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>
42 #include "tpsessionaccount.h"
43 #include "tpsessionobserver.h"
45 class TpSession:public QObject
49 TpSession(QString cmname=QString(),bool synchronous=FALSE);
52 static TpSession* instance(bool synchronous=TRUE);
53 void sendMessageToAddress(QString connectionMgr,QString address,QString message);
54 TpSessionAccount* getAccount(const QString cm, const QString protocol=QString());
55 void createChannelListener(const QString &channelType,
56 const Tp::MethodInvocationContextPtr<> &context,
57 const Tp::AccountPtr &account,
58 const Tp::ChannelPtr &channel);
59 void createObserver();
62 void amReady(TpSession *);
63 void accountReady(TpSessionAccount *);
64 void channeReady(TpSessionAccount *);
65 void messageReceived(const Tp::ReceivedMessage &,TpSessionAccount *);
67 void onAMReady(Tp::PendingOperation *);
68 void onAccountCreated(const QString &);
69 void onReady(Tp::PendingOperation *);
70 void onAccountReady(TpSessionAccount *tpacc);
71 void onMessageReceived(const Tp::ReceivedMessage &,TpSessionAccount *);
73 QVector<TpSessionAccount*> accounts;
76 static TpSession *instancePtr;
77 //TpSession *instancePtr;
82 bool sync; // Synchronous initialization
84 Tp::AccountManagerPtr mAM;
86 Tp::ClientRegistrarPtr registrar;