aboutsummaryrefslogtreecommitdiffstats
path: root/feature-tests/sig_unbind.pl
blob: 3123182a383f4f6b3425710f31ae15e563eb6814 (plain) (blame)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use strict;
use warnings;


use Irssi (@Irssi::EXPORT_OK);
use Irssi::Irc;
use Irssi::TextUI;

use Data::Dumper;


our $VERSION = '0.1';
our %IRSSI = (
              authors     => 'shabble',
              contact     => 'shabble+irssi@metavore.org',
              name        => '',
              description => '',
              license     => 'Public Domain',
             );

command_bind("dosig_r",
             sub {
                 my $ref = \&cmd_oink;
                 _print("binding oink to $ref");
                 signal_add("command oink", $ref);
             });

command_bind("undosig_r",
             sub {
                 my $ref = \&cmd_oink;

                 _print("unbinding oink from $ref");

                 signal_remove("command oink", $ref);
                 });

command_bind("dosig_s",
             sub {
                 signal_add("command oink", 'cmd_oink');
             });

command_bind("undosig_s",
             sub {
                 signal_remove("command oink", 'cmd_oink');
                 });

sub cmd_oink {
    Irssi::active_win()->print("Oink:");
}

sub _print  {
    Irssi::active_win()->print($_[0]);
}

command("dosig_r");
command("oink");
command("undosig_r");
command("oink");