diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:19:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:19:02 +0000 |
commit | 03929dac2a29664878d2c971648a4fe1fb698462 (patch) | |
tree | 02c5e2b3e006234aa29545f7a93a1ce01b291a8b /scripts/wilm.pl | |
parent | Initial commit. (diff) | |
download | irssi-scripts-upstream.tar.xz irssi-scripts-upstream.zip |
Adding upstream version 20231031.upstream/20231031upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/wilm.pl')
-rw-r--r-- | scripts/wilm.pl | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/scripts/wilm.pl b/scripts/wilm.pl new file mode 100644 index 0000000..59fd1a5 --- /dev/null +++ b/scripts/wilm.pl @@ -0,0 +1,54 @@ +# wilm.pl +# Lam 28.10.2001, 10.3.2002 +# lam@lac.pl + +use strict; +use vars qw($VERSION %IRSSI); +$VERSION = "1.0.1"; +%IRSSI = ( + authors => "Leszek Matok", + contact => "lam\@lac.pl", + name => "wilm", + description => "Provides /wilm and /wiilm commands, which do a whois on a person who sent you last private message", + license => "Public Domain", + changed => "10.3.2002 14:00" +); + +my $last_nick; +my $last_server; + +sub wilm { + my @all_servers = Irssi::servers(); + foreach my $one_server ( @all_servers ) { + if ( $one_server = $last_server ) { + $one_server->command( "whois $last_nick" ); + return; + } + } + Irssi::print( "noone to whois" ); +} + +sub wiilm { + my @all_servers = Irssi::servers(); + foreach my $one_server ( @all_servers ) { + if ( $one_server = $last_server ) { + $one_server->command( "whois $last_nick $last_nick" ); + return; + } + } + Irssi::print( "noone to whois" ); +} + +sub privmsg { + my ( $server, $data, $nick, $address ) = @_; + my ( $target, $text ) = split( / :/, $data, 2 ); + + if ( ( lc $target ) eq ( lc $server->{ nick } ) ) { + $last_nick = $nick; + $last_server = $server; + } +} + +Irssi::command_bind( "wilm", "wilm" ); +Irssi::command_bind( "wiilm", "wiilm" ); +Irssi::signal_add( "event privmsg", "privmsg" ); |