From 87cafb1df56b5eca945b28f89a441c05e3aef537 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 20 Mar 2009 10:14:58 +0000 Subject: [PATCH] empathy_contact_set_handle: remove the handle ready flag when the handle is set to 0 From: Guillaume Desmottes svn path=/trunk/; revision=2719 --- libempathy/empathy-contact.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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); } -- 2.39.2