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

Merge branch '101-nick-ison' into maint

* 101-nick-ison:
  Comment release expiry
  server_minutely: Only try regaining nicks we think are juped.
  nicks_available: Look for all wanted nicks, not just jupenick.
Bryan Drewery пре 10 година
родитељ
комит
093643f079
3 измењених фајлова са 13 додато и 11 уклоњено
  1. 2 0
      doc/UPDATES.md
  2. 2 1
      src/mod/server.mod/server.cc
  3. 9 10
      src/mod/server.mod/servmsg.cc

+ 2 - 0
doc/UPDATES.md

@@ -29,6 +29,8 @@
     rather than an obscure Libcrypto error.
   * Restrict 'chanset groups' to owners.
   * Stop building the binary as i486.  Let it use modern x86/x86_64.
+  * Stop trying to regain jupenick when it is unavailable and main nick is
+    temporarily juped (#101).
 
 # 1.4.6
   * Disable demo TCL support by default to prevent confusion during build.

+ 2 - 1
src/mod/server.mod/server.cc

@@ -1025,6 +1025,7 @@ static void server_secondly()
     } else if (!keepnick && release_time && ((now - release_time) >= RELEASE_TIME)) {
       release_time = 0;
       keepnick = 1;
+      /* The release time has expired, try to regain the jupenick. */
       nick_available(1, 0);
     }
 
@@ -1108,7 +1109,7 @@ static void server_minutely()
     // Ratbox sets a nick_delay (default:15min) timer when a nick splits off to prevent collisions,
     // We must check periodically to see if the local server has unjuped our wanted nicks.
     if (keepnick && (jnick_juped == 2 || nick_juped == 2)) {
-      nick_available(1, 1);
+      nick_available(jnick_juped == 2, nick_juped == 2);
     }
   }
 }

+ 9 - 10
src/mod/server.mod/servmsg.cc

@@ -1027,17 +1027,14 @@ static int gotpong(char *from, char *msg)
   return 0;
 }
 
-static int nick_which(const char* nick, bool& is_jupe, bool& is_orig) {
-  if (jupenick[0] && !rfc_ncasecmp(nick, jupenick, nick_len)) {
-    is_jupe = 1;
-    // If some stupid reason they have the same jupenick/nick, make sure to mark it as on
-    if (!rfc_ncasecmp(nick, origbotname, nick_len))
-      is_orig = 1;
-    return 1;
-  } else if (!rfc_ncasecmp(nick, origbotname, nick_len)) {
+static void nick_which(const char* nick, bool& is_jupe, bool& is_orig) {
+  if (is_orig == 0 && !rfc_ncasecmp(nick, origbotname, nick_len)) {
     is_orig = 1;
   }
-  return 0;
+  /* It's possible jupenick==nick.  Set both flags. */
+  if (is_jupe == 0 && jupenick[0] && !rfc_ncasecmp(nick, jupenick, nick_len)) {
+    is_jupe = 1;
+  }
 }
 
 static void nick_available(bool is_jupe, bool is_orig) {
@@ -1070,8 +1067,10 @@ void nicks_available(char* buf, char delim, bool buf_contains_available) {
   char *nick = NULL;
   if (delim) {
     while ((nick = newsplit(&buf, delim))[0]) {
-      if (nick_which(nick, is_jupe, is_orig))
+      nick_which(nick, is_jupe, is_orig);
+      if (is_jupe && is_orig) {
         break;
+      }
     }
   } else {
     nick = buf;