X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=tpsession-0.1%2Ftpsession%2Ftpsession.h;fp=tpsession-0.1%2Ftpsession%2Ftpsession.h;h=281310ab66000866fccc97e9ab7e1d42596e7079;hb=9a48f77860a2bb996f3ca318fe3c19096110f28a;hp=0000000000000000000000000000000000000000;hpb=f116f1ac60b47e9186e4eef5f68597980518a2eb;p=tpsession diff --git a/tpsession-0.1/tpsession/tpsession.h b/tpsession-0.1/tpsession/tpsession.h new file mode 100644 index 0000000..281310a --- /dev/null +++ b/tpsession-0.1/tpsession/tpsession.h @@ -0,0 +1,91 @@ +/* + * This file is part of TpSession + * + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * Contact Kate Alhola kate.alholanokia.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef TPSESSION_H +#define TPSESSION_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "tpsessionaccount.h" +#include "tpsessionobserver.h" + +class TpSession:public QObject +{ + Q_OBJECT +public: + TpSession(QString cmname=QString(),bool synchronous=FALSE); + + + static TpSession* instance(bool synchronous=TRUE); + void sendMessageToAddress(QString connectionMgr,QString address,QString message); + TpSessionAccount* getAccount(const QString cm, const QString protocol=QString()); + void createChannelListener(const QString &channelType, + const Tp::MethodInvocationContextPtr<> &context, + const Tp::AccountPtr &account, + const Tp::ChannelPtr &channel); + void createObserver(); + +signals: + void amReady(TpSession *); + void accountReady(TpSessionAccount *); + void channeReady(TpSessionAccount *); + void messageReceived(const Tp::ReceivedMessage &,TpSessionAccount *); +private slots: + void onAMReady(Tp::PendingOperation *); + void onAccountCreated(const QString &); + void onReady(Tp::PendingOperation *); + void onAccountReady(TpSessionAccount *tpacc); + void onMessageReceived(const Tp::ReceivedMessage &,TpSessionAccount *); +public: + QVector accounts; + +private: + static TpSession *instancePtr; + //TpSession *instancePtr; + QString reqCm; + QString reqAddress; + QString reqMsg; + + bool sync; // Synchronous initialization + QEventLoop loop; + Tp::AccountManagerPtr mAM; + QStringList channels; + Tp::ClientRegistrarPtr registrar; +}; + + + +#endif // TPSESSION_H