]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
Sort by networks. eg FreeNode activity is less interesting.
authorIsaacG <redacted>
Wed, 7 Mar 2012 18:20:23 +0000 (13:20 -0500)
committerbw1 <redacted>
Mon, 8 Jan 2018 18:23:33 +0000 (19:23 +0100)
scripts/ack.pl

index 42d9ba28d42d9d9078eed8f01e5ccb19dd0f13f9..d0eb1687e37c7b618125d8e30af02446cd845b57 100644 (file)
@@ -30,6 +30,7 @@ my %sort_methods = (
        lastspoke => [ \&sort_lastspoke, "Give priority to channels you recently spoke in" ],
        priority  => [ \&sort_priority,  "Manually prioritize given windows" ],
        timestamp => [ \&sort_timestamp, "Channel most recently with activity" ],
+       network   => [ \&sort_network,   "Ordered list of network tags" ],
 );
 
 
@@ -58,6 +59,24 @@ sub sort_level
        }
 }
 
+sub sort_network
+{
+       my ($reverse, @windows) = @_;
+       return @windows unless (Irssi::settings_get_str('ack_networks'));
+       my @networks = split (/,/, lc(Irssi::settings_get_str('ack_networks')));
+       my @list;
+       for my $tag (@networks)
+       {
+               for my $item (@windows)
+               {
+                       push @list, $item if ( lc($item->{active_server}->{tag}) eq $tag );
+               }
+               return @list if( @list );
+       }
+       return @windows;
+}
+
+
 # Only show whitelisted windows - by refnum 
 # Set reversed to blacklist
 sub sort_whitelist
@@ -235,5 +254,8 @@ Irssi::settings_add_str('misc', 'ack_channel_whitelist', '');
 # See the sort_method hash
 Irssi::settings_add_str('misc', 'ack_sorts', '+level,+refnum');
 
+# Network priority list, eg a,b,c will prioritize a then b then c then the rest
+Irssi::settings_add_str('misc', 'ack_networks', 'FreeNode,EFNet');
+
 # How long a last_spoke is valid for before "forgotten"
 Irssi::settings_add_int('misc', 'ack_last_spoke_timeout', 300);
git clone https://git.99rst.org/PROJECT