# Francesco `ascii` Ongaro - ascii@ush.it - www.ush.it use strict; use warnings; use Xchat qw( :all ); my $name = 'foo'; my $version = '0.1'; register($name, $version, 'foo'); prnt("Loaded $name $version"); my $kvirc_channel_usage = 'Usage: /kvirc_channel command: Test the current channel'; my $kvirc_user_usage = 'Usage: /kvirc_user user_name command: Test a user'; hook_command('kvirc_channel', \&kvirc_channel, { help_message => $kvirc_channel_usage }); hook_command('kvirc_user', \&kvirc_user, { help_message => $kvirc_user_usage }); sub kvirc_channel { if ($_[1][1]) { my $command = $_[1][1]; prnt("[+] kvirc_channel against current channel with command $command .."); my @user_list = Xchat::get_list("users"); foreach (@user_list) { my $user_name = $_->{"nick"}; kvirc_user_internal($user_name, $command); } return EAT_XCHAT; } else { prnt($kvirc_channel_usage); } } sub kvirc_user { if ($_[1][1] && $_[1][2]) { my @inputs = split(' ', $_[1][1]); my $user_name = @inputs[0]; my $command = $_[1][2]; kvirc_user_internal($user_name, $command); } else { prnt($kvirc_user_usage); } } sub kvirc_user_internal { prnt("\tSending $_[1] to $_[0] .."); command('ctcp '.$_[0].' DCC GET\r'.$_[1].'\r'); }