email/pop3andsmtpmtm/imapservermtm/test/inc/T_PartialDownloadImapClient.h
changeset 25 84d9eb65b26f
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __T_PARTIALDOWNLOADIMAPCLIENT_H__
       
    17 #define __T_PARTIALDOWNLOADIMAPCLIENT_H__
       
    18 
       
    19 #include <e32cons.h>
       
    20 #include <e32const.h>
       
    21 #include <in_sock.h>
       
    22 #include <nifman.h>
       
    23 #include "emailtestutils.h"
       
    24 #include <iapprefs.h>
       
    25 #include <cemailaccounts.h>
       
    26 #include "impsmtm.h"
       
    27 #include <imapconnectionobserver.h>
       
    28 #include "cspoofserver.h"
       
    29 
       
    30 // For loading the serial comms device drivers 
       
    31 #if defined (__WINS__)
       
    32 	#define PDD_NAME		_L("ECDRV")
       
    33 	#define LDD_NAME		_L("ECOMM")
       
    34 #else
       
    35 	#define PDD_NAME		_L("EUART1")
       
    36 	#define LDD_NAME		_L("ECOMM")
       
    37 #endif
       
    38 
       
    39 class TDummySessionObserver : public CBase , public MMsvSessionObserver
       
    40 	{
       
    41 public:
       
    42 	void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
       
    43 	};
       
    44 
       
    45 class CPartialDownLoadImapClient : public CActive , public MMsvImapConnectionObserver
       
    46 	{
       
    47 
       
    48 public:
       
    49 	
       
    50 	static CPartialDownLoadImapClient* NewL(MImapTestEventHandler& aObserver,TBool aFetchWholeMessage);
       
    51 	static CPartialDownLoadImapClient* NewLC(MImapTestEventHandler& aObserver,TBool aFetchWholeMessage);
       
    52 	void StartL();
       
    53 	void CreateImapAccountL();
       
    54 	~CPartialDownLoadImapClient();
       
    55 	TImapAccount GetImapAccount();
       
    56 
       
    57 private:
       
    58 	CPartialDownLoadImapClient(MImapTestEventHandler& aObserver,TBool aFetchWholeMessage);
       
    59 	void ConstructL();
       
    60 	virtual void DoCancel();
       
    61 	virtual void RunL();
       
    62 	virtual TInt RunError(TInt aError);
       
    63 	
       
    64 	//implementation of pure virtual inherited from MMsvImapConnectionObserver 
       
    65 	virtual void HandleImapConnectionEvent(TImapConnectionEvent aConnectionState);
       
    66 private:
       
    67 
       
    68 	enum TIMAPClientState 
       
    69 		{
       
    70 		EFetch=0,	
       
    71 		EDisconnect, 
       
    72 		EComplete
       
    73 		};
       
    74 		
       
    75 	CEmailAccounts* iAccounts;
       
    76 	TImapAccount iImapAccount;
       
    77 	CMsvSession* iSession;
       
    78 	CBaseMtm* iClientMtm;
       
    79 	CClientMtmRegistry*	iClientRegistry;
       
    80 	TDummySessionObserver*	iSessionObserver;
       
    81 	CMsvOperation* iMsvOperation;
       
    82 	TIMAPClientState iNextStep;
       
    83 	CMsvEntrySelection* iSelection;
       
    84 	MImapTestEventHandler& iObserver;
       
    85 	TBool iFetchWholeMessage;
       
    86 	};
       
    87 
       
    88 #endif  //__T_PARTIALDOWNLOADIMAPCLIENT_H__