summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-09-15 12:13:31 -0400
committerJune McEnroe <june@causal.agency>2021-09-15 12:13:31 -0400
commit1f8b9eda315347cd32363f5bbb9bd18e5ace3a85 (patch)
tree0e1e01d9a4915791767b1e69d86a5357ebb94016 /bin
parentEnter capsicum in downgrade (diff)
downloadsrc-1f8b9eda315347cd32363f5bbb9bd18e5ace3a85.tar.gz
src-1f8b9eda315347cd32363f5bbb9bd18e5ace3a85.zip
Set bot mode on downgrade
Diffstat (limited to 'bin')
-rw-r--r--bin/downgrade.c10
-rw-r--r--bin/man1/downgrade.16
2 files changed, 16 insertions, 0 deletions
diff --git a/bin/downgrade.c b/bin/downgrade.c
index 3548efcf..ee7c4a7e 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