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