]> git.madduck.net Git - code/irssi/scripts-bc-bd.git/blob - reslap.pl

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

semi-consistent use of tabs
[code/irssi/scripts-bc-bd.git] / reslap.pl
1 use Irssi;
2 use Irssi::Irc;
3 use strict;
4
5 use vars qw($VERSION %IRSSI);
6
7 $VERSION="0.1.0";
8 %IRSSI = (
9         authors=> 'BC-bd',
10         contact=> 'bd@bc-bd.org',
11         name=> 'reslap',
12         description=> 'Autoreslaps people',
13         license=> 'GPL v2',
14         url=> 'https://bc-bd.org/svn/repos/irssi/reslap',
15 );
16
17 # $Id$
18 # for irssi 0.8.5 by bd@bc-bd.org
19 #
20 #########
21 # USAGE
22 ###
23 #
24 #########
25 # OPTIONS
26 #########
27 #
28 ###
29 ################
30 ###
31 #
32 # Changelog
33 #
34 # Version 0.1.0
35 #  - initial release
36 #
37 ###
38 ################
39
40 sub sig_action() {
41         my ($server,$msg,$nick,$address,$target) = @_;
42
43         my $window = $server->window_find_item($target);
44         my $match = "slaps $server->{nick} around a bit with a ";
45         my $fish = $msg;
46         
47         $fish =~ s/\Q$match\E//e;
48
49         if ($fish ne $msg) {
50                 $window->command("/me slaps $nick around a bit with a ".$fish." (autoreslap successfull)");
51                 return 0;
52         }
53
54         $match = "drives over $server->{nick}";
55         my $jump = $msg;
56
57         $jump =~ s/\Q$match\E//e;
58
59         if ($jump ne $msg) {
60                 $window->command("/me jumps away (autoavoidance successfull)");
61                 return 0;
62         }
63 }
64
65 # "message irc action", SERVER_REC, char *msg, char *nick, char *address, char *target
66 Irssi::signal_add_last('message irc action', 'sig_action');