This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Vip Script Based on Hosts ?

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
p
paps
Voice
Posts: 5
Joined: Thu May 24, 2007 4:36 pm

Vip Script Based on Hosts ?

Post by paps »

Hello

I'm looking for a very simple script. It should voice anyone who joins a specified channel if their host matches one in a text file.

Google doesnt give me anything.

Thx in advance
x
xU
Voice
Posts: 7
Joined: Thu May 24, 2007 4:04 pm

Post by xU »

hi paps,

you can use script without read from file:

Code: Select all

## set(s) ##
############

## channels
set chanvoice "#xU #qadsia"


## host voice
ser hosts { 
"*@*.qualitynet.net"
"*xU@*.WeArab.Knights"
"*@qadsia.com"
}

## bind ##
##########

bind join - * proc:join

## proc ##
##########
proc proc:join { nick host hand chan } {
global chanvoice hosts
if {([isbotnick $nick]) || (![botisop $chan]) || (![lsearch -exact [string tolower $chanvoice] [string tolower $chan]] == "-1")} {return 0}
foreach hostv $hosts {
if {([string match -nocase "$hostv" $host])} {putquick "mode $chan +v $nick;break}
}
}
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Add these hosts to a specific handle and give it the +v flag. Set your channel to +autovoice and they'll be autovoiced on join.
p
paps
Voice
Posts: 5
Joined: Thu May 24, 2007 4:36 pm

Post by paps »

Thanks xU and Sir_Fz. It will help me a lot :D

And now what about a script that voices only people that are authed on Quakenet with a certain account ?
The bot should voice anyone that is authed (Q account) with one of the account-name listed on a text file or something...

Is this possible ? (My bot is on quakenet)

Thanks :]
x
xU
Voice
Posts: 7
Joined: Thu May 24, 2007 4:04 pm

Post by xU »

## set(s) ##
############

## channels
set chanvoice "#xU #qadsia"


## filename
set filehost "hosts.txl"

## bind ##
##########

bind join - * proc:join

## proc ##
##########
proc proc:join { nick host hand chan } {
global chanvoice txtfile
if {([isbotnick $nick]) || (![botisop $chan]) || (![lsearch -exact [string tolower $chanvoice] [string tolower $chan]] == "-1")} {return 0}
set ropen [open $filehost r]
foreach hostv $ropen {
if {([string match -nocase "$hostv" $host])} {putquick "mode $chan +v $nick;break}
}
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@xU:
What good would using a foreach-loop on a filehandle do?
Were'nt you thinking of actually reading the content of the file?
Also, you forget to close it afterwards, leaving uneccesary filehandles open...
Furthermore, your braces {} are unbalanced, and using lsearch on a plain string is not advisable (actually, in some rare conditions it's really bad).

edit:
Might aswell include a piece of code that is working:
Assumes one hostmask per line within the voice.txt file

Code: Select all

set voicefile "voice.txt"
setudef flag filevoice
bind join - * join:checkvoice
proc join:checkvoice {nick host hand chan} {
 if {[channel get $chan chanvoice] && ![isbotnick $nick] && [botisop $chan]} {
  set _t [split [read [set fid [open $::voicefile "RDONLY"]]] "\n"]
  close $fid
  foreach h $_t {
   if {[string match -nocase $h $host]} {
    pushmode $chan +v $nick
    return
   }
  }
 }
}
Last edited by nml375 on Fri May 25, 2007 12:29 pm, edited 1 time in total.
NML_375
p
paps
Voice
Posts: 5
Joined: Thu May 24, 2007 4:36 pm

Post by paps »

thx xU, but as far as i can see your script is based on hosts, right ? I'd like a script that voices based on the "Authed as Account-Name" (which appears on the /whois of Quakenet).
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@paps:
As I am not familiar with Quakenet, which respose-code would be used to indicate the Q auth from a whois reply?
NML_375
p
paps
Voice
Posts: 5
Joined: Thu May 24, 2007 4:36 pm

Post by paps »

Well, I dont think i really understand the question, but:

When you type /whois nick on quakenet you get something like this if the guy is authed :
nick is xxxx@xxxx.users.quakenet.org * Real Name
nick on +#channel #channel2 @#channel3
nick using port80b.se.quakenet.org Located at Port80, Sweden
nick is authed as xxxx
nick End of /WHOIS list.
When you do a /whois on someone that is not authed, this is what you get :
nick is ~xxxxx@xxx-xx-xxx-x-xxx.xxx.host.net * Real Name
nick on #channel
nick using *.quakenet.org QuakeNet IRC Server
nick End of /WHOIS list.
Is this enough to make a script work ?

thx
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

I'll try to explain my query alittle better then;
Each response-line from a whois-query (such as the examples you posted) is preceeded with a numeric responsecode (three digits). These are used to allow the client to know what kind of information the server is sending.

Taking the second example you posted, what is actually sent from the server is this:
311 nick ~xxxxx@xxx-xx-xxx-x-xxx.xxx.host.net * :Real Name
319 nick :#channel
312 nick *.quakenet.org :QuakeNet IRC Server
318 nick :End of /WHOIS list.
What we need is the number for the "nick is authed as xxxx" line. Unfortunately, this is not a "rfc 1459" message, but a QuakeNet feature (yes, some other networks use it aswell, I know...)

Also worth noting, implementing this would require your bot to send a whois-query whenever someone joins the channel. On highly trafficed channels this might cause some performace degradations.. just so you know.
NML_375
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

You can use a /who reply for this (raw 354 reply)

Code: Select all

set chanvoice(channel) "#channel"
set chanvoice(file) "chanvoice.txt"

proc chanvoice:join {nick host hand chan} {
  global chanvoice
  if {![string equal -nocase $chanvoice(channel) $chan]} { return }
  puthelp "WHO $nick n%a"
}

proc chanvoice:raw {from raw arg} {
  global chanvoice
  set nick [lindex [split $arg] 1]
  set auth [lindex [split $arg] 2]
  if {$auth == "" || $auth == "0"} { return }
  set data [read -nonewline [set file [open "$chanvoice(file)" r]]]
  close $file
  foreach x [split $data \n] {
    if {$x == ""} { return }
    if {[string equal -nocase $auth $x]} {
        pushmode $chanvoice(channel) +v $nick
        break
    }
  }
}
Not tested, but can be used as a basebone...
r0t3n @ #r0t3n @ Quakenet
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Interresting, I suppose this could be extended to create a database of auth'd nicks (and their accuntname) by extending the WHO-query to the speciffic channel when the bot joins.
Should also be trivial to modify the raw 354 "handler" to update a list of nick/auths-pairs to cache this information in order to further reduce traffic.

Might almost be worth writing a module..

Edit:
Just found this page that provided some nice information: http://www.mircscripts.org/showdoc.php? ... al&id=2412
Might be a good idea to tag the query in case any other scripts would use these extended /WHO-queries.
NML_375
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

the t option can be added.

A fixed version with the t paramater:

Code: Select all

set chanvoice(channel) "#channel"
set chanvoice(file) "chanvoice.txt"

proc chanvoice:join {nick host hand chan} {
  global chanvoice
  if {![string equal -nocase $chanvoice(channel) $chan]} { return }
  puthelp "WHO $nick n%at,88"
}

proc chanvoice:raw {from raw arg} {
  global chanvoice
  set tag [lindex [split $arg] 1]
  if {$tag != "88"} { return }
  set nick [lindex [split $arg] 2]
  set auth [lindex [split $arg] 2#3]
  if {$auth == "" || $auth == "0"} { return }
  set data [read -nonewline [set file [open "$chanvoice(file)" r]]]
  close $file
  foreach x [split $data \n] {
    if {$x == ""} { return }
    if {[string equal -nocase $auth $x]} {
        pushmode $chanvoice(channel) +v $nick
        break
    }
  }
}
The tag in this example is 88.
r0t3n @ #r0t3n @ Quakenet
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

You'd still need some bindings I suppose... and [lindex ... 2#3] ? :p
NML_375
p
paps
Voice
Posts: 5
Joined: Thu May 24, 2007 4:36 pm

Post by paps »

So, what would be the bindings ?

I dont understand anything in TCL :(
Post Reply