From 5df79c53745fde5d6c3340a2979b1429cd5892c1 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sat, 8 Oct 2011 20:30:28 +0200 Subject: Initial import of htcd system 1.0 Signed-off-by: Henrik Rydberg --- src/mime/test.cc | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 src/mime/test.cc (limited to 'src/mime/test.cc') diff --git a/src/mime/test.cc b/src/mime/test.cc new file mode 100644 index 0000000..6392904 --- /dev/null +++ b/src/mime/test.cc @@ -0,0 +1,108 @@ +/************************************************************************* + * + * HTCd - Copyright (C) 1998-2006 Henrik Rydberg + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include + +static fp_stream mout(stdout),merr(stderr); + +static void Show(mstream& out,const Message& msg) +{ + if(msg.cont_type.empty()|| + eqn(msg.cont_type,mime_textplain)|| + eqn(msg.cont_type,mime_texthtml)) { + if(eqn(msg.cont_trans_enc,trans_quote)) { + //decodeQP(out,msg.body); + mswrite tmp; + decodeQP(tmp,msg.body); + encodeQP(out,tmp.str()); + } + else { + //out< [index]\n"; + return 1; + } + Mailbox box; + GetMessages(box,argv[1]); + merr<<"Found "<2) { + Message msg(box[atoi(argv[2])]); + //msg.Pick(mime_textplain); + + mswrite tmp; + encodeHeader(tmp,mime_default,msg.subject); + msg.subject=tmp.str(); + + msg.putHead(mout); + mout<<"-----------------------------------------\n"; + rpile part; + if(msg.Multipart(part)) { + for(int i=0;i\n"; + return 1; + } + mstring buffer; buffer.load(argv[1]); + merr<