Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@atErik
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atErik/bf63edbbb2656f562dd5 to your computer and use it in GitHub Desktop.
Save atErik/bf63edbbb2656f562dd5 to your computer and use it in GitHub Desktop.
Close IRC PM Dialog/Window By Name, perl script 02 - originally developped by culb (nightfrog)
#Author culb ( nightfrog )
#Description:
#Close a PM dialog by name
#
#Version: 1
# This paragraph (with 4 lines) of comments are added here by tErik.
# These codes were shared by user nightfrog, on Apr 29, 2014 around 23:45
# UTC-08:00, in #xchat irc channel at irc.freenode.net, with user tErik.
# Actually it is now version 1.01
use strict;
use warnings;
use Xchat qw(:all);
hook_command( 'CLOSEPM',
sub{
# Don't be greedy
if ( $_[0][2] ){
prnt "One NICK at a time. /closepm NICK";
return EAT_XCHAT;
}
if ( not $_[0][1] ){
prnt "Need a NICK. /closepm NICK";
return EAT_XCHAT;
}
my $person = $_[0][1];
my $context = get_info 'context';
for my $var ( get_list( 'channels' ) ) {
# Be safe. Only Dialogs
if ( $var->{ type } == 3 and lc $var->{channel} eq lc $person ){
command 'CLOSE', $var->{ channel }, $var->{ network };
}
}
set_context $context;
return EAT_XCHAT;
}
);
register( 'Close Dialog', 1, 'Close a dialog by name' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment