diff options
author | Matúš Kukan <matus.kukan@gmail.com> | 2012-08-04 01:52:29 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2012-08-04 01:57:17 +0200 |
commit | 769e2b59e605c2c882d2039ad89e0958ea7bb2f2 (patch) | |
tree | 0f03a29e170e77e744c1ded69bf12ee9f3154952 /tubes/source/manager.cxx | |
parent | 01839d6c7fbf2b32779c7c9037c0930b79c9e979 (diff) |
tubes: stop collaborating when the account gets off-line
Change-Id: Ic6f1bc41bc212e0c36751168f1204c41ebe0ce61
Diffstat (limited to 'tubes/source/manager.cxx')
-rw-r--r-- | tubes/source/manager.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index dd3dcd5a37c0..3a2fc1b4ac11 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -105,8 +105,24 @@ public: ~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 pConference ) +{ + if (!tb_account_is_online( pAccount )) + { + Collaboration* pCollaboration = + reinterpret_cast<TeleConference*> (pConference)->getCollaboration(); + if (pCollaboration) + pCollaboration->ContactLeft(); + } +} + static void contact_presence_changed_cb( TpContact* pContact, guint /* type */, gchar* /* status */, @@ -157,6 +173,10 @@ void TeleManager_DBusChannelHandler( TeleConference* pConference = new TeleConference( pManager, pAccount, TP_DBUS_TUBE_CHANNEL( pChannel ) ); pConference->acceptTube(); pManager->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", @@ -636,6 +656,9 @@ 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; } @@ -711,6 +734,9 @@ 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 ); |