From: Guillaume Desmottes Date: Fri, 20 Mar 2009 10:14:58 +0000 (+0000) Subject: empathy_contact_set_handle: remove the handle ready flag when the handle is set to 0 X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=87cafb1df56b5eca945b28f89a441c05e3aef537 empathy_contact_set_handle: remove the handle ready flag when the handle is set to 0 From: Guillaume Desmottes svn path=/trunk/; revision=2719 --- diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 59d55fd4..1cac4851 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -456,6 +456,19 @@ contact_set_ready_flag (EmpathyContact *contact, } } +static void +contact_remove_ready_flag (EmpathyContact *contact, + EmpathyContactReady flag) +{ + EmpathyContactPriv *priv = GET_PRIV (contact); + + if (priv->ready & flag) + { + priv->ready ^= flag; + g_object_notify (G_OBJECT (contact), "ready"); + } +} + EmpathyContact * empathy_contact_new (McAccount *account) { @@ -713,7 +726,12 @@ empathy_contact_set_handle (EmpathyContact *contact, priv->handle = handle; g_object_notify (G_OBJECT (contact), "handle"); } - contact_set_ready_flag (contact, EMPATHY_CONTACT_READY_HANDLE); + + if (handle != 0) + contact_set_ready_flag (contact, EMPATHY_CONTACT_READY_HANDLE); + else + contact_remove_ready_flag (contact, EMPATHY_CONTACT_READY_HANDLE); + g_object_unref (contact); }