mirror of
https://github.com/irssi/irssi.git
synced 2026-08-08 19:30:15 +02:00
feat: add support for JOIN 0 to leave all channels
https://www.rfc-editor.org/rfc/rfc2812.html#section-3.2.1
This commit is contained in:
parent
599448af2e
commit
cbafe8bc92
3 changed files with 18 additions and 2 deletions
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
%9Description:%9
|
||||
|
||||
Joins the given channels.
|
||||
Joins the given channels, or use `JOIN 0` to leave all currently joined channels.
|
||||
|
||||
%9Examples:%9
|
||||
|
||||
|
|
@ -21,6 +21,7 @@
|
|||
/JOIN #basementcat secret_lair
|
||||
/JOIN -invite
|
||||
/JOIN -liberachat #github,#libera,#irssi
|
||||
/JOIN 0
|
||||
|
||||
%9See also:%9 KICK, PART
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ static void sig_channel_joined(CHANNEL_REC *channel)
|
|||
}
|
||||
}
|
||||
|
||||
/* SYNTAX: JOIN [-window] [-invite] [-<server tag>] <channels> [<keys>] */
|
||||
/* SYNTAX: JOIN [-window] [-invite] [-<server tag>] <channels> [<keys>] / "0" */
|
||||
static void cmd_join(const char *data, SERVER_REC *server)
|
||||
{
|
||||
WINDOW_REC *window;
|
||||
|
|
@ -142,6 +142,15 @@ static void cmd_join(const char *data, SERVER_REC *server)
|
|||
/* -<server tag> */
|
||||
server = cmd_options_get_server("join", optlist, server);
|
||||
|
||||
/* JOIN 0 (leave all channels) */
|
||||
if (!invite && !samewindow && strcmp(pdata, "0") == 0) {
|
||||
if (server == NULL || !server->connected)
|
||||
cmd_param_error(CMDERR_NOT_CONNECTED);
|
||||
server->channels_join(server, pdata, FALSE);
|
||||
cmd_params_free(free_arg);
|
||||
return;
|
||||
}
|
||||
|
||||
channel = channel_find(server, pdata);
|
||||
if (channel != NULL) {
|
||||
/* already joined to channel, set it active */
|
||||
|
|
|
|||
|
|
@ -92,6 +92,12 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
|
|||
g_return_if_fail(IS_IRC_SERVER(server) && server->connected);
|
||||
if (*data == '\0') return;
|
||||
|
||||
/* JOIN 0 (leave all channels) */
|
||||
if (strcmp(data, "0") == 0) {
|
||||
irc_send_cmd(IRC_SERVER(server), "JOIN 0");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST,
|
||||
&channels, &keys))
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue