queryblocker

Discussion about Perl, TCL or Python scripts and C/C++ plugins (using and writing them).

queryblocker

Postby Anja » 06 Jun 2006 13:01

hi,

i search for a queryblocker like this methode:

- someone wants to make a query with me
he get:

"hi, if you want to talk with me, you have to write "/msg Anja password" and then you can pass the query"

i get:

(/queryblocker) <- tab
"XYZ wants a Query with you"

the person write the password and than i get the query


its only a good way to block the messages like

"hi, you need porn webcam link ? here: www.pornwebcamforyouXYZ.com"

because these bots can understand that password way


hope someone can help me :(
Anja
 
Posts: 10
Joined: 06 Jun 2006 12:56

Postby Anja » 08 Jun 2006 07:22

please, i need a queryblocker like this :(
Anja
 
Posts: 10
Joined: 06 Jun 2006 12:56

Postby jlh » 08 Jun 2006 20:34

Don't know of any such script. Did you look through the list of scripts and plugins? There are quite a few that are for query management, and there might be something there that could do the job too.

Otherwise, hire someone to write such a script for you. (Some people might accept beer or candy as payment. :))
jlh
 
Posts: 248
Joined: 14 Jul 2004 19:38
Location: Switzerland

Postby Anja » 13 Jun 2006 16:29

Code: Select all
#!/usr/bin/perl

##### 'PassBlock' script developed by the-me on irc.quakenet.org ( #Linux-Dev ) Version 1.3
##### This program is free software; you can redistribute it and/or modify
##### it under the terms of the GNU General Public License as published by
##### the Free Software Foundation; either version 2 of the License, or
##### (at your option) any later version.
##### This program is distributed in the hope that it will be useful,
##### but WITHOUT ANY WARRANTY; without even the implied warranty of
##### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
##### GNU General Public License for more details.
##### You should have received a copy of the GNU General Public License
##### along with this program; if not, write to the Free Software
##### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

### Xchat registers and hooks.

Xchat::register("irc.quakenet.org:6667 #Linux-Dev QueryBlock Script for XChat", "1.3", "This is the /qblock Perlscript for XChat", "");
Xchat::print"» Loaded modified QueryBlock Version 1.3 successful from 'the-me' on irc.quakenet.org @ #Linux-Dev - Try /qblock_help «";
Xchat::hook_print("Private Message to Dialog", "qblock_handler");
Xchat::hook_command("qblock", "qblock_help");
Xchat::hook_command("qblock_pub", "qblock_pub");
Xchat::hook_command("qblock_list", "qblock_list");
Xchat::hook_command("qblock_add", "qblock_add");
Xchat::hook_command("qblock_del", "qblock_del");
Xchat::hook_command("qoff", "qoff");
Xchat::hook_command("qon", "qon");

### Variable sets and configload.

use warnings;
use strict;

### Message, that the user will recieve in the nonsilentmode, if he msg you and he's not on the whitelist.
my $denymessage = "» Your query has been auto blocked. You have to type the password - keks «";
### 0 = QueryBlock deactivated. 1 = QueryBlock activated.
my $qblock = "on";
### 0 = Silent deactivated. 1 = Silentmode activated. - If the silentmode is on, you and the other user will not informed about the blocked query.
my $silent = "off";

### Don't change this!
my $xdir = Xchat::get_info("xchatdir");
my $conf = "$xdir/qblock.conf";
my $userinfo = Xchat::user_info();
my $me = $userinfo->{nick};
my @whitelist;
qblock_read_conf();

### This will push $me and some famous bouncerproxys to the whitelist.

if(&qblock_check($me) == -1){
push(@whitelist,$me);
}
if(&qblock_check(-sBNC) == -1){
push(@whitelist,-sBNC);
}
if(&qblock_check(-psyBNC) == -1){
push(@whitelist,-psyBNC);
}

qblock_save_conf();

### This reads out all nicks from the config to @whitelist.

sub qblock_read_conf {
if(-e "$conf"){
open(CONF, "<$conf");
while (<CONF>){
chomp;
push(@whitelist, $_);
}
close CONF;
} else {
open(CONFC, ">$conf");
close(CONFC);
qblock_read_conf();
}
}

### Routine to save all entrys from @whitelist to the config.

sub qblock_save_conf {
open(CONF, ">$conf");
if( -f CONF){
foreach (@whitelist){
print CONF $_."\n";
}
close CONF;
}
}

### A checker, if $nick is in the @whitelist.

sub qblock_check {
my $nick = join(" ", @_ );
my $schleife = 0;
foreach (@whitelist){
if (uc($_) eq uc($nick)){
return $schleife;
}
$schleife++;
}
return -1;
}

### The heart of QueryBlock, the PRIVMSG_handler.

sub qblock_handler {
if($qblock ne "off"){
my $qbltvar;
my $qblquery = $_[0][0];
my $message = $_[0][1];
my $oldcontext = Xchat::get_context();
if($message eq "keks"){
push(@whitelist,$qblquery);
}
Xchat::set_context("$oldcontext");
foreach $qbltvar (@whitelist){
if(uc("$qbltvar") eq uc("$qblquery")){
return 0;
}
}
Xchat::set_context("$qblquery");
Xchat::command("close");
Xchat::set_context("$oldcontext");
if($silent ne "on"){
Xchat::hook_timer(1000, "qblock_timer_handler", {data => [$qblquery]});
}
return 1;
} else {
return 0;
}
}

### Timer handler for the qblock_main_handler

sub qblock_timer_handler {
my $nick = $_[0][0];
Xchat::command("PRIVMSG $nick :$denymessage");
return Xchat::REMOVE;
}

### Routine to add a nick to the whitelist.

sub qblock_add {
my $addnick = $_[0][1];
unless($addnick){
Xchat::print"» You must enter a nickname to add. Example: /qblock_add nickname. «";
return 1;
} else {
my $qbltemp = &qblock_check($addnick);
if($qbltemp == -1){
push(@whitelist,$addnick);
Xchat::print"» I added the nickname $addnick to the whitelist. «";
qblock_save_conf();
return 1;
} else {
Xchat::print"» $addnick is already on the whitelist. I won't add $addnick again! «";
return 1;
}
}
}

### Routine to del a host from the whitelist.

sub qblock_del {
my $delnick = $_[0][1];
unless($delnick){
Xchat::print"» You must enter a nickname to delete. Example: /qblock_del nickname. «";
return 1;
} else {
my $qbltemp = &qblock_check($delnick);
if($qbltemp == -1){
Xchat::print"» I can't delete the user $delnick from the whitelist, because he isn't on the whitelist! Have a look at /qblock_list. «";
return 1;
} else {
@whitelist = grep{$_ ne "$delnick"} @whitelist;
Xchat::print"» I have removed $delnick from the whitelist. Now all querys from $delnick will be blocked. «";
qblock_save_conf();
}
return 1;
}
return 1;
}

### This routine lists all entrys at the whitelist.

sub qblock_list {
open(WLLIST, "<$conf");
Xchat::print"» All nicks, that are on the whitelist: «";
Xchat::print"$_" while <WLLIST>;
close(WLLIST);
}

### Little advertise routine.

sub qblock_pub {
Xchat::command("say » QueryBlock 1.3 for XChat2 is available at http://www.Linux-Development.org «");
}

sub qon {
$qblock = "on";
Xchat::print"It's now on.";
}

sub qoff {
$qblock = "off";
Xchat::print"It's now off.";
}

#####
##### That was it!!!
#####


thanks to the-me !
Anja
 
Posts: 10
Joined: 06 Jun 2006 12:56

Postby Anja » 22 Jun 2006 16:46

it works fine, but only the problem with multiconnects in one network...

the script dont know who has get the query and takes the active network :/

has someone an idea ?! the problem is the servertab name... in quakenet they are always the same and the script dont know the right network :(
Anja
 
Posts: 10
Joined: 06 Jun 2006 12:56


Return to Scripts and Plugins

Who is online

Users browsing this forum: Google [Bot] and 1 guest