changeset 448:39a28cb59af3

Add "/room remove", to remove an old chatroom from the roster
author Mikael Berthe <mikael@lilotux.net>
date Sun, 25 Sep 2005 01:04:48 +0200
parents 03bb57383cea
children e08b0c2d0e54
files mcabber/src/commands.c
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/commands.c	Sun Sep 25 01:01:44 2005 +0200
+++ b/mcabber/src/commands.c	Sun Sep 25 01:04:48 2005 +0200
@@ -152,6 +152,7 @@
   compl_add_category_word(COMPL_ROOM, "join");
   compl_add_category_word(COMPL_ROOM, "leave");
   compl_add_category_word(COMPL_ROOM, "names");
+  compl_add_category_word(COMPL_ROOM, "remove");
 }
 
 //  expandalias(line)
@@ -973,6 +974,22 @@
       return;
     }
     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;
+    }
+    // Quick check: if there are resources, we haven't left
+    if (buddy_getresources(bud)) {
+      scr_LogPrint(LPRINT_NORMAL, "You haven't left this room!");
+      return;
+    }
+    // Delete the room
+    roster_del_user(buddy_getjid(bud));
+    buddylist_build();
+    update_roster = TRUE;
   } else {
     scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!");
   }