commit 35e3fdea7948608948d3d2444cf7150486e2c4ef
parent c864b60033d58b812941c19b028c8a87e78be18d
Author: hhvn <dev@hhvn.uk>
Date: Sun, 17 Apr 2022 10:42:42 +0100
Reconnect on ERROR (unless message indicated kill/ban/etc)
Diffstat:
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/handle.c b/src/handle.c
@@ -206,7 +206,26 @@ handle_KICK) {
HANDLER(
handle_ERROR) {
- serv_disconnect(server, 0, NULL);
+ char *lowered, *p;
+ int recon = 1;
+
+ if (param_len(msg->params) > 1) {
+ lowered = estrdup(*(msg->params+1));
+ for (p = lowered; *p; p++)
+ *p = tolower(*p);
+ if (strstr(lowered, "unauthorized") ||
+ strstr(lowered, "invalid") ||
+ strstr(lowered, "kill") ||
+ strstr(lowered, "ban") ||
+ strstr(lowered, "kline") ||
+ strstr(lowered, "gline") ||
+ strstr(lowered, "k-line") ||
+ strstr(lowered, "g-line"))
+ recon = 0;
+ pfree(&lowered);
+ }
+
+ serv_disconnect(server, recon, NULL);
hist_addp(server->history, msg, Activity_status, HIST_DFL);
}