epoc32/include/smtcmtm.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 smtcmtm.h
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // SMTCPMTM.H
       
    15 // Client MTM for the SMTP protocol
       
    16 // 
       
    17 //
       
    18 
       
    19 #if !defined (__SMTCMTM_H__)
       
    20 #define __SMTCMTM_H__
       
    21 
       
    22 #if !defined (__E32BASE_H__)
       
    23 #include <e32base.h>		// CActive, TFileName)
       
    24 #endif
       
    25 
       
    26 #if !defined(__BADESCA_H__)
       
    27 #include <badesca.h>
       
    28 #endif
       
    29 
       
    30 #if !defined (__MSVAPI_H__)
       
    31 #include <msvapi.h>
       
    32 #endif
       
    33 
       
    34 #if !defined (__MTCLBASE_H__)
       
    35 #include <mtclbase.h>
       
    36 #endif
       
    37 
       
    38 #if !defined (__MIUTHDR_H__)
       
    39 #include <miuthdr.h>
       
    40 #endif
       
    41 
       
    42 #if !defined (__MIUTPARS_H__)
       
    43 #include <miutpars.h>		//TImMessageField
       
    44 #endif
       
    45 
       
    46 #if !defined (__MIUTMSG_H__)
       
    47 #include <miutmsg.h>		//CImEmailMessage
       
    48 #endif
       
    49 
       
    50 #if !defined (__SMTPSET_H__)
       
    51 #include <smtpset.h>
       
    52 #endif
       
    53 
       
    54 #if !defined (__SMTPCMDS_H__)
       
    55 #include <smtpcmds.h>
       
    56 #endif
       
    57 
       
    58 class CMsvEntry;
       
    59 class CMtmDllRegistry;
       
    60 class CRichText;
       
    61 class TMsvEntry;
       
    62 class CRegisteredMtmDll;
       
    63 class CImSmtpSettings;
       
    64 class CMsvSession;
       
    65 class CImAttachmentWaiter;
       
    66 
       
    67 ///////  Smtp Client MTM  /////////////////////////////////////////////////////////////////////////////
       
    68 class CSmtpClientMtm : public CBaseMtm
       
    69 /** SMTP client MTM interface.
       
    70 
       
    71 Most of the functions in this class are implementations of the virtual functions 
       
    72 defined by the base class CBaseMtm. 
       
    73 @publishedAll
       
    74 @released
       
    75 */
       
    76 	{
       
    77 public:
       
    78 	IMPORT_C static CSmtpClientMtm* NewL(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession);
       
    79 	~CSmtpClientMtm();
       
    80 
       
    81 	void SaveMessageL();
       
    82 	void LoadMessageL();
       
    83 
       
    84 	IMPORT_C void StoreSettingsL();
       
    85 	IMPORT_C void RestoreSettingsL();
       
    86 
       
    87 	CMsvOperation* ReplyL  (TMsvId aReplyEntryId, TMsvPartList aPartlist, TRequestStatus& aCompletionStatus);
       
    88 	CMsvOperation* ForwardL(TMsvId aForwardEntryId, TMsvPartList aPartList, TRequestStatus& aCompletionStatus);
       
    89 
       
    90 	TMsvPartList ValidateMessage(TMsvPartList aPartList);
       
    91 	TMsvPartList Find(const TDesC& aTextToFind, TMsvPartList aPartList);
       
    92 
       
    93 	// addresssee list (used by objects with no MTM knowledge)
       
    94 	void AddAddresseeL(const TDesC& aRealAddress);
       
    95 	void AddAddresseeL(const TDesC& aRealAddress, const TDesC& aAlias);
       
    96 	void AddAddresseeL(TMsvRecipientType aType, const TDesC& aRealAddress);
       
    97 	void AddAddresseeL(TMsvRecipientType aType, const TDesC& aRealAddress, const TDesC& aAlias);
       
    98 	void RemoveAddressee(TInt aIndex);
       
    99 
       
   100 	IMPORT_C void SetSettingsL(const CImSmtpSettings& aSettings);
       
   101 	IMPORT_C const CImSmtpSettings& Settings() const; 
       
   102 	IMPORT_C void SetSubjectL(const TDesC& aSubject);
       
   103 	IMPORT_C const TPtrC SubjectL() const;
       
   104 
       
   105 	// --- RTTI functions ---
       
   106 	TInt QueryCapability(TUid aCapability, TInt& aResponse);
       
   107 	void InvokeSyncFunctionL(TInt aFunctionId,const CMsvEntrySelection& aSelection, TDes8& aParameter);
       
   108 	CMsvOperation* InvokeAsyncFunctionL(TInt aFunctionId,const CMsvEntrySelection& aSelection, TDes8& aParameter, TRequestStatus& aCompletionStatus);
       
   109 
       
   110 	// Attachment functions to support the SendAs API
       
   111 	IMPORT_C virtual void AddAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
       
   112 	IMPORT_C virtual void AddAttachmentL(RFile& aFile, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
       
   113 	IMPORT_C virtual void AddLinkedAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
       
   114 	IMPORT_C virtual void AddEntryAsAttachmentL(TMsvId aAttachmentId, TRequestStatus& aStatus);
       
   115 	IMPORT_C virtual void CreateAttachmentL(const TDesC& aFileName, RFile& aAttachmentFile, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
       
   116 	IMPORT_C virtual void CreateMessageL(TMsvId aServiceId);
       
   117 
       
   118 	IMPORT_C virtual TMsvId DefaultServiceL() const;
       
   119 	IMPORT_C virtual void RemoveDefaultServiceL();
       
   120 	IMPORT_C virtual void ChangeDefaultServiceL(const TMsvId& aService);
       
   121 	IMPORT_C void CancelAttachmentOperation();
       
   122 
       
   123 protected:
       
   124 	CSmtpClientMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession);
       
   125 	void ConstructL();
       
   126 	
       
   127 	void ContextEntrySwitched(); // called after the context of this instance has been changed to another entry
       
   128 private:
       
   129 	TBool ValidateAddress(const TPtrC& anAddress);
       
   130 	void ResetData();
       
   131 
       
   132 	void RestoreEmailMessageL();
       
   133 	void StoreEmailMessageL();
       
   134 	void SetAddresseeListL();
       
   135 	void GetBodyTextL(CImEmailMessage& aMessage, TMsvId aMsvId);
       
   136 	TInt32 GetAttachmentSizeL(CImEmailMessage& aMessage, TMsvId aMsvId);
       
   137 	TMsvPartList DoFindL(const TDesC& aTextToFind, TMsvPartList aPartList);
       
   138 
       
   139 private:
       
   140 	CMsvOperationActiveSchedulerWait* iWait;
       
   141 	CImSmtpSettings* iImSmtpSettings;
       
   142 	CImHeader* iHeader;
       
   143 	HBufC* iSubject;
       
   144 
       
   145 	TImMessageField iTImMessageField;
       
   146 	HBufC* iEmailAddressFormatString;	// defines format of email address used by "Send as" API eg _LIT("/"%S/" <%S>")
       
   147 	CMsvEntrySelection* iEntrySelection;
       
   148 	CImEmailOperation*	iImEmailOperation;
       
   149 	CImAttachmentWaiter* iAttachmentWaiter;
       
   150 	CImEmailMessage* iEmailMessage;
       
   151 	};
       
   152 
       
   153 
       
   154 #endif // __SMTCMTM_H__