email/imap4mtm/imapsession/src/cimapservereventwait.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 "cimapservereventwait.h"
       
    18 #include "moutputstream.h"
       
    19 #include "cimapsessionconsts.h"
       
    20 #include "imappaniccodes.h"
       
    21 
       
    22 CImapServerEventWait* CImapServerEventWait::NewL(CImapFolderInfo* aSelectedFolderData, TInt aLogId)
       
    23 	{
       
    24 	CImapServerEventWait* self = new (ELeave) CImapServerEventWait(aSelectedFolderData, aLogId);
       
    25 	CleanupStack::PushL(self);
       
    26 	self->ConstructL();
       
    27 	CleanupStack::Pop();
       
    28 	return self;		
       
    29 	}	
       
    30 
       
    31 CImapServerEventWait::CImapServerEventWait(CImapFolderInfo* aSelectedFolderData, TInt aLogId) 
       
    32 	: CImapCommandEx(aSelectedFolderData, aLogId)
       
    33 	{
       
    34 	// override the default CImapCommand value
       
    35 	iCompleteOnAnyResponse = ETrue;
       
    36 	}
       
    37 	
       
    38 void CImapServerEventWait::ConstructL()
       
    39 	{
       
    40 	}
       
    41 	
       
    42 CImapServerEventWait::~CImapServerEventWait()
       
    43 	{
       
    44 	}
       
    45 
       
    46 /**
       
    47 If CImapServerEventWait is waiting for the start of a new response
       
    48 (i.e. it is not in the middle of processing a response) then the Flush
       
    49 operation can complete the command straight away.
       
    50 @return EFalse if processing a response.
       
    51 		ETrue if waiting for the start of a new response.
       
    52 */
       
    53 TBool CImapServerEventWait::CanCompleteFlushNow() const
       
    54 	{
       
    55 	// Any command that has completed should have been destroyed before this
       
    56 	// method is called.
       
    57 	__ASSERT_DEBUG(ParseState() != ECommandComplete, TImapServerPanic::ImapPanic(TImapServerPanic::ECommandInvalidParseState10));
       
    58 	__ASSERT_DEBUG(Flushing(), TImapServerPanic::ImapPanic(TImapServerPanic::ECommandNotFlushing));
       
    59 	
       
    60 	return (ParseState() == EWaitStartResponse) ? ETrue: EFalse;
       
    61 	}
       
    62 
       
    63 /**
       
    64 This command does not send any command.
       
    65 It just waits for any unsolicited responses that the server might send.
       
    66 So this method is an empty stub that allows the server event wait object
       
    67 to fit into the CImapCommand framework.
       
    68 @param aTagId	Ignored in this implementation of CImapCommand.
       
    69 @param aStream	Ignored in this implementation of CImapCommand.
       
    70 */
       
    71 void CImapServerEventWait::SendMessageL(TInt /*aTagId*/, MOutputStream& /*aStream*/)
       
    72 	{
       
    73 	__ASSERT_DEBUG(iOutputBuffer==NULL, TImapServerPanic::ImapPanic(TImapServerPanic::ECommandOutputBufferNotNull));
       
    74 	}
       
    75 
       
    76 /**
       
    77 Always leaves with KErrImapCorrupt, because unsolicited tagged responses are not expected from the server.
       
    78 @return because this implementation of the method always leaves, no value can ever be returned.
       
    79 */
       
    80 TBool CImapServerEventWait::ParseTaggedResponseL(TInt /*aTagId*/)
       
    81 	{
       
    82 	CorruptDataL();
       
    83 	return EFalse;
       
    84 	}
       
    85