]> git.0d.be Git - empathy.git/commitdiff
contact_list_store_chat_state_changed_cb(): tidy
authorWill Thompson <will.thompson@collabora.co.uk>
Fri, 15 Apr 2011 18:31:28 +0000 (19:31 +0100)
committerWill Thompson <will.thompson@collabora.co.uk>
Mon, 25 Apr 2011 10:55:15 +0000 (11:55 +0100)
This doesn't fix bgo#647891, but I think it makes the loop clearer.

Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
libempathy-gtk/empathy-contact-list-store.c

index f6a7a114d343db80a1e56f9185a73b1f27d0a19a..783ce77ef9e530e8957eea7663bf84a7faacddc3 100644 (file)
@@ -194,17 +194,15 @@ contact_list_store_chat_state_changed_cb (TpChannel *self,
 
        contacts = empathy_contact_list_get_members (priv->list);
 
-       /* Find the contact in the list. After that l is the list elem or NULL */
        for (l = contacts; l != NULL; l = l->next) {
-               if (empathy_contact_get_handle (EMPATHY_CONTACT (l->data)) ==
-                   contact_handle) {
+               EmpathyContact *contact = EMPATHY_CONTACT (l->data);
+
+               if (empathy_contact_get_handle (contact) == contact_handle) {
+                       contact_list_store_contact_update (store, contact);
                        break;
                }
        }
 
-       if (l != NULL)
-               contact_list_store_contact_update (store, l->data);
-
        g_list_foreach (contacts, (GFunc) g_object_unref, NULL);
        g_list_free (contacts);
 }