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