--- a/mcabber/src/commands.c Tue Dec 13 23:04:09 2005 +0100
+++ b/mcabber/src/commands.c Tue Dec 13 23:40:17 2005 +0100
@@ -158,6 +158,7 @@
// Room category
compl_add_category_word(COMPL_ROOM, "affil");
compl_add_category_word(COMPL_ROOM, "ban");
+ compl_add_category_word(COMPL_ROOM, "destroy");
compl_add_category_word(COMPL_ROOM, "invite");
compl_add_category_word(COMPL_ROOM, "join");
compl_add_category_word(COMPL_ROOM, "kick");
@@ -1457,6 +1458,18 @@
g_free(msg);
}
+static void room_destroy(gpointer bud, char *arg)
+{
+ gchar *msg;
+
+ if (arg && *arg)
+ msg = arg;
+ else
+ msg = NULL;
+
+ jb_room_destroy(buddy_getjid(bud), NULL, msg);
+}
+
static void room_unlock(gpointer bud, char *arg)
{
if (*arg) {
@@ -1589,6 +1602,9 @@
} else if (!strcasecmp(subcmd, "remove")) {
if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL)
room_remove(bud, arg);
+ } else if (!strcasecmp(subcmd, "destroy")) {
+ if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL)
+ room_destroy(bud, arg);
} else if (!strcasecmp(subcmd, "unlock")) {
if ((arg = check_room_subcommand(arg, FALSE, bud)) != NULL)
room_unlock(bud, arg);
--- a/mcabber/src/jabglue.c Tue Dec 13 23:04:09 2005 +0100
+++ b/mcabber/src/jabglue.c Tue Dec 13 23:40:17 2005 +0100
@@ -581,6 +581,35 @@
jb_reset_keepalive();
}
+// Destroy a MUC room
+// room syntax: "room@server"
+void jb_room_destroy(const char *room, const char *venue, const char *reason)
+{
+ xmlnode x, y, z;
+
+ if (!online || !room) return;
+
+ x = jutil_iqnew(JPACKET__SET, "http://jabber.org/protocol/muc#owner");
+ xmlnode_put_attrib(x, "id", "destroy1"); // XXX
+ xmlnode_put_attrib(x, "to", room);
+ y = xmlnode_get_tag(x, "query");
+ z = xmlnode_insert_tag(y, "destroy");
+
+ if (venue && *venue)
+ xmlnode_put_attrib(z, "jid", venue);
+
+ if (reason) {
+ gchar *utf8_reason = to_utf8(reason);
+ y = xmlnode_insert_tag(z, "reason");
+ xmlnode_insert_cdata(y, utf8_reason, (unsigned) -1);
+ g_free(utf8_reason);
+ }
+
+ jab_send(jc, x);
+ xmlnode_free(x);
+ jb_reset_keepalive();
+}
+
// Change role or affiliation of a MUC user
// room syntax: "room@server"
// Either the jid or the nickname must be set (when banning, only the jid is
@@ -979,7 +1008,11 @@
} else {
// Natural leave
if (we_left) {
- mbuf = g_strdup_printf("You have left %s", roomjid);
+ if (xmlnode_get_tag(xmldata, "destroy"))
+ mbuf = g_strdup_printf("You have left %s, "
+ "the room has been destroyed", roomjid);
+ else
+ mbuf = g_strdup_printf("You have left %s", roomjid);
} else {
if (ustmsg)
mbuf = g_strdup_printf("%s has left: %s", rname, ustmsg);
--- a/mcabber/src/jabglue.h Tue Dec 13 23:04:09 2005 +0100
+++ b/mcabber/src/jabglue.h Tue Dec 13 23:40:17 2005 +0100
@@ -47,6 +47,7 @@
void jb_set_keepalive_delay(unsigned int delay);
void jb_room_join(const char *room, const char *nickname);
void jb_room_unlock(const char *room);
+void jb_room_destroy(const char *room, const char *venue, const char *reason);
void jb_room_invite(const char *room, const char *jid, const char *reason);
int jb_room_setattrib(const char *roomid, const char *jid, const char *nick,
struct role_affil ra, const char *reason);