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.

2 quick questions

Old posts that have not been replied to for several years.
Locked
n
nso
Voice
Posts: 19
Joined: Fri Apr 25, 2003 4:45 pm

2 quick questions

Post by nso »

Hi.

Im currently working on a tcl-script and have fond some weird "bugs" I haven't been able to figure out what is.

1:
I get the nick of the last erson whom joined with $nick in an JOIN bind.
I set a global variable to that nick, and then when I call the global variable in another proc and process it.. it seems like it won't kick people with special chars in their name.. I do no editing/checking other then comparing the whois on the user with a predefined pattern..
Any idea why this might be so?
Actually it seems like the only characters this apply to are \ .. atleast in my testing

2:
When using these two lines
set rsbanhost [maskhost [getchanhost $rsnick $rschan]]
newban $rsbanhost AutoBan $rsbanreason 5 none
it did this
[08:48:34] * Joins: Kakarotto (~Kakarotto@ti400720a080-2656.bb.online.no)
[08:48:38] * skansen sets mode: +b *!Kakarotto@*.bb.online.no
[08:48:40] * Kakarotto was kicked by defacto (banned)
[08:48:52] * Joins: Kakarotto (~Kakarotto@ti400720a080-2656.bb.online.no)
it doesnt seem to catch the ~..
any quick n dirty solution to this one? :)
Last edited by nso on Mon Jun 16, 2003 3:44 am, edited 1 time in total.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

try this:

Code: Select all

set rsbanhost "*!*@[lindex [split [getchanhost $rsnick $rschan] @] 1]"
Once the game is over, the king and the pawn go back in the same box.
n
nso
Voice
Posts: 19
Joined: Fri Apr 25, 2003 4:45 pm

Post by nso »

i dont think it would be wise to ban hosts..
but thanks anyway :)
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

# Set this to 1 if you don't want your the bot to strip a leading '~'
# on user@hosts.
set strict-host 1
^^from the config-file
as for question 1... we need to see the parts of your code where you are handling that variable..
Elen sila lúmenn' omentielvo
n
nso
Voice
Posts: 19
Joined: Fri Apr 25, 2003 4:45 pm

Post by nso »

Code: Select all

set rschan "#bla"
set rsserver "bla bla"
set rskickreason "bla"
set rsmsgonkick "\[blabla\] bla"
set rsbanreason "bla"
set rsmsgonban "\[blabla\]  bla"

bind JOIN - * rsjoin
bind RAW * 312 rswhois

set rsnick ""
set rslastnick ""

proc rsjoin { nick uhost hand chan } {
global rschan rsnick
	if { $chan != $rschan } { return 0 }
	putserv "WHOIS $nick"
	set rsnick "$nick"
}

proc rswhois { from key arg } {
global rsnick rschan rsserver rskickreason rslastnick rsmsgonkick rsmsgonban rsbanreason
	set isonserver [lindex $arg 2]
	set isonserver [string tolower $isonserver]
	for { set rscounter 0 } { $rscounter < [llength $rsserver] } { incr rscounter } {
                if {$isonserver == [lindex $rsserver $rscounter]} {
			if { $rsnick == $rslastnick } {
				set rsbanhost [maskhost [getchanhost $rsnick $rschan]]
				newban $rsbanhost AutoBan_ServerKick $rsbanreason 5 none		
				putserv "KICK $rschan $rsnick :$rsbanreason"
				putserv "PRIVMSG $rsnick :$rsmsgonban"
				set rslastnick ""
			} else {
				putserv "KICK $rschan $rsnick :$rskickreason"
				set rslastnick $rsnick
				putserv "PRIVMSG $rsnick :$rsmsgonkick"
		}
	        }
	}
}
edited.. forgot some stuff on the top

it's public anyhoo, dunno why i didn't just paste it in the first post :p
Last edited by nso on Mon Jun 16, 2003 4:07 am, edited 2 times in total.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Oups, yah, setting strict-host to 1 will do fine with your ban mask.
Once the game is over, the king and the pawn go back in the same box.
n
nso
Voice
Posts: 19
Joined: Fri Apr 25, 2003 4:45 pm

Post by nso »

goodie :)
i thought it was kindoff funny since i didn't manage to reproduce the error on my own testeggie ^^
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

try using

Code: Select all

putkick $rschan $rsnick "$rsbanreason"
for kicking
.. and change

Code: Select all

if { $rsnick == $rslastnick } {
to

Code: Select all

if { [string equal $rsnick $rslastnick] } {
Elen sila lúmenn' omentielvo
n
nso
Voice
Posts: 19
Joined: Fri Apr 25, 2003 4:45 pm

Post by nso »

thanks for the assistance.. will try it out :)
n
nso
Voice
Posts: 19
Joined: Fri Apr 25, 2003 4:45 pm

Post by nso »

hi.

it wont work tho.. it still denies to do anything when someone with a \ in their nick joins the channel..
any other suggestions? i really dont understand why :p

[edit]

did some testing now..
entered a putserv "privmsg $rschan :$isonserver" below set isonserver in the second proc.. and what it returned when someone, with a nick using \ at the end, was this

Code: Select all

<test2k> :who
when infact it should return the irc-channel

im guessing that the \ in the nick disables something.. how do i go around this?
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

well.... raw 312 will not give you any channels, just serverinfo :)
and use split before you use list commands on variables, ie.. [lindex [split $arg] 2] ..... same goes with $rsserver, and make sure you have "" around $rsbanreason, or it will give an error if you have more than 1 word in it
Elen sila lúmenn' omentielvo
Locked