Selaa lähdekoodia

Merge branch '208-botcmd-stale-idx'

* 208-botcmd-stale-idx:
  * Fix botcmd to make sure that results are delivered only to the requester (fixes #208)
Bryan Drewery 17 vuotta sitten
vanhempi
commit
b98a586fd9
2 muutettua tiedostoa jossa 9 lisäystä ja 5 poistoa
  1. 1 0
      doc/UPDATES
  2. 8 5
      src/botcmd.c

+ 1 - 0
doc/UPDATES

@@ -33,6 +33,7 @@
 * Use random query ids for DNS lookups
 * Use random query ids for DNS lookups
 * Fix problem of bots never reconnecting to hub after being up for long periods.
 * Fix problem of bots never reconnecting to hub after being up for long periods.
 * Fix problem of upgrading with uninitialized binaries causing corruption (will kick in on future upgrades)
 * Fix problem of upgrading with uninitialized binaries causing corruption (will kick in on future upgrades)
+* Fix botcmd to make sure that results are delivered only to the requester (fixes #208)
 
 
 1.2.16 - http://wraith.botpack.net/milestone/1.2.16
 1.2.16 - http://wraith.botpack.net/milestone/1.2.16
 * Add 'set altchars' so that alternative characters used for nicks can be changed. (fixes #418)
 * Add 'set altchars' so that alternative characters used for nicks can be changed. (fixes #418)

+ 8 - 5
src/botcmd.c

@@ -1320,7 +1320,7 @@ void bounce_simul(int idx, char *buf)
   if (p)
   if (p)
     *p = 0;
     *p = 0;
 
 
-  simple_snprintf(rmsg, sizeof rmsg, "r-sr %d %s", dcc[idx].simul, buf);          /* remote-simul[r]eturn idx buf */
+  simple_snprintf(rmsg, sizeof rmsg, "r-sr %d %s %s", dcc[idx].simul, dcc[idx].user->handle, buf);          /* remote-simul[r]eturn idx buf */
   putbot(dcc[idx].simulbot, rmsg);
   putbot(dcc[idx].simulbot, rmsg);
 }
 }
 
 
@@ -1329,12 +1329,15 @@ static void bot_rsimr(char *botnick, char *code, char *msg)
   if (msg[0]) {
   if (msg[0]) {
     char * par = strdup(msg), *parp = par, *prefix = NULL;
     char * par = strdup(msg), *parp = par, *prefix = NULL;
     int idx = atoi(newsplit(&par));
     int idx = atoi(newsplit(&par));
+    char *nick = newsplit(&par);
     size_t size = strlen(botnick) + 4;
     size_t size = strlen(botnick) + 4;
 
 
-    prefix = (char *) my_calloc(1, size);
-    simple_snprintf(prefix, size, "[%s] ", botnick);
-    dumplots(idx, prefix, par);
-    free(prefix);
+    if (dcc[idx].type && (dcc[idx].type == &DCC_CHAT) && dcc[idx].user && !strcmp(dcc[idx].user->handle, nick)) {
+      prefix = (char *) my_calloc(1, size);
+      simple_snprintf(prefix, size, "[%s] ", botnick);
+      dumplots(idx, prefix, par);
+      free(prefix);
+    }
     free(parp);
     free(parp);
   }
   }
 }
 }