summaryrefslogtreecommitdiff
path: root/tubes/source
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2012-08-03 23:50:03 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2012-08-04 01:57:16 +0200
commit8aef9f4027a9908f9f7f8e023fed4d9db50c5696 (patch)
tree6b14b9c57cbf64d8b42dafa0ea7e99abe1774d61 /tubes/source
parent374fb913a78edaa765e0f731d823d6e8180f56fe (diff)
tubes: stop collaborating when the contact leaves
Change-Id: I779aededb95eac6cbfb2fec3e97d207704244e25
Diffstat (limited to 'tubes/source')
-rw-r--r--tubes/source/contact-list.cxx3
-rw-r--r--tubes/source/contacts.cxx2
-rw-r--r--tubes/source/manager.cxx25
3 files changed, 28 insertions, 2 deletions
diff --git a/tubes/source/contact-list.cxx b/tubes/source/contact-list.cxx
index 9a5b49211f40..1b27af23adf8 100644
--- a/tubes/source/contact-list.cxx
+++ b/tubes/source/contact-list.cxx
@@ -71,8 +71,7 @@ ContactList::~ContactList()
mpAccountManager = NULL;
}
-static bool
-tb_contact_is_online (TpContact *contact)
+bool tb_contact_is_online( TpContact *contact )
{
switch (tp_contact_get_presence_type (contact))
{
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
index aa3fb790e42d..4db911368d0b 100644
--- a/tubes/source/contacts.cxx
+++ b/tubes/source/contacts.cxx
@@ -124,6 +124,7 @@ class TubeContacts : public ModelessDialog
tp_contact_get_identifier( pContact ) );
else
{
+ pConference->setCollaboration( mpCollaboration );
mpCollaboration->SetCollaboration( pConference );
mpCollaboration->SendFile( pContact, OStringToOUString(
pConference->getUuid(), RTL_TEXTENCODING_UTF8 ) );
@@ -146,6 +147,7 @@ class TubeContacts : public ModelessDialog
SAL_WARN( "tubes", "Could not start group session." );
else
{
+ pConference->setCollaboration( mpCollaboration );
mpCollaboration->SetCollaboration( pConference );
}
}
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index 7722844832d8..dd3dcd5a37c0 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -27,6 +27,8 @@
*/
#include <tubes/manager.hxx>
+
+#include <tubes/collaboration.hxx>
#include <tubes/conference.hxx>
#include <tubes/constants.h>
#include <tubes/contact-list.hxx>
@@ -103,6 +105,22 @@ public:
~TeleManagerImpl();
};
+bool tb_contact_is_online( TpContact* pContact );
+
+static void contact_presence_changed_cb( TpContact* pContact,
+ guint /* type */,
+ gchar* /* status */,
+ gchar* /* message */,
+ gpointer pConference )
+{
+ if (!tb_contact_is_online( pContact ))
+ {
+ Collaboration* pCollaboration =
+ reinterpret_cast<TeleConference*> (pConference)->getCollaboration();
+ if (pCollaboration)
+ pCollaboration->ContactLeft();
+ }
+}
void TeleManager_DBusChannelHandler(
TpSimpleHandler* /*handler*/,
@@ -139,6 +157,10 @@ void TeleManager_DBusChannelHandler(
TeleConference* pConference = new TeleConference( pManager, pAccount, TP_DBUS_TUBE_CHANNEL( pChannel ) );
pConference->acceptTube();
pManager->addConference( 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
{
@@ -689,6 +711,9 @@ TeleConference* TeleManager::startBuddySession( TpAccount *pAccount, TpContact *
if (!pConference->isReady())
return NULL;
+ g_signal_connect( pBuddy, "presence-changed",
+ G_CALLBACK (contact_presence_changed_cb), pConference );
+
return pConference;
}