rcsimengine/src/chatsessionimpl_sym.cpp
author shivsood
Fri, 08 Oct 2010 18:07:26 +0530
changeset 0 59dfe4ae66d0
permissions -rw-r--r--
RCS IM Library - Initial implementation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
     1
/*
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
     2
* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
     3
* All rights reserved.
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
     4
* This component and the accompanying materials are made available
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
     6
* which accompanies this distribution, and is available
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html."
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
     8
* Initial Contributors:
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
     9
* Nokia Corporation - initial contribution.
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    10
* Contributors:
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    11
*
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    12
* Description:
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    13
* RCS IM Library - Initial version
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    14
*
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    15
*/
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    16
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    17
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    18
#include <e32base.h>
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    19
#include <e32std.h>
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    20
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    21
#include <mcemessagesource.h>
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    22
#include <mcemessagestream.h>
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    23
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    24
#include <sipprofileregistry.h>
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    25
#include <flogger.h>
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    26
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    27
#include "chatsessionimpl_sym.h"
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    28
#include "msrpchatsessiondata_sym.h"
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    29
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    30
using namespace RcsIMLib;
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    31
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    32
//_LIT( KLogDir1, "rcs" );
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    33
//_LIT( KLogFile1, "rcs.txt" );
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    34
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    35
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    36
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    37
ChatSessionImpl::ChatSessionImpl(ChatSession *apParent):mParent(apParent)
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    38
{
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    39
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    40
}
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    41
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    42
bool ChatSessionImpl::sendChatData(QString newChatData)
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    43
{
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    44
	TPtrC16 dataPtr(reinterpret_cast<const TUint16*>(newChatData.utf16()));
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    45
	RBuf8 chatData;
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    46
	chatData.Create(300);
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    47
	chatData.Copy(dataPtr);
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    48
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    49
	mMessageSource->SendDataL(chatData);
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    50
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    51
	chatData.Close();
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    52
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    53
	return true;
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    54
}
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    55
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    56
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    57
bool ChatSessionImpl::endChatSession()
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    58
{
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    59
	return true;
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    60
}
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    61
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    62
void ChatSessionImpl::setPlatformParams(void *apPlatFormParam)
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    63
{
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    64
	mMsrpChatSessionData = static_cast<TMsrpChatSession*>(apPlatFormParam);
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    65
    if (mMsrpChatSessionData->iStream1->Source()->Type() == KMceMessageSource)
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    66
    {
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    67
    	mMessageSource = (CMceMessageSource*) mMsrpChatSessionData->iStream1->Source();
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    68
    }
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    69
    else if (mMsrpChatSessionData->iStream2->Source()->Type() == KMceMessageSource)
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    70
    {
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    71
        mMessageSource = (CMceMessageSource*) mMsrpChatSessionData->iStream2->Source();
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    72
    }
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    73
}
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    74
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    75
//Get the Platform implementations
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    76
void* ChatSessionImpl::getPlatformImpl()
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    77
{
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    78
	return this;
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    79
}
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    80
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    81
void ChatSessionImpl::incomingData(const TDesC8& aData)
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    82
{
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    83
    QString chatData = QString::fromUtf8((const char*)aData.Ptr(),aData.Length());
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    84
    emit mParent->newChatData(chatData);
59dfe4ae66d0 RCS IM Library - Initial implementation
shivsood
parents:
diff changeset
    85
}