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.

Var probs..

Old posts that have not been replied to for several years.
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Then simply have the bot "operup", use the proper command to retrieve the real host and proceed from there.

An IRCD being based on Bahamut does not mean that the original has user hostmasking. Oper hostmasking is all Bahamut allows.

It would possibly have helped if you had mentioned in your original post that the bot was able to "operup". :P
Last edited by Alchera on Sat Aug 14, 2004 7:48 am, edited 1 time in total.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

That's what i'm tryin to do :-?

The prob is just that i can get a var at the right place to gline... nothin more :mrgreen:
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

I am not good with linking pointers, like upvar. Papillon is good, he might give you the working solution. :wink:

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. :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

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
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

The prob is i dont know how to get a var "global" that's all... no ircd things, user modes and all :)

Well n/m
i got a small prob,

Code: Select all

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..
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

*sigh :-?
I can never seem to get the vwait function to work correctly in eggdrop-scripts :(
try this, it'll be my last test with eggdrop/vwait :)

Code: Select all

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 ;)
Elen sila lúmenn' omentielvo
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

thx for tryin :)
tryed to execute the script but still vwait causing trouble.. bot just freezes.. :(
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

Isnt there any other way of doin this? coz i'd really like to get that script working..
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

ooook i got it to work :mrgreen:

Finally!

Code: Select all

bind raw - 302 raw:realhost

proc raw:realhost { from key text } {

	upvar #0 g_host g_host

	set g_host [lindex [lrange [split $text "@"] 1 end] 0] 

	putlog "$g_host from realhost"
}


proc user:host {bnick breason} {

	putserv "userhost $bnick"

	utimer 2 [list userhost:gline $breason] 


}

proc userhost:gline {breason} { 

	global g_host 

	set g_host $g_host 	

	putserv "gline add *@$g_host 3600s $breason"

	putlog "$g_host $breason from gline"


} 
thx for helpin ppl. :)
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

why don't you just put that gline code straight in the raw:realhost proc and get rid of the timer?
Have you ever read "The Manual"?
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

Because it need to give it the gline reason var which is $breason..

Ready to try if there's better way doin these things. :)

Hmm.. just noticed, it still doesnt give me the right host time to time... like when i restart it..
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

How about this?

Post by user »

What's keeping you from storing the reason in a global variable instead of the host? :)

Code: Select all

# 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)
			}
		}
	}
}
...not tested - as usual :wink:
Have you ever read "The Manual"?
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

Thx user that works too, works even better :D

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?

thx again for your help :wink:
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

tcl-commands.doc is your friend

Post by user »

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")
Have you ever read "The Manual"?
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

if it is for the bots its own ip use look at this code its in there somewhere http://cvs.ofloo.net/ip-to-country/ip-t ... markuplook below in old script support section
XplaiN but think of me as stupid
Locked