diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-05-03 17:14:45 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-05-03 17:25:19 +0800 |
commit | 6fa54e003930d9c0f3fe64a5e799b2f2c55c0fef (patch) | |
tree | 432a838051f3f43aed06c630262c326cd9046ac5 /libempathy | |
parent | a296925676f10385929fee162610d49f1caff373 (diff) | |
download | gsoc2013-empathy-6fa54e003930d9c0f3fe64a5e799b2f2c55c0fef.tar gsoc2013-empathy-6fa54e003930d9c0f3fe64a5e799b2f2c55c0fef.tar.gz gsoc2013-empathy-6fa54e003930d9c0f3fe64a5e799b2f2c55c0fef.tar.bz2 gsoc2013-empathy-6fa54e003930d9c0f3fe64a5e799b2f2c55c0fef.tar.lz gsoc2013-empathy-6fa54e003930d9c0f3fe64a5e799b2f2c55c0fef.tar.xz gsoc2013-empathy-6fa54e003930d9c0f3fe64a5e799b2f2c55c0fef.tar.zst gsoc2013-empathy-6fa54e003930d9c0f3fe64a5e799b2f2c55c0fef.zip |
tp-chat:stop using the handle of members
https://bugzilla.gnome.org/show_bug.cgi?id=675229
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-tp-chat.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index aa324ca3b..390f9a533 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -845,10 +845,9 @@ add_members_contact (EmpathyTpChat *self, check_almost_ready (self); } -static EmpathyContact * -chat_lookup_contact (EmpathyTpChat *self, - TpHandle handle, - gboolean remove_) +static void +remove_member (EmpathyTpChat *self, + EmpathyContact *contact) { GList *l; @@ -856,23 +855,13 @@ chat_lookup_contact (EmpathyTpChat *self, { EmpathyContact *c = l->data; - if (empathy_contact_get_handle (c) != handle) - continue; - - if (remove_) + if (contact == c) { - /* Caller takes the reference. */ self->priv->members = g_list_delete_link (self->priv->members, l); + g_object_unref (c); + break; } - else - { - g_object_ref (c); - } - - return c; } - - return NULL; } static void @@ -884,13 +873,15 @@ contact_renamed (EmpathyTpChat *self, { EmpathyContact *old = NULL, *new = NULL; - old = chat_lookup_contact (self, tp_contact_get_handle (old_contact), TRUE); + old = empathy_contact_dup_from_tp_contact (old_contact); new = empathy_contact_dup_from_tp_contact (new_contact); self->priv->members = g_list_prepend (self->priv->members, new); if (old != NULL) { + remove_member (self, old); + g_signal_emit (self, signals[SIG_MEMBER_RENAMED], 0, old, new, reason, message); g_object_unref (old); @@ -943,8 +934,8 @@ tp_chat_group_contacts_changed_cb (TpChannel *channel, if (actor != NULL) { - actor_contact = chat_lookup_contact (self, tp_contact_get_handle (actor), - FALSE); + actor_contact = empathy_contact_dup_from_tp_contact (actor); + if (actor_contact == NULL) { /* FIXME: handle this a tad more gracefully: perhaps @@ -962,11 +953,12 @@ tp_chat_group_contacts_changed_cb (TpChannel *channel, TpContact *tp_contact = g_ptr_array_index (removed, i); EmpathyContact *contact; - contact = chat_lookup_contact (self, tp_contact_get_handle (tp_contact), - TRUE); + contact = empathy_contact_dup_from_tp_contact (tp_contact); if (contact != NULL) { + remove_member (self, contact); + g_signal_emit (self, signals[SIG_MEMBERS_CHANGED], 0, contact, actor_contact, reason, message, FALSE); g_object_unref (contact); |