Add server_redirect for names

Then, use this redirect to make irssi not print NAMES commands sent by
proxy clients.

Closes https://github.com/irssi/irssi/issues/1537
This commit is contained in:
Moritz Wilhelmy 2024-10-10 14:34:06 +02:00
parent 0697e3eaf1
commit 64f91df8fb
2 changed files with 10 additions and 2 deletions

View File

@ -706,6 +706,14 @@ void servers_redirect_init(void)
NULL, /* */ NULL, /* */
NULL); NULL);
/* NAMES */
server_redirect_register("names", TRUE, 0,
"event 353", -1, /* An element of NAMES */
NULL,
"event 366", 1, /* End of NAMES */
NULL,
NULL);
/* LIST */ /* LIST */
server_redirect_register("list", FALSE, 0, server_redirect_register("list", FALSE, 0,
"event 321", 1, /* Begins the LIST */ "event 321", 1, /* Begins the LIST */

View File

@ -304,14 +304,14 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
grab_who(client, args); grab_who(client, args);
else if (g_strcmp0(cmd, "WHOWAS") == 0) else if (g_strcmp0(cmd, "WHOWAS") == 0)
proxy_redirect_event(client, "whowas", 1, args, -1); proxy_redirect_event(client, "whowas", 1, args, -1);
else if (g_strcmp0(cmd, "WHOIS") == 0) { else if (g_strcmp0(cmd, "WHOIS") == 0 || g_strcmp0(cmd, "NAMES") == 0) {
char *p; char *p;
/* convert dots to spaces */ /* convert dots to spaces */
for (p = args; *p != '\0'; p++) for (p = args; *p != '\0'; p++)
if (*p == ',') *p = ' '; if (*p == ',') *p = ' ';
proxy_redirect_event(client, "whois", 1, args, TRUE); proxy_redirect_event(client, *cmd == 'N' ? "names" : "whois", 1, args, TRUE);
} else if (g_strcmp0(cmd, "ISON") == 0) } else if (g_strcmp0(cmd, "ISON") == 0)
proxy_redirect_event(client, "ison", 1, args, -1); proxy_redirect_event(client, "ison", 1, args, -1);
else if (g_strcmp0(cmd, "USERHOST") == 0) else if (g_strcmp0(cmd, "USERHOST") == 0)