From: IsaacG Date: Wed, 7 Mar 2012 18:20:23 +0000 (-0500) Subject: Sort by networks. eg FreeNode activity is less interesting. X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=b9fc2685f6b4b13b9d56750ce16be8a31be085e2;p=irssi-scripts.irssi.org.git Sort by networks. eg FreeNode activity is less interesting. --- diff --git a/scripts/ack.pl b/scripts/ack.pl index 42d9ba2..d0eb168 100644 --- a/scripts/ack.pl +++ b/scripts/ack.pl @@ -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);