diff options
author | Matúš Kukan <matus.kukan@gmail.com> | 2012-07-23 16:20:48 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2012-07-23 21:43:51 +0200 |
commit | 955bbbb54c153dc50daca1f35d738acfe1d823a5 (patch) | |
tree | 712c7b4abe1052990c2076e0c6b42c4c24f06fa8 /tubes | |
parent | a83d916085350cd44dc2d0f575f3a6833404abb0 (diff) |
tubes: get local callbacks out of class
Change-Id: I7e43d9990827c4c7d86d947e7d71a94b686642fc
Diffstat (limited to 'tubes')
-rw-r--r-- | tubes/inc/tubes/conference.hxx | 15 | ||||
-rw-r--r-- | tubes/inc/tubes/manager.hxx | 13 | ||||
-rw-r--r-- | tubes/source/conference.cxx | 36 | ||||
-rw-r--r-- | tubes/source/manager.cxx | 10 |
4 files changed, 26 insertions, 48 deletions
diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx index ab6db925b0fd..89544578eeed 100644 --- a/tubes/inc/tubes/conference.hxx +++ b/tubes/inc/tubes/conference.hxx @@ -71,6 +71,7 @@ public: typedef void (*FileSentCallback)( bool aSuccess, void* pUserData); TUBES_DLLPUBLIC void sendFile( rtl::OUString &localUri, FileSentCallback pCallback, void* pUserData); TUBES_DLLPUBLIC const OString& getUuid() const { return msUuid; } + void setUuid( const OString& rUuid ) { msUuid = rUuid; } // --- following only to be called only by manager's callbacks --- // TODO: make friends instead @@ -79,6 +80,7 @@ public: TpDBusTubeChannel* getChannel() const { return mpChannel; } bool offerTube(); bool acceptTube(); + bool setTube( GDBusConnection* pTube ); /// got tube accepted on other end as well? bool isTubeOpen() const { return mpTube != NULL; } @@ -86,22 +88,9 @@ public: void setTubeOfferedHandlerInvoked( bool b ) { mbTubeOfferedHandlerInvoked = b; } bool isTubeOfferedHandlerInvoked() const { return mbTubeOfferedHandlerInvoked; } - static void TubeOfferedHandler(GObject* pSource, GAsyncResult* pResult, gpointer pUserData); - static void TubeAcceptedHandler(GObject* pSource, GAsyncResult* pResult, gpointer pUserData); - - static void methodCallHandler(GDBusConnection* pConnection, - const gchar* pSender, - const gchar* pObjectPath, - const gchar* pInterfaceName, - const gchar* pMethodName, - GVariant* pParameters, - GDBusMethodInvocation* pInvocation, - void* pUserData); - private: typedef ::std::queue<OString> TelePacketQueue; bool spinUntilTubeEstablished(); - bool setTube( GDBusConnection* pTube); TeleManager* mpManager; TpAccount* mpAccount; diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx index c8e7b4ae356e..8e39e65d1289 100644 --- a/tubes/inc/tubes/manager.hxx +++ b/tubes/inc/tubes/manager.hxx @@ -147,6 +147,7 @@ public: // Only for callbacks. + void addConference( TeleConference* pConference ); void setChannelReadyHandlerInvoked( bool b ) { mbChannelReadyHandlerInvoked = b; } bool isChannelReadyHandlerInvoked() const { return mbChannelReadyHandlerInvoked; } void setAccountManagerReadyHandlerInvoked( bool b ); @@ -192,19 +193,7 @@ public: TpAccount* getAccount( const rtl::OString& rAccountID ); -/* Callbacks; not for use outside this class. */ - static void DBusChannelHandler( - TpSimpleHandler* /*handler*/, - TpAccount* pAccount, - TpConnection* /*connection*/, - GList* pChannels, - GList* /*requests_satisfied*/, - gint64 /*user_action_time*/, - TpHandleChannelsContext* pContext, - gpointer pUserData); - private: - void addConference( TeleConference* ); void ensureLegacyChannel( TpAccount* pAccount, TpContact* pBuddy ); bool mbChannelReadyHandlerInvoked : 1; diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx index 5cf197251601..7dc531dca804 100644 --- a/tubes/source/conference.cxx +++ b/tubes/source/conference.cxx @@ -58,7 +58,7 @@ struct InfoLogger #define INFO_LOGGER(s) #endif // SAL_LOG_INFO -void TeleConference::methodCallHandler( +static void TeleConference_MethodCallHandler( GDBusConnection* /*pConnection*/, const gchar* pSender, const gchar* /*pObjectPath*/, @@ -68,15 +68,15 @@ void TeleConference::methodCallHandler( GDBusMethodInvocation* pInvocation, void* pUserData) { - INFO_LOGGER_F( "TeleConference::methodCallHandler"); + INFO_LOGGER_F( "TeleConference_MethodCallHandler"); TeleConference* pConference = reinterpret_cast<TeleConference*>(pUserData); - SAL_WARN_IF( !pConference, "tubes", "TeleConference::methodCallHandler: no conference"); + SAL_WARN_IF( !pConference, "tubes", "TeleConference_MethodCallHandler: no conference"); if (!pConference) return; TeleManager* pManager = pConference->getManager(); - SAL_WARN_IF( !pManager, "tubes", "TeleConference::methodCallHandler: no manager"); + SAL_WARN_IF( !pManager, "tubes", "TeleConference_MethodCallHandler: no manager"); if (!pManager) return; @@ -104,11 +104,11 @@ void TeleConference::methodCallHandler( const char* pPacketData = reinterpret_cast<const char*>( g_variant_get_data( ay)); gsize nPacketSize = g_variant_get_size( ay); - SAL_WARN_IF( !pPacketData, "tubes", "TeleConference::methodCallHandler: couldn't get packet data"); + SAL_WARN_IF( !pPacketData, "tubes", "TeleConference_MethodCallHandler: couldn't get packet data"); if (!pPacketData) return; - SAL_INFO( "tubes", "TeleConference::methodCallHandler: received packet from sender " + SAL_INFO( "tubes", "TeleConference_MethodCallHandler: received packet from sender " << (pSender ? pSender : "(null)") << " with size " << nPacketSize); pConference->queue( pPacketData, nPacketSize ); g_dbus_method_invocation_return_value( pInvocation, 0 ); @@ -142,15 +142,15 @@ static void TeleConference_ChannelCloseHandler( } -void TeleConference::TubeOfferedHandler( +static void TeleConference_TubeOfferedHandler( GObject* pSource, GAsyncResult* pResult, gpointer pUserData) { - INFO_LOGGER_F( "TeleConference::TubeOfferedHandler"); + INFO_LOGGER_F( "TeleConference_TubeOfferedHandler"); TeleConference* pConference = reinterpret_cast<TeleConference*>(pUserData); - SAL_WARN_IF( !pConference, "tubes", "TeleConference::TubeOfferedHandler: no conference"); + SAL_WARN_IF( !pConference, "tubes", "TeleConference_TubeOfferedHandler: no conference"); if (!pConference) return; @@ -163,7 +163,7 @@ void TeleConference::TubeOfferedHandler( // "can't find contact ... presence" means contact is not a contact. /* FIXME: detect and handle */ - SAL_WARN_IF( !pTube, "tubes", "TeleConference::TubeOfferedHandler: entered with error: " << pError->message); + SAL_WARN_IF( !pTube, "tubes", "TeleConference_TubeOfferedHandler: entered with error: " << pError->message); if (pError) { g_error_free( pError); return; @@ -173,15 +173,15 @@ void TeleConference::TubeOfferedHandler( } -void TeleConference::TubeAcceptedHandler( +static void TeleConference_TubeAcceptedHandler( GObject* pSource, GAsyncResult* pResult, gpointer pUserData) { - INFO_LOGGER_F( "TeleConference::TubeAcceptedHandler"); + INFO_LOGGER_F( "TeleConference_TubeAcceptedHandler"); TeleConference* pConference = reinterpret_cast<TeleConference*>(pUserData); - SAL_WARN_IF( !pConference, "tubes", "TeleConference::TubeAcceptedHandler: no conference"); + SAL_WARN_IF( !pConference, "tubes", "TeleConference_TubeAcceptedHandler: no conference"); if (!pConference) return; @@ -192,14 +192,14 @@ void TeleConference::TubeAcceptedHandler( GDBusConnection* pTube = tp_dbus_tube_channel_accept_finish( pChannel, pResult, &pError); - SAL_WARN_IF( !pTube, "tubes", "TeleConference::TubeAcceptedHandler: entered with error: " << pError->message); + SAL_WARN_IF( !pTube, "tubes", "TeleConference_TubeAcceptedHandler: entered with error: " << pError->message); if (pError) { g_error_free( pError); return; } GHashTable* pParameters = tp_dbus_tube_channel_get_parameters( pChannel); const char* sUuid = tp_asv_get_string( pParameters, LIBO_TUBES_UUID); - pConference->msUuid = OString( sUuid); + pConference->setUuid( OString( sUuid)); pConference->setTube( pTube); } @@ -263,7 +263,7 @@ bool TeleConference::acceptTube() return false; tp_dbus_tube_channel_accept_async( mpChannel, - &TeleConference::TubeAcceptedHandler, + TeleConference_TubeAcceptedHandler, this); return spinUntilTubeEstablished(); } @@ -284,7 +284,7 @@ bool TeleConference::offerTube() tp_dbus_tube_channel_offer_async( mpChannel, pParameters, - &TeleConference::TubeOfferedHandler, + TeleConference_TubeOfferedHandler, this); return spinUntilTubeEstablished(); @@ -303,7 +303,7 @@ bool TeleConference::setTube( GDBusConnection* pTube) guint registration_id; static const GDBusInterfaceVTable interface_vtable = { - &TeleConference::methodCallHandler, + TeleConference_MethodCallHandler, NULL, NULL, { NULL }, diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index 49cda03868b4..86d2f5d19fbd 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -104,7 +104,7 @@ public: }; -void TeleManager::DBusChannelHandler( +void TeleManager_DBusChannelHandler( TpSimpleHandler* /*handler*/, TpAccount* pAccount, TpConnection* /*connection*/, @@ -115,10 +115,10 @@ void TeleManager::DBusChannelHandler( gpointer pUserData) { bool aAccepted = false; - INFO_LOGGER_F( "TeleManager::DBusChannelHandler"); + INFO_LOGGER_F( "TeleManager_DBusChannelHandler"); TeleManager* pManager = reinterpret_cast<TeleManager*>(pUserData); - SAL_WARN_IF( !pManager, "tubes", "TeleManager::DBusChannelHandler: no manager"); + SAL_WARN_IF( !pManager, "tubes", "TeleManager_DBusChannelHandler: no manager"); if (!pManager) return; @@ -128,7 +128,7 @@ void TeleManager::DBusChannelHandler( if (!pChannel) continue; - SAL_INFO( "tubes", "TeleManager::DBusChannelHandler: incoming dbus channel: " + SAL_INFO( "tubes", "TeleManager_DBusChannelHandler: incoming dbus channel: " << tp_channel_get_identifier( pChannel)); if (TP_IS_DBUS_TUBE_CHANNEL( pChannel)) @@ -491,7 +491,7 @@ bool TeleManager::registerClients() FALSE, // requests getFullClientName().getStr(), // name FALSE, // uniquify - &TeleManager::DBusChannelHandler, // callback + TeleManager_DBusChannelHandler, // callback this, // user_data NULL // destroy ); |