• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

TelepathyUnixAccountHandler.h

Go to the documentation of this file.
00001 /* Copyright (C) 2007 One Laptop Per Child
00002  * Author: Marc Maurer <uwog@uwog.net>
00003  * Copyright (C) 2010 AbiSource Corporation B.V.
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00018  * 02110-1301 USA.
00019  */
00020 
00021 #ifndef __TELEPATHY_ACCOUNT_HANDLER__
00022 #define __TELEPATHY_ACCOUNT_HANDLER__
00023 
00024 #include <vector>
00025 
00026 #include <dbus/dbus.h>
00027 #include <dbus/dbus-glib.h>
00028 #include <dbus/dbus-glib-lowlevel.h>
00029 
00030 #include <telepathy-glib/telepathy-glib.h>
00031 
00032 #include <account/xp/AccountHandler.h>
00033 #include "DTubeBuddy.h"
00034 #include "TelepathyBuddy.h"
00035 
00036 #define DEFAULT_CONFERENCE_SERVER "conference.telepathy.im"
00037 #define INTERFACE "org.freedesktop.Telepathy.Client.AbiCollab"
00038 #define SEND_ONE_METHOD "SendOne"
00039 
00040 extern AccountHandlerConstructor TelepathyAccountHandlerConstructor;
00041 
00042 class Session;
00043 class FV_View;
00044 
00045 class TelepathyAccountHandler : public AccountHandler
00046 {
00047 public:
00048     static TelepathyAccountHandler*             getHandler();
00049     TelepathyAccountHandler(); // TODO: this constructor shouldn't be public
00050     virtual ~TelepathyAccountHandler();
00051 
00052     // housekeeping
00053     virtual UT_UTF8String                   getDescription();
00054     virtual UT_UTF8String                   getDisplayType();
00055     virtual UT_UTF8String                   getStorageType();
00056 
00057     // dialog management
00058     virtual void                            embedDialogWidgets(void* pEmbeddingParent);
00059     virtual void                            removeDialogWidgets(void* pEmbeddingParent);
00060     virtual bool                            canDelete()
00061         { return false; }
00062     virtual void                            loadProperties();
00063     virtual void                            storeProperties();
00064 
00065     // connection management
00066     virtual ConnectResult                   connect();
00067     virtual bool                            disconnect();
00068     virtual bool                            isOnline();
00069     void                                    acceptTube(TpChannel *tubes_chan, const char* address);
00070     void                                    finalizeOfferTube(TelepathyChatroomPtr pChatroom);
00071 
00072     // user management
00073     virtual void                            getBuddiesAsync();
00074     virtual BuddyPtr                        constructBuddy(const PropertyMap& props);
00075     virtual BuddyPtr                        constructBuddy(const std::string& descriptor, BuddyPtr pBuddy);
00076     virtual bool                            recognizeBuddyIdentifier(const std::string& identifier);
00077     virtual bool                            allowsManualBuddies()
00078         { return false; }
00079     virtual void                            forceDisconnectBuddy(BuddyPtr pBuddy);
00080     virtual bool                            hasAccess(const std::vector<std::string>& /*vAcl*/, BuddyPtr pBuddy);
00081     virtual bool                            hasPersistentAccessControl()
00082         { return true; }
00083     void                                    addContact(TpContact* contact);
00084     void                                    buddyDisconnected(TelepathyChatroomPtr pChatroom, TpHandle disconnected);
00085 
00086     // session management
00087     virtual bool                            startSession(PD_Document* pDoc, const std::vector<std::string>& acl, AbiCollab** pSession);
00088     virtual bool                            setAcl(AbiCollab* /*pSession*/, const std::vector<std::string>& /*vAcl*/);
00089     virtual bool                            allowsSessionTakeover()
00090         { return false; /* not right now */ }
00091     void                                    unregisterChatroom(TelepathyChatroomPtr pChatroom);
00092 
00093     // signal management
00094     virtual void                            signal(const Event& event, BuddyPtr pSource);
00095 
00096     // packet management
00097     virtual bool                            send(const Packet* pPacket);
00098     virtual bool                            send(const Packet* pPacket, BuddyPtr buddy);
00099     void                                    handleMessage(DTubeBuddyPtr pBuddy, const std::string& packet_str);
00100 
00101 private:
00102     void                                    _inviteBuddies(TelepathyChatroomPtr pChatroom, const std::vector<std::string>& /*vAcl*/);
00103     std::vector<TelepathyBuddyPtr>          _getBuddies(const std::vector<std::string>& vAcl);
00104     TelepathyBuddyPtr                       _getBuddy(TelepathyBuddyPtr pBuddy);
00105     TelepathyChatroomPtr                    _getChatroom(const std::string& sSessionId);
00106 
00107     GtkWidget*                              table;
00108     GtkWidget*                              conference_entry;
00109     GtkWidget*                              autoconnect_button;
00110 
00111     TpBaseClient*                           m_pTpClient;
00112     std::vector<TelepathyChatroomPtr>       m_chatrooms;
00113 };
00114 
00115 #endif /* __TELEPATHY_ACCOUNT_HANDLER__ */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1