mmsclient.h

Go to the documentation of this file.
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>
00211         virtual void CreateServiceL();
00212 // </DEPRECATED>
00213 
00214         // Functions to load, save, and access MMS Settings.
00215         // There is no need to change the context when these functions are used.
00216         //
00217 
00249         virtual const CMmsSettings& MmsSettings();
00250 
00265         virtual void SetSettingsL( const CMmsSettings& aSettings );
00266 
00273         virtual void StoreSettingsL();
00274 
00281         virtual void RestoreSettingsL();
00282 
00283 // <DEPRECATED>
00292         virtual void RestoreFactorySettingsL(
00293             TMmsFactorySettingsLevel aLevel = EMmsFactorySettingsLevelNormal );
00294 // </DEPRECATED>
00295 
00312         virtual TInt ValidateService( TMsvId aServiceId );
00313 
00314         // -------------------------------------------------------------------
00315         // FUNCTIONS TO HANDLE MMS HEADERS
00316 
00317         // Accessors and mutators (getters and setters) for header fields.
00318         // Some of these header fields have default values that are assigned
00319         // from cached service settings when a new header is allocated.
00320         // Some header fields are needed by protocol only.
00321         // Those headers don't have accessors and mutators here,
00322         // as they are used by Server MTM who accesses them directly
00323         // through functions offered by CMmsHeaders.
00324 
00338         virtual void SetSenderL( const TDesC& aAlias );
00339 
00346         virtual const TPtrC Sender() const;
00347 
00361         virtual void SetMessageClass( TMmsMessageClass aMessageClass );
00362 
00374         virtual TInt MessageClass() const;
00375 
00386         virtual void SetExpiryInterval( TTimeIntervalSeconds aInterval );
00387 
00396         virtual TTimeIntervalSeconds ExpiryInterval() const;
00397 
00407         virtual void SetExpiryDate( TTime aDate );
00408 
00416         virtual TTime ExpiryDate() const;
00417 
00426         virtual void SetDeliveryTimeInterval( TTimeIntervalSeconds aInterval );
00427 
00435         virtual TTimeIntervalSeconds DeliveryTimeInterval() const;
00436 
00446         virtual void SetDeliveryDate( TTime aDate );
00447 
00455         virtual TTime DeliveryDate() const;
00456 
00468         virtual void SetMessagePriority( TMmsMessagePriority aPriority );
00469 
00479         virtual TInt MessagePriority() const;
00480 
00496         virtual void SetSenderVisibility(
00497             TMmsMessageSenderVisibility aVisibility );
00498 
00513         virtual TInt SenderVisibility() const;
00514 
00525         virtual void SetDeliveryReport(
00526             TMmsYesNo aRequest );
00527 
00538         virtual TInt DeliveryReport() const;
00539 
00551         virtual void SetReadReply( TMmsYesNo aRequest );
00552 
00567         virtual TInt ReadReply() const;
00568 
00576         virtual TTime SendingDate() const;
00577 
00589         virtual TPtrC ResponseText() const;
00590 
00610         virtual TInt ResponseStatus() const;
00611 
00623         virtual TInt NumberOfPreviousSenders() const;
00624 
00639         virtual TPtrC PreviousSender( TInt aSequenceNumber ) const;
00640 
00655         virtual TTime PreviousSendingDate( TInt aSequenceNumber ) const;
00656 
00664         virtual TTime MessageReceiveTime() const;
00665 
00673         virtual TInt MessageTransferSize() const;
00674 
00683         virtual TPtrC8 MessageContentLocation() const;
00684 
00691         virtual void SetMessageRootL( const TMsvAttachmentId aId );
00692 
00699         virtual TMsvAttachmentId MessageRootAttachment() const;
00700 
00707         virtual void SetMaximumImage( TInt aWidth, TInt aHeight );
00708 
00716         virtual void GetMaximumImage( TInt& aWidth, TInt& aHeight ) const;
00717 
00718         // -------------------------------------------------------------------
00719         // GENERAL MESSAGE INFORMATION METHODS
00720 
00731         virtual TInt32 MessageSize();
00732 
00749         virtual void SetMessageDescriptionL( const TDesC& aText );
00750 
00751         // ---------------------------------------------------------------------
00752         // FUNCTIONS TO HANDLE EXTRA MESSAGE ATTRIBUTES (FOR UI USE ONLY)
00753 
00768         virtual void AddAttributeL( const TDesC& aName, const TDesC& aValue );
00769 
00777         virtual TPtrC GetAttributeL( const TDesC& aName );
00778 
00785         virtual TBool FindAttribute( const TDesC& aName );
00786 
00792         virtual void DeleteAttribute( const TDesC& aName );
00793 
00799         virtual void ResetAttributes();
00800 
00801         // -------------------------------------------------------------------
00802         // FUNCTIONS TO HANDLE MESSAGE ATTACHMENTS
00803 
00913         virtual void CreateAttachment2L(
00914             CMsvStore& aStore,
00915             RFile& aFile,
00916             TDesC8& aMimeType,
00917             CMsvMimeHeaders& aMimeHeaders,
00918             CMsvAttachment* aAttachmentInfo,
00919             TMsvAttachmentId& aAttaId);
00920 
00971         virtual void CreateTextAttachmentL(
00972             CMsvStore& aStore,
00973             TMsvAttachmentId& aAttachmentId,
00974             const TDesC& aText,
00975             const TDesC& aFile,
00976             TBool aConvertParagraphSeparator = ETrue );
00977 
00978         // -------------------------------------------------------------------
00979         // MESSAGE HANDLING FUNCTIONS
00980 
00981         // NOTE: these are asynchronous functions
00982 
01006         virtual CMsvOperation* SendL( TRequestStatus& aCompletionStatus,
01007             const TTime aSendingTime = TTime( 0 ) );
01008 
01034         virtual CMsvOperation* SendL(
01035             CMsvEntrySelection& aSelection,
01036             TRequestStatus& aCompletionStatus,
01037             TTime aSendingTime = TTime( 0 ) );
01038 
01066         virtual CMsvOperation* FetchAllL( TRequestStatus& aCompletionStatus,
01067             TBool aForced = ETrue );
01068             
01101         virtual CMsvOperation* SendReadReportL( TMsvId aReadMessageId,
01102             TRequestStatus& aCompletionStatus,
01103             TMmsReadStatus aReadStatus = EMmsReadStatusRead );
01104             
01105     public:  // FUNCTIONS FROM BASE CLASSES
01106 
01111         inline TUid Type() const;
01112 
01113 
01114         // Context specific functions
01115 
01120         inline void SetCurrentEntryL( CMsvEntry* aEntry );
01121 
01126         inline void SwitchCurrentEntryL( TMsvId aId );
01127 
01132         inline CMsvEntry& Entry() const;
01133 
01140         inline TBool HasContext() const;
01141 
01142         // Message specific functions
01143 
01147         void SaveMessageL();
01148 
01152         void LoadMessageL();
01153 
01169         TMsvPartList ValidateMessage( TMsvPartList aPartList );
01170 
01186         TMsvPartList Find( const TDesC& aTextToFind, TMsvPartList aPartList );
01187 
01210         CMsvOperation* ReplyL(
01211             TMsvId aDestination,
01212             TMsvPartList aPartlist,
01213             TRequestStatus& aCompletionStatus );
01214 
01237         CMsvOperation* ForwardL(
01238             TMsvId aDestination,
01239             TMsvPartList aPartList,
01240             TRequestStatus& aCompletionStatus );
01241 
01256         void AddAddresseeL( const TDesC& aRealAddress );
01257 
01265         void AddAddresseeL( const TDesC& aRealAddress, const TDesC& aAlias );
01266 
01276         virtual void AddAddresseeL(
01277             TMsvRecipientType aType,
01278             const TDesC& aRealAddress);
01279 
01290         virtual void AddAddresseeL(
01291             TMsvRecipientType aType,
01292             const TDesC& aRealAddress,
01293             const TDesC& aAlias);
01294 
01302         void RemoveAddressee( TInt aIndex );
01303 
01304         // Note: rich text body not supported in MMS Message encapsulation.
01305 
01313         inline CRichText& Body();
01314 
01322         inline const CRichText& Body() const;
01323 
01328         void SetSubjectL( const TDesC& aSubject );
01329 
01334         const TPtrC SubjectL() const;
01335 
01336         // General MTM-specific functionality
01337 
01350         TInt QueryCapability( TUid aCapability, TInt& aResponse );
01351 
01365         void InvokeSyncFunctionL(
01366             TInt aFunctionId,
01367             const CMsvEntrySelection& aSelection,
01368             TDes8& aParameter );
01369 
01386         CMsvOperation*  InvokeAsyncFunctionL(
01387             TInt aFunctionId,
01388             const CMsvEntrySelection& aSelection,
01389             TDes8& aParameter,
01390             TRequestStatus& aCompletionStatus );
01391 
01396         inline CMsvSession& Session();
01397 
01398         // Functions for SendAs support
01399 
01455         void AddAttachmentL( const TDesC& aFilePath,
01456             const TDesC8& aMimeType,
01457             TUint aCharset,
01458             TRequestStatus& aStatus );
01459 
01519         void AddAttachmentL( RFile& aFile,
01520             const TDesC8& aMimeType,
01521             TUint aCharset,
01522             TRequestStatus& aStatus );
01523 
01552         void AddLinkedAttachmentL( const TDesC& aFilePath,
01553             const TDesC8& aMimeType,
01554             TUint aCharset,
01555             TRequestStatus& aStatus );
01556 
01564         void AddEntryAsAttachmentL( TMsvId aAttachmentId,
01565             TRequestStatus& aStatus );
01566 
01621         void CreateAttachmentL( const TDesC& aFileName,
01622             RFile& aAttachmentFile,
01623             const TDesC8& aMimeType,
01624             TUint aCharset,
01625             TRequestStatus& aStatus);
01626 
01630         void CancelAttachmentOperation();
01631 
01632         // End of attachment funtions to support SendAs
01633 
01657         void CreateMessageL( TMsvId aServiceId );
01658 
01664         void BioTypeChangedL( TUid aBioTypeUid );
01665 
01672         TMsvId DefaultServiceL() const;
01673 
01679         void RemoveDefaultServiceL();
01680 
01686         void ChangeDefaultServiceL(const TMsvId& aService);
01687 
01688     protected:  // New functions
01689 
01695         CMsvEntrySelection* ListNotificationsInInboxL();
01696 
01697     protected:  // Functions from base classes
01698 
01703         void ContextEntrySwitched();
01704 
01713         void HandleEntryEventL(
01714             TMsvEntryEvent aEvent,
01715             TAny* arg1,
01716             TAny* arg2,
01717             TAny* arg3 );
01718 
01724         CMmsClientMtm(
01725             CRegisteredMtmDll& aRegisteredMtmDll,
01726             CMsvSession& aSession );
01727 
01728         void ConstructL();
01729 
01730     private:
01731 
01735         void BuildAddresseeListL();
01736 
01742         void BuildAddresseeListL(
01743             const CDesCArray& aArray, TMsvRecipientType aValue);
01744 
01749         TInt32 AttachmentsSizeL();
01750 
01755         CMsvEntrySelection* ListMmsFolderNotificationsL();
01756 
01761         CMsvEntrySelection* ListInboxNotificationsL();
01762 
01777         CMsvOperation* FetchAllFromInboxL( TRequestStatus& aCompletionStatus,
01778             TBool aForced = ETrue );
01779 
01785         // all times expressed in global time zone - no conversions
01786         /*
01787         TInt64 ConvertUTCDateToLocal( TInt64 aDate ) const;
01788         */
01789 
01798         TBool FindInRecipientL(
01799             const TDesC& aTextToFind,
01800             TMsvPartList aPartlist,
01801             const CDesCArray& aRecipients,
01802             CMsvFindText& aFindText );
01803 
01816         void AddFilePathAttachmentL(const TDesC& aFilePath,
01817             const TDesC8& aMimeType,
01818             CMsvAttachment::TMsvAttachmentType aType,
01819             TRequestStatus& aStatus,
01820             const TUint aCharacterSet = 0 );
01821 
01826         void StoreAttributesL( CMsvStore& aStore );
01827 
01832         void RestoreAttributesL( CMsvStore& aStore );
01833 
01842         TUint GetUnicodeCharacterSet( TDesC8& aSample );
01843 
01851         void ReadBytesFromFileL( const RFile aFile, TDes8& aSample );
01852 
01859         TUint RecognizeCharSetL( RFile& aFile );
01860 
01861 
01862     public:     // Data
01863 
01864     protected:  // Data
01865         CMmsSettings* iMmsSettings;  // MMSC settings (access point etc.)
01866 
01867         CMmsHeaders*  iMmsHeaders;   // MMS message headers
01868         TMsvId        iServiceId;    // last selected service
01869         TBool         iFetchAll;     // All the messages are fetched when
01870                                      // settings are saved after certain fetch
01871                                      // mode change.
01872         TBool         iFetchOverride; // force fetching all messages.
01873         TInt          iMessageDrive; // messages are on C: drive by default,
01874                                      // may be moved to other drive
01875         TInt32        iHomeMode;     // receiving mode in the home network
01876         TInt32        iRoamingMode;  // receiving mode when roaming
01877         TInt          iAccessPointCount; // number of access points
01878         CDesCArrayFlat* iAttributes;     // zero or more attributes for UI.
01879                                          // Name, value pairs
01880         CMsvSession& iOwnSession;    // copy of session because base class session is private
01881 
01882 
01883     private:    // Data
01884         // active object that commits the store when attachment operation
01885         // is complete
01886         CMmsAttachmentWaiter* iAttaWaiter;
01887 
01888     public:     // Friend classes
01889 
01890     protected:  // Friend classes
01891 
01892     private:    // Friend classes
01893 
01894     };
01895 
01896 // panic function
01897 GLREF_C void gPanic( TMmsPanic aPanic );
01898 
01899 #include "mmsclient.inl"
01900 
01901 // MMSCLIENT_H
01902 #endif
01903 
01904 // End of File
01905 

Copyright © Nokia Corporation 2001-2008
Back to top