summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2012-08-06 15:29:17 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2012-08-08 10:04:16 +0200
commit34c6421bddddb2128dd59acc867f73739ac1ca62 (patch)
tree7e7cc03fab695147fefdad5bec7126f59ab07df0
parent7a597eb6248ef48ebeb23daa40d2c75e5a24d9ee (diff)
tubes: handle TeleConference internally in Collaboration
Hopefully, this simplifies the tubes <-> app interface Change-Id: I8933fde490941b259d5d133972db26a09ab380d5
-rw-r--r--sc/source/ui/collab/sccollaboration.cxx64
-rw-r--r--sc/source/ui/collab/sendfunc.cxx87
-rw-r--r--sc/source/ui/collab/sendfunc.hxx22
-rw-r--r--sc/source/ui/docshell/docsh.cxx2
-rw-r--r--sc/source/ui/inc/docsh.hxx6
-rw-r--r--sc/source/ui/inc/sccollaboration.hxx19
-rw-r--r--tubes/Library_tubes.mk1
-rw-r--r--tubes/Package_inc.mk1
-rw-r--r--tubes/inc/tubes/collaboration.hxx28
-rw-r--r--tubes/inc/tubes/conference.hxx9
-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
14 files changed, 170 insertions, 161 deletions
diff --git a/sc/source/ui/collab/sccollaboration.cxx b/sc/source/ui/collab/sccollaboration.cxx
index e9c4ea0c2e88..78e97217c482 100644
--- a/sc/source/ui/collab/sccollaboration.cxx
+++ b/sc/source/ui/collab/sccollaboration.cxx
@@ -11,6 +11,12 @@
#include "docsh.hxx"
#include "sendfunc.hxx"
+#include <com/sun/star/document/XDocumentRecovery.hpp>
+#include <comphelper/mediadescriptor.hxx>
+#include <unotools/tempfile.hxx>
+#include <unotools/localfilehelper.hxx>
+
+namespace css = ::com::sun::star;
ScCollaboration::ScCollaboration( ScDocShell* pScDocShell ) :
mpScDocShell( pScDocShell )
@@ -21,7 +27,7 @@ ScCollaboration::~ScCollaboration()
{
}
-void ScCollaboration::ContactLeft()
+void ScCollaboration::ContactLeft() const
{
SAL_INFO( "sc.tubes", "Contact has left the collaboration" );
ScDocFuncSend* pSender = GetScDocFuncSend();
@@ -32,48 +38,60 @@ void ScCollaboration::ContactLeft()
}
}
-TeleConference* ScCollaboration::GetConference()
+void ScCollaboration::PacketReceived( const OString& rPacket ) const
{
ScDocFuncSend* pSender = GetScDocFuncSend();
if (pSender)
- return pSender->GetConference();
-
- return NULL;
+ return pSender->RecvMessage( rPacket );
}
-sal_uInt64 ScCollaboration::GetId()
+void ScCollaboration::SaveAndSendFile( TpContact* pContact, const OUString& sUuid ) const
{
- return reinterpret_cast<sal_uInt64> (mpScDocShell);
-}
+ String aTmpPath = utl::TempFile::CreateTempName();
+ aTmpPath.Append( OUString("_") );
+ aTmpPath.Append( sUuid );
+ aTmpPath.Append( OUString("_") );
+ aTmpPath.Append( OUString(".ods") );
-void ScCollaboration::PacketReceived( const OString& rPacket )
-{
- ScDocFuncSend* pSender = GetScDocFuncSend();
- if (pSender)
- return pSender->RecvMessage( rPacket );
+ rtl::OUString aFileURL;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aTmpPath, aFileURL );
+
+ ::comphelper::MediaDescriptor aDescriptor;
+ // some issue with hyperlinks:
+ aDescriptor[::comphelper::MediaDescriptor::PROP_DOCUMENTBASEURL()] <<= ::rtl::OUString();
+ try {
+ css::uno::Reference< css::document::XDocumentRecovery > xDocRecovery(
+ mpScDocShell->GetBaseModel(), css::uno::UNO_QUERY_THROW);
+
+ xDocRecovery->storeToRecoveryFile( aFileURL, aDescriptor.getAsConstPropertyValueList() );
+ } catch (const css::uno::Exception &ex) {
+ fprintf( stderr, "exception foo !\n" );
+ }
+
+ fprintf( stderr, "Temp file is '%s'\n",
+ rtl::OUStringToOString( aFileURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+
+ SendFile( pContact, aFileURL );
+
+ // FIXME: unlink the file after send ...
}
-void ScCollaboration::SetCollaboration( TeleConference* pConference )
+void ScCollaboration::StartCollaboration( TeleConference* pConference )
{
+ SetConference( pConference );
ScDocFunc* pDocFunc = &mpScDocShell->GetDocFunc();
ScDocFuncSend* pSender = dynamic_cast<ScDocFuncSend*> (pDocFunc);
if (!pSender)
{
// This means pDocFunc has to be ScDocFuncDirect* and we are not collaborating yet.
- pSender = new ScDocFuncSend( *mpScDocShell, dynamic_cast<ScDocFuncDirect*> (pDocFunc) );
+ pSender = new ScDocFuncSend( *mpScDocShell, dynamic_cast<ScDocFuncDirect*> (pDocFunc), this );
mpScDocShell->SetDocFunc( pSender );
}
- pSender->SetCollaboration( pConference );
}
-void ScCollaboration::SendFile( TpContact* pContact, const OUString& rURL )
-{
- ScDocFuncSend* pSender = GetScDocFuncSend();
- if (pSender)
- pSender->SendFile( pContact, rURL );
-}
+// --- private ---
-ScDocFuncSend* ScCollaboration::GetScDocFuncSend()
+ScDocFuncSend* ScCollaboration::GetScDocFuncSend() const
{
return dynamic_cast<ScDocFuncSend*> (&mpScDocShell->GetDocFunc());
}
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index 6b59d5394a70..f0c781253bf0 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -26,26 +26,16 @@
* instead of those above.
*/
-#include "sal/config.h"
-
-#include <vector>
+#include "sendfunc.hxx"
#include "cell.hxx"
#include "docsh.hxx"
#include "docfunc.hxx"
#include "sccollaboration.hxx"
-#include "sendfunc.hxx"
-#include <tubes/conference.hxx>
#include <tubes/contacts.hxx>
#include <tubes/manager.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <unotools/tempfile.hxx>
-#include <unotools/localfilehelper.hxx>
-#include <comphelper/mediadescriptor.hxx>
-#include <com/sun/star/document/XDocumentRecovery.hpp>
-
-namespace css = ::com::sun::star;
+#include <vector>
void ScDocFuncSend::RecvMessage( const rtl::OString &rString )
{
@@ -86,58 +76,18 @@ void ScDocFuncSend::RecvMessage( const rtl::OString &rString )
}
}
-extern "C"
-{
- static void file_sent_cb( bool aSuccess, void* /* pUserData */ )
- {
- fprintf( stderr, "File send %s\n", aSuccess ? "success" : "failed" );
- }
-}
-
void ScDocFuncSend::SendMessage( ScChangeOpWriter &rOp )
{
fprintf( stderr, "Op: '%s'\n", rOp.toString().getStr() );
- if (mpConference)
- mpConference->sendPacket( rOp.toString() );
-}
-
-void ScDocFuncSend::SendFile( TpContact* pContact, const rtl::OUString &sUuid )
-{
- String aTmpPath = utl::TempFile::CreateTempName();
- aTmpPath.Append( OUString("_") );
- aTmpPath.Append( sUuid );
- aTmpPath.Append( OUString("_") );
- aTmpPath.Append( OUString(".ods") );
-
- rtl::OUString aFileURL;
- ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aTmpPath, aFileURL );
-
- ::comphelper::MediaDescriptor aDescriptor;
- // some issue with hyperlinks:
- aDescriptor[::comphelper::MediaDescriptor::PROP_DOCUMENTBASEURL()] <<= ::rtl::OUString();
- try {
- css::uno::Reference< css::document::XDocumentRecovery > xDocRecovery(
- rDocShell.GetBaseModel(), css::uno::UNO_QUERY_THROW);
-
- xDocRecovery->storeToRecoveryFile( aFileURL, aDescriptor.getAsConstPropertyValueList() );
- } catch (const css::uno::Exception &ex) {
- fprintf( stderr, "exception foo !\n" );
- }
-
- fprintf( stderr, "Temp file is '%s'\n",
- rtl::OUStringToOString( aFileURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-
- mpConference->sendFile( pContact, aFileURL, file_sent_cb, NULL );
-
- // FIXME: unlink the file after send ...
+ mpCollaboration->SendPacket( rOp.toString() );
}
// FIXME: really ScDocFunc should be an abstract base, so
// we don't need the rDocSh hack/pointer
-ScDocFuncSend::ScDocFuncSend( ScDocShell& rDocSh, ScDocFuncDirect *pDirect )
+ScDocFuncSend::ScDocFuncSend( ScDocShell& rDocSh, ScDocFuncDirect *pDirect, ScCollaboration* pCollaboration )
: ScDocFunc( rDocSh ),
mpDirect( pDirect ),
- mpConference( NULL )
+ mpCollaboration( pCollaboration )
{
fprintf( stderr, "Sender created !\n" );
}
@@ -145,22 +95,9 @@ ScDocFuncSend::ScDocFuncSend( ScDocShell& rDocSh, ScDocFuncDirect *pDirect )
ScDocFuncSend::~ScDocFuncSend()
{
fprintf( stderr, "Sender destroyed !\n" );
- if (mpConference)
- mpConference->close();
-
delete mpDirect;
}
-void ScDocFuncSend::SetCollaboration( TeleConference* pConference )
-{
- mpConference = pConference;
-}
-
-TeleConference* ScDocFuncSend::GetConference()
-{
- return mpConference;
-}
-
void ScDocFuncSend::EnterListAction( sal_uInt16 nNameResId )
{
// Want to group these operations for the other side ...
@@ -187,7 +124,7 @@ sal_Bool ScDocFuncSend::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& r
o_rbNumFmtSet = false;
if ( rtl::OUString( rText ) == "saveme" )
- SendFile( NULL, rText );
+ mpCollaboration->SaveAndSendFile( NULL, rText );
if ( rtl::OUString( rText ) == "contacts" )
tubes::createContacts( rDocShell.GetCollaboration() );
@@ -280,14 +217,14 @@ ScDocFunc *ScDocShell::CreateDocFunc()
{
if (TeleManager::hasWaitingConference())
{
- ScDocFuncSend *pSender = new ScDocFuncSend( *this, new ScDocFuncDirect( *this ) );
TeleConference* pConference = TeleManager::getConference();
- pConference->setCollaboration( mpCollaboration );
- pSender->SetCollaboration( pConference );
- return pSender;
+ if (pConference)
+ {
+ mpCollaboration->SetConference( pConference );
+ return new ScDocFuncSend( *this, new ScDocFuncDirect( *this ), mpCollaboration );
+ }
}
- else
- return new ScDocFuncDirect( *this );
+ return new ScDocFuncDirect( *this );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/collab/sendfunc.hxx b/sc/source/ui/collab/sendfunc.hxx
index 07160c8e8e57..676fc78a915c 100644
--- a/sc/source/ui/collab/sendfunc.hxx
+++ b/sc/source/ui/collab/sendfunc.hxx
@@ -12,10 +12,9 @@
#include <sal/config.h>
-#include "cell.hxx"
#include "docfunc.hxx"
-class TeleConference;
-typedef struct _TpContact TpContact;
+class ScCollaboration;
+class ScBaseCell;
namespace {
@@ -206,23 +205,18 @@ public:
class ScDocFuncSend : public ScDocFunc
{
- ScDocFuncDirect *mpDirect;
- TeleConference *mpConference;
-
- void SendMessage( ScChangeOpWriter &rOp );
+ ScDocFuncDirect* mpDirect;
+ ScCollaboration* mpCollaboration;
+ friend class ScCollaboration;
+ void RecvMessage( const rtl::OString &rString );
+ void SendMessage( ScChangeOpWriter &rOp );
public:
// FIXME: really ScDocFunc should be an abstract base, so
// we don't need the rDocSh hack/pointer
- ScDocFuncSend( ScDocShell& rDocSh, ScDocFuncDirect *pDirect );
+ ScDocFuncSend( ScDocShell& rDocSh, ScDocFuncDirect* pDirect, ScCollaboration* pCollaboration );
virtual ~ScDocFuncSend();
- void RecvMessage( const rtl::OString &rString );
- void SetCollaboration( TeleConference* pConference );
- TeleConference* GetConference();
- // TODO: I think this could be moved to TeleManager later.
- void SendFile( TpContact* pContact, const rtl::OUString &rURL );
-
virtual void EnterListAction( sal_uInt16 nNameResId );
virtual void EndListAction();
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 228c6da23af7..eb2880605b9a 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2509,7 +2509,7 @@ ScDocFunc *ScDocShell::CreateDocFunc()
return new ScDocFuncDirect( *this );
}
#else
-Collaboration* ScDocShell::GetCollaboration()
+ScCollaboration* ScDocShell::GetCollaboration()
{
return mpCollaboration;
}
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index fef1657692d4..aa87507ffdc7 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -73,7 +73,7 @@ class ScSheetSaveData;
class ScFlatBoolRowSegments;
struct ScColWidthParam;
#ifdef ENABLE_TELEPATHY
-class Collaboration;
+class ScCollaboration;
#endif
namespace sfx2 { class FileDialogHelper; }
@@ -124,7 +124,7 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener
ScDocShellModificator* pModificator; // #109979#; is used to load XML (created in BeforeXMLLoading and destroyed in AfterXMLLoading)
#ifdef ENABLE_TELEPATHY
- Collaboration* mpCollaboration;
+ ScCollaboration* mpCollaboration;
#endif
SC_DLLPRIVATE void InitItems();
@@ -192,7 +192,7 @@ public:
using SfxObjectShell::Print; // print styles
#ifdef ENABLE_TELEPATHY
- SC_DLLPRIVATE Collaboration* GetCollaboration();
+ SC_DLLPRIVATE ScCollaboration* GetCollaboration();
#endif
virtual void Activate();
virtual void Deactivate();
diff --git a/sc/source/ui/inc/sccollaboration.hxx b/sc/source/ui/inc/sccollaboration.hxx
index 811f1cf8ef3b..cc71fe959cef 100644
--- a/sc/source/ui/inc/sccollaboration.hxx
+++ b/sc/source/ui/inc/sccollaboration.hxx
@@ -10,6 +10,8 @@
#ifndef INCLUDED_SC_COLLABORATION_HXX
#define INCLUDED_SC_COLLABORATION_HXX
+#include <sal/config.h>
+
#include <tubes/collaboration.hxx>
class ScDocFuncSend;
class ScDocShell;
@@ -18,17 +20,16 @@ class ScCollaboration : public Collaboration
{
ScDocShell* mpScDocShell;
public:
- ScCollaboration( ScDocShell* pScDocShell );
- virtual ~ScCollaboration();
+ ScCollaboration( ScDocShell* pScDocShell );
+ virtual ~ScCollaboration();
- virtual void ContactLeft();
- virtual TeleConference* GetConference();
- virtual sal_uInt64 GetId();
- virtual void PacketReceived( const OString& rPacket );
- virtual void SetCollaboration( TeleConference* pConference );
- virtual void SendFile( TpContact* pContact, const OUString& rURL );
+ virtual void ContactLeft() const;
+ virtual void PacketReceived( const OString& rPacket ) const;
+ virtual void SaveAndSendFile( TpContact* pContact, const OUString& rURL ) const;
+ virtual void StartCollaboration( TeleConference* pConference );
private:
- ScDocFuncSend* GetScDocFuncSend();
+ friend class ScDocShell;
+ ScDocFuncSend* GetScDocFuncSend() const;
};
#endif // INCLUDED_SC_COLLABORATION_HXX
diff --git a/tubes/Library_tubes.mk b/tubes/Library_tubes.mk
index 2ff9ab2407dd..b9edab9577d2 100644
--- a/tubes/Library_tubes.mk
+++ b/tubes/Library_tubes.mk
@@ -55,6 +55,7 @@ $(eval $(call gb_Library_use_externals,tubes,\
))
$(eval $(call gb_Library_add_exception_objects,tubes,\
+ tubes/source/collaboration \
tubes/source/conference \
tubes/source/contact-list \
tubes/source/contacts \
diff --git a/tubes/Package_inc.mk b/tubes/Package_inc.mk
index 1aff70bb00ec..be6266aeca49 100644
--- a/tubes/Package_inc.mk
+++ b/tubes/Package_inc.mk
@@ -27,7 +27,6 @@
$(eval $(call gb_Package_Package,tubes_inc,$(SRCDIR)/tubes/inc))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/collaboration.hxx,tubes/collaboration.hxx))
-$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/conference.hxx,tubes/conference.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/contacts.hxx,tubes/contacts.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/manager.hxx,tubes/manager.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/tubesdllapi.h,tubes/tubesdllapi.h))
diff --git a/tubes/inc/tubes/collaboration.hxx b/tubes/inc/tubes/collaboration.hxx
index 65595cde1143..15d59d4abf66 100644
--- a/tubes/inc/tubes/collaboration.hxx
+++ b/tubes/inc/tubes/collaboration.hxx
@@ -13,23 +13,29 @@
#include <sal/config.h>
#include <rtl/ustring.hxx>
+#include <tubes/tubesdllapi.h>
class TeleConference;
typedef struct _TpContact TpContact;
-class Collaboration
+class TUBES_DLLPUBLIC Collaboration
{
+ TeleConference* mpConference;
public:
- Collaboration() {}
- virtual ~Collaboration() {}
-
- virtual void ContactLeft() = 0;
- virtual TeleConference* GetConference() = 0;
- virtual sal_uInt64 GetId() = 0;
- virtual void PacketReceived( const OString& rPacket ) = 0;
- virtual void SetCollaboration( TeleConference* pConference ) = 0;
- // TODO: I think this could be moved to TeleManager later.
- virtual void SendFile( TpContact* pContact, const OUString& rURL ) = 0;
+ Collaboration();
+ virtual ~Collaboration();
+
+ virtual void ContactLeft() const = 0;
+ virtual void PacketReceived( const OString& rPacket ) const = 0;
+ virtual void SaveAndSendFile( TpContact* pContact, const OUString& rURL ) const = 0;
+ virtual void StartCollaboration( TeleConference* pConference ) = 0;
+
+ TUBES_DLLPRIVATE TeleConference* GetConference() const;
+ TUBES_DLLPRIVATE sal_uInt64 GetId() const;
+
+ void SendFile( TpContact* pContact, const OUString& rURL ) const;
+ void SendPacket( const OString& rPacket ) const;
+ void SetConference( TeleConference* pConference );
};
#endif // INCLUDED_TUBES_COLLABORATION_HXX
diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx
index 3f600e06a650..1514b141cd0b 100644
--- a/tubes/inc/tubes/conference.hxx
+++ b/tubes/inc/tubes/conference.hxx
@@ -30,7 +30,6 @@
#define INCLUDED_TUBES_CONFERENCE_HXX
#include <sal/config.h>
-#include "tubes/tubesdllapi.h"
#include <rtl/ustring.hxx>
class Collaboration;
@@ -52,21 +51,21 @@ public:
~TeleConference();
/// Close channel and call finalize()
- TUBES_DLLPUBLIC void close();
+ void close();
/// Unrefs, unregisters from manager and calls dtor if last reference!
void finalize();
- TUBES_DLLPUBLIC bool sendPacket( const OString& rPacket );
+ bool sendPacket( const OString& rPacket );
void invite( TpContact *pContact );
typedef void (*FileSentCallback)( bool aSuccess, void* pUserData);
- TUBES_DLLPUBLIC void sendFile( TpContact* pContact, rtl::OUString &localUri, FileSentCallback pCallback, void* pUserData);
+ void sendFile( TpContact* pContact, const OUString& rURL, FileSentCallback pCallback, void* pUserData);
const OString& getUuid() const { return msUuid; }
Collaboration* getCollaboration() const;
- TUBES_DLLPUBLIC void setCollaboration( Collaboration* pCollaboration );
+ void setCollaboration( Collaboration* pCollaboration );
// --- following only to be called only by manager's callbacks ---
// TODO: make friends instead
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;
}