22use Irssi;
33use vars qw( $VERSION %IRSSI) ;
44
5- $VERSION = " 1.00 " ;
5+ $VERSION = " 1.01 " ;
66%IRSSI = (
77 name => " zmartfilter" ,
88 description => " smartfilter.pl reimagined, optimized for unusually flakey networks such as IRC over I2P" ,
@@ -169,10 +169,15 @@ sub print_text {
169169 return ;
170170 }
171171
172- my ($level , @nicks ) = $dest -> {level };
172+ my ($level , @nicks , %addresses ) = $dest -> {level };
173173 if ($level & (MSGLEVEL_JOINS | MSGLEVEL_PARTS | MSGLEVEL_QUITS)) {
174- if ($stripped =~ / ([^ ]+) \[ .+ \] has (joined|left|quit)/ ) {
174+ if ($stripped =~ / ([^ ]+) \[ ([^]]+) \] has (joined|left|quit)/ ) {
175175 @nicks = ($1 );
176+ # this nick may have just parted or quit, in which case
177+ # we can't rely on the channel->nick->address lookup,
178+ # so we need to use the address in the message text
179+ # when we can
180+ $addresses {$1 } = $2 ;
176181 }
177182 } elsif ($level & MSGLEVEL_NICKS) {
178183 if ($stripped =~ / [^ ]+ is now known as ([^ ]+)/ ) {
@@ -197,11 +202,14 @@ sub print_text {
197202 # it's text that relates to me
198203 return ;
199204 }
200- my $address = $server -> channel_find($target );
201- $address = $address -> nick_find($nick );
202- $address = $address -> {host };
205+ my $address = $addresses {$nick };
203206 if (!$address ) {
204- next ;
207+ $address = $server -> channel_find($target );
208+ $address = $address -> nick_find($nick );
209+ $address = $address -> {host };
210+ if (!$address ) {
211+ next ;
212+ }
205213 }
206214 if ($server -> mask_match_address(' *!*@services.*' , " " , $address )) {
207215 # relates to network services
0 commit comments