hirc

IRC client
Log | Files | Refs

commit 18877c9127fa4c02bd1d75ae287f2ce125c0fe17
parent 5dc7b34a3e3bd73c8650fcd3fde4b0e10fefebb7
Author: hhvn <dev@hhvn.uk>
Date:   Sat, 12 Mar 2022 23:47:40 +0000

Add /cycle

Diffstat:
Msrc/commands.c | 27++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/commands.c b/src/commands.c @@ -43,6 +43,10 @@ * * I don't think I have ever used /knock * + * A lot of commands related to server administration are nonstandard and/or + * unwieldy, and as such aren't implemented here. These can be used via + * aliases, eg: /alias /kline /quote kline. + * */ /* IRC commands */ @@ -76,6 +80,7 @@ COMMAND(command_links); COMMAND(command_map); COMMAND(command_lusers); COMMAND(command_invite); +COMMAND(command_cycle); /* Channel priviledges (use modelset only) */ COMMAND(command_op); @@ -146,8 +151,11 @@ struct Command commands[] = { "usage: /join <channel>", "Join channel", NULL}}, {"part", command_part, 1, { - "usage: /part <channel>", + "usage: /part <channel> [reason]", "Part channel", NULL}}, + {"cycle", command_cycle, 1, { + "usage: /cycle <channel> [reason]", + "Part channel and rejoin", NULL}}, {"kick", command_kick, 1, { "usage: /kick [channel] <nick> [reason]", "Kick nick from channel", NULL}}, @@ -570,6 +578,23 @@ command_part) { } COMMAND( +command_cycle) { + char *chan = NULL; + + if (str && serv_ischannel(server, str)) + chan = strtok(str, " "); + if (!chan && channel) { + chan = channel->name; + } else if (!chan) { + command_toofew("cycle"); + return; + } + + command_part(server, channel, str); + command_join(server, channel, chan); +} + +COMMAND( command_kick) { char *chan, *nick, *reason; char *s;