From: Doug Freed Date: Sun, 9 Apr 2017 06:21:53 +0000 (-0400) Subject: trigger.pl: default address to empty in mask match X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=cb811cf51b39e6aa6cd01e46186490042b0085fe;p=irssi-scripts.irssi.org.git trigger.pl: default address to empty in mask match Server notices are included in the privnotices type, but their address parameter is undefined, because the prefix of the message is just the server name. By defaulting address to an empty string in the masks match, we can match server notices easily with `-privnotices -masks '!'` instead of a really messy rawin + regexp. (Irssi merges the nick and address passed into masks_match with a `%s!%s` format string, so there'll be a trailing "!" when address is an empty string.) --- diff --git a/scripts/trigger.pl b/scripts/trigger.pl index 4b070e6..fd6a369 100644 --- a/scripts/trigger.pl +++ b/scripts/trigger.pl @@ -456,7 +456,8 @@ my %filters = ( 'types' => \@all_types, 'sub' => sub { my ($param, $signal,$parammessage,$server,$channelname,$nickname,$address,$condition,$extra) = @_; - return (defined($nickname) && defined($address) && defined($server) && $server->masks_match($param, $nickname, $address)); + $address //= ''; + return (defined($nickname) && defined($server) && $server->masks_match($param, $nickname, $address)); } }, 'other_masks' => {