1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
23 #include <msvids.h> // KMsvNullIndexEntryId
24 #include <miutstd.hrh> // KUidMsvEmailTextEntryValue
26 // IMail-specific stream type within an IMail file store for CImHeader
27 const TUid KUidMsgFileMimeHeader = {0x1000160F}; // 268441103 decimal
28 // IMail-specific stream type within an IMail file store for CImMimeHeader
29 const TUid KUidMsgFileIMailHeader = {0x100001D8}; // 268435928 decimal
31 // Identifies which version of CImHeader has been stored in stream
32 const TUint16 KImHeaderVersion = 2;
34 const TUid KUidMsvEmailTextEntry = {KUidMsvEmailTextEntryValue};
35 const TUid KUidMsvEmailHtmlEntry = {KUidMsvEmailHtmlEntryValue};
36 const TUid KUidMsvEmailExternalBodyEntry = {KUidMsvEmailExternalBodyEntryValue};
37 const TUid KUidMsvEmailRtfEntry = {KUidMsvEmailRtfEntryValue};
40 _LIT8(KMiutDateFormat, " %S, %2d %S %04d %02d:%02d:%02d ");
41 _LIT8(KMiutMonthNames, "JanFebMarAprMayJunJulAugSepOctNovDec");
42 _LIT8(KMiutDayNames, "MonTueWedThuFriSatSun");
43 _LIT8(KMiutTimeZoneNeg, "-%02d%02d");
44 _LIT8(KMiutTimeZonePos, "+%02d%02d");
46 _LIT8(KMiutBase64String, "Base64");
47 _LIT8(KMiutQPString, "quoted-printable");
48 _LIT8(KMiut7BitString, "7bit");
49 _LIT8(KMiut8BitString, "8bit");
50 _LIT8(KMiutBinaryString, "binary");
51 _LIT8(KMiutUUString, "uuencode");
53 _LIT8(KMiutWildcardBase64, "*base64*");
54 _LIT8(KMiutWildcardQP, "*quoted-printable*");
55 _LIT8(KMiutWildcard7Bit, "*7bit*");
56 _LIT8(KMiutWildcard8Bit, "*8bit*");
57 _LIT8(KMiutWildcardBinary, "*binary*");
58 _LIT8(KMiutWildcardUU, "*uu*");
60 #define KMiutEmptyString KNullDesC
62 _LIT(KMiutFormatString, "%S");
63 _LIT(KImEngineResourceFile, "\\resource\\messaging\\imcm.rsc");
65 const TInt KMiutDateStringLength = 32;
66 const TInt KCenturyThreshold = 100;
67 const TInt KCenturyOffset = 70;
68 const TInt KThisCentury = 1900; // as defined in 1998
69 const TInt KNextCentury = 2000;
74 class RMsvWriteStream;
75 class CImConvertHeader;
76 class CImEncodedHeader;
78 void CopyArrayL(const CDesCArray& aSource, CDesCArray& aDestination);
80 // Maximum size for descriptors stored in HBufC members of CImHeader = 1000 chars
81 const TInt KMaxImHeaderStringLength = 1000;
82 const TInt KMaxImMimeFieldLength = 1000;
83 const TInt KImMailMaxBufferSize = 1000; // 1000 is defined by the SMTP spec as max space
84 const TInt KSmtpMaxBufferExcludingCRLF = 979; // Line length limit is 1000 chars per line including CRLF (RFC2822, Section 2.1.1)
85 // 1000 chars including "Field name: "+"Field body"+CRLF (here "Resent-Message-ID: " is largest field)
88 /** Defines how emails will be encoded when they are sent.
90 MIME standards are defined in RFC 2045, RFC 2046 and RFC 2047.
94 enum TMsgOutboxBodyEncoding
96 /** Emails are sent with the default encoding, which is as for EMsgOutboxMIME. */
98 /** Emails are sent as plain text RFC822 messages.
100 Attachments are encoded using UUEncoding algorithm. This method would not
101 normally be used unless the sender was sure that the receiving mail clients
102 don't support MIME. */
103 EMsgOutboxNoAlgorithm,
104 /** Text is encoded using quoted-printable encoding, and all attachments are encoded
105 using BASE64 encoding.
107 This is the default setting for this option. */
109 /** Text parts of the message are sent as MIME TEXT/HTML parts, and are encoded
110 using UTF-8 encoding system.
112 All attachments are encoded using BASE64 encoding. Receiving mail clients
113 that do no support MHTML mail will display the HTML message text to the user
114 including all HTML tags, etc. */
115 EMsgOutboxMHTMLAsMIME,
116 /** Each text part of the message is sent as two alternative MIME parts.
118 The first part is sent as plain text using quoted-printable encoding, the
119 second part is sent as a TEXT/HTML part which is encoded using UTF-8 encoding
120 system. All attachments are encoded using BASE64 encoding. This is the standard
121 encoding method if the user wishes to send MHTML mail. */
122 EMsgOutboxMHTMLAlternativeAsMIME
125 /** Messaging encoding types.
132 EEncodingTypeUnknown,
138 EEncodingType8Bit, // ie lines still <1000 chars and terminated by CRLF
140 EEncodingTypeBinary, // ie any length of data, not terminated by CRLF
150 // Class used for storing extracting information (to/from header)..
151 // regarding the encoding in an incoming email message header.
152 //----------------------------------------------------------------------------------------
153 class TImHeaderEncodingInfo
154 //----------------------------------------------------------------------------------------
155 /** Stores encoding data found in message headers.
161 /** Message field types. */
164 EFrom, /**< "From" field. */
165 EReplyTo, /**< "Reply To" field. */
166 ETo, /**< "To" field. */
167 ECc, /**< "Cc" field. */
168 EBcc, /**< "Bcc" field. */
169 ESubject /**< Subject field. */
171 /** Encoding types. */
174 EBase64, /**< Base64. */
176 ENoEncoding, /**< No encoding */
181 IMPORT_C TImHeaderEncodingInfo();
182 IMPORT_C TImHeaderEncodingInfo(const TImHeaderEncodingInfo& aFrom);
184 IMPORT_C void ExternalizeL( RWriteStream& aWriteStream ) const;
185 IMPORT_C void InternalizeL( RReadStream& aReadStream );
187 inline void SetField(const TFieldList aField);
188 inline TFieldList Field() const;
190 inline void SetOffset(const TInt aOffset);
191 inline TInt Offset() const;
193 inline void SetLength(const TInt aLength);
194 inline TInt Length() const;
196 inline void SetCharsetUid(const TUint aUid);
197 inline TUint CharsetUid() const;
199 inline void SetEncodingType(const TDesC8& aChar);
200 inline void SetEncodingType(const TEncodingType aType);
201 inline TEncodingType EncodingType() const;
203 inline void SetArrayValue(const TInt aValue);
204 inline TInt ArrayValue() const;
206 inline void SetAddSpace(const TBool atrueFalse);
207 inline TBool AddSpace() const;
209 inline void SetEncodedLength(const TInt aLength);
210 inline TInt EncodedLength() const;
218 TBool iAddSpace; // A space char needs adding between two adjoining 'encoded-words'
219 TUint8 iEncodedLength; // This can be used to determine space needed for buffer.
225 //------------------------------------------------------------------------------
228 class CImHeader : public CBase
229 /** Encapsulates an Internet Mail (RFC822) header.
231 Note that the class contains some obsolete functions that take a narrow descriptor:
232 always use the equivalent wide descriptor function instead.
238 /** Flags used to determine where to obtain the ReplyTo address for the header
239 field of that name. */
242 /** Get address from originator. */
244 /** Get address from sender. */
246 /** Get address from all sources. */
248 /** Get address from recipients. */
252 IMPORT_C static CImHeader* NewLC();
253 IMPORT_C ~CImHeader();
254 IMPORT_C void Reset();
256 // streaming operations
257 IMPORT_C void InternalizeL(RMsvReadStream& aReadStream);
258 IMPORT_C void ExternalizeL(RMsvWriteStream& aWriteStream) const;
259 IMPORT_C void RestoreL(CMsvStore& aMessageStore);
260 IMPORT_C void StoreL (CMsvStore& aMessageStore) const;
261 IMPORT_C void StoreWithoutCommitL(CMsvStore& aMessageStore) const;
263 // the bulk of the member functions are accessors & mutators so we can use
264 // objects of the class as data repositories during the data-marshalling stage
265 // of getting imail headers to/from the internet
266 IMPORT_C const TPtrC Subject() const;
267 IMPORT_C void SetSubjectL(const TDesC8& aSubject);
269 // Internet message ID
270 IMPORT_C const TPtrC8 ImMsgId() const;
271 /** Sets the "MessageId" header field.
273 @param aImMsgIdL Field value */
274 IMPORT_C void SetImMsgIdL(const TDesC8& aImMsgIdL);
276 IMPORT_C const TPtrC From() const;
277 IMPORT_C void SetFromL(const TDesC8& aFrom);
279 IMPORT_C const TPtrC ReplyTo() const;
280 IMPORT_C void SetReplyToL(const TDesC8& aReplyTo);
282 IMPORT_C const TPtrC ReceiptAddress() const;
283 /** Sets the "Receipt" header field.
285 @param aReceiptAddress Field value */
286 IMPORT_C void SetReceiptAddressL(const TDesC8& aReceiptAddress);
288 IMPORT_C TUint Charset() const;
289 IMPORT_C void SetCharset(const TUint aCharset);
291 #if defined (_UNICODE)
292 IMPORT_C void SetFromL(const TDesC16& aFrom);
293 IMPORT_C void SetReplyToL(const TDesC16& aReplyTo);
294 /** Sets the "Receipt" header field.
296 @param aReceiptAddress Field value */
297 IMPORT_C void SetReceiptAddressL(const TDesC16& aReceiptAddress);
298 IMPORT_C void SetSubjectL(const TDesC16& aSubject);
301 IMPORT_C TInt DataSize();
303 inline const TUint RemoteSize() const;
304 inline void SetRemoteSize(TUint aSize);
306 inline const TUint16 Version() const;
307 inline void SetVersion(TUint16 aVersion);
309 // give const access to the recipient lists
310 inline const CDesCArray& ToRecipients () const;
311 inline const CDesCArray& CcRecipients () const;
312 inline const CDesCArray& BccRecipients() const;
314 // give non-const access to the recipient lists
315 inline CDesCArray& ToRecipients () ;
316 inline CDesCArray& CcRecipients () ;
317 inline CDesCArray& BccRecipients() ;
319 inline CArrayFix<TImHeaderEncodingInfo>& EncodingInfo() ;
320 inline const CArrayFix<TImHeaderEncodingInfo>& EncodingInfo() const;
322 IMPORT_C void AddEncodingInfoL(TImHeaderEncodingInfo& aInfo);
324 //-------------------------------------------------------------------------------------
325 //----------------------Used for forwarding/replying to an email ----------------------
327 IMPORT_C const TPtrC8 ResentMsgId() const;
328 IMPORT_C void SetResentMsgIdL( const TDesC8& );
330 IMPORT_C const TPtrC ResentFrom() const;
331 IMPORT_C void SetResentFromL( const TDesC& );
333 // give const access to the recipient lists
334 inline const CDesCArray& ResentToRecipients () const;
335 inline const CDesCArray& ResentCcRecipients () const;
336 inline const CDesCArray& ResentBccRecipients() const;
338 // give non-const access to the recipient lists
339 inline CDesCArray& ResentToRecipients ();
340 inline CDesCArray& ResentCcRecipients ();
341 inline CDesCArray& ResentBccRecipients();
343 IMPORT_C const TPtrC8 InReplyTo() const;
344 IMPORT_C void SetInReplyToL(const TDesC8&);
346 IMPORT_C TInt CreateForwardL(CImHeader&, TDesC&);
347 IMPORT_C TInt CreateReplyL(CImHeader&, TReplyTo, TDesC&);
348 IMPORT_C void CreateReceiptL(CImHeader&, TDesC&);
350 //-------------------------------------------------------------------------------------
351 //-------------------------------------------------------------------------------------
353 // Body Encoding (charset) stored on a per message basis
354 IMPORT_C TMsgOutboxBodyEncoding BodyEncoding() const;
355 IMPORT_C void SetBodyEncoding(TMsgOutboxBodyEncoding aMessageBodyEncoding);
357 IMPORT_C void ReDecodeL(RFs& aFS);
358 IMPORT_C TUint OverrideCharset() const;
359 IMPORT_C void SetOverrideCharset(TUint aCharset);
360 IMPORT_C void SaveEncodedHeadersL();
366 // these four functions keep the line count down as there are several instances
367 // of streaming in/out HBufC objects.
368 void ReadRecipientsL ( RReadStream&, CDesCArray* );
369 void WriteRecipientsL( RWriteStream&, const CDesCArray* ) const;
370 void FormatSubjectL(CImHeader&, TDesC&);
372 //finds the duplicate recipients in To and Cc list
373 TBool IsRecipientPresent(CImHeader& aCImHeader, TPtrC16 newRecipient);
389 //-------------------------------------------------------------------------------------
390 //----------------------Used for forwarding/replying to an email ----------------------
393 HBufC8* iResentMsgId;
394 CDesCArray* iResentTo;
395 CDesCArray* iResentCc;
396 CDesCArray* iResentBcc;
399 //-------------------------------------------------------------------------------------
400 //-------------------------------------------------------------------------------------
401 CArrayFix<TImHeaderEncodingInfo>* iEncodingInfo;
402 TMsgOutboxBodyEncoding iBodyEncoding;
403 // The character set to be when sending message.
404 // Overrides the charset passed in from the settings.
405 TUint i822HeaderCharset;
407 CImEncodedHeader* iEncodedHeader;
410 class TImRfc822DateField
417 IMPORT_C TInt ParseDateField(const TDesC8& aRfc822DateField, TTime& rTime);
418 IMPORT_C void SetDate(const TTime& aTimeDate, TDes8& rOutputLine); // NB assumes that "Date: " string has already been inserted into rOutputLine
421 TBool GetMonth( const TDesC8& name, TMonth& month );
422 TBool GetTimezone( const TDesC8& name, TInt& minsOffset );
426 /** Folder type flags.
428 The flags correspond to the MIME multipart subtype.
432 enum TImEmailFolderType
443 EFolderTypeAlternative,
451 EFolderTypeDirectory,
456 /** Describes the types of off-line email operations than can occur.
458 @see TMsvEmailEntry::DisconnectedOperation()
462 enum TImDisconnectedOperationType
465 ENoDisconnectedOperations,
466 /** Create operation. */
467 EDisconnectedCreateOperation,
468 /** Delete operation. */
469 EDisconnectedDeleteOperation,
470 /** Change operation. */
471 EDisconnectedChangeOperation,
472 /** "Copy to" operation. */
473 EDisconnectedCopyToOperation,
474 /** "Copy from" operation. */
475 EDisconnectedCopyFromOperation,
476 /** "Copy within service" operation. */
477 EDisconnectedCopyWithinServiceOperation,
478 /** "Move to" operation. */
479 EDisconnectedMoveToOperation,
480 /** "Move from" operation. */
481 EDisconnectedMoveFromOperation,
482 /** "Move within service" operation. */
483 EDisconnectedMoveWithinServiceOperation,
484 /** Special operation. */
485 EDisconnectedSpecialOperation,
486 /** Unknown operation. */
487 EDisconnectedUnknownOperation,
488 /** Multiple operations. */
489 EDisconnectedMultipleOperation
492 // Remote folder message count limited to TUint16 by using lower 16 bits of "iMtmData3".
493 // Note: The upper 16 bits of "iMtmData3" are not currently used by "TMsvEmailEntry".
494 const TUint KMsvRemoteFolderEntriesMask = 0x0000FFFF;
496 class TMsvEmailEntry : public TMsvEntry
497 /** Provides storage for and access to extra email specific information for a message.
499 To get a TMsvEmailEntry, get the entry's TMsvEntry, e.g. using
500 @c CMsvEntry::Entry(), and use the constructor that takes a TMsvEntry parameter.
502 Many of the flags are only used by IMAP4 entries. These can be grouped as follows:
504 - IMAP-specific flags, as defined by the IMAP protocol (see RFC3501, 2.3.2. Flags Message Attribute)
505 - GetIMAP4Flags() and SetIMAP4Flags() handle all the flags as a group
506 - \\Seen flag: SetSeenIMAP4Flag(), SeenIMAP4Flag().
507 - \\Answered flag: SetAnsweredIMAP4Flag(), AnsweredIMAP4Flag()
508 - \\Flagged flag: SetFlaggedIMAP4Flag(), FlaggedIMAP4Flag()
509 - \\Deleted flag: SetDeletedIMAP4Flag(), DeletedIMAP4Flag()
510 - \\Draft flag: SetDraftIMAP4Flag(), DraftIMAP4Flag()
511 - \\Recent flag: SetRecentIMAP4Flag(), RecentIMAP4Flag()
512 - Folder subscriptions and other folder-related flags:
513 - SetMailbox(), Mailbox(),
514 - SetSubscribed(), Subscribed(),
515 - SetLocalSubscription(), LocalSubscription()
516 - SetRemoteFolderEntries(), RemoteFolderEntries()
517 - Disconnected operation information:
518 - SetDisconnectedOperation(), DisconnectedOperation().
519 - Partial download flags: these flags allow a client to test if a message or its body has
520 been partially downloaded (see TImImap4GetPartialMailInfo)
521 - SetPartialDownloaded(), PartialDownloaded()
522 - SetBodyTextComplete(), BodyTextComplete()
523 - UID information: IMAP messages have a unique identifier number (see
524 RFC3501, 2.3.1.1. Unique Identifier (UID) Message Attribute)
525 - SetValidUID(), ValidUID()
528 The following flags are set only by the IMAP MTM. They indicate if the
529 message contains a vCard, vCalendar (http://www.imc.org), or iCalendar (RFC 2445) attachment.
531 - VCard(), SetVCard()
532 - VCalendar(), SetVCalendar()
533 - ICalendar(), SetICalendar()
535 The following flags apply to all email protocols:
537 - Receipt requested: Receipt(), SetReceipt()
538 - MHTML content: MHTMLEmail(), SetMHTMLEmail()
540 Note that the email specific data is stored in the reserved data members @c iMtmData1,
541 @c iMtmData2 and @c iMtmData3 of the TMsvEntry base class. These public data members
542 must not be directly altered by clients.
549 public: // Public member functions
550 IMPORT_C TMsvEmailEntry(); // default constructor
551 IMPORT_C TMsvEmailEntry(const TMsvEntry& aGenericEntry);
553 IMPORT_C TBool operator==(const TMsvEntry& aEntry) const;
554 IMPORT_C TBool operator==(const TMsvEmailEntry& aEntry) const;
556 IMPORT_C void GetIMAP4Flags(TBool& rUnread,TBool& rSeen,TBool& rAnswered,TBool& rFlagged,TBool& rDeleted,TBool& rDraft,TBool& rRecent);
557 IMPORT_C void SetIMAP4Flags(TBool aUnread,TBool aSeen,TBool aAnswered,TBool aFlagged,TBool aDeleted,TBool aDraft,TBool aRecent);
559 IMPORT_C void SetMessageFolderType(TImEmailFolderType aFolderType);
560 IMPORT_C TImEmailFolderType MessageFolderType() const;
562 IMPORT_C void SetDisconnectedOperation(TImDisconnectedOperationType aDisconnectedOperationType);
563 IMPORT_C TImDisconnectedOperationType DisconnectedOperation() const;
565 IMPORT_C void SetPartialDownloaded(TBool aPartialDownloaded);
566 IMPORT_C TBool PartialDownloaded() const;
569 inline void SetEncrypted(TBool aEncrypt);
570 inline TBool Encrypted() const;
572 inline void SetSigned(TBool aSignature);
573 inline TBool Signed() const;
575 inline TBool VCard() const;
576 inline void SetVCard(TBool aVCard);
578 inline TBool VCalendar() const;
579 inline void SetVCalendar(TBool aVCal);
581 inline TBool ICalendar() const;
582 inline void SetICalendar(TBool aICal);
584 inline TBool Receipt() const;
585 inline void SetReceipt(TBool aReceipt);
587 inline TBool MHTMLEmail() const;
588 inline void SetMHTMLEmail(TBool aMhtml);
590 inline TBool BodyTextComplete() const;
591 inline void SetBodyTextComplete(TBool aFlag);
594 // IMAP4-specific flags
596 inline void SetUnreadIMAP4Flag(TBool aUnread);
597 inline TBool UnreadIMAP4Flag() const;
599 inline void SetSeenIMAP4Flag(TBool aSeen);
600 inline TBool SeenIMAP4Flag() const;
602 inline void SetAnsweredIMAP4Flag(TBool aAnswered);
603 inline TBool AnsweredIMAP4Flag() const;
605 inline void SetFlaggedIMAP4Flag(TBool aFlagged);
606 inline TBool FlaggedIMAP4Flag() const;
608 inline void SetDeletedIMAP4Flag(TBool aDeleted);
609 inline TBool DeletedIMAP4Flag() const;
611 inline void SetDraftIMAP4Flag(TBool aDraft);
612 inline TBool DraftIMAP4Flag() const;
614 inline void SetRecentIMAP4Flag(TBool aRecent);
615 inline TBool RecentIMAP4Flag() const;
617 inline void SetMailbox(TBool aMailbox);
618 inline TBool Mailbox() const;
620 inline TBool Orphan() const;
622 inline void SetOrphan(TBool aOrphan);
624 inline void SetValidUID(TBool aValid);
625 inline TBool ValidUID() const;
627 inline void SetSubscribed(TBool aSubscribed);
628 inline TBool Subscribed() const;
630 inline void SetLocalSubscription(TBool aLocal); // i.e. is subscription local, or remote
631 inline TBool LocalSubscription() const;
633 inline void SetUID(TUint32 aUid);
634 inline TUint32 UID() const;
636 inline TInt RemoteFolderEntries() const;
637 inline void SetRemoteFolderEntries(TInt aEntries);
640 enum TMsvEmailEntryFlags
642 KMsvEmailEntryClearFlag =0x00,
643 // Flags set on Message entries...
644 KMsvEmailEntryEncryptedFlag =0x00000001,
645 KMsvEmailEntrySignedFlag =0x00000002,
646 KMsvEmailEntryReceiptFlag =0x00000004,
647 KMsvEmailEntryOrphanFlag =0x00000008,
649 // VCard and VCalendar entries may be set on folders or attachments
650 KMsvEmailEntryVCardFlag =0x00000010,
651 KMsvEmailEntryVCalendarFlag =0x00000020,
653 // Message contains HTML data
654 // (Note: HTML and not only MHTML)
655 KMsvEmailEntryMHTMLFlag = 0x00000040,
656 KMsvEmailEntryBodyTextCompleteFlag = 0x00000080,
658 KMsvEmailEntryNoDisconnectedOperations = 0x00000000,
659 KMsvEmailEntryDisconnectedCreateOperation = 0x00000100,
660 KMsvEmailEntryDisconnectedDeleteOperation = 0x00000200,
661 KMsvEmailEntryDisconnectedChangeOperation = 0x00000300,
662 KMsvEmailEntryDisconnectedCopyToOperation = 0x00000400,
663 KMsvEmailEntryDisconnectedCopyFromOperation = 0x00000500,
664 KMsvEmailEntryDisconnectedCopyWithinServiceOperation = 0x00000600,
665 KMsvEmailEntryDisconnectedMoveToOperation = 0x00000700,
666 KMsvEmailEntryDisconnectedMoveFromOperation = 0x00000800,
667 KMsvEmailEntryDisconnectedMoveWithinServiceOperation = 0x00000900,
668 KMsvEmailEntryDisconnectedSpecialOperation = 0x00000A00,
669 KMsvEmailEntryDisconnectedUnknownOperation = 0x00000B00,
670 KMsvEmailEntryDisconnectedMultipleOperation = 0x00000C00,
671 KMsvEmailEntryDisconnectedOperation = 0x00000F00,
673 // IMAP4-specific masks. Can be re-used by non-IMAP4 entries (eg POP3, SMTP)
674 KMsvEmailEntryIMAP4SubscribedFlag =0x00001000,
675 KMsvEmailEntryIMAP4UnreadFlag =0x00002000,
676 KMsvEmailEntryIMAP4SeenFlag =0x00004000,
677 KMsvEmailEntryIMAP4AnsweredFlag =0x00008000,
678 KMsvEmailEntryIMAP4FlaggedFlag =0x00010000,
679 KMsvEmailEntryIMAP4DeletedFlag =0x00020000,
680 KMsvEmailEntryIMAP4DraftFlag =0x00040000,
681 KMsvEmailEntryIMAP4RecentFlag =0x00080000,
682 KMsvEmailEntryIMAP4ValidUIDFlag =0x00100000,
683 KMsvEmailEntryIMAP4MailboxFlag =0x00200000,
684 KMsvEmailEntryIMAP4LocalSubFlag =0x00400000,
686 // MIME "multipart" types assigned to folders.
687 KMsvMimeFolderUnknownMask =0x00000000,
688 KMsvMimeFolderRelatedMask =0x01000000,
689 KMsvMimeFolderMixedMask =0x02000000,
690 KMsvMimeFolderAlternativeMask =0x03000000,
691 KMsvMimeFolderParallelMask =0x04000000,
692 KMsvMimeFolderDigestMask =0x05000000,
694 // MIME message types
695 KMsvMimeFolderRFC822Mask =0x06000000,
696 KMsvMimeFolderPartialMask =0x07000000,
697 KMsvMimeFolderDirectoryMask =0x08000000, // for VCard, VCalendar types
698 KMsvMimeFolderExternalMask =0x09000000,
699 KMsvMimeFolderMask =0x0F000000,
701 // Can be used by POP3 and IMAP4 MTMs.
702 KMsvEmailEntryPartialDownloadFlag =0x10000000,
704 KMsvEmailEntryICalendarFlag =0x20000000
709 const TUint16 KImMimeHeaderVersion = 2; // identify which version of this class has been stored
711 class CImMimeHeader : public CBase
712 /** Stores a MIME email header.
718 IMPORT_C static CImMimeHeader* NewLC();
719 IMPORT_C static CImMimeHeader* NewL();
720 IMPORT_C ~CImMimeHeader();
721 IMPORT_C void Reset();
722 IMPORT_C TInt Size(); // number of header fields stored in object
724 // streaming operations
725 IMPORT_C void InternalizeL( RMsvReadStream& aReadStream );
726 IMPORT_C void ExternalizeL( RMsvWriteStream& aWriteStream ) const;
727 IMPORT_C void RestoreL( CMsvStore& aMessageStore );
728 IMPORT_C void StoreL ( CMsvStore& aMessageStore ) const;
729 IMPORT_C void StoreWithoutCommitL(CMsvStore& aMessageStore) const;
731 /** Sets the Content-Type field value (e.g. "text" in Content-Type:text/plain).
733 The value is MIME defined and should always be 8-bit.
735 @param aPath Field value */
736 IMPORT_C void SetContentTypeL(const TDesC8& aPath);
737 IMPORT_C const TPtrC8 ContentType() const;
739 /** Sets the Content-Type subtype field value (e.g. "plain" in Content-Type:text/plain).
742 The value is MIME defined and should always be 8-bit.
744 @param aPath Field value */
745 IMPORT_C void SetContentSubTypeL(const TDesC8& aPath);
746 IMPORT_C const TPtrC8 ContentSubType() const;
748 /** Sets the Content-Disposition field value (either inline or attachment).
750 The value is MIME defined and should always be 8-bit.
752 @param aPath Field value */
753 IMPORT_C void SetContentDispositionL(const TDesC8& aPath);
754 IMPORT_C const TPtrC8 ContentDisposition() const;
756 /** Sets the Content-Description field value.
758 The value is MIME defined and should always be 8-bit.
760 @param aPath Field value */
761 IMPORT_C void SetContentDescriptionL(const TDesC8& aPath);
762 IMPORT_C const TPtrC8 ContentDescription() const;
764 /** Sets the Content-Base field value.
766 @param aPath Field value */
767 IMPORT_C void SetContentBaseL(const TDesC8& aPath);
768 IMPORT_C const TPtrC8 ContentBase() const;
770 /** Sets the Content-ID field value.
772 @param aPath Field value */
773 IMPORT_C void SetContentIDL(const TDesC8& aPath);
774 IMPORT_C const TPtrC8 ContentID() const;
776 /** Sets the Content-Location field value.
778 @param aPath Field value */
779 IMPORT_C void SetContentLocationL(const TDesC16& aPath);
780 IMPORT_C const TPtrC16 ContentLocation() const;
782 // IMAP-specific info describing relative location of entry w.r.t. parent Email message
783 /** Sets IMAP-specific information for the relative location of the entry to the
784 parent email message.
786 @param aPath Relative location */
787 IMPORT_C void SetRelativePathL(const TDesC8& aPath);
788 IMPORT_C const TPtrC8 RelativePath() const;
790 /** Sets the Content-Transfer-Encoding field value.
792 @param aType Field value */
793 IMPORT_C void SetContentTransferEncodingL(const TDesC8& aType);
794 IMPORT_C TImEncodingType ContentTransferEncoding() const;
795 IMPORT_C TImEncodingType ContentTransferEncoding(TDes8& rType) const;
796 IMPORT_C const TPtrC8 GetContentTypeValue(const TDesC8& aContentTypeParameter) const;
798 // inlines to access arrays
799 inline const CDesC8Array& ContentTypeParams() const;
800 inline const CDesC8Array& ContentDispositionParams() const;
801 inline const CDesC8Array& XTypeParams() const;
803 inline CDesC8Array& ContentTypeParams();
804 inline CDesC8Array& ContentDispositionParams();
805 inline CDesC8Array& XTypeParams(); // anything else that is in the header, but not recognised
807 inline const TUint16 Version() const;
808 inline void SetVersion( TUint16 aVersion );
810 IMPORT_C void SetMimeCharset(const TUint aCharset);
811 IMPORT_C TUint MimeCharset() const;
816 TBool ArrayEntryExists(CDesCArray& aArray, TInt aField);
820 HBufC8* iRelativePath;
821 HBufC8* iContentDescription;
823 TImEncodingType iContentTransferEncoding;
826 HBufC8* iContentBase;
827 HBufC16* iContentLocation;
830 HBufC8* iContentType;
831 HBufC8* iContentSubType;
832 HBufC8* iContentDisposition;
834 CDesC8Array* iContentTypeParams; // zero or more "parameter"
835 CDesC8Array* iContentDispositionParams; // zero or more "parameters"
836 CDesC8Array* iXTypeParams; // zero or more X-Type "parameters"
838 TBuf<20> iContentTransferEncodingBuffer; // must be big enough to store "quoted-printable" string
840 // The uid value is always used in preference to the stored string.
841 // Only when the uid is not set is the string used when sending.
847 #include <miuthdr.inl>
849 #endif // #defined __MIUTHDR_H__