aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/gossip-presence.c36
-rw-r--r--libempathy/gossip-presence.h1
2 files changed, 33 insertions, 4 deletions
diff --git a/libempathy/gossip-presence.c b/libempathy/gossip-presence.c
index 1b04abc8f..ab0973d90 100644
--- a/libempathy/gossip-presence.c
+++ b/libempathy/gossip-presence.c
@@ -281,8 +281,35 @@ gossip_presence_state_get_default_status (McPresence state)
return _("Unavailable");
case MC_PRESENCE_OFFLINE:
return _("Offline");
+ case MC_PRESENCE_UNSET:
+ return _("Unset");
default:
- return NULL;
+ g_assert_not_reached ();
+ }
+
+ return NULL;
+}
+
+const gchar *
+gossip_presence_state_to_str (McPresence state)
+{
+ switch (state) {
+ case MC_PRESENCE_AVAILABLE:
+ return "available";
+ case MC_PRESENCE_DO_NOT_DISTURB:
+ return "busy";
+ case MC_PRESENCE_AWAY:
+ return "away";
+ case MC_PRESENCE_EXTENDED_AWAY:
+ return "ext_away";
+ case MC_PRESENCE_HIDDEN:
+ return "hidden";
+ case MC_PRESENCE_OFFLINE:
+ return "offline";
+ case MC_PRESENCE_UNSET:
+ return "unset";
+ default:
+ g_assert_not_reached ();
}
return NULL;
@@ -303,9 +330,10 @@ gossip_presence_state_from_str (const gchar *str)
return MC_PRESENCE_HIDDEN;
} else if (strcmp (str, "offline") == 0) {
return MC_PRESENCE_OFFLINE;
- } else if (strcmp (str, "chat") == 0) {
- /* We don't support chat, so treat it like available. */
- return MC_PRESENCE_AVAILABLE;
+ } else if (strcmp (str, "unset") == 0) {
+ return MC_PRESENCE_UNSET;
+ } else {
+ g_assert_not_reached ();
}
return MC_PRESENCE_AVAILABLE;
diff --git a/libempathy/gossip-presence.h b/libempathy/gossip-presence.h
index 4aa2aa668..0029906f3 100644
--- a/libempathy/gossip-presence.h
+++ b/libempathy/gossip-presence.h
@@ -58,6 +58,7 @@ void gossip_presence_set_status (GossipPresence *pr
gint gossip_presence_sort_func (gconstpointer a,
gconstpointer b);
const gchar * gossip_presence_state_get_default_status (McPresence state);
+const gchar * gossip_presence_state_to_str (McPresence state);
McPresence gossip_presence_state_from_str (const gchar *str);
G_END_DECLS