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
This commit is contained in:
Kevin Easton
2008-06-14 06:51:03 +00:00
parent 708e4b6f19
commit df93dcbbc0
4 changed files with 30 additions and 25 deletions

View File

@@ -1,11 +1,14 @@
[Changes 1.2c01 ] [Changes 1.2c01 ]
* Add /HOP and /DEHOP commands for halfop. (caf)
* Removed "scan" plugin, this functionality is now covered by /SCAN -stat. * Removed "scan" plugin, this functionality is now covered by /SCAN -stat.
(caf)
* Change NICKSORT_OP to NICKSORT_STAT (sorts nicks by channel status - * Change NICKSORT_OP to NICKSORT_STAT (sorts nicks by channel status -
chanop first, then halops, voices and others). Added /SCAN -stat chanop first, then halops, voices and others). Added /SCAN -stat
to sort nicks using NICKSORT_OP. Removed NICKSORT_VOICE - it was broken 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 * Add halfop nick prefix to default status line, and change the voice prefix
so it appears whether or not you're opped. (caf) so it appears whether or not you're opped. (caf)

View File

@@ -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 /SCAN now supports a new sort flag "-stat", which sorts the output by
channel status (chanops, then halfops, then voices, then the riff-raff). 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 PLUGINS
------- -------

View File

@@ -585,15 +585,13 @@ BUILT_IN_COMMAND(doop)
ChannelList *chan = NULL; ChannelList *chan = NULL;
int count, int count,
max = get_int_var(NUM_OPMODES_VAR); max = get_int_var(NUM_OPMODES_VAR);
char buffer[BIG_BUFFER_SIZE + 1];
int old_server = from_server; int old_server = from_server;
int voice = 0;
/* command is mode char to use - if none given, default to op */
if (!command)
command = "o";
if (command)
voice = 1;
count = 0; count = 0;
*buffer = 0;
if (!(to = next_arg(args, &args))) if (!(to = next_arg(args, &args)))
to = NULL; to = NULL;
@@ -612,7 +610,7 @@ ChannelList *chan = NULL;
while (temp && *temp) while (temp && *temp)
{ {
count++; count++;
add_mode(chan, voice?"v":"o", 1, temp, NULL, max); add_mode(chan, command, 1, temp, NULL, max);
temp = next_arg(args, &args); temp = next_arg(args, &args);
} }
flush_mode_all(chan); flush_mode_all(chan);
@@ -624,19 +622,15 @@ BUILT_IN_COMMAND(dodeop)
char *to = NULL, *temp; char *to = NULL, *temp;
int count, max; int count, max;
ChannelList *chan; ChannelList *chan;
char buffer[BIG_BUFFER_SIZE + 1];
int isvoice = 0;
int server = from_server; int server = from_server;
count = 0; count = 0;
temp = NULL; temp = NULL;
max = get_int_var(NUM_OPMODES_VAR); max = get_int_var(NUM_OPMODES_VAR);
*buffer = 0; /* command is mode char to use - if none given, default to deop */
if (!command)
if (command && (!my_stricmp(command, "unvoice") || !my_stricmp(command, "devoice"))) command = "o";
isvoice = 1;
if (!(to = next_arg(args, &args))) if (!(to = next_arg(args, &args)))
to = NULL; to = NULL;
@@ -655,7 +649,7 @@ BUILT_IN_COMMAND(dodeop)
while (temp && *temp) while (temp && *temp)
{ {
count++; count++;
add_mode(chan, isvoice?"v":"o", 0, temp, NULL, max); add_mode(chan, command, 0, temp, NULL, max);
temp = next_arg(args, &args); temp = next_arg(args, &args);
} }
flush_mode_all(chan); flush_mode_all(chan);

View File

@@ -341,13 +341,14 @@ IrcCommand irc_command[] =
#ifdef WANT_USERLIST #ifdef WANT_USERLIST
{ "DEBUGUSER", NULL, debug_user, 0, NULL }, { "DEBUGUSER", NULL, debug_user, 0, NULL },
#endif #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" }, { "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" }, { "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 #ifdef ALLOW_DETACH
{ "DETACH", NULL, detachcmd, 0, NULL }, { "DETACH", NULL, detachcmd, 0, NULL },
#endif #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__) #if !defined(WINNT) && !defined(__EMX__)
{ "DF", "df", exec_cmd, 0, "- Show disk space usage" }, { "DF", "df", exec_cmd, 0, "- Show disk space usage" },
#endif #endif
@@ -360,7 +361,7 @@ IrcCommand irc_command[] =
{ "DME", "dme", me, SERVERREQ, "<action>\n- Sends an action to current dcc" }, { "DME", "dme", me, SERVERREQ, "<action>\n- Sends an action to current dcc" },
{ "DNS", "NSlookup", nslookup, 0, "%YDNS<%nnick|hostname%y>%n\n- Attempts to nslookup on nick or hostname"}, { "DNS", "NSlookup", nslookup, 0, "%YDNS<%nnick|hostname%y>%n\n- Attempts to nslookup on nick or hostname"},
{ "DO", NULL, docmd, 0, scripting_command }, { "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" }, { "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" }, { "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, "<text>\n- Echos text to the screen" }, { "ECHO", NULL, echocmd, 0, "<text>\n- Echos text to the screen" },
@@ -405,6 +406,7 @@ IrcCommand irc_command[] =
#endif #endif
{ "HISTORY", NULL, history, 0, "- Shows recently typed commands" }, { "HISTORY", NULL, history, 0, "- Shows recently typed commands" },
{ "HOOK", NULL, hookcmd, 0, scripting_command }, { "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" }, { "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" }, { "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" }, { "I", "INVITE", do_invite, SERVERREQ, "- See %YINVITE%n" },
@@ -510,7 +512,7 @@ IrcCommand irc_command[] =
{ "OFFERS", "Offers", do_offers, 0, NULL }, { "OFFERS", "Offers", do_offers, 0, NULL },
{ "ON", NULL, oncmd, 0, scripting_command }, { "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" }, { "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" }, { "OPER", "OPER", oper, SERVERREQ, "%Y*%n Requires irc operator status\n%Y<%Cnick%Y>%n %R[%npassword%R]%n" },
#ifdef WANT_CHAN_NICK_SERV #ifdef WANT_CHAN_NICK_SERV
{ "OPERSERV", "OPERSERV", send_comm, SERVERREQ, NULL }, { "OPERSERV", "OPERSERV", send_comm, SERVERREQ, NULL },
@@ -700,7 +702,7 @@ IrcCommand irc_command[] =
#ifdef WANT_USERLIST #ifdef WANT_USERLIST
{ "UNUSER", "UnUser", add_user, 0, "%Y<%nnick%W|%nnick!user@hostname%Y> <%n#channel%W|%n*%Y>%n" }, { "UNUSER", "UnUser", add_user, 0, "%Y<%nnick%W|%nnick!user@hostname%Y> <%n#channel%W|%n*%Y>%n" },
#endif #endif
{ "UNVOICE", "Unvoice", dodeop, 0, NULL }, { "UNVOICE", "v", dodeop, 0, NULL },
{ "UNWORDKICK", "UnWordKick", add_ban_word, 0, "%Y<%n#channel%Y> <%nword%Y>%n" }, { "UNWORDKICK", "UnWordKick", add_ban_word, 0, "%Y<%n#channel%Y> <%nword%Y>%n" },
{ "UPING", "uPing", pingcmd, 0, NULL }, { "UPING", "uPing", pingcmd, 0, NULL },
{ "UPTIME", NULL, do_uptime, 0, NULL }, { "UPTIME", NULL, do_uptime, 0, NULL },
@@ -722,7 +724,7 @@ IrcCommand irc_command[] =
{ "USRIP", "USRIP", usripcmd, 0, NULL }, { "USRIP", "USRIP", usripcmd, 0, NULL },
{ "VER", "Version", ctcp_version, 0, NULL }, { "VER", "Version", ctcp_version, 0, NULL },
{ "VERSION", "VERSION", version1, 0, NULL }, { "VERSION", "VERSION", version1, 0, NULL },
{ "VOICE", "Voice", doop, 0, NULL }, { "VOICE", "v", doop, 0, NULL },
{ "W", "W", whocmd, 0, NULL }, { "W", "W", whocmd, 0, NULL },
{ "WAIT", NULL, waitcmd, 0, scripting_command }, { "WAIT", NULL, waitcmd, 0, scripting_command },
{ "WALL", "WALL", ChanWallOp, 0, NULL }, { "WALL", "WALL", ChanWallOp, 0, NULL },