|
1 // Copyright (c) 2007-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 __CPOPSESSIONMANAGER_H__ |
|
17 #define __CPOPSESSIONMANAGER_H__ |
|
18 |
|
19 #include <mentact.h> |
|
20 #include <es_sock.h> |
|
21 |
|
22 class CImPop3Settings; |
|
23 class CImIAPPreferences; |
|
24 class TRequestStatus; |
|
25 class CImConnect; |
|
26 class CImPop3Session; |
|
27 class TPop3Progress; |
|
28 |
|
29 /** |
|
30 Provides a mechanism for creating logged in POP sessions and for |
|
31 disconnecting them. |
|
32 @internalTechnology |
|
33 @released |
|
34 */ |
|
35 NONSHARABLE_CLASS(CPopSessionManager) : public CMsgActive |
|
36 { |
|
37 public: |
|
38 static CPopSessionManager* NewL(); |
|
39 ~CPopSessionManager(); |
|
40 |
|
41 void GetSessionL(CImPop3Settings& aSettings, CImIAPPreferences& aIAPPrefs, |
|
42 CImPop3Session*& aSession, TRequestStatus& aStatus); |
|
43 void DeleteSession(CImPop3Session& aSession, TRequestStatus& aStatus); |
|
44 void ConnectionProgress(TPop3Progress& aProgress); |
|
45 TBool HasConnection(); |
|
46 RConnection& GetConnection(); |
|
47 TInt GetAccessPointIdForConnection(TUint32& aAccessPointId) const; |
|
48 |
|
49 private: |
|
50 enum TState |
|
51 { |
|
52 EStateIdle, |
|
53 EStateCreatingConnection, |
|
54 EStateCreatingSession, |
|
55 EStateStoringSession, |
|
56 EStateQuittingSession |
|
57 }; |
|
58 |
|
59 private: |
|
60 // Construction routines |
|
61 CPopSessionManager(); |
|
62 void ConstructL(); |
|
63 |
|
64 virtual void DoRunL(); |
|
65 virtual void DoCancel(); |
|
66 virtual void DoComplete(TInt& aStatus); |
|
67 |
|
68 void CreateConnectionL(); |
|
69 void CreateSessionL(); |
|
70 void StoreSession(); |
|
71 void QuitSession(); |
|
72 |
|
73 private: |
|
74 |
|
75 // Pop settings. Not owned by this class |
|
76 CImPop3Settings* iSettings; |
|
77 |
|
78 // IAP preferences. Not owned by this class |
|
79 CImIAPPreferences* iIAPPrefs; |
|
80 |
|
81 // Session we are operating on |
|
82 CImPop3Session* iSession; |
|
83 |
|
84 // Stores the created session for passing back to caller |
|
85 CImPop3Session** iStoreSession; |
|
86 |
|
87 // Network connection |
|
88 CImConnect* iConnect; |
|
89 |
|
90 // Socket server |
|
91 RSocketServ iServ; |
|
92 |
|
93 // State machine state |
|
94 TState iState; |
|
95 }; |
|
96 |
|
97 #endif // __CPOPSESSIONMANAGER_H__ |