diff mcabber/src/jabglue.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 35020a2ed115
children 4b4b3948420c
line wrap: on
line diff
--- a/mcabber/src/jabglue.c	Wed Oct 01 20:36:22 2008 +0200
+++ b/mcabber/src/jabglue.c	Thu Oct 02 20:00:11 2008 +0200
@@ -1428,7 +1428,7 @@
 
 //  jb_get_all_storage_bookmarks()
 // Return a GSList with all storage bookmarks.
-// The caller should g_free the list (not the MUC jids).
+// The caller should g_free the list and its contents.
 GSList *jb_get_all_storage_bookmarks(void)
 {
   xmlnode x;
@@ -1444,10 +1444,23 @@
     const char *p = xmlnode_get_name(x);
     // If the node is a conference item, let's add the note to our list.
     if (p && !strcmp(p, "conference")) {
+      struct bookmark *bm_elt;
+      const char *autojoin, *name, *nick;
       const char *fjid = xmlnode_get_attrib(x, "jid");
       if (!fjid)
         continue;
-      sl_bookmarks = g_slist_append(sl_bookmarks, (char*)fjid);
+      bm_elt = g_new0(struct bookmark, 1);
+      bm_elt->roomjid = g_strdup(fjid);
+      autojoin = xmlnode_get_attrib(x, "autojoin");
+      nick = xmlnode_get_attrib(x, "nick");
+      name = xmlnode_get_attrib(x, "name");
+      if (autojoin && !strcmp(autojoin, "1"))
+        bm_elt->autojoin = 1;
+      if (nick)
+        bm_elt->nick = g_strdup(nick);
+      if (name)
+        bm_elt->name = g_strdup(name);
+      sl_bookmarks = g_slist_append(sl_bookmarks, bm_elt);
     }
   }
   return sl_bookmarks;