email/imap4mtm/imapsession/src/cimapclose.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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 #include "cimapclose.h"
       
    17 #include "moutputstream.h"
       
    18 #include "cimapsessionconsts.h"
       
    19 #include "imappaniccodes.h"
       
    20 
       
    21 // IMAP Close command
       
    22 _LIT8(KCommandClose, "%d CLOSE\r\n");
       
    23 
       
    24 CImapClose* CImapClose::NewL(CImapFolderInfo* aSelectedFolderData, TInt aLogId)
       
    25 // static method first phase construction
       
    26 	{
       
    27 	CImapClose* self = new (ELeave) CImapClose(aSelectedFolderData, aLogId);
       
    28 	CleanupStack::PushL(self);
       
    29 	self->ConstructL();
       
    30 	CleanupStack::Pop();
       
    31 	return self;
       
    32 	}
       
    33 
       
    34 CImapClose::CImapClose(CImapFolderInfo* aSelectedFolderData, TInt aLogId)
       
    35 	: CImapCommandEx(aSelectedFolderData, aLogId)
       
    36 	{
       
    37 	}
       
    38 
       
    39 void CImapClose::ConstructL()
       
    40 	{
       
    41 	}
       
    42 
       
    43 CImapClose::~CImapClose()
       
    44 	{	
       
    45 	}
       
    46 
       
    47 /**
       
    48 Formats and sends the IMAP CLOSE command.
       
    49 @param aTagId Command sequence id which will be sent along with the IMAP command.
       
    50 @param aStream A wrapper for the outbound stream of a connected socket, using which
       
    51 the command will be send to the server
       
    52 */
       
    53 void CImapClose::SendMessageL(TInt aTagId, MOutputStream& aStream)
       
    54 	{
       
    55 	iTagId = aTagId;
       
    56 
       
    57 	__ASSERT_DEBUG(iOutputBuffer==NULL, TImapServerPanic::ImapPanic(TImapServerPanic::ECommandOutputBufferNotNull));
       
    58 	iOutputBuffer = HBufC8::NewL(KCommandClose().Length() + TagLength(aTagId));
       
    59 	iOutputBuffer->Des().Format(KCommandClose, aTagId);
       
    60 
       
    61 	//send the command to the server
       
    62 	aStream.SendDataReq(*iOutputBuffer);
       
    63 	}
       
    64