2 * This file is part of TpSession
4 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
5 * Contact Kate Alhola kate.alholanokia.com
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #include <TelepathyQt4/Types>
25 #include <TelepathyQt4/Account>
26 #include <TelepathyQt4/Types>
27 #include <TelepathyQt4/PendingChannelRequest>
28 #include <TelepathyQt4/ChannelRequest>
29 #include <TelepathyQt4/PendingChannel>
30 #include <TelepathyQt4/Channel>
31 #include <TelepathyQt4/TextChannel>
32 #include <TelepathyQt4/AccountManager>
33 #include <TelepathyQt4/PendingOperation>
34 #include <TelepathyQt4/PendingReady>
35 #include <TelepathyQt4/ClientRegistrar>
36 #include <TelepathyQt4/Debug>
37 #include <QProcessEnvironment>
43 #include "tpsessionaccount.h"
44 #include "tpsessionobserver.h"
47 class TpSession:public QObject
51 TpSession(QString cmname=QString(),bool synchronous=FALSE);
54 static TpSession* instance(bool synchronous=TRUE);
55 static bool tpsDebug();
56 void sendMessageToAddress(QString connectionMgr,QString address,QString message);
57 TpSessionAccount* getAccount(const QString cm, const QString protocol=QString());
58 void createChannelListener(const QString &channelType,
59 const Tp::MethodInvocationContextPtr<> &context,
60 const Tp::AccountPtr &account,
61 const Tp::ChannelPtr &channel);
62 void createObserver();
65 void amReady(TpSession *);
66 void accountReady(TpSessionAccount *);
67 void channeReady(TpSessionAccount *);
68 void messageReceived(const Tp::ReceivedMessage &,TpSessionAccount *);
70 void onAMReady(Tp::PendingOperation *);
71 void onAccountCreated(const QString &);
72 void onReady(Tp::PendingOperation *);
73 void onAccountReady(TpSessionAccount *tpacc);
74 void onMessageReceived(const Tp::ReceivedMessage &,TpSessionAccount *);
76 QVector<TpSessionAccount*> accounts;
79 static TpSession *instancePtr;
81 //TpSession *instancePtr;
86 bool sync; // Synchronous initialization
88 Tp::AccountManagerPtr mAM;
90 Tp::ClientRegistrarPtr registrar;