################################################################################
# Close Queries by ct^ <http://xanoo.com/ct/> #
################################################################################
package Xchat::Script::CloseQueries;
use warnings;
use strict;
use constant COMMAND => 'clq';
use constant {
NAME => 'Close Queries',
VERSION => '0.2',
DESCRIPTION => 'Closes all query windows on /' . COMMAND
};
Xchat::register(NAME, VERSION, DESCRIPTION);
Xchat::hook_command(COMMAND, \&close_queries);
sub close_queries {
my $context = Xchat::get_context();
my @channels = Xchat::get_list('channels');
my $closed = 0;
foreach my $channel (@channels) {
if ($channel->{'type'} == 3) {
Xchat::set_context($channel->{'context'});
Xchat::command('close');
$closed++;
}
}
Xchat::set_context($context);
Xchat::print('Queries closed: ' . $closed);
}
################################################################################