|
1 // Copyright (c) 1998-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 // This is the public API header file for IMSM.DLL - |
|
15 // the transport driver which sends Imail using the |
|
16 // SMTP Internet protocol. |
|
17 // |
|
18 // |
|
19 |
|
20 #if !defined(_IMSM_H__) |
|
21 #define _IMSM_H__ |
|
22 |
|
23 #if !defined (__IMSK_H__) |
|
24 #include <imsk.h> // EActivePriorityHigh |
|
25 #endif |
|
26 |
|
27 #include "mimmobileserver.h" |
|
28 |
|
29 /** |
|
30 @internalComponent |
|
31 @released |
|
32 */ |
|
33 const TInt KImSmtpFilePriority = (EActivePriorityHigh); |
|
34 const TInt KImSmtpSessionPriority = (KImSmtpFilePriority); |
|
35 const TInt KMsgImOutboxSendPriority = (KImSmtpSessionPriority); |
|
36 |
|
37 |
|
38 // forward declarations |
|
39 class CImSmtpSession; |
|
40 class CMsvEntrySelection; |
|
41 class CMsvServerEntry; |
|
42 class CSmtpSessionManager; |
|
43 class CImMobilityManager; |
|
44 class CSmtpSettings; |
|
45 #if (defined SYMBIAN_USER_PROMPT_SERVICE) |
|
46 class CSmtpUpsResponseWaiter; |
|
47 #endif |
|
48 class CMsgImOutboxSend : public CActive, public MImMobileServer |
|
49 /** |
|
50 @internalComponent |
|
51 @released |
|
52 */ |
|
53 { |
|
54 public: |
|
55 static CMsgImOutboxSend* NewLC(const CMsvEntrySelection& aEntrySelection,CMsvServerEntry& aServerEntry,TMsvId aService); |
|
56 static CMsgImOutboxSend* NewL(const CMsvEntrySelection& aEntrySelection,CMsvServerEntry& aServerEntry,TMsvId aService); |
|
57 ~CMsgImOutboxSend(); |
|
58 |
|
59 #if (defined SYMBIAN_USER_PROMPT_SERVICE) |
|
60 void StartL(TRequestStatus& aStatus, TThreadId aClientThreadId, TBool aHasCapability); |
|
61 #endif |
|
62 void StartL(TRequestStatus& aStatus); |
|
63 |
|
64 const TImSmtpProgress& Progress(); |
|
65 TBool SessionIsConnected(); |
|
66 TInt NextFile(); // public (but not imported) |
|
67 // so SmtpSession() can use function |
|
68 void SetLastMessageStatusL(const TTime&, TInt); // ditto |
|
69 inline const CMsvEntrySelection& EntrySelection() const; |
|
70 |
|
71 CDesCArray& BccRcptArray(); |
|
72 void ResetBccRcptArrayL(); |
|
73 |
|
74 // From MImMobileServer |
|
75 void PrepareForNewCarrier(TImMobilityAction aAction, TBool aIsSeamless); |
|
76 void CarrierLost(); |
|
77 void NewCarrierActive(TAccessPointInfo aNewAp, TBool aIsSeamless); |
|
78 void MobilityError(TUint aError); |
|
79 const TDesC8& MobilityProgress(); |
|
80 TInt GetAccessPointIdForConnection(TUint32& aAccessPointId) const; |
|
81 |
|
82 protected: |
|
83 void RunL(); |
|
84 TInt RunError(TInt aError); |
|
85 void DoCancel(); |
|
86 void ConstructL( TMsvId aService ); |
|
87 CMsgImOutboxSend(const CMsvEntrySelection& aEntrySelection,CMsvServerEntry& aServerEntry); |
|
88 |
|
89 private: |
|
90 enum TState |
|
91 { |
|
92 EStateIdle, |
|
93 EStateUserPrompting, |
|
94 EStateConnectingSession, |
|
95 EStateSendingFiles, |
|
96 EStateClosingSession, |
|
97 EStateWaitingNewCarrier, |
|
98 EStateMobilityError |
|
99 }; |
|
100 |
|
101 enum TMobilityOperation |
|
102 { |
|
103 EMobilityOperationIdle, |
|
104 EMobilityOperationStoppingCurrent, |
|
105 EMobilityOperationCompletingCurrent, |
|
106 EMobilityOperationMigrating |
|
107 }; |
|
108 |
|
109 private: |
|
110 void SetupStartL(); |
|
111 void StartConnectingL(); |
|
112 void PrepareForNewCarrierAfterOperation(TMobilityOperation aMobilityOperation); |
|
113 void SessionConnectedL(); |
|
114 void SentFiles(); |
|
115 void SessionClosed(); |
|
116 void MigratedL(); |
|
117 void SessionConnectionFailed(); |
|
118 void SignalMigrate(); |
|
119 void StartWaitingNewCarrier(); |
|
120 void CancelForMigrate(); |
|
121 void Complete(TInt status); |
|
122 |
|
123 void UpdateSummaryInfo(TInt&); |
|
124 void SetBodyEncoding(TMsgOutboxBodyEncoding); |
|
125 void DisconnectUnsentMessagesL(); |
|
126 TInt CalculateError(TInt aCompletionReason); |
|
127 void RestoreBccRecipientsToHeaderL(); |
|
128 void CleanUpOnDestructL(); |
|
129 TBool PreparingForMigration(); |
|
130 |
|
131 private: |
|
132 const CMsvEntrySelection& iEntrySelection; // Array of message Ids.. (filename) |
|
133 CMsvServerEntry& iServerEntry; // Handle on individual |
|
134 // element of iEntrySelection |
|
135 CImSmtpSession* iSession; |
|
136 CSmtpSettings* iSettings; |
|
137 |
|
138 TImSmtpProgress iProgress; |
|
139 TRequestStatus* iReport; |
|
140 |
|
141 |
|
142 TInt iCurrentMessageNo; // Replaces count in NextFile() |
|
143 TInt iTotalMessages; // Relaces msgNo in NextFile(); |
|
144 TBool iSetDisconnected; |
|
145 CDesCArrayFlat* iBccRcptArray; |
|
146 |
|
147 #if (defined SYMBIAN_USER_PROMPT_SERVICE) |
|
148 CSmtpUpsResponseWaiter* iWaiter; |
|
149 #endif |
|
150 |
|
151 TState iState; |
|
152 TMobilityOperation iMobilityOperation; |
|
153 |
|
154 CSmtpSessionManager* iSessionManager; |
|
155 CImMobilityManager* iMobilityManager; |
|
156 TBool iCancellingForMigrate; |
|
157 TBool iDecrementMessageCountAfterMigration; |
|
158 |
|
159 TPckgBuf<TImSmtpProgress> iMobilityProgressBuffer; |
|
160 }; |
|
161 |
|
162 #endif |