I am not good with linking pointers, like upvar. Papillon is good, he might give you the working solution.
In my case you need to make one or two more procedures one to get the variable, the other to return the variable back to the main proc and then utilize it, which will be a bit longer.
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee) PS: Guys, I don't accept script helps or requests personally anymore.
==================================
The problem is that even though the bot (with the proper flags) can see the real host it may not be able to capture it via script. Opers usually have to manually copy the hostmask to add it to any ban. There's no problem if the offending user has his mode set -x.
Add [SOLVED] to the thread title if your issue has been. Search | FAQ | RTM
bind raw - 302 realhost
proc realhost { from key text } {
putlog "$text"
upvar #0 g_host g_host
set g_host [lindex [lrange [split $text "@"] 1 end] 0]
putlog "$g_host"
}
proc get:host { arg } {
global g_host
putserv "userhost $arg"
putlog "$g_host from get:host proc"
return $g_host
}
Looks like when it userhosts someone the var doesnt get set on time
so it always displayes the previous var... Its just what papillon suggested, but removed the vwait from there coz it makes bot not respond..
bind pubm - "* *" badword:pubm:check
bind raw - 302 realhost
proc badword:pubm:check { nick uhost handle chan arg } {
global BadwordWarn g_message g_host
set input " [bad:filter $arg] "
#Search through the list to see if the badword is present.
if { [file exists badword.txt] } {
set read [open badword.txt r]
while { ![eof $read] } {
gets $read line
set helpwanted [string range $line 0 [expr [string first # $line]-1]]
set g_message [string range $line [expr [string first # $line]+1] end]
if { [string match -nocase "* $helpwanted *" $input] && $helpwanted != "" } {
if {([info exists BadwordWarn($uhost)] == 1)} {
putserv "userhost $nick"
#gline part goes here, need the g_host to do that..
utimer 2 [list dummy]
vwait g_host
#and now you got he g_host....
unset BadwordWarn($uhost)
} else {
set BadwordWarn($uhost) 1
timer 60 "unset BadwordWarn($uhost)"
putserv "kill $nick $message"
}
}
}
close $read
}
}
proc realhost { from key arg } {
upvar #0 g_host g_host
set g_host [lindex [lrange [split $arg "@"] 1 end] 0]
}
proc dummy {} {
global g_host
set g_host $g_host
}
note: I don't have a eggdrop running atm, so I'm unable to test it
# if you're on a non RFC 1459 compliant network, remove this alias
# and replace the calls to it with 'string tolower' or whatever...
interp alias {} irc2lower {} string map {A a B b C c D d E e F f G g H h I i J j K k L l M m N n O o P p Q q R r S s T t U u V v W w X x Y y Z z \[ \{ \] \} \\ |}
proc userhostGline {nick why} {
upvar #0 gline_on_302 reason
# store the reason in a global array...
set reason([irc2lower $nick]) $why
# ...and let the other proc do the rest
putserv "USERHOST $nick"
}
bind raw - 302 userhostGline:raw
proc userhostGline:raw {server 302 arg} {
upvar #0 gline_on_302 reason
# trim off the unwanted "prefix" and check if the reply was empty
if {[scan $arg "%*s :%\[^\n\]" arg]} {
# support for several hosts in a single reply
foreach host [split $arg] {
# dig out the nick and @host parts...
scan $host {%[^*=]%*[^@]%s} nick host
set nick [irc2lower $nick]
# and gline if there's a reason :)
if {[info exists reason($nick)]} {
putserv "GLINE add *$host 3600s $reason($nick)"
unset reason($nick)
}
}
}
}
Just an other question, i tried bidding a same raw event to two diff procs.. And i think there was some sort of "conflict" is there anyway to fix that?
The raw bind is marked as "stackable", which means there should be no problem having several binds on the same keyword triggering different procs, BUT
If the proc returns 1, Eggdrop will not process the line any further (this could cause unexpected behavior in some cases).
(1 in this case means anything that will NOT be interpreted as a boolean "false" - my example should be fine as the empty value returned should be interpreted as "false")