00001 /* 00002 * ============================================================================ 00003 * Name : CMmsClientMtm from mmsclient.h 00004 * Part of : mmsengine\clientmtm 00005 * 00006 * Description: 00007 * Client Mtm for multimedia messaging. 00008 * This is the API for accessing multimedia messaging engine. 00009 * Version: 00010 * 00011 * Copyright (C) 2002-2006 Nokia Corporation. 00012 * This material, including documentation and any related 00013 * computer programs, is protected by copyright controlled by 00014 * Nokia Corporation. All rights are reserved. Copying, 00015 * including reproducing, storing, adapting or translating, any 00016 * or all of this material requires the prior written consent of 00017 * Nokia Corporation. This material also contains confidential 00018 * information which may not be disclosed to others without the 00019 * prior written consent of Nokia Corporation. 00020 * ============================================================================ 00021 */ 00022 00023 #ifndef MMSCLIENT_H 00024 #define MMSCLIENT_H 00025 00026 // INCLUDES 00027 #include <mtclbase.h> // base client mtm 00028 #include <e32std.h> // TTimeInterval & TTime 00029 #include "mmsconst.h" // common constants 00030 00031 // CONSTANTS 00032 00033 // MACROS 00034 00035 // DATA TYPES 00036 typedef struct 00037 { 00038 const TUint SymbianCharsetUID; 00039 const TUint IANAMIBEnum; 00040 }TMmsCharacterSetLookup; 00041 00042 // FUNCTION PROTOTYPES 00043 00044 // FORWARD DECLARATIONS 00045 class CMmsSettings; 00046 class CMmsHeaders; 00047 class CMsvMimeHeaders; 00048 class CMsvFindText; 00049 class CMmsAttachmentWaiter; 00050 00051 // CLASS DECLARATION 00052 00093 class CMmsClientMtm :public CBaseMtm 00094 { 00095 public: // Constructors and destructor 00096 00108 IMPORT_C static CMmsClientMtm* NewL( 00109 CRegisteredMtmDll& aRegisteredMtmDll, 00110 CMsvSession& aSession ); 00111 00115 virtual ~CMmsClientMtm(); 00116 00117 public: // New functions 00118 00119 // ---------------------------------------------------------- 00120 // Functions to create and modify message entries 00121 00185 virtual CMsvOperation* CreateNewEntryL( 00186 TMsvId aDestination, 00187 TRequestStatus& aCompletionStatus); 00188 00189 00190 // ------------------------------------------------------------------- 00191 // FUNCTIONS TO HANDLE MMSC SETTINGS 00192 // 00193 // Only one MMS service entry may be created! 00194 // 00195 // The Client MTM maintains cached MMS service settings, referred to 00196 // as current service below. Some of those cached settings are used 00197 // as template values when a new multimedia message is created. 00198 // 00199 // Use Base MTM functions to get default service id. 00200 00201 // <DEPRECATED> 00209 virtual void CreateServiceL(); 00210 // </DEPRECATED> 00211 00212 // Functions to load, save, and access MMS Settings. 00213 // There is no need to change the context when these functions are used. 00214 // 00215 00247 virtual const CMmsSettings& MmsSettings(); 00248 00263 virtual void SetSettingsL( const CMmsSettings& aSettings ); 00264 00271 virtual void StoreSettingsL(); 00272 00279 virtual void RestoreSettingsL(); 00280 00281 // <DEPRECATED> 00289 virtual void RestoreFactorySettingsL( 00290 TMmsFactorySettingsLevel aLevel = EMmsFactorySettingsLevelNormal ); 00291 // </DEPRECATED> 00292 00309 virtual TInt ValidateService( TMsvId aServiceId ); 00310 00311 // ------------------------------------------------------------------- 00312 // FUNCTIONS TO HANDLE MMS HEADERS 00313 00314 // Accessors and mutators (getters and setters) for header fields. 00315 // Some of these header fields have default values that are assigned 00316 // from cached service settings when a new header is allocated. 00317 // Some header fields are needed by protocol only. 00318 // Those headers don't have accessors and mutators here, 00319 // as they are used by Server MTM who accesses them directly 00320 // through functions offered by CMmsHeaders. 00321 00335 virtual void SetSenderL( const TDesC& aAlias ); 00336 00343 virtual const TPtrC Sender() const; 00344 00358 virtual void SetMessageClass( TMmsMessageClass aMessageClass ); 00359 00371 virtual TInt MessageClass() const; 00372 00383 virtual void SetExpiryInterval( TTimeIntervalSeconds aInterval ); 00384 00393 virtual TTimeIntervalSeconds ExpiryInterval() const; 00394 00404 virtual void SetExpiryDate( TTime aDate ); 00405 00413 virtual TTime ExpiryDate() const; 00414 00423 virtual void SetDeliveryTimeInterval( TTimeIntervalSeconds aInterval ); 00424 00432 virtual TTimeIntervalSeconds DeliveryTimeInterval() const; 00433 00443 virtual void SetDeliveryDate( TTime aDate ); 00444 00452 virtual TTime DeliveryDate() const; 00453 00465 virtual void SetMessagePriority( TMmsMessagePriority aPriority ); 00466 00476 virtual TInt MessagePriority() const; 00477 00493 virtual void SetSenderVisibility( 00494 TMmsMessageSenderVisibility aVisibility ); 00495 00510 virtual TInt SenderVisibility() const; 00511 00522 virtual void SetDeliveryReport( 00523 TMmsYesNo aRequest ); 00524 00535 virtual TInt DeliveryReport() const; 00536 00548 virtual void SetReadReply( TMmsYesNo aRequest ); 00549 00564 virtual TInt ReadReply() const; 00565 00573 virtual TTime SendingDate() const; 00574 00586 virtual TPtrC ResponseText() const; 00587 00607 virtual TInt ResponseStatus() const; 00608 00620 virtual TInt NumberOfPreviousSenders() const; 00621 00636 virtual TPtrC PreviousSender( TInt aSequenceNumber ) const; 00637 00652 virtual TTime PreviousSendingDate( TInt aSequenceNumber ) const; 00653 00661 virtual TTime MessageReceiveTime() const; 00662 00670 virtual TInt MessageTransferSize() const; 00671 00680 virtual TPtrC8 MessageContentLocation() const; 00681 00688 virtual void SetMessageRootL( const TMsvAttachmentId aId ); 00689 00696 virtual TMsvAttachmentId MessageRootAttachment() const; 00697 00704 virtual void SetMaximumImage( TInt aWidth, TInt aHeight ); 00705 00713 virtual void GetMaximumImage( TInt& aWidth, TInt& aHeight ) const; 00714 00715 // ------------------------------------------------------------------- 00716 // GENERAL MESSAGE INFORMATION METHODS 00717 00728 virtual TInt32 MessageSize(); 00729 00746 virtual void SetMessageDescriptionL( const TDesC& aText ); 00747 00748 // --------------------------------------------------------------------- 00749 // FUNCTIONS TO HANDLE EXTRA MESSAGE ATTRIBUTES (FOR UI USE ONLY) 00750 00765 virtual void AddAttributeL( const TDesC& aName, const TDesC& aValue ); 00766 00774 virtual TPtrC GetAttributeL( const TDesC& aName ); 00775 00782 virtual TBool FindAttribute( const TDesC& aName ); 00783 00789 virtual void DeleteAttribute( const TDesC& aName ); 00790 00796 virtual void ResetAttributes(); 00797 00798 // ------------------------------------------------------------------- 00799 // FUNCTIONS TO HANDLE MESSAGE ATTACHMENTS 00800 00910 virtual void CreateAttachment2L( 00911 CMsvStore& aStore, 00912 RFile& aFile, 00913 TDesC8& aMimeType, 00914 CMsvMimeHeaders& aMimeHeaders, 00915 CMsvAttachment* aAttachmentInfo, 00916 TMsvAttachmentId& aAttaId); 00917 00968 virtual void CreateTextAttachmentL( 00969 CMsvStore& aStore, 00970 TMsvAttachmentId& aAttachmentId, 00971 const TDesC& aText, 00972 const TDesC& aFile, 00973 TBool aConvertParagraphSeparator = ETrue ); 00974 00975 // ------------------------------------------------------------------- 00976 // MESSAGE HANDLING FUNCTIONS 00977 00978 // NOTE: these are asynchronous functions 00979 01003 virtual CMsvOperation* SendL( TRequestStatus& aCompletionStatus, 01004 const TTime aSendingTime = TTime( 0 ) ); 01005 01031 virtual CMsvOperation* SendL( 01032 CMsvEntrySelection& aSelection, 01033 TRequestStatus& aCompletionStatus, 01034 TTime aSendingTime = TTime( 0 ) ); 01035 01061 virtual CMsvOperation* FetchAllL( TRequestStatus& aCompletionStatus, 01062 TBool aForced = ETrue ); 01063 01064 01065 public: // FUNCTIONS FROM BASE CLASSES 01066 01071 inline TUid Type() const; 01072 01073 01074 // Context specific functions 01075 01080 inline void SetCurrentEntryL( CMsvEntry* aEntry ); 01081 01086 inline void SwitchCurrentEntryL( TMsvId aId ); 01087 01092 inline CMsvEntry& Entry() const; 01093 01100 inline TBool HasContext() const; 01101 01102 // Message specific functions 01103 01107 void SaveMessageL(); 01108 01112 void LoadMessageL(); 01113 01129 TMsvPartList ValidateMessage( TMsvPartList aPartList ); 01130 01146 TMsvPartList Find( const TDesC& aTextToFind, TMsvPartList aPartList ); 01147 01170 CMsvOperation* ReplyL( 01171 TMsvId aDestination, 01172 TMsvPartList aPartlist, 01173 TRequestStatus& aCompletionStatus ); 01174 01197 CMsvOperation* ForwardL( 01198 TMsvId aDestination, 01199 TMsvPartList aPartList, 01200 TRequestStatus& aCompletionStatus ); 01201 01216 void AddAddresseeL( const TDesC& aRealAddress ); 01217 01225 void AddAddresseeL( const TDesC& aRealAddress, const TDesC& aAlias ); 01226 01236 virtual void AddAddresseeL( 01237 TMsvRecipientType aType, 01238 const TDesC& aRealAddress); 01239 01250 virtual void AddAddresseeL( 01251 TMsvRecipientType aType, 01252 const TDesC& aRealAddress, 01253 const TDesC& aAlias); 01254 01262 void RemoveAddressee( TInt aIndex ); 01263 01264 // Note: rich text body not supported in MMS Message encapsulation. 01265 01273 inline CRichText& Body(); 01274 01282 inline const CRichText& Body() const; 01283 01288 void SetSubjectL( const TDesC& aSubject ); 01289 01294 const TPtrC SubjectL() const; 01295 01296 // General MTM-specific functionality 01297 01310 TInt QueryCapability( TUid aCapability, TInt& aResponse ); 01311 01325 void InvokeSyncFunctionL( 01326 TInt aFunctionId, 01327 const CMsvEntrySelection& aSelection, 01328 TDes8& aParameter ); 01329 01346 CMsvOperation* InvokeAsyncFunctionL( 01347 TInt aFunctionId, 01348 const CMsvEntrySelection& aSelection, 01349 TDes8& aParameter, 01350 TRequestStatus& aCompletionStatus ); 01351 01356 inline CMsvSession& Session(); 01357 01358 // Functions for SendAs support 01359 01415 void AddAttachmentL( const TDesC& aFilePath, 01416 const TDesC8& aMimeType, 01417 TUint aCharset, 01418 TRequestStatus& aStatus ); 01419 01479 void AddAttachmentL( RFile& aFile, 01480 const TDesC8& aMimeType, 01481 TUint aCharset, 01482 TRequestStatus& aStatus ); 01483 01512 void AddLinkedAttachmentL( const TDesC& aFilePath, 01513 const TDesC8& aMimeType, 01514 TUint aCharset, 01515 TRequestStatus& aStatus ); 01516 01524 void AddEntryAsAttachmentL( TMsvId aAttachmentId, 01525 TRequestStatus& aStatus ); 01526 01581 void CreateAttachmentL( const TDesC& aFileName, 01582 RFile& aAttachmentFile, 01583 const TDesC8& aMimeType, 01584 TUint aCharset, 01585 TRequestStatus& aStatus); 01586 01590 void CancelAttachmentOperation(); 01591 01592 // End of attachment funtions to support SendAs 01593 01617 void CreateMessageL( TMsvId aServiceId ); 01618 01624 void BioTypeChangedL( TUid aBioTypeUid ); 01625 01632 TMsvId DefaultServiceL() const; 01633 01639 void RemoveDefaultServiceL(); 01640 01646 void ChangeDefaultServiceL(const TMsvId& aService); 01647 01648 protected: // New functions 01649 01655 CMsvEntrySelection* ListNotificationsInInboxL(); 01656 01657 protected: // Functions from base classes 01658 01663 void ContextEntrySwitched(); 01664 01673 void HandleEntryEventL( 01674 TMsvEntryEvent aEvent, 01675 TAny* arg1, 01676 TAny* arg2, 01677 TAny* arg3 ); 01678 01684 CMmsClientMtm( 01685 CRegisteredMtmDll& aRegisteredMtmDll, 01686 CMsvSession& aSession ); 01687 01688 void ConstructL(); 01689 01690 private: 01691 01695 void BuildAddresseeListL(); 01696 01702 void BuildAddresseeListL( 01703 const CDesCArray& aArray, TMsvRecipientType aValue); 01704 01709 TInt32 AttachmentsSizeL(); 01710 01715 CMsvEntrySelection* ListMmsFolderNotificationsL(); 01716 01721 CMsvEntrySelection* ListInboxNotificationsL(); 01722 01737 CMsvOperation* FetchAllFromInboxL( TRequestStatus& aCompletionStatus, 01738 TBool aForced = ETrue ); 01739 01745 // all times expressed in global time zone - no conversions 01746 /* 01747 TInt64 ConvertUTCDateToLocal( TInt64 aDate ) const; 01748 */ 01749 01758 TBool FindInRecipientL( 01759 const TDesC& aTextToFind, 01760 TMsvPartList aPartlist, 01761 const CDesCArray& aRecipients, 01762 CMsvFindText& aFindText ); 01763 01776 void AddFilePathAttachmentL(const TDesC& aFilePath, 01777 const TDesC8& aMimeType, 01778 CMsvAttachment::TMsvAttachmentType aType, 01779 TRequestStatus& aStatus, 01780 const TUint aCharacterSet = 0 ); 01781 01786 void StoreAttributesL( CMsvStore& aStore ); 01787 01792 void RestoreAttributesL( CMsvStore& aStore ); 01793 01802 TUint GetUnicodeCharacterSet( TDesC8& aSample ); 01803 01811 void ReadBytesFromFileL( const RFile aFile, TDes8& aSample ); 01812 01819 TUint RecognizeCharSetL( RFile& aFile ); 01820 01827 TUint CharconvIdToMibIdL( TUint aCharconvCharsetId ); 01828 01829 01830 public: // Data 01831 01832 protected: // Data 01833 CMmsSettings* iMmsSettings; // MMSC settings (access point etc.) 01834 01835 CMmsHeaders* iMmsHeaders; // MMS message headers 01836 TMsvId iServiceId; // last selected service 01837 TBool iFetchAll; // All the messages are fetched when 01838 // settings are saved after certain fetch 01839 // mode change. 01840 TBool iFetchOverride; // force fetching all messages. 01841 TInt iMessageDrive; // messages are on C: drive by default, 01842 // may be moved to other drive 01843 TInt32 iHomeMode; // receiving mode in the home network 01844 TInt32 iRoamingMode; // receiving mode when roaming 01845 TInt iAccessPointCount; // number of access points 01846 CDesCArrayFlat* iAttributes; // zero or more attributes for UI. 01847 // Name, value pairs 01848 #start_since SINCE_3_1_SDK 01849 01852 CMsvSession& iOwnSession; // copy of session because base class session is private 01853 #end_since SINCE_3_1_SDK 01854 01855 01856 private: // Data 01857 // active object that commits the store when attachment operation 01858 // is complete 01859 CMmsAttachmentWaiter* iAttaWaiter; 01860 01861 public: // Friend classes 01862 01863 protected: // Friend classes 01864 01865 private: // Friend classes 01866 01867 }; 01868 01869 // panic function 01870 GLREF_C void gPanic( TMmsPanic aPanic ); 01871 01872 #include "mmsclient.inl" 01873 01874 // MMSCLIENT_H 01875 #endif 01876 01877 // End of File 01878