changeset 1378:61fc9eddf763

Small code cleanup
author Mikael Berthe <mikael@lilotux.net>
date Wed, 28 Nov 2007 22:42:48 +0100
parents cd9182f0b5c7
children 74b7621537d7
files mcabber/src/jabglue.c
diffstat 1 files changed, 14 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/jabglue.c	Tue Nov 27 23:57:20 2007 +0100
+++ b/mcabber/src/jabglue.c	Wed Nov 28 22:42:48 2007 +0100
@@ -48,6 +48,16 @@
     '_', 'o', 'f', 'd', 'n', 'a', 'i', '\0'
 };
 
+static char *imstatus_showmap[] = {
+  "",
+  "",
+  "chat",
+  "dnd",
+  "xa",
+  "away",
+  ""
+};
+
 static time_t LastPingTime;
 static unsigned int KeepaliveDelay;
 static enum imstatus mystatus = offline;
@@ -401,23 +411,11 @@
 
   switch(st) {
     case away:
-        xmlnode_insert_cdata(xmlnode_insert_tag(x, "show"), "away",
-                             (unsigned) -1);
-        break;
-
+    case notavail:
     case dontdisturb:
-        xmlnode_insert_cdata(xmlnode_insert_tag(x, "show"), "dnd",
-                             (unsigned) -1);
-        break;
-
     case freeforchat:
-        xmlnode_insert_cdata(xmlnode_insert_tag(x, "show"), "chat",
-                             (unsigned) -1);
-        break;
-
-    case notavail:
-        xmlnode_insert_cdata(xmlnode_insert_tag(x, "show"), "xa",
-                             (unsigned) -1);
+        xmlnode_insert_cdata(xmlnode_insert_tag(x, "show"),
+                             imstatus_showmap[st], (unsigned) -1);
         break;
 
     case invisible:
@@ -688,7 +686,7 @@
    * "Until receiving a reply to the initial content message (or a standalone
    * notification) from the Contact, the User MUST NOT send subsequent chat
    * state notifications to the Contact."
-   * In our implementation support is initially "unknown", they it's "probed"
+   * In our implementation support is initially "unknown", then it's "probed"
    * and can become "ok".
    */
   if (jep85 && (jep85->support == CHATSTATES_SUPPORT_OK ||