diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-03-11 20:22:37 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-03-11 20:22:37 +0800 |
commit | fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9 (patch) | |
tree | fa43f89134570a145e721945b72da07d27ac4f3f /libempathy | |
parent | cf327059e269141a38a3aa38f0a37d3c6eb0fbbb (diff) | |
download | gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.tar gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.tar.gz gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.tar.bz2 gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.tar.lz gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.tar.xz gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.tar.zst gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.zip |
Make sure we don't expect contact id and handle to be directly ready. Add some _run_until_ready.
svn path=/trunk/; revision=755
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-debug.c | 4 | ||||
-rw-r--r-- | libempathy/empathy-tp-call.c | 27 | ||||
-rw-r--r-- | libempathy/empathy-tp-chatroom.c | 116 | ||||
-rw-r--r-- | libempathy/empathy-tp-contact-factory.c | 2 | ||||
-rw-r--r-- | libempathy/empathy-tp-contact-list.c | 4 | ||||
-rw-r--r-- | libempathy/empathy-utils.c | 4 |
6 files changed, 69 insertions, 88 deletions
diff --git a/libempathy/empathy-debug.c b/libempathy/empathy-debug.c index f39573025..d81e6dca7 100644 --- a/libempathy/empathy-debug.c +++ b/libempathy/empathy-debug.c @@ -54,9 +54,11 @@ debug_init (void) const gchar *env; gint i; - env = g_getenv ("EMPATHY_DEBUG"); + env = g_getenv ("TELEPATHY_GLIB_DEBUG"); tp_debug_set_flags (env); + env = g_getenv ("EMPATHY_DEBUG"); + if (env) { debug_strv = g_strsplit_set (env, ":, ", 0); } else { diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c index afc6ff657..d218fd8ef 100644 --- a/libempathy/empathy-tp-call.c +++ b/libempathy/empathy-tp-call.c @@ -392,7 +392,6 @@ static void tp_call_is_ready (EmpathyTpCall *call) { EmpathyTpCallPriv *priv = GET_PRIV (call); - EmpathyContact *self_contact; GList *members; GList *local_pendings; GList *remote_pendings; @@ -404,13 +403,11 @@ tp_call_is_ready (EmpathyTpCall *call) if (!members) return; - self_contact = empathy_tp_group_get_self_contact (priv->group); local_pendings = empathy_tp_group_get_local_pendings (priv->group); remote_pendings = empathy_tp_group_get_remote_pendings (priv->group); if (local_pendings && - empathy_contact_equal (EMPATHY_CONTACT (((EmpathyPendingInfo *) - local_pendings->data)->member), self_contact)) + empathy_contact_is_user (((EmpathyPendingInfo *) local_pendings->data)->member)) { empathy_debug (DEBUG_DOMAIN, "Incoming call is ready - %p", @@ -418,8 +415,7 @@ tp_call_is_ready (EmpathyTpCall *call) priv->is_incoming = TRUE; priv->contact = g_object_ref (members->data); } - else if (remote_pendings && - empathy_contact_equal (EMPATHY_CONTACT (members->data), self_contact)) + else if (remote_pendings && empathy_contact_is_user (members->data)) { empathy_debug (DEBUG_DOMAIN, "Outgoing call is ready - %p", remote_pendings->data); @@ -428,7 +424,6 @@ tp_call_is_ready (EmpathyTpCall *call) tp_call_request_streams (call); } - g_object_unref (self_contact); g_list_foreach (members, (GFunc) g_object_unref, NULL); g_list_free (members); g_list_foreach (local_pendings, (GFunc) empathy_pending_info_free, NULL); @@ -458,10 +453,8 @@ tp_call_member_added_cb (EmpathyTpGroup *group, if (priv->status == EMPATHY_TP_CALL_STATUS_PENDING) { - if ((priv->is_incoming && - !empathy_contact_equal (contact, priv->contact)) - || (!priv->is_incoming && - empathy_contact_equal (contact, priv->contact))) + if ((priv->is_incoming && contact != priv->contact) || + (!priv->is_incoming && contact == priv->contact)) { priv->status = EMPATHY_TP_CALL_STATUS_ACCEPTED; g_signal_emit (call, signals[STATUS_CHANGED_SIGNAL], 0); @@ -831,17 +824,13 @@ void empathy_tp_call_accept_incoming_call (EmpathyTpCall *call) { EmpathyTpCallPriv *priv = GET_PRIV (call); - GList *local_pendings; + EmpathyContact *self_contact; empathy_debug (DEBUG_DOMAIN, "Accepting incoming call"); - local_pendings = empathy_tp_group_get_local_pendings (priv->group); - - empathy_tp_group_add_member (priv->group, EMPATHY_CONTACT - (((EmpathyPendingInfo *) local_pendings->data)->member), NULL); - - g_list_foreach (local_pendings, (GFunc) empathy_pending_info_free, NULL); - g_list_free (local_pendings); + self_contact = empathy_tp_group_get_self_contact (priv->group); + empathy_tp_group_add_member (priv->group, self_contact, NULL); + g_object_unref (self_contact); } void diff --git a/libempathy/empathy-tp-chatroom.c b/libempathy/empathy-tp-chatroom.c index a00aa581b..b66b38d2c 100644 --- a/libempathy/empathy-tp-chatroom.c +++ b/libempathy/empathy-tp-chatroom.c @@ -46,18 +46,6 @@ static void empathy_tp_chatroom_class_init (EmpathyTpChatroomClass * static void tp_chatroom_iface_init (EmpathyContactListIface *iface); static void empathy_tp_chatroom_init (EmpathyTpChatroom *chatroom); static void tp_chatroom_finalize (GObject *object); -static void tp_chatroom_member_added_cb (EmpathyTpGroup *group, - EmpathyContact *contact, - EmpathyContact *actor, - guint reason, - const gchar *message, - EmpathyTpChatroom *chatroom); -static void tp_chatroom_member_removed_cb (EmpathyTpGroup *group, - EmpathyContact *contact, - EmpathyContact *actor, - guint reason, - const gchar *message, - EmpathyTpChatroom *chatroom); static void tp_chatroom_add (EmpathyContactList *list, EmpathyContact *contact, const gchar *message); @@ -114,14 +102,59 @@ tp_chatroom_finalize (GObject *object) G_OBJECT_CLASS (empathy_tp_chatroom_parent_class)->finalize (object); } +static void +tp_chatroom_member_added_cb (EmpathyTpGroup *group, + EmpathyContact *contact, + EmpathyContact *actor, + guint reason, + const gchar *message, + EmpathyTpChatroom *chatroom) +{ + g_signal_emit_by_name (chatroom, "members-changed", + contact, actor, reason, message, + TRUE); +} + +static void +tp_chatroom_member_removed_cb (EmpathyTpGroup *group, + EmpathyContact *contact, + EmpathyContact *actor, + guint reason, + const gchar *message, + EmpathyTpChatroom *chatroom) +{ + g_signal_emit_by_name (chatroom, "members-changed", + contact, actor, reason, message, + FALSE); +} +static void +tp_chatroom_local_pending_cb (EmpathyTpGroup *group, + EmpathyContact *contact, + EmpathyContact *actor, + guint reason, + const gchar *message, + EmpathyTpChatroom *chatroom) +{ + EmpathyTpChatroomPriv *priv = GET_PRIV (chatroom); + + if (empathy_contact_is_user (contact)) { + priv->invitor = g_object_ref (actor); + priv->invit_message = g_strdup (message); + priv->is_invited = TRUE; + + empathy_debug (DEBUG_DOMAIN, "We are invited to join by %s (%d): %s", + empathy_contact_get_id (priv->invitor), + empathy_contact_get_handle (priv->invitor), + priv->invit_message); + } +} + EmpathyTpChatroom * empathy_tp_chatroom_new (McAccount *account, TpChan *tp_chan) { EmpathyTpChatroomPriv *priv; EmpathyTpChatroom *chatroom; - GList *members, *l; - EmpathyContact *user; g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL); @@ -142,32 +175,9 @@ empathy_tp_chatroom_new (McAccount *account, g_signal_connect (priv->group, "member-removed", G_CALLBACK (tp_chatroom_member_removed_cb), chatroom); - - /* Check if we are invited to join the chat */ - user = empathy_tp_group_get_self_contact (priv->group); - members = empathy_tp_group_get_local_pendings (priv->group); - for (l = members; l; l = l->next) { - EmpathyPendingInfo *info; - - info = l->data; - - if (!empathy_contact_equal (user, info->member)) { - continue; - } - - priv->invitor = g_object_ref (info->actor); - priv->invit_message = g_strdup (info->message); - priv->is_invited = TRUE; - - empathy_debug (DEBUG_DOMAIN, "We are invited to join by %s (%d): %s", - empathy_contact_get_id (priv->invitor), - empathy_contact_get_handle (priv->invitor), - priv->invit_message); - } - - g_list_foreach (members, (GFunc) empathy_pending_info_free, NULL); - g_list_free (members); - g_object_unref (user); + g_signal_connect (priv->group, "local-pending", + G_CALLBACK (tp_chatroom_local_pending_cb), + chatroom); return chatroom; } @@ -230,32 +240,6 @@ empathy_tp_chatroom_set_topic (EmpathyTpChatroom *chatroom, } static void -tp_chatroom_member_added_cb (EmpathyTpGroup *group, - EmpathyContact *contact, - EmpathyContact *actor, - guint reason, - const gchar *message, - EmpathyTpChatroom *chatroom) -{ - g_signal_emit_by_name (chatroom, "members-changed", - contact, actor, reason, message, - TRUE); -} - -static void -tp_chatroom_member_removed_cb (EmpathyTpGroup *group, - EmpathyContact *contact, - EmpathyContact *actor, - guint reason, - const gchar *message, - EmpathyTpChatroom *chatroom) -{ - g_signal_emit_by_name (chatroom, "members-changed", - contact, actor, reason, message, - FALSE); -} - -static void tp_chatroom_add (EmpathyContactList *list, EmpathyContact *contact, const gchar *message) diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c index 8773207e0..bbb17394b 100644 --- a/libempathy/empathy-tp-contact-factory.c +++ b/libempathy/empathy-tp-contact-factory.c @@ -731,6 +731,8 @@ tp_contact_factory_got_self_handle_cb (TpConnection *proxy, return; } + empathy_debug (DEBUG_DOMAIN, "Connection ready"); + empathy_contact_set_handle (priv->user, handle); priv->ready = TRUE; diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c index b89384487..779aa6132 100644 --- a/libempathy/empathy-tp-contact-list.c +++ b/libempathy/empathy-tp-contact-list.c @@ -710,8 +710,8 @@ empathy_tp_contact_list_new (McAccount *account) priv->tp_conn = tp_conn; priv->account = g_object_ref (account); priv->mc = mc; - priv->contacts_groups = g_hash_table_new_full (empathy_contact_hash, - empathy_contact_equal, + priv->contacts_groups = g_hash_table_new_full (g_direct_hash, + g_direct_equal, (GDestroyNotify) g_object_unref, (GDestroyNotify) tp_contact_list_group_list_free); diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index f54f4193f..c24927b36 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -452,6 +452,10 @@ empathy_call_with_contact (EmpathyContact *contact) group = empathy_tp_group_new (account, new_chan); factory = empathy_contact_factory_new (); self_contact = empathy_contact_factory_get_user (factory, account); + empathy_contact_run_until_ready (self_contact, + EMPATHY_CONTACT_READY_HANDLE, + NULL); + empathy_tp_group_add_member (group, contact, ""); empathy_tp_group_add_member (group, self_contact, ""); |