summaryrefslogtreecommitdiff
path: root/tubes/source
diff options
context:
space:
mode:
Diffstat (limited to 'tubes/source')
-rw-r--r--tubes/source/collaboration.cxx50
-rw-r--r--tubes/source/conference.cxx11
-rw-r--r--tubes/source/contacts.cxx15
-rw-r--r--tubes/source/manager.cxx16
4 files changed, 73 insertions, 19 deletions
diff --git a/tubes/source/collaboration.cxx b/tubes/source/collaboration.cxx
new file mode 100644
index 000000000000..846f5dc51cc7
--- /dev/null
+++ b/tubes/source/collaboration.cxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <tubes/collaboration.hxx>
+
+#include <tubes/conference.hxx>
+
+Collaboration::Collaboration()
+{
+}
+
+Collaboration::~Collaboration()
+{
+ if (mpConference)
+ mpConference->close();
+}
+
+TeleConference* Collaboration::GetConference() const
+{
+ return mpConference;
+}
+
+sal_uInt64 Collaboration::GetId() const
+{
+ return reinterpret_cast<sal_uInt64> (this);
+}
+
+void Collaboration::SendFile( TpContact* pContact, const OUString& rURL ) const
+{
+ mpConference->sendFile( pContact, rURL, NULL, NULL );
+}
+
+void Collaboration::SendPacket( const OString& rPacket ) const
+{
+ mpConference->sendPacket( rPacket );
+}
+
+void Collaboration::SetConference( TeleConference* pConference )
+{
+ mpConference = pConference;
+ mpConference->setCollaboration( this );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx
index 88109df68429..bf33ebd27582 100644
--- a/tubes/source/conference.cxx
+++ b/tubes/source/conference.cxx
@@ -489,7 +489,8 @@ static void TeleConference_TransferDone( EmpathyFTHandler *handler, TpFileTransf
{
SendFileRequest *request = reinterpret_cast<SendFileRequest *>(user_data);
- request->mpCallback(true, request->mpUserData);
+ if (request->mpCallback)
+ request->mpCallback(true, request->mpUserData);
delete request;
g_object_unref (handler);
}
@@ -500,7 +501,8 @@ static void TeleConference_TransferError( EmpathyFTHandler *handler, const GErro
SAL_INFO( "tubes", "TeleConference_TransferError: " << error->message);
- request->mpCallback(false, request->mpUserData);
+ if (request->mpCallback)
+ request->mpCallback(false, request->mpUserData);
delete request;
g_object_unref (handler);
}
@@ -511,7 +513,8 @@ static void TeleConference_FTReady( EmpathyFTHandler *handler, GError *error, gp
if ( error != 0 )
{
- request->mpCallback(error == 0, request->mpUserData);
+ if (request->mpCallback)
+ request->mpCallback(error == 0, request->mpUserData);
delete request;
g_object_unref (handler);
}
@@ -528,7 +531,7 @@ static void TeleConference_FTReady( EmpathyFTHandler *handler, GError *error, gp
// TODO: move sending file to TeleManager
extern void TeleManager_fileReceived( const OUString& );
-void TeleConference::sendFile( TpContact* pContact, rtl::OUString &localUri, FileSentCallback pCallback, void* pUserData)
+void TeleConference::sendFile( TpContact* pContact, const OUString& localUri, FileSentCallback pCallback, void* pUserData)
{
INFO_LOGGER( "TeleConference::sendFile");
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
index 62cb7bfe0902..508322a69257 100644
--- a/tubes/source/contacts.cxx
+++ b/tubes/source/contacts.cxx
@@ -98,7 +98,7 @@ class TubeContacts : public ModelessDialog
{
TpContact* pContact = pAC->mpContact;
mpCollaboration->GetConference()->invite( pContact );
- mpCollaboration->SendFile( pContact, OStringToOUString(
+ mpCollaboration->SaveAndSendFile( pContact, OStringToOUString(
mpCollaboration->GetConference()->getUuid(), RTL_TEXTENCODING_UTF8 ) );
}
}
@@ -117,9 +117,8 @@ class TubeContacts : public ModelessDialog
SAL_WARN( "tubes", "Could not start demo session!" );
else
{
- pConference->setCollaboration( mpCollaboration );
- mpCollaboration->SetCollaboration( pConference );
- mpCollaboration->SendFile( NULL, OStringToOUString(
+ mpCollaboration->StartCollaboration( pConference );
+ mpCollaboration->SaveAndSendFile( NULL, OStringToOUString(
pConference->getUuid(), RTL_TEXTENCODING_UTF8 ) );
}
}
@@ -140,9 +139,8 @@ class TubeContacts : public ModelessDialog
tp_contact_get_identifier( pContact ) );
else
{
- pConference->setCollaboration( mpCollaboration );
- mpCollaboration->SetCollaboration( pConference );
- mpCollaboration->SendFile( pContact, OStringToOUString(
+ mpCollaboration->StartCollaboration( pConference );
+ mpCollaboration->SaveAndSendFile( pContact, OStringToOUString(
pConference->getUuid(), RTL_TEXTENCODING_UTF8 ) );
}
}
@@ -163,8 +161,7 @@ class TubeContacts : public ModelessDialog
SAL_WARN( "tubes", "Could not start group session." );
else
{
- pConference->setCollaboration( mpCollaboration );
- mpCollaboration->SetCollaboration( pConference );
+ mpCollaboration->StartCollaboration( pConference );
}
}
}
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index f3714978191d..3d87f1969393 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -115,12 +115,13 @@ static void account_presence_changed_cb( TpAccount* pAccount,
guint /* type */,
gchar* /* status */,
gchar* /* message */,
- gpointer pConference )
+ gpointer pUserData )
{
if (!tb_account_is_online( pAccount ))
{
- Collaboration* pCollaboration =
- reinterpret_cast<TeleConference*> (pConference)->getCollaboration();
+ TeleConference* pConference = reinterpret_cast<TeleConference*> (pUserData);
+ pConference->close();
+ Collaboration* pCollaboration = pConference->getCollaboration();
if (pCollaboration)
pCollaboration->ContactLeft();
}
@@ -130,12 +131,13 @@ static void contact_presence_changed_cb( TpContact* pContact,
guint /* type */,
gchar* /* status */,
gchar* /* message */,
- gpointer pConference )
+ gpointer pUserData )
{
if (!tb_contact_is_online( pContact ))
{
- Collaboration* pCollaboration =
- reinterpret_cast<TeleConference*> (pConference)->getCollaboration();
+ TeleConference* pConference = reinterpret_cast<TeleConference*> (pUserData);
+ pConference->close();
+ Collaboration* pCollaboration = pConference->getCollaboration();
if (pCollaboration)
pCollaboration->ContactLeft();
}
@@ -205,6 +207,8 @@ void TeleManager_DBusChannelHandler(
void TeleManager::addConference( TeleConference* pConference )
{
+ SAL_WARN_IF( pConference->getUuid().isEmpty(), "tubes",
+ "Adding conference with empty UUID should not happen!" );
pImpl->maAcceptedConferences[ pConference->getUuid() ] = pConference;
}