email/pop3andsmtpmtm/popservermtm/inc/POPSOP.H
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 2008-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 // popservermtm module header
       
    15 // @internalComponent
       
    16 // @released
       
    17 // 
       
    18 //
       
    19 
       
    20 #if !defined(_IMPPOP_H__)
       
    21 #define _IMPPOP_H__
       
    22 
       
    23 #include <badesca.h>
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>    // For CMsgActive, TFileName
       
    26 #include <imsk.h>		// ImSockets interface - For CImSocket() wrapper.
       
    27 #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT)
       
    28 #include "cpopsaslauthhelper.h"
       
    29 #endif
       
    30 
       
    31 class CImRecvConvert;
       
    32 
       
    33 //
       
    34 // CImPop3Operation
       
    35 //
       
    36 class CImPop3Operation : public CMsgActive
       
    37 	{
       
    38 public:
       
    39 	~CImPop3Operation();
       
    40 	virtual TBool SetMessage(TMsvId);
       
    41 	
       
    42 	TBool PopCommandAccepted();
       
    43 	// get necessary info from IMCV
       
    44 	TMsvId EntryId() { return iNewEntryId; };
       
    45 	TBool  EmptyHeaders() { return iEmptyHeaders; };
       
    46 	TPtrC8  ImMsgId();
       
    47 
       
    48 protected:
       
    49 	CImPop3Operation();
       
    50 	virtual void Construct(CImPop3Session*);
       
    51 	virtual void Construct(CImPop3Session*, CImRecvConvert*);
       
    52 
       
    53 	virtual void DoRunL();
       
    54 	virtual void DoCancel();
       
    55 	virtual void DoComplete(TInt&);
       
    56 
       
    57 	TInt MessageNo(TMsvId);
       
    58 	void QueueReadNext();
       
    59 	void RetrieveMessageL();
       
    60 	void CheckIfPending();
       
    61 	void RemoveFirstDot();
       
    62 
       
    63 protected:
       
    64 	CImTextServerSession*			iTextServer;
       
    65 	CImPop3Session*					iPopSession;
       
    66 
       
    67 	TImMailBuffer					iTextServerResponse;
       
    68 
       
    69 	TInt							iMessageNo;
       
    70 	TBufC8<3>						iFullStopTerminator;
       
    71 	TBool							iFirstLine;
       
    72 	TBool							iCommandAccepted;
       
    73 	CImRecvConvert*					iRecvConverter;
       
    74 
       
    75 	TMsvId							iNewEntryId;
       
    76 	TBool							iEmptyHeaders;
       
    77 	HBufC8*							iImId;
       
    78 	TBool							iParsedHeader;
       
    79 	};
       
    80 
       
    81 //
       
    82 // CImPop3Stat
       
    83 //
       
    84 // STAT command returns no of messages and total size of remote mailbox
       
    85 //
       
    86 class CImPop3Stat : public CImPop3Operation
       
    87 	{
       
    88 public:
       
    89 	static CImPop3Stat* NewL(CImPop3Session*);
       
    90 	void Start(TRequestStatus&, TUint&, TUint&);
       
    91 	
       
    92 private:
       
    93 	inline CImPop3Stat() {};
       
    94 	virtual void DoRunL();
       
    95 private:
       
    96 	TUint*		iNoMessages;
       
    97 	TUint*		iMailboxSize;
       
    98 	};
       
    99 
       
   100 //
       
   101 // CImPop3List
       
   102 //
       
   103 // list get size of a single message or all messages in remote mailbox
       
   104 //
       
   105 class CImPop3List : public CImPop3Operation
       
   106 	{
       
   107 public:
       
   108 	static CImPop3List* NewL(CImPop3Session*);
       
   109 	void Start(TRequestStatus&, TUint*);
       
   110 private:
       
   111 	inline	CImPop3List() {};
       
   112 	virtual void DoRunL();
       
   113 	TInt	GetIndexAndSize(TLex8*);
       
   114 private:
       
   115 	TUint*		iSize;
       
   116 	TUint		iArrayPos;
       
   117 	TInt 		iNoResponses;
       
   118 	};
       
   119 
       
   120 //
       
   121 // CImPop3Retr
       
   122 //
       
   123 // retrieve a specified message
       
   124 //
       
   125 class CImPop3Retr : public CImPop3Operation
       
   126 	{
       
   127 public:
       
   128 	static CImPop3Retr* NewL(CImPop3Session*, CImRecvConvert*, RFs&);
       
   129 	void StartL(TRequestStatus&);
       
   130 	void SetMessageIndex(TInt);
       
   131 	virtual TUint Progress();
       
   132 
       
   133 private:
       
   134 	inline CImPop3Retr(RFs& aFs) : iFs(aFs) {};
       
   135 	void ConstructL(CImPop3Session *aPopSession, CImRecvConvert* aRecvConverter);
       
   136 	void DoRunL();
       
   137 private:
       
   138 	TUint		iNoBytesRetrieved;
       
   139 	RFs&		iFs;
       
   140 	TInt		iCurrentDrive;
       
   141 	};
       
   142 
       
   143 //
       
   144 // CImPop3Dele
       
   145 //
       
   146 // delete a specified message
       
   147 //
       
   148 class CImPop3Dele : public CImPop3Operation
       
   149 	{
       
   150 public:
       
   151 	static CImPop3Dele* NewL(CImPop3Session*);
       
   152 	void Start(TRequestStatus&);
       
   153 private:
       
   154 	inline CImPop3Dele() {};
       
   155 	};
       
   156 
       
   157 //
       
   158 // CImPop3Noop
       
   159 //
       
   160 // carry out a no operation
       
   161 //
       
   162 class CImPop3Noop : public CImPop3Operation
       
   163 	{
       
   164 public:
       
   165 	static CImPop3Noop* NewL(CImPop3Session*);
       
   166 	void Start(TRequestStatus&);
       
   167 private:
       
   168 	inline CImPop3Noop() {};
       
   169 	};
       
   170 
       
   171 //
       
   172 // CImPop3Rset
       
   173 //
       
   174 // carry out RSET command
       
   175 //
       
   176 class CImPop3Rset : public CImPop3Operation
       
   177 	{
       
   178 public:
       
   179 	static CImPop3Rset* NewL(CImPop3Session*);
       
   180 	void Start(TRequestStatus&);
       
   181 private:
       
   182 	inline CImPop3Rset() {};
       
   183 	};
       
   184 
       
   185 //
       
   186 // CImPop3Top
       
   187 //
       
   188 // sends the TOP command to request email headers. 
       
   189 //
       
   190 class CImPop3Top : public CImPop3Operation
       
   191 	{
       
   192 public:
       
   193 	static CImPop3Top* NewL(CImPop3Session*, CImRecvConvert* ,TBool aHeaderOnly=ETrue);
       
   194 	void StartL(TRequestStatus&);
       
   195 	TBool SetMessageAndLines(TMsvId, TInt);
       
   196 	void SetMessageIndexAndLines(TInt, TInt);
       
   197 	void SetStartAndEndMessageIndex(TInt, TInt);
       
   198 	virtual TUint Progress();
       
   199 private:
       
   200 	inline CImPop3Top() {};
       
   201 
       
   202 	void DoRunL();
       
   203 	void ConstructL(CImPop3Session*, CImRecvConvert* ,TBool aHeaderOnly);
       
   204 
       
   205 
       
   206 	TInt		iNoLines;
       
   207 	TUint		iNoBytesRetrieved;
       
   208 	TBool		iHeadersOnly;
       
   209 	TInt		iStartMsg;
       
   210 	TInt		iLastMulti;
       
   211 	TBool 		iPipeliningSupported;
       
   212 	};
       
   213 
       
   214 
       
   215 // 
       
   216 // CImPop3UidlMap
       
   217 // 
       
   218 // return unique POP id of a specified message or ids of all the remote messages
       
   219 //
       
   220 class CImPop3UidlMap : public CBase
       
   221 	{
       
   222 public:
       
   223 	static CImPop3UidlMap* NewL(TInt aMsgCount);
       
   224 	~CImPop3UidlMap();
       
   225 
       
   226 	void BindL(TInt aMsgIx,const TDesC8& aUidl);
       
   227 	TInt MsgNo(const TDesC8& aUidl) const;
       
   228 	TPtrC8 At(TInt aMsgIx) const;
       
   229 	inline TPtrC8 operator[](TInt aMsgIx) const;
       
   230 	TInt MsgUidlNo(const TDesC8& aUidl,TInt& aPos) const;
       
   231 	TInt MsgIndex(TInt aPos) const;
       
   232 	TInt MsgCount() const;
       
   233 	TPtrC8 MsgUidl(TInt aPos) const;
       
   234 private:
       
   235 	CImPop3UidlMap(TInt aMsgCount);
       
   236 private:
       
   237 	CDesC8ArrayFlat iUid;
       
   238 	CArrayFixFlat<TInt> iMsgNo;
       
   239 	};
       
   240 
       
   241 inline TPtrC8 CImPop3UidlMap::operator[](TInt aMsgNo) const
       
   242 	{return At(aMsgNo);}
       
   243 
       
   244 //
       
   245 //  CImPop3Uidl
       
   246 //
       
   247 //
       
   248 class CImPop3Uidl : public CImPop3Operation
       
   249 	{
       
   250 public:
       
   251 	static CImPop3Uidl* NewL(CImPop3Session*);
       
   252 	void Start(TRequestStatus&, CImPop3UidlMap&);
       
   253 
       
   254 private:
       
   255 	inline CImPop3Uidl() {};
       
   256 	
       
   257 	void DoRunL();
       
   258 	void GetIndexAndUidL(TLex8*);
       
   259 private:
       
   260 	CImPop3UidlMap*		iMsgUid;
       
   261 	};
       
   262 	
       
   263 //
       
   264 // CImPop3Capa
       
   265 //
       
   266 // returns the list of capabilities supported by the server
       
   267 //
       
   268 class CImPop3Capa : public CImPop3Operation
       
   269 	{
       
   270 public:
       
   271 	static CImPop3Capa* NewL(CImPop3Session*);
       
   272 	void Start(TRequestStatus&);
       
   273 	TBool PipeliningSupport();
       
   274 	void ParseSASLCapabilitise(const TDesC8& aData);
       
   275 #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT)	
       
   276 	void SetSaslAuthExtensionFlag();
       
   277 	TUint SaslAuthExtensionFlag();
       
   278 #endif
       
   279 	
       
   280 private:
       
   281 	inline CImPop3Capa() {};
       
   282 	virtual void DoRunL();
       
   283 
       
   284 private:
       
   285 	TBool iPipeliningSupported;
       
   286 #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT)	
       
   287 	TUint iSupportedAuthProfiles; // for TPopAuthProfileFlags
       
   288 	CPopAuthMechanismHelper::TPopAuthProfileFlag iCurrentAuthProfile;
       
   289 #endif	
       
   290 	};
       
   291 
       
   292 #endif