]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
Fix network matching for query subcommand
authormartin f. krafft <redacted>
Thu, 23 Feb 2017 18:33:08 +0000 (07:33 +1300)
committermartin f. krafft <redacted>
Thu, 23 Feb 2017 18:44:45 +0000 (07:44 +1300)
In the absence of a network tag passed to the `query` subcommand, no
rules but the default would match and so the returned match(es) would
potentially not actually be the ones used in context of ctrlact's normal
operation.

This commit fixes #354 by special-casing the threshold match when the
data to be looked up doesn't actually specify a network tag. In this
case, the output for net will be '(ignored)'.

Signed-off-by: martin f. krafft <redacted>
scripts/ctrlact.pl

index 534b00a74542d82830ce9ad153147b52568ecf20..aa9dcfbd51134d9a47dab6b08a850f469e378ee9 100644 (file)
@@ -111,7 +111,7 @@ use Carp qw( croak );
 use Irssi;
 use Text::ParseWords;
 
-our $VERSION = '1.1';
+our $VERSION = '1.2';
 
 our %IRSSI = (
     authors     => 'martin f. krafft',
@@ -119,7 +119,7 @@ our %IRSSI = (
     name        => 'ctrlact',
     description => 'allows per-channel control over activity indication',
     license     => 'MIT',
-    changed     => '2017-02-15'
+    changed     => '2017-02-24'
 );
 
 ### DEFAULTS AND SETTINGS ######################################################
@@ -208,7 +208,8 @@ sub from_data_level {
 sub walk_match_array {
        my ($name, $net, $type, @arr) = @_;
        foreach my $quadruplet (@arr) {
-               my $netmatch = match($quadruplet->[0], $net);
+               my $netmatch = $net eq '*' ? '(ignored)'
+                                       : match($quadruplet->[0], $net);
                my $match = match($quadruplet->[1], $name);
                next unless $netmatch and $match;
 
git clone https://git.99rst.org/PROJECT