1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/app/miuthdr.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,849 @@
1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// 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
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __MIUTHDR_H__
1.20 +#define __MIUTHDR_H__
1.21 +
1.22 +#include <s32strm.h>
1.23 +#include <badesca.h>
1.24 +#include <pop3cmds.h>
1.25 +#include <msvstd.h>
1.26 +#include <msvids.h> // KMsvNullIndexEntryId
1.27 +#include <miutstd.hrh> // KUidMsvEmailTextEntryValue
1.28 +
1.29 +// IMail-specific stream type within an IMail file store for CImHeader
1.30 +const TUid KUidMsgFileMimeHeader = {0x1000160F}; // 268441103 decimal
1.31 +// IMail-specific stream type within an IMail file store for CImMimeHeader
1.32 +const TUid KUidMsgFileIMailHeader = {0x100001D8}; // 268435928 decimal
1.33 +
1.34 +// Identifies which version of CImHeader has been stored in stream
1.35 +const TUint16 KImHeaderVersion = 2;
1.36 +
1.37 +const TUid KUidMsvEmailTextEntry = {KUidMsvEmailTextEntryValue};
1.38 +const TUid KUidMsvEmailHtmlEntry = {KUidMsvEmailHtmlEntryValue};
1.39 +const TUid KUidMsvEmailExternalBodyEntry = {KUidMsvEmailExternalBodyEntryValue};
1.40 +const TUid KUidMsvEmailRtfEntry = {KUidMsvEmailRtfEntryValue};
1.41 +
1.42 +
1.43 +_LIT8(KMiutDateFormat, " %S, %2d %S %04d %02d:%02d:%02d ");
1.44 +_LIT8(KMiutMonthNames, "JanFebMarAprMayJunJulAugSepOctNovDec");
1.45 +_LIT8(KMiutDayNames, "MonTueWedThuFriSatSun");
1.46 +_LIT8(KMiutTimeZoneNeg, "-%02d%02d");
1.47 +_LIT8(KMiutTimeZonePos, "+%02d%02d");
1.48 +
1.49 +_LIT8(KMiutBase64String, "Base64");
1.50 +_LIT8(KMiutQPString, "quoted-printable");
1.51 +_LIT8(KMiut7BitString, "7bit");
1.52 +_LIT8(KMiut8BitString, "8bit");
1.53 +_LIT8(KMiutBinaryString, "binary");
1.54 +_LIT8(KMiutUUString, "uuencode");
1.55 +
1.56 +_LIT8(KMiutWildcardBase64, "*base64*");
1.57 +_LIT8(KMiutWildcardQP, "*quoted-printable*");
1.58 +_LIT8(KMiutWildcard7Bit, "*7bit*");
1.59 +_LIT8(KMiutWildcard8Bit, "*8bit*");
1.60 +_LIT8(KMiutWildcardBinary, "*binary*");
1.61 +_LIT8(KMiutWildcardUU, "*uu*");
1.62 +
1.63 +#define KMiutEmptyString KNullDesC
1.64 +
1.65 +_LIT(KMiutFormatString, "%S");
1.66 +_LIT(KImEngineResourceFile, "\\resource\\messaging\\imcm.rsc");
1.67 +
1.68 +const TInt KMiutDateStringLength = 32;
1.69 +const TInt KCenturyThreshold = 100;
1.70 +const TInt KCenturyOffset = 70;
1.71 +const TInt KThisCentury = 1900; // as defined in 1998
1.72 +const TInt KNextCentury = 2000;
1.73 +
1.74 +class CMsvStore;
1.75 +class TMsvEntry;
1.76 +class RMsvReadStream;
1.77 +class RMsvWriteStream;
1.78 +class CImConvertHeader;
1.79 +class CImEncodedHeader;
1.80 +
1.81 +void CopyArrayL(const CDesCArray& aSource, CDesCArray& aDestination);
1.82 +
1.83 +// Maximum size for descriptors stored in HBufC members of CImHeader = 1000 chars
1.84 +const TInt KMaxImHeaderStringLength = 1000;
1.85 +const TInt KMaxImMimeFieldLength = 1000;
1.86 +const TInt KImMailMaxBufferSize = 1000; // 1000 is defined by the SMTP spec as max space
1.87 +const TInt KSmtpMaxBufferExcludingCRLF = 979; // Line length limit is 1000 chars per line including CRLF (RFC2822, Section 2.1.1)
1.88 + // 1000 chars including "Field name: "+"Field body"+CRLF (here "Resent-Message-ID: " is largest field)
1.89 +
1.90 +
1.91 +/** Defines how emails will be encoded when they are sent.
1.92 +
1.93 +MIME standards are defined in RFC 2045, RFC 2046 and RFC 2047.
1.94 +@publishedAll
1.95 +@released
1.96 +*/
1.97 +enum TMsgOutboxBodyEncoding
1.98 + {
1.99 + /** Emails are sent with the default encoding, which is as for EMsgOutboxMIME. */
1.100 + EMsgOutboxDefault,
1.101 + /** Emails are sent as plain text RFC822 messages.
1.102 +
1.103 + Attachments are encoded using UUEncoding algorithm. This method would not
1.104 + normally be used unless the sender was sure that the receiving mail clients
1.105 + don't support MIME. */
1.106 + EMsgOutboxNoAlgorithm,
1.107 + /** Text is encoded using quoted-printable encoding, and all attachments are encoded
1.108 + using BASE64 encoding.
1.109 +
1.110 + This is the default setting for this option. */
1.111 + EMsgOutboxMIME,
1.112 + /** Text parts of the message are sent as MIME TEXT/HTML parts, and are encoded
1.113 + using UTF-8 encoding system.
1.114 +
1.115 + All attachments are encoded using BASE64 encoding. Receiving mail clients
1.116 + that do no support MHTML mail will display the HTML message text to the user
1.117 + including all HTML tags, etc. */
1.118 + EMsgOutboxMHTMLAsMIME,
1.119 + /** Each text part of the message is sent as two alternative MIME parts.
1.120 +
1.121 + The first part is sent as plain text using quoted-printable encoding, the
1.122 + second part is sent as a TEXT/HTML part which is encoded using UTF-8 encoding
1.123 + system. All attachments are encoded using BASE64 encoding. This is the standard
1.124 + encoding method if the user wishes to send MHTML mail. */
1.125 + EMsgOutboxMHTMLAlternativeAsMIME
1.126 + };
1.127 +
1.128 +/** Messaging encoding types.
1.129 +@publishedAll
1.130 +@released
1.131 +*/
1.132 +enum TImEncodingType
1.133 + {
1.134 + /** Unknown. */
1.135 + EEncodingTypeUnknown,
1.136 + /** None. */
1.137 + EEncodingTypeNone,
1.138 + /** 7-bit. */
1.139 + EEncodingType7Bit,
1.140 + /** 8-bit. */
1.141 + EEncodingType8Bit, // ie lines still <1000 chars and terminated by CRLF
1.142 + /** Binary. */
1.143 + EEncodingTypeBinary, // ie any length of data, not terminated by CRLF
1.144 + /** QP. */
1.145 + EEncodingTypeQP,
1.146 + /** Base64. */
1.147 + EEncodingTypeBASE64,
1.148 + /** UU. */
1.149 + EEncodingTypeUU
1.150 + };
1.151 +
1.152 +
1.153 +// Class used for storing extracting information (to/from header)..
1.154 +// regarding the encoding in an incoming email message header.
1.155 +//----------------------------------------------------------------------------------------
1.156 +class TImHeaderEncodingInfo
1.157 +//----------------------------------------------------------------------------------------
1.158 +/** Stores encoding data found in message headers.
1.159 +@publishedAll
1.160 +@released
1.161 +*/
1.162 + {
1.163 +public:
1.164 + /** Message field types. */
1.165 + enum TFieldList
1.166 + {
1.167 + EFrom, /**< "From" field. */
1.168 + EReplyTo, /**< "Reply To" field. */
1.169 + ETo, /**< "To" field. */
1.170 + ECc, /**< "Cc" field. */
1.171 + EBcc, /**< "Bcc" field. */
1.172 + ESubject /**< Subject field. */
1.173 + };
1.174 + /** Encoding types. */
1.175 + enum TEncodingType
1.176 + {
1.177 + EBase64, /**< Base64. */
1.178 + EQP, /**< QP. */
1.179 + ENoEncoding, /**< No encoding */
1.180 + EUU /**< UU. */
1.181 + };
1.182 +
1.183 +public:
1.184 + IMPORT_C TImHeaderEncodingInfo();
1.185 + IMPORT_C TImHeaderEncodingInfo(const TImHeaderEncodingInfo& aFrom);
1.186 +
1.187 + IMPORT_C void ExternalizeL( RWriteStream& aWriteStream ) const;
1.188 + IMPORT_C void InternalizeL( RReadStream& aReadStream );
1.189 +
1.190 + inline void SetField(const TFieldList aField);
1.191 + inline TFieldList Field() const;
1.192 +
1.193 + inline void SetOffset(const TInt aOffset);
1.194 + inline TInt Offset() const;
1.195 +
1.196 + inline void SetLength(const TInt aLength);
1.197 + inline TInt Length() const;
1.198 +
1.199 + inline void SetCharsetUid(const TUint aUid);
1.200 + inline TUint CharsetUid() const;
1.201 +
1.202 + inline void SetEncodingType(const TDesC8& aChar);
1.203 + inline void SetEncodingType(const TEncodingType aType);
1.204 + inline TEncodingType EncodingType() const;
1.205 +
1.206 + inline void SetArrayValue(const TInt aValue);
1.207 + inline TInt ArrayValue() const;
1.208 +
1.209 + inline void SetAddSpace(const TBool atrueFalse);
1.210 + inline TBool AddSpace() const;
1.211 +
1.212 + inline void SetEncodedLength(const TInt aLength);
1.213 + inline TInt EncodedLength() const;
1.214 +
1.215 +private:
1.216 + TFieldList iField;
1.217 + TUint16 iOffset;
1.218 + TUint16 iLength;
1.219 + TEncodingType iType;
1.220 + TUint16 iArrayValue;
1.221 + TBool iAddSpace; // A space char needs adding between two adjoining 'encoded-words'
1.222 + TUint8 iEncodedLength; // This can be used to determine space needed for buffer.
1.223 + TUint iCharsetUid;
1.224 +
1.225 + };
1.226 +
1.227 +
1.228 +//------------------------------------------------------------------------------
1.229 +
1.230 +
1.231 +class CImHeader : public CBase
1.232 +/** Encapsulates an Internet Mail (RFC822) header.
1.233 +
1.234 +Note that the class contains some obsolete functions that take a narrow descriptor:
1.235 +always use the equivalent wide descriptor function instead.
1.236 +@publishedAll
1.237 +@released
1.238 +*/
1.239 + {
1.240 +public:
1.241 +/** Flags used to determine where to obtain the ReplyTo address for the header
1.242 +field of that name. */
1.243 + enum TReplyTo
1.244 + {
1.245 + /** Get address from originator. */
1.246 + EOriginator,
1.247 + /** Get address from sender. */
1.248 + ESender,
1.249 + /** Get address from all sources. */
1.250 + EAll,
1.251 + /** Get address from recipients. */
1.252 + ERecipients
1.253 + };
1.254 +
1.255 + IMPORT_C static CImHeader* NewLC();
1.256 + IMPORT_C ~CImHeader();
1.257 + IMPORT_C void Reset();
1.258 +
1.259 + // streaming operations
1.260 + IMPORT_C void InternalizeL(RMsvReadStream& aReadStream);
1.261 + IMPORT_C void ExternalizeL(RMsvWriteStream& aWriteStream) const;
1.262 + IMPORT_C void RestoreL(CMsvStore& aMessageStore);
1.263 + IMPORT_C void StoreL (CMsvStore& aMessageStore) const;
1.264 + IMPORT_C void StoreWithoutCommitL(CMsvStore& aMessageStore) const;
1.265 +
1.266 + // the bulk of the member functions are accessors & mutators so we can use
1.267 + // objects of the class as data repositories during the data-marshalling stage
1.268 + // of getting imail headers to/from the internet
1.269 + IMPORT_C const TPtrC Subject() const;
1.270 + IMPORT_C void SetSubjectL(const TDesC8& aSubject);
1.271 +
1.272 + // Internet message ID
1.273 + IMPORT_C const TPtrC8 ImMsgId() const;
1.274 + /** Sets the "MessageId" header field.
1.275 +
1.276 + @param aImMsgIdL Field value */
1.277 + IMPORT_C void SetImMsgIdL(const TDesC8& aImMsgIdL);
1.278 +
1.279 + IMPORT_C const TPtrC From() const;
1.280 + IMPORT_C void SetFromL(const TDesC8& aFrom);
1.281 +
1.282 + IMPORT_C const TPtrC ReplyTo() const;
1.283 + IMPORT_C void SetReplyToL(const TDesC8& aReplyTo);
1.284 +
1.285 + IMPORT_C const TPtrC ReceiptAddress() const;
1.286 + /** Sets the "Receipt" header field.
1.287 +
1.288 + @param aReceiptAddress Field value */
1.289 + IMPORT_C void SetReceiptAddressL(const TDesC8& aReceiptAddress);
1.290 +
1.291 + IMPORT_C TUint Charset() const;
1.292 + IMPORT_C void SetCharset(const TUint aCharset);
1.293 +
1.294 +#if defined (_UNICODE)
1.295 + IMPORT_C void SetFromL(const TDesC16& aFrom);
1.296 + IMPORT_C void SetReplyToL(const TDesC16& aReplyTo);
1.297 + /** Sets the "Receipt" header field.
1.298 +
1.299 + @param aReceiptAddress Field value */
1.300 + IMPORT_C void SetReceiptAddressL(const TDesC16& aReceiptAddress);
1.301 + IMPORT_C void SetSubjectL(const TDesC16& aSubject);
1.302 +#endif
1.303 +
1.304 + IMPORT_C TInt DataSize();
1.305 +
1.306 + inline const TUint RemoteSize() const;
1.307 + inline void SetRemoteSize(TUint aSize);
1.308 +
1.309 + inline const TUint16 Version() const;
1.310 + inline void SetVersion(TUint16 aVersion);
1.311 +
1.312 + // give const access to the recipient lists
1.313 + inline const CDesCArray& ToRecipients () const;
1.314 + inline const CDesCArray& CcRecipients () const;
1.315 + inline const CDesCArray& BccRecipients() const;
1.316 +
1.317 + // give non-const access to the recipient lists
1.318 + inline CDesCArray& ToRecipients () ;
1.319 + inline CDesCArray& CcRecipients () ;
1.320 + inline CDesCArray& BccRecipients() ;
1.321 +
1.322 + inline CArrayFix<TImHeaderEncodingInfo>& EncodingInfo() ;
1.323 + inline const CArrayFix<TImHeaderEncodingInfo>& EncodingInfo() const;
1.324 +
1.325 + IMPORT_C void AddEncodingInfoL(TImHeaderEncodingInfo& aInfo);
1.326 +
1.327 +//-------------------------------------------------------------------------------------
1.328 +//----------------------Used for forwarding/replying to an email ----------------------
1.329 +
1.330 + IMPORT_C const TPtrC8 ResentMsgId() const;
1.331 + IMPORT_C void SetResentMsgIdL( const TDesC8& );
1.332 +
1.333 + IMPORT_C const TPtrC ResentFrom() const;
1.334 + IMPORT_C void SetResentFromL( const TDesC& );
1.335 +
1.336 + // give const access to the recipient lists
1.337 + inline const CDesCArray& ResentToRecipients () const;
1.338 + inline const CDesCArray& ResentCcRecipients () const;
1.339 + inline const CDesCArray& ResentBccRecipients() const;
1.340 +
1.341 + // give non-const access to the recipient lists
1.342 + inline CDesCArray& ResentToRecipients ();
1.343 + inline CDesCArray& ResentCcRecipients ();
1.344 + inline CDesCArray& ResentBccRecipients();
1.345 +
1.346 + IMPORT_C const TPtrC8 InReplyTo() const;
1.347 + IMPORT_C void SetInReplyToL(const TDesC8&);
1.348 +
1.349 + IMPORT_C TInt CreateForwardL(CImHeader&, TDesC&);
1.350 + IMPORT_C TInt CreateReplyL(CImHeader&, TReplyTo, TDesC&);
1.351 + IMPORT_C void CreateReceiptL(CImHeader&, TDesC&);
1.352 +
1.353 +//-------------------------------------------------------------------------------------
1.354 +//-------------------------------------------------------------------------------------
1.355 +
1.356 + // Body Encoding (charset) stored on a per message basis
1.357 + IMPORT_C TMsgOutboxBodyEncoding BodyEncoding() const;
1.358 + IMPORT_C void SetBodyEncoding(TMsgOutboxBodyEncoding aMessageBodyEncoding);
1.359 +
1.360 + IMPORT_C void ReDecodeL(RFs& aFS);
1.361 + IMPORT_C TUint OverrideCharset() const;
1.362 + IMPORT_C void SetOverrideCharset(TUint aCharset);
1.363 + IMPORT_C void SaveEncodedHeadersL();
1.364 +
1.365 +private:
1.366 + CImHeader();
1.367 + void ConstructL();
1.368 +
1.369 + // these four functions keep the line count down as there are several instances
1.370 + // of streaming in/out HBufC objects.
1.371 + void ReadRecipientsL ( RReadStream&, CDesCArray* );
1.372 + void WriteRecipientsL( RWriteStream&, const CDesCArray* ) const;
1.373 + void FormatSubjectL(CImHeader&, TDesC&);
1.374 +
1.375 + //finds the duplicate recipients in To and Cc list
1.376 + TBool IsRecipientPresent(CImHeader& aCImHeader, TPtrC16 newRecipient);
1.377 +
1.378 +private:
1.379 + TUint16 iVersion;
1.380 +
1.381 + HBufC16* iFrom;
1.382 + HBufC* iSubject;
1.383 + HBufC8* iImMsgId;
1.384 + HBufC16* iReplyTo;
1.385 + HBufC16* iReceipt;
1.386 +
1.387 + CDesCArray* iTo;
1.388 + CDesCArray* iCc;
1.389 + CDesCArray* iBcc;
1.390 + TUint iRemoteSize;
1.391 +
1.392 +//-------------------------------------------------------------------------------------
1.393 +//----------------------Used for forwarding/replying to an email ----------------------
1.394 +
1.395 + HBufC* iResentFrom;
1.396 + HBufC8* iResentMsgId;
1.397 + CDesCArray* iResentTo;
1.398 + CDesCArray* iResentCc;
1.399 + CDesCArray* iResentBcc;
1.400 + HBufC8* iInReplyTo;
1.401 +
1.402 +//-------------------------------------------------------------------------------------
1.403 +//-------------------------------------------------------------------------------------
1.404 + CArrayFix<TImHeaderEncodingInfo>* iEncodingInfo;
1.405 + TMsgOutboxBodyEncoding iBodyEncoding;
1.406 + // The character set to be when sending message.
1.407 + // Overrides the charset passed in from the settings.
1.408 + TUint i822HeaderCharset;
1.409 +
1.410 + CImEncodedHeader* iEncodedHeader;
1.411 + };
1.412 +
1.413 +class TImRfc822DateField
1.414 +/**
1.415 +@internalTechnology
1.416 +@released
1.417 +*/
1.418 + {
1.419 +public:
1.420 + IMPORT_C TInt ParseDateField(const TDesC8& aRfc822DateField, TTime& rTime);
1.421 + IMPORT_C void SetDate(const TTime& aTimeDate, TDes8& rOutputLine); // NB assumes that "Date: " string has already been inserted into rOutputLine
1.422 +
1.423 +private:
1.424 + TBool GetMonth( const TDesC8& name, TMonth& month );
1.425 + TBool GetTimezone( const TDesC8& name, TInt& minsOffset );
1.426 + };
1.427 +
1.428 +
1.429 +/** Folder type flags.
1.430 +
1.431 +The flags correspond to the MIME multipart subtype.
1.432 +@publishedAll
1.433 +@released
1.434 +*/
1.435 +enum TImEmailFolderType
1.436 + {
1.437 + /** Unknown. */
1.438 + EFolderTypeUnknown,
1.439 + /** Related. */
1.440 + EFolderTypeRelated,
1.441 + /** Mixed. */
1.442 + EFolderTypeMixed,
1.443 + /** Parallel. */
1.444 + EFolderTypeParallel,
1.445 + /** Alternative. */
1.446 + EFolderTypeAlternative,
1.447 + /** Digest. */
1.448 + EFolderTypeDigest,
1.449 + /** RFC822. */
1.450 + EFolderTypeRFC822,
1.451 + /** Partial. */
1.452 + EFolderTypePartial,
1.453 + /** Directory. */
1.454 + EFolderTypeDirectory,
1.455 + /** External. */
1.456 + EFolderTypeExternal
1.457 + };
1.458 +
1.459 +/** Describes the types of off-line email operations than can occur.
1.460 +
1.461 +@see TMsvEmailEntry::DisconnectedOperation()
1.462 +@publishedAll
1.463 +@released
1.464 +*/
1.465 +enum TImDisconnectedOperationType
1.466 + {
1.467 + /** No operation. */
1.468 + ENoDisconnectedOperations,
1.469 + /** Create operation. */
1.470 + EDisconnectedCreateOperation,
1.471 + /** Delete operation. */
1.472 + EDisconnectedDeleteOperation,
1.473 + /** Change operation. */
1.474 + EDisconnectedChangeOperation,
1.475 + /** "Copy to" operation. */
1.476 + EDisconnectedCopyToOperation,
1.477 + /** "Copy from" operation. */
1.478 + EDisconnectedCopyFromOperation,
1.479 + /** "Copy within service" operation. */
1.480 + EDisconnectedCopyWithinServiceOperation,
1.481 + /** "Move to" operation. */
1.482 + EDisconnectedMoveToOperation,
1.483 + /** "Move from" operation. */
1.484 + EDisconnectedMoveFromOperation,
1.485 + /** "Move within service" operation. */
1.486 + EDisconnectedMoveWithinServiceOperation,
1.487 + /** Special operation. */
1.488 + EDisconnectedSpecialOperation,
1.489 + /** Unknown operation. */
1.490 + EDisconnectedUnknownOperation,
1.491 + /** Multiple operations. */
1.492 + EDisconnectedMultipleOperation
1.493 + };
1.494 +
1.495 +// Remote folder message count limited to TUint16 by using lower 16 bits of "iMtmData3".
1.496 +// Note: The upper 16 bits of "iMtmData3" are not currently used by "TMsvEmailEntry".
1.497 +const TUint KMsvRemoteFolderEntriesMask = 0x0000FFFF;
1.498 +
1.499 +class TMsvEmailEntry : public TMsvEntry
1.500 +/** Provides storage for and access to extra email specific information for a message.
1.501 +
1.502 +To get a TMsvEmailEntry, get the entry's TMsvEntry, e.g. using
1.503 +@c CMsvEntry::Entry(), and use the constructor that takes a TMsvEntry parameter.
1.504 +
1.505 +Many of the flags are only used by IMAP4 entries. These can be grouped as follows:
1.506 +
1.507 +- IMAP-specific flags, as defined by the IMAP protocol (see RFC3501, 2.3.2. Flags Message Attribute)
1.508 + - GetIMAP4Flags() and SetIMAP4Flags() handle all the flags as a group
1.509 + - \\Seen flag: SetSeenIMAP4Flag(), SeenIMAP4Flag().
1.510 + - \\Answered flag: SetAnsweredIMAP4Flag(), AnsweredIMAP4Flag()
1.511 + - \\Flagged flag: SetFlaggedIMAP4Flag(), FlaggedIMAP4Flag()
1.512 + - \\Deleted flag: SetDeletedIMAP4Flag(), DeletedIMAP4Flag()
1.513 + - \\Draft flag: SetDraftIMAP4Flag(), DraftIMAP4Flag()
1.514 + - \\Recent flag: SetRecentIMAP4Flag(), RecentIMAP4Flag()
1.515 +- Folder subscriptions and other folder-related flags:
1.516 + - SetMailbox(), Mailbox(),
1.517 + - SetSubscribed(), Subscribed(),
1.518 + - SetLocalSubscription(), LocalSubscription()
1.519 + - SetRemoteFolderEntries(), RemoteFolderEntries()
1.520 +- Disconnected operation information:
1.521 + - SetDisconnectedOperation(), DisconnectedOperation().
1.522 +- Partial download flags: these flags allow a client to test if a message or its body has
1.523 + been partially downloaded (see TImImap4GetPartialMailInfo)
1.524 + - SetPartialDownloaded(), PartialDownloaded()
1.525 + - SetBodyTextComplete(), BodyTextComplete()
1.526 +- UID information: IMAP messages have a unique identifier number (see
1.527 + RFC3501, 2.3.1.1. Unique Identifier (UID) Message Attribute)
1.528 + - SetValidUID(), ValidUID()
1.529 + - SetUID(), UID().
1.530 +
1.531 +The following flags are set only by the IMAP MTM. They indicate if the
1.532 +message contains a vCard, vCalendar (http://www.imc.org), or iCalendar (RFC 2445) attachment.
1.533 +
1.534 +- VCard(), SetVCard()
1.535 +- VCalendar(), SetVCalendar()
1.536 +- ICalendar(), SetICalendar()
1.537 +
1.538 +The following flags apply to all email protocols:
1.539 +
1.540 +- Receipt requested: Receipt(), SetReceipt()
1.541 +- MHTML content: MHTMLEmail(), SetMHTMLEmail()
1.542 +
1.543 +Note that the email specific data is stored in the reserved data members @c iMtmData1,
1.544 +@c iMtmData2 and @c iMtmData3 of the TMsvEntry base class. These public data members
1.545 +must not be directly altered by clients.
1.546 +
1.547 +@publishedAll
1.548 +@released
1.549 +@see CImap4ClientMtm
1.550 +*/
1.551 + {
1.552 +public: // Public member functions
1.553 + IMPORT_C TMsvEmailEntry(); // default constructor
1.554 + IMPORT_C TMsvEmailEntry(const TMsvEntry& aGenericEntry);
1.555 +
1.556 + IMPORT_C TBool operator==(const TMsvEntry& aEntry) const;
1.557 + IMPORT_C TBool operator==(const TMsvEmailEntry& aEntry) const;
1.558 +
1.559 + IMPORT_C void GetIMAP4Flags(TBool& rUnread,TBool& rSeen,TBool& rAnswered,TBool& rFlagged,TBool& rDeleted,TBool& rDraft,TBool& rRecent);
1.560 + IMPORT_C void SetIMAP4Flags(TBool aUnread,TBool aSeen,TBool aAnswered,TBool aFlagged,TBool aDeleted,TBool aDraft,TBool aRecent);
1.561 +
1.562 + IMPORT_C void SetMessageFolderType(TImEmailFolderType aFolderType);
1.563 + IMPORT_C TImEmailFolderType MessageFolderType() const;
1.564 +
1.565 + IMPORT_C void SetDisconnectedOperation(TImDisconnectedOperationType aDisconnectedOperationType);
1.566 + IMPORT_C TImDisconnectedOperationType DisconnectedOperation() const;
1.567 +
1.568 + IMPORT_C void SetPartialDownloaded(TBool aPartialDownloaded);
1.569 + IMPORT_C TBool PartialDownloaded() const;
1.570 +
1.571 + //
1.572 + inline void SetEncrypted(TBool aEncrypt);
1.573 + inline TBool Encrypted() const;
1.574 + //
1.575 + inline void SetSigned(TBool aSignature);
1.576 + inline TBool Signed() const;
1.577 + //
1.578 + inline TBool VCard() const;
1.579 + inline void SetVCard(TBool aVCard);
1.580 + //
1.581 + inline TBool VCalendar() const;
1.582 + inline void SetVCalendar(TBool aVCal);
1.583 + //
1.584 + inline TBool ICalendar() const;
1.585 + inline void SetICalendar(TBool aICal);
1.586 + //
1.587 + inline TBool Receipt() const;
1.588 + inline void SetReceipt(TBool aReceipt);
1.589 +
1.590 + inline TBool MHTMLEmail() const;
1.591 + inline void SetMHTMLEmail(TBool aMhtml);
1.592 +
1.593 + inline TBool BodyTextComplete() const;
1.594 + inline void SetBodyTextComplete(TBool aFlag);
1.595 +
1.596 + //
1.597 + // IMAP4-specific flags
1.598 + //
1.599 + inline void SetUnreadIMAP4Flag(TBool aUnread);
1.600 + inline TBool UnreadIMAP4Flag() const;
1.601 + //
1.602 + inline void SetSeenIMAP4Flag(TBool aSeen);
1.603 + inline TBool SeenIMAP4Flag() const;
1.604 + //
1.605 + inline void SetAnsweredIMAP4Flag(TBool aAnswered);
1.606 + inline TBool AnsweredIMAP4Flag() const;
1.607 + //
1.608 + inline void SetFlaggedIMAP4Flag(TBool aFlagged);
1.609 + inline TBool FlaggedIMAP4Flag() const;
1.610 + //
1.611 + inline void SetDeletedIMAP4Flag(TBool aDeleted);
1.612 + inline TBool DeletedIMAP4Flag() const;
1.613 + //
1.614 + inline void SetDraftIMAP4Flag(TBool aDraft);
1.615 + inline TBool DraftIMAP4Flag() const;
1.616 + //
1.617 + inline void SetRecentIMAP4Flag(TBool aRecent);
1.618 + inline TBool RecentIMAP4Flag() const;
1.619 + //
1.620 + inline void SetMailbox(TBool aMailbox);
1.621 + inline TBool Mailbox() const;
1.622 + //
1.623 + inline TBool Orphan() const;
1.624 +
1.625 + inline void SetOrphan(TBool aOrphan);
1.626 + //
1.627 + inline void SetValidUID(TBool aValid);
1.628 + inline TBool ValidUID() const;
1.629 + //
1.630 + inline void SetSubscribed(TBool aSubscribed);
1.631 + inline TBool Subscribed() const;
1.632 + //
1.633 + inline void SetLocalSubscription(TBool aLocal); // i.e. is subscription local, or remote
1.634 + inline TBool LocalSubscription() const;
1.635 + //
1.636 + inline void SetUID(TUint32 aUid);
1.637 + inline TUint32 UID() const;
1.638 + //
1.639 + inline TInt RemoteFolderEntries() const;
1.640 + inline void SetRemoteFolderEntries(TInt aEntries);
1.641 +
1.642 +private:
1.643 + enum TMsvEmailEntryFlags
1.644 + {
1.645 + KMsvEmailEntryClearFlag =0x00,
1.646 + // Flags set on Message entries...
1.647 + KMsvEmailEntryEncryptedFlag =0x00000001,
1.648 + KMsvEmailEntrySignedFlag =0x00000002,
1.649 + KMsvEmailEntryReceiptFlag =0x00000004,
1.650 + KMsvEmailEntryOrphanFlag =0x00000008,
1.651 +
1.652 + // VCard and VCalendar entries may be set on folders or attachments
1.653 + KMsvEmailEntryVCardFlag =0x00000010,
1.654 + KMsvEmailEntryVCalendarFlag =0x00000020,
1.655 +
1.656 + // Message contains HTML data
1.657 + // (Note: HTML and not only MHTML)
1.658 + KMsvEmailEntryMHTMLFlag = 0x00000040,
1.659 + KMsvEmailEntryBodyTextCompleteFlag = 0x00000080,
1.660 +
1.661 + KMsvEmailEntryNoDisconnectedOperations = 0x00000000,
1.662 + KMsvEmailEntryDisconnectedCreateOperation = 0x00000100,
1.663 + KMsvEmailEntryDisconnectedDeleteOperation = 0x00000200,
1.664 + KMsvEmailEntryDisconnectedChangeOperation = 0x00000300,
1.665 + KMsvEmailEntryDisconnectedCopyToOperation = 0x00000400,
1.666 + KMsvEmailEntryDisconnectedCopyFromOperation = 0x00000500,
1.667 + KMsvEmailEntryDisconnectedCopyWithinServiceOperation = 0x00000600,
1.668 + KMsvEmailEntryDisconnectedMoveToOperation = 0x00000700,
1.669 + KMsvEmailEntryDisconnectedMoveFromOperation = 0x00000800,
1.670 + KMsvEmailEntryDisconnectedMoveWithinServiceOperation = 0x00000900,
1.671 + KMsvEmailEntryDisconnectedSpecialOperation = 0x00000A00,
1.672 + KMsvEmailEntryDisconnectedUnknownOperation = 0x00000B00,
1.673 + KMsvEmailEntryDisconnectedMultipleOperation = 0x00000C00,
1.674 + KMsvEmailEntryDisconnectedOperation = 0x00000F00,
1.675 +
1.676 + // IMAP4-specific masks. Can be re-used by non-IMAP4 entries (eg POP3, SMTP)
1.677 + KMsvEmailEntryIMAP4SubscribedFlag =0x00001000,
1.678 + KMsvEmailEntryIMAP4UnreadFlag =0x00002000,
1.679 + KMsvEmailEntryIMAP4SeenFlag =0x00004000,
1.680 + KMsvEmailEntryIMAP4AnsweredFlag =0x00008000,
1.681 + KMsvEmailEntryIMAP4FlaggedFlag =0x00010000,
1.682 + KMsvEmailEntryIMAP4DeletedFlag =0x00020000,
1.683 + KMsvEmailEntryIMAP4DraftFlag =0x00040000,
1.684 + KMsvEmailEntryIMAP4RecentFlag =0x00080000,
1.685 + KMsvEmailEntryIMAP4ValidUIDFlag =0x00100000,
1.686 + KMsvEmailEntryIMAP4MailboxFlag =0x00200000,
1.687 + KMsvEmailEntryIMAP4LocalSubFlag =0x00400000,
1.688 +
1.689 + // MIME "multipart" types assigned to folders.
1.690 + KMsvMimeFolderUnknownMask =0x00000000,
1.691 + KMsvMimeFolderRelatedMask =0x01000000,
1.692 + KMsvMimeFolderMixedMask =0x02000000,
1.693 + KMsvMimeFolderAlternativeMask =0x03000000,
1.694 + KMsvMimeFolderParallelMask =0x04000000,
1.695 + KMsvMimeFolderDigestMask =0x05000000,
1.696 +
1.697 + // MIME message types
1.698 + KMsvMimeFolderRFC822Mask =0x06000000,
1.699 + KMsvMimeFolderPartialMask =0x07000000,
1.700 + KMsvMimeFolderDirectoryMask =0x08000000, // for VCard, VCalendar types
1.701 + KMsvMimeFolderExternalMask =0x09000000,
1.702 + KMsvMimeFolderMask =0x0F000000,
1.703 +
1.704 + // Can be used by POP3 and IMAP4 MTMs.
1.705 + KMsvEmailEntryPartialDownloadFlag =0x10000000,
1.706 +
1.707 + KMsvEmailEntryICalendarFlag =0x20000000
1.708 + };
1.709 +
1.710 + };
1.711 +
1.712 +const TUint16 KImMimeHeaderVersion = 2; // identify which version of this class has been stored
1.713 +
1.714 +class CImMimeHeader : public CBase
1.715 +/** Stores a MIME email header.
1.716 +@publishedAll
1.717 +@released
1.718 +*/
1.719 + {
1.720 +public:
1.721 + IMPORT_C static CImMimeHeader* NewLC();
1.722 + IMPORT_C static CImMimeHeader* NewL();
1.723 + IMPORT_C ~CImMimeHeader();
1.724 + IMPORT_C void Reset();
1.725 + IMPORT_C TInt Size(); // number of header fields stored in object
1.726 +
1.727 + // streaming operations
1.728 + IMPORT_C void InternalizeL( RMsvReadStream& aReadStream );
1.729 + IMPORT_C void ExternalizeL( RMsvWriteStream& aWriteStream ) const;
1.730 + IMPORT_C void RestoreL( CMsvStore& aMessageStore );
1.731 + IMPORT_C void StoreL ( CMsvStore& aMessageStore ) const;
1.732 + IMPORT_C void StoreWithoutCommitL(CMsvStore& aMessageStore) const;
1.733 +
1.734 + /** Sets the Content-Type field value (e.g. "text" in Content-Type:text/plain).
1.735 +
1.736 + The value is MIME defined and should always be 8-bit.
1.737 +
1.738 + @param aPath Field value */
1.739 + IMPORT_C void SetContentTypeL(const TDesC8& aPath);
1.740 + IMPORT_C const TPtrC8 ContentType() const;
1.741 +
1.742 + /** Sets the Content-Type subtype field value (e.g. "plain" in Content-Type:text/plain).
1.743 +
1.744 +
1.745 + The value is MIME defined and should always be 8-bit.
1.746 +
1.747 + @param aPath Field value */
1.748 + IMPORT_C void SetContentSubTypeL(const TDesC8& aPath);
1.749 + IMPORT_C const TPtrC8 ContentSubType() const;
1.750 +
1.751 + /** Sets the Content-Disposition field value (either inline or attachment).
1.752 +
1.753 + The value is MIME defined and should always be 8-bit.
1.754 +
1.755 + @param aPath Field value */
1.756 + IMPORT_C void SetContentDispositionL(const TDesC8& aPath);
1.757 + IMPORT_C const TPtrC8 ContentDisposition() const;
1.758 +
1.759 + /** Sets the Content-Description field value.
1.760 +
1.761 + The value is MIME defined and should always be 8-bit.
1.762 +
1.763 + @param aPath Field value */
1.764 + IMPORT_C void SetContentDescriptionL(const TDesC8& aPath);
1.765 + IMPORT_C const TPtrC8 ContentDescription() const;
1.766 +
1.767 + /** Sets the Content-Base field value.
1.768 +
1.769 + @param aPath Field value */
1.770 + IMPORT_C void SetContentBaseL(const TDesC8& aPath);
1.771 + IMPORT_C const TPtrC8 ContentBase() const;
1.772 +
1.773 + /** Sets the Content-ID field value.
1.774 +
1.775 + @param aPath Field value */
1.776 + IMPORT_C void SetContentIDL(const TDesC8& aPath);
1.777 + IMPORT_C const TPtrC8 ContentID() const;
1.778 +
1.779 + /** Sets the Content-Location field value.
1.780 +
1.781 + @param aPath Field value */
1.782 + IMPORT_C void SetContentLocationL(const TDesC16& aPath);
1.783 + IMPORT_C const TPtrC16 ContentLocation() const;
1.784 +
1.785 + // IMAP-specific info describing relative location of entry w.r.t. parent Email message
1.786 + /** Sets IMAP-specific information for the relative location of the entry to the
1.787 + parent email message.
1.788 +
1.789 + @param aPath Relative location */
1.790 + IMPORT_C void SetRelativePathL(const TDesC8& aPath);
1.791 + IMPORT_C const TPtrC8 RelativePath() const;
1.792 +
1.793 + /** Sets the Content-Transfer-Encoding field value.
1.794 +
1.795 + @param aType Field value */
1.796 + IMPORT_C void SetContentTransferEncodingL(const TDesC8& aType);
1.797 + IMPORT_C TImEncodingType ContentTransferEncoding() const;
1.798 + IMPORT_C TImEncodingType ContentTransferEncoding(TDes8& rType) const;
1.799 + IMPORT_C const TPtrC8 GetContentTypeValue(const TDesC8& aContentTypeParameter) const;
1.800 +
1.801 + // inlines to access arrays
1.802 + inline const CDesC8Array& ContentTypeParams() const;
1.803 + inline const CDesC8Array& ContentDispositionParams() const;
1.804 + inline const CDesC8Array& XTypeParams() const;
1.805 +
1.806 + inline CDesC8Array& ContentTypeParams();
1.807 + inline CDesC8Array& ContentDispositionParams();
1.808 + inline CDesC8Array& XTypeParams(); // anything else that is in the header, but not recognised
1.809 +
1.810 + inline const TUint16 Version() const;
1.811 + inline void SetVersion( TUint16 aVersion );
1.812 +
1.813 + IMPORT_C void SetMimeCharset(const TUint aCharset);
1.814 + IMPORT_C TUint MimeCharset() const;
1.815 +
1.816 +private:
1.817 + CImMimeHeader();
1.818 + void ConstructL();
1.819 + TBool ArrayEntryExists(CDesCArray& aArray, TInt aField);
1.820 +
1.821 +private:
1.822 + TUint16 iVersion;
1.823 + HBufC8* iRelativePath;
1.824 + HBufC8* iContentDescription;
1.825 +
1.826 + TImEncodingType iContentTransferEncoding;
1.827 +
1.828 + // MHTML parameters
1.829 + HBufC8* iContentBase;
1.830 + HBufC16* iContentLocation;
1.831 + HBufC8* iContentID;
1.832 + //
1.833 + HBufC8* iContentType;
1.834 + HBufC8* iContentSubType;
1.835 + HBufC8* iContentDisposition;
1.836 + //
1.837 + CDesC8Array* iContentTypeParams; // zero or more "parameter"
1.838 + CDesC8Array* iContentDispositionParams; // zero or more "parameters"
1.839 + CDesC8Array* iXTypeParams; // zero or more X-Type "parameters"
1.840 + //
1.841 + TBuf<20> iContentTransferEncodingBuffer; // must be big enough to store "quoted-printable" string
1.842 +
1.843 + // The uid value is always used in preference to the stored string.
1.844 + // Only when the uid is not set is the string used when sending.
1.845 + TUint iMimeCharset;
1.846 + };
1.847 +
1.848 +
1.849 +
1.850 +#include <miuthdr.inl>
1.851 +
1.852 +#endif // #defined __MIUTHDR_H__