email/imap4mtm/imapsession/src/cimapexpunge.cpp
changeset 31 ebfee66fde93
parent 0 72b543305e3a
equal deleted inserted replaced
30:6a20128ce557 31:ebfee66fde93
       
     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 "cimapexpunge.h"
       
    17 #include "moutputstream.h"
       
    18 #include "cimapfolderinfo.h"
       
    19 #include "cimapsessionconsts.h"
       
    20 #include "imappaniccodes.h"
       
    21 
       
    22 // IMAP EXPUNGE command
       
    23 _LIT8(KCommandExpunge, "%d EXPUNGE\r\n");
       
    24 
       
    25 CImapExpunge* CImapExpunge::NewL(CImapFolderInfo* aSelectedFolderData, TInt aLogId)
       
    26 	{
       
    27 	CImapExpunge* self = new (ELeave) CImapExpunge(aSelectedFolderData, aLogId);
       
    28 	CleanupStack::PushL(self);
       
    29 	self->ConstructL();
       
    30 	CleanupStack::Pop();
       
    31 	return self;		
       
    32 	}	
       
    33 
       
    34 CImapExpunge::CImapExpunge(CImapFolderInfo* aSelectedFolderData, TInt aLogId) 
       
    35 	: CImapCommandEx(aSelectedFolderData, aLogId)
       
    36 	{
       
    37 	}
       
    38 	
       
    39 void CImapExpunge::ConstructL()
       
    40 	{
       
    41 	}
       
    42 	
       
    43 CImapExpunge::~CImapExpunge()
       
    44 	{
       
    45 	}
       
    46 
       
    47 /** 
       
    48 Formats and sends the IMAP EXPUNGE 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 CImapExpunge::SendMessageL(TInt aTagId, MOutputStream& aStream)
       
    54 	{
       
    55 	iTagId = aTagId;
       
    56 		
       
    57 	__ASSERT_DEBUG(iOutputBuffer==NULL, TImapServerPanic::ImapPanic(TImapServerPanic::ECommandOutputBufferNotNull));
       
    58 	iOutputBuffer = HBufC8::NewL(KCommandExpunge().Length() - 2 + TagLength(aTagId));// -2 for %d..
       
    59 	iOutputBuffer->Des().Format(KCommandExpunge, aTagId);	
       
    60 	//send the command to the server
       
    61 	aStream.SendDataReq(*iOutputBuffer);
       
    62 	}