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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
30 #include <msvids.h> // KMsvNullIndexEntryId
31 #include <miutstd.hrh> // KUidMsvEmailTextEntryValue
32 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
33 #include "timrfc822datefield.h"
36 * IMail-specific stream type within an IMail file store for CImHeader
40 const TUid KUidMsgFileMimeHeader = {0x1000160F}; // 268441103 decimal
42 * IMail-specific stream type within an IMail file store for CImMimeHeader
46 const TUid KUidMsgFileIMailHeader = {0x100001D8}; // 268435928 decimal
55 class RMsvWriteStream;
60 class CImEncodedHeader;
62 /** Defines how emails will be encoded when they are sent.
64 MIME standards are defined in RFC 2045, RFC 2046 and RFC 2047.
68 enum TMsgOutboxBodyEncoding
70 /** Emails are sent with the default encoding, which is as for EMsgOutboxMIME. */
72 /** Emails are sent as plain text RFC822 messages.
74 Attachments are encoded using UUEncoding algorithm. This method would not
75 normally be used unless the sender was sure that the receiving mail clients
76 don't support MIME. */
77 EMsgOutboxNoAlgorithm,
78 /** Text is encoded using quoted-printable encoding, and all attachments are encoded
79 using BASE64 encoding.
81 This is the default setting for this option. */
83 /** Text parts of the message are sent as MIME TEXT/HTML parts, and are encoded
84 using UTF-8 encoding system.
86 All attachments are encoded using BASE64 encoding. Receiving mail clients
87 that do no support MHTML mail will display the HTML message text to the user
88 including all HTML tags, etc. */
89 EMsgOutboxMHTMLAsMIME,
90 /** Each text part of the message is sent as two alternative MIME parts.
92 The first part is sent as plain text using quoted-printable encoding, the
93 second part is sent as a TEXT/HTML part which is encoded using UTF-8 encoding
94 system. All attachments are encoded using BASE64 encoding. This is the standard
95 encoding method if the user wishes to send MHTML mail. */
96 EMsgOutboxMHTMLAlternativeAsMIME
99 /** Messaging encoding types.
106 EEncodingTypeUnknown,
112 EEncodingType8Bit, // ie lines still <1000 chars and terminated by CRLF
114 EEncodingTypeBinary, // ie any length of data, not terminated by CRLF
124 // Class used for storing extracting information (to/from header)..
125 // regarding the encoding in an incoming email message header.
126 //----------------------------------------------------------------------------------------
127 class TImHeaderEncodingInfo
128 //----------------------------------------------------------------------------------------
129 /** Stores encoding data found in message headers.
135 /** Message field types. */
138 EFrom, /**< "From" field. */
139 EReplyTo, /**< "Reply To" field. */
140 ETo, /**< "To" field. */
141 ECc, /**< "Cc" field. */
142 EBcc, /**< "Bcc" field. */
143 ESubject /**< Subject field. */
145 /** Encoding types. */
148 EBase64, /**< Base64. */
150 ENoEncoding, /**< No encoding */
155 IMPORT_C TImHeaderEncodingInfo();
156 IMPORT_C TImHeaderEncodingInfo(const TImHeaderEncodingInfo& aFrom);
158 IMPORT_C void ExternalizeL( RWriteStream& aWriteStream ) const;
159 IMPORT_C void InternalizeL( RReadStream& aReadStream );
161 inline void SetField(const TFieldList aField);
162 inline TFieldList Field() const;
164 inline void SetOffset(const TInt aOffset);
165 inline TInt Offset() const;
167 inline void SetLength(const TInt aLength);
168 inline TInt Length() const;
170 inline void SetCharsetUid(const TUint aUid);
171 inline TUint CharsetUid() const;
173 inline void SetEncodingType(const TDesC8& aChar);
174 inline void SetEncodingType(const TEncodingType aType);
175 inline TEncodingType EncodingType() const;
177 inline void SetArrayValue(const TInt aValue);
178 inline TInt ArrayValue() const;
180 inline void SetAddSpace(const TBool atrueFalse);
181 inline TBool AddSpace() const;
183 inline void SetEncodedLength(const TInt aLength);
184 inline TInt EncodedLength() const;
192 TBool iAddSpace; // A space char needs adding between two adjoining 'encoded-words'
193 TUint8 iEncodedLength; // This can be used to determine space needed for buffer.
199 //------------------------------------------------------------------------------
202 class CImHeader : public CBase
203 /** Encapsulates an Internet Mail (RFC822) header.
205 Note that the class contains some obsolete functions that take a narrow descriptor:
206 always use the equivalent wide descriptor function instead.
212 /** Flags used to determine where to obtain the ReplyTo address for the header
213 field of that name. */
216 /** Get address from originator. */
218 /** Get address from sender. */
220 /** Get address from all sources. */
222 /** Get address from recipients. */
226 IMPORT_C static CImHeader* NewLC();
227 IMPORT_C ~CImHeader();
228 IMPORT_C void Reset();
230 // streaming operations
231 IMPORT_C void InternalizeL(RMsvReadStream& aReadStream);
232 IMPORT_C void ExternalizeL(RMsvWriteStream& aWriteStream) const;
233 IMPORT_C void RestoreL(CMsvStore& aMessageStore);
234 IMPORT_C void StoreL (CMsvStore& aMessageStore) const;
235 IMPORT_C void StoreWithoutCommitL(CMsvStore& aMessageStore) const;
238 // the bulk of the member functions are accessors & mutators so we can use
239 // objects of the class as data repositories during the data-marshalling stage
240 // of getting imail headers to/from the internet
241 IMPORT_C const TPtrC Subject() const;
242 IMPORT_C void SetSubjectL(const TDesC8& aSubject);
244 // Internet message ID
245 IMPORT_C const TPtrC8 ImMsgId() const;
246 /** Sets the "MessageId" header field.
248 @param aImMsgIdL Field value */
249 IMPORT_C void SetImMsgIdL(const TDesC8& aImMsgIdL);
251 IMPORT_C const TPtrC From() const;
252 IMPORT_C void SetFromL(const TDesC8& aFrom);
254 IMPORT_C const TPtrC ReplyTo() const;
255 IMPORT_C void SetReplyToL(const TDesC8& aReplyTo);
257 IMPORT_C const TPtrC ReceiptAddress() const;
258 /** Sets the "Receipt" header field.
260 @param aReceiptAddress Field value */
261 IMPORT_C void SetReceiptAddressL(const TDesC8& aReceiptAddress);
263 IMPORT_C TUint Charset() const;
264 IMPORT_C void SetCharset(const TUint aCharset);
266 #if defined (_UNICODE)
267 IMPORT_C void SetFromL(const TDesC16& aFrom);
268 IMPORT_C void SetReplyToL(const TDesC16& aReplyTo);
269 /** Sets the "Receipt" header field.
271 @param aReceiptAddress Field value */
272 IMPORT_C void SetReceiptAddressL(const TDesC16& aReceiptAddress);
273 IMPORT_C void SetSubjectL(const TDesC16& aSubject);
276 IMPORT_C TInt DataSize();
278 inline const TUint RemoteSize() const;
279 inline void SetRemoteSize(TUint aSize);
281 inline const TUint16 Version() const;
282 inline void SetVersion(TUint16 aVersion);
284 // give const access to the recipient lists
285 inline const CDesCArray& ToRecipients () const;
286 inline const CDesCArray& CcRecipients () const;
287 inline const CDesCArray& BccRecipients() const;
289 // give non-const access to the recipient lists
290 inline CDesCArray& ToRecipients () ;
291 inline CDesCArray& CcRecipients () ;
292 inline CDesCArray& BccRecipients() ;
294 inline CArrayFix<TImHeaderEncodingInfo>& EncodingInfo() ;
295 inline const CArrayFix<TImHeaderEncodingInfo>& EncodingInfo() const;
297 IMPORT_C void AddEncodingInfoL(TImHeaderEncodingInfo& aInfo);
299 //-------------------------------------------------------------------------------------
300 //----------------------Used for forwarding/replying to an email ----------------------
302 IMPORT_C const TPtrC8 ResentMsgId() const;
303 IMPORT_C void SetResentMsgIdL( const TDesC8& );
305 IMPORT_C const TPtrC ResentFrom() const;
306 IMPORT_C void SetResentFromL( const TDesC& );
308 // give const access to the recipient lists
309 inline const CDesCArray& ResentToRecipients () const;
310 inline const CDesCArray& ResentCcRecipients () const;
311 inline const CDesCArray& ResentBccRecipients() const;
313 // give non-const access to the recipient lists
314 inline CDesCArray& ResentToRecipients ();
315 inline CDesCArray& ResentCcRecipients ();
316 inline CDesCArray& ResentBccRecipients();
318 IMPORT_C const TPtrC8 InReplyTo() const;
319 IMPORT_C void SetInReplyToL(const TDesC8&);
321 IMPORT_C TInt CreateForwardL(CImHeader&, TDesC&);
322 IMPORT_C TInt CreateReplyL(CImHeader&, TReplyTo, TDesC&);
323 IMPORT_C void CreateReceiptL(CImHeader&, TDesC&);
325 //-------------------------------------------------------------------------------------
326 //-------------------------------------------------------------------------------------
328 // Body Encoding (charset) stored on a per message basis
329 IMPORT_C TMsgOutboxBodyEncoding BodyEncoding() const;
330 IMPORT_C void SetBodyEncoding(TMsgOutboxBodyEncoding aMessageBodyEncoding);
332 IMPORT_C void ReDecodeL(RFs& aFS);
333 IMPORT_C TUint OverrideCharset() const;
334 IMPORT_C void SetOverrideCharset(TUint aCharset);
335 IMPORT_C void SaveEncodedHeadersL();
341 // these four functions keep the line count down as there are several instances
342 // of streaming in/out HBufC objects.
343 void ReadRecipientsL ( RReadStream&, CDesCArray* );
344 void WriteRecipientsL( RWriteStream&, const CDesCArray* ) const;
345 void FormatSubjectL(CImHeader&, TDesC&);
347 //finds the duplicate recipients in To and Cc list
348 TBool IsRecipientPresent(CImHeader& aCImHeader, TPtrC16 newRecipient);
350 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB)
351 void ReStoreDBL(CMsvStore& aMessageStore);
352 void StoreDBL (CMsvStore& aMessageStore) const;
353 void CreateImHeaderArrayListL(TDesC16& aStr, CDesCArray& aRecipients);
354 void CreateEncodingInfoL(TDesC16& aEncodingStr);
355 HBufC16* Convert8to16L(const TDesC8& aStr) const;
356 void CreateBufferL( RBuf16& aBuf, CDesCArray& aRecipients)const;
372 //-------------------------------------------------------------------------------------
373 //----------------------Used for forwarding/replying to an email ----------------------
376 HBufC8* iResentMsgId;
377 CDesCArray* iResentTo;
378 CDesCArray* iResentCc;
379 CDesCArray* iResentBcc;
382 //-------------------------------------------------------------------------------------
383 //-------------------------------------------------------------------------------------
384 CArrayFix<TImHeaderEncodingInfo>* iEncodingInfo;
385 TMsgOutboxBodyEncoding iBodyEncoding;
386 // The character set to be when sending message.
387 // Overrides the charset passed in from the settings.
388 TUint i822HeaderCharset;
390 CImEncodedHeader* iEncodedHeader;
391 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB)
392 friend class CTestEmailHeaderStoreReStore;
396 /** Folder type flags.
398 The flags correspond to the MIME multipart subtype.
402 enum TImEmailFolderType
413 EFolderTypeAlternative,
421 EFolderTypeDirectory,
426 /** Describes the types of off-line email operations than can occur.
428 @see TMsvEmailEntry::DisconnectedOperation()
432 enum TImDisconnectedOperationType
435 ENoDisconnectedOperations,
436 /** Create operation. */
437 EDisconnectedCreateOperation,
438 /** Delete operation. */
439 EDisconnectedDeleteOperation,
440 /** Change operation. */
441 EDisconnectedChangeOperation,
442 /** "Copy to" operation. */
443 EDisconnectedCopyToOperation,
444 /** "Copy from" operation. */
445 EDisconnectedCopyFromOperation,
446 /** "Copy within service" operation. */
447 EDisconnectedCopyWithinServiceOperation,
448 /** "Move to" operation. */
449 EDisconnectedMoveToOperation,
450 /** "Move from" operation. */
451 EDisconnectedMoveFromOperation,
452 /** "Move within service" operation. */
453 EDisconnectedMoveWithinServiceOperation,
454 /** Special operation. */
455 EDisconnectedSpecialOperation,
456 /** Unknown operation. */
457 EDisconnectedUnknownOperation,
458 /** Multiple operations. */
459 EDisconnectedMultipleOperation
462 // Remote folder message count limited to TUint16 by using lower 16 bits of "iMtmData3".
463 // Note: The upper 16 bits of "iMtmData3" are not currently used by "TMsvEmailEntry".
464 const TUint KMsvRemoteFolderEntriesMask = 0x0000FFFF;
466 class TMsvEmailEntry : public TMsvEntry
467 /** Provides storage for and access to extra email specific information for a message.
469 To get a TMsvEmailEntry, get the entry's TMsvEntry, e.g. using
470 @c CMsvEntry::Entry(), and use the constructor that takes a TMsvEntry parameter.
472 Many of the flags are only used by IMAP4 entries. These can be grouped as follows:
474 - IMAP-specific flags, as defined by the IMAP protocol (see RFC3501, 2.3.2. Flags Message Attribute)
475 - GetIMAP4Flags() and SetIMAP4Flags() handle all the flags as a group
476 - \\Seen flag: SetSeenIMAP4Flag(), SeenIMAP4Flag().
477 - \\Answered flag: SetAnsweredIMAP4Flag(), AnsweredIMAP4Flag()
478 - \\Flagged flag: SetFlaggedIMAP4Flag(), FlaggedIMAP4Flag()
479 - \\Deleted flag: SetDeletedIMAP4Flag(), DeletedIMAP4Flag()
480 - \\Draft flag: SetDraftIMAP4Flag(), DraftIMAP4Flag()
481 - \\Recent flag: SetRecentIMAP4Flag(), RecentIMAP4Flag()
482 - Folder subscriptions and other folder-related flags:
483 - SetMailbox(), Mailbox(),
484 - SetSubscribed(), Subscribed(),
485 - SetLocalSubscription(), LocalSubscription()
486 - SetRemoteFolderEntries(), RemoteFolderEntries()
487 - Disconnected operation information:
488 - SetDisconnectedOperation(), DisconnectedOperation().
489 - Partial download flags: these flags allow a client to test if a message or its body has
490 been partially downloaded (see TImImap4GetPartialMailInfo)
491 - SetPartialDownloaded(), PartialDownloaded()
492 - SetBodyTextComplete(), BodyTextComplete()
493 - UID information: IMAP messages have a unique identifier number (see
494 RFC3501, 2.3.1.1. Unique Identifier (UID) Message Attribute)
495 - SetValidUID(), ValidUID()
498 The following flags are set only by the IMAP MTM. They indicate if the
499 message contains a vCard, vCalendar (http://www.imc.org), or iCalendar (RFC 2445) attachment.
501 - VCard(), SetVCard()
502 - VCalendar(), SetVCalendar()
503 - ICalendar(), SetICalendar()
505 The following flags apply to all email protocols:
507 - Receipt requested: Receipt(), SetReceipt()
508 - MHTML content: MHTMLEmail(), SetMHTMLEmail()
510 Note that the email specific data is stored in the reserved data members @c iMtmData1,
511 @c iMtmData2 and @c iMtmData3 of the TMsvEntry base class. These public data members
512 must not be directly altered by clients.
519 public: // Public member functions
520 IMPORT_C TMsvEmailEntry(); // default constructor
521 IMPORT_C TMsvEmailEntry(const TMsvEntry& aGenericEntry);
523 IMPORT_C TBool operator==(const TMsvEntry& aEntry) const;
524 IMPORT_C TBool operator==(const TMsvEmailEntry& aEntry) const;
526 IMPORT_C void GetIMAP4Flags(TBool& rUnread,TBool& rSeen,TBool& rAnswered,TBool& rFlagged,TBool& rDeleted,TBool& rDraft,TBool& rRecent);
527 IMPORT_C void SetIMAP4Flags(TBool aUnread,TBool aSeen,TBool aAnswered,TBool aFlagged,TBool aDeleted,TBool aDraft,TBool aRecent);
529 IMPORT_C void SetMessageFolderType(TImEmailFolderType aFolderType);
530 IMPORT_C TImEmailFolderType MessageFolderType() const;
532 IMPORT_C void SetDisconnectedOperation(TImDisconnectedOperationType aDisconnectedOperationType);
533 IMPORT_C TImDisconnectedOperationType DisconnectedOperation() const;
535 IMPORT_C void SetPartialDownloaded(TBool aPartialDownloaded);
536 IMPORT_C TBool PartialDownloaded() const;
539 inline void SetEncrypted(TBool aEncrypt);
540 inline TBool Encrypted() const;
542 inline void SetSigned(TBool aSignature);
543 inline TBool Signed() const;
545 inline TBool VCard() const;
546 inline void SetVCard(TBool aVCard);
548 inline TBool VCalendar() const;
549 inline void SetVCalendar(TBool aVCal);
551 inline TBool ICalendar() const;
552 inline void SetICalendar(TBool aICal);
554 inline TBool Receipt() const;
555 inline void SetReceipt(TBool aReceipt);
557 inline TBool MHTMLEmail() const;
558 inline void SetMHTMLEmail(TBool aMhtml);
560 inline TBool BodyTextComplete() const;
561 inline void SetBodyTextComplete(TBool aFlag);
564 // IMAP4-specific flags
566 inline void SetUnreadIMAP4Flag(TBool aUnread);
567 inline TBool UnreadIMAP4Flag() const;
569 inline void SetSeenIMAP4Flag(TBool aSeen);
570 inline TBool SeenIMAP4Flag() const;
572 inline void SetAnsweredIMAP4Flag(TBool aAnswered);
573 inline TBool AnsweredIMAP4Flag() const;
575 inline void SetFlaggedIMAP4Flag(TBool aFlagged);
576 inline TBool FlaggedIMAP4Flag() const;
578 inline void SetDeletedIMAP4Flag(TBool aDeleted);
579 inline TBool DeletedIMAP4Flag() const;
581 inline void SetDraftIMAP4Flag(TBool aDraft);
582 inline TBool DraftIMAP4Flag() const;
584 inline void SetRecentIMAP4Flag(TBool aRecent);
585 inline TBool RecentIMAP4Flag() const;
587 inline void SetMailbox(TBool aMailbox);
588 inline TBool Mailbox() const;
590 inline TBool Orphan() const;
592 inline void SetOrphan(TBool aOrphan);
594 inline void SetValidUID(TBool aValid);
595 inline TBool ValidUID() const;
597 inline void SetSubscribed(TBool aSubscribed);
598 inline TBool Subscribed() const;
600 inline void SetLocalSubscription(TBool aLocal); // i.e. is subscription local, or remote
601 inline TBool LocalSubscription() const;
603 inline void SetUID(TUint32 aUid);
604 inline TUint32 UID() const;
606 inline TInt RemoteFolderEntries() const;
607 inline void SetRemoteFolderEntries(TInt aEntries);
610 enum TMsvEmailEntryFlags
612 KMsvEmailEntryClearFlag =0x00,
613 // Flags set on Message entries...
614 KMsvEmailEntryEncryptedFlag =0x00000001,
615 KMsvEmailEntrySignedFlag =0x00000002,
616 KMsvEmailEntryReceiptFlag =0x00000004,
617 KMsvEmailEntryOrphanFlag =0x00000008,
619 // VCard and VCalendar entries may be set on folders or attachments
620 KMsvEmailEntryVCardFlag =0x00000010,
621 KMsvEmailEntryVCalendarFlag =0x00000020,
623 // Message contains HTML data
624 // (Note: HTML and not only MHTML)
625 KMsvEmailEntryMHTMLFlag = 0x00000040,
626 KMsvEmailEntryBodyTextCompleteFlag = 0x00000080,
628 KMsvEmailEntryNoDisconnectedOperations = 0x00000000,
629 KMsvEmailEntryDisconnectedCreateOperation = 0x00000100,
630 KMsvEmailEntryDisconnectedDeleteOperation = 0x00000200,
631 KMsvEmailEntryDisconnectedChangeOperation = 0x00000300,
632 KMsvEmailEntryDisconnectedCopyToOperation = 0x00000400,
633 KMsvEmailEntryDisconnectedCopyFromOperation = 0x00000500,
634 KMsvEmailEntryDisconnectedCopyWithinServiceOperation = 0x00000600,
635 KMsvEmailEntryDisconnectedMoveToOperation = 0x00000700,
636 KMsvEmailEntryDisconnectedMoveFromOperation = 0x00000800,
637 KMsvEmailEntryDisconnectedMoveWithinServiceOperation = 0x00000900,
638 KMsvEmailEntryDisconnectedSpecialOperation = 0x00000A00,
639 KMsvEmailEntryDisconnectedUnknownOperation = 0x00000B00,
640 KMsvEmailEntryDisconnectedMultipleOperation = 0x00000C00,
641 KMsvEmailEntryDisconnectedOperation = 0x00000F00,
643 // IMAP4-specific masks. Can be re-used by non-IMAP4 entries (eg POP3, SMTP)
644 KMsvEmailEntryIMAP4SubscribedFlag =0x00001000,
645 KMsvEmailEntryIMAP4UnreadFlag =0x00002000,
646 KMsvEmailEntryIMAP4SeenFlag =0x00004000,
647 KMsvEmailEntryIMAP4AnsweredFlag =0x00008000,
648 KMsvEmailEntryIMAP4FlaggedFlag =0x00010000,
649 KMsvEmailEntryIMAP4DeletedFlag =0x00020000,
650 KMsvEmailEntryIMAP4DraftFlag =0x00040000,
651 KMsvEmailEntryIMAP4RecentFlag =0x00080000,
652 KMsvEmailEntryIMAP4ValidUIDFlag =0x00100000,
653 KMsvEmailEntryIMAP4MailboxFlag =0x00200000,
654 KMsvEmailEntryIMAP4LocalSubFlag =0x00400000,
656 // MIME "multipart" types assigned to folders.
657 KMsvMimeFolderUnknownMask =0x00000000,
658 KMsvMimeFolderRelatedMask =0x01000000,
659 KMsvMimeFolderMixedMask =0x02000000,
660 KMsvMimeFolderAlternativeMask =0x03000000,
661 KMsvMimeFolderParallelMask =0x04000000,
662 KMsvMimeFolderDigestMask =0x05000000,
664 // MIME message types
665 KMsvMimeFolderRFC822Mask =0x06000000,
666 KMsvMimeFolderPartialMask =0x07000000,
667 KMsvMimeFolderDirectoryMask =0x08000000, // for VCard, VCalendar types
668 KMsvMimeFolderExternalMask =0x09000000,
669 KMsvMimeFolderMask =0x0F000000,
671 // Can be used by POP3 and IMAP4 MTMs.
672 KMsvEmailEntryPartialDownloadFlag =0x10000000,
674 KMsvEmailEntryICalendarFlag =0x20000000
679 const TUint16 KImMimeHeaderVersion = 2; // identify which version of this class has been stored
681 class CImMimeHeader : public CBase
682 /** Stores a MIME email header.
688 IMPORT_C static CImMimeHeader* NewLC();
689 IMPORT_C static CImMimeHeader* NewL();
690 IMPORT_C ~CImMimeHeader();
691 IMPORT_C void Reset();
692 IMPORT_C TInt Size(); // number of header fields stored in object
694 // streaming operations
695 IMPORT_C void InternalizeL( RMsvReadStream& aReadStream );
696 IMPORT_C void ExternalizeL( RMsvWriteStream& aWriteStream ) const;
697 IMPORT_C void StoreWithoutCommitL(CMsvStore& aMessageStore) const;
698 IMPORT_C void RestoreL( CMsvStore& aMessageStore );
699 IMPORT_C void StoreL ( CMsvStore& aMessageStore ) const;
702 /** Sets the Content-Type field value (e.g. "text" in Content-Type:text/plain).
704 The value is MIME defined and should always be 8-bit.
706 @param aPath Field value */
707 IMPORT_C void SetContentTypeL(const TDesC8& aPath);
708 IMPORT_C const TPtrC8 ContentType() const;
710 /** Sets the Content-Type subtype field value (e.g. "plain" in Content-Type:text/plain).
713 The value is MIME defined and should always be 8-bit.
715 @param aPath Field value */
716 IMPORT_C void SetContentSubTypeL(const TDesC8& aPath);
717 IMPORT_C const TPtrC8 ContentSubType() const;
719 /** Sets the Content-Disposition field value (either inline or attachment).
721 The value is MIME defined and should always be 8-bit.
723 @param aPath Field value */
724 IMPORT_C void SetContentDispositionL(const TDesC8& aPath);
725 IMPORT_C const TPtrC8 ContentDisposition() const;
727 /** Sets the Content-Description field value.
729 The value is MIME defined and should always be 8-bit.
731 @param aPath Field value */
732 IMPORT_C void SetContentDescriptionL(const TDesC8& aPath);
733 IMPORT_C const TPtrC8 ContentDescription() const;
735 /** Sets the Content-Base field value.
737 @param aPath Field value */
738 IMPORT_C void SetContentBaseL(const TDesC8& aPath);
739 IMPORT_C const TPtrC8 ContentBase() const;
741 /** Sets the Content-ID field value.
743 @param aPath Field value */
744 IMPORT_C void SetContentIDL(const TDesC8& aPath);
745 IMPORT_C const TPtrC8 ContentID() const;
747 /** Sets the Content-Location field value.
749 @param aPath Field value */
750 IMPORT_C void SetContentLocationL(const TDesC16& aPath);
751 IMPORT_C const TPtrC16 ContentLocation() const;
753 // IMAP-specific info describing relative location of entry w.r.t. parent Email message
754 /** Sets IMAP-specific information for the relative location of the entry to the
755 parent email message.
757 @param aPath Relative location */
758 IMPORT_C void SetRelativePathL(const TDesC8& aPath);
759 IMPORT_C const TPtrC8 RelativePath() const;
761 /** Sets the Content-Transfer-Encoding field value.
763 @param aType Field value */
764 IMPORT_C void SetContentTransferEncodingL(const TDesC8& aType);
765 IMPORT_C TImEncodingType ContentTransferEncoding() const;
766 IMPORT_C TImEncodingType ContentTransferEncoding(TDes8& rType) const;
767 IMPORT_C const TPtrC8 GetContentTypeValue(const TDesC8& aContentTypeParameter) const;
769 // inlines to access arrays
770 inline const CDesC8Array& ContentTypeParams() const;
771 inline const CDesC8Array& ContentDispositionParams() const;
772 inline const CDesC8Array& XTypeParams() const;
774 inline CDesC8Array& ContentTypeParams();
775 inline CDesC8Array& ContentDispositionParams();
776 inline CDesC8Array& XTypeParams(); // anything else that is in the header, but not recognised
778 inline const TUint16 Version() const;
779 inline void SetVersion( TUint16 aVersion );
781 IMPORT_C void SetMimeCharset(const TUint aCharset);
782 IMPORT_C TUint MimeCharset() const;
787 TBool ArrayEntryExists(CDesCArray& aArray, TInt aField);
789 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB)
790 void ReStoreMimeDBL(CMsvStore& aMessageStore);
791 void StoreMimeDBL (CMsvStore& aMessageStore) const;
792 void CreateMimeArrayListL(TPtrC16 astr1 ,TInt ai);
793 TInt BufSize() const;
797 HBufC8* iRelativePath;
798 HBufC8* iContentDescription;
800 TImEncodingType iContentTransferEncoding;
803 HBufC8* iContentBase;
804 HBufC16* iContentLocation;
807 HBufC8* iContentType;
808 HBufC8* iContentSubType;
809 HBufC8* iContentDisposition;
811 CDesC8Array* iContentTypeParams; // zero or more "parameter"
812 CDesC8Array* iContentDispositionParams; // zero or more "parameters"
813 CDesC8Array* iXTypeParams; // zero or more X-Type "parameters"
815 TBuf<20> iContentTransferEncodingBuffer; // must be big enough to store "quoted-printable" string
817 // The uid value is always used in preference to the stored string.
818 // Only when the uid is not set is the string used when sending.
827 * Convert the 16 bit descripter to 8 bit.
828 * @param astr A descripter to be convert into 8 bit discripter.
829 * @return HBufC16* A 8 bit discripter.
831 static inline HBufC8* Convert16to8L(TDesC16& aStr)//const
833 HBufC8* newFrom1 = HBufC8::NewL(aStr.Length());
834 newFrom1->Des().Copy(aStr);
842 * Converts a string to an integer.
843 * @param aStr A string to make Integer.
844 * @return TInt A integer value
846 static inline TInt ConvertToTInt(TDesC16& aStr)
849 TInt32 stringIntValue;
850 string.Val(stringIntValue);
851 return stringIntValue;
855 #include <miuthdr.inl>
857 #endif // #defined __MIUTHDR_H__