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