]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-tp-tube.c
empathy_tp_tube_new_stream_tube: allow NULL as parameters. Fixes #575817
[empathy.git] / libempathy / empathy-tp-tube.c
index 0772ac27195b96ab6b35b2f2b98c1d0111977863..bde84fbed7f9f99776784d9ec5e4716e4ed7cf14 100644 (file)
@@ -271,7 +271,8 @@ empathy_tp_tube_new_stream_tube (EmpathyContact *contact,
                                  TpSocketAddressType type,
                                  const gchar *hostname,
                                  guint port,
-                                 const gchar *service)
+                                 const gchar *service,
+                                 GHashTable *parameters)
 {
   MissionControl *mc;
   McAccount *account;
@@ -291,7 +292,7 @@ empathy_tp_tube_new_stream_tube (EmpathyContact *contact,
   g_return_val_if_fail (hostname != NULL, NULL);
   g_return_val_if_fail (service != NULL, NULL);
 
-  mc = empathy_mission_control_new ();
+  mc = empathy_mission_control_dup_singleton ();
   account = empathy_contact_get_account (contact);
   connection = mission_control_get_tpconnection (mc, account, NULL);
   g_object_unref (mc);
@@ -346,9 +347,16 @@ empathy_tp_tube_new_stream_tube (EmpathyContact *contact,
   dbus_g_type_struct_set (address, 0, hostname, 1, port, G_MAXUINT);
   control_param = tp_g_value_slice_new (G_TYPE_STRING);
 
+  if (parameters == NULL)
+    /* Pass an empty dict as parameters */
+    parameters = g_hash_table_new (g_str_hash, g_str_equal);
+  else
+    g_hash_table_ref (parameters);
+
   if (!emp_cli_channel_type_stream_tube_run_offer_stream_tube (
         TP_PROXY(channel), -1, type, address,
-        TP_SOCKET_ACCESS_CONTROL_LOCALHOST, control_param, &error, NULL))
+        TP_SOCKET_ACCESS_CONTROL_LOCALHOST, control_param, parameters,
+        &error, NULL))
     {
       DEBUG ("Couldn't offer tube: %s", error->message);
       g_clear_error (&error);
@@ -367,6 +375,7 @@ OUT:
   tp_g_value_slice_free (address);
   tp_g_value_slice_free (control_param);
   g_object_unref (connection);
+  g_hash_table_unref (parameters);
 
   return tube;
 }