Mercurial > hg
comparison mcabber/src/commands.c @ 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 |
comparison
equal
deleted
inserted
replaced
447:03bb57383cea | 448:39a28cb59af3 |
---|---|
150 | 150 |
151 // Room category | 151 // Room category |
152 compl_add_category_word(COMPL_ROOM, "join"); | 152 compl_add_category_word(COMPL_ROOM, "join"); |
153 compl_add_category_word(COMPL_ROOM, "leave"); | 153 compl_add_category_word(COMPL_ROOM, "leave"); |
154 compl_add_category_word(COMPL_ROOM, "names"); | 154 compl_add_category_word(COMPL_ROOM, "names"); |
155 compl_add_category_word(COMPL_ROOM, "remove"); | |
155 } | 156 } |
156 | 157 |
157 // expandalias(line) | 158 // expandalias(line) |
158 // If there is one, expand the alias in line and returns a new allocated line | 159 // If there is one, expand the alias in line and returns a new allocated line |
159 // If no alias is found, returns line | 160 // If no alias is found, returns line |
971 if (!(buddy_gettype(bud) & ROSTER_TYPE_ROOM)) { | 972 if (!(buddy_gettype(bud) & ROSTER_TYPE_ROOM)) { |
972 scr_LogPrint(LPRINT_NORMAL, "This isn't a chatroom"); | 973 scr_LogPrint(LPRINT_NORMAL, "This isn't a chatroom"); |
973 return; | 974 return; |
974 } | 975 } |
975 do_info(NULL); | 976 do_info(NULL); |
977 } else if (!strcasecmp(arg, "remove")) { | |
978 gpointer bud; | |
979 bud = BUDDATA(current_buddy); | |
980 if (!(buddy_gettype(bud) & ROSTER_TYPE_ROOM)) { | |
981 scr_LogPrint(LPRINT_NORMAL, "This isn't a chatroom"); | |
982 return; | |
983 } | |
984 // Quick check: if there are resources, we haven't left | |
985 if (buddy_getresources(bud)) { | |
986 scr_LogPrint(LPRINT_NORMAL, "You haven't left this room!"); | |
987 return; | |
988 } | |
989 // Delete the room | |
990 roster_del_user(buddy_getjid(bud)); | |
991 buddylist_build(); | |
992 update_roster = TRUE; | |
976 } else { | 993 } else { |
977 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!"); | 994 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!"); |
978 } | 995 } |
979 } | 996 } |
980 | 997 |