Explorar el Código

* Add cmd_botlink for injecting into the botlink stream for testing.

svn: 3739
Bryan Drewery hace 18 años
padre
commit
c236bd2d6f
Se han modificado 3 ficheros con 11 adiciones y 6 borrados
  1. 0 5
      src/botmsg.c
  2. 10 0
      src/cmds.c
  3. 1 1
      src/tandem.h

+ 0 - 5
src/botmsg.c

@@ -36,11 +36,6 @@ void send_uplink(const char *msg, size_t len)
   tputs(dcc[uplink_idx].sock, (char *) msg, len);
 }
 
-void send_hubs(const char *msg, size_t len)
-{
-  send_hubs_but(-1, msg, len);
-}
-
 void send_hubs_but(int idx, const char *msg, size_t len)
 {
   int i = 0;

+ 10 - 0
src/cmds.c

@@ -4449,6 +4449,15 @@ void cmd_test(int idx, char *par)
   putlog(LOG_CMDS, "*", "#%s# test", dcc[idx].nick);
 }
 
+void cmd_botlink(int idx, char *par)
+{
+  putlog(LOG_CMDS, "*", "#%s# botlink %s", dcc[idx].nick, par);
+  if (conf.bot->hub)
+    send_hubs(par, strlen(par));
+  else
+    send_uplink(par, strlen(par));
+}
+
 /* DCC CHAT COMMANDS
  */
 /* Function call should be:
@@ -4558,6 +4567,7 @@ cmd_t C_dcc[] =
   {"w", 		"n", 	(Function) cmd_w, 		NULL, 0},
   {"channels", 		"", 	(Function) cmd_channels, 	NULL, 0},
   {"test",		"",	(Function) cmd_test,		NULL, 0},
+  {"botlink",		"a",	(Function) cmd_botlink,		NULL, 0},
   {"randstring", 	"", 	(Function) cmd_randstring, 	NULL, AUTH_ALL},
   {"md5",		"",	(Function) cmd_md5,		NULL, AUTH_ALL},
   {"sha1",		"",	(Function) cmd_sha1,		NULL, AUTH_ALL},

+ 1 - 1
src/tandem.h

@@ -79,7 +79,7 @@ int botnet_send_cmd(char * fbot, char * bot, char *fhnd, int fromidx, char * cmd
 void botnet_send_cmd_broad(int idx, char * fbot, char *fhnd, int fromidx, char * cmd);
 void botnet_send_cmdreply(char * fbot, char * bot, char * to, char * toidx, char * ln);
 void send_uplink(const char *, size_t);
-inline void send_hubs(const char *, size_t);
+#define send_hubs(_s, _l) send_hubs_but(-1, (_s), (_l))
 void send_hubs_but(int , const char *, size_t);