Home · All Classes · All Namespaces · Modules · Functions · Files

tpsessionaccount.h

00001 /*
00002  * This file is part of TpSession
00003  *
00004  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
00005  * Contact Kate Alhola  kate.alholanokia.com
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020  */
00021 #ifndef TPSESSIONACCOUNT_H
00022 #define TPSESSIONACCOUNT_H
00023 
00024 #include <TelepathyQt4/Types>
00025 #include <TelepathyQt4/Account>
00026 #include <TelepathyQt4/Types>
00027 #include <TelepathyQt4/PendingChannelRequest>
00028 #include <TelepathyQt4/ChannelRequest>
00029 #include <TelepathyQt4/PendingChannel>
00030 #include <TelepathyQt4/PendingContacts>
00031 #include <TelepathyQt4/Channel>
00032 #include <TelepathyQt4/TextChannel>
00033 #include <TelepathyQt4/AccountManager>
00034 #include <TelepathyQt4/PendingReady>
00035 #include <TelepathyQt4/ContactManager>
00036 
00037 #include <QString>
00038 #include <QVector>
00039 
00040 #include "tpsessionchannel.h"
00041 
00042 class TpSessionAccount:public QObject
00043 {
00044 
00045     Q_OBJECT
00046 public:
00047   TpSessionAccount(Tp::AccountManagerPtr am,const QString &objectPath);
00048   void makeContactFromAddress(QString address);
00049   void sendMessageToAddress(QString address,QString message);
00050   Tp::ContactPtr getContactFromAddress(QString address);
00051   void addOutgoingChannel(const Tp::ContactPtr &contact);
00052   void addOutgoingChannel(QString address);
00053   TpSessionChannel *getChannelFromPeerAddress(QString id);
00054 signals:
00055   void accountReady(TpSessionAccount *);
00056   void channelReady(TpSessionAccount *);
00057   void messageReceived(const Tp::ReceivedMessage &,TpSessionAccount *);
00058   void messageSent(const Tp::Message &,TpSessionAccount *);
00059   void newChannel(TpSessionAccount *,QString,QString,const Tp::ChannelDetails &);
00060 
00061 private slots:
00062   void onReady(Tp::PendingOperation *op);
00063   void onOutgoingChannelReady(TpSessionChannel *ch);
00064   void onContactsConnectionReady(Tp::PendingOperation *op);
00065   void onNewContactRetrieved(Tp::PendingOperation *op);
00066   void onMessageReceived(const Tp::ReceivedMessage &,TpSessionChannel *);
00067   void onMessageSent(const Tp::Message &,Tp::MessageSendingFlags, const QString &);
00068   void onNewChannels(const Tp::ChannelDetailsList&);
00069 public:
00070   bool ready;
00071   QString reqContact;
00072   QString reqMessage;
00073   Tp::AccountPtr mAcc;
00074   Tp::Account *acc;
00075   Tp::ConnectionPtr contactsConn;
00076   QSet<Tp::ContactPtr> myContacts;
00077   QSet<TpSessionChannel *> myChannels;
00078 };
00079 
00080 #endif // TPSESSIONACCOUNT_H


Copyright © 2010 Nokia Corporation
TpSession