diff mcabber/src/commands.c @ 1525:68580b6be895

Display more information in /room bookmark (autojoin, nick...) With this patch /room bookmark adds a '*' prefix when autojoin is set in the bookmark list. It also displays the nick and the room name contained in the bookmarks.
author Mikael Berthe <mikael@lilotux.net>
date Thu, 02 Oct 2008 20:00:11 +0200
parents 63dc211a4c1a
children ac87eef9050f
line wrap: on
line diff
--- a/mcabber/src/commands.c	Wed Oct 01 20:36:22 2008 +0200
+++ b/mcabber/src/commands.c	Thu Oct 02 20:00:11 2008 +0200
@@ -2810,6 +2810,7 @@
 {
   GSList *bm, *bmp;
   GString *sbuf;
+  struct bookmark *bm_elt;
 
   bm = jb_get_all_storage_bookmarks();
 
@@ -2822,7 +2823,17 @@
                            0, HBB_PREFIX_INFO, 0);
 
   for (bmp = bm; bmp; bmp = g_slist_next(bmp)) {
-    g_string_printf(sbuf, "<%s>", (char*)bmp->data);
+    bm_elt = bmp->data;
+    g_string_printf(sbuf, "%c <%s>",
+                    (bm_elt->autojoin ? '*' : ' '), bm_elt->roomjid);
+    if (bm_elt->nick)
+      g_string_append_printf(sbuf, " (%s)", bm_elt->nick);
+    if (bm_elt->name)
+      g_string_append_printf(sbuf, " %s", bm_elt->name);
+    g_free(bm_elt->roomjid);
+    g_free(bm_elt->name);
+    g_free(bm_elt->nick);
+    g_free(bm_elt);
     scr_WriteIncomingMessage(NULL, sbuf->str,
                              0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0);
   }