# # NAME # # sjpq.pl - sspecific join/part/quit # # DESCRIPTION # # This plugin ensures that scrollback for channels isn't peppered by # join, part or signoff/quit messages produced by people that were not # talking in the channel at the time. This plugin intercepts all # join/part/quit messages and only displays them if they have said # something in the channel within N minutes ago. N is configurable # throught he 'sjpq_minutes' variable. # # USAGE # # $ cp sjpq.pl ~/.irssi/plugins # # /script load sjpq.pl # # (optionally, 10 minutes is the default:) # /set sjpq_minutes 30 # use strict; use vars qw( $VERSION %IRSSI $SEEN ); $VERSION = '0.99.2'; %IRSSI = ( name => 'specific join/part/quit', authors => 'Ian Langworth', contact => 'http://langworth.com/ContactingIan', url => 'http://langworth.com/IrssiStuff', license => 'GNU GPL version 2', description => 'hides joins/parts/quits in a channel unless they were involved in recent conversations -- in other words, ignores idle users that join/part/signoff', ); use Irssi qw( settings_add_int settings_get_int signal_add signal_stop print ); # used like: $time = $SEEN->{$channel}{$nick} $SEEN = {}; # default setting, user must have talked within sjpq_minutes settings_add_int( 'sjpq', sjpq_minutes => 10 ); # record the last time a person has talked publicly in what channel signal_add( 'event privmsg' => sub { my ( $server, $data, $nick ) = @_; my ( $channel ) = $data =~ /(\#[^\s]+)/; # ignore private messages -- you have them appear in a # separate window anyway, right? right? return unless $channel; $SEEN->{$channel}{$nick} = time; }); # do the join/part/quit output blocking my $handler = sub { my ( $server, $channel, $nick ) = @_; # block the signal if we've seen them... signal_stop() unless ( ( time - $SEEN->{$channel}{$nick} ) / 60 ) <= settings_get_int( 'sjpq_minutes' ); }; signal_add( 'message join' => $handler ); signal_add( 'message part' => $handler ); signal_add( 'message quit' => $handler ); # print successful startup info print ">>> '$IRSSI{name}' version $VERSION loaded"; print ">>> $IRSSI{url}"; 1;