1 package Xchat::VPIT::Services;
8 use lib get_info 'xchatdir';
10 use Xchat::XPI::Utils qw<save_context>;
12 our $VERSION = '0.03';
16 sub get_servers_ctxt {
18 return map $_->{context},
19 grep !$s{$_->{server}}++,
20 sort { $a->{type} <=> $b->{type} }
24 hook_command 'ID', sub {
25 return EAT_PLUGIN if $_[0][1];
26 my $passwd = get_info 'nickserv';
27 return EAT_ALL unless $passwd;
28 command 'ID ' . $passwd;
31 help_text => 'ID [password], identify you to NickServ'
34 hook_command 'AID', sub {
35 my $forcepasswd = $_[0][1];
36 my @contexts = get_servers_ctxt;
37 my $guard = save_context;
40 my $passwd = $forcepasswd || get_info 'nickserv';
42 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 @contexts = get_servers_ctxt;
67 my $guard = save_context;
70 my $passwd = $forcepasswd || get_info 'nickserv';
72 if (nickcmp(get_info('nick'), $target)) {
73 command join ' ', 'GHOST', $target, $passwd;
78 help_text => 'AGHOST [nick] [password], kill usurping clients on all servers'
82 my $cmd = join ' ', 'QUOTE CHANSERV', $_[2], get_info('channel');
83 my @targets = @{$_[0]};
85 @targets = (get_info 'nick') unless @targets;
86 command join ' ', $cmd, $_ for @targets;
90 hook_command "C$_", \&csmode, {
92 help_text => join ' ', $_, '[nicks] ,', (lc $_),
93 'the specified targets (or you if none) on the current channel via ChanServ'
94 } for map { $_, "DE$_" } qw<VOICE HALFOP OP PROTECT>;
96 $ph = Xchat::XPI->new(
97 name => 'IRC Services',
99 desc => 'Various IRC services helpers',
100 author => 'Vincent Pit (VPIT)',
101 email => 'perl@profvince.com',
102 url => 'http://www.profvince.com',