Sfoglia il codice sorgente

Request help to join from all bots (#35)

Bryan Drewery 14 anni fa
parent
commit
4bfc0e132e
1 ha cambiato i file con 8 aggiunte e 20 eliminazioni
  1. 8 20
      src/mod/irc.mod/irc.c

+ 8 - 20
src/mod/irc.mod/irc.c

@@ -987,15 +987,17 @@ request_in(struct chanset_t *chan)
   }
 
   int foundBots = 0;
-  char* botops[MAX_BOTS];
+//  char* botops[MAX_BOTS];
 
   for (tand_t* bot = tandbot; bot && (foundBots < MAX_BOTS); bot = bot->next) {
     if (bot->hub || !bot->u)
       continue;
 
     get_user_flagrec(bot->u, &fr, chan->dname, chan);
-    if (bot_shouldjoin(bot->u, &fr, chan) && chk_op(fr, chan))
-      botops[foundBots++] = bot->bot;
+    if (bot_shouldjoin(bot->u, &fr, chan) && chk_op(fr, chan)) {
+      ++foundBots;
+//      botops[foundBots++] = bot->bot;
+    }
   }
 
   if (!foundBots) {
@@ -1003,23 +1005,9 @@ request_in(struct chanset_t *chan)
     return;
   }
 
-  int cnt = foundBots < in_bots ? foundBots : in_bots;
-  char s[255] = "";
-  char l[1024] = "";
-  size_t len = 0;
-
-  simple_snprintf(s, sizeof(s), "gi i %s %s %s!%s %s", chan->dname, botname, botname, botuserhost, botuserip);
-
-  shuffleArray(botops, foundBots);
-  for (int n = 0; n < cnt; ++n) {
-    putbot(botops[n], s);
-
-    if (l[0])
-      len += strlcpy(l + len, ", ", sizeof(l) - len);
-    len += strlcpy(l + len, botops[n], sizeof(l) - len);
-  }
-  l[len] = 0;
-  putlog(LOG_GETIN, "*", "Requested help to join %s from %s", chan->dname, l);
+  bd::String request(bd::String::printf("gi i %s %s %s!%s %s", chan->dname, botname, botname, botuserhost, botuserip));
+  putallbots(request.c_str());
+  putlog(LOG_GETIN, "*", "Requested help to join %s", chan->dname);
 }