Skip to content

Instantly share code, notes, and snippets.

@atErik
Created November 29, 2014 08:02
Show Gist options
  • Save atErik/0cd717be1cc16b386ca3 to your computer and use it in GitHub Desktop.
Save atErik/0cd717be1cc16b386ca3 to your computer and use it in GitHub Desktop.
Close IRC PM Dialog/Window By Name - originally developped by culb (nightfrog)
#Author culb ( nightfrog )
#Description:
#Close a PM dialog by name
#
#Version: 1
# This paragraph of comment is added here by tErik.
# These codes were shared by user nightfrog, on Apr 29, 2014 around 23:18
# UTC-08:00, in #xchat irc channel at irc.freenode.net, with user tErik.
# This script was created because, because tErik has requested in #xchat irc
# channel, how to stop repeated direct PM sent by irc bot, like "gribble",
# which is very very annoying & its non-secured & its spying & data-collecting.
# These are done by bot's programmer/operator. The gribble bot sends direct PM
# immediately to each user who joins into certain irc channels, instead of
# sending message as a notice to appear inside user's "(notices)" window.
# Direct PM window/messages can reveal user's IP address, geo-location & other
# behavioral information & usage patterns. For grabbing attention, or, to send
# real warning message, user's name can be safely used in a notice-message,
# but repeated direct PM is ethically+morally not right, and done no-where else.
# If bot's programmer/developer actually wanted to really warn users, or
# really cared/concerned about user's real safety, then he/she would have warn
# about real & CURRENT harmful/criminal activity or person, sent as notice-msg
# with user's name in it, so users can see & save themselves from such harmful
# entity, but bot's programmer & its supporting group is actually NOT doing
# any such caring/warning. And those irc channels are dealing with such stuff
# and in such a level of crime, that those crime activities have even reached
# in US congress discussion, and ofcourse in FTC & Court. And not a warning
# on such, what a bunch of hypocrites!
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;
}
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