diff --git a/Changelog b/Changelog index 7e1dae4..ce1c743 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2.2] +* Don't double-up server notices in the /RELS list. (caf) + * Don't fire the SERVER_NOTICE hook more than once per notice. (caf) * Fix display of the OperView SWATCH flags variable. (caf) diff --git a/include/output.h b/include/output.h index c86d1a1..c874d94 100644 --- a/include/output.h +++ b/include/output.h @@ -22,7 +22,7 @@ void say (const char *, ...); void BX_bitchsay (const char *, ...); - void serversay (int, const char *, const char *, ...); + void serversay (const char *, const char *, ...); void BX_yell (const char *, ...); void error (const char *, ...); diff --git a/source/notice.c b/source/notice.c index 2c0e8dc..300b15c 100644 --- a/source/notice.c +++ b/source/notice.c @@ -110,7 +110,7 @@ static int handle_oper_vision(const char *from, char *cline, int *up_status) nick_collisions++; if (!(flags & NICK_COLLIDE)) goto done; - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_NICK_COLLISION_FSET), "%s %s %s %s", update_clock(GET_TIME), fr, for_, q)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_NICK_COLLISION_FSET), "%s %s %s %s", update_clock(GET_TIME), fr, for_, q)); } else { @@ -123,9 +123,9 @@ static int handle_oper_vision(const char *from, char *cline, int *up_status) if (q && *q) q++; chop(q, 1); if (loc_check <= 2) - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_KILL_LOCAL_FSET), "%s %s %s %s", update_clock(GET_TIME), fr, for_, q)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_KILL_LOCAL_FSET), "%s %s %s %s", update_clock(GET_TIME), fr, for_, q)); else - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_KILL_FSET), "%s %s %s %s", update_clock(GET_TIME), fr, for_, q)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_KILL_FSET), "%s %s %s %s", update_clock(GET_TIME), fr, for_, q)); } (*up_status)++; } @@ -143,7 +143,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- p = line + 24; else p = line + 18; - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_NICK_COLLISION_FSET), "%s %s", update_clock(GET_TIME), p)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_NICK_COLLISION_FSET), "%s %s", update_clock(GET_TIME), p)); (*up_status)++; } else if (!strncmp(line, "IP# Mismatch:", 13)) @@ -151,14 +151,14 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- if (!(flags & IP_MISMATCH)) goto done; for_ = line + 14; - serversay(1, from, "%s", convert_output_format(" IP Mismatch %C$1-", "%s %s", update_clock(GET_TIME), for_)); + serversay(from, "%s", convert_output_format(" IP Mismatch %C$1-", "%s %s", update_clock(GET_TIME), for_)); } else if (!strncmp(line, "Hacked ops on opless channel:", 29)) { if (!(flags & HACK_OPS)) goto done; for_ = line + 29; - serversay(1, from, "%s", convert_output_format(" Hacked ops on $0", "%s", for_)); + serversay(from, "%s", convert_output_format(" Hacked ops on $0", "%s", for_)); } else if (!strncmp(line, "connect failure:", 16)) { @@ -167,14 +167,14 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- if (!(flags & SERVER_CRAP)) goto done; for_ = line + 16; - serversay(1, from, "%s", convert_output_format(" Connect failure %K[%n$0-%K]", "%s", for_)); + serversay(from, "%s", convert_output_format(" Connect failure %K[%n$0-%K]", "%s", for_)); } else if (!strncmp(line, "Identd response differs", 22)) { if (!(flags & IDENTD)) goto done; for_ = line + 24; - serversay(1, from, "%s", convert_output_format(" Identd response differs %K[%C$1-%K]", "%s %s", update_clock(GET_TIME), for_)); + serversay(from, "%s", convert_output_format(" Identd response differs %K[%C$1-%K]", "%s %s", update_clock(GET_TIME), for_)); } else if (!strncmp(line, "Fake: ", 6)) /* MODE */ { @@ -185,9 +185,9 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- if ((fr = next_arg(p, &temp))) { if (lookup_channel(fr, from_server, CHAN_NOUNLINK)) - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_FAKE_FSET), "%s %s %s", update_clock(GET_TIME), fr, temp)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_FAKE_FSET), "%s %s %s", update_clock(GET_TIME), fr, temp)); else - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_FAKE_FSET), "%s %s %s", update_clock(GET_TIME), fr, temp)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_FAKE_FSET), "%s %s %s", update_clock(GET_TIME), fr, temp)); } } else if (!strncmp(line, "Unauthorized connection from",28)) @@ -196,7 +196,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- if (!(flags & UNAUTHS)) goto done; for_ = line + 28; - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_UNAUTH_FSET), "%s %s", update_clock(GET_TIME), for_)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_UNAUTH_FSET), "%s %s", update_clock(GET_TIME), for_)); } else if (!strncmp(line, "Too many connections from",25)) { @@ -204,7 +204,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- if (!(flags & TOO_MANY)) goto done; for_ = line + 25; - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_UNAUTH_FSET), "%s %s", update_clock(GET_TIME), for_)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_UNAUTH_FSET), "%s %s", update_clock(GET_TIME), for_)); } else if (strstr(line, "Entering high-traffic mode -") || !strncmp(line, "still high-traffic mode -", 25)) { @@ -245,7 +245,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- q = temp2+2; } } - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_TRAFFIC_HIGH_FSET), "%s %s %s", update_clock(GET_TIME), for_, q)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_TRAFFIC_HIGH_FSET), "%s %s %s", update_clock(GET_TIME), for_, q)); } else if (!strncmp(line, "Resuming standard operation", 27)) { @@ -257,7 +257,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- if (for_ && *for_ == '-') for_ = next_arg(p, &p); temp = next_arg(p, &temp2); - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_TRAFFIC_NORM_FSET), "%s %s %s %s", update_clock(GET_TIME), for_, temp, temp2)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_TRAFFIC_NORM_FSET), "%s %s %s %s", update_clock(GET_TIME), for_, temp, temp2)); } else if (wild_match("% is rehashing Server config*", line)) { @@ -266,7 +266,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- goto done; p = line; for_ = next_arg(p, &p); - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_REHASH_FSET), "%s %s", update_clock(GET_TIME), for_)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_REHASH_FSET), "%s %s", update_clock(GET_TIME), for_)); } else if (wild_match("% added K-Line for *", line)) { @@ -288,9 +288,9 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- if (++temp2) chop(temp2, 1); if (serv) - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_GLINE_FSET), "%s %s %s %s %s", update_clock(GET_TIME), for_, temp2, serv, temp)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_GLINE_FSET), "%s %s %s %s %s", update_clock(GET_TIME), for_, temp2, serv, temp)); else - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_KLINE_FSET), "%s %s %s %s", update_clock(GET_TIME), for_, temp2, temp)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_KLINE_FSET), "%s %s %s %s", update_clock(GET_TIME), for_, temp2, temp)); } else if (!strncmp(line, "Rejecting vlad/joh/com bot:", 27) || !strncmp(line+14, "Rejecting eggdrop bot:", 20) || !strncmp(line, "Rejecting ojnk/annoy bot", 24)) { @@ -300,7 +300,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- p = line + 10; temp2 = next_arg(p, &p); for_ = p + 4; - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_BOT_FSET), "%s %s %s", update_clock(GET_TIME), for_, temp2)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_BOT_FSET), "%s %s %s", update_clock(GET_TIME), for_, temp2)); } else if (!strncmp(line, "Possible bot ", 13)) { @@ -311,7 +311,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- for_ = next_arg(p, &p); if ((temp2 = next_arg(p, &p))) chop(temp2, 1); - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_BOT_FSET), "%s %s %s", update_clock(GET_TIME), for_, temp2)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_BOT_FSET), "%s %s %s", update_clock(GET_TIME), for_, temp2)); } else if (wild_match("Possible % bot *", line)) { @@ -328,7 +328,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- chop(temp2, 1); *temp2 = ' '; } - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_BOT1_FSET), "%s %s %s %s", update_clock(GET_TIME), possible?possible:"Unknown", for_, temp2)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_BOT1_FSET), "%s %s %s %s", update_clock(GET_TIME), possible?possible:"Unknown", for_, temp2)); } else if (wild_match("% % is now operator*", line)) { @@ -343,7 +343,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- if (*temp2 == '(') *temp2 = ' '; } - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_OPER_FSET), "%s %s %s", update_clock(GET_TIME), fr, temp2)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_OPER_FSET), "%s %s %s", update_clock(GET_TIME), fr, temp2)); } else if (!strncmp(line, "Received SQUIT", 14)) { @@ -360,7 +360,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- if (*temp2 == '(') temp2++; } - serversay(1, from, "%s", convert_output_format(" SQUIT of $1 from $2 %K[%R$3-%K]", "%s %s %s %s", update_clock(GET_TIME), for_, fr, temp2)); + serversay(from, "%s", convert_output_format(" SQUIT of $1 from $2 %K[%R$3-%K]", "%s %s %s %s", update_clock(GET_TIME), for_, fr, temp2)); } else if (!strncmp(line, "Received SERVER", 15)) { @@ -377,7 +377,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- if (*temp2 == '(') temp2++; } - serversay(1, from, "%s", convert_output_format(" Received SERVER %c$1%n from %c$2%n %K[%W$3-%K]", "%s %s %s %s", update_clock(GET_TIME), fr, for_, temp2)); + serversay(from, "%s", convert_output_format(" Received SERVER %c$1%n from %c$2%n %K[%W$3-%K]", "%s %s %s %s", update_clock(GET_TIME), fr, for_, temp2)); } else if (!strncmp(line, "Sending SQUIT", 13)) { @@ -390,7 +390,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- chop(temp2, 1); if (*temp2 == '(') temp2++; } - serversay(1, from, "%s", convert_output_format(" Sending SQUIT %c$1%n %K[%R$2-%K]", "%s %s %s", update_clock(GET_TIME), fr, temp2)); + serversay(from, "%s", convert_output_format(" Sending SQUIT %c$1%n %K[%R$2-%K]", "%s %s %s", update_clock(GET_TIME), fr, temp2)); } else if (!strncmp(line, "Sending SERVER", 14)) { @@ -403,7 +403,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- chop(temp2, 1); if (*temp2 == '(') temp2++; } - serversay(1, from, "%s", convert_output_format(" Sending SERVER %c$1%n %K[%W$2-%K]", "%s %s %s", update_clock(GET_TIME), fr, temp2)); + serversay(from, "%s", convert_output_format(" Sending SERVER %c$1%n %K[%W$2-%K]", "%s %s %s", update_clock(GET_TIME), fr, temp2)); } else if (!strncmp(line, "WALLOPS :Remote CONNECT", 23)) { @@ -414,7 +414,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- for_ = next_arg(p, &p); fr = next_arg(p, &p); next_arg(p, &temp2); - serversay(1, from, "%s", convert_output_format(" Remote Connect of $1:$2 from $3", "%s %s %s %s", update_clock(GET_TIME), for_, fr, temp2)); + serversay(from, "%s", convert_output_format(" Remote Connect of $1:$2 from $3", "%s %s %s %s", update_clock(GET_TIME), for_, fr, temp2)); } else if (!strncmp(line, "Client connecting", 17) || !strncmp(line, "Client exiting", 14)) { @@ -509,7 +509,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- } } - serversay(1, from, "%s", convert_output_format(fget_string_var(conn ? FORMAT_SERVER_NOTICE_CLIENT_CONNECT_FSET : FORMAT_SERVER_NOTICE_CLIENT_EXIT_FSET), "%s %s %s %s", update_clock(GET_TIME), for_, q ? q : empty_string, port ? port : empty_string)); + serversay(from, "%s", convert_output_format(fget_string_var(conn ? FORMAT_SERVER_NOTICE_CLIENT_CONNECT_FSET : FORMAT_SERVER_NOTICE_CLIENT_EXIT_FSET), "%s %s %s %s", update_clock(GET_TIME), for_, q ? q : empty_string, port ? port : empty_string)); } else if (!strncmp(line, "Terminating client for excess", 29)) { @@ -527,7 +527,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- chop(temp2, 1); q = temp2+1; } - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_CLIENT_TERM_FSET), "%s %s %s", update_clock(GET_TIME), for_, q)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_CLIENT_TERM_FSET), "%s %s %s", update_clock(GET_TIME), for_, q)); } else if (!strncmp(line, "Invalid username:", 17)) { @@ -539,7 +539,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- for_ = next_arg(p, &p); if ((temp2 = next_arg(p, &p))) chop(temp2, 1); - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_CLIENT_INVALID_FSET), "%s %s %s", update_clock(GET_TIME), for_, temp2)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_CLIENT_INVALID_FSET), "%s %s %s", update_clock(GET_TIME), for_, temp2)); } else if (!strncmp(line, "STATS ", 6)) { @@ -553,7 +553,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- for_ = next_arg(p, &p); if ( (temp2 = ++p) ) chop(temp2, 1); - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_STATS_FSET), "%s %s %s %s", update_clock(GET_TIME), temp, for_, temp2)); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_STATS_FSET), "%s %s %s %s", update_clock(GET_TIME), temp, for_, temp2)); } else if (!strncmp(line, "Nick flooding detected by:", 26)) { @@ -561,7 +561,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- if (!(flags & NICK_FLOODING)) goto done; p = line + 26; - serversay(1, from, "%s", convert_output_format(" Nick Flooding %K[%B$1-%K]", "%s %s", update_clock(GET_TIME), for_)); + serversay(from, "%s", convert_output_format(" Nick Flooding %K[%B$1-%K]", "%s %s", update_clock(GET_TIME), for_)); } else if (!strncmp(line, "Kill line active for", 20) || !strncmp(line+14, "K-line active for", 17)) { @@ -572,14 +572,13 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <- for_ = line + 20; else for_ = line + 17; - serversay(1, from, "%s", convert_output_format(" Kill line for $1 active", "%s %s", update_clock(GET_TIME), for_)); + serversay(from, "%s", convert_output_format(" Kill line for $1 active", "%s %s", update_clock(GET_TIME), for_)); } else { if (!(flags & SERVER_CRAP)) goto done; - serversay(1, from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_FSET), "%s %s %s", update_clock(GET_TIME), from, stripansicodes(line))); - add_last_type(&last_servermsg[0], MAX_LAST_MSG, NULL, NULL, NULL, line); + serversay(from, "%s", convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_FSET), "%s %s %s", update_clock(GET_TIME), from, stripansicodes(line))); } done: reset_display_target(); @@ -617,10 +616,9 @@ static void parse_server_notice(const char *from, char *line) if (get_int_var(OV_VAR) && !(get_server_ircop_flags(from_server) & SERVER_CRAP)) goto done1; #endif - serversay(1, f, "%s", convert_output_format( + serversay(f, "%s", convert_output_format( fget_string_var(FORMAT_SERVER_NOTICE_FSET), "%s %s %s", update_clock(GET_TIME), f, stripansicodes(line))); - add_last_type(&last_servermsg[0], MAX_LAST_MSG, NULL, NULL, NULL, line); } } if (up_status) diff --git a/source/output.c b/source/output.c index fa32cc7..a414bec 100644 --- a/source/output.c +++ b/source/output.c @@ -295,18 +295,19 @@ char *ov_server(int server) return ov_format(get_server_itsname(server)); } -void serversay(int save, const char *from, const char *format, ...) +void serversay(const char *from, const char *format, ...) { Window *old_target_window = target_window; - char *out = NULL; if (get_int_var(OV_VAR)) target_window = get_window_by_name("OPER_VIEW"); if (window_display && format) { + char *out; va_list args; - va_start (args, format); + + va_start(args, format); vsnprintf(putbuf, LARGE_BIG_BUFFER_SIZE, format, args); va_end(args); @@ -314,12 +315,11 @@ void serversay(int save, const char *from, const char *format, ...) convert_output_format(get_string_var(SERVER_PROMPT_VAR), "%s", ov_format(from)), putbuf); put_echo(out); + add_last_type(&last_servermsg[0], MAX_LAST_MSG, NULL, NULL, NULL, out); + new_free(&out); } target_window = old_target_window; - if (save && out) - add_last_type(&last_servermsg[0], MAX_LAST_MSG, NULL, NULL, NULL, out); - new_free(&out); } /* * Error is exactly like yell, except that if the error occured while