summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/ui/collab/sccollaboration.cxx11
-rw-r--r--sc/source/ui/collab/sendfunc.cxx4
-rw-r--r--sc/source/ui/inc/sccollaboration.hxx1
-rw-r--r--tubes/inc/tubes/collaboration.hxx1
-rw-r--r--tubes/inc/tubes/conference.hxx5
-rw-r--r--tubes/source/contact-list.cxx3
-rw-r--r--tubes/source/contacts.cxx2
-rw-r--r--tubes/source/manager.cxx25
8 files changed, 49 insertions, 3 deletions
diff --git a/sc/source/ui/collab/sccollaboration.cxx b/sc/source/ui/collab/sccollaboration.cxx
index aea2f0b34e2a..4651bfc1e348 100644
--- a/sc/source/ui/collab/sccollaboration.cxx
+++ b/sc/source/ui/collab/sccollaboration.cxx
@@ -21,6 +21,17 @@ ScCollaboration::~ScCollaboration()
{
}
+void ScCollaboration::ContactLeft()
+{
+ SAL_INFO( "sc.tubes", "Contact has left the collaboration" );
+ ScDocFuncSend* pSender = GetScDocFuncSend();
+ if (pSender)
+ {
+ delete pSender;
+ mpScDocShell->SetDocFunc( new ScDocFuncDirect( *mpScDocShell ) );
+ }
+}
+
TeleConference* ScCollaboration::GetConference()
{
ScDocFuncSend* pSender = GetScDocFuncSend();
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index e3ee4dccd1b3..0530980b93cb 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -356,7 +356,9 @@ ScDocFunc *ScDocShell::CreateDocFunc()
ScDocFuncDirect *pDirect = new ScDocFuncDirect( *this );
ScDocFuncRecv *pReceiver = new ScDocFuncRecv( pDirect );
ScDocFuncSend *pSender = new ScDocFuncSend( *this, pReceiver );
- pSender->SetCollaboration( TeleManager::getConference() );
+ TeleConference* pConference = TeleManager::getConference();
+ pConference->setCollaboration( mpCollaboration );
+ pSender->SetCollaboration( pConference );
return pSender;
}
else
diff --git a/sc/source/ui/inc/sccollaboration.hxx b/sc/source/ui/inc/sccollaboration.hxx
index 283cce4dbeba..bfdb98567969 100644
--- a/sc/source/ui/inc/sccollaboration.hxx
+++ b/sc/source/ui/inc/sccollaboration.hxx
@@ -21,6 +21,7 @@ public:
ScCollaboration( ScDocShell* pScDocShell );
virtual ~ScCollaboration();
+ virtual void ContactLeft();
virtual TeleConference* GetConference();
virtual sal_uInt64 GetId();
virtual void SetCollaboration( TeleConference* pConference );
diff --git a/tubes/inc/tubes/collaboration.hxx b/tubes/inc/tubes/collaboration.hxx
index 31eff7a4b937..6249173fda7e 100644
--- a/tubes/inc/tubes/collaboration.hxx
+++ b/tubes/inc/tubes/collaboration.hxx
@@ -23,6 +23,7 @@ public:
Collaboration() {}
virtual ~Collaboration() {}
+ virtual void ContactLeft() = 0;
virtual TeleConference* GetConference() = 0;
virtual sal_uInt64 GetId() = 0;
virtual void SetCollaboration( TeleConference* pConference ) = 0;
diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx
index 99eb009ec5b4..150e77ffe2fd 100644
--- a/tubes/inc/tubes/conference.hxx
+++ b/tubes/inc/tubes/conference.hxx
@@ -34,6 +34,7 @@
#include <rtl/ustring.hxx>
#include <tubes/warnings_guard_boost_signals2.hpp>
+class Collaboration;
class TeleManager;
class TeleConferenceImpl;
typedef struct _TpAccount TpAccount;
@@ -73,6 +74,9 @@ public:
TUBES_DLLPUBLIC void sendFile( TpContact* pContact, rtl::OUString &localUri, FileSentCallback pCallback, void* pUserData);
const OString& getUuid() const { return msUuid; }
+ Collaboration* getCollaboration() const { return mpCollaboration; }
+ void setCollaboration( Collaboration* pCollaboration ) { mpCollaboration = pCollaboration; }
+
// --- following only to be called only by manager's callbacks ---
// TODO: make friends instead
void setChannel( TpAccount* pAccount, TpDBusTubeChannel* pChannel );
@@ -98,6 +102,7 @@ private:
// Private:
bool spinUntilTubeEstablished();
+ Collaboration* mpCollaboration;
TeleManager* mpManager;
TpAccount* mpAccount;
TpDBusTubeChannel* mpChannel;
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;
}