changeset 449:e08b0c2d0e54

Add "/room unlock"
author Mikael Berthe <mikael@lilotux.net>
date Sun, 25 Sep 2005 23:45:34 +0200
parents 39a28cb59af3
children fa93f47a08fe
files mcabber/src/commands.c mcabber/src/jabglue.c mcabber/src/jabglue.h
diffstat 3 files changed, 30 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/commands.c	Sun Sep 25 01:04:48 2005 +0200
+++ b/mcabber/src/commands.c	Sun Sep 25 23:45:34 2005 +0200
@@ -153,6 +153,7 @@
   compl_add_category_word(COMPL_ROOM, "leave");
   compl_add_category_word(COMPL_ROOM, "names");
   compl_add_category_word(COMPL_ROOM, "remove");
+  compl_add_category_word(COMPL_ROOM, "unlock");
 }
 
 //  expandalias(line)
@@ -975,8 +976,6 @@
     }
     do_info(NULL);
   } else if (!strcasecmp(arg, "remove"))  {
-    gpointer bud;
-    bud = BUDDATA(current_buddy);
     if (!(buddy_gettype(bud) & ROSTER_TYPE_ROOM)) {
       scr_LogPrint(LPRINT_NORMAL, "This isn't a chatroom");
       return;
@@ -990,6 +989,12 @@
     roster_del_user(buddy_getjid(bud));
     buddylist_build();
     update_roster = TRUE;
+  } else if (!strcasecmp(arg, "unlock"))  {
+    if (!(buddy_gettype(bud) & ROSTER_TYPE_ROOM)) {
+      scr_LogPrint(LPRINT_NORMAL, "This isn't a chatroom");
+      return;
+    }
+    jb_room_unlock(buddy_getjid(bud));
   } else {
     scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!");
   }
--- a/mcabber/src/jabglue.c	Sun Sep 25 01:04:48 2005 +0200
+++ b/mcabber/src/jabglue.c	Sun Sep 25 23:45:34 2005 +0200
@@ -489,6 +489,28 @@
   jb_reset_keepalive();
 }
 
+// Unlock a MUC room
+// room syntax: "room@server"
+void jb_room_unlock(const char *room)
+{
+  xmlnode x, y, z;
+
+  if (!online) return;
+  if (!room)   return;
+
+  x = jutil_iqnew(JPACKET__SET, "http://jabber.org/protocol/muc#owner");
+  xmlnode_put_attrib(x, "id", "unlock1"); // XXX
+  xmlnode_put_attrib(x, "to", room);
+  y = xmlnode_get_tag(x, "query");
+  z = xmlnode_insert_tag(y, "x");
+  xmlnode_put_attrib(z, "xmlns", "jabber:x:data");
+  xmlnode_put_attrib(z, "type", "submit");
+
+  jab_send(jc, x);
+  xmlnode_free(x);
+  jb_reset_keepalive();
+}
+
 void postlogin()
 {
   //int i;
--- a/mcabber/src/jabglue.h	Sun Sep 25 01:04:48 2005 +0200
+++ b/mcabber/src/jabglue.h	Sun Sep 25 23:45:34 2005 +0200
@@ -54,5 +54,6 @@
 void jb_set_keepalive_delay(unsigned int delay);
 inline void jb_set_priority(unsigned int priority);
 void jb_room_join(const char *room);
+void jb_room_unlock(const char *room);
 
 #endif /* __JABGLUE_H__ */