epoc32/include/app/impcmtm.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
// Client MTM for the IMAP4 protocol
williamr@2
    15
// 
williamr@2
    16
//
williamr@2
    17
williamr@2
    18
williamr@2
    19
#if !defined (__IMPCMTM_H__)
williamr@2
    20
#define __IMPCMTM_H__
williamr@2
    21
williamr@2
    22
#if !defined (__MTCLBASE_H_)
williamr@2
    23
#include <mtclbase.h>
williamr@2
    24
#endif
williamr@2
    25
williamr@2
    26
#if !defined (__MIUTHDR_H_)
williamr@2
    27
#include <miuthdr.h>
williamr@2
    28
#endif
williamr@2
    29
williamr@2
    30
#if !defined (__MIUTPARS_H__)
williamr@2
    31
#include <miutpars.h>		//TImMessageField
williamr@2
    32
#endif
williamr@2
    33
williamr@2
    34
#if !defined (__IMAPSET_H__)
williamr@2
    35
#include <imapset.h>
williamr@2
    36
#endif
williamr@2
    37
williamr@2
    38
#if !defined (__IMAPCMDS_H__)
williamr@2
    39
#include <imapcmds.h>
williamr@2
    40
#endif
williamr@2
    41
williamr@2
    42
#if !defined(__OFFOP_H__)
williamr@2
    43
#include <offop.h>
williamr@2
    44
#endif
williamr@2
    45
williamr@2
    46
#if !defined(__MIUTMSG_H__)
williamr@2
    47
#include <miutmsg.h>
williamr@2
    48
#endif
williamr@2
    49
williamr@2
    50
williamr@2
    51
williamr@2
    52
// Forward declarations.
williamr@2
    53
class CImap4ClientSessionObserver;
williamr@2
    54
class CImImap4GetMail;
williamr@2
    55
class CImEmailAutoSend;
williamr@2
    56
williamr@4
    57
//
williamr@2
    58
// Imap4 Client MTM  
williamr@2
    59
class CImap4ClientMtm : public CBaseMtm, public MImUndoOffLineOperation
williamr@2
    60
williamr@2
    61
/** IMAP4 client MTM interface, providing access to the email services using the IMAP4 
williamr@2
    62
protocol.
williamr@2
    63
williamr@2
    64
The class provides support for:
williamr@2
    65
williamr@2
    66
- connecting to remote IMAP4 mail servers
williamr@2
    67
- synchronising message headers with mailboxes on these servers
williamr@2
    68
- getting message bodies and attachments
williamr@2
    69
- copying and moving messages
williamr@2
    70
- creating messages that forward or reply to IMAP4 messages
williamr@2
    71
- server notification of new messages using IMAP IDLE
williamr@2
    72
- queueing operations requested when there is no connection to a mail server, to be 
williamr@2
    73
performed when a connection is made (offline operations).
williamr@2
    74
williamr@2
    75
Note that CImap4ClientMtm does not support many of the generic functions defined by 
williamr@2
    76
the @c CBaseMtm base class. In particular:
williamr@2
    77
williamr@2
    78
- Message address information, body, subjects, and attachments are not manipulated 
williamr@2
    79
through CImap4ClientMtm. Consequently, SaveMessageL() has an empty 
williamr@2
    80
implementation, and is not used. Message access and manipulation is instead done 
williamr@2
    81
through CImEmailMessage, which understands the email specific message formats, 
williamr@2
    82
including MHTML (RFC 2557). The RFC 822 email header, which includes subject and 
williamr@2
    83
address information, is encapsulated in a CImHeader object, which can be obtained from 
williamr@2
    84
a CImEmailMessage object. IMAP also has its own specific flags, such as draft, 
williamr@2
    85
answered, and deleted: this can be accessed through TMsvEmailEntry, which extends the 
williamr@2
    86
message server's generic TMsvEntry to add email-specific information.
williamr@2
    87
williamr@2
    88
- The idea of a default service used by base class functions DefaultServiceL(), 
williamr@2
    89
ChangeDefaultServiceL(), and RemoveDefaultServiceL() is not supported.
williamr@2
    90
williamr@2
    91
IMAP specific commands are issued through the InvokeAsyncFunctionL() function, with 
williamr@2
    92
the commands defined in the #TImap4Cmds enumeration. Details of particular commands 
williamr@2
    93
are given in the documentation for that enumeration, but the following describes some of 
williamr@2
    94
the key concepts required to use those commands. Note that usually these commands do 
williamr@2
    95
not correspond directly to the IMAP protocol commands described in RFC 3501. Instead, 
williamr@2
    96
they are at a higher level, to simplify the logic required for an email client program. 
williamr@2
    97
williamr@2
    98
--------------------------------------
williamr@2
    99
williamr@2
   100
Connection and services
williamr@2
   101
williamr@2
   102
Settings for connection to and use of an IMAP4 mail server and its mailboxes are 
williamr@2
   103
encapsulated in an CImImap4Settings object, created and accessed through 
williamr@2
   104
CEmailAccounts. Preferences for the network connection (e.g. the ISP to use) to be made 
williamr@2
   105
to access an IMAP server are also accessed through CEmailAccounts.
williamr@2
   106
williamr@2
   107
The settings are associated with a service-type entry in the Message Server's message 
williamr@2
   108
store. Message and folder type entries under the service entry store a local copy of the 
williamr@2
   109
mailboxes and messages that are present on an IMAP server. For this reason, the service 
williamr@2
   110
is sometimes referred to as the local mirror of an IMAP server.
williamr@2
   111
williamr@2
   112
By default, it is assumed that the user has a primary mailbox on the server called INBOX, 
williamr@2
   113
though this can be changed if necessary using CImImap4Settings::SetFolderPathL(). (To 
williamr@2
   114
avoid confusion, the term "Inbox" used in the IMAP MTM documentation refers to this 
williamr@2
   115
mailbox, rather than the Message Server's standard local Inbox folder.)
williamr@2
   116
williamr@2
   117
The settings store the user's log-in details required to access the IMAP server, and other 
williamr@2
   118
settings not related to connection, but which affect the behaviour of commands, such as 
williamr@2
   119
synchronisation, made to the service.
williamr@2
   120
williamr@2
   121
--------------------------------------
williamr@2
   122
williamr@2
   123
Synchronisation
williamr@2
   124
williamr@2
   125
The IMAP4 MTM provides the means to synchronise message headers on a remote 
williamr@2
   126
IMAP mailboxes with the messages headers on the phone. Note that synchronisation only 
williamr@2
   127
refers to message headers. Once headers are synchronised, populate operations (i.e. 
williamr@2
   128
getting the message bodies) can be done.
williamr@2
   129
williamr@2
   130
The basic steps involved in a full synchronisation are:
williamr@2
   131
williamr@2
   132
- The headers of messages in the Inbox are synchronised. 
williamr@2
   133
- The local list of folders is synchronised with those existing on the remote IMAP service. 
williamr@2
   134
Depending on the service settings, the local or remote settings of subscribed mailboxes 
williamr@2
   135
may be updated (see below for more information). 
williamr@2
   136
- The headers of messages in subscribed folders are synchronised. 
williamr@2
   137
williamr@2
   138
Queued offline operations (see below) pending on the Inbox or subscribed folders are 
williamr@2
   139
performed prior to the relevant folder being synchronised.
williamr@2
   140
williamr@2
   141
Synchronisations can be performed in the background or the foreground. A foreground 
williamr@2
   142
synchronisation means no other requests, such as message fetching, can be made to the 
williamr@2
   143
MTM, until the synchronisation is complete. A background synchronisation allows some 
williamr@2
   144
types of command to be given while it is in progress. Commands that write to the remote 
williamr@2
   145
server are not allowed however while a background synchronisation is in progress. A 
williamr@2
   146
client is informed of the state of a background synchronisation through the 
williamr@2
   147
MMsvImapConnectionObserver callback interface.
williamr@2
   148
williamr@2
   149
Synchronisations commands are made through  
williamr@2
   150
CImap4ClientMtm::InvokeAsyncFunctionL(). There a variety of commands available 
williamr@2
   151
that give different options for compounding synchronisation
williamr@2
   152
with other commands, such as connection, and synchronising only particular folders. See 
williamr@2
   153
TImap4Cmds for details. Progress information for synchronisation commands can be 
williamr@2
   154
obtained from the CMsvOperation object returned by the InvokeAsyncFunctionL(). 
williamr@2
   155
Synchronisation progress information is encapsulated in a TImap4SyncProgress object.
williamr@2
   156
williamr@2
   157
Settings that affect how a synchronisation is performed include:
williamr@2
   158
williamr@2
   159
- Subscriptions: when an IMAP service had been synchronised, the Messaging server will 
williamr@2
   160
contain entries for all folders on the remote server. These entries will be marked invisible 
williamr@2
   161
within the TMsvEntry for the folder, implying that they should be invisible to the user. 
williamr@2
   162
Messages in these folders are not synchronised unless the folder has been subscribed to. 
williamr@2
   163
Note a folder subscription can be set either locally (i.e. just on the phone), using 
williamr@2
   164
the #KIMAP4MTMLocalSubscribe command, or remotely (on the server), possibly through email 
williamr@2
   165
clients on other devices. A service can be set to synchronise folders using either or both 
williamr@2
   166
of these types of subscription (CImImap4Settings::SetSynchronise()). Local and remote 
williamr@2
   167
subscriptions can themselves be synchronised in various ways (CImImap4Settings::SetSuscribe()).
williamr@2
   168
williamr@2
   169
- Filters: a filter prevents certain e-mail messages from being synchronised onto the 
williamr@2
   170
device when a client requests a synchronisation. Filters can include anything permitted by 
williamr@2
   171
the IMAP Search command, including date, size, content, and message flags.
williamr@2
   172
williamr@2
   173
- Limits: service settings can limit the number of emails synchronised to the inbox 
williamr@2
   174
(CImImap4Settings::SetInboxSynchronisationLimit()), and to other folders 
williamr@2
   175
(CImImap4Settings::SetMailboxSynchronisationLimit()).
williamr@2
   176
williamr@2
   177
- Sync rate: one of the synchronisation commands 
williamr@2
   178
(KIMAP4MTMConnectAndSyncCompleteAfterDisconnect) periodically resynchronises 
williamr@2
   179
the Inbox until the service is disconnected. CImImap4Settings::SyncRate() sets the 
williamr@2
   180
refresh period.
williamr@2
   181
williamr@2
   182
--------------------------------------
williamr@2
   183
williamr@2
   184
Getting and copying messages
williamr@2
   185
williamr@2
   186
After messages headers have been synchronised, message bodies and attachments can be 
williamr@2
   187
fetched from the remote email server. Getting message parts and saving them in the 
williamr@2
   188
mirror service is calling populating them.
williamr@2
   189
williamr@2
   190
Commands for these actions can be made through  
williamr@2
   191
CImap4ClientMtm::InvokeAsyncFunctionL(). There are a large number of commands, 
williamr@2
   192
for different combinations of these options:
williamr@2
   193
williamr@2
   194
- action type: whether to just populate messages, or to also copy or move them to a local 
williamr@2
   195
folder 
williamr@2
   196
- message selection: whether to get all, new, or selected messages
williamr@2
   197
- connection: whether to make a new connection or assume an existing connection
williamr@2
   198
- disconnect: whether to disconnect or stay online after operation is complete
williamr@2
   199
williamr@2
   200
For the populate type commands, further options can be set that control the message 
williamr@2
   201
getting behaviour.  Basic options control, encapsulated in TImImap4GetMailInfo, specify 
williamr@2
   202
whether body text and/or attachments are fetched, and a maximum message size. There 
williamr@2
   203
are also options, encapsulated in TImImap4GetPartialMailInfo, that allow size limits to 
williamr@2
   204
be separately specified for body text and/or attachments. If the the body is larger than the 
williamr@2
   205
limit, then the body is partially downloaded up to the limit. Only attachments smaller 
williamr@2
   206
than the specified size are downloaded. A partially downloaded message can later be 
williamr@2
   207
fully downloaded.
williamr@2
   208
williamr@2
   209
For the copy or move type commands,  a TImImap4GetMailInfo parameter is supplied, in 
williamr@2
   210
order to specify the destination folder for the messages, and a maximum message size. 
williamr@2
   211
williamr@2
   212
Progress information for getting commands can be obtained from the CMsvOperation 
williamr@2
   213
object returned by the InvokeAsyncFunctionL(). Progress information is encapsulated in 
williamr@2
   214
a TImap4GenericProgress object.
williamr@2
   215
williamr@2
   216
Fetching and then copying or moving specified messages can also be performed by using 
williamr@2
   217
the standard Messaging Framework @c CMsvEntry::CopyL() and @c 
williamr@2
   218
CMsvEntry::MoveL() functions on entries under the remote service. If these functions are 
williamr@2
   219
used, then the entire message is fetched without size limits.
williamr@2
   220
williamr@2
   221
CMsvEntry functions can also be used to:
williamr@2
   222
williamr@2
   223
- create a folder on a remote server
williamr@2
   224
- delete messages
williamr@2
   225
- copy or move messages from a local folder into a remote folder
williamr@2
   226
- copy or move messages between remote folders
williamr@2
   227
williamr@2
   228
Note that changing an existing entry through CMsvEntry is not supported. An MTM-
williamr@2
   229
specific command #KIMAP4MTMRenameFolder is instead provided to rename a remote 
williamr@2
   230
folder.
williamr@2
   231
williamr@2
   232
The page "CMsvEntry functions for IMAP4 message entries", linked to in the "See also" 
williamr@2
   233
section below, provides more details on using CMsvEntry.
williamr@2
   234
williamr@2
   235
--------------------------------------
williamr@2
   236
williamr@2
   237
Offline operations
williamr@2
   238
williamr@2
   239
Some operations can only be performed while online, while other commands may 
williamr@2
   240
be stored while offline for processing when next connected. An attempt to perform a 
williamr@2
   241
command while offline that requires the MTM to be connected results in immediate 
williamr@2
   242
completion with the error code KErrDisconnected.
williamr@2
   243
williamr@2
   244
Permitted offline operations include:
williamr@2
   245
williamr@2
   246
- copy
williamr@2
   247
- move
williamr@2
   248
- delete
williamr@2
   249
williamr@2
   250
Queued offline operations are usually performed when a connection is made, prior to the  
williamr@2
   251
relevant folder being synchronised. Delete operations can alternatively be set to be done 
williamr@2
   252
on disconnection using the service setting 
williamr@2
   253
CImImap4Settings::SetDeleteEmailsWhenDisconnecting().
williamr@2
   254
williamr@2
   255
Note that:
williamr@2
   256
- Offline operations are only permitted if the service setting SetDisconnectedUserMode() 
williamr@2
   257
is true.
williamr@2
   258
- It is possible to undo pending offline operations using the commands 
williamr@2
   259
#KIMAP4MTMCancelOffLineOperations and #KIMAP4MTMUndeleteAll.
williamr@2
   260
williamr@2
   261
--------------------------------------
williamr@2
   262
williamr@2
   263
IMAP IDLE support
williamr@2
   264
williamr@2
   265
IMAP IDLE (RFC 2177) is an optional expansion of the IMAP email accessing protocol 
williamr@2
   266
that allows the server to send updates to the client that messages have been created or 
williamr@2
   267
deleted in real time. The IDLE command is sent from the client to the server when the 
williamr@2
   268
client is ready to accept unsolicited mailbox update messages. Whether the client requests 
williamr@2
   269
the server to provide IDLE support is set in the CImImap4Settings::SetImapIdle() service 
williamr@2
   270
setting. When the IMAP MTM receives such a notification, it synchronises the changed 
williamr@2
   271
folder. Email clients can be notified of such changes by setting a MMsvEntryObserver 
williamr@2
   272
observer on a folder.
williamr@2
   273
williamr@2
   274
@publishedAll
williamr@2
   275
@released
williamr@2
   276
*/
williamr@2
   277
	{
williamr@2
   278
public:
williamr@2
   279
   	IMPORT_C static CImap4ClientMtm* NewL(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aSession);
williamr@2
   280
	
williamr@2
   281
	~CImap4ClientMtm();
williamr@2
   282
	void HandleEntryEvent(TMsvEntryEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
williamr@2
   283
	void StoreL(); // uses a CMsvStore from the Session
williamr@2
   284
	void RestoreL();
williamr@2
   285
	CMsvOperation* ReplyL(TMsvId aDestination, TMsvPartList aPartList, TRequestStatus& aCompletionStatus);
williamr@2
   286
	CMsvOperation* ForwardL(TMsvId aDestination, TMsvPartList aPartList, TRequestStatus& aCompletionStatus);
williamr@2
   287
	TUint ValidateMessage(TUint aPartList);
williamr@2
   288
	TMsvPartList Find(const TDesC& aTextToFind, TMsvPartList aPartList);
williamr@2
   289
	void SaveMessageL(); 
williamr@2
   290
	void LoadMessageL();
williamr@2
   291
	IMPORT_C void StoreSettingsL();	// uses a CMsvStore from the session
williamr@2
   292
	IMPORT_C void RestoreSettingsL();
williamr@2
   293
williamr@2
   294
	// --- RTTI functions ---
williamr@2
   295
	TInt QueryCapability(TUid aCapability, TInt& aResponse);
williamr@2
   296
	void InvokeSyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection, TDes8& aParameter);
williamr@2
   297
	CMsvOperation* InvokeAsyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection, TDes8& aParameter, TRequestStatus& aCompletionStatus);
williamr@2
   298
	// Addressees have no meaning in the text mtm.
williamr@2
   299
	void AddAddresseeL(const TDesC& aRealAddress);
williamr@2
   300
	void AddAddresseeL(const TDesC& aRealAddress, const TDesC& aAlias);
williamr@2
   301
	void RemoveAddressee(TInt aIndex);
williamr@2
   302
williamr@2
   303
	// Attachment functions to support the SendAs API
williamr@2
   304
williamr@2
   305
	IMPORT_C virtual void AddAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
williamr@2
   306
	IMPORT_C virtual void AddAttachmentL(RFile& aFile, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
williamr@2
   307
	IMPORT_C virtual void AddLinkedAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
williamr@2
   308
	IMPORT_C virtual void AddEntryAsAttachmentL(TMsvId aAttachmentId, TRequestStatus& aStatus);
williamr@2
   309
	IMPORT_C virtual void CreateAttachmentL(const TDesC& aFileName, RFile& aAttachmentFile, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
williamr@2
   310
	IMPORT_C void CreateMessageL(TMsvId aServiceId);
williamr@2
   311
	
williamr@2
   312
	IMPORT_C virtual TMsvId DefaultServiceL() const;
williamr@2
   313
	IMPORT_C virtual void RemoveDefaultServiceL();
williamr@2
   314
	IMPORT_C virtual void ChangeDefaultServiceL(const TMsvId& aService);
williamr@2
   315
williamr@2
   316
public: // Returning a list of all the offline operations for a service entry.
williamr@2
   317
    IMPORT_C CImOperationQueueList* QueueListL(CMsvEntry& aServiceEntry);
williamr@2
   318
public:  // Wrapper to settings
williamr@2
   319
    IMPORT_C const CImImap4Settings& Imap4Settings() const;
williamr@2
   320
    IMPORT_C void SetImap4SettingsL(const CImImap4Settings& aSettings);
williamr@2
   321
public: // inherited from MUndoOffLine
williamr@2
   322
    virtual void UndoOffLineChangesL(const CImOffLineOperation& aDeleted, TMsvId aFolderId); 
williamr@2
   323
protected:
williamr@2
   324
	CImap4ClientMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aSession);
williamr@2
   325
	void ConstructL();
williamr@2
   326
	void ContextEntrySwitched(); // called after the context of this instance has been changed to another entry
williamr@2
   327
williamr@2
   328
private:
williamr@2
   329
	TBool ValidateAddress(const TPtrC& anAddress);
williamr@2
   330
	void SendOnNextConnectionL();
williamr@2
   331
	TMsvPartList DoFindL(const TDesC& aTextToFind, TMsvPartList aPartList);
williamr@2
   332
	void FilterAllOrNewMailsL(TInt aFunctionId,const CMsvEntrySelection& aSelection,TDes8& aParameter);
williamr@2
   333
	void FilterMailSelectionL(const CMsvEntrySelection& aSelection,TDes8& aParameter);
williamr@2
   334
	CMsvOperation* CopyMoveOrPopulateL(TInt aFunctionId,TDes8& aParameter,TRequestStatus& aCompletionStatus);
williamr@2
   335
	void ConvertToPartialPopulate(TDes8& aParameter);
williamr@2
   336
	// To check whether a partial fetch or full fetch of message has to be done.
williamr@2
   337
	TBool IsPartialPopulate(TDes8& aParameter);
williamr@2
   338
williamr@2
   339
private:
williamr@2
   340
	CImImap4Settings iImImap4Settings;
williamr@2
   341
	TImMessageField iTImMessageField;
williamr@2
   342
	CImap4ClientSessionObserver* iImap4ClientSessionObserver;
williamr@2
   343
	HBufC* iEmailAddressFormatString;	// defines format of email address used by "Send as" API eg _L("/"%S/" <%S>")
williamr@2
   344
	CImHeader* iHeader;
williamr@2
   345
	CMsvEntrySelection* iMsvEntrySelection;
williamr@2
   346
	CImImap4GetMail*	iImIMAP4GetMail;
williamr@2
   347
	CImEmailOperation*	iImEmailOperation;
williamr@2
   348
	TPckgBuf<TImImap4GetPartialMailInfo>	iImap4GetPartialMailInfo;
williamr@2
   349
	};
williamr@2
   350
williamr@2
   351
class CImImap4GetMail : public CMsvOperation
williamr@2
   352
/** Encapsulates an operation to copy, move, and populate (i.e. download the full 
williamr@2
   353
message body) IMAP4 emails from the remote inbox to any local folder.
williamr@2
   354
williamr@2
   355
Note that the same operations are available by calling CImap4ClientMtm::InvokeAsyncFunctionL() 
williamr@2
   356
with a suitable command. 
williamr@2
   357
williamr@2
   358
@publishedAll
williamr@2
   359
@released
williamr@2
   360
*/
williamr@2
   361
	{
williamr@2
   362
public:
williamr@2
   363
	IMPORT_C CMsvOperation* GetMailL(TInt aFunctionId, CImap4ClientMtm& aImap4ClientMtm, const CMsvEntrySelection& aMsvEntrySelection, TDes8& aImap4GetMailInfo, TRequestStatus& aObserverRequestStatus);
williamr@2
   364
	~CImImap4GetMail();
williamr@2
   365
	void DoCancel();
williamr@2
   366
	void RunL();
williamr@2
   367
	const TDesC8& ProgressL();
williamr@2
   368
	const TDesC8& FinalProgress();
williamr@2
   369
private:
williamr@2
   370
	CImImap4GetMail(CMsvSession& aMsvSession, CImap4ClientMtm& aImap4ClientMtm, TRequestStatus& aObserverRequestStatus);
williamr@2
   371
	void ConstructL(TInt aFunctionId, const CMsvEntrySelection& aMsvEntrySelection, TDes8& aImap4GetMailInfo);
williamr@2
   372
	void SelectNextStateL();					// selects next state to go to
williamr@2
   373
	void ChangeStateL();					// initiates the next state operation
williamr@2
   374
	void SelectAndChangeToNextStateL();
williamr@2
   375
	void RequestComplete(TInt aError);
williamr@2
   376
	void Complete();
williamr@2
   377
	void ConnectToMailboxL();
williamr@2
   378
	void CopyMoveNewMessagesL(TBool aCopy);
williamr@2
   379
	void CopyMoveMessageSelectionL(TBool aCopy);
williamr@2
   380
	void CopyMoveAllMessagesL(TBool aCopy);
williamr@2
   381
	void PopulateNewMessagesL();
williamr@2
   382
	void PopulateAllMessagesL();
williamr@2
   383
	void PopulateMessageSelectionL();
williamr@2
   384
	void DisconnectFromMailboxL();
williamr@2
   385
	void ResetProgress();
williamr@2
   386
	void StoreProgressL();
williamr@2
   387
private:
williamr@2
   388
	enum TImImap4GetMailState
williamr@2
   389
		{
williamr@2
   390
		EConnectToMailbox,
williamr@2
   391
		ECopyNewMessages,
williamr@2
   392
		EMoveNewMessages,
williamr@2
   393
		EPopulateNewMessages,
williamr@2
   394
		ECopyMessageSelection,
williamr@2
   395
		EMoveMessageSelection,
williamr@2
   396
		EPopulateMessageSelection,
williamr@2
   397
		ECopyAllMessages,
williamr@2
   398
		EMoveAllMessages,
williamr@2
   399
		EPopulateAllMessages,
williamr@2
   400
		EDisconnectFromMailbox,
williamr@2
   401
		EFinished
williamr@2
   402
		};
williamr@2
   403
	
williamr@2
   404
	CImap4ClientMtm&				iImap4ClientMtm;
williamr@2
   405
	CMsvEntrySelection*				iMsvEntrySelection;
williamr@2
   406
	CMsvOperation*					iMsvOperation;
williamr@2
   407
williamr@2
   408
	TImap4GenericProgress			iProgress;
williamr@2
   409
	TImap4GenericProgress			iErrorProgress;
williamr@2
   410
	TImImap4GetMailState			iState;
williamr@2
   411
	TInt							iCommand;
williamr@2
   412
	TPckgBuf<TImap4GenericProgress>	iProgressBuf;
williamr@2
   413
	TPckgBuf<TImImap4GetPartialMailInfo>	iImap4GetPartialMailInfo;
williamr@2
   414
	};
williamr@2
   415
williamr@2
   416
#endif // __IMPCMTM_H__