[Libreoffice-commits] .: Branch 'feature/tubes2' - 2 commits - configure.in tubes/inc tubes/source
configure.in |2 tubes/inc/tubes/conference.hxx | 19 + tubes/source/conference.cxx| 149 - 3 files changed, 50 insertions(+), 120 deletions(-) New commits: commit 263dece8f15e448709d6e4753c5287eae368f147 Author: Will Thompson will.thomp...@collabora.co.uk Date: Thu Apr 5 10:53:21 2012 +0100 conference: remove a stray dbus-glib import. This is no longer needed since the switch to using GDBus for the tube connection. diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx index 088bf4b..6841f9a 100644 --- a/tubes/inc/tubes/conference.hxx +++ b/tubes/inc/tubes/conference.hxx @@ -37,7 +37,6 @@ #include boost/enable_shared_from_this.hpp #include rtl/ustring.hxx #include telepathy-glib/telepathy-glib.h -#include dbus/dbus-glib-lowlevel.h #include queue typedef ::std::queueTelePacket TelePacketQueue; commit d157e12e3f204fe41fa37f27e1e6eaf7f29eda20 Author: Will Thompson will.thomp...@collabora.co.uk Date: Sun Apr 1 15:50:20 2012 +0100 tubes: use tp_dbus_tube_channel_offer/accept_async I added these to the recently-released telepathy-glib 0.18.0 mainly to let us simplify the code here. With this new API, tp-glib takes care of waiting for the state changes, creating the GDBusConnection, etc. diff --git a/configure.in b/configure.in index 34a8b8b..ebdf217 100644 --- a/configure.in +++ b/configure.in @@ -8369,7 +8369,7 @@ AC_MSG_CHECKING([whether to enable Telepathy support]) if test $_os != WINNT -a $_os != Darwin -a $enable_telepathy = yes; then ENABLE_TELEPATHY=TRUE AC_MSG_RESULT([yes]) -PKG_CHECK_MODULES( TELEPATHY, telepathy-glib = 0.17.1 glib-2.0 gobject-2.0 gthread-2.0 gio-2.0 dbus-1 dbus-glib-1 ) +PKG_CHECK_MODULES( TELEPATHY, telepathy-glib = 0.18.0 glib-2.0 gobject-2.0 gthread-2.0 gio-2.0 ) else AC_MSG_RESULT([no]) fi diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx index fca6e2e..088bf4b 100644 --- a/tubes/inc/tubes/conference.hxx +++ b/tubes/inc/tubes/conference.hxx @@ -84,20 +84,14 @@ public: boolofferTube(); boolacceptTube(); /// got tube accepted on other end as well? -boolisTubeOpen() const { return meTubeChannelState == TP_TUBE_CHANNEL_STATE_OPEN; } +boolisTubeOpen() const { return mpTube != NULL; } // Only for callbacks. voidsetTubeOfferedHandlerInvoked( bool b ) { mbTubeOfferedHandlerInvoked = b; } boolisTubeOfferedHandlerInvoked() const { return mbTubeOfferedHandlerInvoked; } -boolisTubeChannelStateChangedToOpen() const -{ return meTubeChannelState == TP_TUBE_CHANNEL_STATE_OPEN; }; -voidsetTubeChannelState( TpTubeChannelState eState ) { meTubeChannelState = eState; } - -static void TubeChannelStateChangedHandler(TpChannel*, guint, void*, GObject*); -static void TubeOfferedHandler(TpChannel* pChannel, const gchar* pAddress, const GError* pError, - gpointer pUserData, GObject*pWeakObject); -static void TubeAcceptedHandler(TpChannel* pChannel, const gchar* pAddress, const GError* pError, - gpointer pUserData, GObject*pWeakObject); + +static void TubeOfferedHandler(GObject* pSource, GAsyncResult* pResult, gpointer pUserData); +static void TubeAcceptedHandler(GObject* pSource, GAsyncResult* pResult, gpointer pUserData); static void FTReady( EmpathyFTHandler *handler, GError *error, gpointer user_data); static void methodCallHandler(GDBusConnection* pConnection, @@ -110,9 +104,8 @@ public: void* pUserData); private: -booltryToOpen(); boolspinUntilTubeEstablished(); -boolsetTube( const char* pTube ); +boolsetTube( GDBusConnection* pTube); rtl::OStringmaSessionId; TeleManager*mpManager; @@ -122,7 +115,6 @@ private: GDBusConnection*mpTube; guint maObjectRegistrationId; TelePacketQueue maPacketQueue; -TpTubeChannelState meTubeChannelState; boolmbTubeOfferedHandlerInvoked : 1; diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx index 1cd9248..3df23c6 100644 --- a/tubes/source/conference.cxx +++ b/tubes/source/conference.cxx @@ -142,80 +142,62 @@ static void TeleConference_ChannelCloseHandler( void TeleConference::TubeOfferedHandler( -TpChannel* pBaseChannel, -const gchar*pAddress, -const GError* pError
[Libreoffice-commits] .: Branch 'feature/tubes2' - 4 commits - tubes/inc tubes/source
tubes/inc/tubes/conference.hxx | 39 +++- tubes/inc/tubes/manager.hxx| 14 + tubes/source/conference.cxx| 358 + tubes/source/manager.cxx | 70 +--- 4 files changed, 242 insertions(+), 239 deletions(-) New commits: commit 0af429b1446fecc82e679519755350df984c6cae Author: Will Thompson will.thomp...@collabora.co.uk Date: Sun Apr 1 15:30:39 2012 +0100 tubes: make conference hold a TpDBusTubeChannel It already was, actually. :) diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx index 118def6..fca6e2e 100644 --- a/tubes/inc/tubes/conference.hxx +++ b/tubes/inc/tubes/conference.hxx @@ -49,7 +49,7 @@ class TeleConference : public boost::enable_shared_from_thisTeleConference { public: -TeleConference( TeleManager* pManager, TpAccount *pAccount, TpChannel* pChannel, const rtl::OString rSessionId ); +TeleConference( TeleManager* pManager, TpAccount *pAccount, TpDBusTubeChannel* pChannel, const rtl::OString rSessionId ); ~TeleConference(); /// Close channel and call finalize() @@ -79,8 +79,8 @@ public: // --- following only to be called only by manager's callbacks --- // TODO: make friends instead -voidsetChannel( TpAccount* pAccount, TpChannel* pChannel ); -TpChannel* getChannel() const { return mpChannel; } +voidsetChannel( TpAccount* pAccount, TpDBusTubeChannel* pChannel ); +TpDBusTubeChannel* getChannel() const { return mpChannel; } boolofferTube(); boolacceptTube(); /// got tube accepted on other end as well? @@ -117,7 +117,7 @@ private: rtl::OStringmaSessionId; TeleManager*mpManager; TpAccount* mpAccount; -TpChannel* mpChannel; +TpDBusTubeChannel* mpChannel; gchar* mpAddress; GDBusConnection*mpTube; guint maObjectRegistrationId; diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx index 9c2e8d7..1cd9248 100644 --- a/tubes/source/conference.cxx +++ b/tubes/source/conference.cxx @@ -142,7 +142,7 @@ static void TeleConference_ChannelCloseHandler( void TeleConference::TubeOfferedHandler( -TpChannel* pChannel, +TpChannel* pBaseChannel, const gchar*pAddress, const GError* pError, gpointerpUserData, @@ -168,8 +168,9 @@ void TeleConference::TubeOfferedHandler( if (!pAddress) return; +TpDBusTubeChannel* pChannel = TP_DBUS_TUBE_CHANNEL( pBaseChannel); SAL_WARN_IF( pChannel != pConference-getChannel(), tubes, TeleConference::TubeOfferedHandler: not my channel); -if (pChannel != pConference-getChannel()) +if ((pChannel) != pConference-getChannel()) return; pConference-mpAddress = g_strdup( pAddress ); @@ -192,7 +193,7 @@ bool TeleConference::tryToOpen() } void TeleConference::TubeChannelStateChangedHandler( -TpChannel* pChannel, +TpChannel* pBaseChannel, guint nState, gpointerpUserData, GObject*/*weak_object*/ @@ -207,6 +208,7 @@ void TeleConference::TubeChannelStateChangedHandler( if (!pConference) return; +TpDBusTubeChannel* pChannel = TP_DBUS_TUBE_CHANNEL( pBaseChannel); SAL_WARN_IF( pChannel != pConference-getChannel(), tubes, TeleConference::TubeChannelStateChangedHandler: not my channel); if (pChannel != pConference-getChannel()) @@ -217,7 +219,7 @@ void TeleConference::TubeChannelStateChangedHandler( } -TeleConference::TeleConference( TeleManager* pManager, TpAccount* pAccount, TpChannel* pChannel, const rtl::OString rSessionId ) +TeleConference::TeleConference( TeleManager* pManager, TpAccount* pAccount, TpDBusTubeChannel* pChannel, const rtl::OString rSessionId ) : maSessionId( rSessionId ), mpManager( pManager), @@ -238,7 +240,7 @@ TeleConference::~TeleConference() } -void TeleConference::setChannel( TpAccount *pAccount, TpChannel* pChannel ) +void TeleConference::setChannel( TpAccount *pAccount, TpDBusTubeChannel* pChannel ) { OSL_ENSURE( !mpChannel, TeleConference::setChannel: already have channel); if (mpChannel) @@ -254,7 +256,7 @@ void TeleConference::setChannel( TpAccount *pAccount, TpChannel* pChannel ) GError* pError = NULL; TpProxySignalConnection* pProxySignalConnection = tp_cli_channel_interface_tube_connect_to_tube_channel_state_changed( -mpChannel, +TP_CHANNEL( mpChannel), TeleConference::TubeChannelStateChangedHandler, this, NULL, @@ -295,7 +297,7 @@ bool TeleConference::acceptTube() if (!mpChannel || mpTube) return false
[Libreoffice-commits] .: Branch 'feature/tubes2' - 2 commits - sc/source tubes/inc tubes/qa tubes/source
sc/source/ui/collab/collab.cxx |4 +-- sc/source/ui/collab/sendfunc.cxx |5 ++-- sc/source/ui/inc/collab.hxx |2 - tubes/inc/tubes/manager.hxx |7 -- tubes/qa/test_manager.cxx|4 +-- tubes/source/manager.cxx | 40 --- 6 files changed, 50 insertions(+), 12 deletions(-) New commits: commit 602fae9a0d2984790b1c5be8ac607990f4168202 Author: Will Thompson will.thomp...@collabora.co.uk Date: Mon Mar 26 14:40:17 2012 +0100 tubes: work around âWe are supposed to handle only one channelâ bug. This is the bug which breaks the first request after the offerer signed in. diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx index c75e3c1..8ba3a02 100644 --- a/tubes/inc/tubes/manager.hxx +++ b/tubes/inc/tubes/manager.hxx @@ -221,6 +221,8 @@ public: static void TransferDone( EmpathyFTHandler *handler, TpFileTransferChannel *, gpointer user_data); private: +voidensureLegacyChannel( TpAccount* pAccount, TpContact* pBuddy ); + TeleConferenceVectormaConferences; boolmbAcceptIncoming; diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index 21d0d41..73895f9 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -592,11 +592,41 @@ bool TeleManager::startGroupSession( const rtl::OUString rUConferenceRoom, cons #endif +void TeleManager::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 + * request a tube to a contact on an account, you actually get two channels + * back: the tube you asked for, along with a legacy Channel.Type.Tubes + * object. This breaks create_and_handle_channel_async(), which expects to + * only get one channel back. + * + * To work around this, we make sure the legacy Tubes channel already + * exists before we request the channel we actually want. We don't actually + * have to wait for this request to succeedâwe fire it off and forget about + * it. + */ +GHashTable* pRequest = tp_asv_new( +TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TUBES, +TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, TP_TYPE_HANDLE, TP_HANDLE_TYPE_CONTACT, +TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, tp_contact_get_identifier (pBuddy), +NULL); +TpAccountChannelRequest* pChannelRequest = tp_account_channel_request_new( +pAccount, pRequest, TP_USER_ACTION_TIME_NOT_USER_ACTION); +tp_account_channel_request_ensure_channel_async( pChannelRequest, NULL, +NULL, NULL, NULL ); +g_object_unref( pChannelRequest ); +g_hash_table_unref( pRequest ); +} + + /* TODO: factor out common code with startGroupSession() */ bool TeleManager::startBuddySession( TpAccount *pAccount, TpContact *pBuddy ) { INFO_LOGGER( TeleManager::startBuddySession); +ensureLegacyChannel( pAccount, pBuddy ); + OString aSessionId( TeleManager::createUuid()); TeleConferencePtr pConference( new TeleConference( this, NULL, NULL, aSessionId)); commit 2ab2ac613510cf16c4cdfb8f2ac31815de56956e Author: Will Thompson will.thomp...@collabora.co.uk Date: Mon Mar 26 14:22:25 2012 +0100 tubes: quick hack to allow running two instances To record a screencast, I wanted to get two instances of LibreOffice running in the same session. But the Client object(s) claim D-Bus names, so initializing the second instance failed. This patch changes things so that if LIBO_TUBES=master, no Client objects are created. As a result, only the slave can receive files. diff --git a/sc/source/ui/collab/collab.cxx b/sc/source/ui/collab/collab.cxx index 4c02045..a03f4f8 100644 --- a/sc/source/ui/collab/collab.cxx +++ b/sc/source/ui/collab/collab.cxx @@ -66,9 +66,9 @@ void ScCollaboration::packetReceivedCallback( TeleConference *pConference, TeleP sigPacketReceived( pConference, aString); } -bool ScCollaboration::initManager() +bool ScCollaboration::initManager(bool bAcceptIncoming) { -mpManager = TeleManager::get(); +mpManager = TeleManager::get(bAcceptIncoming); mpManager-sigPacketReceived.connect( boost::bind( ScCollaboration::packetReceivedCallback, this, _1, _2 )); mpManager-connect(); diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index 0f74209..3dddabf 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -557,8 +557,9 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc() boost::bind( ScDocFuncRecv::packetReceived, pReceiver, _1, _2 )); pCollab-sigFileReceived.connect( boost::bind( ScDocFuncRecv::fileReceived, pReceiver, _1)); -bOk = bOk pCollab-initManager
[Libreoffice-commits] .: Branch 'feature/tubes2' - 3 commits - tubes/inc tubes/qa tubes/source
tubes/inc/tubes/conference.hxx |2 tubes/inc/tubes/file-transfer-helper.h |3 tubes/inc/tubes/manager.hxx|9 ++ tubes/qa/test_manager.cxx | 30 ++ tubes/source/conference.cxx|5 - tubes/source/file-transfer-helper.c| 29 +- tubes/source/manager.cxx | 148 +++-- 7 files changed, 212 insertions(+), 14 deletions(-) New commits: commit 7b662a91f6452f22265fb99ff782539f43dd2095 Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 08:57:52 2012 + tubes: remove account without account?? warning It's completely kosher for Telepathy accounts not to have a parameter called 'account' (which really means 'username'): Salut (link-local XMPP) accounts do not, for example, because you don't need to specify a username. tp_account_get_normalized_name() gets your contact ID for an account, which is really what we're looking for here. diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index b479d5d..cb9e5d7 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -668,9 +668,7 @@ TpAccount* TeleManager::getAccount( const rtl::OString rAccountID ) for (GList* pA = pAccounts; pA; pA = pA-next) { TpAccount* pAcc = TP_ACCOUNT( pA-data); -const GHashTable* pPar = tp_account_get_parameters( pAcc); -const gchar* pID = tp_asv_get_string( pPar, account); -SAL_WARN_IF( !pID, tubes, TeleManager::getMyAccount: account without account??); +const gchar* pID = tp_account_get_normalized_name( pAcc); if (pID rAccountID == pID) { pAccount = pAcc; commit 25c39927fd338283d2441694eb00b7e595b68f4c Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 08:53:21 2012 + tubes: implement receiving files. diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx index 7428bcb..7c5fd30 100644 --- a/tubes/inc/tubes/conference.hxx +++ b/tubes/inc/tubes/conference.hxx @@ -94,6 +94,8 @@ public: { return mbTubeChannelStateChangedHandlerInvoked; } voidsetTubeChannelState( TpTubeChannelState eState ) { meTubeChannelState = eState; } +static void FTReady( EmpathyFTHandler *handler, GError *error, gpointer user_data); + private: rtl::OStringmaSessionId; diff --git a/tubes/inc/tubes/file-transfer-helper.h b/tubes/inc/tubes/file-transfer-helper.h index fe0678f..8960d14 100644 --- a/tubes/inc/tubes/file-transfer-helper.h +++ b/tubes/inc/tubes/file-transfer-helper.h @@ -90,6 +90,9 @@ void empathy_ft_handler_new_outgoing ( gint64 action_time, EmpathyFTHandlerReadyCallback callback, gpointer user_data); +void empathy_ft_handler_set_service_name ( +EmpathyFTHandler *self, +const gchar *service_name); void empathy_ft_handler_new_incoming (TpFileTransferChannel *channel, EmpathyFTHandlerReadyCallback callback, diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx index 97f5de8..0d2ef3e 100644 --- a/tubes/inc/tubes/manager.hxx +++ b/tubes/inc/tubes/manager.hxx @@ -140,6 +140,9 @@ public: voidsendFile( rtl::OUString localUri, TeleConference::FileSentCallback pCallback, void* pUserData); +typedef void (*FileReceivedCallback)( rtl::OUString localUri, void* pUserData ); +voidsetFileReceivedCallback( FileReceivedCallback callback, void* pUserData ); + /// Only for use with MainLoopFlusher GMainLoop* getMainLoop() const; @@ -197,6 +200,9 @@ public: TpAccount* getAccount( const rtl::OString rAccountID ); +/* Callbacks; not for use outside this class. */ +static void TransferDone( EmpathyFTHandler *handler, TpFileTransferChannel *, gpointer user_data); + private: TeleConferenceVectormaConferences; @@ -207,6 +213,9 @@ private: static sal_uInt32 nRefCount; static rtl::OString aNameSuffix; +FileReceivedCallbackmpFileReceivedCallback; +void *mpFileReceivedCallbackData; + friend class TeleManagerImpl; // access to mutex TUBES_DLLPRIVATE static ::osl::Mutex GetMutex(); diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index d08190d..540728a 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -70,6 +70,7 @@ public: void spinMainLoop(); static void FileSent( bool success, void *user_data); +static void FileReceived( rtl::OUString aUri, void *user_data); // Order is significant. CPPUNIT_TEST_SUITE( TestTeleTubes ); @@ -102,6 +103,7 @@ private: rtl::OString maAccepterIdentifier; bool maFileSentSuccess; +rtl::OUString maFileReceivedUri; }; // static, not members, so
[Libreoffice-commits] .: Branch 'feature/tubes2' - 4 commits - tubes/inc tubes/qa tubes/source
tubes/inc/tubes/contact-list.hxx |5 tubes/inc/tubes/manager.hxx |8 ++- tubes/qa/test_manager.cxx| 12 +- tubes/source/contact-list.cxx| 43 -- tubes/source/manager.cxx | 44 ++- 5 files changed, 53 insertions(+), 59 deletions(-) New commits: commit b0e448bda00bfd8a1632bb596deef14b0ab1a7a9 Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 10:24:11 2012 + tubes: add a hack to give time for caps to propagate :( diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index d3eeefe..e503b03 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -602,6 +602,12 @@ bool TeleManager::startBuddySession( TpAccount *pAccount, TpContact *pBuddy ) } +static gboolean timeout_cb( void* pData) +{ +g_main_loop_quit( reinterpret_castGMainLoop*( pData)); +return FALSE; +} + void TeleManager::prepareAccountManager() { INFO_LOGGER( TeleManager::prepareAccountManager); @@ -634,6 +640,11 @@ void TeleManager::prepareAccountManager() tp_proxy_prepare_async( pImpl-mpAccountManager, NULL, TeleManager_AccountManagerReadyHandler, this); iterateLoop( TeleManager::isAccountManagerReadyHandlerInvoked); + +/* Hack to make sure that our capabilities update from one account has + * propagated via the network and back to the other account. Sorry. */ +g_timeout_add_seconds( 2, timeout_cb, pImpl-mpLoop); +g_main_loop_run( pImpl-mpLoop); } commit 3620eefce92c42a96e3390d525a2d145e4e944bf Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 10:18:41 2012 + fixup! diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index 4e588ad..c2fbe89 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -79,9 +79,9 @@ public: CPPUNIT_TEST( testSetupManager2 ); CPPUNIT_TEST( testConnect1 ); CPPUNIT_TEST( testConnect2 ); -CPPUNIT_TEST( testContactList ); CPPUNIT_TEST( testPrepareAccountManager1 ); CPPUNIT_TEST( testPrepareAccountManager2 ); +CPPUNIT_TEST( testContactList ); CPPUNIT_TEST( testStartBuddySession1 ); CPPUNIT_TEST( testStartBuddySession2 ); CPPUNIT_TEST( testSendPacket ); commit c18eb9f45c89a6a568e49836a2530670dbf79ffa Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 10:18:25 2012 + WIP diff --git a/tubes/inc/tubes/contact-list.hxx b/tubes/inc/tubes/contact-list.hxx index bf1e0f7..a17b110 100644 --- a/tubes/inc/tubes/contact-list.hxx +++ b/tubes/inc/tubes/contact-list.hxx @@ -42,12 +42,9 @@ typedef ::std::vector AccountContactPair AccountContactPairV; class TUBES_DLLPUBLIC ContactList { public: -ContactList(); +ContactList(TpAccountManager *pAccountManager); ~ContactList(); -typedef void (*PrepareCallback)( GError *errorOr0, void *user_data ); -voidprepare( PrepareCallback callback, void *user_data ); - AccountContactPairV getContacts(); private: diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx index aa6a027..3d557ad 100644 --- a/tubes/inc/tubes/manager.hxx +++ b/tubes/inc/tubes/manager.hxx @@ -33,6 +33,7 @@ #include tubes/tubesdllapi.h #include tubes/conference.hxx #include tubes/packet.hxx +#include tubes/contact-list.hxx #include rtl/ustring.hxx #include salhelper/thread.hxx #include rtl/ref.hxx @@ -82,7 +83,7 @@ public: TeleManager( const Link rLink, bool bCreateOwnGMainLoop = false ); ~TeleManager(); -/** Prepare the Telepathy Account Manager. +/** Prepare the Telepathy Account Manager. Requires connect() to have succeeded. Invokes an async call that is not ready until meAccountManagerStatus is set! Until that is AMS_PREPARED nothing else will work. @@ -92,6 +93,11 @@ public: voidprepareAccountManager(); AccountManagerStatusgetAccountManagerStatus() const; +/** Fetches the contact list. Returns 0 before connect() is called successfully. +Is non-functional until prepareAccountManager(). + */ +ContactList*getContactList(); + #if 0 /** Start a group session in a MUC. diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index 31148ef..4e588ad 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -168,14 +168,14 @@ void TestTeleTubes::spinMainLoop() void TestTeleTubes::testContactList() { -ContactList cl; -cl.prepare( TeleTestTubes_ContactListPrepared, this ); -spinMainLoop(); +CPPUNIT_ASSERT( mpManager1); +CPPUNIT_ASSERT( mpManager1-getAccountManagerStatus() == TeleManager::AMS_PREPARED); + +ContactList *cl = mpManager1-getContactList(); -/* Okay, now everything's prepared, we can get contacts synchronously. */ AccountContactPairV pairs; -pairs = cl.getContacts(); +pairs = cl
[Libreoffice-commits] .: Branch 'feature/tubes2' - 3 commits - tubes/qa tubes/source
tubes/qa/test_manager.cxx | 13 +++-- tubes/source/contact-list.cxx |5 - 2 files changed, 7 insertions(+), 11 deletions(-) New commits: commit 4e2123df38772634684fea53b404274d3fac9ea9 Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 11:22:05 2012 + tubes test: remove an unused function diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index 236b23d..8ca3b9f 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -154,15 +154,6 @@ TestTeleTubes::~TestTeleTubes() mpMainLoop = NULL; } -static void TeleTestTubes_ContactListPrepared( GError *errorOr0, void *user_data ) -{ -TestTeleTubes *self = reinterpret_castTestTeleTubes *(user_data); - -CPPUNIT_ASSERT( errorOr0 == 0 ); - -g_main_loop_quit (self-mpMainLoop); -} - void TestTeleTubes::spinMainLoop() { g_main_loop_run( mpMainLoop); commit 48acf01da950702459e64438f44510088ec5e518 Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 11:20:30 2012 + tubes test: disable testFailAlways() diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index c2fbe89..236b23d 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -91,7 +91,9 @@ public: CPPUNIT_TEST( testDestroyManager1 ); CPPUNIT_TEST( testDestroyManager2 ); CPPUNIT_TEST( testDestroyAccepterContact ); -CPPUNIT_TEST( testFailAlways ); // need failure to display SAL_LOG, comment out for real builds +#if 0 +CPPUNIT_TEST( testFailAlways ); // test failure displays SAL_LOG, uncomment for debugging +#endif CPPUNIT_TEST_SUITE_END(); private: commit 2458e00c88a9978f66b95413cb2e68606bb9b9d4 Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 11:18:38 2012 + tubes: skip self contact You should only have yourself on your contact list on rare occasions, but⦠diff --git a/tubes/source/contact-list.cxx b/tubes/source/contact-list.cxx index 4cedc50..317f5d7 100644 --- a/tubes/source/contact-list.cxx +++ b/tubes/source/contact-list.cxx @@ -92,6 +92,7 @@ AccountContactPairV ContactList::getContacts() { TpAccount *account = reinterpret_castTpAccount *(accounts-data); TpConnection *connection = tp_account_get_connection (account); + TpContact *self; GPtrArray *contacts; guint i; @@ -103,13 +104,15 @@ AccountContactPairV ContactList::getContacts() TP_CONTACT_LIST_STATE_SUCCESS) continue; + self = tp_connection_get_self_contact (connection); contacts = tp_connection_dup_contact_list (connection); for (i = 0; i contacts-len; i++) { TpContact *contact = reinterpret_castTpContact *(g_ptr_array_index (contacts, i)); - if (contact_supports_libo_dtube (contact)) + if (contact != self + contact_supports_libo_dtube (contact)) { g_object_ref (account); g_object_ref (contact); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes2' - tubes/qa tubes/source
tubes/qa/test_manager.cxx |2 +- tubes/source/manager.cxx |8 +++- 2 files changed, 8 insertions(+), 2 deletions(-) New commits: commit a0b9d1595f9cbabe29d63b85590cc66313eba203 Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 11:31:26 2012 + Use a slightly nicer filename diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index 8ca3b9f..a7e690f 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -331,7 +331,7 @@ void TestTeleTubes::testSendFile() CPPUNIT_ASSERT( maFileSentSuccess); CPPUNIT_ASSERT_MESSAGE( OUStringToOString( maFileReceivedUri, RTL_TEXTENCODING_UTF8).getStr(), -maFileReceivedUri == file:///tmp/fixme.ods); +maFileReceivedUri == file:///tmp/LibreOffice-collab-test-config.ini); } void TestTeleTubes::testFlushLoops() diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index cccd62c..25f879d 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -212,7 +212,13 @@ TeleManager_IncomingHandlerReady ( return; } -GFile *pDestination = g_file_new_for_uri( file:///tmp/fixme.ods); +/* The filename suggested by the sender, which in our case is the last bit + * of whatever URI got passed to ::sendFile() + */ +const char* pFileName = empathy_ft_handler_get_filename( pHandler); +char* pLocalUri = g_strdup_printf( file:///tmp/LibreOffice-collab-%s, pFileName); +GFile *pDestination = g_file_new_for_uri( pLocalUri); +g_free( pLocalUri); empathy_ft_handler_incoming_set_destination( pHandler, pDestination); g_object_unref( pDestination); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes2' - 3 commits - sc/source tubes/inc tubes/qa tubes/source
sc/source/ui/collab/collab.cxx |3 +++ tubes/inc/tubes/conference.hxx |3 ++- tubes/qa/test_manager.cxx | 11 --- tubes/source/conference.cxx| 17 ++--- tubes/source/manager.cxx |2 -- 5 files changed, 27 insertions(+), 9 deletions(-) New commits: commit 1e8d2df6c52ad41375982dac8d4b75d776544161 Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 14:24:56 2012 + tubes: push sent packets onto the incoming queue. This ensures that our changes are echoed locally as well as being sent to the peer. diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx index 8a891d5..35812bb 100644 --- a/tubes/inc/tubes/conference.hxx +++ b/tubes/inc/tubes/conference.hxx @@ -63,13 +63,14 @@ public: /** @param rPacket non-const on purpose, see TelePacket::getData() */ -boolsendPacket( TelePacket rPacket ) const; +boolsendPacket( TelePacket rPacket ); /** Pop a received packet. */ TUBES_DLLPUBLIC boolpopPacket( TelePacket rPacket ); /** Queue incoming data as TelePacket */ voidqueue( const char* pDBusSender, const char* pPacket, int nSize ); +voidqueue( TelePacket rPacket ); typedef void (*FileSentCallback)( bool aSuccess, void* pUserData); diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index a7e690f..f76353d 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -279,6 +279,11 @@ void TestTeleTubes::testReceivePacket() TelePacket aPacket( , RTL_CONSTASCII_STRINGPARAM( from 1 to 2)); TelePacket aReceived; sal_uInt32 nReceivedPackets = 0; +/* We expect to get every packet we send pushed onto the queue to be echoed + * locally; and since we are also listening at the other end, we expect + * to receive a copy of each packet as well. + */ +sal_uInt32 nExpectedPackets = nSentPackets * 2; bool bOk; do { @@ -291,10 +296,10 @@ void TestTeleTubes::testReceivePacket() CPPUNIT_ASSERT( aPacket == aReceived); } } while (bOk); -if (nReceivedPackets nSentPackets) +if (nReceivedPackets nExpectedPackets) mpManager1-iterateLoop(); -} while (nReceivedPackets nSentPackets); -CPPUNIT_ASSERT( nReceivedPackets == nSentPackets); +} while (nReceivedPackets nExpectedPackets); +CPPUNIT_ASSERT( nReceivedPackets == nExpectedPackets); } void TestTeleTubes::FileSent( bool success, void *user_data) diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx index d48807d..4e218b8 100644 --- a/tubes/source/conference.cxx +++ b/tubes/source/conference.cxx @@ -400,7 +400,7 @@ void TeleConference::finalize() } -bool TeleConference::sendPacket( TelePacket rPacket ) const +bool TeleConference::sendPacket( TelePacket rPacket ) { INFO_LOGGER( TeleConference::sendPacket); @@ -432,21 +432,32 @@ bool TeleConference::sendPacket( TelePacket rPacket ) const bool bSent = dbus_connection_send( mpTube, pMessage, NULL); SAL_WARN_IF( !bSent, tubes, TeleConference::sendPacket: not sent); + +/* FIXME: need to impose an ordering on packets. */ +queue( rPacket ); + dbus_message_unref( pMessage); return bSent; } -void TeleConference::queue( const char* pDBusSender, const char* pPacketData, int nPacketSize ) +void TeleConference::queue( TelePacket rPacket ) { INFO_LOGGER( TeleConference::queue); -maPacketQueue.push( TelePacket( pDBusSender, pPacketData, nPacketSize)); +maPacketQueue.push( rPacket); getManager()-callbackOnRecieved( this); } +void TeleConference::queue( const char* pDBusSender, const char* pPacketData, int nPacketSize ) +{ +TelePacket aPacket( pDBusSender, pPacketData, nPacketSize ); +queue( aPacket ); +} + + class SendFileRequest { public: SendFileRequest( TeleConference *pSelf, commit 79919ef4ebb080f3d01b5024aac465fb90462bb0 Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 14:19:11 2012 + tubes: delete some loop-spinning debug diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index f9ca143..5bd0f62 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -864,7 +864,6 @@ rtl::OString TeleManager::getFullObjectPath() void TeleManager::iterateLoop() { GMainContext* pContext = getMainContext(); -SAL_INFO( tubes.loop, TeleManager::iterateLoop: once); g_main_context_iteration( pContext, TRUE); } @@ -906,7 +905,6 @@ void TeleManager::flushLoop() const GMainContext* pContext = g_main_loop_get_context( pImpl-mpLoop); while (g_main_context_iteration( pContext, FALSE)) { -SAL_INFO( tubes.loop, TeleManager::flushLoop); } } } commit 8cf573e82ba33a43ce07a3dcc274f00c9ea7e175 Author
[Libreoffice-commits] .: Branch 'feature/tubes2' - 5 commits - sc/source tubes/inc tubes/qa tubes/source
sc/source/ui/collab/collab.cxx | 22 + sc/source/ui/collab/sendfunc.cxx |8 ++-- sc/source/ui/inc/collab.hxx | 15 ++--- tubes/inc/tubes/manager.hxx | 56 ++--- tubes/qa/test_manager.cxx| 20 tubes/source/contact-list.cxx|1 tubes/source/manager.cxx | 65 --- 7 files changed, 103 insertions(+), 84 deletions(-) New commits: commit 513b203bfa7deea7c2cdc68373bb729fe2caf835 Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 16:39:43 2012 + tubes: add a shared TeleManager singleton Yes, this is in addition to the existing TeleManagerImpl singleton. This class needs to be properly split in half: one Manager part from which the UI can request new sessions and which signals the appearance of new incoming sessions, and another Session part representing the shared editing session (which in turn owns one or more Conferences, which owns exactly one tube, as now). The Manager will dispatch incoming files to the appropriate Conference by UUID or similar. But for now, Michael is opening a new window with the received file, so we want incoming and outgoing events to go to both windows so that it works well enough for a demo. diff --git a/sc/source/ui/collab/collab.cxx b/sc/source/ui/collab/collab.cxx index 35fa9b1..cf8777c 100644 --- a/sc/source/ui/collab/collab.cxx +++ b/sc/source/ui/collab/collab.cxx @@ -47,7 +47,9 @@ ScCollaboration::~ScCollaboration() g_object_unref( mpAccount); if (mpContact) g_object_unref( mpContact); -delete mpManager; + +mpManager-unref(); +mpManager = NULL; } @@ -75,13 +77,13 @@ void ScCollaboration::packetReceivedCallback( TeleConference *pConference ) bool ScCollaboration::initManager() { -mpManager = new TeleManager(); +mpManager = TeleManager::get(); mpManager-sigPacketReceived.connect( boost::bind( ScCollaboration::packetReceivedCallback, this, _1 )); -bool bOk = mpManager-connect(); +mpManager-connect(); mpManager-prepareAccountManager(); mpManager-setFileReceivedCallback( file_recv_cb, (void *)this ); -return bOk; +return true; } diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx index f7edbfa..6d26b02 100644 --- a/tubes/inc/tubes/manager.hxx +++ b/tubes/inc/tubes/manager.hxx @@ -80,6 +80,9 @@ public: TeleManager( bool bCreateOwnGMainLoop = false ); ~TeleManager(); +static TeleManager *get(); +voidunref(); + /** Prepare the Telepathy Account Manager. Requires connect() to have succeeded. Invokes an async call that is not ready until meAccountManagerStatus is @@ -227,13 +230,19 @@ private: static sal_uInt32 nRefCount; static rtl::OString aNameSuffix; +/* FIXME: double-singletonning is bad. These two are used by ::get and + * ::unref, and are a quick hack so that we can have a demo working. + */ +static TeleManager* pSingleton; +static sal_uInt32 nAnotherRefCount; +TUBES_DLLPRIVATE static ::osl::Mutex GetAnotherMutex(); + FileReceivedCallbackmpFileReceivedCallback; void *mpFileReceivedCallbackData; friend class TeleManagerImpl; // access to mutex TUBES_DLLPRIVATE static ::osl::Mutex GetMutex(); - }; diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index 088080d..e0e2425 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -70,6 +70,9 @@ TeleManagerImpl* TeleManager::pImpl = NULL; sal_uInt32 TeleManager::nRefCount = 0; rtl::OString TeleManager::aNameSuffix; +sal_uInt32 TeleManager::nAnotherRefCount = 0; +TeleManager* TeleManager::pSingleton = NULL; + /** Refcounted singleton implementation class. */ class TeleManagerImpl @@ -386,6 +389,27 @@ TeleManager::~TeleManager() } } +TeleManager * +TeleManager::get() +{ +MutexGuard aGuard( GetAnotherMutex()); +if (!pSingleton) +pSingleton = new TeleManager(); + +nAnotherRefCount++; +return pSingleton; +} + +void +TeleManager::unref() +{ +MutexGuard aGuard( GetAnotherMutex()); +if (--nAnotherRefCount == 0) { +delete pSingleton; +pSingleton = NULL; +} +} + bool TeleManager::connect() { @@ -931,6 +955,18 @@ Mutex TeleManager::GetMutex() return *pMutex; } +Mutex TeleManager::GetAnotherMutex() +{ +static Mutex* pMutex = NULL; +if (!pMutex) +{ +MutexGuard aGuard( Mutex::getGlobalMutex()); +if (!pMutex) +pMutex = new Mutex; +} +return *pMutex; +} + // static void TeleManager::addSuffixToNames( const char* pName ) commit d084e062feff59e6522eb1fe3e00505d6754dd57 Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 16:25:34 2012 + tubes
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source tubes/inc tubes/qa tubes/source
sc/source/ui/collab/collab.cxx | 26 ++ sc/source/ui/collab/sendfunc.cxx | 10 -- sc/source/ui/inc/collab.hxx |5 +++-- tubes/inc/tubes/manager.hxx | 10 +++--- tubes/qa/test_manager.cxx| 19 +-- tubes/source/conference.cxx |2 +- tubes/source/manager.cxx | 12 +++- 7 files changed, 29 insertions(+), 55 deletions(-) New commits: commit 30ad3ccd848e0832d5dd669b3feb9579e5248ba8 Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 17:14:36 2012 + Include packet in packetReceived signals. (And also signalify receiving files.) diff --git a/sc/source/ui/collab/collab.cxx b/sc/source/ui/collab/collab.cxx index cf8777c..a68ba45 100644 --- a/sc/source/ui/collab/collab.cxx +++ b/sc/source/ui/collab/collab.cxx @@ -61,28 +61,22 @@ void ScCollaboration::receivedFile( rtl::OUString rFileURL ) maLinkFile.Call( rFileURL ); } -extern C { -void file_recv_cb( rtl::OUString localUri, void* pUserData ) -{ -ScCollaboration *pCollab = reinterpret_castScCollaboration *( pUserData ); -pCollab-receivedFile( localUri ); -} -} - -void ScCollaboration::packetReceivedCallback( TeleConference *pConference ) +void ScCollaboration::packetReceivedCallback( TeleConference *pConference, TelePacket rPacket ) { +rtl::OString aString( rPacket.getData(), rPacket.getSize()); /* Relay the signal out⦠*/ -sigPacketReceived( pConference); +sigPacketReceived( pConference, aString); } bool ScCollaboration::initManager() { mpManager = TeleManager::get(); mpManager-sigPacketReceived.connect( -boost::bind( ScCollaboration::packetReceivedCallback, this, _1 )); +boost::bind( ScCollaboration::packetReceivedCallback, this, _1, _2 )); mpManager-connect(); mpManager-prepareAccountManager(); -mpManager-setFileReceivedCallback( file_recv_cb, (void *)this ); +mpManager-sigFileReceived.connect( +boost::bind( ScCollaboration::receivedFile, this, _1 )); return true; } @@ -119,14 +113,6 @@ bool ScCollaboration::sendPacket( const rtl::OString rString ) } -bool ScCollaboration::recvPacket( rtl::OString rString, TeleConference* pConference ) -{ -TelePacket aPacket; -bool bOk = (pConference ? pConference-popPacket( aPacket) : mpManager-popPacket( aPacket)); -rString = rtl::OString( aPacket.getData(), aPacket.getSize()); -return bOk; -} - extern C { static void file_sent_cb( bool aSuccess, void* /* pUserData */ ) { diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index 08383fa..38c598f 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -261,7 +261,7 @@ public: mpCollab = pCollab; } -void packetReceived( TeleConference* pConference); +void packetReceived( TeleConference* pConference, const rtl::OString ); DECL_LINK( ReceiveFileCallback, rtl::OUString * ); void RecvMessage( const rtl::OString rString ) @@ -301,11 +301,9 @@ public: } }; -void ScDocFuncRecv::packetReceived( TeleConference* pConference) +void ScDocFuncRecv::packetReceived( TeleConference* pConference, const rtl::OString rStr) { -rtl::OString aStr; -if (mpCollab mpCollab-recvPacket( aStr, pConference)) -RecvMessage( aStr); +RecvMessage( rStr); } IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr ) @@ -557,7 +555,7 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc() ScCollaboration* pCollab = new ScCollaboration( LINK( pReceiver, ScDocFuncRecv, ReceiveFileCallback) ); pCollab-sigPacketReceived.connect( -boost::bind( ScDocFuncRecv::packetReceived, pReceiver, _1 )); +boost::bind( ScDocFuncRecv::packetReceived, pReceiver, _1, _2 )); bOk = bOk pCollab-initManager(); if (!strcmp( pEnv, master)) { diff --git a/sc/source/ui/inc/collab.hxx b/sc/source/ui/inc/collab.hxx index faf8145..0337b79 100644 --- a/sc/source/ui/inc/collab.hxx +++ b/sc/source/ui/inc/collab.hxx @@ -37,6 +37,7 @@ typedef struct _TpContact TpContact; typedef struct _TpAccount TpAccount; class TeleManager; class TeleConference; +class TelePacket; namespace rtl { class OString; class OUString; } class ScCollaboration @@ -56,14 +57,14 @@ public: boolsendPacket( const rtl::OString rString ); /** Emitted when a packet is received */ -boost::signals2::signalvoid (TeleConference*) sigPacketReceived; +boost::signals2::signalvoid (TeleConference*, rtl::OString rString ) sigPacketReceived; boolrecvPacket( rtl::OString rString, TeleConference* pConference ); voidsendFile( rtl::OUString rFileURL ); voidreceivedFile( rtl::OUString rFileURL ); /* Internal callbacks */ -void
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source
sc/source/ui/collab/collab.cxx |6 ++ sc/source/ui/collab/sendfunc.cxx | 12 ++-- sc/source/ui/inc/collab.hxx | 12 +--- 3 files changed, 13 insertions(+), 17 deletions(-) New commits: commit 762ed00a6b9ee7fbbbf88b59ad751223d0d70227 Author: Will Thompson will.thomp...@collabora.co.uk Date: Fri Mar 23 17:40:21 2012 + Replace file received link with a signal. diff --git a/sc/source/ui/collab/collab.cxx b/sc/source/ui/collab/collab.cxx index a68ba45..4c02045 100644 --- a/sc/source/ui/collab/collab.cxx +++ b/sc/source/ui/collab/collab.cxx @@ -31,9 +31,8 @@ #include tubes/conference.hxx #include tubes/contact-list.hxx -ScCollaboration::ScCollaboration( const Link rLinkFile ) +ScCollaboration::ScCollaboration() : -maLinkFile( rLinkFile ), mpAccount( NULL), mpContact( NULL), mpManager( NULL) @@ -57,8 +56,7 @@ void ScCollaboration::receivedFile( rtl::OUString rFileURL ) { fprintf( stderr, file recieved '%s'\n, rtl::OUStringToOString( rFileURL, RTL_TEXTENCODING_UTF8 ).getStr() ); -if ( maLinkFile.IsSet() ) -maLinkFile.Call( rFileURL ); +sigFileReceived( rFileURL ); } void ScCollaboration::packetReceivedCallback( TeleConference *pConference, TelePacket rPacket ) diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index 38c598f..66db1d2 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -262,6 +262,7 @@ public: } void packetReceived( TeleConference* pConference, const rtl::OString ); +void fileReceived( rtl::OUString *rStr ); DECL_LINK( ReceiveFileCallback, rtl::OUString * ); void RecvMessage( const rtl::OString rString ) @@ -301,12 +302,12 @@ public: } }; -void ScDocFuncRecv::packetReceived( TeleConference* pConference, const rtl::OString rStr) +void ScDocFuncRecv::packetReceived( TeleConference*, const rtl::OString rStr) { RecvMessage( rStr); } -IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr ) +void ScDocFuncRecv::fileReceived( rtl::OUString *pStr ) { fprintf( stderr, incoming file '%s'\n, rtl::OUStringToOString( *pStr, RTL_TEXTENCODING_UTF8 ).getStr() ); @@ -362,8 +363,6 @@ IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr ) fprintf( stderr, exception when loading '%s' !\n, rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); } - -return 0; } class ScDocFuncSend : public ScDocFunc @@ -552,10 +551,11 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc() ScDocFuncRecv* pReceiver = new ScDocFuncRecv( *this, new ScDocFuncDirect( *this ) ); ScDocFuncSend* pSender = new ScDocFuncSend( *this, pReceiver ); bool bOk = true; -ScCollaboration* pCollab = new ScCollaboration( -LINK( pReceiver, ScDocFuncRecv, ReceiveFileCallback) ); +ScCollaboration* pCollab = new ScCollaboration(); pCollab-sigPacketReceived.connect( boost::bind( ScDocFuncRecv::packetReceived, pReceiver, _1, _2 )); +pCollab-sigFileReceived.connect( +boost::bind( ScDocFuncRecv::fileReceived, pReceiver, _1)); bOk = bOk pCollab-initManager(); if (!strcmp( pEnv, master)) { diff --git a/sc/source/ui/inc/collab.hxx b/sc/source/ui/inc/collab.hxx index 0337b79..df059ad 100644 --- a/sc/source/ui/inc/collab.hxx +++ b/sc/source/ui/inc/collab.hxx @@ -30,7 +30,6 @@ #define INCLUDED_SC_COLLAB_HXX #include sal/config.h -#include tools/link.hxx #include boost/signals2.hpp typedef struct _TpContact TpContact; @@ -44,10 +43,7 @@ class ScCollaboration { public: -/** @param rLink -Callback when a file is received, called with TeleConference* - */ -ScCollaboration( const Link rLinkFile ); +ScCollaboration(); ~ScCollaboration(); boolinitManager(); @@ -61,14 +57,16 @@ public: boolrecvPacket( rtl::OString rString, TeleConference* pConference ); voidsendFile( rtl::OUString rFileURL ); -voidreceivedFile( rtl::OUString rFileURL ); +/** Emitted when a file is received + */ +boost::signals2::signalvoid ( rtl::OUString *pFileURL ) sigFileReceived; /* Internal callbacks */ voidpacketReceivedCallback( TeleConference *pConference, TelePacket rPacket ); +voidreceivedFile( rtl::OUString rFileURL ); private: -LinkmaLinkFile; TpAccount* mpAccount; TpContact* mpContact; TeleManager*mpManager; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] .: Branch 'feature/tubes2' - sal/inc
sal/inc/rtl/bootstrap.h |2 +- sal/inc/rtl/bootstrap.hxx |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) New commits: commit 180fc63ab8fe7d37ed3da364784a7f0946b918cb Author: Will Thompson will.thomp...@collabora.co.uk Date: Thu Mar 22 09:57:36 2012 + rtl::bootstap: rename filename parameter to contain uri diff --git a/sal/inc/rtl/bootstrap.h b/sal/inc/rtl/bootstrap.h index 3f89bde..1df1461 100644 --- a/sal/inc/rtl/bootstrap.h +++ b/sal/inc/rtl/bootstrap.h @@ -124,7 +124,7 @@ extern C { @param pName URL of the ini file; must not be null, must not be the empty string */ -SAL_DLLPUBLIC void SAL_CALL rtl_bootstrap_setIniFileName( rtl_uString *pName ) +SAL_DLLPUBLIC void SAL_CALL rtl_bootstrap_setIniFileName( rtl_uString *pFileUri ) SAL_THROW_EXTERN_C(); /** diff --git a/sal/inc/rtl/bootstrap.hxx b/sal/inc/rtl/bootstrap.hxx index 60ad350..789c17c 100644 --- a/sal/inc/rtl/bootstrap.hxx +++ b/sal/inc/rtl/bootstrap.hxx @@ -41,9 +41,9 @@ namespace rtl public: /** - @see rtl_bootstrap_setIniFileName() + * @see rtl_bootstrap_setIniFileName() */ -static inline void SAL_CALL setIniFilename( const ::rtl::OUString sFile ); +static inline void SAL_CALL setIniFilename( const ::rtl::OUString sFileUri ); /** Retrieves a bootstrap parameter @param sName name of the bootstrap value. case insensitive. ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes' - 3 commits - Repository.mk tubes/Executable_liboapprover.mk tubes/LibreOfficeApprover.client tubes/LibreOffice.client tubes/Module_tubes.mk tubes/org.f
Repository.mk |1 tubes/Executable_liboapprover.mk | 47 + tubes/LibreOffice.client | 11 tubes/LibreOfficeApprover.client |8 tubes/Module_tubes.mk |1 tubes/README | 17 tubes/org.freedesktop.Telepathy.Client.LibreOffice.service |3 tubes/org.freedesktop.Telepathy.Client.LibreOfficeApprover.service |3 tubes/source/approver.c| 246 ++ 9 files changed, 337 insertions(+) New commits: commit 4b088d4ee611f05a003acc6146afba7a574c5e66 Author: Will Thompson will.thomp...@collabora.co.uk Date: Wed Mar 21 18:51:24 2012 + tubes approver: add error handling in case spawning LibO fails diff --git a/tubes/source/approver.c b/tubes/source/approver.c index fdf0799..5f4bbde 100644 --- a/tubes/source/approver.c +++ b/tubes/source/approver.c @@ -45,16 +45,21 @@ handle_with_cb (GObject *source, gpointer user_data) { TpChannelDispatchOperation *cdo = TP_CHANNEL_DISPATCH_OPERATION (source); - GError *error; + GtkDialog *dialog = GTK_DIALOG (user_data); + GError *error = NULL; if (!tp_channel_dispatch_operation_handle_with_finish (cdo, result, error)) { g_print (HandleWith() failed: %s\n, error-message); + gtk_message_dialog_format_secondary_markup (dialog, + bError/b\n\nAsking LibreOffice to accept the session failed: i%s/i, + error-message); g_error_free (error); return; } g_print (HandleWith() succeeded\n); + gtk_widget_destroy (dialog); } static void @@ -64,7 +69,7 @@ close_cb (GObject *source, { TpChannelDispatchOperation *cdo = TP_CHANNEL_DISPATCH_OPERATION (source); - GError *error; + GError *error = NULL; if (!tp_channel_dispatch_operation_close_channels_finish (cdo, result, error)) { @@ -90,16 +95,19 @@ dialog_response_cb ( g_print (Approve channels\n); tp_channel_dispatch_operation_handle_with_async (cdo, NULL, -handle_with_cb, NULL); +handle_with_cb, dialog); + +gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT, FALSE); +gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_REJECT, FALSE); } else { g_print (Reject channels\n); -tp_channel_dispatch_operation_close_channels_async (cdo, close_cb, NULL); +tp_channel_dispatch_operation_close_channels_async (cdo, close_cb, dialog); +gtk_widget_destroy (dialog); } -gtk_widget_destroy (dialog); g_object_unref (cdo); } commit 4da2b141304a47a300c97406b44d6aec05ce1bf3 Author: Will Thompson will.thomp...@collabora.co.uk Date: Wed Mar 21 18:38:27 2012 + Add WIP .client and .service files. These are roughly what need to get installed to make the approver (the little dialog box that pops up for incoming offers) and handler (LibreOffice itself) service-activatable. Without these, your contacts will only see that you're capable of LibreOffice tubes while you're running LibreOffice, and you won't get a prompt unless liboapprover is running. diff --git a/tubes/LibreOffice.client b/tubes/LibreOffice.client new file mode 100644 index 000..e454611 --- /dev/null +++ b/tubes/LibreOffice.client @@ -0,0 +1,11 @@ +[org.freedesktop.Telepathy.Client] +Interfaces = org.freedesktop.Telepathy.Client.Handler; + +[org.freedesktop.Telepathy.Client.Handler] +BypassApproval = false + +[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 0] +org.freedesktop.Telepathy.Channel.TargetHandleType u = 1 +org.freedesktop.Telepathy.Channel.ChannelType s = org.freedesktop.Telepathy.Channel.Type.DBusTube +org.freedesktop.Telepathy.Channel.Type.DBusTube.ServiceName s = org.freedesktop.Telepathy.Client.LibreOfficeTeleTest + diff --git a/tubes/LibreOfficeApprover.client b/tubes/LibreOfficeApprover.client new file mode 100644 index 000..da6d511 --- /dev/null +++ b/tubes/LibreOfficeApprover.client @@ -0,0 +1,8 @@ +[org.freedesktop.Telepathy.Client] +Interfaces = org.freedesktop.Telepathy.Client.Approver; + +[org.freedesktop.Telepathy.Client.Approver.ApproverChannelFilter 0] +org.freedesktop.Telepathy.Channel.TargetHandleType u = 1 +org.freedesktop.Telepathy.Channel.ChannelType s = org.freedesktop.Telepathy.Channel.Type.DBusTube +org.freedesktop.Telepathy.Channel.Type.DBusTube.ServiceName s = org.freedesktop.Telepathy.Client.LibreOfficeTeleTest + diff --git a/tubes/README b/tubes/README index 3527a72..84d4892 100644 --- a/tubes/README +++ b/tubes/README @@ -8,6 +8,23 @@ the same TeleConference abstraction. To enable configure LibO with --enable-telepathy +If you have a Telepathy-enabled LibreOffice installed to /usr (including
[Libreoffice-commits] .: Branch 'feature/tubes2' - tubes/CppunitTest_tubes_test.mk tubes/qa tubes/test-config.ini
tubes/CppunitTest_tubes_test.mk |2 ++ tubes/qa/test_manager.cxx | 22 +++--- tubes/test-config.ini |3 +++ 3 files changed, 20 insertions(+), 7 deletions(-) New commits: commit 16e48ea17024c7b97b3048bf4463ae443f930455 Author: Will Thompson will.thomp...@collabora.co.uk Date: Thu Mar 22 10:43:57 2012 + tubes: move hardcoded test accounts to an .ini file diff --git a/tubes/CppunitTest_tubes_test.mk b/tubes/CppunitTest_tubes_test.mk index 7b558d7..57a53a5 100644 --- a/tubes/CppunitTest_tubes_test.mk +++ b/tubes/CppunitTest_tubes_test.mk @@ -33,6 +33,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,tubes_test, \ $(eval $(call gb_CppunitTest_add_linked_libs,tubes_test, \ tubes \ sal \ +unotest \ $(gb_STDLIBS) \ )) @@ -42,6 +43,7 @@ $(eval $(call gb_CppunitTest_add_libs,tubes_test, \ $(eval $(call gb_CppunitTest_set_include,tubes_test,\ -I$(realpath $(SRCDIR)/tubes/inc) \ +-I$(realpath $(OUTDIR)/inc/udkapi) \ $$(TELEPATHY_CFLAGS) \ $$(INCLUDE) \ )) diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index 69266d0..63077dc 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -37,10 +37,12 @@ #include cppunit/plugin/TestPlugIn.h #include rtl/string.hxx #include rtl/ustring.hxx +#include rtl/bootstrap.hxx +#include unotest/bootstrapfixturebase.hxx namespace { -class TestTeleTubes: public CppUnit::TestFixture +class TestTeleTubes: public test::BootstrapFixtureBase { public: @@ -83,22 +85,28 @@ public: CPPUNIT_TEST( testFailAlways ); // need failure to display SAL_LOG, comment out for real builds CPPUNIT_TEST_SUITE_END(); +private: +// XXX The Jabber accounts specified in test-config.ini need to be setup in +// Empathy, enabled, connected, and on each other's rosters. +rtl::BootstrapmaTestConfig; + +rtl::OUString maAcc1; +rtl::OUString maAcc2; }; // static, not members, so they actually survive cppunit test iteration static TeleManager* mpManager1 = NULL; static TeleManager* mpManager2 = NULL; -// XXX The accounts need to be setup in Empathy and a jabber daemon needs -// to be running on localhost.localdomain and both accounts need to be -// enabled and connected. -static rtl::OUString sAcc1( RTL_CONSTASCII_USTRINGPARAM( libo1@localhost.localdomain)); -static rtl::OUString sAcc2( RTL_CONSTASCII_USTRINGPARAM( libo2@localhost.localdomain)); static sal_uInt32 nSentPackets = 0; TestTeleTubes::TestTeleTubes() +: maTestConfig(getURLFromSrc(/tubes/test-config.ini)) { TeleManager::addSuffixToNames( TeleTest); + +CPPUNIT_ASSERT( maTestConfig.getFrom(offerer, maAcc1)); +CPPUNIT_ASSERT( maTestConfig.getFrom(accepter, maAcc2)); } TestTeleTubes::~TestTeleTubes() @@ -182,7 +190,7 @@ void TestTeleTubes::testPrepareAccountManager2() void TestTeleTubes::testStartBuddySession1() { -bool bStarted = mpManager1-startBuddySession( sAcc1, sAcc2); +bool bStarted = mpManager1-startBuddySession( maAcc1, maAcc2); CPPUNIT_ASSERT( bStarted == true); } diff --git a/tubes/test-config.ini b/tubes/test-config.ini new file mode 100644 index 000..dba2be1 --- /dev/null +++ b/tubes/test-config.ini @@ -0,0 +1,3 @@ +# Locally-configured Jabber accounts used by Tubes test suite. +offerer=libo1@localhost.localdomain +accepter=libo2@localhost.localdomain ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes2' - 2 commits - .gitignore tubes/inc tubes/qa tubes/README tubes/source tubes/test-config.ini
.gitignore |3 +++ tubes/README | 10 -- tubes/inc/tubes/manager.hxx |6 +++--- tubes/qa/test-config.ini.example |5 + tubes/qa/test_manager.cxx| 14 ++ tubes/source/manager.cxx | 11 ++- tubes/test-config.ini|3 --- 7 files changed, 27 insertions(+), 25 deletions(-) New commits: commit 9fc45729868d76f450cdbf3bc427a25f55de61aa Author: Will Thompson will.thomp...@collabora.co.uk Date: Thu Mar 22 11:22:44 2012 + tubes: Give a useful error when test-config.ini is missing. diff --git a/.gitignore b/.gitignore index c1aef58..ce66673 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,6 @@ test/user-template/user/psprint/pspfontcache # Somepeople love debugging gdbtrace.log valgrind.log + +# Tubes test stuff +/tubes/qa/test-config.ini diff --git a/tubes/README b/tubes/README index 84d4892..3f2f637 100644 --- a/tubes/README +++ b/tubes/README @@ -37,12 +37,10 @@ Status 2012-03-20: is silenced down ... :-( * for the cppunittest needed: - * a jabber daemon running on localhost.localdomain - * two accounts configured in Empathy -* libo1@localhost.localdomain -* libo2@localhost.localdomain - * libo1 and libo2 must be contacts/buddies of each other - * both accounts need to be online in Empathy + * Configure two Jabber accounts in Empathy + * Both must be online and on each other's contact list + * Copy qa/test-config.ini.example to qa/test-config.ini, and specify those +two accounts' JIDs in it. * very nasty GMainLoop handling for cppunittest, HOPEFULLY we will get rid of that in a real LibO diff --git a/tubes/qa/test-config.ini.example b/tubes/qa/test-config.ini.example new file mode 100644 index 000..2d03ca8 --- /dev/null +++ b/tubes/qa/test-config.ini.example @@ -0,0 +1,5 @@ +# Locally-configured Jabber accounts used by Tubes test suite. These accounts +# must both be signed in and on each others' contact lists for the tests to +# work. +offerer=libo1@localhost.localdomain +accepter=libo2@localhost.localdomain diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index f7461ba..ea5806d 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -88,6 +88,7 @@ public: private: // XXX The Jabber accounts specified in test-config.ini need to be setup in // Empathy, enabled, connected, and on each other's rosters. +rtl::OUString maTestConfigIniURL; rtl::BootstrapmaTestConfig; rtl::OUString maAcc1; @@ -101,12 +102,15 @@ static TeleManager* mpManager2 = NULL; static sal_uInt32 nSentPackets = 0; TestTeleTubes::TestTeleTubes() -: maTestConfig(getURLFromSrc(/tubes/test-config.ini)) +: maTestConfigIniURL(getURLFromSrc(/tubes/qa/test-config.ini)), + maTestConfig(maTestConfigIniURL) { TeleManager::addSuffixToNames( TeleTest); -CPPUNIT_ASSERT( maTestConfig.getFrom(offerer, maAcc1)); -CPPUNIT_ASSERT( maTestConfig.getFrom(accepter, maAcc2)); +CPPUNIT_ASSERT_MESSAGE( See README for how to set up test-config.ini, +maTestConfig.getFrom(offerer, maAcc1)); +CPPUNIT_ASSERT_MESSAGE( See README for how to set up test-config.ini, +maTestConfig.getFrom(accepter, maAcc2)); } TestTeleTubes::~TestTeleTubes() diff --git a/tubes/test-config.ini b/tubes/test-config.ini deleted file mode 100644 index dba2be1..000 --- a/tubes/test-config.ini +++ /dev/null @@ -1,3 +0,0 @@ -# Locally-configured Jabber accounts used by Tubes test suite. -offerer=libo1@localhost.localdomain -accepter=libo2@localhost.localdomain commit 8f0ec4cef3f3dc78f27a3e08b68eaa9d0f45608e Author: Will Thompson will.thomp...@collabora.co.uk Date: Thu Mar 22 11:06:42 2012 + Make startBuddySession() take a TpAccount *. diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx index 7f325c3..122b959 100644 --- a/tubes/inc/tubes/manager.hxx +++ b/tubes/inc/tubes/manager.hxx @@ -113,7 +113,7 @@ public: @param rBuddy The buddy to be connected. Must be a contact of rAccount. */ -boolstartBuddySession( const rtl::OUString rAccount, const rtl::OUString rBuddy ); +boolstartBuddySession( TpAccount *pAccount, const rtl::OUString rBuddy ); voidunregisterConference( TeleConferencePtr pConference ); @@ -195,14 +195,14 @@ public: */ static void addSuffixToNames( const char* pName ); +TpAccount* getAccount( const rtl::OString rAccountID ); + private: TeleConferenceVectormaConferences; boolmbChannelReadyHandlerInvoked : 1; -TpAccount* getAccount( const rtl::OString rAccountID ); - static TeleManagerImpl* pImpl; static sal_uInt32 nRefCount; static rtl::OString aNameSuffix; diff --git a/tubes/qa/test_manager.cxx b
[Libreoffice-commits] .: Branch 'feature/tubes2' - 3 commits - tubes/inc tubes/qa tubes/source
tubes/inc/tubes/conference.hxx |3 - tubes/inc/tubes/manager.hxx| 10 ++ tubes/qa/test_manager.cxx | 63 + tubes/source/conference.cxx|6 --- tubes/source/manager.cxx | 12 +++ 5 files changed, 60 insertions(+), 34 deletions(-) New commits: commit b881624cc1225c2c851bfc391ac4647aa2539b8d Author: Will Thompson will.thomp...@collabora.co.uk Date: Thu Mar 22 12:59:15 2012 + tubes: make startBuddySession take a TpContact *. I removed Conference::setTarget() because it's redundant: you can get the target from the channel. And maTarget was unused anyway. diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx index 8f68333..b9fd366 100644 --- a/tubes/inc/tubes/conference.hxx +++ b/tubes/inc/tubes/conference.hxx @@ -71,8 +71,6 @@ public: // --- following only to be called only by manager's callbacks --- // TODO: make friends instead -/// bu...@jabber.example.org or r...@conference.example.org or UUID -voidsetTarget( const rtl::OString rTarget ); voidsetChannel( TpChannel* pChannel ); TpChannel* getChannel() const { return mpChannel; } boolofferTube(); @@ -92,7 +90,6 @@ public: private: -rtl::OStringmaTarget; rtl::OStringmaSessionId; TeleManager*mpManager; TpChannel* mpChannel; diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx index c704780..10f20ef 100644 --- a/tubes/inc/tubes/manager.hxx +++ b/tubes/inc/tubes/manager.hxx @@ -105,15 +105,13 @@ public: /** Start a session with a buddy. -@param rAccount -The account (JID) to use. This must be a valid JID that has been -setup with Empathy or another Telepathy client providing -Jabber/XMPP. +@param pAccount +The account to use. This must be a valid Jabber account. -@param rBuddy +@param pBuddy The buddy to be connected. Must be a contact of rAccount. */ -boolstartBuddySession( TpAccount *pAccount, const rtl::OString rBuddy ); +boolstartBuddySession( TpAccount *pAccount, TpContact *pBuddy); voidunregisterConference( TeleConferencePtr pConference ); diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index debfef5..b053652 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -224,8 +224,10 @@ void TestTeleTubes::testPrepareAccountManager2() void TestTeleTubes::testStartBuddySession1() { TpAccount *pAcc1 = mpManager1-getAccount(maOffererIdentifier); -CPPUNIT_ASSERT ( pAcc1 != 0); -bool bStarted = mpManager1-startBuddySession( pAcc1, maAccepterIdentifier); +CPPUNIT_ASSERT( pAcc1 != 0); +/* This has to run after testContactList has run successfully. */ +CPPUNIT_ASSERT( mpAccepterContact != 0); +bool bStarted = mpManager1-startBuddySession( pAcc1, mpAccepterContact); CPPUNIT_ASSERT( bStarted == true); } diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx index f5875e0..830db5f 100644 --- a/tubes/source/conference.cxx +++ b/tubes/source/conference.cxx @@ -231,12 +231,6 @@ TeleConference::~TeleConference() } -void TeleConference::setTarget( const rtl::OString rTarget ) -{ -maTarget = rTarget; -} - - void TeleConference::setChannel( TpChannel* pChannel ) { OSL_ENSURE( !mpChannel, TeleConference::setChannel: already have channel); diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index 96c4b3e..5497435 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -392,7 +392,7 @@ bool TeleManager::startGroupSession( const rtl::OUString rUConferenceRoom, cons /* TODO: factor out common code with startGroupSession() */ -bool TeleManager::startBuddySession( TpAccount *pAccount, const rtl::OString rBuddy ) +bool TeleManager::startBuddySession( TpAccount *pAccount, TpContact *pBuddy ) { INFO_LOGGER( TeleManager::startBuddySession); @@ -404,16 +404,15 @@ bool TeleManager::startBuddySession( TpAccount *pAccount, const rtl::OString rB maConferences.push_back( pConference); /* TODO: associate the document with this session and conference */ - -pConference-setTarget( rBuddy); - +const char *pIdentifier = tp_contact_get_identifier( pBuddy); SAL_INFO( tubes, TeleManager::startBuddySession: creating channel request from - tp_account_get_path_suffix( pAccount) to rBuddy.getStr()); + tp_account_get_path_suffix( pAccount) + to pIdentifier); GHashTable* pRequest = tp_asv_new( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, TP_TYPE_HANDLE, TP_HANDLE_TYPE_CONTACT
[Libreoffice-commits] .: Branch 'feature/tubes2' - tubes/source
tubes/source/manager.cxx |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) New commits: commit 52c85e7bfb00696b4b68331ab6139c98d93329b9 Author: Will Thompson will.thomp...@collabora.co.uk Date: Thu Mar 22 15:40:10 2012 + tubes manager: fix a compiler warning diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index ed53a10..8dd0fe2 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -164,10 +164,11 @@ static void TeleManager_DBusChannelHandler( tp_handle_channels_context_accept( pContext); else { -GError aError = { TP_ERRORS, TP_ERROR_CONFUSED, +GError *pError = g_error_new_literal( TP_ERRORS, TP_ERROR_CONFUSED, None of these channels were LibreOffice D-Bus tubes; -why did the Channel Dispatcher give them to us? }; -tp_handle_channels_context_fail( pContext, aError); +why did the Channel Dispatcher give them to us?); +tp_handle_channels_context_fail( pContext, pError); +g_clear_error (pError); } } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes' - configure.in tubes/CppunitTest_tubes_test.mk tubes/inc tubes/Library_tubes.mk tubes/qa tubes/source
configure.in |2 tubes/CppunitTest_tubes_test.mk |4 tubes/Library_tubes.mk |1 tubes/inc/tubes/contact-list.hxx | 60 + tubes/qa/test_manager.cxx| 56 tubes/source/contact-list.cxx| 169 +++ 6 files changed, 291 insertions(+), 1 deletion(-) New commits: commit 3cd4a8e788d01e87a2e6dbc768b99668443b0839 Author: Will Thompson will.thomp...@collabora.co.uk Date: Wed Mar 21 11:13:04 2012 + tubes: add API to find contacts with LibO tube support diff --git a/configure.in b/configure.in index af324fc..7fdabdb 100644 --- a/configure.in +++ b/configure.in @@ -8369,7 +8369,7 @@ AC_MSG_CHECKING([whether to enable Telepathy support]) if test $_os != WINNT -a $_os != Darwin -a $enable_telepathy = yes; then ENABLE_TELEPATHY=TRUE AC_MSG_RESULT([yes]) -PKG_CHECK_MODULES( TELEPATHY, telepathy-glib = 0.16.4 glib-2.0 gobject-2.0 gthread-2.0 dbus-1 dbus-glib-1 ) +PKG_CHECK_MODULES( TELEPATHY, telepathy-glib = 0.16.4 glib-2.0 gobject-2.0 gthread-2.0 gio-2.0 dbus-1 dbus-glib-1 ) else AC_MSG_RESULT([no]) fi diff --git a/tubes/CppunitTest_tubes_test.mk b/tubes/CppunitTest_tubes_test.mk index 32810f9..7b558d7 100644 --- a/tubes/CppunitTest_tubes_test.mk +++ b/tubes/CppunitTest_tubes_test.mk @@ -36,6 +36,10 @@ $(eval $(call gb_CppunitTest_add_linked_libs,tubes_test, \ $(gb_STDLIBS) \ )) +$(eval $(call gb_CppunitTest_add_libs,tubes_test, \ +$$(TELEPATHY_LIBS) \ +)) + $(eval $(call gb_CppunitTest_set_include,tubes_test,\ -I$(realpath $(SRCDIR)/tubes/inc) \ $$(TELEPATHY_CFLAGS) \ diff --git a/tubes/Library_tubes.mk b/tubes/Library_tubes.mk index 2ab2616..48ef793 100644 --- a/tubes/Library_tubes.mk +++ b/tubes/Library_tubes.mk @@ -58,6 +58,7 @@ $(eval $(call gb_Library_add_exception_objects,tubes,\ tubes/source/conference \ tubes/source/manager \ tubes/source/packet \ + tubes/source/contact-list \ )) # vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/tubes/inc/tubes/contact-list.hxx b/tubes/inc/tubes/contact-list.hxx new file mode 100644 index 000..bf1e0f7 --- /dev/null +++ b/tubes/inc/tubes/contact-list.hxx @@ -0,0 +1,60 @@ +/* -*- 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 Collabora Ltd. + * + * 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. + */ + +#ifndef INCLUDED_TUBES_CONTACT_LIST_HXX +#define INCLUDED_TUBES_CONTACT_LIST_HXX + +#include utility +#include vector + +#include telepathy-glib/telepathy-glib.h + +#include tubes/tubesdllapi.h + +typedef ::std::pair TpAccount *, TpContact * AccountContactPair; +typedef ::std::vector AccountContactPair AccountContactPairV; + +class TUBES_DLLPUBLIC ContactList +{ +public: +ContactList(); +~ContactList(); + +typedef void (*PrepareCallback)( GError *errorOr0, void *user_data ); +voidprepare( PrepareCallback callback, void *user_data ); + +AccountContactPairV getContacts(); + +private: +TpAccountManager* mpAccountManager; + +}; + +#endif // INCLUDED_TUBES_CONTACT_LIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index 07dd264..f017a9c 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -28,6 +28,7 @@ #include sal/precppunit.hxx +#include tubes/contact-list.hxx #include tubes/manager.hxx #include cppunit/TestAssert.h @@ -45,6 +46,7 @@ public: TestTeleTubes(); ~TestTeleTubes(); +void testContactList(); void testSetupManager1(); void testSetupManager2(); void testConnect1(); @@ -60,8 +62,11 @@ public: void testDestroyManager2(); void testFailAlways(); +GMainLoop* mpMainLoop; + // Order is significant. CPPUNIT_TEST_SUITE( TestTeleTubes ); +CPPUNIT_TEST( testContactList ); CPPUNIT_TEST( testSetupManager1
[Libreoffice-commits] .: Branch 'feature/tubes' - tubes/inc tubes/source
tubes/inc/tubes/constants.h | 52 ++ tubes/source/contact-list.cxx | 12 - 2 files changed, 53 insertions(+), 11 deletions(-) New commits: commit 042c53a42cc0a94288370392b5697c5bb9abfb09 Author: Will Thompson will.thomp...@collabora.co.uk Date: Wed Mar 21 12:15:35 2012 + Move tube service name definition to a header. diff --git a/tubes/inc/tubes/constants.h b/tubes/inc/tubes/constants.h new file mode 100644 index 000..6087115 --- /dev/null +++ b/tubes/inc/tubes/constants.h @@ -0,0 +1,52 @@ +/* -*- 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 Collabora Ltd. + * + * 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. + */ + +#ifndef INCLUDED_TUBES_CONSTANTS_H +#define INCLUDED_TUBES_CONSTANTS_H + +/* DBusTube.ServiceName. + * + * FIXME: Should be something like + * + * org.libreoffice.calc + * org.libreoffice.writer + * + * etc. This does not need to include the org.freedesktop.Telepathy.Client + * stuff. + */ +#define LIBO_DTUBE_SERVICE \ +TP_CLIENT_BUS_NAME_BASE LibreOfficeTeleTest + +/* Client name suffix, for passing as 'name' to + * tp_simple_handler_new_with_am(). */ +#define LIBO_CLIENT_SUFFIX \ +LibreOffice + +#endif // INCLUDED_TUBES_CONSTANTS_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tubes/source/contact-list.cxx b/tubes/source/contact-list.cxx index 7f707af..c342115 100644 --- a/tubes/source/contact-list.cxx +++ b/tubes/source/contact-list.cxx @@ -30,6 +30,7 @@ #include telepathy-glib/telepathy-glib.h +#include tubes/constants.h #include tubes/contact-list.hxx ContactList::ContactList() @@ -66,17 +67,6 @@ ContactList::~ContactList() mpAccountManager = NULL; } -/* FIXME: Should be something like - * - * org.libreoffice.calc - * org.libreoffice.writer - * - * etc. This does not need to include the org.freedesktop.Telepathy.Client - * stuff. - */ -#define LIBO_DTUBE_SERVICE \ -TP_CLIENT_BUS_NAME_BASE LibreOfficeTeleTest - static gboolean contact_supports_libo_dtube (TpContact *contact) { ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes2' - 3 commits - Repository.mk tubes/Executable_liboapprover.mk tubes/LibreOfficeApprover.client tubes/LibreOffice.client tubes/Module_tubes.mk tubes/org.
Repository.mk |1 tubes/Executable_liboapprover.mk | 47 + tubes/LibreOffice.client | 11 tubes/LibreOfficeApprover.client |8 tubes/Module_tubes.mk |1 tubes/README | 17 tubes/org.freedesktop.Telepathy.Client.LibreOffice.service |3 tubes/org.freedesktop.Telepathy.Client.LibreOfficeApprover.service |3 tubes/source/approver.c| 246 ++ 9 files changed, 337 insertions(+) New commits: commit 6db31dc4ba6e296d05629c12494007cc80adb019 Author: Will Thompson will.thomp...@collabora.co.uk Date: Wed Mar 21 18:51:24 2012 + tubes approver: add error handling in case spawning LibO fails diff --git a/tubes/source/approver.c b/tubes/source/approver.c index fdf0799..5f4bbde 100644 --- a/tubes/source/approver.c +++ b/tubes/source/approver.c @@ -45,16 +45,21 @@ handle_with_cb (GObject *source, gpointer user_data) { TpChannelDispatchOperation *cdo = TP_CHANNEL_DISPATCH_OPERATION (source); - GError *error; + GtkDialog *dialog = GTK_DIALOG (user_data); + GError *error = NULL; if (!tp_channel_dispatch_operation_handle_with_finish (cdo, result, error)) { g_print (HandleWith() failed: %s\n, error-message); + gtk_message_dialog_format_secondary_markup (dialog, + bError/b\n\nAsking LibreOffice to accept the session failed: i%s/i, + error-message); g_error_free (error); return; } g_print (HandleWith() succeeded\n); + gtk_widget_destroy (dialog); } static void @@ -64,7 +69,7 @@ close_cb (GObject *source, { TpChannelDispatchOperation *cdo = TP_CHANNEL_DISPATCH_OPERATION (source); - GError *error; + GError *error = NULL; if (!tp_channel_dispatch_operation_close_channels_finish (cdo, result, error)) { @@ -90,16 +95,19 @@ dialog_response_cb ( g_print (Approve channels\n); tp_channel_dispatch_operation_handle_with_async (cdo, NULL, -handle_with_cb, NULL); +handle_with_cb, dialog); + +gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT, FALSE); +gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_REJECT, FALSE); } else { g_print (Reject channels\n); -tp_channel_dispatch_operation_close_channels_async (cdo, close_cb, NULL); +tp_channel_dispatch_operation_close_channels_async (cdo, close_cb, dialog); +gtk_widget_destroy (dialog); } -gtk_widget_destroy (dialog); g_object_unref (cdo); } commit 44a4ec0ae0554cbbf1a07a1aecaa62624155527b Author: Will Thompson will.thomp...@collabora.co.uk Date: Wed Mar 21 18:38:27 2012 + Add WIP .client and .service files. These are roughly what need to get installed to make the approver (the little dialog box that pops up for incoming offers) and handler (LibreOffice itself) service-activatable. Without these, your contacts will only see that you're capable of LibreOffice tubes while you're running LibreOffice, and you won't get a prompt unless liboapprover is running. diff --git a/tubes/LibreOffice.client b/tubes/LibreOffice.client new file mode 100644 index 000..8c3356f --- /dev/null +++ b/tubes/LibreOffice.client @@ -0,0 +1,11 @@ +[org.freedesktop.Telepathy.Client] +Interfaces = org.freedesktop.Telepathy.Client.Handler; + +[org.freedesktop.Telepathy.Client.Handler] +BypassApproval = false + +[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 0] +org.freedesktop.Telepathy.Channel.TargetHandleType u = 1 +org.freedesktop.Telepathy.Channel.ChannelType s = org.freedesktop.Telepathy.Channel.Type.DBusTube +org.freedesktop.Telepathy.Channel.Type.DBusTube.ServiceName s = org.libreoffice.calc + diff --git a/tubes/LibreOfficeApprover.client b/tubes/LibreOfficeApprover.client new file mode 100644 index 000..035e022 --- /dev/null +++ b/tubes/LibreOfficeApprover.client @@ -0,0 +1,8 @@ +[org.freedesktop.Telepathy.Client] +Interfaces = org.freedesktop.Telepathy.Client.Approver; + +[org.freedesktop.Telepathy.Client.Approver.ApproverChannelFilter 0] +org.freedesktop.Telepathy.Channel.TargetHandleType u = 1 +org.freedesktop.Telepathy.Channel.ChannelType s = org.freedesktop.Telepathy.Channel.Type.DBusTube +org.freedesktop.Telepathy.Channel.Type.DBusTube.ServiceName s = org.libreoffice.calc + diff --git a/tubes/README b/tubes/README index 3527a72..84d4892 100644 --- a/tubes/README +++ b/tubes/README @@ -8,6 +8,23 @@ the same TeleConference abstraction. To enable configure LibO with --enable-telepathy +If you have a Telepathy-enabled LibreOffice installed to /usr (including +liboapprover) you may also want to install the .service and .client files