All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
4 use vars qw($VERSION %IRSSI);
9 contact=> 'bd@bc-bd.org',
11 description=> 'Remembers the last person oping you on a channel',
13 url=> 'https://bc-bd.org/svn/repos/irssi/thankop',
22 # Type '/thankop' in a channel window to thank the person opping you
28 # /set thankop_command [command]
29 # * command : to be executed. The following $'s are expanded
30 # $N : Nick (some dude)
34 # /set thankop_command say $N: w00t!
40 # To the channel you got op in, with <nick> beeing the nick who
48 # - fix crash if used in a window != CHANNEL
49 # - do not thank someone who has already left
52 # - added support for multiple networks, thanks to senneth
53 # - adapted to signal changes in 0.8.10
56 # - change back to setting instead of theme item
59 # - added theme item to customize the message (idea from mordeth)
62 # - removed '/' from the ->command (thx to mordeth)
63 # - removed debug messages (where commented out)
66 # - added version dependency, since some 0.8.4 users complained about a not
70 # - unsetting of hash values is done with delete not unset.
81 my ($data, $server, $witem) = @_;
83 if (!$witem || ($witem->{type} =! "CHANNEL")) {
84 Irssi::print("thankop: Window not of type CHANNEL");
88 my $tag = $witem->{server}->{tag}.'/'.$witem->{name};
90 # did we record who opped us here
91 if (!exists($op{$tag})) {
92 $witem->print("thankop: I don't know who op'ed you in here");
99 if (!$witem->nick_find($by)) {
100 $witem->print("thankop: $by already left");
104 my $cmd = Irssi::settings_get_str('thankop_command');
107 $witem->command($cmd);
111 my ($channel, $nick, $by, undef, undef) = @_;
113 return if ($channel->{server}->{nick} ne $nick->{nick});
115 # since 0.8.10 this is set after signals have been processed
116 return if ($channel->{chanop});
118 my $tag = $channel->{server}->{tag}.'/'.$channel->{name};
123 sub channel_destroyed {
126 my $tag = $channel->{server}->{tag}.'/'.$channel->{name};
131 Irssi::command_bind('thankop','cmd_thankop');
132 Irssi::signal_add_last('nick mode changed', 'mode_changed');
134 Irssi::settings_add_str('thankop', 'thankop_command', 'say $N: opthx');