imstutils/imconversationview/imcvuiengine/src/cimcvenginemessagecreator.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 21 Jun 2010 15:25:20 +0300
branchRCL_3
changeset 19 fda5a9396e07
parent 0 5e5d6b214f4f
permissions -rw-r--r--
Revision: 201023 Kit: 2010125

/*
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  message creater class implementation
*
*/


#include "cimcvenginemessagecreator.h"
#include "cimcvenginetextmessage.h"
#include "imcvuiliterals.h"
#include "imcvlogger.h"

//-----------------------------------------------------------------------------
// CIMCVEngineMessageCreator::CIMCVEngineMessageCreator
// ( Other items commented in header )
//-----------------------------------------------------------------------------
CIMCVEngineMessageCreator::CIMCVEngineMessageCreator()
	{
	IM_CV_LOGS(TXT("CIMCVEngineMessageCreator::CIMCVEngineMessageCreator() start") );
	IM_CV_LOGS(TXT("CIMCVEngineMessageCreator::CIMCVEngineMessageCreator() end") );
	}

//-----------------------------------------------------------------------------
// CIMCVEngineMessageCreator::~CIMCVEngineMessageCreator
// ( Other items commented in header )
//-----------------------------------------------------------------------------
CIMCVEngineMessageCreator::~CIMCVEngineMessageCreator()
	{
	}
	
//-----------------------------------------------------------------------------
// CIMCVEngineMessageCreator::NewL
// ( Other items commented in header )
//-----------------------------------------------------------------------------
CIMCVEngineMessageCreator* CIMCVEngineMessageCreator::NewL()
	{
	IM_CV_LOGS(TXT("CIMCVEngineMessageCreator::NewL() start") );
	CIMCVEngineMessageCreator* self = new ( ELeave ) CIMCVEngineMessageCreator();
	IM_CV_LOGS(TXT("CIMCVEngineMessageCreator::NewL() end") );
	return self;
	}

	
//-----------------------------------------------------------------------------
// CIMCVEngineMessageCreator::CreateMessageL
// ( Other items commented in header )
//-----------------------------------------------------------------------------
MIMCVEngineMessage* CIMCVEngineMessageCreator::CreateMessageL( const SMessageData& aData ) const
	{
	IM_CV_LOGS(TXT("CIMCVEngineMessageCreator::CreateMessageL() start") );
	if( aData.iContentType == MIMCVEngineMessage::EContentText ) // Text message
		{
		return CreateTextMessageL( aData );
		}
	IM_CV_LOGS(TXT("CIMCVEngineMessageCreator::CreateMessageL() end") );
	return NULL;
	}
	
 
	
//-----------------------------------------------------------------------------
// CIMCVEngineMessageCreator::CreateTextMessageL
// ( Other items commented in header )
//-----------------------------------------------------------------------------
MIMCVEngineMessage* CIMCVEngineMessageCreator::CreateTextMessageL( 
                                        const SMessageData& aData ) const
	{
	IM_CV_LOGS(TXT("CIMCVEngineMessageCreator::CreateTextMessageL() start") );
	CIMCVEngineTextMessage* message = CIMCVEngineTextMessage::NewL( 
	                                                aData.iSenderId, 
                                                    aData.iTargetId,
	                                                aData.iText );
	message->SetMessagerType( aData.iMessager );
	IM_CV_LOGS(TXT("CIMCVEngineMessageCreator::CreateTextMessageL() end") );
	return message;
	}
//-----------------------------------------------------------------------------
// CIMCVEngineMessageCreator::CreateFailedMessageL
// ( Other items commented in header )
//-----------------------------------------------------------------------------
MIMCVEngineMessage* CIMCVEngineMessageCreator::CreateFailedMessageL( 
                                        const MIMCVEngineMessage* pSource ) const
    {
    IM_CV_LOGS(TXT("CIMCVEngineMessageCreator::CreateFailedMessageL() start") );
    CIMCVEngineTextMessage* message = CIMCVEngineTextMessage::NewLC(
	                                                 pSource->Sender(), 
	                                                 pSource->Recipient(),
	                                                 pSource->Text() );
    message->SetFailedL();
    CleanupStack::Pop( message );
	message->SetMessagerType( pSource->MessagerType() );
	IM_CV_LOGS(TXT("CIMCVEngineMessageCreator::CreateFailedMessageL() end") );
	
	return message;
    }
    	


// end of file