|
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 |
|
19 /* A set of interfaces to be implemented by providers for chat application. |
|
20 */ |
|
21 |
|
22 #ifndef __CHATINTERFACES_H__ |
|
23 #define __CHATINTERFACES_H__ |
|
24 |
|
25 #include <QObject> |
|
26 #include <QString> |
|
27 #include <QList> |
|
28 #include <qcontactid.h> |
|
29 |
|
30 |
|
31 QTM_BEGIN_NAMESPACE |
|
32 class QContact; |
|
33 QTM_END_NAMESPACE |
|
34 |
|
35 QTM_USE_NAMESPACE |
|
36 |
|
37 namespace RcsIMLib |
|
38 { |
|
39 |
|
40 typedef unsigned int RcsChatId; |
|
41 |
|
42 /* |
|
43 * Manages creation of a new session, notification for incoming |
|
44 * session, closing the session. Also manages sending of |
|
45 * IM Message, and notification of incoming message, |
|
46 * and error notification. |
|
47 */ |
|
48 class MChatSessionIntf; |
|
49 |
|
50 /* Manages fetching and Managing of contacts for |
|
51 * chat. The APIs allow for fetching of the list |
|
52 * of contacts and also their presence information. |
|
53 * Also the status message can be filled up if supported. |
|
54 */ |
|
55 class MChatContactManagerIntf: public QObject |
|
56 { |
|
57 Q_OBJECT |
|
58 public: |
|
59 /* Also APIs need to be there for setting status message, |
|
60 * and presence info etc */ |
|
61 |
|
62 virtual RcsChatId createChatSession(QContactLocalId contactId, QString initMsg)=0; |
|
63 virtual void closeSession(RcsChatId sessID)=0; |
|
64 virtual void acceptIncomingSession(RcsChatId sessID)=0; |
|
65 |
|
66 signals: |
|
67 void incomingChatSession(QContactLocalId aMyBuddyID, QString incomingSipUri, QString initMsg, RcsIMLib::RcsChatId sessID); |
|
68 void sessionEstablised(RcsIMLib::RcsChatId sessID, RcsIMLib::MChatSessionIntf* chatSession); |
|
69 void sessionTerminated(RcsIMLib::RcsChatId sessID, RcsIMLib::MChatSessionIntf* chatSession); |
|
70 |
|
71 }; |
|
72 |
|
73 /* The interface used to initiate a chat session with a |
|
74 * particular contact. |
|
75 * The ChatSessionManager is symbolised by an instance of MChatInterface |
|
76 */ |
|
77 class MChatSessionIntf: public QObject |
|
78 { |
|
79 Q_OBJECT |
|
80 public: |
|
81 |
|
82 /* Creates a chat session with the specified contact. |
|
83 * If the session creation was successful the MChatSessionManagerIntf |
|
84 * returned will be a valid pointer. |
|
85 */ |
|
86 virtual bool sendChatData(QString newChatData)=0; |
|
87 virtual bool endChatSession()=0; |
|
88 |
|
89 //Dirty APIs :( |
|
90 //Use this API to set any Platform Parameters |
|
91 virtual void setPlatformParams(void *apPlatFormParam)=0; |
|
92 //Get the Platform implementations |
|
93 virtual void* getPlatformImpl()=0; |
|
94 |
|
95 signals: |
|
96 void newChatData(QString newChatData); |
|
97 /* Notifies of error and the appropriate error |
|
98 * string */ |
|
99 void errorMessage(QString errorString); |
|
100 /* Additional info such as, |
|
101 * User is typing a message etc, |
|
102 * The same will be reset by giving an empty string |
|
103 * when appropriate.*/ |
|
104 void additionalInfo(QString additionalInfo); |
|
105 |
|
106 |
|
107 }; |
|
108 |
|
109 } //namespace |
|
110 |
|
111 #endif //__CHATINTERFACES_H__ |
|
112 |