From 9932abb09e3204d6cbd44c92f3678b6184625693 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 15 Sep 2021 12:13:31 -0400 Subject: Set bot mode on downgrade --- bin/downgrade.c | 10 ++++++++++ bin/man1/downgrade.1 | 6 ++++++ 2 files changed, 16 insertions(+) (limited to 'bin') diff --git a/bin/downgrade.c b/bin/downgrade.c index af1b528b..871b3eb4 100644 --- a/bin/downgrade.c +++ b/bin/downgrade.c @@ -120,6 +120,16 @@ static void handle(char *ptr) { format("NICK %s_\r\n", nick); } else if (!strcmp(cmd, "001")) { if (join) format("JOIN %s\r\n", join); + } else if (!strcmp(cmd, "005")) { + char *self = strsep(&ptr, " "); + if (!self) errx(EX_PROTOCOL, "RPL_ISUPPORT missing nick"); + while (ptr && *ptr != ':') { + char *tok = strsep(&ptr, " "); + char *key = strsep(&tok, "="); + if (!strcmp(key, "BOT") && tok) { + format("MODE %s +%s\r\n", self, tok); + } + } } else if (!strcmp(cmd, "INVITE") && invite) { strsep(&ptr, " "); if (!ptr) errx(EX_PROTOCOL, "INVITE missing channel"); diff --git a/bin/man1/downgrade.1 b/bin/man1/downgrade.1 index 910b42c3..e1a594b7 100644 --- a/bin/man1/downgrade.1 +++ b/bin/man1/downgrade.1 @@ -97,6 +97,12 @@ Connect to .Re .It .Rs +.%A Daniel Oaks +.%T Bot Mode +.%U https://ircv3.net/specs/extensions/bot-mode +.Re +.It +.Rs .%A James Wheare .%T Message IDs .%U https://ircv3.net/specs/extensions/message-ids -- cgit 1.4.1