1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/app/pop3set.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,293 @@
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 +#if !defined (__POP3SET_H__)
1.20 +#define __POP3SET_H__
1.21 +
1.22 +
1.23 +
1.24 +
1.25 +#include <msvuids.h>
1.26 +#include <miutset.h>
1.27 +#include <miut_err.h>
1.28 +
1.29 +
1.30 +
1.31 +/** Default POP3 server port number. */
1.32 +const TUint32 KPOP3DefaultPortNumber = 110;
1.33 +
1.34 +/** @deprecated */
1.35 +const TInt32 KImPop3SynchroniseAll = -1;
1.36 +
1.37 +/** @deprecated */
1.38 +const TInt32 KImPop3SynchroniseNone = 0;
1.39 +
1.40 +/**
1.41 +Specifies which parts of a POP3 message to download. Used when configuring the
1.42 +POP3 service settings.
1.43 +
1.44 +@see
1.45 +CImPop3Settings
1.46 +
1.47 +@publishedAll
1.48 +@released
1.49 +*/
1.50 +enum TPop3GetMailOptions
1.51 + {
1.52 + /** Message headers only. */
1.53 + EGetPop3EmailHeaders,
1.54 + /** Complete message. */
1.55 + EGetPop3EmailMessages
1.56 + };
1.57 +
1.58 +
1.59 +class TPop3Progress
1.60 +/**
1.61 +Progress information for a POP3 operation.
1.62 +
1.63 +@publishedAll
1.64 +@released
1.65 +*/
1.66 + {
1.67 +public:
1.68 + IMPORT_C TInt ConnectionState() const;
1.69 + IMPORT_C TInt ConnectionIAP() const;
1.70 +
1.71 +public:
1.72 + /** Defines types of POP3 operations. */
1.73 + enum TPop3ProgressType
1.74 + {
1.75 + /** Refreshing view of remote mail box. */
1.76 + EPopRefreshing,
1.77 + /** Copying messages. */
1.78 + EPopCopying,
1.79 + /** Deleting messages. */
1.80 + EPopDeleting,
1.81 + /** Connecting to remote mail box. */
1.82 + EPopConnecting,
1.83 + /** Internal reorganisation. */
1.84 + EPopTidying,
1.85 + /** Connected to remote mail box and no current operations. */
1.86 + EPopConnectedAndIdle,
1.87 + /** Disconnecting from remote mail box. */
1.88 + EPopDisconnecting,
1.89 + /** Disconnected from remote mail box. */
1.90 + EPopDisconnected,
1.91 + /** Moving messages. */
1.92 + EPopMoving,
1.93 + /** Copying new messages. */
1.94 + EPopCopyNewMail,
1.95 + /** Moving new messages. */
1.96 + EPopMoveNewMail,
1.97 + /** Copying a selection of messages. */
1.98 + EPopCopyMailSelection,
1.99 + /** Moving a selection of messages. */
1.100 + EPopMoveMailSelection,
1.101 + /** Copying all messages. */
1.102 + EPopCopyAllMail,
1.103 + /** Moving all messages. */
1.104 + EPopMoveAllMail,
1.105 + /** Populating view of remote mail box. */
1.106 + EPopPopulating,
1.107 + /** Cancelling all off-line operations. */
1.108 + EPopCancellingOfflineOps,
1.109 + /** Populating mailbox with top command */
1.110 + EPopTopPopulating,
1.111 + /** Defines the maximum value for this enumeration. */
1.112 + EPopMaxProgressValue=EPopTopPopulating
1.113 + };
1.114 +
1.115 + /** Type of operation for which progress is being reported. */
1.116 + TPop3ProgressType iPop3Progress; // holds the progress for a 'super operation'
1.117 + /** When in the EPopConnecting state, this member holds the connection
1.118 + stage. Otherwise it holds the total number of messages for the operation. */
1.119 + TInt iTotalMsgs;
1.120 + /** Remaining number of messages to process. */
1.121 + TInt iMsgsToProcess;
1.122 + /** Number of bytes processed by the operation. */
1.123 + TInt iBytesDone;
1.124 + /** When in the EPopConnecting state, this member holds the connection
1.125 + iap value. Otherwise it holds the total number of bytes to progress for the
1.126 + operation. */
1.127 + TInt iTotalBytes;
1.128 + /** Operation error code. */
1.129 + TInt iErrorCode; // client side needs to be informed of an error
1.130 + /** Type of the sub-operation, where a nested operations is occurring. */
1.131 + TPop3ProgressType iPop3SubStateProgress; // holds the progress for the substate of the 'super operation'
1.132 + /** Service performing the operation. */
1.133 + TMsvId iServiceId;
1.134 + /** The total size of messages to be downloaded. */
1.135 + TInt iTotalSize; // The total size of messages to be downloaded.
1.136 + };
1.137 +
1.138 +
1.139 +class TImPop3GetMailInfo
1.140 +/**
1.141 +Use to specify the maximum message size and the destination folder ID for
1.142 +certain POP3 operations.
1.143 +
1.144 +@see
1.145 +CPop3ClientMtm
1.146 +
1.147 +@publishedAll
1.148 +@released
1.149 +*/
1.150 + {
1.151 +public:
1.152 + /** Maximum message size for the operation. */
1.153 + TInt32 iMaxEmailSize;
1.154 + /** ID of the destination folder for the operation. */
1.155 + TMsvId iDestinationFolder;
1.156 + };
1.157 +
1.158 +class TImPop3PopulateOptions
1.159 +/**
1.160 +Use to specify the population limit for the POP3 top command
1.161 +
1.162 +@see
1.163 +CPop3ClientMtm
1.164 +
1.165 +@publishedAll
1.166 +@released
1.167 +*/
1.168 + {
1.169 +private:
1.170 + /** Version of this GetMailInfo class, breaks coding standard by putting a private member at
1.171 + the beginning to enable unpacking code to check the version before unpacking the rest of the class */
1.172 + TInt32 iVersion;
1.173 +
1.174 +public:
1.175 + IMPORT_C TImPop3PopulateOptions();
1.176 + IMPORT_C static void UnpackL(const TDesC8& aDesc, TImPop3PopulateOptions &aUnpackTo);
1.177 +
1.178 + IMPORT_C TInt MaxEmailSize();
1.179 + IMPORT_C void SetMaxEmailSize(TInt aMaxEmailSize);
1.180 + IMPORT_C TInt PopulationLimit();
1.181 + IMPORT_C void SetPopulationLimit(TInt aPopulationLimit);
1.182 +
1.183 +private:
1.184 + /** Maximum message size for the operation. */
1.185 + TInt32 iMaxEmailSize;
1.186 + /** Population limit for Populate operation, set to -1 for total populate */
1.187 + TInt32 iPopulationLimit;
1.188 + /** Construction utility function */
1.189 + };
1.190 +
1.191 +
1.192 +class CImPop3Settings : public CImBaseEmailSettings
1.193 +/**
1.194 +Run-time configuration settings for POP3.
1.195 +
1.196 +Messaging clients should use an instance of this class to specify
1.197 +and retrieve configuration settings that are used by the POP3 service when
1.198 +executing email operations.
1.199 +
1.200 +Service settings such as the user name and password, whether to authenticate
1.201 +using APOP or plain text, the maximum size of an email to download, and the
1.202 +maximum number of messages to synchronise can be specified using this class.
1.203 +Storing and restoring from the message store is also supported.
1.204 +
1.205 +To use this class to change a setting:
1.206 +1) Set the current context to the POP3 service entry using CMsvStore.
1.207 +2) Create an instance of CImPop3Settings and put it on the cleanup stack.
1.208 +3) Retrieve the existing settings by calling CImPop3Settings::RestoreL().
1.209 +4) Change the inbox synchronisation limit setting by calling CImPop3Settings::SetInboxSynchronisationLimit().
1.210 +5) Save the new settings by calling CImPop3Settings::StoreL().
1.211 +6) Pop and destroy the CImPop3Settings instance.
1.212 +
1.213 +@see CMsvStore
1.214 +@publishedAll
1.215 +@released
1.216 +*/
1.217 + {
1.218 +public:
1.219 + IMPORT_C CImPop3Settings();
1.220 + IMPORT_C virtual ~CImPop3Settings();
1.221 + IMPORT_C void Reset();
1.222 + IMPORT_C const TPtrC8 LoginName() const;
1.223 + IMPORT_C void SetLoginNameL(const TDesC8&);
1.224 + IMPORT_C const TPtrC8 Password() const;
1.225 + IMPORT_C void SetPasswordL(const TDesC8&);
1.226 + IMPORT_C TBool AutoSendOnConnect() const;
1.227 + IMPORT_C void SetAutoSendOnConnect(TBool aFlag);
1.228 + IMPORT_C TBool Apop() const;
1.229 + IMPORT_C void SetApop(TBool aFlag);
1.230 + IMPORT_C TBool DisconnectedUserMode() const;
1.231 + IMPORT_C void SetDisconnectedUserMode(TBool aFlag);
1.232 + IMPORT_C TBool DeleteEmailsWhenDisconnecting() const;
1.233 + IMPORT_C void SetDeleteEmailsWhenDisconnecting(TBool aFlag);
1.234 + IMPORT_C TBool AcknowledgeReceipts() const;
1.235 + IMPORT_C void SetAcknowledgeReceipts(TBool aFlag);
1.236 + IMPORT_C TInt MaxEmailSize() const;
1.237 + IMPORT_C void SetMaxEmailSize(const TInt aMaxEmailSize);
1.238 + IMPORT_C TPop3GetMailOptions GetMailOptions() const;
1.239 + IMPORT_C void SetGetMailOptions(TPop3GetMailOptions aGetMailOptions);
1.240 + IMPORT_C CImPop3Settings& CopyL(const CImPop3Settings& aCImPop3Settings);
1.241 + IMPORT_C TBool operator==(const CImPop3Settings& aCImPop3Settings) const;
1.242 + IMPORT_C TInt32 InboxSynchronisationLimit() const;
1.243 + IMPORT_C void SetInboxSynchronisationLimit(const TInt32 aInboxSyncLimit);
1.244 + IMPORT_C TInt32 PopulationLimit() const;
1.245 + IMPORT_C void SetPopulationLimitL(const TInt32 aPopulationLimit);
1.246 + IMPORT_C void SetTlsSslDomainL(const TDesC8& aDomainName);
1.247 + IMPORT_C TPtrC8 TlsSslDomain() const;
1.248 +
1.249 +private:
1.250 + class TImPop3SettingsExtension
1.251 + {
1.252 + public:
1.253 + inline TImPop3SettingsExtension();
1.254 + public:
1.255 + HBufC8* iLoginName;
1.256 + HBufC8* iPassword;
1.257 + HBufC8* iTlsSslDomain;
1.258 + TInt32 iPopulationLimit;
1.259 + };
1.260 + inline TImPop3SettingsExtension* Extension() const;
1.261 + inline void CheckExtensionExistsL();
1.262 +
1.263 + enum TImPop3EmailSettings
1.264 + {
1.265 + KPop3SettingsClearFlag = 0x00000000,
1.266 + KPop3BaseEmailSettingsLastUsedFlag = CImBaseEmailSettings::EBaseEmailSettingsLastUsedFlag, //0x00000002
1.267 + KPop3ApopFlag = KPop3BaseEmailSettingsLastUsedFlag << 1, //0x00000004
1.268 + KPop3AutoSendFlag = KPop3ApopFlag << 1, //0x00000008
1.269 + KPop3DisconnectedModeFlag = KPop3AutoSendFlag << 1, //0x00000010
1.270 + KPop3DeleteEmailsWhenDisconnectingFlag = KPop3DisconnectedModeFlag << 1, //0x00000020
1.271 + KPop3AcknowledgeReceipts = KPop3DeleteEmailsWhenDisconnectingFlag << 1, //0x00000040
1.272 + KPop3EmailSettingsLastUsedFlag = KPop3AcknowledgeReceipts //0x00000040
1.273 + };
1.274 +
1.275 + TImPop3SettingsExtension* iExtension; // renamed iReceiptAddress
1.276 + TInt32 iInboxSyncLimit;
1.277 + TInt32 iMaxEmailSize;
1.278 + TPop3GetMailOptions iGetMailOptions;
1.279 + };
1.280 +
1.281 +inline CImPop3Settings::TImPop3SettingsExtension* CImPop3Settings::Extension() const
1.282 + {
1.283 + return iExtension;
1.284 + }
1.285 +
1.286 +inline void CImPop3Settings::CheckExtensionExistsL()
1.287 + {
1.288 + if (!iExtension)
1.289 + iExtension=new (ELeave) CImPop3Settings::TImPop3SettingsExtension;
1.290 + }
1.291 +
1.292 +inline CImPop3Settings::TImPop3SettingsExtension::TImPop3SettingsExtension() : iLoginName(NULL) , iPassword(NULL), iTlsSslDomain(NULL)
1.293 + {
1.294 + }
1.295 +
1.296 +#endif // #define __POP3SET_H__