1 package Xchat::VPIT::Services;
8 use lib get_info 'xchatdir';
11 our $VERSION = '0.03';
15 sub get_servers_ctxt {
17 return map $_->{context},
18 grep !$s{$_->{server}}++,
19 sort { $a->{type} <=> $b->{type} }
23 hook_command 'ID', sub {
24 return EAT_PLUGIN if $_[0][1];
25 my $passwd = get_info 'nickserv';
26 return EAT_ALL unless $passwd;
27 command 'ID ' . $passwd;
30 help_text => 'ID [password], identify you to NickServ'
33 hook_command 'AID', sub {
34 my $forcepasswd = $_[0][1];
35 my $oldctxt = get_context;
36 my @contexts = get_servers_ctxt;
39 my $passwd = $forcepasswd || get_info 'nickserv';
41 command 'ID ' . $passwd;
46 help_text => 'AID [password], identify you on all servers'
49 hook_command 'GHOST', sub {
50 return EAT_PLUGIN if $_[0][2];
51 my $target = $_[0][1] || get_prefs 'irc_nick1';
52 my $passwd = get_info 'nickserv';
53 return EAT_ALL unless $target && $passwd;
54 if (nickcmp(get_info('nick'), $target)) {
55 command join ' ', 'GHOST', $target, $passwd;
59 help_text => 'GHOST [nick] [password], kill the client currently connected with your nickname'
62 hook_command 'AGHOST', sub {
63 my $target = $_[0][1] || get_prefs 'irc_nick1';
64 return EAT_ALL unless $target;
65 my $forcepasswd = $_[0][2];
66 my $oldctxt = get_context;
67 my @contexts = get_servers_ctxt;
70 my $passwd = $forcepasswd || get_info 'nickserv';
72 if (nickcmp(get_info('nick'), $target)) {
73 command join ' ', 'GHOST', $target, $passwd;
79 help_text => 'AGHOST [nick] [password], kill usurping clients on all servers'
83 my $cmd = join ' ', 'QUOTE CHANSERV', $_[2], get_info('channel');
84 my @targets = @{$_[0]};
86 @targets = (get_info 'nick') unless @targets;
87 command join ' ', $cmd, $_ for @targets;
91 hook_command "C$_", \&csmode, {
93 help_text => join ' ', $_, '[nicks] ,', (lc $_),
94 'the specified targets (or you if none) on the current channel via ChanServ'
95 } for map { $_, "DE$_" } qw<VOICE HALFOP OP PROTECT>;
97 $ph = Xchat::XPI->new(
98 name => 'IRC Services',
100 desc => 'Various IRC services helpers',
101 author => 'Vincent Pit (VPIT)',
102 email => 'perl@profvince.com',
103 url => 'http://www.profvince.com',