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.
16 /** Sets the field type.
17 @param aField Field type */
18 inline void TImHeaderEncodingInfo::SetField(const TFieldList aField)
23 /** Gets the field type.
25 inline TImHeaderEncodingInfo::TFieldList TImHeaderEncodingInfo::Field() const
30 /** Sets the field offset.
31 @param aOffset Field offset */
32 inline void TImHeaderEncodingInfo::SetOffset(const TInt aOffset)
34 iOffset = (TUint16)aOffset;
37 /** Gets the field offset.
38 @return Field offset */
39 inline TInt TImHeaderEncodingInfo::Offset() const
44 /** Sets the field length.
45 @param aLength Field length */
46 inline void TImHeaderEncodingInfo::SetLength(const TInt aLength)
48 iLength = (TUint16)aLength;
51 /** Gets the field length.
52 @return Field length */
53 inline TInt TImHeaderEncodingInfo::Length() const
58 /** Sets the character set UID.
59 @param aUid Character set UID */
60 void TImHeaderEncodingInfo::SetCharsetUid(const TUint aUid)
65 /** Gets the character set UID.
66 @return Character set UID */
67 TUint TImHeaderEncodingInfo::CharsetUid() const
72 /** Sets the encoding type (string).
73 @param aChar Encoding type */
74 inline void TImHeaderEncodingInfo::SetEncodingType(const TDesC8& aChar)
76 // If invalid, defaults to QPEncoding
77 if (aChar[0] == 'b' || aChar[0] == 'B')
78 iType = TImHeaderEncodingInfo::EBase64;
79 else if (aChar[0] == 'q' || aChar[0] == 'Q')
80 iType = TImHeaderEncodingInfo::EQP;
82 iType = TImHeaderEncodingInfo::ENoEncoding;
85 /** Sets the encoding type (enumeration).
86 @param aType Encoding type */
87 inline void TImHeaderEncodingInfo::SetEncodingType(const TEncodingType aType)
92 /** Gets the encoding type (enumeration).
93 @return Encoding type */
94 inline TImHeaderEncodingInfo::TEncodingType TImHeaderEncodingInfo::EncodingType() const
99 /** Sets the array value.
100 @param aValue Array value */
101 inline void TImHeaderEncodingInfo::SetArrayValue(const TInt aValue)
103 iArrayValue = (TUint16)aValue;
106 /** Gets the array value.
107 @return Array value */
108 inline TInt TImHeaderEncodingInfo::ArrayValue() const
113 /** Sets if a space character needs adding between two adjoining encoded-words.
114 @param atrueFalse True to add a space character */
115 inline void TImHeaderEncodingInfo::SetAddSpace(const TBool atrueFalse)
117 iAddSpace = atrueFalse;
120 /** Tests if the add space character flag is set.
121 @return True for added space characters */
122 inline TBool TImHeaderEncodingInfo::AddSpace() const
127 /** Sets the encoded length.
128 @param aLength Encoded length */
129 inline void TImHeaderEncodingInfo::SetEncodedLength(const TInt aLength)
131 iEncodedLength = (TInt8) aLength;
134 /** Gets the encoded length.
135 @return Encoded length */
136 inline TInt TImHeaderEncodingInfo::EncodedLength() const
138 return iEncodedLength + (AddSpace() ? 1 : 0);
141 //----------------------------------------------------------------------------------------
143 /** Gets a list of "To" recipients.
146 @return Recipient list */
147 inline CDesCArray& CImHeader::ToRecipients ()
152 /** Gets a list of "Cc" recipients.
153 @return Recipient list */
154 inline CDesCArray& CImHeader::CcRecipients ()
159 /** Gets a list of "Bcc" recipients.
160 @return Recipient list */
161 inline CDesCArray& CImHeader::BccRecipients()
166 /** Gets a const list of "To" recipients.
167 @return Recipient list */
168 inline const CDesCArray& CImHeader::ToRecipients () const
173 /** Gets a const list of "Cc" recipients.
174 @return Recipient list */
175 inline const CDesCArray& CImHeader::CcRecipients () const
180 /** Gets a const list of "Bcc" recipients.
181 @return Recipient list */
182 inline const CDesCArray& CImHeader::BccRecipients() const
187 //-------------------------------------------------------------------------------------
188 //---------------------------- Used for forwarding an email ---------------------------
190 inline CDesCArray& CImHeader::ResentToRecipients ()
195 inline CDesCArray& CImHeader::ResentCcRecipients ()
200 inline CDesCArray& CImHeader::ResentBccRecipients()
205 inline const CDesCArray& CImHeader::ResentToRecipients () const
210 inline const CDesCArray& CImHeader::ResentCcRecipients () const
215 inline const CDesCArray& CImHeader::ResentBccRecipients() const
220 //-------------------------------------------------------------------------------------
221 //-------------------------------------------------------------------------------------
223 inline const TUint CImHeader::RemoteSize() const
228 inline void CImHeader::SetRemoteSize( TUint aRemoteSize )
230 iRemoteSize = aRemoteSize;
234 inline const TUint16 CImHeader::Version() const
239 inline void CImHeader::SetVersion( TUint16 aVersion )
244 /** Gets information relating to the encoding of header fields in received email.
246 This includes the charset. This information can be used when forwarding the
247 email, to re-encode the header fields.
249 @return Encoding information */
250 inline CArrayFix<TImHeaderEncodingInfo>& CImHeader::EncodingInfo()
252 return *iEncodingInfo;
255 /** Gets const information relating to the encoding of header fields in received
258 This includes the charset. This information can be used when forwarding the
259 email, to re-encode the header fields.
261 @return Encoding information */
262 inline const CArrayFix<TImHeaderEncodingInfo>& CImHeader::EncodingInfo() const
264 return *iEncodingInfo;
267 //////////////////////////////////////////////////////////////
269 //////////////////////////////////////////////////////////////
271 /** Tests whether encryption is used.
275 @return True if encryption is used */
276 inline TBool TMsvEmailEntry::Encrypted() const
278 if(iMtmData1&KMsvEmailEntryEncryptedFlag)
288 /** Sets whether encryption is used.
292 @param aFlag True if encryption is used */
293 inline void TMsvEmailEntry::SetEncrypted(TBool aFlag)
295 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryEncryptedFlag) | (aFlag?KMsvEmailEntryEncryptedFlag:KMsvEmailEntryClearFlag);
298 /** Tests whether signing is used.
302 @return True if signing is used */
303 inline TBool TMsvEmailEntry::Signed() const
305 if(iMtmData1&KMsvEmailEntrySignedFlag)
315 /** Sets whether signing is used.
319 @param aFlag True if signing is used */
320 inline void TMsvEmailEntry::SetSigned(TBool aFlag)
322 iMtmData1 = (iMtmData1 & ~KMsvEmailEntrySignedFlag) | (aFlag?KMsvEmailEntrySignedFlag:KMsvEmailEntryClearFlag);
326 /** Returns the flag indicating if the message has an HTML body part.
328 Note: the flag is for HTML and not only MHTML.
330 Use CImEmailMessage to retrieve the HTML body part.
332 @return True if the message has an HTML body part
335 inline TBool TMsvEmailEntry::MHTMLEmail() const
337 if(iMtmData1&KMsvEmailEntryMHTMLFlag)
347 /** Sets the flag indicating if the message has an HTML body part.
349 Note: the flag is for HTML and not only MHTML.
351 Use CImEmailMessage to retrieve the HTML body part.
353 @param aFlag True if the message has an HTML body part
356 inline void TMsvEmailEntry::SetMHTMLEmail(TBool aFlag)
358 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryMHTMLFlag) | (aFlag?KMsvEmailEntryMHTMLFlag:KMsvEmailEntryClearFlag);
362 /** Tests if body text is complete.
363 @return True if body text is complete. */
364 inline TBool TMsvEmailEntry::BodyTextComplete() const
366 if(iMtmData1 & KMsvEmailEntryBodyTextCompleteFlag)
376 /** Sets if body text is complete.
377 @param aFlag True if body text is complete. */
378 inline void TMsvEmailEntry::SetBodyTextComplete(TBool aFlag)
380 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryBodyTextCompleteFlag) | (aFlag?KMsvEmailEntryBodyTextCompleteFlag:KMsvEmailEntryClearFlag);
384 /** Tests if the message contains a VCard attachment.
385 @return True if the message contains a VCard attachment */
386 inline TBool TMsvEmailEntry::VCard() const
388 if(iMtmData1&KMsvEmailEntryVCardFlag)
398 /** Sets a flag that the message contains a VCard attachment.
399 @param aFlag True if the message contains a VCard attachment */
400 inline void TMsvEmailEntry::SetVCard(TBool aFlag)
402 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryVCardFlag) | (aFlag?KMsvEmailEntryVCardFlag:KMsvEmailEntryClearFlag);
405 /** Tests if the message contains a VCal attachment.
406 @return True if the message contains a VCal attachment */
407 inline TBool TMsvEmailEntry::VCalendar() const
409 if(iMtmData1&KMsvEmailEntryVCalendarFlag)
419 /** Sets a flag that the message contains a VCal attachment.
420 @param aFlag True if the message contains a VCal attachment */
421 inline void TMsvEmailEntry::SetVCalendar(TBool aFlag)
423 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryVCalendarFlag) | (aFlag?KMsvEmailEntryVCalendarFlag:KMsvEmailEntryClearFlag);
426 /** Tests if the message contains an iCalendar attachment.
428 @return True if the message contains an iCalendar attachment
430 inline TBool TMsvEmailEntry::ICalendar() const
432 if(iMtmData1&KMsvEmailEntryICalendarFlag)
442 /** Sets a flag that the message contains an iCalendar attachment.
444 @param aFlag True if the message contains an iCalendar attachment
446 inline void TMsvEmailEntry::SetICalendar(TBool aFlag)
448 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryICalendarFlag) | (aFlag?KMsvEmailEntryICalendarFlag:KMsvEmailEntryClearFlag);
452 /** Tests if the email message requests a receipt.
453 @return True if the email message requests a receipt */
454 inline TBool TMsvEmailEntry::Receipt() const
456 if(iMtmData1&KMsvEmailEntryReceiptFlag)
466 /** Sets a flag that the email message requests a receipt.
467 @param aFlag True if the email message requests a receipt */
468 inline void TMsvEmailEntry::SetReceipt(TBool aFlag)
470 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryReceiptFlag) | (aFlag?KMsvEmailEntryReceiptFlag:KMsvEmailEntryClearFlag);
474 /** Gets the state of the unread messages IMAP4 flag.
476 This flag is set on a folder if the folder contains any
477 messages with the IMAP \\Seen flag set.
479 @return Unread messages IMAP4 flag
480 @see TMsvEmailEntry::SeenIMAP4Flag()
482 inline TBool TMsvEmailEntry::UnreadIMAP4Flag() const
484 if(iMtmData1&KMsvEmailEntryIMAP4UnreadFlag)
494 /** Sets the state of the unread messages IMAP4 flag.
495 @param aFlag Unread messages IMAP4 flag */
496 inline void TMsvEmailEntry::SetUnreadIMAP4Flag(TBool aFlag)
498 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryIMAP4UnreadFlag) | (aFlag?KMsvEmailEntryIMAP4UnreadFlag:KMsvEmailEntryClearFlag);
501 /** Gets the state of the \\Seen IMAP4 flag.
503 This indicates if the message has been read. It is described in RFC3501, 2.3.2.
504 Flags Message Attribute.
506 Note that the server MTM creates messages with the TMsvEntry::Unread() flag set. If
507 on synchronisation a folder contains new messages, the Unread flag will also be
510 @return \\Seen IMAP4 flag
511 @see CImImap4Settings::UpdatingSeenFlags()
513 inline TBool TMsvEmailEntry::SeenIMAP4Flag() const
515 if(iMtmData1&KMsvEmailEntryIMAP4SeenFlag)
525 /** Sets the state of the \\Seen IMAP4 flag.
526 @param aFlag \\Seen IMAP4 flag */
527 inline void TMsvEmailEntry::SetSeenIMAP4Flag(TBool aFlag)
529 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryIMAP4SeenFlag) | (aFlag?KMsvEmailEntryIMAP4SeenFlag:KMsvEmailEntryClearFlag);
532 /** Gets the state of the \\Answered IMAP4 flag.
534 This indicates if the message has been answered. It is described in
535 RFC3501, 2.3.2. Flags Message Attribute.
537 @return \\Answered IMAP4 flag */
538 inline TBool TMsvEmailEntry::AnsweredIMAP4Flag() const
540 if(iMtmData1&KMsvEmailEntryIMAP4AnsweredFlag)
550 /** Sets the state of the \\Answered IMAP4 flag.
551 @param aFlag \\Answered IMAP4 flag */
552 inline void TMsvEmailEntry::SetAnsweredIMAP4Flag(TBool aFlag)
554 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryIMAP4AnsweredFlag) | (aFlag?KMsvEmailEntryIMAP4AnsweredFlag:KMsvEmailEntryClearFlag);
558 /** Gets the state of the \\Flagged IMAP4 flag.
560 This indicates if the message is flagged for urgent/special attention.
561 It is described in RFC3501, 2.3.2. Flags Message Attribute.
563 @return \\Flagged IMAP4 flag */
564 inline TBool TMsvEmailEntry::FlaggedIMAP4Flag() const
566 if(iMtmData1&KMsvEmailEntryIMAP4FlaggedFlag)
576 /** Sets the state of the \\Flagged IMAP4 flag.
577 @param aFlag \\Flagged IMAP4 flag */
578 inline void TMsvEmailEntry::SetFlaggedIMAP4Flag(TBool aFlag)
580 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryIMAP4FlaggedFlag) | (aFlag?KMsvEmailEntryIMAP4FlaggedFlag:KMsvEmailEntryClearFlag);
583 /** Gets the state of the \\Deleted IMAP4 flag.
585 This indicates if the message is marked as deleted for removal later. It is described in
586 RFC3501, 2.3.2. Flags Message Attribute.
588 @return \\Deleted IMAP4 flag */
589 inline TBool TMsvEmailEntry::DeletedIMAP4Flag() const
591 if(iMtmData1&KMsvEmailEntryIMAP4DeletedFlag)
601 /** Sets the state of the \\Deleted IMAP4 flag.
602 @param aFlag \\Deleted IMAP4 flag */
603 inline void TMsvEmailEntry::SetDeletedIMAP4Flag(TBool aFlag)
605 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryIMAP4DeletedFlag) | (aFlag?KMsvEmailEntryIMAP4DeletedFlag:KMsvEmailEntryClearFlag);
608 /** Gets the state of the \\Draft IMAP4 flag.
610 This indicates if the message has not completed composition. It is described in
611 RFC3501, 2.3.2. Flags Message Attribute.
613 @return \\Draft IMAP4 flag */
614 inline TBool TMsvEmailEntry::DraftIMAP4Flag() const
616 if(iMtmData1&KMsvEmailEntryIMAP4DraftFlag)
626 /** Sets the state of the \\Draft IMAP4 flag.
627 @param aFlag \\Draft IMAP4 flag */
628 inline void TMsvEmailEntry::SetDraftIMAP4Flag(TBool aFlag)
630 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryIMAP4DraftFlag) | (aFlag?KMsvEmailEntryIMAP4DraftFlag:KMsvEmailEntryClearFlag);
633 /** Gets the state of the \\Recent IMAP4 flag.
635 This indicates if the message is "recently" arrived in this mailbox. This session
636 is the first session to have been notified about this message. For more details, see
637 see RFC3501, 2.3.2. Flags Message Attribute.
639 @return \\Recent IMAP4 flag */
640 inline TBool TMsvEmailEntry::RecentIMAP4Flag() const
642 if(iMtmData1&KMsvEmailEntryIMAP4RecentFlag)
652 /** Sets the state of the \\Recent IMAP4 flag.
653 @param aFlag \\Recent IMAP4 flag */
654 inline void TMsvEmailEntry::SetRecentIMAP4Flag(TBool aFlag)
656 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryIMAP4RecentFlag) | (aFlag?KMsvEmailEntryIMAP4RecentFlag:KMsvEmailEntryClearFlag);
660 /** Tests if the specified folder is the IMAP4 Mailbox.
661 @return True if the specified folder is the Mailbox */
662 inline TBool TMsvEmailEntry::Mailbox() const
664 if(iMtmData1&KMsvEmailEntryIMAP4MailboxFlag)
674 /** Sets if the specified folder is the IMAP4 Mailbox.
675 @param aFlag True if the specified folder is the Mailbox */
676 inline void TMsvEmailEntry::SetMailbox(TBool aFlag)
678 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryIMAP4MailboxFlag) | (aFlag?KMsvEmailEntryIMAP4MailboxFlag:KMsvEmailEntryClearFlag);
682 /** Gets the IMAP4 orphaned state for the specified message/folder.
684 The concept of an orphan is no longer used, so this function should not be used.
686 @return True if the specified entry is orphaned */
687 inline TBool TMsvEmailEntry::Orphan() const
689 if(iMtmData1&KMsvEmailEntryOrphanFlag)
699 /** Sets the IMAP4 orphaned state for the specified message/folder.
701 The concept of an orphan is no longer used, so this function should not be used.
703 @param aFlag True if the specified entry is orphaned */
704 inline void TMsvEmailEntry::SetOrphan(TBool aFlag)
706 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryOrphanFlag) | (aFlag?KMsvEmailEntryOrphanFlag:KMsvEmailEntryClearFlag);
710 /** Gets the IMAP4 UID (unique identifier) validity for the specified folder.
711 @return True if IMAP4 UID validity is set */
712 inline TBool TMsvEmailEntry::ValidUID() const
714 if(iMtmData1&KMsvEmailEntryIMAP4ValidUIDFlag)
724 /** Sets the IMAP4 UID (unique identifier) validity for the specified folder.
725 @param aFlag True if IMAP4 UID validity is set */
726 inline void TMsvEmailEntry::SetValidUID(TBool aFlag)
728 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryIMAP4ValidUIDFlag) | (aFlag?KMsvEmailEntryIMAP4ValidUIDFlag:KMsvEmailEntryClearFlag);
732 /** Gets the IMAP4 subscription state for the specified folder.
733 @return IMAP4 subscription state */
734 inline TBool TMsvEmailEntry::Subscribed() const
736 if(iMtmData1&KMsvEmailEntryIMAP4SubscribedFlag)
746 /** Sets the IMAP4 subscription state for the specified folder.
747 @param aFlag IMAP4 subscription state */
748 inline void TMsvEmailEntry::SetSubscribed(TBool aFlag)
750 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryIMAP4SubscribedFlag) | (aFlag?KMsvEmailEntryIMAP4SubscribedFlag:KMsvEmailEntryClearFlag);
754 /** Gets the IMAP4 local subscription state for the specified folder.
756 @return IMAP4 local subscription state */
757 inline TBool TMsvEmailEntry::LocalSubscription() const
759 if(iMtmData1&KMsvEmailEntryIMAP4LocalSubFlag)
769 /** Sets the IMAP4 local subscription state for the specified folder.
771 Depending on other settings, setting a folder to be locally subscribed can mean:
773 - that the folder is synchronised as part of synchronisation operations
774 (depending on the value of CImImap4Settings::Synchronise())
775 - that the folder will be set as subscribed on the remote server
776 (depending on the value of CImImap4Settings::SetSuscribe())
778 Note that clients can use the #KIMAP4MTMLocalSubscribe command to set
779 this flag and save the change to the entry.
781 @param aFlag IMAP4 local subscription state */
782 inline void TMsvEmailEntry::SetLocalSubscription(TBool aFlag)
784 iMtmData1 = (iMtmData1 & ~KMsvEmailEntryIMAP4LocalSubFlag) | (aFlag?KMsvEmailEntryIMAP4LocalSubFlag:KMsvEmailEntryClearFlag);
788 /** Gets the IMAP4 UID (unique identifier) for the specified message/folder.
790 inline TUint32 TMsvEmailEntry::UID() const
792 return (TUint32)iMtmData2; // hide the casting away from the caller
795 /** Sets the IMAP4 UID (unique identifier) for the specified message/folder.
796 @param aUID IMAP4 UID */
797 inline void TMsvEmailEntry::SetUID(TUint32 aUID)
799 iMtmData2 = (TInt32) aUID; // hide the casting away from the user
802 /** Gets the number of messages stored in the remote folder.
803 @return Number of messages */
804 inline TInt TMsvEmailEntry::RemoteFolderEntries() const
806 return iMtmData3&KMsvRemoteFolderEntriesMask;
809 /** Sets the number of messages stored in the remote folder.
810 @param aEntries Number of messages */
811 inline void TMsvEmailEntry::SetRemoteFolderEntries(TInt aEntries)
813 iMtmData3 = (TInt32) ((iMtmData3 & ~KMsvRemoteFolderEntriesMask) | (aEntries & KMsvRemoteFolderEntriesMask));
816 //////////////////////////////////////////////////////////////
817 // CImMimeHeader inlines //
818 //////////////////////////////////////////////////////////////
820 /** Gets the const Content-Type parameters and their associated values.
821 @return Parameters and associated values */
822 inline const CDesC8Array& CImMimeHeader::ContentTypeParams() const
824 return *iContentTypeParams;
828 /** Gets the const Content-Disposition parameters and their associated values.
829 @return Parameters and associated values */
830 inline const CDesC8Array& CImMimeHeader::ContentDispositionParams() const
832 return *iContentDispositionParams;
836 /** Gets the const MIME header parameters and their associated values.
837 This can be used by any MIME header fields.
838 @return Parameters and associated values */
839 inline const CDesC8Array& CImMimeHeader::XTypeParams() const
841 return *iXTypeParams;
845 /** Gets the Content-Type parameters and their associated values.
846 @return Parameters and associated values */
847 inline CDesC8Array& CImMimeHeader::ContentTypeParams()
849 return *iContentTypeParams;
853 /** Gets the Content-Disposition parameters and their associated values.
854 @return Parameters and associated values */
855 inline CDesC8Array& CImMimeHeader::ContentDispositionParams()
857 return *iContentDispositionParams;
861 /** Gets the MIME header parameters and their associated values.
862 This can be used by any MIME header fields.
863 @return Parameters and associated values */
864 inline CDesC8Array& CImMimeHeader::XTypeParams()
866 return *iXTypeParams;
870 inline const TUint16 CImMimeHeader::Version() const
875 inline void CImMimeHeader::SetVersion( TUint16 aVersion )