aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-tp-call.c19
-rw-r--r--libempathy/empathy-utils.c38
2 files changed, 49 insertions, 8 deletions
diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c
index c9da17491..b72e3877e 100644
--- a/libempathy/empathy-tp-call.c
+++ b/libempathy/empathy-tp-call.c
@@ -542,6 +542,13 @@ tp_call_finalize (GObject *object)
g_slice_free (EmpathyTpCallStream, priv->audio);
g_slice_free (EmpathyTpCallStream, priv->video);
g_object_unref (priv->group);
+
+ if (priv->connection != NULL)
+ g_object_unref (priv->connection);
+
+ if (priv->channel != NULL)
+ g_object_unref (priv->channel);
+
if (priv->contact)
{
g_object_unref (priv->contact);
@@ -561,13 +568,15 @@ tp_call_set_property (GObject *object,
switch (prop_id)
{
case PROP_CONNECTION:
- priv->connection = g_value_get_object (value);
+ priv->connection = g_value_dup_object (value);
break;
case PROP_CHANNEL:
- priv->channel = g_value_get_object (value);
+ priv->channel = g_value_dup_object (value);
break;
case PROP_CONTACT:
- priv->contact = g_value_get_object (value);
+ /* FIXME should this one be writable in the first place ? */
+ g_assert (priv->contact == NULL);
+ priv->contact = g_value_dup_object (value);
break;
case PROP_IS_INCOMING:
priv->is_incoming = g_value_get_boolean (value);
@@ -653,12 +662,12 @@ empathy_tp_call_class_init (EmpathyTpCallClass *klass)
g_object_class_install_property (object_class, PROP_CONNECTION,
g_param_spec_object ("connection", "connection", "connection",
TELEPATHY_CONN_TYPE,
- G_PARAM_CONSTRUCT | G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
g_object_class_install_property (object_class, PROP_CHANNEL,
g_param_spec_object ("channel", "channel", "channel",
TELEPATHY_CHAN_TYPE,
- G_PARAM_CONSTRUCT | G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
g_object_class_install_property (object_class, PROP_CONTACT,
g_param_spec_object ("contact", "Call contact", "Call contact",
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index 070e45a0e..7548c58fb 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -463,6 +463,28 @@ empathy_call_with_contact (EmpathyContact *contact)
#endif
}
+#ifdef HAVE_VOIP
+struct empathy_call_cb_user_data {
+ guint handler;
+ GObject *factory;
+};
+
+static void
+empathy_call_with_contact_id_got_handle_cb (EmpathyContact *contact,
+ GParamSpec *property, gpointer user_data) {
+
+ struct empathy_call_cb_user_data *ud =
+ (struct empathy_call_cb_user_data *) user_data;
+
+ g_signal_handler_disconnect (contact, ud->handler);
+
+ empathy_call_with_contact (contact);
+ g_object_unref (ud->factory);
+ g_object_unref (contact);
+ g_free (ud);
+}
+#endif
+
void
empathy_call_with_contact_id (McAccount *account, const gchar *contact_id)
{
@@ -472,9 +494,19 @@ empathy_call_with_contact_id (McAccount *account, const gchar *contact_id)
factory = empathy_contact_factory_new ();
contact = empathy_contact_factory_get_from_id (factory, account, contact_id);
- empathy_call_with_contact (contact);
- g_object_unref (contact);
- g_object_unref (factory);
+
+ if (empathy_contact_get_handle (contact) != 0) {
+ empathy_call_with_contact (contact);
+ g_object_unref (contact);
+ g_object_unref (factory);
+ } else {
+ struct empathy_call_cb_user_data *ud;
+ ud = g_malloc0 (sizeof (struct empathy_call_cb_user_data));
+ ud->factory = G_OBJECT (factory);
+ ud->handler = g_signal_connect (G_OBJECT (contact), "notify::handle",
+ G_CALLBACK (empathy_call_with_contact_id_got_handle_cb), ud);
+ }
+
#endif
}