]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-tp-tube.c
empathy-tp-tube: remove initiator and type member variables as they are not used
[empathy.git] / libempathy / empathy-tp-tube.c
index f8ce0536f1f0a60e8a6464154a113c7ef25b9d40..4ceb2c4a72d04190aca3f717c43f69521d4238af 100644 (file)
@@ -64,12 +64,10 @@ free_empathy_tp_tube_accept_data (gpointer data)
 typedef struct
 {
   TpChannel *channel;
-  guint initiator;
-  guint type;
   gchar *service;
   /* FIXME readd support for parameters.. */
   GHashTable *parameters;
-  guint state;
+  EmpTubeChannelState state;
   EmpathyContact *initiator_contact;
   EmpathyContactFactory *factory;
 } EmpathyTpTubePriv;
@@ -93,7 +91,7 @@ G_DEFINE_TYPE (EmpathyTpTube, empathy_tp_tube, G_TYPE_OBJECT)
 
 static void
 tp_tube_state_changed_cb (TpProxy *proxy,
-                          guint state,
+                          EmpTubeChannelState state,
                           gpointer user_data,
                           GObject *tube)
 {
@@ -229,13 +227,12 @@ empathy_tp_tube_class_init (EmpathyTpTubeClass *klass)
 
   g_object_class_install_property (object_class, PROP_CHANNEL,
       g_param_spec_object ("channel", "channel", "channel", TP_TYPE_CHANNEL,
-      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NAME |
-        G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (object_class, PROP_STATE,
-      g_param_spec_uint ("state", "state", "state", 0, G_MAXUINT, 0,
-        G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
-        G_PARAM_STATIC_BLURB));
+      g_param_spec_uint ("state", "state", "state",
+        0, NUM_EMP_TUBE_CHANNEL_STATES, 0,
+        G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_STRINGS));
 
   signals[DESTROY] = g_signal_new ("destroy",
       G_TYPE_FROM_CLASS (klass),
@@ -271,7 +268,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;
@@ -346,9 +344,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 +372,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;
 }