1use strict;
2use vars qw($VERSION %IRSSI);
3
4use Irssi;
5$VERSION = '20071209';
6%IRSSI = (
7    authors     => '',
8    contact     => '',
9    name        => 'oops',
10    description =>
11'turns \'ls\' in the beginning of a sent line into the names or whois commands',
12    license => 'Public Domain',
13);
14
15sub send_text {
16
17    #"send text", char *line, SERVER_REC, WI_ITEM_REC
18    my ( $data, $server, $witem ) = @_;
19    if ( $witem
20        && ( $witem->{type} eq "CHANNEL" )
21        && ( $data =~ /(^ls |^ls$)/ ) )
22    {
23        $witem->command("names $witem->{name}");
24        Irssi::signal_stop();
25    }
26    if ( $witem && ( $witem->{type} eq "QUERY" ) && ( $data =~ /(^ls |^ls$)/ ) )
27    {
28        $witem->command("whois $witem->{name}");
29        Irssi::signal_stop();
30    }
31}
32
33Irssi::signal_add 'send text' => 'send_text'
34