Преглед изворни кода

Fallback to ISON if the server falsely claims to support MONITOR.

This fixes nick regain on some EFNet servers, such as
efnet.port80.se.  Recently they have unloaded the monitor
module but kept it in 005, apparently.  This results in an
unknown command (421) and we never regain nicks again due to
thinking we have a working MONITOR list.
Bryan Drewery пре 10 година
родитељ
комит
1f6995e3fd
2 измењених фајлова са 19 додато и 0 уклоњено
  1. 1 0
      doc/UPDATES.md
  2. 18 0
      src/mod/server.mod/servmsg.cc

+ 1 - 0
doc/UPDATES.md

@@ -7,6 +7,7 @@
   * Use FreeBSD 10's procctl(PROC_TRACE_CTL) to disable core dumps and tracing.
   * Fix binary compat issue causing ptrace permission errors on Linux 3.4+
   * Fix ban/exempt/invite masking not working with 10-char idents.
+  * Fallback to ISON if the server falsely claims to support MONITOR.
 
 # 1.4.6
   * Disable demo TCL support by default to prevent confusion during build.

+ 18 - 0
src/mod/server.mod/servmsg.cc

@@ -1152,6 +1152,23 @@ static void got303(char *from, char *msg)
     nicks_available(msg, ' ', 0);
 }
 
+/*
+ * :<server> 421 <nick> <command> :Unknown command
+ */
+static void got421(char *from, char *msg)
+{
+  char *command = NULL;
+
+  newsplit(&msg);	/* nick */
+  command = newsplit(&msg);
+
+  if (use_monitor && !strcasecmp(command, "MONITOR")) {
+    /* The command doesn't work despite 005 claiming to have it.
+     * Disable MONITOR usage to fallback on ISON. */
+    use_monitor = 0;
+  }
+}
+
 /* 432 : Bad nickname (RESV)
  */
 static int got432(char *from, char *msg)
@@ -1988,6 +2005,7 @@ static cmd_t my_raw_binds[] =
   {"005",	"",	(Function) got005,		NULL, LEAF},
   {"302",       "",     (Function) got302,		NULL, LEAF},
   {"303",	"",	(Function) got303,		NULL, LEAF},
+  {"421",	"",	(Function) got421,		NULL, LEAF},
   {"432",	"",	(Function) got432,		NULL, LEAF},
   {"433",	"",	(Function) got433,		NULL, LEAF},
   {"437",	"",	(Function) got437,		NULL, LEAF},