diff --git a/doc/sphinx_source/using/tcl-commands.rst b/doc/sphinx_source/using/tcl-commands.rst index 0fbbecb6d..eee307b55 100644 --- a/doc/sphinx_source/using/tcl-commands.rst +++ b/doc/sphinx_source/using/tcl-commands.rst @@ -1650,6 +1650,28 @@ strip [+/-strip-flags] Module: core +^^^^^^^^^^^^^^^^^^^ +page [number] +^^^^^^^^^^^^^^^^^^^ + + Description: This allows you to slow down the number of lines the bot sends + + to a user at once via the partyline. When enabled, any commands that send + + greater than the specified number of lines will stop when that number is + + reached and wait for the user to type another command (or press enter) to + + continue. If the user has too many pending lines, he may be booted off the + + bot. + + Returns: new value of page lines for that user (or the current value, if + + status was omitted) + + Module: core + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ putbot ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/Makefile.in b/src/Makefile.in index 21e359131..954c41c1c 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -121,7 +121,7 @@ dcc.o: dcc.c main.h ../config.h ../eggint.h ../lush.h lang.h eggdrop.h \ compat/in6.h flags.h proto.h misc_file.h cmdt.h tclegg.h tclhash.h \ chan.h users.h compat/compat.h compat/base64.h compat/inet_aton.h \ ../src/main.h compat/snprintf.h compat/explicit_bzero.h compat/strlcpy.h \ - tandem.h md5/md5.h + modules.h mod/modvals.h tandem.h md5/md5.h dccutil.o: dccutil.c main.h ../config.h ../eggint.h ../lush.h lang.h \ eggdrop.h compat/in6.h flags.h proto.h misc_file.h cmdt.h tclegg.h \ tclhash.h chan.h users.h compat/compat.h compat/base64.h \ diff --git a/src/dcc.c b/src/dcc.c index 0bd0a95cf..d717ecff1 100644 --- a/src/dcc.c +++ b/src/dcc.c @@ -25,6 +25,7 @@ #include "main.h" #include +#include "modules.h" #include "tandem.h" /* Includes for botnet md5 challenge/response code */ @@ -926,8 +927,10 @@ static void append_line(int idx, char *line) struct msgq *p, *q; struct chat_info *c = (dcc[idx].type == &DCC_CHAT) ? dcc[idx].u.chat : dcc[idx].u.file->chat; + module_entry *me; + char line_r[LOGLINELEN]; - if (c->current_lines > 1000) { + if (c->current_lines > 2000) { /* They're probably trying to fill up the bot nuke the sods :) */ for (p = c->buffer; p; p = q) { q = p->next; @@ -935,8 +938,16 @@ static void append_line(int idx, char *line) nfree(p); } c->buffer = 0; + + /* Turn paging off to avoid infinite loop */ dcc[idx].status &= ~STAT_PAGE; - do_boot(idx, botnetnick, "too many pages - sendq full"); + if ((me = module_find("console", 1, 1))) { + Function *func = me->funcs; + (func[CONSOLE_DOSTORE]) (idx); + } + debug0("dcc.c: append_line(): Paging turned off."); + + do_boot(idx, botnetnick, "more than 1000 page lines - sendq full"); return; } if ((c->line_count < c->max_line) && (c->buffer == NULL)) { @@ -948,13 +959,16 @@ static void append_line(int idx, char *line) q = NULL; else for (q = c->buffer; q->next; q = q->next); + /* get_data_ptr() -> n_malloc() could destroy line, so copy line to line_r + * to make append_line() reentrant + */ + strlcpy(line_r, line, sizeof line_r); p = get_data_ptr(sizeof(struct msgq)); - p->len = l; p->msg = get_data_ptr(l + 1); p->next = NULL; - strcpy(p->msg, line); + strlcpy(p->msg, line_r, l + 1); if (q == NULL) c->buffer = p; else