diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2007-05-02 20:38:49 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2007-05-02 20:38:49 +0800 |
commit | 59f3e5480f8b20dcea7d7b19682a5c2f67260cdd (patch) | |
tree | f441f3eea5f7540923d2631ec27a4c3e2936decf /libempathy/empathy-contact-list.c | |
parent | 6e1d5d1bf7e4c1bbac9d1d76fe967acf0dc423d1 (diff) | |
download | gsoc2013-empathy-59f3e5480f8b20dcea7d7b19682a5c2f67260cdd.tar gsoc2013-empathy-59f3e5480f8b20dcea7d7b19682a5c2f67260cdd.tar.gz gsoc2013-empathy-59f3e5480f8b20dcea7d7b19682a5c2f67260cdd.tar.bz2 gsoc2013-empathy-59f3e5480f8b20dcea7d7b19682a5c2f67260cdd.tar.lz gsoc2013-empathy-59f3e5480f8b20dcea7d7b19682a5c2f67260cdd.tar.xz gsoc2013-empathy-59f3e5480f8b20dcea7d7b19682a5c2f67260cdd.tar.zst gsoc2013-empathy-59f3e5480f8b20dcea7d7b19682a5c2f67260cdd.zip |
[darcs-to-svn @ Fix setting presence]
svn path=/trunk/; revision=23
Diffstat (limited to 'libempathy/empathy-contact-list.c')
-rw-r--r-- | libempathy/empathy-contact-list.c | 44 |
1 files changed, 11 insertions, 33 deletions
diff --git a/libempathy/empathy-contact-list.c b/libempathy/empathy-contact-list.c index 1a8640026..9ed83df70 100644 --- a/libempathy/empathy-contact-list.c +++ b/libempathy/empathy-contact-list.c @@ -192,7 +192,6 @@ static void contact_list_parse_presence_foreach (guint static void contact_list_presences_table_foreach (const gchar *state_str, GHashTable *presences_table, GossipPresence **presence); -static GossipPresenceState contact_list_presence_state_from_str (const gchar *str); enum { CONTACT_ADDED, @@ -1728,9 +1727,11 @@ contact_list_parse_presence_foreach (guint handle, (GHFunc) contact_list_presences_table_foreach, &presence); - gossip_debug (DEBUG_DOMAIN, "Presence changed for %s (%d)", + gossip_debug (DEBUG_DOMAIN, "Presence changed for %s (%d) to %s (%d)", gossip_contact_get_name (contact), - handle); + handle, + presence ? gossip_presence_get_status (presence) : "unset", + presence ? gossip_presence_get_state (presence) : MC_PRESENCE_UNSET); contact_list_block_contact (list, contact); gossip_contact_set_presence (contact, presence); @@ -1742,19 +1743,19 @@ contact_list_presences_table_foreach (const gchar *state_str, GHashTable *presences_table, GossipPresence **presence) { - GossipPresenceState state; - const GValue *message; + McPresence state; + const GValue *message; + + state = gossip_presence_state_from_str (state_str); + if ((state == MC_PRESENCE_UNSET) || (state == MC_PRESENCE_OFFLINE)) { + return; + } if (*presence) { g_object_unref (*presence); *presence = NULL; } - state = contact_list_presence_state_from_str (state_str); - if (state == GOSSIP_PRESENCE_STATE_UNAVAILABLE) { - return; - } - *presence = gossip_presence_new (); gossip_presence_set_state (*presence, state); @@ -1765,26 +1766,3 @@ contact_list_presences_table_foreach (const gchar *state_str, } } -static GossipPresenceState -contact_list_presence_state_from_str (const gchar *str) -{ - if (strcmp (str, "available") == 0) { - return GOSSIP_PRESENCE_STATE_AVAILABLE; - } else if ((strcmp (str, "dnd") == 0) || (strcmp (str, "busy") == 0)) { - return GOSSIP_PRESENCE_STATE_BUSY; - } else if ((strcmp (str, "away") == 0) || (strcmp (str, "brb") == 0)) { - return GOSSIP_PRESENCE_STATE_AWAY; - } else if (strcmp (str, "xa") == 0) { - return GOSSIP_PRESENCE_STATE_EXT_AWAY; - } else if (strcmp (str, "hidden") == 0) { - return GOSSIP_PRESENCE_STATE_HIDDEN; - } else if (strcmp (str, "offline") == 0) { - return GOSSIP_PRESENCE_STATE_UNAVAILABLE; - } else if (strcmp (str, "chat") == 0) { - /* We don't support chat, so treat it like available. */ - return GOSSIP_PRESENCE_STATE_AVAILABLE; - } - - return GOSSIP_PRESENCE_STATE_AVAILABLE; -} - |