Parcourir la source

* Ported [2508] to 1.2.9

svn: 2614
Bryan Drewery il y a 20 ans
Parent
commit
f6051a2ea2
1 fichiers modifiés avec 20 ajouts et 20 suppressions
  1. 20 20
      src/botcmd.c

+ 20 - 20
src/botcmd.c

@@ -29,14 +29,14 @@
 
 
 static char TBUF[1024] = "";		/* Static buffer for goofy bot stuff */
 static char TBUF[1024] = "";		/* Static buffer for goofy bot stuff */
 
 
-static void fake_alert(int idx, char *item, char *extra)
+static void fake_alert(int idx, char *item, char *extra, char *what)
 {
 {
   static time_t lastfake;	/* The last time fake_alert was used */
   static time_t lastfake;	/* The last time fake_alert was used */
 
 
   if ((now - lastfake) > 10) {	
   if ((now - lastfake) > 10) {	
     /* Don't fake_alert more than once every 10secs */
     /* Don't fake_alert more than once every 10secs */
-    dprintf(idx, "ct %s NOTICE: %s (%s != %s).\n", conf.bot->nick, NET_FAKEREJECT, item, extra);
-    putlog(LOG_BOTS, "*", "%s %s (%s != %s).", dcc[idx].nick, NET_FAKEREJECT, item, extra);
+    dprintf(idx, "ct %s NOTICE: %s (%s != %s). (%s)\n", conf.bot->nick, NET_FAKEREJECT, item, extra, what);
+    putlog(LOG_BOTS, "*", "%s %s (%s != %s). (%s)", dcc[idx].nick, NET_FAKEREJECT, item, extra, what);
     lastfake = now;
     lastfake = now;
   }
   }
 }
 }
@@ -65,7 +65,7 @@ static void bot_chan2(int idx, char *msg)
     *p = 0;
     *p = 0;
     if (!partyidle(p + 1, from)) {
     if (!partyidle(p + 1, from)) {
       *p = '@';
       *p = '@';
-      fake_alert(idx, "user", from);
+      fake_alert(idx, "user", from, "chan2_i");
       return;
       return;
     }
     }
     *p = '@';
     *p = '@';
@@ -76,7 +76,7 @@ static void bot_chan2(int idx, char *msg)
   }
   }
   i = nextbot(p);
   i = nextbot(p);
   if (i != idx) {
   if (i != idx) {
-    fake_alert(idx, "direction", p);
+    fake_alert(idx, "direction", p, "chan2_ii");
   } else {
   } else {
     chanout_but(-1, chan, "%s\n", TBUF);
     chanout_but(-1, chan, "%s\n", TBUF);
     /* Send to new version bots */
     /* Send to new version bots */
@@ -167,13 +167,13 @@ static void bot_chat(int idx, char *par)
 
 
   from = newsplit(&par);
   from = newsplit(&par);
   if (strchr(from, '@') != NULL) {
   if (strchr(from, '@') != NULL) {
-    fake_alert(idx, "bot", from);
+    fake_alert(idx, "bot", from, "chat_i");
     return;
     return;
   }
   }
   /* Make sure the bot is valid */
   /* Make sure the bot is valid */
   i = nextbot(from);
   i = nextbot(from);
   if (i != idx) {
   if (i != idx) {
-    fake_alert(idx, "direction", from);
+    fake_alert(idx, "direction", from, "chat_ii");
     return;
     return;
   }
   }
   chatout("*** (%s) %s\n", from, par);
   chatout("*** (%s) %s\n", from, par);
@@ -191,20 +191,20 @@ static void bot_actchan(int idx, char *par)
   p = strchr(from, '@');
   p = strchr(from, '@');
   if (p == NULL) {
   if (p == NULL) {
     /* How can a bot do an action? */
     /* How can a bot do an action? */
-    fake_alert(idx, "user@bot", from);
+    fake_alert(idx, "user@bot", from, "actchan_i");
     return;
     return;
   }
   }
   *p = 0;
   *p = 0;
   if (!partyidle(p + 1, from)) {
   if (!partyidle(p + 1, from)) {
     *p = '@';
     *p = '@';
-    fake_alert(idx, "user", from);
+    fake_alert(idx, "user", from, "actchan_ii");
     return;
     return;
   }
   }
   *p = '@';
   *p = '@';
   p++;
   p++;
   i = nextbot(p);
   i = nextbot(p);
   if (i != idx) {
   if (i != idx) {
-    fake_alert(idx, "direction", p);
+    fake_alert(idx, "direction", p, "actchan_iii");
     return;
     return;
   }
   }
   p = newsplit(&par);
   p = newsplit(&par);
@@ -237,7 +237,7 @@ static void bot_priv(int idx, char *par)
     p = from;
     p = from;
   i = nextbot(p);
   i = nextbot(p);
   if (i != idx) {
   if (i != idx) {
-    fake_alert(idx, "direction", p);
+    fake_alert(idx, "direction", p, "priv_i");
     return;
     return;
   }
   }
   if (!to[0])
   if (!to[0])
@@ -498,7 +498,7 @@ static void bot_log(int idx, char *par)
   int i = nextbot(from);
   int i = nextbot(from);
 
 
   if (i != idx) {
   if (i != idx) {
-    fake_alert(idx, "direction", from);
+    fake_alert(idx, "direction", from, "log");
     return;
     return;
   }
   }
 
 
@@ -676,7 +676,7 @@ static void bot_unlinked(int idx, char *par)
   i = nextbot(bot);
   i = nextbot(bot);
   if ((i >= 0) && (i != idx))	/* Bot is NOT downstream along idx, so
   if ((i >= 0) && (i != idx))	/* Bot is NOT downstream along idx, so
 				 * BOGUS! */
 				 * BOGUS! */
-    fake_alert(idx, "direction", bot);
+    fake_alert(idx, "direction", bot, "unlinked");
   else if (i >= 0) {		/* Valid bot downstream of idx */
   else if (i >= 0) {		/* Valid bot downstream of idx */
     if (par[0])
     if (par[0])
 /* #ifdef HUB */
 /* #ifdef HUB */
@@ -789,7 +789,7 @@ static void bot_reject(int idx, char *par)
     frombot = from;
     frombot = from;
   i = nextbot(frombot);
   i = nextbot(frombot);
   if (i != idx) {
   if (i != idx) {
-    fake_alert(idx, "direction", frombot);
+    fake_alert(idx, "direction", frombot, "reject");
     return;
     return;
   }
   }
   who = newsplit(&par);
   who = newsplit(&par);
@@ -856,7 +856,7 @@ static void bot_zapf(int idx, char *par)
   to = newsplit(&par);
   to = newsplit(&par);
   i = nextbot(from);
   i = nextbot(from);
   if (i != idx) {
   if (i != idx) {
-    fake_alert(idx, "direction", from);
+    fake_alert(idx, "direction", from, "zapf");
     return;
     return;
   }
   }
   if (!egg_strcasecmp(to, conf.bot->nick)) {
   if (!egg_strcasecmp(to, conf.bot->nick)) {
@@ -886,7 +886,7 @@ static void bot_zapfbroad(int idx, char *par)
 
 
   i = nextbot(from);
   i = nextbot(from);
   if (i != idx) {
   if (i != idx) {
-    fake_alert(idx, "direction", from);
+    fake_alert(idx, "direction", from, "zapfb");
     return;
     return;
   }
   }
   check_bind_bot(from, opcode, par);
   check_bind_bot(from, opcode, par);
@@ -908,7 +908,7 @@ static void bot_nickchange(int idx, char *par)
   bot = newsplit(&par);
   bot = newsplit(&par);
   i = nextbot(bot);
   i = nextbot(bot);
   if (i != idx) {
   if (i != idx) {
-    fake_alert(idx, "direction", bot);
+    fake_alert(idx, "direction", bot, "nickchange_i");
     return;
     return;
   }
   }
   ssock = newsplit(&par);
   ssock = newsplit(&par);
@@ -916,7 +916,7 @@ static void bot_nickchange(int idx, char *par)
   newnick = newsplit(&par);
   newnick = newsplit(&par);
   i = partynick(bot, sock, newnick);
   i = partynick(bot, sock, newnick);
   if (i < 0) {
   if (i < 0) {
-    fake_alert(idx, "sock#", ssock);
+    fake_alert(idx, "sock#", ssock, "nickchange_ii");
     return;
     return;
   }
   }
   chanout_but(-1, party[i].chan, "*** (%s) Nick change: %s -> %s\n",
   chanout_but(-1, party[i].chan, "*** (%s) Nick change: %s -> %s\n",
@@ -956,7 +956,7 @@ static void bot_join(int idx, char *par)
   i = nextbot(bot);
   i = nextbot(bot);
   if (i != idx) {		/* Ok, garbage from a 1.0g (who uses that
   if (i != idx) {		/* Ok, garbage from a 1.0g (who uses that
 				 * now?) OR raistlin being evil :) */
 				 * now?) OR raistlin being evil :) */
-    fake_alert(idx, "direction", bot);
+    fake_alert(idx, "direction", bot, "join");
     return;
     return;
   }
   }
   u = get_user_by_handle(userlist, nick);
   u = get_user_by_handle(userlist, nick);
@@ -1104,7 +1104,7 @@ static void bot_versions(int sock, char *par)
   char *frombot = newsplit(&par), *tobot = NULL, *from = NULL;
   char *frombot = newsplit(&par), *tobot = NULL, *from = NULL;
 
 
   if (nextbot(frombot) != sock)
   if (nextbot(frombot) != sock)
-    fake_alert(sock, "versions-direction", frombot);
+    fake_alert(sock, "direction", frombot, "versions");
   else if (egg_strcasecmp(tobot = newsplit(&par), conf.bot->nick)) {
   else if (egg_strcasecmp(tobot = newsplit(&par), conf.bot->nick)) {
     if ((sock = nextbot(tobot)) >= 0)
     if ((sock = nextbot(tobot)) >= 0)
       dprintf(sock, "v %s %s %s\n", frombot, tobot, par);
       dprintf(sock, "v %s %s %s\n", frombot, tobot, par);