diff options
-rw-r--r-- | sc/source/ui/collab/contacts.cxx | 19 | ||||
-rw-r--r-- | tubes/inc/tubes/manager.hxx | 8 | ||||
-rw-r--r-- | tubes/source/manager.cxx | 26 |
3 files changed, 36 insertions, 17 deletions
diff --git a/sc/source/ui/collab/contacts.cxx b/sc/source/ui/collab/contacts.cxx index d1f27ec87596..bfc771055ad0 100644 --- a/sc/source/ui/collab/contacts.cxx +++ b/sc/source/ui/collab/contacts.cxx @@ -107,6 +107,21 @@ class TubeContacts : public ModelessDialog } } + void StartGroupSession() + { + AccountContact *pAC = NULL; + if (maList.FirstSelected()) + pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData()); + if (pAC) + { + TpAccount* pAccount = pAC->mpAccount; + fprintf( stderr, "picked %s\n", tp_account_get_display_name( pAccount ) ); + TeleManager *pManager = TeleManager::get(); + if (!pManager->startGroupSession( pAccount, rtl::OUString("liboroom"), rtl::OUString("conference.jabber.org") )) + fprintf( stderr, "could not start group session\n" ); + } + } + public: TubeContacts() : ModelessDialog( NULL, ScResId( RID_SCDLG_CONTACTS ) ), @@ -188,7 +203,11 @@ public: IMPL_LINK_NOARG( TubeContacts, BtnConnectHdl ) { +#if 0 StartBuddySession(); +#else + StartGroupSession(); +#endif Close(); return 0; } diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx index c780fd2467a7..326cc5191d22 100644 --- a/tubes/inc/tubes/manager.hxx +++ b/tubes/inc/tubes/manager.hxx @@ -101,9 +101,11 @@ public: */ ContactList* getContactList() const; -#if 0 /** Start a group session in a MUC. + @param pAccount + The account to use. This must be a valid Jabber account. + @param rConferenceRoom The MUC to be created/joined, e.g. "LibreOffice". If empty, the conference's UUID is used. @@ -113,9 +115,9 @@ public: empty, only the conference's UUID is used and rConferenceRoom is ignored, hopefully resulting in a local DBus tube. */ - bool startGroupSession( const rtl::OUString& rConferenceRoom, + bool startGroupSession( TpAccount *pAccount, + const rtl::OUString& rConferenceRoom, const rtl::OUString& rConferenceServer ); -#endif /** Start a session with a buddy. diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index 2e0cd3e3023d..06b153303057 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -442,8 +442,6 @@ bool TeleManager::connect() /* TODO: setup filters for LibreOfficeCalc, LibreOfficeWriter, ... */ -/* FIXME: once we can handle MUCs, this is additional to buddy channels! */ -#if 0 // Setup client handler for MUC channels with our service. tp_base_client_take_handler_filter( pImpl->mpClient, tp_asv_new( @@ -451,7 +449,6 @@ bool TeleManager::connect() TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_ROOM, TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME, G_TYPE_STRING, getFullServiceName().getStr(), NULL)); -#endif if (!tp_base_client_register( pImpl->mpClient, &pError)) { @@ -497,18 +494,16 @@ bool TeleManager::connect() } -#if 0 /* TODO: factor out common code with startBuddySession() */ -bool TeleManager::startGroupSession( const rtl::OUString& rUConferenceRoom, const rtl::OUString& rUConferenceServer ) +bool TeleManager::startGroupSession( TpAccount *pAccount, + const rtl::OUString& rUConferenceRoom, + const rtl::OUString& rUConferenceServer ) { INFO_LOGGER( "TeleManager::startGroupSession"); - if (!getMyAccount()) - return false; - OString aSessionId( TeleManager::createUuid()); - TeleConferencePtr pConference( new TeleConference( this, NULL, aSessionId)); + TeleConferencePtr pConference( new TeleConference( this, NULL, NULL, aSessionId)); maConferences.push_back( pConference); /* TODO: associate the document with this session and conference */ @@ -528,10 +523,9 @@ bool TeleManager::startGroupSession( const rtl::OUString& rUConferenceRoom, cons /* FIXME: else? bail out? we have only a session ID without server then */ } OString aTarget( aBuf.makeStringAndClear()); - pConference->setTarget( aTarget); SAL_INFO( "tubes", "TeleManager::startGroupSession: creating channel request from " - << maAccountID.getStr() << " to " << aTarget.getStr()); + << tp_account_get_path_suffix( pAccount ) << " to " << aTarget.getStr() ); // MUC request GHashTable* pRequest = tp_asv_new( @@ -542,11 +536,13 @@ bool TeleManager::startGroupSession( const rtl::OUString& rUConferenceRoom, cons NULL); TpAccountChannelRequest * pChannelRequest = tp_account_channel_request_new( - mpAccount, pRequest, TP_USER_ACTION_TIME_NOT_USER_ACTION); - g_hash_table_unref( pRequest); + pAccount, pRequest, TP_USER_ACTION_TIME_NOT_USER_ACTION); SAL_WARN_IF( !pChannelRequest, "tubes", "TeleManager::startGroupSession: no channel"); if (!pChannelRequest) + { + g_hash_table_unref( pRequest); return false; + } setChannelReadyHandlerInvoked( false); @@ -555,9 +551,11 @@ bool TeleManager::startGroupSession( const rtl::OUString& rUConferenceRoom, cons iterateLoop( &TeleManager::isChannelReadyHandlerInvoked); + g_object_unref( pChannelRequest); + g_hash_table_unref( pRequest); + return pConference->getChannel() != NULL && pConference->isTubeOpen(); } -#endif void TeleManager::ensureLegacyChannel( TpAccount* pAccount, TpContact* pBuddy ) |