|
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 __IMAPCLIENT_H__ |
|
17 #define __IMAPCLIENT_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 "eventhandler.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 CActiveImapClient : public CActive , public MMsvImapConnectionObserver |
|
46 { |
|
47 |
|
48 public: |
|
49 |
|
50 IMPORT_C static CActiveImapClient* NewL(MImapTestEventHandler* aOwner,TBool aFetchWholeMessage); |
|
51 IMPORT_C static CActiveImapClient* NewLC(MImapTestEventHandler* aOwner,TBool aFetchWholeMessage); |
|
52 void StartL(); |
|
53 void CreateImapAccountL(); |
|
54 ~CActiveImapClient(); |
|
55 TImapAccount GetAccount(); |
|
56 |
|
57 private: |
|
58 CActiveImapClient(); |
|
59 IMPORT_C void ConstructL(MImapTestEventHandler* aOwner,TBool aFetchWholeMessage); |
|
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, EDisconnect , EComplete |
|
71 }; |
|
72 |
|
73 CEmailAccounts* iAccounts; |
|
74 TImapAccount iImapAccount; |
|
75 CImap4ServerMtm* iImapServerMtm; |
|
76 CMsvSession* iSession; |
|
77 CBaseMtm* iClientMtm; |
|
78 CClientMtmRegistry* iClientRegistry; |
|
79 TDummySessionObserver* iSessionObserver; |
|
80 CMsvOperation* iMsvOperation; |
|
81 TIMAPClientState iNextStep; |
|
82 CMsvEntrySelection* iSelection; |
|
83 TBool iFetchWholeMessage; |
|
84 MImapTestEventHandler* iOwner; |
|
85 }; |
|
86 |
|
87 #endif //__IMAPCLIENT_H__ |