aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-utils.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-01-25 00:33:33 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-01-25 00:33:33 +0800
commita687b7c513d3bb967781f17dc5d247161bcffd8c (patch)
tree116b335b3c4fe96ddd09c64e9aa382516168af03 /libempathy/empathy-utils.c
parentff21a5f6bfedae8ca32ac871ccad5c106e831b28 (diff)
downloadgsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.gz
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.bz2
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.lz
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.xz
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.tar.zst
gsoc2013-empathy-a687b7c513d3bb967781f17dc5d247161bcffd8c.zip
Remove EmpathyPresence object and have "presence" and "presence-message" properties directly in EmpathyContact
svn path=/trunk/; revision=601
Diffstat (limited to 'libempathy/empathy-utils.c')
-rw-r--r--libempathy/empathy-utils.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index 4050f4673..c810f9cca 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -485,3 +485,74 @@ empathy_chat_with_contact_id (McAccount *account, const gchar *contact_id)
g_object_unref (mc);
}
+
+const gchar *
+empathy_presence_get_default_message (McPresence presence)
+{
+ switch (presence) {
+ case MC_PRESENCE_AVAILABLE:
+ return _("Available");
+ case MC_PRESENCE_DO_NOT_DISTURB:
+ return _("Busy");
+ case MC_PRESENCE_AWAY:
+ case MC_PRESENCE_EXTENDED_AWAY:
+ return _("Away");
+ case MC_PRESENCE_HIDDEN:
+ return _("Hidden");
+ case MC_PRESENCE_OFFLINE:
+ case MC_PRESENCE_UNSET:
+ return _("Offline");
+ default:
+ g_assert_not_reached ();
+ }
+
+ return NULL;
+}
+
+const gchar *
+empathy_presence_to_str (McPresence presence)
+{
+ switch (presence) {
+ 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;
+}
+
+McPresence
+empathy_presence_from_str (const gchar *str)
+{
+ if (strcmp (str, "available") == 0) {
+ return MC_PRESENCE_AVAILABLE;
+ } else if ((strcmp (str, "dnd") == 0) || (strcmp (str, "busy") == 0)) {
+ return MC_PRESENCE_DO_NOT_DISTURB;
+ } else if ((strcmp (str, "away") == 0) || (strcmp (str, "brb") == 0)) {
+ return MC_PRESENCE_AWAY;
+ } else if ((strcmp (str, "xa") == 0) || (strcmp (str, "ext_away") == 0)) {
+ return MC_PRESENCE_EXTENDED_AWAY;
+ } else if (strcmp (str, "hidden") == 0) {
+ return MC_PRESENCE_HIDDEN;
+ } else if (strcmp (str, "offline") == 0) {
+ return MC_PRESENCE_OFFLINE;
+ } else if (strcmp (str, "unset") == 0) {
+ return MC_PRESENCE_UNSET;
+ }
+
+ return MC_PRESENCE_AVAILABLE;
+}
+