williamr@2: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #if !defined (__POP3SET_H__) williamr@2: #define __POP3SET_H__ williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: williamr@2: williamr@2: /** Default POP3 server port number. */ williamr@2: const TUint32 KPOP3DefaultPortNumber = 110; williamr@2: williamr@2: /** @deprecated */ williamr@2: const TInt32 KImPop3SynchroniseAll = -1; williamr@2: williamr@2: /** @deprecated */ williamr@2: const TInt32 KImPop3SynchroniseNone = 0; williamr@2: williamr@2: /** williamr@2: Specifies which parts of a POP3 message to download. Used when configuring the williamr@2: POP3 service settings. williamr@2: williamr@2: @see williamr@2: CImPop3Settings williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: enum TPop3GetMailOptions williamr@2: { williamr@2: /** Message headers only. */ williamr@2: EGetPop3EmailHeaders, williamr@2: /** Complete message. */ williamr@2: EGetPop3EmailMessages williamr@2: }; williamr@2: williamr@2: williamr@2: class TPop3Progress williamr@2: /** williamr@2: Progress information for a POP3 operation. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TInt ConnectionState() const; williamr@2: IMPORT_C TInt ConnectionIAP() const; williamr@2: williamr@2: public: williamr@2: /** Defines types of POP3 operations. */ williamr@2: enum TPop3ProgressType williamr@2: { williamr@2: /** Refreshing view of remote mail box. */ williamr@2: EPopRefreshing, williamr@2: /** Copying messages. */ williamr@2: EPopCopying, williamr@2: /** Deleting messages. */ williamr@2: EPopDeleting, williamr@2: /** Connecting to remote mail box. */ williamr@2: EPopConnecting, williamr@2: /** Internal reorganisation. */ williamr@2: EPopTidying, williamr@2: /** Connected to remote mail box and no current operations. */ williamr@2: EPopConnectedAndIdle, williamr@2: /** Disconnecting from remote mail box. */ williamr@2: EPopDisconnecting, williamr@2: /** Disconnected from remote mail box. */ williamr@2: EPopDisconnected, williamr@2: /** Moving messages. */ williamr@2: EPopMoving, williamr@2: /** Copying new messages. */ williamr@2: EPopCopyNewMail, williamr@2: /** Moving new messages. */ williamr@2: EPopMoveNewMail, williamr@2: /** Copying a selection of messages. */ williamr@2: EPopCopyMailSelection, williamr@2: /** Moving a selection of messages. */ williamr@2: EPopMoveMailSelection, williamr@2: /** Copying all messages. */ williamr@2: EPopCopyAllMail, williamr@2: /** Moving all messages. */ williamr@2: EPopMoveAllMail, williamr@2: /** Populating view of remote mail box. */ williamr@2: EPopPopulating, williamr@2: /** Cancelling all off-line operations. */ williamr@2: EPopCancellingOfflineOps, williamr@2: /** Populating mailbox with top command */ williamr@2: EPopTopPopulating, williamr@2: /** Defines the maximum value for this enumeration. */ williamr@2: EPopMaxProgressValue=EPopTopPopulating williamr@2: }; williamr@2: williamr@2: /** Type of operation for which progress is being reported. */ williamr@2: TPop3ProgressType iPop3Progress; // holds the progress for a 'super operation' williamr@2: /** When in the EPopConnecting state, this member holds the connection williamr@2: stage. Otherwise it holds the total number of messages for the operation. */ williamr@2: TInt iTotalMsgs; williamr@2: /** Remaining number of messages to process. */ williamr@2: TInt iMsgsToProcess; williamr@2: /** Number of bytes processed by the operation. */ williamr@2: TInt iBytesDone; williamr@2: /** When in the EPopConnecting state, this member holds the connection williamr@2: iap value. Otherwise it holds the total number of bytes to progress for the williamr@2: operation. */ williamr@2: TInt iTotalBytes; williamr@2: /** Operation error code. */ williamr@2: TInt iErrorCode; // client side needs to be informed of an error williamr@2: /** Type of the sub-operation, where a nested operations is occurring. */ williamr@2: TPop3ProgressType iPop3SubStateProgress; // holds the progress for the substate of the 'super operation' williamr@2: /** Service performing the operation. */ williamr@2: TMsvId iServiceId; williamr@2: /** The total size of messages to be downloaded. */ williamr@2: TInt iTotalSize; // The total size of messages to be downloaded. williamr@2: }; williamr@2: williamr@2: williamr@2: class TImPop3GetMailInfo williamr@2: /** williamr@2: Use to specify the maximum message size and the destination folder ID for williamr@2: certain POP3 operations. williamr@2: williamr@2: @see williamr@2: CPop3ClientMtm williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** Maximum message size for the operation. */ williamr@2: TInt32 iMaxEmailSize; williamr@2: /** ID of the destination folder for the operation. */ williamr@2: TMsvId iDestinationFolder; williamr@2: }; williamr@2: williamr@2: class TImPop3PopulateOptions williamr@2: /** williamr@2: Use to specify the population limit for the POP3 top command williamr@2: williamr@2: @see williamr@2: CPop3ClientMtm williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: private: williamr@2: /** Version of this GetMailInfo class, breaks coding standard by putting a private member at williamr@2: the beginning to enable unpacking code to check the version before unpacking the rest of the class */ williamr@2: TInt32 iVersion; williamr@2: williamr@2: public: williamr@2: IMPORT_C TImPop3PopulateOptions(); williamr@2: IMPORT_C static void UnpackL(const TDesC8& aDesc, TImPop3PopulateOptions &aUnpackTo); williamr@2: williamr@2: IMPORT_C TInt MaxEmailSize(); williamr@2: IMPORT_C void SetMaxEmailSize(TInt aMaxEmailSize); williamr@2: IMPORT_C TInt PopulationLimit(); williamr@2: IMPORT_C void SetPopulationLimit(TInt aPopulationLimit); williamr@2: williamr@2: private: williamr@2: /** Maximum message size for the operation. */ williamr@2: TInt32 iMaxEmailSize; williamr@2: /** Population limit for Populate operation, set to -1 for total populate */ williamr@2: TInt32 iPopulationLimit; williamr@2: /** Construction utility function */ williamr@2: }; williamr@2: williamr@2: williamr@2: class CImPop3Settings : public CImBaseEmailSettings williamr@2: /** williamr@2: Run-time configuration settings for POP3. williamr@2: williamr@2: Messaging clients should use an instance of this class to specify williamr@2: and retrieve configuration settings that are used by the POP3 service when williamr@2: executing email operations. williamr@2: williamr@2: Service settings such as the user name and password, whether to authenticate williamr@2: using APOP or plain text, the maximum size of an email to download, and the williamr@2: maximum number of messages to synchronise can be specified using this class. williamr@2: Storing and restoring from the message store is also supported. williamr@2: williamr@2: To use this class to change a setting: williamr@2: 1) Set the current context to the POP3 service entry using CMsvStore. williamr@2: 2) Create an instance of CImPop3Settings and put it on the cleanup stack. williamr@2: 3) Retrieve the existing settings by calling CImPop3Settings::RestoreL(). williamr@2: 4) Change the inbox synchronisation limit setting by calling CImPop3Settings::SetInboxSynchronisationLimit(). williamr@2: 5) Save the new settings by calling CImPop3Settings::StoreL(). williamr@2: 6) Pop and destroy the CImPop3Settings instance. williamr@2: williamr@2: @see CMsvStore williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C CImPop3Settings(); williamr@2: IMPORT_C virtual ~CImPop3Settings(); williamr@2: IMPORT_C void Reset(); williamr@2: IMPORT_C const TPtrC8 LoginName() const; williamr@2: IMPORT_C void SetLoginNameL(const TDesC8&); williamr@2: IMPORT_C const TPtrC8 Password() const; williamr@2: IMPORT_C void SetPasswordL(const TDesC8&); williamr@2: IMPORT_C TBool AutoSendOnConnect() const; williamr@2: IMPORT_C void SetAutoSendOnConnect(TBool aFlag); williamr@2: IMPORT_C TBool Apop() const; williamr@2: IMPORT_C void SetApop(TBool aFlag); williamr@2: IMPORT_C TBool DisconnectedUserMode() const; williamr@2: IMPORT_C void SetDisconnectedUserMode(TBool aFlag); williamr@2: IMPORT_C TBool DeleteEmailsWhenDisconnecting() const; williamr@2: IMPORT_C void SetDeleteEmailsWhenDisconnecting(TBool aFlag); williamr@2: IMPORT_C TBool AcknowledgeReceipts() const; williamr@2: IMPORT_C void SetAcknowledgeReceipts(TBool aFlag); williamr@2: IMPORT_C TInt MaxEmailSize() const; williamr@2: IMPORT_C void SetMaxEmailSize(const TInt aMaxEmailSize); williamr@2: IMPORT_C TPop3GetMailOptions GetMailOptions() const; williamr@2: IMPORT_C void SetGetMailOptions(TPop3GetMailOptions aGetMailOptions); williamr@2: IMPORT_C CImPop3Settings& CopyL(const CImPop3Settings& aCImPop3Settings); williamr@2: IMPORT_C TBool operator==(const CImPop3Settings& aCImPop3Settings) const; williamr@2: IMPORT_C TInt32 InboxSynchronisationLimit() const; williamr@2: IMPORT_C void SetInboxSynchronisationLimit(const TInt32 aInboxSyncLimit); williamr@2: IMPORT_C TInt32 PopulationLimit() const; williamr@2: IMPORT_C void SetPopulationLimitL(const TInt32 aPopulationLimit); williamr@2: IMPORT_C void SetTlsSslDomainL(const TDesC8& aDomainName); williamr@2: IMPORT_C TPtrC8 TlsSslDomain() const; williamr@4: #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT) williamr@4: IMPORT_C void SetPOP3Auth(TBool aFlag); williamr@4: IMPORT_C TBool POP3Auth() const; williamr@4: IMPORT_C void SetFallBack(TBool aFlag); williamr@4: IMPORT_C TBool FallBack() const; williamr@4: #endif williamr@2: williamr@2: private: williamr@2: class TImPop3SettingsExtension williamr@2: { williamr@2: public: williamr@2: inline TImPop3SettingsExtension(); williamr@2: public: williamr@2: HBufC8* iLoginName; williamr@2: HBufC8* iPassword; williamr@2: HBufC8* iTlsSslDomain; williamr@2: TInt32 iPopulationLimit; williamr@2: }; williamr@2: inline TImPop3SettingsExtension* Extension() const; williamr@2: inline void CheckExtensionExistsL(); williamr@2: williamr@2: enum TImPop3EmailSettings williamr@2: { williamr@2: KPop3SettingsClearFlag = 0x00000000, williamr@2: KPop3BaseEmailSettingsLastUsedFlag = CImBaseEmailSettings::EBaseEmailSettingsLastUsedFlag, //0x00000002 williamr@2: KPop3ApopFlag = KPop3BaseEmailSettingsLastUsedFlag << 1, //0x00000004 williamr@2: KPop3AutoSendFlag = KPop3ApopFlag << 1, //0x00000008 williamr@2: KPop3DisconnectedModeFlag = KPop3AutoSendFlag << 1, //0x00000010 williamr@2: KPop3DeleteEmailsWhenDisconnectingFlag = KPop3DisconnectedModeFlag << 1, //0x00000020 williamr@2: KPop3AcknowledgeReceipts = KPop3DeleteEmailsWhenDisconnectingFlag << 1, //0x00000040 williamr@4: #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT) williamr@4: KPop3AuthFlag = KPop3AcknowledgeReceipts << 1, //0x00000080 williamr@4: KPop3FallbackFlag = KPop3AuthFlag << 1, //0x00000100 williamr@4: KPop3EmailSettingsLastUsedFlag = KPop3FallbackFlag //0x00000100 williamr@4: #else williamr@2: KPop3EmailSettingsLastUsedFlag = KPop3AcknowledgeReceipts //0x00000040 williamr@4: #endif williamr@2: }; williamr@2: williamr@2: TImPop3SettingsExtension* iExtension; // renamed iReceiptAddress williamr@2: TInt32 iInboxSyncLimit; williamr@2: TInt32 iMaxEmailSize; williamr@2: TPop3GetMailOptions iGetMailOptions; williamr@2: }; williamr@2: williamr@2: inline CImPop3Settings::TImPop3SettingsExtension* CImPop3Settings::Extension() const williamr@2: { williamr@2: return iExtension; williamr@2: } williamr@2: williamr@2: inline void CImPop3Settings::CheckExtensionExistsL() williamr@2: { williamr@2: if (!iExtension) williamr@2: iExtension=new (ELeave) CImPop3Settings::TImPop3SettingsExtension; williamr@2: } williamr@2: williamr@2: inline CImPop3Settings::TImPop3SettingsExtension::TImPop3SettingsExtension() : iLoginName(NULL) , iPassword(NULL), iTlsSslDomain(NULL) williamr@2: { williamr@2: } williamr@2: williamr@2: #endif // #define __POP3SET_H__