diff mcabber/src/jab_iq.c @ 1379:74b7621537d7

MUC: Store room settings (print_status, auto_whois) in private storage
author Mikael Berthe <mikael@lilotux.net>
date Thu, 29 Nov 2007 20:54:38 +0100
parents c7e709719c43
children 216b4da93e08
line wrap: on
line diff
--- a/mcabber/src/jab_iq.c	Wed Nov 28 22:42:48 2007 +0100
+++ b/mcabber/src/jab_iq.c	Thu Nov 29 20:54:38 2007 +0100
@@ -739,6 +739,7 @@
 static void storage_bookmarks_parse_conference(xmlnode xmldata)
 {
   const char *fjid, *name, *autojoin;
+  const char *pstatus, *awhois;
   char *bjid;
   GSList *room_elt;
 
@@ -747,6 +748,8 @@
     return;
   name = xmlnode_get_attrib(xmldata, "name");
   autojoin = xmlnode_get_attrib(xmldata, "autojoin");
+  awhois = xmlnode_get_attrib(xmldata, "autowhois");
+  pstatus = xmlnode_get_tag_data(xmldata, "print_status");
 
   bjid = jidtodisp(fjid); // Bare jid
 
@@ -766,6 +769,25 @@
     */
   }
 
+  // Set the print_status and auto_whois values
+  if (pstatus) {
+    enum room_printstatus i;
+    for (i = status_none; i <= status_all; i++)
+      if (!strcasecmp(pstatus, strprintstatus[i]))
+        break;
+    if (i <= status_all)
+      buddy_setprintstatus(room_elt->data, i);
+  }
+  if (awhois) {
+    enum room_autowhois i = autowhois_default;
+    if (!strcmp(awhois, "1"))
+      i = autowhois_on;
+    else if (!strcmp(awhois, "0"))
+      i = autowhois_off;
+    if (i != autowhois_default)
+      buddy_setautowhois(room_elt->data, i);
+  }
+
   // Is autojoin set?
   // If it is, we'll look up for more information (nick? password?) and
   // try to join the room.