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.

matchattr problem...

Old posts that have not been replied to for several years.
Locked
J
Jiuy

matchattr problem...

Post by Jiuy »

ok...i have problem to match channel name...
if my channel are config like this #TestChannel and $chan variable are #testchannel....then channel doesn't match, right? so are there any way to solve this?

there is my code....

Code: Select all

bind pub - !testing pub:testing

proc pub:testing { nick host hand chan arg } {
    if {[matchattr $nick m $chan]} {
        ...some code...
    }
}
ps. sorry bad english :/
User avatar
Rusher2K
Halfop
Posts: 88
Joined: Fri Apr 18, 2003 10:45 am
Location: Germany
Contact:

Post by Rusher2K »

I think:

Code: Select all

bind pub - !testing pub:testing 

proc pub:testing { nick host handle chan arg } { 
    if {[matchattr $handle m $chan]} { 
        ...some code... 
    } 
} 
J
Jiuy

Post by Jiuy »

ouh...mistake in example code...
that's not solution for my problem :(
User avatar
caesar
Mint Rubber
Posts: 3777
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Use "string match -nocase" then, consult the manual here or do a forum search.
Once the game is over, the king and the pawn go back in the same box.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

and maybe add this

Code: Select all

{[matchattr $handle m $chan] == 1}
could be mestaking
XplaiN but think of me as stupid
User avatar
CrazyCat
Revered One
Posts: 1279
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: matchattr problem...

Post by CrazyCat »

Jiuy wrote:ok...i have problem to match channel name...
if my channel are config like this #TestChannel and $chan variable are #testchannel....then channel doesn't match, right? so are there any way to solve this?

Code: Select all

bind pub - !testing pub:testing

proc pub:testing { nick host hand chan arg } {
    set channel [string lower $chan]
    if {[matchattr $nick m $channel]} {
        ...some code...
    }
}
another security is:

Code: Select all

if {[matchattr $nick -|m $channel]} {
User avatar
caesar
Mint Rubber
Posts: 3777
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

For matching #TestChannel with #testchannel use the string match and for matching flags to a certain user use:

Code: Select all

if {[matchattr $hand -|m $channel]} {
if the person who trigers the proc is the person who should be checked for the specified flag(s) and else:

Code: Select all

if {[matchattr [nick2hand $nick] -|m $channel]} {
when the person who triggers the proc is not the person who should be checked for the flags but a certain defined user from the channel.
Once the game is over, the king and the pawn go back in the same box.
Locked