File: oops.pl

package info (click to toggle)
irssi-scripts 20070925
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,708 kB
  • ctags: 2,415
  • sloc: perl: 54,737; makefile: 43; sh: 20
file content (33 lines) | stat: -rw-r--r-- 864 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use strict;
use vars qw($VERSION %IRSSI);

use Irssi;
$VERSION = '20021003';
%IRSSI = (
    authors     => 'Niklas \'Nakke\' Bertell',
    contact     => 'niklas.bertell\@abo.fi',
    name        => 'oops',
    description =>
'turns \'ls\' in the beginning of a sent line into the names or whois commands',
    license => 'Public Domain',
);

sub send_text {

    #"send text", char *line, SERVER_REC, WI_ITEM_REC
    my ( $data, $server, $witem ) = @_;
    if ( $witem
        && ( $witem->{type} eq "CHANNEL" )
        && ( $data =~ /(^ls |^ls$)/ ) )
    {
        $witem->command("names $witem->{name}");
        Irssi::signal_stop();
    }
    if ( $witem && ( $witem->{type} eq "QUERY" ) && ( $data =~ /(^ls |^ls$)/ ) )
    {
        $witem->command("whois $witem->{name}");
        Irssi::signal_stop();
    }
}

Irssi::signal_add 'send text' => 'send_text'