Created
November 29, 2014 08:59
-
-
Save atErik/db271c56e9c7fecde462 to your computer and use it in GitHub Desktop.
Close IRC PM Dialog/Window By Sender's Name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description : Close a IRC PM Dialog Window By Using Sender's Name. | |
# A Perl script, to use with XChat based IRC client software. | |
# | |
# Original Script Author : culb ( nightfrog ) | |
# First version developed on : 2014-04-29, around 23:18 UTC-08:00. | |
# Modified by : tErik. | |
# Last Modified on : 2014-07-28, around 23:35 UTC-08:00 | |
# | |
# Usage: | |
# For example, an annoying irc-bot "gribble" is repeatedly sending you | |
# direct PM messages: | |
# To close that PM window, type: /closepm gribble | |
# | |
# In XChat, in IRC network connection-time script file, codes such as below | |
# can be added to auto close PM dialog window: | |
# TIMER 30 JOIN #bitcoin | |
# TIMER 40 CLOSEPM gribble | |
# | |
# | |
# For using perl scripts, such as this, you will need perl software in host | |
# system/computer, and you will also need to install HexChat's/XChat's perl | |
# interface interpreter file. | |
# | |
# | |
# | |
# | |
# History: | |
# Original codes were 1st 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 & collecting | |
# data. These are done by bot's programmer/operator, and supporting gang or | |
# group. 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 NICKname at a time. Command: /closepm NickNameOfPMsender"; | |
return EAT_XCHAT; | |
} | |
if ( not $_[0][1] ){ | |
prnt "Need a NICKname. Command: /closepm NickNameOfPMsender"; | |
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 (PM) dialog window by sender\'s name. Command: /CLOSEPM NickNameOfPMsender' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment