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.

Confused (special character problem)

Old posts that have not been replied to for several years.
Locked
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Confused (special character problem)

Post by kain »

The code below adds peoples channel flags by public command,
but if someone has a special character in their nick
it doesn't always recognise them, I can't really see whats wrong
here, but maybe I've been looking at it for too long.

Code: Select all

proc adduserproc { nick address handle chan text } {
	global priv lbn hub home group private
	set ichan [string tolower $chan]
	set pri private($ichan)
	set type [string tolower [lindex $text 0]]
	set usernick [lindex $text 1]
	set user [nick2hand $usernick]
	if {[onchan $usernick $chan]} {
		if {[nick2hand [lindex $text 1]] == 0 } {
			puthelp "PRIVMSG $chan :$usernick is not on $chan. or I can't recognise that user."
			return 0
		}
		if {[validuser [nick2hand $user]] == 0 } {
			puthelp "PRIVMSG $chan :$usernick is not on $chan. or I can't recognise that user."
			return 0
		}
		if {[matchattr $user L] == 0 } {
			puthelp "PRIVMSG $chan :I know $usernick, but $usernick isn't authed."
			return 0
		}
	}
	if {![onchan $usernick $chan]} {
		set user $usernick
	}
### Channel
	if {$type == "owner" && [matchattr $handle m]} {
		chattr $user |+nmofgv $chan
		putserv "MODE $chan +v $usernick"
		puthelp "PRIVMSG $chan :$usernick is now a channel $type for $chan!"
		if {[info exists $pri] && [channel get $chan private]} {
		if {$private(${ichan}) != "" } {
		putserv "INVITE $usernick :$private(${ichan})"
	}}}
	if {$type == "master" && [matchattr $handle m|n $chan]} {
		chattr $user |+mofgv-n $chan
		putserv "MODE $chan +v $usernick"
		puthelp "PRIVMSG $chan :$usernick is now a channel $type for $chan!"
		if {[info exists $pri] && [channel get $chan private]} {
		if {$private(${ichan}) != "" } {
		putserv "INVITE $usernick :$private(${ichan})"
	}}}
	if {$type == "op"} {
		chattr $user |+ofgv-nm $chan
		putserv "MODE $chan +v $usernick"
		puthelp "PRIVMSG $chan :$usernick is now a channel $type for $chan!"
		if {[info exists $pri] && [channel get $chan private]} {
		if {$private(${ichan}) != "" } {
		putserv "INVITE $usernick :$private(${ichan})"
	}}}
	if {$type == "voice"} {
		chattr $user |+fv-nmo $chan
		putserv "MODE $chan +v $usernick "
		puthelp "PRIVMSG $chan :$usernick is now a channel $type for $chan!"
	}
The problem is probably in the top part of the code, rather than
where the flags are actually added and invites made.
moo
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Re: Confused (special character problem)

Post by arcane »

Code: Select all

set type [string tolower [lindex $text 0]]
set usernick [lindex $text 1]
you are using list commands on strings. use this instead:

Code: Select all

set type [string tolower [lindex [split $text] 0]]
set usernick [lindex [split $text] 1]
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

or even

Code: Select all

set text [split $text]
and voila, no need to change anything :)
Once the game is over, the king and the pawn go back in the same box.
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Post by kain »

Thanks for the response both, nice to see caesar is still spamming around :)
arcane I've tried what you said and it still spits out the same error
eg;
<kain> add op user-
<bot> user- is not on the channel or I can't recognise that user.
but if I;
<kain> add op user
<bot> user is now a channel op for #channel!
for example, the 'user-'s handle is 'user' but when trying it with a -
in the nick it doesn't work, but 'user'/handle does.
its also not sending out an invite unless the user drops the special
character from their nick, but the invite thing is something else altogether.
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

you'd have to change the [lindex $text] everywhere. but caesar's way is easier. just put a "set text [split $text]" at the beginning of your proc and all should be fine.
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Post by kain »

Just tried that, still comes back with the same problem though,
I also added the 'set text [split $text] bellow, and that didn't work either.

Code: Select all

proc pub:add { nick address handle chan text } {
	global lbn hub home priv
	set text [split $text]
	if {[matchattr $handle L]} {
		if {[ishub $chan] == 1 } {
			adduserproc $nick $address $handle $chan $text
		}
	}
}
Don't know if looking at that might help.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Then it might be the way he places the masks for the users. Do a whois on a user with a "special" char that is not working and see if it's added with nick also.
Once the game is over, the king and the pawn go back in the same box.
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Post by kain »

no, thats not it, just lists the nick as normal no extra characters,
this only happens when they lose their nick and add a - at the end
or something like that, if their handle had the - in it wouldnt be a problem
but i dont want to go round changing peoples handles every 5 minutes
or have to write something that will, just to acomodate this code.
apart from that i cant think :/
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I mean if he dose have an hostmask like Nick!*@*.something.org or something similar with Nick! in it? Where "Nick" is the actual nick of the person.
Once the game is over, the king and the pawn go back in the same box.
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Post by kain »

I've tried it myself, for example 'kain!kain@egghelp.org'
or even 'kain*!*kain@egghelp.org'
If I change my nick to 'kain-' rather than 'kain',
it gives me the same error, yet works on 'kain'
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

You do have the 'kain!kain@egghelp.org' host on IRC?
Once the game is over, the king and the pawn go back in the same box.
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Post by kain »

I used that as an example to show what my hosts look like,
except they are not egghelp.org, I use k@in,
so it would be 'kain!k@in' and 'kain*!*k@in'
Locked