ソースを参照

* Ported [2903] to 1.2.11
* Fixed cmd_checkchannels so that results are not shown in log, but to user only. (fixes #217)


svn: 2904

Bryan Drewery 20 年 前
コミット
d768d1683a

+ 1 - 0
doc/UPDATES

@@ -8,6 +8,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Suicide now removes userfile backups, most pid files, and crontab entries. (Fixes #125)
 * Fixed removed bots not being automatically unlinked from botnet. (fixes #254)
 * Aliases may no longer reference other aliases (only checked when used) (fixes #244)
+* Fixed cmd_checkchannels so that results are not shown in log, but to user only. (fixes #217)
 
 1.2.10 - http://tracker.shatow.net/milestone/1.2.10
 * Removed old references to '+/-manop' and '+/-nomop' for chaninfo in help file.

+ 3 - 0
src/cmds.c

@@ -41,6 +41,7 @@
 #include "src/mod/server.mod/server.h"
 #include "src/mod/irc.mod/irc.h"
 #include "src/mod/update.mod/update.h"
+#include "src/mod/channels.mod/channels.h"
 
 #include <ctype.h>
 #include <stdlib.h>
@@ -4113,6 +4114,8 @@ void gotremotecmd (char *forbot, char *frombot, char *fromhand, char *fromidx, c
     rcmd_curnick(frombot, fromhand, fromidx);
   } else if (!strcmp(cmd, "cursrv")) {
     rcmd_cursrv(frombot, fromhand, fromidx);
+  } else if (!strcmp(cmd, "chans")) {
+    rcmd_chans(frombot, fromhand, fromidx);
   } else if (!strcmp(cmd, "jump")) {
     rcmd_jump(frombot, fromhand, fromidx, par);
   } else if (!strcmp(cmd, "msg")) {

+ 9 - 6
src/mod/channels.mod/channels.c

@@ -182,10 +182,12 @@ static void got_cpart(char *botnick, char *code, char *par)
     write_userfile(-1);
 }
 
-static void got_chans(char *botnick, char *code, char *par)
-{
+void rcmd_chans(char *fbot, char *fhand, char *fidx) {
+  if (conf.bot->hub)
+    return;
+
   struct chanset_t *chan = NULL;
-  char buf[1024] = "";
+  char buf[1024] = "", reply[1024] = "";
 
   if (server_online) {
     for (chan = chanset; chan; chan = chan->next) {
@@ -195,9 +197,11 @@ static void got_chans(char *botnick, char *code, char *par)
     }
 
     if (buf[0])
-      putlog(LOG_MISC, "*", "I am not in: %s", buf);
+      simple_snprintf(reply, sizeof(reply), "I am not in: %s", buf);
   } else
-    putlog(LOG_MISC, "*", "I am not online.");
+    simple_snprintf(reply, sizeof(reply), "I am not online.");
+
+  botnet_send_cmdreply(conf.bot->nick, fbot, fhand, fidx, reply);
 }
 
 static void got_cjoin(char *botnick, char *code, char *par)
@@ -889,7 +893,6 @@ void channels_report(int idx, int details)
 }
 
 cmd_t channels_bot[] = {
-  {"chans",	"",	(Function) got_chans,	NULL, LEAF},
   {"cjoin",	"", 	(Function) got_cjoin, 	NULL, 0},
   {"cpart",	"", 	(Function) got_cpart, 	NULL, 0},
   {"cset",	"", 	(Function) got_cset,  	NULL, 0},

+ 1 - 0
src/mod/channels.mod/channels.h

@@ -51,6 +51,7 @@ bool ismasked(masklist *, const char *);
 bool ismodeline(masklist *, const char *);
 void channels_report(int, int);
 void channels_writeuserfile();
+void rcmd_chans(char *, char *, char *);
 
 extern char		glob_chanset[512];
 

+ 1 - 5
src/mod/channels.mod/cmdschan.c

@@ -494,12 +494,8 @@ static void cmd_chinfo(int idx, char *par)
 
 static void cmd_checkchannels(int idx, char *par)
 {
-  char buf[6] = "";
-
   putlog(LOG_CMDS, "*", "#%s# checkchannels", dcc[idx].nick);
-
-  simple_snprintf(buf, sizeof(buf), "chans");
-  putallbots(buf);
+  botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, "chans");
 }
 
 static void cmd_slowjoin(int idx, char *par)