Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __SUGARACCOUNTHANDLER__
00021 #define __SUGARACCOUNTHANDLER__
00022
00023 #include <set>
00024
00025 #include <account/xp/AccountHandler.h>
00026 #include <dbus/dbus.h>
00027 #include <dbus/dbus-glib.h>
00028 #include <dbus/dbus-glib-lowlevel.h>
00029 #include "SugarBuddy.h"
00030
00031 #define SUGAR_STATIC_STORAGE_TYPE "com.abisource.abiword.abicollab.backend.sugar"
00032
00033 extern AccountHandlerConstructor SugarAccountHandlerConstructor;
00034
00035 class Session;
00036 class FV_View;
00037
00038 class SugarAccountHandler : public AccountHandler
00039 {
00040 public:
00041 static SugarAccountHandler* getHandler();
00042 SugarAccountHandler();
00043 virtual ~SugarAccountHandler();
00044
00045
00046 static UT_UTF8String getStaticStorageType();
00047 virtual UT_UTF8String getStorageType()
00048 { return getStaticStorageType(); }
00049 virtual UT_UTF8String getDescription();
00050 virtual UT_UTF8String getDisplayType();
00051
00052
00053 virtual void embedDialogWidgets(void* )
00054 { UT_ASSERT_HARMLESS(UT_NOT_REACHED); }
00055 virtual void removeDialogWidgets(void* )
00056 { UT_ASSERT_HARMLESS(UT_NOT_REACHED); }
00057 virtual bool canDelete()
00058 { return false; }
00059 virtual bool canEditProperties()
00060 { return false; }
00061 virtual void loadProperties();
00062 virtual void storeProperties();
00063
00064
00065 virtual ConnectResult connect();
00066 virtual bool disconnect();
00067 virtual bool isOnline();
00068
00069
00070 virtual BuddyPtr constructBuddy(const PropertyMap& props);
00071 virtual BuddyPtr constructBuddy(const std::string& descriptor, BuddyPtr pBuddy);
00072 virtual bool allowsManualBuddies()
00073 { return false; }
00074 virtual void forceDisconnectBuddy(BuddyPtr pBuddy);
00075 virtual bool hasAccess(const std::vector<std::string>& vAcl, BuddyPtr pBuddy);
00076 virtual bool hasPersistentAccessControl()
00077 { return false; }
00078 virtual bool recognizeBuddyIdentifier(const std::string& identifier);
00079
00080
00081 virtual bool allowsSessionTakeover()
00082 { return true; }
00083 virtual bool canManuallyStartSession()
00084 { return false; }
00085
00086
00087 virtual bool send(const Packet* pPacket);
00088 virtual bool send(const Packet* pPacket, BuddyPtr buddy);
00089 Packet* createPacket(const std::string& packet, BuddyPtr pBuddy);
00090
00091
00092 void handleEvent(Session& pSession);
00093
00094
00095 virtual void signal(const Event& event, BuddyPtr pSource);
00096
00097
00098 SugarBuddyPtr getBuddy(const UT_UTF8String& dbusAddress);
00099 bool offerTube(FV_View* pView, const UT_UTF8String& tubeDBusAddress);
00100 bool joinTube(FV_View* pView, const UT_UTF8String& tubeDBusAddress);
00101 bool disconnectTube(FV_View* pView);
00102 bool joinBuddy(FV_View* pView, const UT_UTF8String& buddyDBusAddress);
00103 bool disjoinBuddy(FV_View* pView, const UT_UTF8String& buddyDBusAddress);
00104
00105 bool isIgnoredBuddy(const UT_UTF8String& buddyName)
00106 { return m_ignoredBuddies.find(buddyName) != m_ignoredBuddies.end(); }
00107
00108 protected:
00109 bool _send(const Packet* pPacket, const char* dbusAddress);
00110 void _registerEditMethods();
00111 virtual void _handlePacket(Packet* packet, BuddyPtr buddy);
00112
00113 private:
00114 static SugarAccountHandler* m_pHandler;
00115 DBusConnection* m_pTube;
00116 bool m_bIsInSession;
00117 std::set<UT_UTF8String> m_ignoredBuddies;
00118 std::string m_sSessionId;
00119 };
00120
00121 #endif