diff mcabber/src/commands.c @ 1587:0a1f59dc503d

/room names --compact New parameter.
author sh!zeeg <shizeeg@yandex.ru>
date Wed, 29 Jul 2009 03:13:04 +0400
parents ece4f26bf9ff
children 5411897a1e7b
line wrap: on
line diff
--- a/mcabber/src/commands.c	Mon Apr 20 19:58:06 2009 +0200
+++ b/mcabber/src/commands.c	Wed Jul 29 03:13:04 2009 +0400
@@ -1817,7 +1817,8 @@
   const char *bjid;
   char *buffer;
   GSList *resources, *p_res;
-  enum { style_normal = 0, style_detail, style_short, style_quiet } style = 0;
+  enum { style_normal = 0, style_detail, style_short,
+         style_quiet, style_compact } style = 0;
 
   if (*arg) {
     if (!strcasecmp(arg, "--short"))
@@ -1826,6 +1827,8 @@
       style = style_quiet;
     else if (!strcasecmp(arg, "--detail"))
       style = style_detail;
+    else if (!strcasecmp(arg, "--compact"))
+      style = style_compact;
     else {
       scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!");
       return;
@@ -1855,7 +1858,22 @@
                (char*)p_res->data,
                rst_msg ? " -- " : "", rst_msg ? rst_msg : "");
       scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0);
-    } else {
+    } else if (style == style_compact) {
+        enum imrole role = buddy_getrole(bud, p_res->data);
+        enum imaffiliation affil = buddy_getaffil(bud, p_res->data);
+
+        snprintf(buffer, 4095, "[%c] %s (", imstatus2char[rstatus],
+                 (char*)p_res->data);
+	
+        if (affil != affil_none) {
+          strcat(buffer, straffil[affil]);
+          strcat(buffer, "/");
+        }
+        strcat(buffer, strrole[role]);
+        strcat(buffer, ")");
+
+        scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0);
+      } else {
       // (Style "normal", "detail" or "quiet")
       snprintf(buffer, 4095, "[%c] %s", imstatus2char[rstatus],
                (char*)p_res->data);