Kaydet (Commit) 1ffa61a4 authored tarafından Will Thompson's avatar Will Thompson Kaydeden (comit) Matúš Kukan

tubes: make conference hold a TpDBusTubeChannel

It already was, actually. :)
üst d32927c8
...@@ -49,7 +49,7 @@ class TeleConference : public boost::enable_shared_from_this<TeleConference> ...@@ -49,7 +49,7 @@ class TeleConference : public boost::enable_shared_from_this<TeleConference>
{ {
public: public:
TeleConference( TeleManager* pManager, TpAccount *pAccount, TpChannel* pChannel, const rtl::OString& rSessionId ); TeleConference( TeleManager* pManager, TpAccount *pAccount, TpDBusTubeChannel* pChannel, const rtl::OString& rSessionId );
~TeleConference(); ~TeleConference();
/// Close channel and call finalize() /// Close channel and call finalize()
...@@ -79,8 +79,8 @@ public: ...@@ -79,8 +79,8 @@ public:
// --- following only to be called only by manager's callbacks --- // --- following only to be called only by manager's callbacks ---
// TODO: make friends instead // TODO: make friends instead
void setChannel( TpAccount* pAccount, TpChannel* pChannel ); void setChannel( TpAccount* pAccount, TpDBusTubeChannel* pChannel );
TpChannel* getChannel() const { return mpChannel; } TpDBusTubeChannel* getChannel() const { return mpChannel; }
bool offerTube(); bool offerTube();
bool acceptTube(); bool acceptTube();
/// got tube accepted on other end as well? /// got tube accepted on other end as well?
...@@ -117,7 +117,7 @@ private: ...@@ -117,7 +117,7 @@ private:
rtl::OString maSessionId; rtl::OString maSessionId;
TeleManager* mpManager; TeleManager* mpManager;
TpAccount* mpAccount; TpAccount* mpAccount;
TpChannel* mpChannel; TpDBusTubeChannel* mpChannel;
gchar* mpAddress; gchar* mpAddress;
GDBusConnection* mpTube; GDBusConnection* mpTube;
guint maObjectRegistrationId; guint maObjectRegistrationId;
......
...@@ -142,7 +142,7 @@ static void TeleConference_ChannelCloseHandler( ...@@ -142,7 +142,7 @@ static void TeleConference_ChannelCloseHandler(
void TeleConference::TubeOfferedHandler( void TeleConference::TubeOfferedHandler(
TpChannel* pChannel, TpChannel* pBaseChannel,
const gchar* pAddress, const gchar* pAddress,
const GError* pError, const GError* pError,
gpointer pUserData, gpointer pUserData,
...@@ -168,8 +168,9 @@ void TeleConference::TubeOfferedHandler( ...@@ -168,8 +168,9 @@ void TeleConference::TubeOfferedHandler(
if (!pAddress) if (!pAddress)
return; return;
TpDBusTubeChannel* pChannel = TP_DBUS_TUBE_CHANNEL( pBaseChannel);
SAL_WARN_IF( pChannel != pConference->getChannel(), "tubes", "TeleConference::TubeOfferedHandler: not my channel"); SAL_WARN_IF( pChannel != pConference->getChannel(), "tubes", "TeleConference::TubeOfferedHandler: not my channel");
if (pChannel != pConference->getChannel()) if ((pChannel) != pConference->getChannel())
return; return;
pConference->mpAddress = g_strdup( pAddress ); pConference->mpAddress = g_strdup( pAddress );
...@@ -192,7 +193,7 @@ bool TeleConference::tryToOpen() ...@@ -192,7 +193,7 @@ bool TeleConference::tryToOpen()
} }
void TeleConference::TubeChannelStateChangedHandler( void TeleConference::TubeChannelStateChangedHandler(
TpChannel* pChannel, TpChannel* pBaseChannel,
guint nState, guint nState,
gpointer pUserData, gpointer pUserData,
GObject* /*weak_object*/ GObject* /*weak_object*/
...@@ -207,6 +208,7 @@ void TeleConference::TubeChannelStateChangedHandler( ...@@ -207,6 +208,7 @@ void TeleConference::TubeChannelStateChangedHandler(
if (!pConference) if (!pConference)
return; return;
TpDBusTubeChannel* pChannel = TP_DBUS_TUBE_CHANNEL( pBaseChannel);
SAL_WARN_IF( pChannel != pConference->getChannel(), "tubes", SAL_WARN_IF( pChannel != pConference->getChannel(), "tubes",
"TeleConference::TubeChannelStateChangedHandler: not my channel"); "TeleConference::TubeChannelStateChangedHandler: not my channel");
if (pChannel != pConference->getChannel()) if (pChannel != pConference->getChannel())
...@@ -217,7 +219,7 @@ void TeleConference::TubeChannelStateChangedHandler( ...@@ -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 ), maSessionId( rSessionId ),
mpManager( pManager), mpManager( pManager),
...@@ -238,7 +240,7 @@ TeleConference::~TeleConference() ...@@ -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"); OSL_ENSURE( !mpChannel, "TeleConference::setChannel: already have channel");
if (mpChannel) if (mpChannel)
...@@ -254,7 +256,7 @@ void TeleConference::setChannel( TpAccount *pAccount, TpChannel* pChannel ) ...@@ -254,7 +256,7 @@ void TeleConference::setChannel( TpAccount *pAccount, TpChannel* pChannel )
GError* pError = NULL; GError* pError = NULL;
TpProxySignalConnection* pProxySignalConnection = TpProxySignalConnection* pProxySignalConnection =
tp_cli_channel_interface_tube_connect_to_tube_channel_state_changed( tp_cli_channel_interface_tube_connect_to_tube_channel_state_changed(
mpChannel, TP_CHANNEL( mpChannel),
&TeleConference::TubeChannelStateChangedHandler, &TeleConference::TubeChannelStateChangedHandler,
this, this,
NULL, NULL,
...@@ -295,7 +297,7 @@ bool TeleConference::acceptTube() ...@@ -295,7 +297,7 @@ bool TeleConference::acceptTube()
if (!mpChannel || mpTube) if (!mpChannel || mpTube)
return false; return false;
tp_cli_channel_type_dbus_tube_call_accept( mpChannel, -1, tp_cli_channel_type_dbus_tube_call_accept( TP_CHANNEL( mpChannel), -1,
TP_SOCKET_ACCESS_CONTROL_CREDENTIALS, TP_SOCKET_ACCESS_CONTROL_CREDENTIALS,
&TeleConference::TubeOfferedHandler, &TeleConference::TubeOfferedHandler,
this, NULL, NULL); this, NULL, NULL);
...@@ -318,7 +320,7 @@ bool TeleConference::offerTube() ...@@ -318,7 +320,7 @@ bool TeleConference::offerTube()
NULL); NULL);
tp_cli_channel_type_dbus_tube_call_offer( tp_cli_channel_type_dbus_tube_call_offer(
mpChannel, // proxy TP_CHANNEL( mpChannel), // proxy
-1, // timeout_ms -1, // timeout_ms
pParams, // in_parameters pParams, // in_parameters
TP_SOCKET_ACCESS_CONTROL_CREDENTIALS, // in_access_control TP_SOCKET_ACCESS_CONTROL_CREDENTIALS, // in_access_control
...@@ -387,7 +389,7 @@ void TeleConference::close() ...@@ -387,7 +389,7 @@ void TeleConference::close()
INFO_LOGGER( "TeleConference::close"); INFO_LOGGER( "TeleConference::close");
if (mpChannel) if (mpChannel)
tp_cli_channel_call_close( mpChannel, 5000, TeleConference_ChannelCloseHandler, this, NULL, NULL); tp_cli_channel_call_close( TP_CHANNEL( mpChannel), 5000, TeleConference_ChannelCloseHandler, this, NULL, NULL);
else else
finalize(); finalize();
} }
...@@ -552,7 +554,7 @@ void TeleConference::sendFile( rtl::OUString &localUri, FileSentCallback pCallba ...@@ -552,7 +554,7 @@ void TeleConference::sendFile( rtl::OUString &localUri, FileSentCallback pCallba
SendFileRequest *pReq = new SendFileRequest( this, pCallback, pUserData); SendFileRequest *pReq = new SendFileRequest( this, pCallback, pUserData);
empathy_ft_handler_new_outgoing( mpAccount, empathy_ft_handler_new_outgoing( mpAccount,
tp_channel_get_target_contact( mpChannel), tp_channel_get_target_contact( TP_CHANNEL( mpChannel)),
pSource, pSource,
0, 0,
&TeleConference::FTReady, pReq); &TeleConference::FTReady, pReq);
......
...@@ -119,12 +119,12 @@ void TeleManager::DBusChannelHandler( ...@@ -119,12 +119,12 @@ void TeleManager::DBusChannelHandler(
SAL_INFO( "tubes", "TeleManager::DBusChannelHandler: incoming dbus channel: " SAL_INFO( "tubes", "TeleManager::DBusChannelHandler: incoming dbus channel: "
<< tp_channel_get_identifier( pChannel)); << tp_channel_get_identifier( pChannel));
if (tp_channel_get_channel_type_id( pChannel) == TP_IFACE_QUARK_CHANNEL_TYPE_DBUS_TUBE) if (TP_IS_DBUS_TUBE_CHANNEL( pChannel))
{ {
SAL_INFO( "tubes", "accepting"); SAL_INFO( "tubes", "accepting");
aAccepted = true; aAccepted = true;
TeleConferencePtr pConference( new TeleConference( pManager, pAccount, pChannel, "")); TeleConferencePtr pConference( new TeleConference( pManager, pAccount, TP_DBUS_TUBE_CHANNEL( pChannel), ""));
pManager->maConferences.push_back( pConference); pManager->maConferences.push_back( pConference);
pConference->acceptTube(); pConference->acceptTube();
} }
...@@ -283,7 +283,7 @@ static void TeleManager_ChannelReadyHandler( ...@@ -283,7 +283,7 @@ static void TeleManager_ChannelReadyHandler(
} }
pConference->setChannel( tp_account_channel_request_get_account( pChannelRequest), pConference->setChannel( tp_account_channel_request_get_account( pChannelRequest),
pChannel); TP_DBUS_TUBE_CHANNEL (pChannel));
pConference->offerTube(); pConference->offerTube();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment