]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
trigger.pl: default address to empty in mask match
authorDoug Freed <redacted>
Sun, 9 Apr 2017 06:21:53 +0000 (02:21 -0400)
committerGitHub <redacted>
Sun, 9 Apr 2017 06:21:53 +0000 (02:21 -0400)
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
'<servername>!'` 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.)

scripts/trigger.pl

index 4b070e68e322a28398fe292d95c5bf5f27e3c5ff..fd6a369f7dfc7f9087e1adee86e973e2e02a9cd9 100644 (file)
@@ -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' => {
git clone https://git.99rst.org/PROJECT