|
1 // Copyright (c) 2006-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 |
|
17 #ifndef __CIMAPAPPEND_H__ |
|
18 #define __CIMAPAPPEND_H__ |
|
19 |
|
20 #include <e32std.h> |
|
21 #include "cimapcommand.h" |
|
22 |
|
23 // Forward Declaration |
|
24 class CImSendMessage; |
|
25 class CImapSession; |
|
26 |
|
27 class CImapAppend; |
|
28 |
|
29 /** |
|
30 The CImapAppend class encapsulates the sending of the IMAP APPEND |
|
31 command to the remote server. It parses the response data from |
|
32 the remote server. |
|
33 @internalTechnology |
|
34 @prototype |
|
35 */ |
|
36 class CImapAppend : public CImapCommandEx |
|
37 { |
|
38 public: |
|
39 // Construction and Destruction |
|
40 static CImapAppend* NewL(CImapFolderInfo* aSelectedFolderData, TInt aLogId, CImSendMessage& aSource, const TDesC& aDestinationMailboxName, CImapSession& aParentSession); |
|
41 ~CImapAppend(); |
|
42 |
|
43 private: |
|
44 CImapAppend(CImapFolderInfo* aSelectedFolderData, TInt aLogId, CImSendMessage& aSource, CImapSession& aParentSession); |
|
45 void ConstructL(const TDesC& aDestinationMailboxName); |
|
46 |
|
47 void SendDataCnfL(); |
|
48 void SendNextMessageLineL(); |
|
49 |
|
50 // Implements CImapCommand |
|
51 void SendMessageL(TInt aTagId, MOutputStream& aStream); |
|
52 void Cancel(); |
|
53 TBool CanCompleteFlushNow() const; |
|
54 |
|
55 static TInt MessageSizeCalculationStep(TAny* aSelf); |
|
56 TInt MessageSizeCalculationStepL(); |
|
57 void SendAppendCommandWithSizeL(); |
|
58 |
|
59 void ParseContinuationResponseL(); |
|
60 |
|
61 private: |
|
62 CImSendMessage& iSource; |
|
63 /** |
|
64 This object is used to split the message size calculation into steps: one per line of the message. |
|
65 Each step is initiated by the active scheduler when no other processing is taking place. |
|
66 */ |
|
67 CIdle* iBackgroundCalculationStepper; |
|
68 /** |
|
69 The parent session - refereneced so that it can receive failure notification if a |
|
70 leave occurs during MessageSizeCalculationStepL() |
|
71 */ |
|
72 CImapSession& iParentSession; |
|
73 TInt iTotalMessageSize; |
|
74 |
|
75 TInt iPadCount; |
|
76 HBufC8* iLineBufferForSend; |
|
77 HBufC8* iDestinationMailboxName; |
|
78 MOutputStream* iStream; // not owned |
|
79 |
|
80 /** |
|
81 Represents the sequence of steps involved in sending the append message. |
|
82 The order of the enumeration steps matches the order they are carried out. |
|
83 CanCompleteFlushNow() relies on this ordering to decide whether data has been sent yet. |
|
84 */ |
|
85 enum |
|
86 { |
|
87 EAppendWaitingToStart, |
|
88 EAppendCalculatingSize, |
|
89 EAppendWaitingForContinuationResponse, |
|
90 EAppendSendingMessageData, |
|
91 EAppendSendingLastMessageData, |
|
92 EAppendFinishedSending |
|
93 |
|
94 } iAppendCommandSendState; |
|
95 }; |
|
96 |
|
97 #endif // __CIMAPAPPEND_H__ |