summaryrefslogtreecommitdiff
path: root/tubes/source/manager.cxx
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2012-07-13 22:42:48 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2012-07-17 16:40:25 +0200
commit53b180a49af8aaa25b9b38a8b020113483f0af6b (patch)
treee784ec91a5a2b6614cfc8c050891c2ff0104d9e4 /tubes/source/manager.cxx
parent019f35d7e4e4494af3a11429219cb361897a7872 (diff)
tubes: associate the document directly with TeleConference
Packet communication now goes directly through TeleConference and TeleManager is used only for receiving files and new channels. This should also allow collaboration of different documents with different contacts independently. Change-Id: Iaf719dce156f1c4c9edc3db4ff0964dec0e0c944
Diffstat (limited to 'tubes/source/manager.cxx')
-rw-r--r--tubes/source/manager.cxx48
1 files changed, 20 insertions, 28 deletions
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index 944d33a9b503..b524942071b1 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -124,9 +124,9 @@ void TeleManager::DBusChannelHandler(
SAL_INFO( "tubes", "accepting");
aAccepted = true;
- TeleConferencePtr pConference( new TeleConference( pManager, pAccount, TP_DBUS_TUBE_CHANNEL( pChannel ) ) );
- pManager->maConferences.push_back( pConference);
+ TeleConference* pConference = new TeleConference( pManager, pAccount, TP_DBUS_TUBE_CHANNEL( pChannel ) );
pConference->acceptTube();
+ pManager->sigConferenceCreated( pConference );
}
else
{
@@ -506,7 +506,7 @@ bool TeleManager::registerClients()
/* TODO: factor out common code with startBuddySession() */
-bool TeleManager::startGroupSession( TpAccount *pAccount,
+TeleConference* TeleManager::startGroupSession( TpAccount *pAccount,
const rtl::OUString& rUConferenceRoom,
const rtl::OUString& rUConferenceServer )
{
@@ -514,11 +514,6 @@ bool TeleManager::startGroupSession( TpAccount *pAccount,
OString aSessionId( TeleManager::createUuid());
- TeleConferencePtr pConference( new TeleConference( this, NULL, NULL ) );
- maConferences.push_back( pConference);
-
- /* TODO: associate the document with this session and conference */
-
/* FIXME: does this work at all _creating_ a MUC? */
// Use conference and server if given, else create conference.
OString aConferenceRoom( OUStringToOString( rUConferenceRoom, RTL_TEXTENCODING_UTF8));
@@ -552,20 +547,25 @@ bool TeleManager::startGroupSession( TpAccount *pAccount,
if (!pChannelRequest)
{
g_hash_table_unref( pRequest);
- return false;
+ return NULL;
}
setChannelReadyHandlerInvoked( false);
+ TeleConference* pConference = new TeleConference( this, NULL, NULL );
+
tp_account_channel_request_create_and_handle_channel_async(
- pChannelRequest, NULL, TeleManager_ChannelReadyHandler, pConference.get());
+ pChannelRequest, NULL, TeleManager_ChannelReadyHandler, pConference);
iterateLoop( &TeleManager::isChannelReadyHandlerInvoked);
g_object_unref( pChannelRequest);
g_hash_table_unref( pRequest);
- return pConference->getChannel() != NULL && pConference->isTubeOpen();
+ if (!pConference->getChannel() || !pConference->isTubeOpen())
+ return NULL;
+
+ return pConference;
}
@@ -598,16 +598,12 @@ void TeleManager::ensureLegacyChannel( TpAccount* pAccount, TpContact* pBuddy )
/* TODO: factor out common code with startGroupSession() */
-bool TeleManager::startBuddySession( TpAccount *pAccount, TpContact *pBuddy )
+TeleConference* TeleManager::startBuddySession( TpAccount *pAccount, TpContact *pBuddy )
{
INFO_LOGGER( "TeleManager::startBuddySession");
ensureLegacyChannel( pAccount, pBuddy );
- TeleConferencePtr pConference( new TeleConference( this, NULL, NULL ) );
- maConferences.push_back( pConference);
-
- /* TODO: associate the document with this session and conference */
const char *pIdentifier = tp_contact_get_identifier( pBuddy);
SAL_INFO( "tubes", "TeleManager::startBuddySession: creating channel request from "
<< tp_account_get_path_suffix( pAccount)
@@ -626,20 +622,25 @@ bool TeleManager::startBuddySession( TpAccount *pAccount, TpContact *pBuddy )
if (!pChannelRequest)
{
g_hash_table_unref( pRequest);
- return false;
+ return NULL;
}
setChannelReadyHandlerInvoked( false);
+ TeleConference* pConference = new TeleConference( this, NULL, NULL );
+
tp_account_channel_request_create_and_handle_channel_async(
- pChannelRequest, NULL, TeleManager_ChannelReadyHandler, pConference.get());
+ pChannelRequest, NULL, TeleManager_ChannelReadyHandler, pConference );
iterateLoop( &TeleManager::isChannelReadyHandlerInvoked);
g_object_unref( pChannelRequest);
g_hash_table_unref( pRequest);
- return pConference->getChannel() != NULL && pConference->isTubeOpen();
+ if (!pConference->getChannel() || !pConference->isTubeOpen())
+ return NULL;
+
+ return pConference;
}
void TeleManager::prepareAccountManager()
@@ -750,15 +751,6 @@ sal_uInt32 TeleManager::sendPacket( const TelePacket& rPacket ) const
return nSent;
}
-
-void TeleManager::callbackOnRecieved( TeleConference* pConference, TelePacket& rPacket) const
-{
- INFO_LOGGER( "TeleManager::callbackOnRecieved");
-
- sigPacketReceived( pConference, rPacket );
-}
-
-
bool TeleManager::popPacket( TelePacket& rPacket )
{
INFO_LOGGER( "TeleManager::popPacket");