From df93dcbbc05b666064c20670cdbf2311c1bbbc62 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sat, 14 Jun 2008 06:51:03 +0000 Subject: [PATCH] Add /HOP and /DEHOP commands for halfop. Also did a little cleanup around doop() and dodeop() - they could do with a bit more though. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@53 13b04d17-f746-0410-82c6-800466cd88b0 --- Changelog | 5 ++++- README-1.2 | 6 ++++++ source/banlist.c | 30 ++++++++++++------------------ source/commands.c | 14 ++++++++------ 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/Changelog b/Changelog index 55e160e..4f24d64 100644 --- a/Changelog +++ b/Changelog @@ -1,11 +1,14 @@ [Changes 1.2c01 ] +* Add /HOP and /DEHOP commands for halfop. (caf) + * Removed "scan" plugin, this functionality is now covered by /SCAN -stat. + (caf) * Change NICKSORT_OP to NICKSORT_STAT (sorts nicks by channel status - chanop first, then halops, voices and others). Added /SCAN -stat to sort nicks using NICKSORT_OP. Removed NICKSORT_VOICE - it was broken - anyway. + anyway. (caf) * Add halfop nick prefix to default status line, and change the voice prefix so it appears whether or not you're opped. (caf) diff --git a/README-1.2 b/README-1.2 index 2b54f5a..d61c512 100644 --- a/README-1.2 +++ b/README-1.2 @@ -43,6 +43,12 @@ to the total number of nicks in the channel, and $4 to the mask given to /SCAN now supports a new sort flag "-stat", which sorts the output by channel status (chanops, then halfops, then voices, then the riff-raff). +/HOP and /DEHOP +--------------- + +New commands /HOP and /DEHOP have been added, to give and remove halfop +status (on servers that support it). + PLUGINS ------- diff --git a/source/banlist.c b/source/banlist.c index 5750320..1a4860c 100644 --- a/source/banlist.c +++ b/source/banlist.c @@ -580,20 +580,18 @@ register NickList *nicks; BUILT_IN_COMMAND(doop) { - char *to = NULL, + char *to = NULL, *temp = NULL; -ChannelList *chan = NULL; + ChannelList *chan = NULL; int count, max = get_int_var(NUM_OPMODES_VAR); - char buffer[BIG_BUFFER_SIZE + 1]; int old_server = from_server; - int voice = 0; - - - if (command) - voice = 1; + + /* command is mode char to use - if none given, default to op */ + if (!command) + command = "o"; + count = 0; - *buffer = 0; if (!(to = next_arg(args, &args))) to = NULL; @@ -612,7 +610,7 @@ ChannelList *chan = NULL; while (temp && *temp) { count++; - add_mode(chan, voice?"v":"o", 1, temp, NULL, max); + add_mode(chan, command, 1, temp, NULL, max); temp = next_arg(args, &args); } flush_mode_all(chan); @@ -624,19 +622,15 @@ BUILT_IN_COMMAND(dodeop) char *to = NULL, *temp; int count, max; ChannelList *chan; - char buffer[BIG_BUFFER_SIZE + 1]; - int isvoice = 0; int server = from_server; - count = 0; temp = NULL; max = get_int_var(NUM_OPMODES_VAR); - *buffer = 0; - - if (command && (!my_stricmp(command, "unvoice") || !my_stricmp(command, "devoice"))) - isvoice = 1; + /* command is mode char to use - if none given, default to deop */ + if (!command) + command = "o"; if (!(to = next_arg(args, &args))) to = NULL; @@ -655,7 +649,7 @@ BUILT_IN_COMMAND(dodeop) while (temp && *temp) { count++; - add_mode(chan, isvoice?"v":"o", 0, temp, NULL, max); + add_mode(chan, command, 0, temp, NULL, max); temp = next_arg(args, &args); } flush_mode_all(chan); diff --git a/source/commands.c b/source/commands.c index d51388c..e7e81b6 100644 --- a/source/commands.c +++ b/source/commands.c @@ -341,13 +341,14 @@ IrcCommand irc_command[] = #ifdef WANT_USERLIST { "DEBUGUSER", NULL, debug_user, 0, NULL }, #endif - { "DEOP", NULL, dodeop, SERVERREQ, "%Y<%C%nnick(s)%Y>%n\n- Deops %Y<%Cnick%y(%Cs%y)%Y>%n" }, + { "DEHOP", "h", dodeop, SERVERREQ, "%Y<%C%nnick(s)%Y>%n\n- Removes halfops from %Y<%Cnick%y(%Cs%y)%Y>%n" }, + { "DEOP", "o", dodeop, SERVERREQ, "%Y<%C%nnick(s)%Y>%n\n- Deops %Y<%Cnick%y(%Cs%y)%Y>%n" }, { "DEOPER", NULL, deop, SERVERREQ, "%Y*%n Requires irc operator status\n- Removes irc operator status" }, { "DESCRIBE", NULL, describe, SERVERREQ, "%Y<%Cnick%G|%Bchannel%Y>%n %Y<%naction%Y>%n\n- Describes to %Y<%Cnick%G|%Bchannel%Y>%n with %Y<%naction%Y>%n" }, #ifdef ALLOW_DETACH { "DETACH", NULL, detachcmd, 0, NULL }, #endif - { "DEVOICE", "DeVoice", dodeop, SERVERREQ, "%Y<%C%nnick(s)%Y>%n\n- de-voices %Y<%Cnick%y(%Cs%y)%Y>%n" }, + { "DEVOICE", "v", dodeop, SERVERREQ, "%Y<%C%nnick(s)%Y>%n\n- de-voices %Y<%Cnick%y(%Cs%y)%Y>%n" }, #if !defined(WINNT) && !defined(__EMX__) { "DF", "df", exec_cmd, 0, "- Show disk space usage" }, #endif @@ -360,7 +361,7 @@ IrcCommand irc_command[] = { "DME", "dme", me, SERVERREQ, "\n- Sends an action to current dcc" }, { "DNS", "NSlookup", nslookup, 0, "%YDNS<%nnick|hostname%y>%n\n- Attempts to nslookup on nick or hostname"}, { "DO", NULL, docmd, 0, scripting_command }, - { "DOP", NULL, dodeop, SERVERREQ, "- See deop" }, + { "DOP", "o", dodeop, SERVERREQ, "- See deop" }, { "DS", NULL, dcc_stat_comm, 0, "- Displays some dcc file transfer stats" }, { "DUMP", "Dump", dumpcmd, 0, "%Y<%ntype%Y>%n\n- Dumps %Y<%ntype%Y>%n to screen\n%Y<%ntype%Y>%n:\n%YAlias%n %YAll%n %YBind%n %YChstats%n %YFsets%n\n%YFile%n %YOn%n %YVar%n %YTimers%n %YWsets%n %YCsets%n" }, { "ECHO", NULL, echocmd, 0, "\n- Echos text to the screen" }, @@ -405,6 +406,7 @@ IrcCommand irc_command[] = #endif { "HISTORY", NULL, history, 0, "- Shows recently typed commands" }, { "HOOK", NULL, hookcmd, 0, scripting_command }, + { "HOP", "h", doop, SERVERREQ, "%Y<%Cnick%Y>%n\n- Gives %Y<%Cnick%Y>%n +h" }, { "HOST", "USERHOST", userhostcmd, 0, "- Shows host of yourself or %R[%Cnick%R]%n" }, { "HOSTNAME", "HOSTNAME", e_hostname, 0, "%Y<%nhostname%Y>%n\n- Shows list of possible hostnames with option to change it on virtual hosts" }, { "I", "INVITE", do_invite, SERVERREQ, "- See %YINVITE%n" }, @@ -510,7 +512,7 @@ IrcCommand irc_command[] = { "OFFERS", "Offers", do_offers, 0, NULL }, { "ON", NULL, oncmd, 0, scripting_command }, { "OOPS", NULL, do_oops, SERVERREQ, "%Y<%Cnick%Y>%n\n- Sends a oops message to last recipient of a message and sends the correct message to %Y<%Cnick%Y>%n" }, - { "OP", NULL, doop, SERVERREQ, "%Y<%Cnick%Y>%n\n- Gives %Y<%Cnick%Y>%n +o" }, + { "OP", "o", doop, SERVERREQ, "%Y<%Cnick%Y>%n\n- Gives %Y<%Cnick%Y>%n +o" }, { "OPER", "OPER", oper, SERVERREQ, "%Y*%n Requires irc operator status\n%Y<%Cnick%Y>%n %R[%npassword%R]%n" }, #ifdef WANT_CHAN_NICK_SERV { "OPERSERV", "OPERSERV", send_comm, SERVERREQ, NULL }, @@ -700,7 +702,7 @@ IrcCommand irc_command[] = #ifdef WANT_USERLIST { "UNUSER", "UnUser", add_user, 0, "%Y<%nnick%W|%nnick!user@hostname%Y> <%n#channel%W|%n*%Y>%n" }, #endif - { "UNVOICE", "Unvoice", dodeop, 0, NULL }, + { "UNVOICE", "v", dodeop, 0, NULL }, { "UNWORDKICK", "UnWordKick", add_ban_word, 0, "%Y<%n#channel%Y> <%nword%Y>%n" }, { "UPING", "uPing", pingcmd, 0, NULL }, { "UPTIME", NULL, do_uptime, 0, NULL }, @@ -722,7 +724,7 @@ IrcCommand irc_command[] = { "USRIP", "USRIP", usripcmd, 0, NULL }, { "VER", "Version", ctcp_version, 0, NULL }, { "VERSION", "VERSION", version1, 0, NULL }, - { "VOICE", "Voice", doop, 0, NULL }, + { "VOICE", "v", doop, 0, NULL }, { "W", "W", whocmd, 0, NULL }, { "WAIT", NULL, waitcmd, 0, scripting_command }, { "WALL", "WALL", ChanWallOp, 0, NULL },