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