This patch adds support for storing passwords to a MUC (patch by Nico
Golde <nion@debian.org>) and documents the new feature in the /help command for the /room
command. (help files patched by Franziska Lichtblau <rhalina@old-forest.org>)
diff -Nurad mcabber-0.10.1/mcabber/commands.c mcabber-0.10.1.new/mcabber/commands.c
--- mcabber-0.10.1/mcabber/commands.c	2010-12-01 21:51:20.000000000 +0100
+++ mcabber-0.10.1.new/mcabber/commands.c	2012-06-17 14:08:06.647247157 +0200
@@ -2918,7 +2918,7 @@
 static void room_bookmark(gpointer bud, char *arg)
 {
   const char *roomid;
-  const char *name = NULL, *nick = NULL;
+  const char *name = NULL, *nick = NULL, *passwd = NULL;
   char *tmpnick = NULL;
   enum room_autowhois autowhois = 0;
   enum room_printstatus printstatus = 0;
@@ -2931,7 +2931,8 @@
     char **paramlst;
     char **pp;
 
-    paramlst = split_arg(arg, 3, 0); // At most 3 parameters
+    paramlst = split_arg(arg, 4, 0); // At most 4 parameters
+
     for (pp = paramlst; *pp; pp++) {
       if (!strcasecmp(*pp, "add"))
         action = bm_add;
@@ -2943,9 +2944,11 @@
         autojoin = 1;
       else if (!strcmp(*pp, "-"))
         nick_set = 1;
-      else {
+      else if(nick_set == 0){
         nick_set = 1;
         nick = tmpnick = to_utf8 (*pp);
+      } else if(nick_set == 1){
+       passwd = to_utf8(*pp);
       }
     }
     free_arg_lst(paramlst);
@@ -2961,7 +2964,7 @@
     autowhois   = buddy_getautowhois(bud);
   }
 
-  xmpp_set_storage_bookmark(roomid, name, nick, NULL, autojoin,
+  xmpp_set_storage_bookmark(roomid, name, nick, passwd, autojoin,
                             printstatus, autowhois);
   g_free (tmpnick);
 }
@@ -2988,11 +2991,15 @@
                     (bm_elt->autojoin ? '*' : ' '), bm_elt->roomjid);
     if (bm_elt->nick)
       g_string_append_printf(sbuf, " (%s)", bm_elt->nick);
+    if (bm_elt->passwd)
+      /* replace password for security reasons */
+      g_string_append_printf(sbuf, " (*****)");
     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->passwd);
     g_free(bm_elt);
     scr_WriteIncomingMessage(NULL, sbuf->str,
                              0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0);
diff -Nurad mcabber-0.10.1/mcabber/xmpp.c mcabber-0.10.1.new/mcabber/xmpp.c
--- mcabber-0.10.1/mcabber/xmpp.c	2010-12-01 21:51:21.000000000 +0100
+++ mcabber-0.10.1.new/mcabber/xmpp.c	2012-06-17 14:08:06.647247157 +0200
@@ -2083,7 +2083,7 @@
     // If the node is a conference item, let's add the note to our list.
     if (x->name && !strcmp(x->name, "conference")) {
       struct bookmark *bm_elt;
-      const char *autojoin, *name, *nick;
+      const char *autojoin, *name, *nick, *passwd;
       const char *fjid = lm_message_node_get_attribute(x, "jid");
       if (!fjid)
         continue;
@@ -2092,10 +2092,13 @@
       autojoin = lm_message_node_get_attribute(x, "autojoin");
       nick = lm_message_node_get_child_value(x, "nick");
       name = lm_message_node_get_attribute(x, "name");
+      passwd = lm_message_node_get_child_value(x, "password");
       if (autojoin && !strcmp(autojoin, "1"))
         bm_elt->autojoin = 1;
       if (nick)
         bm_elt->nick = g_strdup(nick);
+      if (nick)
+        bm_elt->passwd = g_strdup(passwd);
       if (name)
         bm_elt->name = g_strdup(name);
       sl_bookmarks = g_slist_append(sl_bookmarks, bm_elt);
diff -Nurad mcabber-0.10.1/mcabber/xmpp.h mcabber-0.10.1.new/mcabber/xmpp.h
--- mcabber-0.10.1/mcabber/xmpp.h	2010-12-01 21:51:21.000000000 +0100
+++ mcabber-0.10.1.new/mcabber/xmpp.h	2012-06-17 14:08:06.647247157 +0200
@@ -24,6 +24,7 @@
   gchar *roomjid;
   gchar *name;
   gchar *nick;
+  gchar *passwd;
   guint autojoin;
   /* enum room_printstatus pstatus; */
   /* enum room_autowhois awhois; */
diff -Nurad mcabber-0.10.1/doc/help/en/hlp_room.txt mcabber-0.10.1.new/hlp_room.txt
--- mcabber-0.10.1/doc/help/en/hlp_room.txt    2012-06-16 14:00:24.678230334 +0200
+++ hlp_room.txt        2012-06-17 14:59:41.579532275 +0200
@@ -2,7 +2,7 @@
  /ROOM join|leave|names|nick|remove|topic|unlock|destroy
  /ROOM privmsg|invite|whois|kick|ban|unban|role|affil
  /ROOM setopt print_status|auto_whois [value]
- /ROOM bookmark [add|del] [-autojoin|+autojoin] [-|nick]
+ /ROOM bookmark [add|del] [-autojoin|+autojoin] [-|nick] [password]
 
 The 'room' command handles Multi-User Chat room actions.
 
@@ -44,7 +44,8 @@
  For print_status, the possible values are "default", "none", "in_and_out", "all".
  For auto_whois, the possible values are "default", "off", "on".
  When the value is "default", the options muc_print_status / muc_auto_whois is used.
-/room bookmark [add|del] [-autojoin|+autojoin] [-|nick]
- Add, remove or update a bookmark (default is add).
+/room bookmark [add|del] [-autojoin|+autojoin] [-|nick] [password]
+ Add, remove or update a bookmark (default is add) and optionally store a
+ password for entering the MUC.
  If autojoin is set, mcabber will automatically join the MUC room when it connects to the server.
  To see the list of bookmarks, use /room bookmark in the status buffer.
diff -Nurad mcabber-0.10.1/doc/help/de/hlp_room.txt mcabber-0.10.1.new/hlp_room.txt
--- mcabber/doc/help/de/hlp_room.txt    2012-06-16 14:00:24.678230334 +0200
+++ hlp_room.txt        2012-06-17 15:18:01.872988505 +0200
@@ -2,7 +2,7 @@
  /ROOM join|leave|names|nick|remove|topic|unlock|destroy
  /ROOM privmsg|invite|whois|kick|ban|unban|role|affil
  /ROOM setopt print_status|auto_whois [wert]
- /ROOM bookmark [add|del] [-autojoin|+autojoin] [-|nick]
+ /ROOM bookmark [add|del] [-autojoin|+autojoin] [-|nick] [password]
 
 Der "room" Befehl umfasst die Multi-User Chat (kurz MUC) Befehle.
 
@@ -44,7 +44,8 @@
  Für "print_status" sind folgende Werte möglich: "default", "none", "in_and_out", "all".
  Bei "auto_whois" sind die Werte "default", "off" und "on" gültig.
  Wenn man die Einstellungen auf "default" setzt, so werden die Optionen muc_print_status / muc_auto_whois benutzt.
-/room bookmark [add|del] [-autojoin|+autojoin] [-|nick]
- Zum Hinzufügen, Löschen und Ändern von Raum-Bookmarks.
+/room bookmark [add|del] [-autojoin|+autojoin] [-|nick] [password]
+ Zum Hinzufügen, Löschen und Ändern von Raum-Bookmarks und optionalen
+ Speichern eines Passworts eines MUCs.
  Wenn autojoin gesetzt ist, wird mcabber nach dem verbinden zum Server diesen MUC automatisch betreten.
  Um die Liste der Bookmarks zu sehen, benutze "/room bookmark", bei ausgewähltem Status Buffer.
