-
Notifications
You must be signed in to change notification settings - Fork 234
/
hignore.pl
78 lines (65 loc) · 2.62 KB
/
hignore.pl
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/perl -w
## Bugreports and Licence disclaimer.
#
# For bugreports and other improvements contact Geert Hauwaerts <geert@irssi.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this script; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
##
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "0.02";
%IRSSI = (
authors => 'Geert Hauwaerts',
contact => 'geert@irssi.org',
name => 'hignore.pl',
description => 'This script will add the HIGNORE command, if you use this command in a query it will ignore the host.',
license => 'Public Domain',
url => 'http://irssi.hauwaerts.be/hignore.pl',
changed => 'Wed Sep 17 23:51:38 CEST 2003',
);
## Comments and remarks.
#
# A little tip for this script.
#
# Tip: This script if verry usefull if you bind this to an F-key. For example if you get flooded
# (by the little bastard dj_poison on Undernet) you'll just need to press F1 and it will
# ignore the hostmask and close the query.
# Command: /BIND meta2-P key F1
# /BIND F1 command eval hignore ; unquery
#
##
Irssi::theme_register([
'loaded', '%R>>%n %_Scriptinfo:%_ Loaded $0 version $1 by $2.',
'no_query', '%R>>%n %_HIGNORE:%_ The specified window isn\'t a query.',
'no_host', '%R>>%n %_HIGNORE:%_ The specified query doesn\'t contain host information.'
]);
sub hignore {
my $wintype = Irssi::active_win->{active}->{type};
my $winaddr = Irssi::active_win->{active}->{address};
if ($wintype ne "QUERY") {
Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'no_query');
} else {
if ($winaddr =~ /\b~?(.{1,10})@([a-zA-Z0-9_.-]+)\b/) {
my ($user, $host) = ($1, $2);
Irssi::command("IGNORE *!*\@$host");
} else {
Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'no_host');
}
}
}
Irssi::command_bind('hignore', 'hignore');
Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'loaded', $IRSSI{name}, $VERSION, $IRSSI{authors});