Unify handling of SWATCH NONE between OperView and non-OperView modes

Previously, SWATCH NONE meant "show no server notices" if OperView was
enabled, but "show all server notices" if OperView was disabled.  Now,
it always means "show no server notices" (the default SWATCH is ALL,
so the default will behave the same).

This allows us to simplify the code a great deal as well.

Also trim off leading "***" if the server messages are handled by
handle_oper_vision(), as they already are in parse_server_notice().
This commit is contained in:
Kevin Easton
2016-04-14 23:50:42 +10:00
parent 7c3648bb2c
commit e53d1cab7b
2 changed files with 20 additions and 33 deletions

View File

@@ -1,5 +1,7 @@
[Changes 1.2.2] [Changes 1.2.2]
* Unify handling of SWATCH NONE between OperView and non-OperView. (caf)
* Don't double-up server notices in the /RELS list. (caf) * Don't double-up server notices in the /RELS list. (caf)
* Don't fire the SERVER_NOTICE hook more than once per notice. (caf) * Don't fire the SERVER_NOTICE hook more than once per notice. (caf)

View File

@@ -66,26 +66,22 @@ long oper_kills = 0,
#ifdef WANT_OPERVIEW #ifdef WANT_OPERVIEW
extern void check_orig_nick(char *); extern void check_orig_nick(char *);
static int handle_oper_vision(const char *from, char *cline, int *up_status) static void handle_oper_vision(const char *from, char *line)
{ {
char *fr, *for_, *temp, *temp2; char *fr, *for_, *temp, *temp2;
char *p; char *p;
int done_one = 0; int up_status = 0;
char *line; const unsigned long flags = get_server_ircop_flags(from_server);
unsigned long flags;
p = fr = for_ = temp = temp2 = NULL; p = fr = for_ = temp = temp2 = NULL;
if (from_server == -1 || !(flags = get_server_ircop_flags(from_server)))
return 0;
line = LOCAL_COPY(cline);
if (!strncmp(line, "*** Notice -- ", 13)) if (!strncmp(line, "*** Notice -- ", 13))
line += 14; line += 14;
else if (!strncmp(line, "*** \002Notice\002 --", 15)) else if (!strncmp(line, "*** \002Notice\002 --", 15))
line += 16; line += 16;
else if (!strncmp(line, "*** ", 4))
line += 4;
done_one++;
/* /*
[ss]!irc.cs.cmu.edu D-line active for think[think@skateboarders.edu] [ss]!irc.cs.cmu.edu D-line active for think[think@skateboarders.edu]
*/ */
@@ -103,7 +99,6 @@ static int handle_oper_vision(const char *from, char *cline, int *up_status)
fr = next_arg(q, &q); fr = next_arg(q, &q);
q += 6; q += 6;
check_orig_nick(for_); check_orig_nick(for_);
if (strchr(fr, '.')) if (strchr(fr, '.'))
{ {
@@ -127,7 +122,7 @@ static int handle_oper_vision(const char *from, char *cline, int *up_status)
else else
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)); 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)++; up_status++;
} }
else if (!strncmp(line, "Nick collision on", 17) || !strncmp(line, "Nick change collision on", 24)) else if (!strncmp(line, "Nick collision on", 17) || !strncmp(line, "Nick change collision on", 24))
{ {
@@ -144,7 +139,7 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <-
else else
p = line + 18; p = line + 18;
serversay(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)++; up_status++;
} }
else if (!strncmp(line, "IP# Mismatch:", 13)) else if (!strncmp(line, "IP# Mismatch:", 13))
{ {
@@ -582,14 +577,14 @@ irc.BitchX.com *** Notice -- Nick collision on nickserv(irc.distracted.net <-
} }
done: done:
reset_display_target(); reset_display_target();
return done_one; if (up_status)
update_all_status(current_window, NULL, 0);
} }
#endif #endif
static void parse_server_notice(const char *from, char *line) static void parse_server_notice(const char *from, char *line)
{ {
int flag = 0; int flag = 0;
int up_status = 0;
const char *f = from; const char *f = from;
if (!f || !*f) if (!f || !*f)
@@ -603,28 +598,18 @@ static void parse_server_notice(const char *from, char *line)
if (do_hook(SERVER_NOTICE_LIST, flag?"%s *** %s":"%s %s", f, line)) if (do_hook(SERVER_NOTICE_LIST, flag?"%s *** %s":"%s %s", f, line))
{ {
#ifdef WANT_OPERVIEW #ifdef WANT_OPERVIEW
if (handle_oper_vision(f, line, &up_status)) handle_oper_vision(f, line);
reset_display_target(); #else
else if (!flag)
#endif next_arg(line, &line);
{
if (!flag)
next_arg(line, &line);
set_display_target(NULL, LOG_SNOTE); set_display_target(NULL, LOG_SNOTE);
#ifdef WANT_OPERVIEW serversay(f, "%s", convert_output_format(
if (get_int_var(OV_VAR) && !(get_server_ircop_flags(from_server) & SERVER_CRAP)) fget_string_var(FORMAT_SERVER_NOTICE_FSET), "%s %s %s",
goto done1; update_clock(GET_TIME), f, stripansicodes(line)));
reset_display_target();
#endif #endif
serversay(f, "%s", convert_output_format(
fget_string_var(FORMAT_SERVER_NOTICE_FSET), "%s %s %s",
update_clock(GET_TIME), f, stripansicodes(line)));
}
} }
if (up_status)
update_all_status(current_window, NULL, 0);
done1:
reset_display_target();
} }
static int check_ignore_notice(char *from, char *to, unsigned long type, char *line, char **high) static int check_ignore_notice(char *from, char *to, unsigned long type, char *line, char **high)