diff options
| author | Isaac Good | 2016-12-06 18:44:35 -0800 |
|---|---|---|
| committer | Isaac Good | 2016-12-06 18:44:35 -0800 |
| commit | 2d83df01cbda6946f84c1bba1c01c34bd05e9570 (patch) | |
| tree | 66ce0db9d4f817649df1def9ac09f4c57257dffc | |
| parent | d5063cf314ba7c08e9441f128735ba4169a56cd6 (diff) | |
| download | scripts.irssi.org-2d83df01cbda6946f84c1bba1c01c34bd05e9570.tar.bz2 | |
Fix build errors
| -rw-r--r-- | scripts/listsort.pl | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/scripts/listsort.pl b/scripts/listsort.pl index f615cd9..deb8770 100644 --- a/scripts/listsort.pl +++ b/scripts/listsort.pl @@ -1,3 +1,5 @@ +use strict; +use warnings; use Irssi; use vars qw/$VERSION %IRSSI/; @@ -15,16 +17,10 @@ $VERSION = '0.1'; # Bindings. Start of channel list, end of list, list item. Irssi::signal_add_last('event 322', \&list_event); Irssi::signal_add_last('event 323', \&list_end); -Irssi::signal_add_last('notifylist event', \&list_start); # Store the channel list between IRC messages my %list; -# When we get a start-list, create an empty list. -sub list_start { - %list = {}; -} - # Store list info in the hash. sub list_event { my ($server, $data, $server_name) = @_; @@ -32,9 +28,12 @@ sub list_event { my ($nick, $name, $size) = split (/ /, $meta, 3); $list{$name}{'size'} = $size; - $more =~ /^[^[]*\[([^]]*)\][^ ]* *([^ ].*)$/; - my $modes = $1; - $list{$name}{'desc'} = $2; + my $modes = ''; + $list{$name}{'desc'} = ''; + if ($more =~ /^[^[]*\[([^]]*)\][^ ]* *([^ ].*)$/) { + $modes = $1; + $list{$name}{'desc'} = $2; + } $modes =~ s/ +$//; $list{$name}{'modes'} = $modes; @@ -43,12 +42,14 @@ sub list_event { # Print out the whole list in sorted order. sub list_end { for my $name (sort {$list{$a}{'size'} <=> $list{$b}{'size'}} keys %list) { + my $mode = $list{$name}{'modes'}; + $mode = " ($mode)" if ($mode); my $msg = sprintf ( - "%d %s: %s (%s)", + "%d %s: %s%s", $list{$name}{'size'}, $name, $list{$name}{'desc'}, - $list{$name}{'modes'} + $mode ); Irssi::print($msg, MSGLEVEL_CRAP); |
