21 #include <tqptrlist.h>
24 #include "mimehdrline.h"
26 #include "rfcdecoder.h"
39 virtual void outputHeader (
mimeIO &);
40 virtual void outputPart (
mimeIO &);
43 TQCString outputParameter (TQDict < TQString > *);
45 int parsePart (
mimeIO &,
const TQString&);
46 int parseBody (
mimeIO &, TQCString &,
const TQString&,
bool mbox =
false);
49 bool parseHeader (
mimeIO &);
51 TQString getDispositionParm (
const TQCString&);
52 void setDispositionParm (
const TQCString&,
const TQString&);
53 TQDictIterator < TQString > getDispositionIterator ();
55 TQString getTypeParm (
const TQCString&);
56 void setTypeParm (
const TQCString&,
const TQString&);
57 TQDictIterator < TQString > getTypeIterator ();
60 void serialize(TQDataStream& stream);
62 const TQCString& getType ()
66 void setType (
const TQCString & _str)
71 const TQCString& getDescription ()
73 return _contentDescription;
75 void setDescription (
const TQCString & _str)
77 _contentDescription = _str;
80 TQCString getDisposition ()
82 return _contentDisposition;
84 void setDisposition (
const TQCString & _str)
86 _contentDisposition = _str;
89 TQCString getEncoding ()
91 return contentEncoding;
93 void setEncoding (
const TQCString & _str)
95 contentEncoding = _str;
102 void setMD5 (
const TQCString & _str)
111 void setID (
const TQCString & _str)
116 unsigned long getLength ()
118 return contentLength;
120 void setLength (
unsigned long _len)
122 contentLength = _len;
125 const TQString & getPartSpecifier ()
127 return partSpecifier;
129 void setPartSpecifier (
const TQString & _str)
131 partSpecifier = _str;
134 TQPtrListIterator < mimeHdrLine > getOriginalIterator ();
135 TQPtrListIterator < mimeHdrLine > getAdditionalIterator ();
136 void setContent (
const TQCString &aContent)
138 mimeContent = aContent;
140 TQCString getContent ()
147 return preMultipartBody + postMultipartBody;
149 TQCString getPreBody ()
151 return preMultipartBody;
153 void setPreBody (TQCString & inBody)
155 preMultipartBody = inBody;
158 TQCString getPostBody ()
160 return postMultipartBody;
162 void setPostBody (TQCString & inBody)
164 postMultipartBody = inBody;
165 contentLength = inBody.length ();
170 return nestedMessage;
172 void setNestedMessage (
mimeHeader * inPart,
bool destroy =
true)
174 if (nestedMessage && destroy)
175 delete nestedMessage;
176 nestedMessage = inPart;
182 nestedParts.append (inPart);
184 TQPtrListIterator < mimeHeader > getNestedIterator ()
186 return TQPtrListIterator < mimeHeader > (nestedParts);
190 void clearNestedParts ()
192 nestedParts.clear ();
196 void clearTypeParameters ()
202 void clearDispositionParameters ()
204 dispositionList.clear ();
210 #ifdef KMAIL_COMPATIBLE
213 return contentLength;
217 return nestedParts.count ();
222 (*ret) = nestedParts.at (which);
223 return nestedParts.at (which);
225 void write (
const TQString &)
230 return TQString (contentType.left (contentType.find (
'/')));
232 void setTypeStr (
const TQString & _str)
234 contentType = TQCString (_str.latin1 ()) +
"/" + subtypeStr ().latin1 ();
236 TQString subtypeStr ()
238 return TQString (contentType.
239 right (contentType.length () - contentType.find (
'/') -
242 void setSubtypeStr (
const TQString & _str)
244 contentType = TQCString (typeStr ().latin1 ()) +
"/" + _str.latin1 ();
248 return TQString (getEncoding ());
250 void setCteStr (
const TQString & _str)
252 setEncoding (_str.latin1 ());
254 TQString contentDisposition ()
256 return TQString (_contentDisposition);
260 return TQString (postMultipartBody);
264 return getTypeParm (
"charset");
266 TQString bodyDecoded ();
267 void setBodyEncoded (
const TQByteArray &);
268 void setBodyEncodedBinary (
const TQByteArray &);
269 TQByteArray bodyDecodedBinary ();
272 return TQString (getTypeParm (
"name"));
274 void setName (
const TQString & _str)
276 setTypeParm (
"name", _str);
280 return TQString (getDispositionParm (
"filename"));
282 TQString contentDescription ()
286 void setContentDescription (
const TQString & _str)
292 return TQString (contentMD5);
294 TQString iconName ();
295 TQString magicSetType (
bool aAutoDecode =
true);
296 TQString headerAsString ();
301 void fromString (
const TQByteArray &)
304 void setContentDisposition (
const TQString & _str)
306 setDisposition (_str.latin1 ());
311 static void addParameter (
const TQCString&, TQDict < TQString > *);
312 static TQString getParameter (
const TQCString&, TQDict < TQString > *);
313 static void setParameter (
const TQCString&,
const TQString&, TQDict < TQString > *);
315 TQPtrList < mimeHdrLine > originalHdrLines;
318 TQPtrList < mimeHdrLine > additionalHdrLines;
319 TQDict < TQString > typeList;
320 TQDict < TQString > dispositionList;
321 TQCString contentType;
322 TQCString _contentDisposition;
323 TQCString contentEncoding;
324 TQCString _contentDescription;
326 TQCString contentMD5;
327 unsigned long contentLength;
328 TQCString mimeContent;
329 TQCString preMultipartBody;
330 TQCString postMultipartBody;
332 TQPtrList < mimeHeader > nestedParts;
333 TQString partSpecifier;
static const TQString decodeRFC2047String(const TQString &_str, TQString &charset, TQString &language)
decode a RFC2047 String
static const TQString encodeRFC2047String(const TQString &_str, TQString &charset, TQString &language)
encode a RFC2047 String