diff options
author | Matúš Kukan <matus.kukan@gmail.com> | 2012-08-09 23:37:32 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2012-08-14 19:39:46 +0200 |
commit | 7f6b2321a5adbf63fdd50989e58418db93e90454 (patch) | |
tree | 46f33f6ebd468e183f2c554ef6db665de618d638 /tubes/source/manager.cxx | |
parent | 0357b778956a453a700d7b7002a7850071bde70d (diff) |
tubes: use channel's signal closed to know when end the collaboration
Change-Id: I11e0aa2db3b41a166e23c85fd040f883e0d3be08
Diffstat (limited to 'tubes/source/manager.cxx')
-rw-r--r-- | tubes/source/manager.cxx | 60 |
1 files changed, 7 insertions, 53 deletions
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index 340c0023579f..d900cb61d724 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -106,41 +106,6 @@ public: TeleManagerImpl* TeleManager::pImpl = new TeleManagerImpl(); -bool tb_account_is_online( TpAccount* pAccount ); -bool tb_contact_is_online( TpContact* pContact ); - -static void account_presence_changed_cb( TpAccount* pAccount, - guint /* type */, - gchar* /* status */, - gchar* /* message */, - gpointer pUserData ) -{ - if (!tb_account_is_online( pAccount )) - { - TeleConference* pConference = reinterpret_cast<TeleConference*> (pUserData); - pConference->close(); - Collaboration* pCollaboration = pConference->getCollaboration(); - if (pCollaboration) - pCollaboration->ContactLeft(); - } -} - -static void contact_presence_changed_cb( TpContact* pContact, - guint /* type */, - gchar* /* status */, - gchar* /* message */, - gpointer pUserData ) -{ - if (!tb_contact_is_online( pContact )) - { - TeleConference* pConference = reinterpret_cast<TeleConference*> (pUserData); - pConference->close(); - Collaboration* pCollaboration = pConference->getCollaboration(); - if (pCollaboration) - pCollaboration->ContactLeft(); - } -} - static void TeleManager_DBusChannelHandler( TpSimpleHandler* /*handler*/, TpAccount* pAccount, @@ -171,14 +136,6 @@ static void TeleManager_DBusChannelHandler( TeleConference* pConference = new TeleConference( pAccount, TP_DBUS_TUBE_CHANNEL( pChannel ) ); pConference->acceptTube(); TeleManager::addConference( pConference ); - - g_signal_connect( pAccount, "presence-changed", - G_CALLBACK (account_presence_changed_cb), pConference ); - - TpContact* pContact = tp_channel_get_target_contact( pChannel ); - if (pContact) - g_signal_connect( pContact, "presence-changed", - G_CALLBACK (contact_presence_changed_cb), pConference ); } else { @@ -236,6 +193,13 @@ void TeleManager::unregisterCollaboration( Collaboration* pCollaboration ) pImpl->maCollaborations.erase( pCollaboration ); } +bool TeleManager::existsCollaboration( Collaboration* pCollaboration ) +{ + MutexGuard aGuard( GetMutex()); + + return pImpl->maCollaborations.find( pCollaboration ) != pImpl->maCollaborations.end(); +} + void TeleManager::displayAllContacts() { MutexGuard aGuard( GetMutex()); @@ -447,7 +411,6 @@ static void TeleManager_ChannelReadyHandler( g_error_free( pError); return; } - pConference->setChannel( tp_account_channel_request_get_account( pChannelRequest), TP_DBUS_TUBE_CHANNEL (pChannel)); pConference->offerTube(); @@ -690,9 +653,6 @@ TeleConference* TeleManager::startGroupSession( TpAccount *pAccount, if (!pConference->isReady()) return NULL; - g_signal_connect( pAccount, "presence-changed", - G_CALLBACK (account_presence_changed_cb), pConference ); - return pConference; } @@ -768,12 +728,6 @@ TeleConference* TeleManager::startBuddySession( TpAccount *pAccount, TpContact * if (!pConference->isReady()) return NULL; - g_signal_connect( pAccount, "presence-changed", - G_CALLBACK (account_presence_changed_cb), pConference ); - - g_signal_connect( pBuddy, "presence-changed", - G_CALLBACK (contact_presence_changed_cb), pConference ); - return pConference; } |