summaryrefslogtreecommitdiff
path: root/tubes
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2012-03-26 14:40:17 +0100
committerMatúš Kukan <matus.kukan@gmail.com>2012-07-17 16:40:01 +0200
commit4a758fc56f2491c911f035bbe86c9b50fd69436a (patch)
tree57dcf477376cd658f93c96b9b981202b3adcf0f8 /tubes
parent70ecadfcffc780f5024c1ed99b18b7939ea0609f (diff)
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.
Diffstat (limited to 'tubes')
-rw-r--r--tubes/inc/tubes/manager.hxx2
-rw-r--r--tubes/source/manager.cxx30
2 files changed, 32 insertions, 0 deletions
diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx
index c75e3c123e84..8ba3a020ce48 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:
+ void ensureLegacyChannel( TpAccount* pAccount, TpContact* pBuddy );
+
TeleConferenceVector maConferences;
bool mbAcceptIncoming;
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index 21d0d4186349..73895f9c6ee0 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));