|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Pop agent implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef __ALWAYSONLINEPOPAGENT_H__ |
|
20 #define __ALWAYSONLINEPOPAGENT_H__ |
|
21 |
|
22 #include "AlwaysOnlineEmailAgentBase.h" |
|
23 |
|
24 #include <mtclreg.h>//ClientMtmRegistry |
|
25 #include <popcmtm.h>//popclientmtm |
|
26 /** |
|
27 * CAlwaysOnlinePopAgent |
|
28 * |
|
29 * Class takes care of POP mailbox "always" online logic |
|
30 */ |
|
31 class CAlwaysOnlinePop3Agent : public CAlwaysOnlineEmailAgentBase |
|
32 { |
|
33 |
|
34 public: |
|
35 |
|
36 |
|
37 /** |
|
38 * NewL |
|
39 * Two phased constructor |
|
40 * @param CMsvSession&, session reference |
|
41 * @param CClientMtmRegistry&, mtm registry reference |
|
42 * @param TMsvId, mailbox id |
|
43 * @param MAlwaysOnlineStatusQueryInterface&, status query interface |
|
44 * @param CAlwaysOnlineEmailAgent&, email agent reference |
|
45 * @return CAlwaysOnlinePop3Agent*, self pointer |
|
46 */ |
|
47 static CAlwaysOnlinePop3Agent* NewL( CMsvSession& aSession, |
|
48 CClientMtmRegistry& aClientMtmRegistry, |
|
49 TMsvId aMailboxId, |
|
50 MAlwaysOnlineStatusQueryInterface& aAlwaysOnlineManager, |
|
51 CAlwaysOnlineEmailAgent& aEmailAgent); |
|
52 |
|
53 /** |
|
54 * ~CAlwaysOnlinePop3Agent |
|
55 * Destructor |
|
56 */ |
|
57 ~CAlwaysOnlinePop3Agent(); |
|
58 |
|
59 private: |
|
60 /** |
|
61 * CAlwaysOnlinePop3Agent |
|
62 * @param CMsvSession&, session reference |
|
63 * @param CClientMtmRegistry&, mtm registry reference |
|
64 * @param TMsvId, mailbox id |
|
65 * @param MAlwaysOnlineStatusQueryInterface&, status query interface |
|
66 * @param CAlwaysOnlineEmailAgent&, email agent reference |
|
67 */ |
|
68 CAlwaysOnlinePop3Agent( CMsvSession& aSession, |
|
69 CClientMtmRegistry& aClientMtmRegistry, |
|
70 MAlwaysOnlineStatusQueryInterface& aAlwaysOnlineManager, |
|
71 CAlwaysOnlineEmailAgent& aEmailAgent ); |
|
72 |
|
73 /** |
|
74 * ConstructL |
|
75 * @param TMsvId, mailbox id |
|
76 * Second phase constructor |
|
77 */ |
|
78 void ConstructL( TMsvId aMailboxId ); |
|
79 |
|
80 //from CAlwaysOnlineEmailAgentBase |
|
81 public: |
|
82 |
|
83 /** |
|
84 * StartL |
|
85 * from CAlwaysOnlineEmailAgentBase |
|
86 */ |
|
87 void StartL(); |
|
88 |
|
89 /** |
|
90 * ConnectAndUpdateHeadersL |
|
91 * from CAlwaysOnlineEmailAgentBase |
|
92 */ |
|
93 void ConnectAndUpdateHeadersL( ); |
|
94 |
|
95 |
|
96 /** |
|
97 * DisconnectL |
|
98 * from CAlwaysOnlineEmailAgentBase |
|
99 * @param TBool, automatic or manual disconnection |
|
100 */ |
|
101 void DisconnectL( TBool aAutomatic ); |
|
102 |
|
103 |
|
104 protected: |
|
105 |
|
106 /** |
|
107 * ChangeNextStateL |
|
108 * from CAlwaysOnlineEmailAgentBase |
|
109 */ |
|
110 void ChangeNextStateL(); |
|
111 |
|
112 /** |
|
113 * HandleOpErrorL |
|
114 * from CAlwaysOnlineEmailAgentBase |
|
115 */ |
|
116 void HandleOpErrorL(); |
|
117 |
|
118 /** |
|
119 * DoSyncDisconnectL(), from emailagentbase |
|
120 * Does sync disconnect. Meant to be called from ResetAll(). |
|
121 * This is needed because this must not have imapact on state machine. |
|
122 */ |
|
123 void DoSyncDisconnectL(); |
|
124 |
|
125 /** |
|
126 * HandleOpCompleted |
|
127 * from CAlwaysOnlineEmailAgentBase |
|
128 * @param TMsvOp, id of completed operation |
|
129 * @param, TInt, completion code |
|
130 */ |
|
131 void HandleOpCompleted( TMsvOp opId, TInt aCompletionCode ); |
|
132 |
|
133 /** |
|
134 * CreateCompletedOpL |
|
135 * from CAlwaysOnlineEmailAgentBase |
|
136 */ |
|
137 void CreateCompletedOpL(); |
|
138 |
|
139 /** |
|
140 * MailHasBeenSyncedL |
|
141 * Function to check has mailbox been synced before. |
|
142 * This is used to determine which sync method we should use. |
|
143 * @return TBool, has mailbox been synced |
|
144 */ |
|
145 TBool MailHasBeenSyncedL(); |
|
146 |
|
147 /** |
|
148 * |
|
149 * |
|
150 * @since S60 v3.2 |
|
151 * @return |
|
152 * @leave KErrNoMemory |
|
153 */ |
|
154 TImPop3PopulateOptions FillMailOptionsL(); |
|
155 |
|
156 |
|
157 private: |
|
158 |
|
159 /** |
|
160 * StartWaitTimerL |
|
161 * starts interval waiter. Does not handle schedule waits, only polling interval |
|
162 */ |
|
163 void StartWaitTimerL(); |
|
164 |
|
165 /** |
|
166 * CreatePop3OperationL |
|
167 * aFunctionId ignored and completed operation is created if aCompletedOperation is true. |
|
168 * @param TMsvOp&, this operation id is set in this function |
|
169 * @param TInt, function Id |
|
170 * @param TBool, ETrue if we want completed operation instead of real one |
|
171 */ |
|
172 void CreatePop3OperationL( |
|
173 TMsvOp& aOpId, TInt aFunctionId, TBool aCompletedOperation = EFalse ); |
|
174 |
|
175 /** |
|
176 * aFunctionId ignored and completed operation is created if aCompletedOperation is true. |
|
177 * @param TInt, function Id |
|
178 * @param TBool, ETrue if we want completed operation instead of real one |
|
179 */ |
|
180 void CreatePop3OperationL( |
|
181 TInt aFunctionId, TBool aCompletedOperation = EFalse ); |
|
182 |
|
183 /** |
|
184 * |
|
185 * |
|
186 */ |
|
187 void DoFilteredPopulateL(); |
|
188 |
|
189 //data |
|
190 private: |
|
191 CPop3ClientMtm* iPop3ClientMtm; |
|
192 TBool iHasBeenSynced; |
|
193 |
|
194 }; |
|
195 |
|
196 |
|
197 #endif |
|
198 //EOF |