[Libreoffice-commits] .: 8 commits - desktop/inc desktop/source sc/source tubes/inc tubes/Library_tubes.mk tubes/Package_inc.mk tubes/qa tubes/source
Matus Kukan
mkukan at kemper.freedesktop.org
Wed Aug 8 01:05:05 PDT 2012
desktop/inc/app.hxx | 7
desktop/source/app/app.cxx | 8
sc/source/ui/collab/sccollaboration.cxx | 61 ++++---
sc/source/ui/collab/sendfunc.cxx | 90 +---------
sc/source/ui/collab/sendfunc.hxx | 22 --
sc/source/ui/docshell/docsh.cxx | 2
sc/source/ui/inc/docsh.hxx | 6
sc/source/ui/inc/sccollaboration.hxx | 19 +-
sc/source/ui/view/cellsh3.cxx | 3
tubes/Library_tubes.mk | 1
tubes/Package_inc.mk | 2
tubes/inc/tubes/collaboration.hxx | 31 ++-
tubes/inc/tubes/conference.hxx | 9 -
tubes/inc/tubes/contacts.hxx | 38 ----
tubes/inc/tubes/file-transfer-helper.h | 5
tubes/inc/tubes/manager.hxx | 73 +++-----
tubes/qa/test_manager.cxx | 22 +-
tubes/source/collaboration.cxx | 59 ++++++
tubes/source/conference.cxx | 28 ++-
tubes/source/contact-list.cxx | 5
tubes/source/contacts.cxx | 100 +++--------
tubes/source/file-transfer-helper.c | 26 ++-
tubes/source/manager.cxx | 270 ++++++++++++++------------------
23 files changed, 399 insertions(+), 488 deletions(-)
New commits:
commit 011e348e114c1cc4ccdf6ce8e17024c81b9a0e6a
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Tue Aug 7 23:59:07 2012 +0200
tubes: add invite to Collaboration class
Change-Id: I37463d4365a2fe81e58d5f4bcf9f86d9830e26be
diff --git a/tubes/inc/tubes/collaboration.hxx b/tubes/inc/tubes/collaboration.hxx
index 18a64f0..8aef937 100644
--- a/tubes/inc/tubes/collaboration.hxx
+++ b/tubes/inc/tubes/collaboration.hxx
@@ -32,8 +32,8 @@ public:
virtual void SaveAndSendFile( TpContact* pContact ) const = 0;
virtual void StartCollaboration( TeleConference* pConference ) = 0;
- TUBES_DLLPRIVATE TeleConference* GetConference() const;
TUBES_DLLPRIVATE sal_uInt64 GetId() const;
+ TUBES_DLLPRIVATE void Invite( TpContact* pContact ) const;
void DisplayContacts();
void SendFile( TpContact* pContact, const OUString& rURL ) const;
diff --git a/tubes/source/collaboration.cxx b/tubes/source/collaboration.cxx
index 65c24c5..c957091 100644
--- a/tubes/source/collaboration.cxx
+++ b/tubes/source/collaboration.cxx
@@ -26,14 +26,18 @@ Collaboration::~Collaboration()
mpConference->close();
}
-TeleConference* Collaboration::GetConference() const
+sal_uInt64 Collaboration::GetId() const
{
- return mpConference;
+ return reinterpret_cast<sal_uInt64> (this);
}
-sal_uInt64 Collaboration::GetId() const
+void Collaboration::Invite( TpContact* pContact ) const
{
- return reinterpret_cast<sal_uInt64> (this);
+ if (mpConference)
+ {
+ mpConference->invite( pContact );
+ SaveAndSendFile( pContact );
+ }
}
void Collaboration::SendFile( TpContact* pContact, const OUString& rURL ) const
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
index 1472773..2a75f23 100644
--- a/tubes/source/contacts.cxx
+++ b/tubes/source/contacts.cxx
@@ -84,12 +84,7 @@ class TubeContacts : public ModelessDialog
pAC = static_cast<AccountContactPair*> (maList.FirstSelected()->GetUserData());
if (pAC)
{
- if (mpCollaboration->GetConference())
- {
- TpContact* pContact = pAC->second;
- mpCollaboration->GetConference()->invite( pContact );
- mpCollaboration->SaveAndSendFile( pContact );
- }
+ mpCollaboration->Invite( pAC->second );
}
}
commit c3c2dcf80de012b620de8563d7e872c3ae556881
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Tue Aug 7 23:34:19 2012 +0200
tubes: do not encode UUID into file name anymore
Change-Id: I6c3828eb9c2f2d1810822e90006fc1af4bfcf277
diff --git a/sc/source/ui/collab/sccollaboration.cxx b/sc/source/ui/collab/sccollaboration.cxx
index 78e9721..74c067c 100644
--- a/sc/source/ui/collab/sccollaboration.cxx
+++ b/sc/source/ui/collab/sccollaboration.cxx
@@ -45,13 +45,10 @@ void ScCollaboration::PacketReceived( const OString& rPacket ) const
return pSender->RecvMessage( rPacket );
}
-void ScCollaboration::SaveAndSendFile( TpContact* pContact, const OUString& sUuid ) const
+void ScCollaboration::SaveAndSendFile( TpContact* pContact ) const
{
- String aTmpPath = utl::TempFile::CreateTempName();
- aTmpPath.Append( OUString("_") );
- aTmpPath.Append( sUuid );
- aTmpPath.Append( OUString("_") );
- aTmpPath.Append( OUString(".ods") );
+ OUString aTmpPath = utl::TempFile::CreateTempName();
+ aTmpPath += ".ods";
rtl::OUString aFileURL;
::utl::LocalFileHelper::ConvertPhysicalNameToURL( aTmpPath, aFileURL );
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index d4b0253..7a7c741 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -121,7 +121,7 @@ sal_Bool ScDocFuncSend::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& r
o_rbNumFmtSet = false;
if ( rtl::OUString( rText ) == "saveme" )
- mpCollaboration->SaveAndSendFile( NULL, rText );
+ mpCollaboration->SaveAndSendFile( NULL );
if ( rtl::OUString( rText ) == "contacts" )
mpCollaboration->DisplayContacts();
diff --git a/sc/source/ui/inc/sccollaboration.hxx b/sc/source/ui/inc/sccollaboration.hxx
index cc71fe9..ece2604 100644
--- a/sc/source/ui/inc/sccollaboration.hxx
+++ b/sc/source/ui/inc/sccollaboration.hxx
@@ -25,7 +25,7 @@ public:
virtual void ContactLeft() const;
virtual void PacketReceived( const OString& rPacket ) const;
- virtual void SaveAndSendFile( TpContact* pContact, const OUString& rURL ) const;
+ virtual void SaveAndSendFile( TpContact* pContact ) const;
virtual void StartCollaboration( TeleConference* pConference );
private:
friend class ScDocShell;
diff --git a/tubes/inc/tubes/collaboration.hxx b/tubes/inc/tubes/collaboration.hxx
index 8378dda..18a64f0 100644
--- a/tubes/inc/tubes/collaboration.hxx
+++ b/tubes/inc/tubes/collaboration.hxx
@@ -29,7 +29,7 @@ public:
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 SaveAndSendFile( TpContact* pContact ) const = 0;
virtual void StartCollaboration( TeleConference* pConference ) = 0;
TUBES_DLLPRIVATE TeleConference* GetConference() const;
diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx
index 4bfd51c..8be9cab 100644
--- a/tubes/source/conference.cxx
+++ b/tubes/source/conference.cxx
@@ -535,7 +535,7 @@ static void TeleConference_FTReady( EmpathyFTHandler *handler, GError *error, gp
}
// TODO: move sending file to TeleManager
-extern void TeleManager_fileReceived( const OUString& );
+extern void TeleManager_fileReceived( const OUString&, const OString& );
void TeleConference::sendFile( TpContact* pContact, const OUString& localUri, FileSentCallback pCallback, void* pUserData)
{
INFO_LOGGER( "TeleConference::sendFile");
@@ -543,7 +543,7 @@ void TeleConference::sendFile( TpContact* pContact, const OUString& localUri, Fi
if (!pContact)
{
// used in demo mode
- TeleManager_fileReceived( localUri );
+ TeleManager_fileReceived( localUri, "demo" );
return;
}
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
index ef772de..1472773 100644
--- a/tubes/source/contacts.cxx
+++ b/tubes/source/contacts.cxx
@@ -88,8 +88,7 @@ class TubeContacts : public ModelessDialog
{
TpContact* pContact = pAC->second;
mpCollaboration->GetConference()->invite( pContact );
- mpCollaboration->SaveAndSendFile( pContact, OStringToOUString(
- mpCollaboration->GetConference()->getUuid(), RTL_TEXTENCODING_UTF8 ) );
+ mpCollaboration->SaveAndSendFile( pContact );
}
}
}
@@ -108,8 +107,7 @@ class TubeContacts : public ModelessDialog
else
{
mpCollaboration->StartCollaboration( pConference );
- mpCollaboration->SaveAndSendFile( NULL, OStringToOUString(
- pConference->getUuid(), RTL_TEXTENCODING_UTF8 ) );
+ mpCollaboration->SaveAndSendFile( NULL );
}
}
@@ -130,8 +128,7 @@ class TubeContacts : public ModelessDialog
else
{
mpCollaboration->StartCollaboration( pConference );
- mpCollaboration->SaveAndSendFile( pContact, OStringToOUString(
- pConference->getUuid(), RTL_TEXTENCODING_UTF8 ) );
+ mpCollaboration->SaveAndSendFile( pContact );
}
}
}
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index e1311c8..340c002 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -285,26 +285,19 @@ void TeleManager::setCurrentUuid( const OString& rUuid )
}
// FIXME: should be static and not used in conference.cxx
-void TeleManager_fileReceived( const rtl::OUString &rStr )
+void TeleManager_fileReceived( const OUString& rStr, const OString& rUuid )
{
SAL_INFO( "tubes", "TeleManager_fileReceived: incoming file: " << rStr );
- sal_Int32 first = rStr.indexOf('_');
- sal_Int32 last = rStr.lastIndexOf('_');
- SAL_WARN_IF( first == last, "tubes", "No UUID to associate with the file!" );
- if (first != last)
+ OString sUuid( rUuid );
+ if (sUuid == "demo")
{
- OString sUuid( OUStringToOString( rStr.copy( first + 1, last - first - 1),
- RTL_TEXTENCODING_UTF8));
- if (sUuid == "demo")
- {
- sUuid = TeleManager::createUuid();
- TeleConference* pConference = new TeleConference( NULL, NULL, sUuid );
- TeleManager::addConference( pConference );
- TeleManager::registerDemoConference( pConference );
- }
- TeleManager::setCurrentUuid( sUuid );
+ sUuid = TeleManager::createUuid();
+ TeleConference* pConference = new TeleConference( NULL, NULL, sUuid );
+ TeleManager::addConference( pConference );
+ TeleManager::registerDemoConference( pConference );
}
+ TeleManager::setCurrentUuid( sUuid );
css::uno::Reference< css::lang::XMultiServiceFactory > rFactory =
::comphelper::getProcessServiceFactory();
@@ -334,7 +327,7 @@ static void TeleManager_TransferDone( EmpathyFTHandler *handler, TpFileTransferC
rtl::OUString aUri( OUString::createFromAscii( uri ) );
g_free( uri);
- TeleManager_fileReceived( aUri );
+ TeleManager_fileReceived( aUri, empathy_ft_handler_get_description( handler ) );
g_object_unref( handler);
}
commit 1fa1894ec4ac7dd2ba314716d5565f3dac87592a
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Tue Aug 7 23:11:50 2012 +0200
tubes: use file channel description for sending UUID
Change-Id: I44129798110491cd59e1eb39d2f4c2cf3eb3c81b
diff --git a/tubes/inc/tubes/file-transfer-helper.h b/tubes/inc/tubes/file-transfer-helper.h
index 8960d14..016aed8 100644
--- a/tubes/inc/tubes/file-transfer-helper.h
+++ b/tubes/inc/tubes/file-transfer-helper.h
@@ -93,6 +93,10 @@ void empathy_ft_handler_new_outgoing (
void empathy_ft_handler_set_service_name (
EmpathyFTHandler *self,
const gchar *service_name);
+void empathy_ft_handler_set_description (
+ EmpathyFTHandler *self,
+ const gchar *description);
+
void empathy_ft_handler_new_incoming (TpFileTransferChannel *channel,
EmpathyFTHandlerReadyCallback callback,
@@ -108,6 +112,7 @@ const char * empathy_ft_handler_get_filename (EmpathyFTHandler *handler);
const char * empathy_ft_handler_get_content_type (EmpathyFTHandler *handler);
TpContact * empathy_ft_handler_get_contact (EmpathyFTHandler *handler);
GFile * empathy_ft_handler_get_gfile (EmpathyFTHandler *handler);
+const char *empathy_ft_handler_get_description(EmpathyFTHandler*);
gboolean empathy_ft_handler_get_use_hash (EmpathyFTHandler *handler);
gboolean empathy_ft_handler_is_incoming (EmpathyFTHandler *handler);
guint64 empathy_ft_handler_get_transferred_bytes (EmpathyFTHandler *handler);
diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx
index bf33ebd..4bfd51c 100644
--- a/tubes/source/conference.cxx
+++ b/tubes/source/conference.cxx
@@ -474,16 +474,20 @@ void TeleConference::invite( TpContact *pContact )
-1, &handles, NULL, NULL, NULL, NULL, NULL );
}
-
+namespace {
class SendFileRequest {
public:
- SendFileRequest( TeleConference::FileSentCallback pCallback, void* pUserData)
+ SendFileRequest( TeleConference::FileSentCallback pCallback, void* pUserData, const char* sUuid )
: mpCallback(pCallback)
- , mpUserData(pUserData) {};
+ , mpUserData(pUserData)
+ , msUuid(sUuid)
+ {}
TeleConference::FileSentCallback mpCallback;
void* mpUserData;
+ const char* msUuid;
};
+}
static void TeleConference_TransferDone( EmpathyFTHandler *handler, TpFileTransferChannel *, gpointer user_data)
{
@@ -525,6 +529,7 @@ static void TeleConference_FTReady( EmpathyFTHandler *handler, GError *error, gp
g_signal_connect(handler, "transfer-error",
G_CALLBACK (TeleConference_TransferError), request);
empathy_ft_handler_set_service_name(handler, TeleManager::getFullServiceName().getStr());
+ empathy_ft_handler_set_description(handler, request->msUuid);
empathy_ft_handler_start_transfer(handler);
}
}
@@ -549,7 +554,7 @@ void TeleConference::sendFile( TpContact* pContact, const OUString& localUri, Fi
GFile *pSource = g_file_new_for_uri(
OUStringToOString( localUri, RTL_TEXTENCODING_UTF8).getStr() );
- SendFileRequest *pReq = new SendFileRequest( pCallback, pUserData);
+ SendFileRequest *pReq = new SendFileRequest( pCallback, pUserData, msUuid.getStr() );
empathy_ft_handler_new_outgoing( mpAccount,
pContact,
diff --git a/tubes/source/file-transfer-helper.c b/tubes/source/file-transfer-helper.c
index c5049f8..6450343 100644
--- a/tubes/source/file-transfer-helper.c
+++ b/tubes/source/file-transfer-helper.c
@@ -923,6 +923,9 @@ ft_handler_populate_outgoing_request (EmpathyFTHandler *handler)
if (priv->service_name != NULL)
tp_asv_set_string (priv->request, TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_SERVICE_NAME, priv->service_name);
+ if (priv->description != NULL)
+ tp_asv_set_string (priv->request, TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_DESCRIPTION, priv->description);
+
g_free (uri);
}
@@ -1455,6 +1458,15 @@ empathy_ft_handler_set_service_name (
self->priv->service_name = g_strdup (service_name);
}
+void
+empathy_ft_handler_set_description (
+ EmpathyFTHandler *self,
+ const gchar *description)
+{
+ g_free (self->priv->description);
+ self->priv->description = g_strdup (description);
+}
+
/**
* empathy_ft_handler_new_incoming:
* @channel: the #TpFileTransferChannel proxy to the incoming channel
@@ -1616,6 +1628,18 @@ empathy_ft_handler_get_filename (EmpathyFTHandler *handler)
return priv->filename;
}
+const char *
+empathy_ft_handler_get_description (EmpathyFTHandler *handler)
+{
+ EmpathyFTHandlerPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_FT_HANDLER (handler), NULL);
+
+ priv = handler->priv;
+
+ return priv->description;
+}
+
/**
* empathy_ft_handler_get_content_type:
* @handler: an #EmpathyFTHandler
commit 35aa0360ed14ced09b803c2fc95ea095d4a6cb36
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Tue Aug 7 20:57:38 2012 +0200
Revert "tubes: mangle service name into file description"
Hopefully, it will work now, and we can use description field for UUID.
This reverts commit 98411a76545737f4b2b956fb1cc137a924c64641.
Change-Id: Ib6feeea861949c0cd316fda0295f13751de789e5
diff --git a/tubes/source/file-transfer-helper.c b/tubes/source/file-transfer-helper.c
index 107f103..c5049f8 100644
--- a/tubes/source/file-transfer-helper.c
+++ b/tubes/source/file-transfer-helper.c
@@ -921,7 +921,7 @@ ft_handler_populate_outgoing_request (EmpathyFTHandler *handler)
NULL);
if (priv->service_name != NULL)
- tp_asv_set_string (priv->request, TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_DESCRIPTION, priv->service_name);
+ tp_asv_set_string (priv->request, TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_SERVICE_NAME, priv->service_name);
g_free (uri);
}
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index b4fb93b..e1311c8 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -613,7 +613,7 @@ bool TeleManager::registerClients()
tp_asv_new(
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
- TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_DESCRIPTION, G_TYPE_STRING, getFullServiceName().getStr(),
+ TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_SERVICE_NAME, G_TYPE_STRING, getFullServiceName().getStr(),
NULL));
if (!tp_base_client_register( pImpl->mpFileTransferClient, &pError))
commit 6766c6a2a0a933b507e8e98a30280d1963f5b7db
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Tue Aug 7 16:04:52 2012 +0200
tubes: re-use typedefs from contact-list.hxx
Change-Id: I7b1ac653d22275a64d00913f014ca2536be3ffed
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
index 37a9de4..ef772de 100644
--- a/tubes/source/contacts.cxx
+++ b/tubes/source/contacts.cxx
@@ -43,7 +43,6 @@
#include <map>
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
#include <telepathy-glib/telepathy-glib.h>
namespace {
@@ -76,25 +75,18 @@ class TubeContacts : public ModelessDialog
DECL_LINK( BtnInviteHdl, void * );
DECL_LINK( BtnListenHdl, void * );
- struct AccountContact
- {
- TpAccount* mpAccount;
- TpContact* mpContact;
- AccountContact( TpAccount* pAccount, TpContact* pContact ):
- mpAccount(pAccount), mpContact(pContact) {}
- };
- boost::ptr_vector<AccountContact> maACs;
+ AccountContactPairV maACs;
void Invite()
{
- AccountContact *pAC = NULL;
+ AccountContactPair *pAC = NULL;
if (maList.FirstSelected())
- pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
+ pAC = static_cast<AccountContactPair*> (maList.FirstSelected()->GetUserData());
if (pAC)
{
if (mpCollaboration->GetConference())
{
- TpContact* pContact = pAC->mpContact;
+ TpContact* pContact = pAC->second;
mpCollaboration->GetConference()->invite( pContact );
mpCollaboration->SaveAndSendFile( pContact, OStringToOUString(
mpCollaboration->GetConference()->getUuid(), RTL_TEXTENCODING_UTF8 ) );
@@ -123,13 +115,13 @@ class TubeContacts : public ModelessDialog
void StartBuddySession()
{
- AccountContact *pAC = NULL;
+ AccountContactPair *pAC = NULL;
if (maList.FirstSelected())
- pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
+ pAC = static_cast<AccountContactPair*> (maList.FirstSelected()->GetUserData());
if (pAC)
{
- TpAccount* pAccount = pAC->mpAccount;
- TpContact* pContact = pAC->mpContact;
+ TpAccount* pAccount = pAC->first;
+ TpContact* pContact = pAC->second;
SAL_INFO( "tubes", "picked " << tp_contact_get_identifier( pContact ) );
TeleConference* pConference = TeleManager::startBuddySession( pAccount, pContact );
if (!pConference)
@@ -146,12 +138,12 @@ class TubeContacts : public ModelessDialog
void StartGroupSession()
{
- AccountContact *pAC = NULL;
+ AccountContactPair *pAC = NULL;
if (maList.FirstSelected())
- pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
+ pAC = static_cast<AccountContactPair*> (maList.FirstSelected()->GetUserData());
if (pAC)
{
- TpAccount* pAccount = pAC->mpAccount;
+ TpAccount* pAccount = pAC->first;
SAL_INFO( "tubes", "picked " << tp_account_get_display_name( pAccount ) );
TeleConference* pConference = TeleManager::startGroupSession( pAccount,
rtl::OUString("liboroom"), rtl::OUString("conference.jabber.org") );
@@ -211,11 +203,15 @@ public:
{
SAL_INFO( "sc.tubes", "Populating contact list dialog" );
maList.Clear();
+ maACs.clear();
ContactList *pContacts = TeleManager::getContactList();
if ( pContacts )
{
AccountContactPairV aPairs = pContacts->getContacts();
AccountContactPairV::iterator it;
+ // make sure we have enough memory to not need re-allocation
+ // which would invalidate pointers stored in maList entries
+ maACs.reserve( aPairs.size() );
for( it = aPairs.begin(); it != aPairs.end(); ++it )
{
Image aImage;
@@ -240,7 +236,7 @@ public:
aEntry.append( sal_Unicode( '\t' ) );
SvLBoxEntry* pEntry = maList.InsertEntry( aEntry.makeStringAndClear(), aImage, aImage );
// FIXME: ref the TpAccount, TpContact ...
- maACs.push_back( new AccountContact( it->first, it->second ) );
+ maACs.push_back( AccountContactPair( it->first, it->second ) );
pEntry->SetUserData( &maACs.back() );
}
}
commit 510576b6d8ba1cbd0bac6584f5ce56c93abc36ae
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Tue Aug 7 15:35:20 2012 +0200
tubes: finish efforts to make TeleManager static
Change-Id: I1d25a6074c3465a6e8c1df3127093d30d913b65d
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index c31b953..06dc4c7 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -42,10 +42,6 @@
#include <com/sun/star/uno/Reference.h>
#include <osl/mutex.hxx>
-#ifdef ENABLE_TELEPATHY
-class TeleManager;
-#endif
-
using namespace com::sun::star::task;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -209,9 +205,6 @@ class Desktop : public Application
sal_uInt16 m_nAppEvents;
BootstrapError m_aBootstrapError;
BootstrapStatus m_aBootstrapStatus;
-#ifdef ENABLE_TELEPATHY
- TeleManager* m_pTeleManager;
-#endif
std::auto_ptr< Lockfile > m_pLockfile;
Timer m_firstRunTimer;
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 4e76579..84a7516 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -618,9 +618,6 @@ throw()
Desktop::Desktop()
: m_bServicesRegistered( false )
, m_aBootstrapError( BE_OK )
-#ifdef ENABLE_TELEPATHY
-, m_pTeleManager( NULL )
-#endif
{
RTL_LOGFILE_TRACE( "desktop (cd100003) ::Desktop::Desktop" );
}
@@ -628,7 +625,7 @@ Desktop::Desktop()
Desktop::~Desktop()
{
#ifdef ENABLE_TELEPATHY
- delete m_pTeleManager;
+ TeleManager::finalize();
#endif
}
@@ -1711,9 +1708,8 @@ int Desktop::Main()
SetSplashScreenProgress(60);
#ifdef ENABLE_TELEPATHY
- m_pTeleManager = new TeleManager();
bool bListen = rCmdLineArgs.IsInvisible();
- m_pTeleManager->init( bListen );
+ TeleManager::init( bListen );
#endif
if ( !pExecGlobals->bRestartRequested )
diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx
index 533233a..b0825a3 100644
--- a/tubes/inc/tubes/manager.hxx
+++ b/tubes/inc/tubes/manager.hxx
@@ -55,6 +55,8 @@ typedef struct _TpContact TpContact;
class TeleManager
{
+ TeleManager();
+ ~TeleManager();
public:
enum AccountManagerStatus
@@ -68,16 +70,21 @@ public:
/** Prepare tube manager with account and service to be offered/listened
to.
*/
- TUBES_DLLPUBLIC TeleManager();
- TUBES_DLLPUBLIC ~TeleManager();
+ TUBES_DLLPUBLIC static bool init( bool bListen );
- TUBES_DLLPUBLIC bool init( bool bListen );
+ TUBES_DLLPUBLIC static void finalize();
+
+ /** True if there has been tube channel received and is still not used. */
+ TUBES_DLLPUBLIC static bool hasWaitingConference();
+
+ /** Get a conference with current UUID to set a session. */
+ TUBES_DLLPUBLIC static TeleConference* getConference();
/** Connect to DBus and create AccountManager. */
- bool createAccountManager();
+ static bool createAccountManager();
/** Setup client handlers. */
- bool registerClients();
+ static bool registerClients();
/** Prepare the Telepathy Account Manager.
Requires createAccountManager() to have succeeded.
@@ -87,16 +94,16 @@ public:
TODO: this needs some signalling mechanism
*/
- void prepareAccountManager();
- AccountManagerStatus getAccountManagerStatus() const;
+ static void prepareAccountManager();
+ static AccountManagerStatus getAccountManagerStatus();
/** Fetches the contact list. Returns 0 before connect() is called successfully.
Is non-functional until prepareAccountManager().
*/
- ContactList* getContactList() const;
+ static ContactList* getContactList();
/** Start a demo session where all local documents are shared to each other */
- TeleConference* startDemoSession();
+ static TeleConference* startDemoSession();
/** Start a group session in a MUC.
@@ -112,7 +119,7 @@ public:
empty, only the conference's UUID is used and rConferenceRoom is
ignored, hopefully resulting in a local DBus tube.
*/
- TeleConference* startGroupSession( TpAccount *pAccount,
+ static TeleConference* startGroupSession( TpAccount *pAccount,
const rtl::OUString& rConferenceRoom,
const rtl::OUString& rConferenceServer );
@@ -124,47 +131,30 @@ public:
@param pBuddy
The buddy to be connected. Must be a contact of pAccount.
*/
- TeleConference* startBuddySession( TpAccount *pAccount, TpContact *pBuddy );
-
- /** Get a conference with current UUID to set a session. */
- TUBES_DLLPUBLIC static TeleConference* getConference();
+ static TeleConference* startBuddySession( TpAccount *pAccount, TpContact *pBuddy );
- static void registerCollaboration( Collaboration* pCollaboration );
- static void unregisterCollaboration( Collaboration* pCollaboration );
+ static void registerCollaboration( Collaboration* pCollaboration );
+ static void unregisterCollaboration( Collaboration* pCollaboration );
/** Display contact list dialog for all documents. */
- static void displayAllContacts();
+ static void displayAllContacts();
- static void registerDemoConference( TeleConference* pConference );
- static void unregisterDemoConference( TeleConference* pConference );
+ static void registerDemoConference( TeleConference* pConference );
+ static void unregisterDemoConference( TeleConference* pConference );
/** Broadcast packet to all conferences. Used for demo mode. */
- static void broadcastPacket( const OString& rPacket );
-
- /** True if there has been tube channel received and is still not used. */
- TUBES_DLLPUBLIC static bool hasWaitingConference();
- static void setCurrentUuid( const OString& rUuid );
-
- void disconnect();
+ static void broadcastPacket( const OString& rPacket );
+ static void setCurrentUuid( const OString& rUuid );
static rtl::OString createUuid();
-
// Only for callbacks.
static void addConference( TeleConference* pConference );
static void setChannelReadyHandlerInvoked( bool b );
- bool isChannelReadyHandlerInvoked() const;
- void setAccountManagerReadyHandlerInvoked( bool b );
- bool isAccountManagerReadyHandlerInvoked() const;
+ static bool isChannelReadyHandlerInvoked();
+ static void setAccountManagerReadyHandlerInvoked( bool b );
+ static bool isAccountManagerReadyHandlerInvoked();
/** Only the callback of prepareAccountManager() is to set this. */
- void setAccountManagerReady( bool bPrepared);
-
- typedef bool (*CallBackInvokedFunc)();
- /** Iterate our GMainLoop, blocking, until the callback is done. */
- void iterateLoop( CallBackInvokedFunc pFunc );
-
- typedef bool (TeleManager::*ManagerCallBackInvokedFunc)() const;
- /** Iterate our GMainLoop, blocking, until the callback is done. */
- void iterateLoop( ManagerCallBackInvokedFunc pFunc );
+ static void setAccountManagerReady( bool bPrepared);
/// "LibreOfficeWhatEver"
static rtl::OString getFullClientName();
@@ -186,19 +176,14 @@ public:
*/
static void addSuffixToNames( const char* pName );
- TpAccount* getAccount( const rtl::OString& rAccountID );
+ static TpAccount* getAccount( const rtl::OString& rAccountID );
private:
- void ensureLegacyChannel( TpAccount* pAccount, TpContact* pBuddy );
-
static TeleManagerImpl* pImpl;
- static sal_uInt32 nRefCount;
- static rtl::OString aNameSuffix;
static ::osl::Mutex& GetMutex();
};
-
#endif // INCLUDED_TUBES_MANAGER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx
index 850d5d5..00ce9e5 100644
--- a/tubes/qa/test_manager.cxx
+++ b/tubes/qa/test_manager.cxx
@@ -85,7 +85,6 @@ public:
// static, not members, so they actually survive cppunit test iteration
static TeleConference* mpConference1 = NULL;
-static TeleManager* mpManager = NULL;
static TpContact* mpAccepterContact = NULL;
static GMainLoop* mpMainLoop = NULL;
static bool maFileSentSuccess = false;
@@ -126,16 +125,13 @@ void TestTeleTubes::testInitialize()
mpMainLoop = g_main_loop_new (NULL, FALSE);
g_timeout_add_seconds (10, timed_out, mpMainLoop);
-
- mpManager = new TeleManager();
}
void TestTeleTubes::testContactList()
{
- CPPUNIT_ASSERT( mpManager);
- CPPUNIT_ASSERT( mpManager->getAccountManagerStatus() == TeleManager::AMS_PREPARED);
+ CPPUNIT_ASSERT( TeleManager::getAccountManagerStatus() == TeleManager::AMS_PREPARED);
- ContactList *cl = mpManager->getContactList();
+ ContactList *cl = TeleManager::getContactList();
AccountContactPairV pairs;
@@ -178,30 +174,30 @@ void TestTeleTubes::testContactList()
void TestTeleTubes::testPrepareAccountManager()
{
- mpManager->prepareAccountManager();
- TeleManager::AccountManagerStatus eStatus = mpManager->getAccountManagerStatus();
+ TeleManager::prepareAccountManager();
+ TeleManager::AccountManagerStatus eStatus = TeleManager::getAccountManagerStatus();
CPPUNIT_ASSERT( eStatus == TeleManager::AMS_PREPARED);
}
void TestTeleTubes::testStartBuddySession()
{
- TpAccount *pAcc1 = mpManager->getAccount(maOffererIdentifier);
+ TpAccount *pAcc1 = TeleManager::getAccount(maOffererIdentifier);
CPPUNIT_ASSERT( pAcc1 != 0);
/* This has to run after testContactList has run successfully. */
CPPUNIT_ASSERT( mpAccepterContact != 0);
- mpConference1 = mpManager->startBuddySession( pAcc1, mpAccepterContact);
+ mpConference1 = TeleManager::startBuddySession( pAcc1, mpAccepterContact);
CPPUNIT_ASSERT( mpConference1 != NULL);
}
void TestTeleTubes::testCreateAccountManager()
{
- bool bConnected = mpManager->createAccountManager();
+ bool bConnected = TeleManager::createAccountManager();
CPPUNIT_ASSERT( bConnected == true);
}
void TestTeleTubes::testRegisterClients()
{
- bool bRegistered = mpManager->registerClients();
+ bool bRegistered = TeleManager::registerClients();
CPPUNIT_ASSERT( bRegistered == true);
}
@@ -254,7 +250,7 @@ void TestTeleTubes::testDestroyTeleTubes()
if (mpConference1)
mpConference1->close();
delete mpConference1;
- delete mpManager;
+ TeleManager::finalize();
}
void TestTeleTubes::testFailAlways()
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
index c6037f4..37a9de4 100644
--- a/tubes/source/contacts.cxx
+++ b/tubes/source/contacts.cxx
@@ -68,7 +68,6 @@ class TubeContacts : public ModelessDialog
PushButton maBtnListen;
SvxSimpleTableContainer maListContainer;
SvxSimpleTable maList;
- TeleManager* mpManager;
Collaboration* mpCollaboration;
DECL_LINK( BtnDemoHdl, void * );
@@ -105,13 +104,13 @@ class TubeContacts : public ModelessDialog
void Listen()
{
- if (!mpManager->registerClients())
+ if (!TeleManager::registerClients())
SAL_INFO( "sc.tubes", "Could not register client handlers." );
}
void StartDemoSession()
{
- TeleConference* pConference = mpManager->startDemoSession();
+ TeleConference* pConference = TeleManager::startDemoSession();
if (!pConference)
SAL_WARN( "tubes", "Could not start demo session!" );
else
@@ -132,7 +131,7 @@ class TubeContacts : public ModelessDialog
TpAccount* pAccount = pAC->mpAccount;
TpContact* pContact = pAC->mpContact;
SAL_INFO( "tubes", "picked " << tp_contact_get_identifier( pContact ) );
- TeleConference* pConference = mpManager->startBuddySession( pAccount, pContact );
+ TeleConference* pConference = TeleManager::startBuddySession( pAccount, pContact );
if (!pConference)
SAL_WARN( "tubes", "Could not start session with " <<
tp_contact_get_identifier( pContact ) );
@@ -154,7 +153,7 @@ class TubeContacts : public ModelessDialog
{
TpAccount* pAccount = pAC->mpAccount;
SAL_INFO( "tubes", "picked " << tp_account_get_display_name( pAccount ) );
- TeleConference* pConference = mpManager->startGroupSession( pAccount,
+ TeleConference* pConference = TeleManager::startGroupSession( pAccount,
rtl::OUString("liboroom"), rtl::OUString("conference.jabber.org") );
if (!pConference)
SAL_WARN( "tubes", "Could not start group session." );
@@ -176,7 +175,6 @@ public:
maBtnListen( this, TubesResId( BTN_LISTEN ) ),
maListContainer( this, TubesResId( CTL_LIST ) ),
maList( maListContainer ),
- mpManager( new TeleManager() ),
mpCollaboration( pCollaboration )
{
Hide();
@@ -201,7 +199,6 @@ public:
}
virtual ~TubeContacts()
{
- delete mpManager;
}
static rtl::OUString fromUTF8( const char *pStr )
@@ -214,7 +211,7 @@ public:
{
SAL_INFO( "sc.tubes", "Populating contact list dialog" );
maList.Clear();
- ContactList *pContacts = mpManager->getContactList();
+ ContactList *pContacts = TeleManager::getContactList();
if ( pContacts )
{
AccountContactPairV aPairs = pContacts->getContacts();
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index 4d0fc66..b4fb93b 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -71,21 +71,14 @@ struct InfoLogger
};
}
#define INFO_LOGGER_F(s) InfoLogger aLogger(0,(s))
-#define INFO_LOGGER(s) InfoLogger aLogger(this,(s))
#else
#define INFO_LOGGER_F(s)
-#define INFO_LOGGER(s)
#endif // SAL_LOG_INFO
using namespace rtl;
using namespace osl;
-
-TeleManagerImpl* TeleManager::pImpl = NULL;
-sal_uInt32 TeleManager::nRefCount = 0;
-rtl::OString TeleManager::aNameSuffix;
-
/** Refcounted singleton implementation class. */
class TeleManagerImpl
{
@@ -99,6 +92,7 @@ public:
bool mbChannelReadyHandlerInvoked : 1;
ContactList* mpContactList;
OString msCurrentUUID;
+ OString msNameSuffix;
typedef std::map< OString, TeleConference* > MapStringConference;
MapStringConference maAcceptedConferences;
typedef std::set< TeleConference* > DemoConferences;
@@ -110,6 +104,8 @@ public:
~TeleManagerImpl();
};
+TeleManagerImpl* TeleManager::pImpl = new TeleManagerImpl();
+
bool tb_account_is_online( TpAccount* pAccount );
bool tb_contact_is_online( TpContact* pContact );
@@ -145,7 +141,7 @@ static void contact_presence_changed_cb( TpContact* pContact,
}
}
-void TeleManager_DBusChannelHandler(
+static void TeleManager_DBusChannelHandler(
TpSimpleHandler* /*handler*/,
TpAccount* pAccount,
TpConnection* /*connection*/,
@@ -153,16 +149,11 @@ void TeleManager_DBusChannelHandler(
GList* /*requests_satisfied*/,
gint64 /*user_action_time*/,
TpHandleChannelsContext* pContext,
- gpointer pUserData)
+ gpointer /*pUserData*/ )
{
bool aAccepted = false;
INFO_LOGGER_F( "TeleManager_DBusChannelHandler");
- TeleManager* pManager = reinterpret_cast<TeleManager*>(pUserData);
- SAL_WARN_IF( !pManager, "tubes", "TeleManager_DBusChannelHandler: no manager");
- if (!pManager)
- return;
-
for (GList* p = pChannels; p; p = p->next)
{
TpChannel* pChannel = TP_CHANNEL(p->data);
@@ -179,7 +170,7 @@ void TeleManager_DBusChannelHandler(
TeleConference* pConference = new TeleConference( pAccount, TP_DBUS_TUBE_CHANNEL( pChannel ) );
pConference->acceptTube();
- pManager->addConference( pConference );
+ TeleManager::addConference( pConference );
g_signal_connect( pAccount, "presence-changed",
G_CALLBACK (account_presence_changed_cb), pConference );
@@ -209,6 +200,8 @@ void TeleManager_DBusChannelHandler(
void TeleManager::addConference( TeleConference* pConference )
{
+ MutexGuard aGuard( GetMutex());
+
SAL_WARN_IF( pConference->getUuid().isEmpty(), "tubes",
"Adding conference with empty UUID should not happen!" );
pImpl->maAcceptedConferences[ pConference->getUuid() ] = pConference;
@@ -216,6 +209,8 @@ void TeleManager::addConference( TeleConference* pConference )
TeleConference* TeleManager::getConference()
{
+ MutexGuard aGuard( GetMutex());
+
TeleManagerImpl::MapStringConference::const_iterator it =
pImpl->maAcceptedConferences.find( pImpl->msCurrentUUID );
TeleConference* pConference = NULL;
@@ -229,16 +224,22 @@ TeleConference* TeleManager::getConference()
void TeleManager::registerCollaboration( Collaboration* pCollaboration )
{
+ MutexGuard aGuard( GetMutex());
+
pImpl->maCollaborations.insert( pCollaboration );
}
void TeleManager::unregisterCollaboration( Collaboration* pCollaboration )
{
+ MutexGuard aGuard( GetMutex());
+
pImpl->maCollaborations.erase( pCollaboration );
}
void TeleManager::displayAllContacts()
{
+ MutexGuard aGuard( GetMutex());
+
for (TeleManagerImpl::Collaborations::iterator it = pImpl->maCollaborations.begin();
it != pImpl->maCollaborations.end(); ++it)
(*it)->DisplayContacts();
@@ -246,16 +247,22 @@ void TeleManager::displayAllContacts()
void TeleManager::registerDemoConference( TeleConference* pConference )
{
+ MutexGuard aGuard( GetMutex());
+
pImpl->maDemoConferences.insert( pConference );
}
void TeleManager::unregisterDemoConference( TeleConference* pConference )
{
+ MutexGuard aGuard( GetMutex());
+
pImpl->maDemoConferences.erase( pConference );
}
void TeleManager::broadcastPacket( const OString& rPacket )
{
+ MutexGuard aGuard( GetMutex());
+
INFO_LOGGER_F( "TeleManager::broadcastPacket" );
for (TeleManagerImpl::DemoConferences::iterator it = pImpl->maDemoConferences.begin();
it != pImpl->maDemoConferences.end(); ++it)
@@ -265,11 +272,15 @@ void TeleManager::broadcastPacket( const OString& rPacket )
bool TeleManager::hasWaitingConference()
{
- return pImpl && !pImpl->msCurrentUUID.isEmpty();
+ MutexGuard aGuard( GetMutex());
+
+ return !pImpl->msCurrentUUID.isEmpty();
}
void TeleManager::setCurrentUuid( const OString& rUuid )
{
+ MutexGuard aGuard( GetMutex());
+
pImpl->msCurrentUUID = rUuid;
}
@@ -335,14 +346,19 @@ static void TeleManager_TransferError( EmpathyFTHandler *handler, const GError *
g_object_unref( handler);
}
-static void
-TeleManager_IncomingHandlerReady (
+static void lcl_iterateLoop( bool (*pFunc)() )
+{
+ while (!(*pFunc)())
+ {
+ g_main_context_iteration( NULL, TRUE );
+ }
+}
+
+static void lcl_IncomingHandlerReady (
EmpathyFTHandler* pHandler,
GError* pError,
- void* pUserData)
+ void* /*pUserData*/ )
{
- TeleManager* pManager = reinterpret_cast<TeleManager*>(pUserData);
-
if (pError)
{
SAL_INFO ("tubes", "failed to prepare incoming transfer: " << pError->message);
@@ -361,8 +377,8 @@ TeleManager_IncomingHandlerReady (
empathy_ft_handler_incoming_set_destination( pHandler, pDestination);
g_object_unref( pDestination);
- g_signal_connect( pHandler, "transfer-done", G_CALLBACK (TeleManager_TransferDone), pManager);
- g_signal_connect( pHandler, "transfer-error", G_CALLBACK (TeleManager_TransferError), pManager);
+ g_signal_connect( pHandler, "transfer-done", G_CALLBACK (TeleManager_TransferDone), NULL);
+ g_signal_connect( pHandler, "transfer-error", G_CALLBACK (TeleManager_TransferError), NULL);
empathy_ft_handler_start_transfer( pHandler);
}
@@ -374,16 +390,11 @@ static void TeleManager_FileTransferHandler(
GList* /*requests_satisfied*/,
gint64 /*user_action_time*/,
TpHandleChannelsContext* pContext,
- gpointer pUserData)
+ gpointer /*pUserData*/ )
{
bool aAccepted = false;
INFO_LOGGER_F( "TeleManager_FileTransferHandler");
- TeleManager* pManager = reinterpret_cast<TeleManager*>(pUserData);
- SAL_WARN_IF( !pManager, "tubes", "TeleManager_FileTransferHandler: no manager");
- if (!pManager)
- return;
-
for (GList* p = pChannels; p; p = p->next)
{
TpChannel* pChannel = TP_CHANNEL(p->data);
@@ -395,7 +406,7 @@ static void TeleManager_FileTransferHandler(
{
SAL_INFO( "tubes", "accepting file transfer");
empathy_ft_handler_new_incoming( TP_FILE_TRANSFER_CHANNEL( pChannel),
- TeleManager_IncomingHandlerReady, pManager);
+ lcl_IncomingHandlerReady, NULL);
aAccepted = true;
}
else
@@ -452,16 +463,11 @@ static void TeleManager_ChannelReadyHandler(
static void TeleManager_AccountManagerReadyHandler(
GObject* pSourceObject,
GAsyncResult* pResult,
- gpointer pUserData
+ gpointer /*pUserData*/
)
{
INFO_LOGGER_F( "TeleManager_AccountManagerReadyHandler");
- TeleManager* pManager = reinterpret_cast<TeleManager*>(pUserData);
- SAL_WARN_IF( !pManager, "tubes", "TeleManager_AccountManagerReadyHandler: no manager");
- if (!pManager)
- return;
-
GError* pError = NULL;
gboolean bPrepared = tp_proxy_prepare_finish( pSourceObject, pResult, &pError);
SAL_WARN_IF( !bPrepared, "tubes", "TeleManager_AccountManagerReadyHandler: not prepared");
@@ -471,35 +477,8 @@ static void TeleManager_AccountManagerReadyHandler(
g_error_free( pError);
}
- pManager->setAccountManagerReady( bPrepared);
- pManager->setAccountManagerReadyHandlerInvoked( true);
-}
-
-
-TeleManager::TeleManager()
-{
- SAL_INFO( "tubes", "TeleManager::get: count: " << nRefCount );
- // The glib object types need to be initialized, else we aren't going
- // anywhere.
- g_type_init();
-
- MutexGuard aGuard( GetMutex());
- ++nRefCount;
- if (!pImpl)
- pImpl = new TeleManagerImpl;
-}
-
-TeleManager::~TeleManager()
-{
- MutexGuard aGuard( GetMutex());
- if (!--nRefCount)
- {
- disconnect();
-
- delete pImpl;
- pImpl = NULL;
- }
- SAL_INFO( "tubes", "TeleManager::unref: count: " << nRefCount );
+ TeleManager::setAccountManagerReady( bPrepared);
+ TeleManager::setAccountManagerReadyHandlerInvoked( true);
}
bool TeleManager::init( bool bListen )
@@ -518,9 +497,14 @@ bool TeleManager::init( bool bListen )
return false;
}
+void TeleManager::finalize()
+{
+ delete pImpl;
+}
+
bool TeleManager::createAccountManager()
{
- INFO_LOGGER( "TeleManager::createAccountManager");
+ INFO_LOGGER_F( "TeleManager::createAccountManager");
MutexGuard aGuard( GetMutex());
@@ -558,7 +542,7 @@ bool TeleManager::createAccountManager()
bool TeleManager::registerClients()
{
- INFO_LOGGER( "TeleManager::registerClients");
+ INFO_LOGGER_F( "TeleManager::registerClients");
MutexGuard aGuard( GetMutex());
@@ -574,7 +558,7 @@ bool TeleManager::registerClients()
getFullClientName().getStr(), // name
FALSE, // uniquify
TeleManager_DBusChannelHandler, // callback
- this, // user_data
+ NULL, // user_data
NULL // destroy
);
SAL_WARN_IF( !pImpl->mpClient, "tubes", "TeleManager::registerClients: no client");
@@ -622,7 +606,7 @@ bool TeleManager::registerClients()
getFullClientName().getStr(), // name
TRUE, // uniquify to get a different bus name to the main client, above
TeleManager_FileTransferHandler, // callback
- this, // user_data, unused
+ NULL, // user_data
NULL // destroy
);
tp_base_client_take_handler_filter( pImpl->mpFileTransferClient,
@@ -645,7 +629,7 @@ bool TeleManager::registerClients()
TeleConference* TeleManager::startDemoSession()
{
- INFO_LOGGER( "TeleManager::startDemoSession");
+ INFO_LOGGER_F( "TeleManager::startDemoSession");
TeleConference* pConference = new TeleConference( NULL, NULL, "demo" );
registerDemoConference( pConference );
@@ -658,7 +642,7 @@ TeleConference* TeleManager::startGroupSession( TpAccount *pAccount,
const rtl::OUString& rUConferenceRoom,
const rtl::OUString& rUConferenceServer )
{
- INFO_LOGGER( "TeleManager::startGroupSession");
+ INFO_LOGGER_F( "TeleManager::startGroupSession");
OString aSessionId( TeleManager::createUuid());
@@ -705,7 +689,7 @@ TeleConference* TeleManager::startGroupSession( TpAccount *pAccount,
tp_account_channel_request_create_and_handle_channel_async(
pChannelRequest, NULL, TeleManager_ChannelReadyHandler, pConference);
- iterateLoop( &TeleManager::isChannelReadyHandlerInvoked);
+ lcl_iterateLoop( &TeleManager::isChannelReadyHandlerInvoked);
g_object_unref( pChannelRequest);
g_hash_table_unref( pRequest);
@@ -720,7 +704,7 @@ TeleConference* TeleManager::startGroupSession( TpAccount *pAccount,
}
-void TeleManager::ensureLegacyChannel( TpAccount* pAccount, TpContact* pBuddy )
+static void lcl_ensureLegacyChannel( TpAccount* pAccount, TpContact* pBuddy )
{
/* This is a workaround for a Telepathy bug.
* <https://bugs.freedesktop.org/show_bug.cgi?id=47760>. The first time you
@@ -751,9 +735,9 @@ void TeleManager::ensureLegacyChannel( TpAccount* pAccount, TpContact* pBuddy )
/* TODO: factor out common code with startGroupSession() */
TeleConference* TeleManager::startBuddySession( TpAccount *pAccount, TpContact *pBuddy )
{
- INFO_LOGGER( "TeleManager::startBuddySession");
+ INFO_LOGGER_F( "TeleManager::startBuddySession");
- ensureLegacyChannel( pAccount, pBuddy );
+ lcl_ensureLegacyChannel( pAccount, pBuddy );
const char *pIdentifier = tp_contact_get_identifier( pBuddy);
SAL_INFO( "tubes", "TeleManager::startBuddySession: creating channel request from "
@@ -783,7 +767,7 @@ TeleConference* TeleManager::startBuddySession( TpAccount *pAccount, TpContact *
tp_account_channel_request_create_and_handle_channel_async(
pChannelRequest, NULL, TeleManager_ChannelReadyHandler, pConference );
- iterateLoop( &TeleManager::isChannelReadyHandlerInvoked);
+ lcl_iterateLoop( &TeleManager::isChannelReadyHandlerInvoked);
g_object_unref( pChannelRequest);
g_hash_table_unref( pRequest);
@@ -802,7 +786,7 @@ TeleConference* TeleManager::startBuddySession( TpAccount *pAccount, TpContact *
void TeleManager::prepareAccountManager()
{
- INFO_LOGGER( "TeleManager::prepareAccountManager");
+ INFO_LOGGER_F( "TeleManager::prepareAccountManager");
MutexGuard aGuard( GetMutex());
@@ -827,13 +811,13 @@ void TeleManager::prepareAccountManager()
pImpl->meAccountManagerStatus = AMS_INPREPARATION;
setAccountManagerReadyHandlerInvoked( false);
- tp_proxy_prepare_async( pImpl->mpAccountManager, NULL, TeleManager_AccountManagerReadyHandler, this);
+ tp_proxy_prepare_async( pImpl->mpAccountManager, NULL, TeleManager_AccountManagerReadyHandler, NULL);
- iterateLoop( &TeleManager::isAccountManagerReadyHandlerInvoked);
+ lcl_iterateLoop( &TeleManager::isAccountManagerReadyHandlerInvoked);
}
-TeleManager::AccountManagerStatus TeleManager::getAccountManagerStatus() const
+TeleManager::AccountManagerStatus TeleManager::getAccountManagerStatus()
{
return pImpl->meAccountManagerStatus;
}
@@ -844,7 +828,7 @@ void TeleManager::setAccountManagerReadyHandlerInvoked( bool b )
pImpl->mbAccountManagerReadyHandlerInvoked = b;
}
-bool TeleManager::isAccountManagerReadyHandlerInvoked() const
+bool TeleManager::isAccountManagerReadyHandlerInvoked()
{
return pImpl->mbAccountManagerReadyHandlerInvoked;
}
@@ -854,19 +838,19 @@ void TeleManager::setChannelReadyHandlerInvoked( bool b )
pImpl->mbChannelReadyHandlerInvoked = b;
}
-bool TeleManager::isChannelReadyHandlerInvoked() const
+bool TeleManager::isChannelReadyHandlerInvoked()
{
return pImpl->mbChannelReadyHandlerInvoked;
}
-ContactList* TeleManager::getContactList() const
+ContactList* TeleManager::getContactList()
{
return pImpl->mpContactList;
}
TpAccount* TeleManager::getAccount( const rtl::OString& rAccountID )
{
- INFO_LOGGER( "TeleManager::getMyAccount");
+ INFO_LOGGER_F( "TeleManager::getMyAccount");
SAL_WARN_IF( pImpl->meAccountManagerStatus != AMS_PREPARED, "tubes",
"TeleManager::getMyAccount: Account Manager not prepared");
@@ -899,21 +883,6 @@ TpAccount* TeleManager::getAccount( const rtl::OString& rAccountID )
return pAccount;
}
-void TeleManager::disconnect()
-{
- INFO_LOGGER( "TeleManager::disconnect");
-
- if (!pImpl->mpClient)
- return;
-
- tp_base_client_unregister( pImpl->mpClient);
- pImpl->mpClient = NULL;
-
- tp_base_client_unregister( pImpl->mpFileTransferClient);
- pImpl->mpFileTransferClient = NULL;
-}
-
-
void TeleManager::setAccountManagerReady( bool bPrepared)
{
pImpl->meAccountManagerStatus = (bPrepared ? AMS_PREPARED : AMS_UNPREPARABLE);
@@ -923,7 +892,7 @@ void TeleManager::setAccountManagerReady( bool bPrepared)
rtl::OString TeleManager::getFullClientName()
{
OStringBuffer aBuf(64);
- aBuf.append( RTL_CONSTASCII_STRINGPARAM( LIBO_CLIENT_SUFFIX)).append( aNameSuffix);
+ aBuf.append( RTL_CONSTASCII_STRINGPARAM( LIBO_CLIENT_SUFFIX)).append( pImpl->msNameSuffix);
return aBuf.makeStringAndClear();
}
@@ -931,7 +900,7 @@ rtl::OString TeleManager::getFullClientName()
rtl::OString TeleManager::getFullServiceName()
{
OStringBuffer aBuf(64);
- aBuf.append( RTL_CONSTASCII_STRINGPARAM( LIBO_DTUBE_SERVICE)).append( aNameSuffix);
+ aBuf.append( RTL_CONSTASCII_STRINGPARAM( LIBO_DTUBE_SERVICE)).append( pImpl->msNameSuffix);
return aBuf.makeStringAndClear();
}
@@ -939,29 +908,11 @@ rtl::OString TeleManager::getFullServiceName()
rtl::OString TeleManager::getFullObjectPath()
{
OStringBuffer aBuf(64);
- aBuf.append( '/').append( RTL_CONSTASCII_STRINGPARAM( LIBO_DTUBE_SERVICE)).append( aNameSuffix);
+ aBuf.append( '/').append( RTL_CONSTASCII_STRINGPARAM( LIBO_DTUBE_SERVICE)).append( pImpl->msNameSuffix);
OString aStr( aBuf.makeStringAndClear().replace( '.', '/'));
return aStr;
}
-void TeleManager::iterateLoop( CallBackInvokedFunc pFunc )
-{
- while (!(*pFunc)())
- {
- g_main_context_iteration( NULL, TRUE );
- }
-}
-
-
-void TeleManager::iterateLoop( ManagerCallBackInvokedFunc pFunc )
-{
- while (!(this->*pFunc)())
- {
- g_main_context_iteration( NULL, TRUE );
- }
-}
-
-// static
rtl::OString TeleManager::createUuid()
{
sal_uInt8 nId[16];
@@ -975,8 +926,6 @@ rtl::OString TeleManager::createUuid()
return rtl::OString( aBuf);
}
-
-// static
Mutex& TeleManager::GetMutex()
{
static Mutex* pMutex = NULL;
@@ -989,10 +938,9 @@ Mutex& TeleManager::GetMutex()
return *pMutex;
}
-// static
void TeleManager::addSuffixToNames( const char* pName )
{
- aNameSuffix = pName;
+ pImpl->msNameSuffix = pName;
}
// ===========================================================================
@@ -1007,9 +955,9 @@ TeleManagerImpl::TeleManagerImpl()
mbAccountManagerReadyHandlerInvoked( false),
mbChannelReadyHandlerInvoked( false)
{
+ g_type_init();
}
-
TeleManagerImpl::~TeleManagerImpl()
{
// There may be unused conferences left opened, so close them.
@@ -1017,12 +965,18 @@ TeleManagerImpl::~TeleManagerImpl()
for (MapStringConference::iterator it = maAcceptedConferences.begin();
it != maAcceptedConferences.end(); ++it)
it->second->close();
- if (mpFactory)
- g_object_unref( mpFactory);
if (mpClient)
+ {
+ tp_base_client_unregister( mpClient);
g_object_unref( mpClient);
+ }
if (mpFileTransferClient)
+ {
+ tp_base_client_unregister( mpFileTransferClient);
g_object_unref( mpFileTransferClient);
+ }
+ if (mpFactory)
+ g_object_unref( mpFactory);
if (mpAccountManager)
g_object_unref( mpAccountManager);
if (mpContactList)
commit b870f1420ea926f231502272eec08c45e9da4cc5
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Tue Aug 7 10:59:58 2012 +0200
tubes: make contacts dialog a member of Collaboration class
Change-Id: Ib50b550f9486bc1abfeefd5d1aac57c0d712ec04
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index f0c7812..d4b0253 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -32,11 +32,8 @@
#include "docsh.hxx"
#include "docfunc.hxx"
#include "sccollaboration.hxx"
-#include <tubes/contacts.hxx>
#include <tubes/manager.hxx>
-#include <vector>
-
void ScDocFuncSend::RecvMessage( const rtl::OString &rString )
{
try {
@@ -127,7 +124,7 @@ sal_Bool ScDocFuncSend::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& r
mpCollaboration->SaveAndSendFile( NULL, rText );
if ( rtl::OUString( rText ) == "contacts" )
- tubes::createContacts( rDocShell.GetCollaboration() );
+ mpCollaboration->DisplayContacts();
return true; // needs some code auditing action
}
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 4850229..c0c4ad9 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -54,7 +54,6 @@
#ifdef ENABLE_TELEPATHY
#include "sccollaboration.hxx"
-#include <tubes/contacts.hxx>
#endif
#define IS_EDITMODE() GetViewData()->HasEditView( GetViewData()->GetActivePart() )
@@ -118,7 +117,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
case SID_COLLABORATION:
#ifdef ENABLE_TELEPATHY
- tubes::createContacts( GetViewData()->GetDocShell()->GetCollaboration() );
+ GetViewData()->GetDocShell()->GetCollaboration()->DisplayContacts();
#endif
break;
diff --git a/tubes/Package_inc.mk b/tubes/Package_inc.mk
index be6266a..3ed92f9 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/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 15d59d4..8378dda 100644
--- a/tubes/inc/tubes/collaboration.hxx
+++ b/tubes/inc/tubes/collaboration.hxx
@@ -21,6 +21,8 @@ typedef struct _TpContact TpContact;
class TUBES_DLLPUBLIC Collaboration
{
TeleConference* mpConference;
+ // This is in fact of type TubeContacts* from anonymous namespace
+ void* mpContacts;
public:
Collaboration();
virtual ~Collaboration();
@@ -33,6 +35,7 @@ public:
TUBES_DLLPRIVATE TeleConference* GetConference() const;
TUBES_DLLPRIVATE sal_uInt64 GetId() const;
+ void DisplayContacts();
void SendFile( TpContact* pContact, const OUString& rURL ) const;
void SendPacket( const OString& rPacket ) const;
void SetConference( TeleConference* pConference );
diff --git a/tubes/inc/tubes/contacts.hxx b/tubes/inc/tubes/contacts.hxx
deleted file mode 100644
index a2b1f7f..0000000
--- a/tubes/inc/tubes/contacts.hxx
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Major Contributor(s):
- * Copyright (C) 2012 Michael Meeks <michael.meeks at suse.com> (initial developer)
- *
- * All Rights Reserved.
- *
- * For minor contributions see the git repository.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
- */
-
-#include "sal/config.h"
-#include <tubes/tubesdllapi.h>
-
-class Collaboration;
-
-namespace tubes {
- void TUBES_DLLPUBLIC createContacts( Collaboration* pCollaboration );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx
index ab5e39a..533233a 100644
--- a/tubes/inc/tubes/manager.hxx
+++ b/tubes/inc/tubes/manager.hxx
@@ -39,6 +39,7 @@
#define LIBO_TUBES_DBUS_PATH "/org/libreoffice/calc"
namespace osl { class Mutex; }
+class Collaboration;
class ContactList;
class TeleConference;
class TeleManagerImpl;
@@ -128,6 +129,11 @@ public:
/** Get a conference with current UUID to set a session. */
TUBES_DLLPUBLIC static TeleConference* getConference();
+ static void registerCollaboration( Collaboration* pCollaboration );
+ static void unregisterCollaboration( Collaboration* pCollaboration );
+ /** Display contact list dialog for all documents. */
+ static void displayAllContacts();
+
static void registerDemoConference( TeleConference* pConference );
static void unregisterDemoConference( TeleConference* pConference );
/** Broadcast packet to all conferences. Used for demo mode. */
diff --git a/tubes/source/collaboration.cxx b/tubes/source/collaboration.cxx
index 846f5dc..65c24c5 100644
--- a/tubes/source/collaboration.cxx
+++ b/tubes/source/collaboration.cxx
@@ -10,13 +10,18 @@
#include <tubes/collaboration.hxx>
#include <tubes/conference.hxx>
+#include <tubes/manager.hxx>
-Collaboration::Collaboration()
+Collaboration::Collaboration() :
+ mpConference( NULL ),
+ mpContacts( NULL )
{
+ TeleManager::registerCollaboration( this );
}
Collaboration::~Collaboration()
{
+ TeleManager::unregisterCollaboration( this );
if (mpConference)
mpConference->close();
}
diff --git a/tubes/source/contact-list.cxx b/tubes/source/contact-list.cxx
index b238a2c..163f4e0 100644
--- a/tubes/source/contact-list.cxx
+++ b/tubes/source/contact-list.cxx
@@ -101,16 +101,13 @@ bool tb_contact_is_online( TpContact *contact )
return tb_presence_is_online (tp_contact_get_presence_type (contact));
}
-namespace tubes {
- void reDrawAllContacts();
-}
static void presence_changed_cb( TpContact* /* contact */,
guint /* type */,
gchar* /* status */,
gchar* /* message */,
gpointer /* pContactList*/ )
{
- tubes::reDrawAllContacts();
+ TeleManager::displayAllContacts();
}
AccountContactPairV ContactList::getContacts()
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
index 508322a..c6037f4 100644
--- a/tubes/source/contacts.cxx
+++ b/tubes/source/contacts.cxx
@@ -35,7 +35,6 @@
#include <tubes/conference.hxx>
#include <tubes/collaboration.hxx>
#include <tubes/contact-list.hxx>
-#include <tubes/contacts.hxx>
#include <tubes/manager.hxx>
#include <unotools/confignode.hxx>
#include <vcl/fixed.hxx>
@@ -282,34 +281,13 @@ IMPL_LINK_NOARG( TubeContacts, BtnListenHdl )
return 0;
}
-// Mapping contacts dialog instance for each document
-typedef std::map< sal_uInt64, TubeContacts* > DialogsMap;
-static DialogsMap aDialogsMap;
-
-TubeContacts* ContactsFactory( Collaboration* pCollaboration )
-{
- sal_uInt64 Id = pCollaboration->GetId();
- if (aDialogsMap.find( Id ) == aDialogsMap.end())
- aDialogsMap[ Id ] = new TubeContacts( pCollaboration );
- return aDialogsMap[ Id ];
-}
-
} // anonymous namespace
-namespace tubes {
-void createContacts( Collaboration* pCollaboration )
+void Collaboration::DisplayContacts()
{
- TubeContacts* pContacts = ContactsFactory( pCollaboration );
- pContacts->Populate();
-}
-
-void reDrawAllContacts()
-{
- for (DialogsMap::const_iterator it = aDialogsMap.begin();
- it != aDialogsMap.end(); ++it)
- it->second->Populate();
-}
-
+ if (!mpContacts)
+ mpContacts = new TubeContacts( this );
+ reinterpret_cast<TubeContacts*> (mpContacts)->Populate();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index 3d87f19..4d0fc66 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -103,6 +103,8 @@ public:
MapStringConference maAcceptedConferences;
typedef std::set< TeleConference* > DemoConferences;
DemoConferences maDemoConferences;
+ typedef std::set< Collaboration* > Collaborations;
+ Collaborations maCollaborations;
TeleManagerImpl();
~TeleManagerImpl();
@@ -225,6 +227,23 @@ TeleConference* TeleManager::getConference()
return pConference;
}
+void TeleManager::registerCollaboration( Collaboration* pCollaboration )
+{
+ pImpl->maCollaborations.insert( pCollaboration );
+}
+
+void TeleManager::unregisterCollaboration( Collaboration* pCollaboration )
+{
+ pImpl->maCollaborations.erase( pCollaboration );
+}
+
+void TeleManager::displayAllContacts()
+{
+ for (TeleManagerImpl::Collaborations::iterator it = pImpl->maCollaborations.begin();
+ it != pImpl->maCollaborations.end(); ++it)
+ (*it)->DisplayContacts();
+}
+
void TeleManager::registerDemoConference( TeleConference* pConference )
{
pImpl->maDemoConferences.insert( pConference );
commit 34c6421bddddb2128dd59acc867f73739ac1ca62
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Mon Aug 6 15:29:17 2012 +0200
tubes: handle TeleConference internally in Collaboration
Hopefully, this simplifies the tubes <-> app interface
Change-Id: I8933fde490941b259d5d133972db26a09ab380d5
diff --git a/sc/source/ui/collab/sccollaboration.cxx b/sc/source/ui/collab/sccollaboration.cxx
index e9c4ea0..78e9721 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 6b59d53..f0c7812 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 07160c8..676fc78 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 228c6da..eb28806 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 fef1657..aa87507 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 811f1cf..cc71fe9 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 2ff9ab2..b9edab9 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 1aff70b..be6266a 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 65595cd..15d59d4 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 3f600e0..1514b14 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 0000000..846f5dc
--- /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 88109df..bf33ebd 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 62cb7bf..508322a 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 f371497..3d87f19 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;
}
More information about the Libreoffice-commits
mailing list