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