63 |
|
|
64 |
# Checks $handle for $flags, $channel is optional. |
# Checks $handle for $flags, $channel is optional. |
65 |
proc ::tcldrop::users::matchattr {handle flags {channel {}}} { |
proc ::tcldrop::users::matchattr {handle flags {channel {}}} { |
66 |
switch -- $flags { |
if {![validuser $handle]} { |
67 |
{-} - {-|-} - {*} - {*|*} - {|} - {+} - {} { return 1 } |
# Return 0 since the user is unknown to the bot. |
68 |
{default} { |
return 0 |
69 |
if {![validuser $handle]} { |
} else { |
70 |
# Return 0 since the user is unknown to the bot |
switch -- $flags { |
71 |
return |
{-} - {-|-} - {*} - {*|*} - {|} - {+} - {} { return 1 } |
72 |
} elseif {[::tcldrop::CheckFlags [lindex [split $flags {|}] 0] [getuser $handle flags]] == 1} { |
{default} { |
73 |
# Return 1 since we matched one of their global flags. |
if {[::tcldrop::CheckFlags [lindex [split $flags {|}] 0] [getuser $handle flags]] == 1} { |
74 |
return 1 |
# Return 1 since we matched one of their global flags. |
75 |
} elseif {$channel != {} && [::tcldrop::CheckFlags [lindex [split $flags {|}] end] [getuser $handle flags $channel]] == 1} { |
return 1 |
76 |
# Return 1 since we matched one of their channel flags. |
} elseif {$channel != {} && [::tcldrop::CheckFlags [lindex [split $flags {|}] end] [getuser $handle flags $channel]] == 1} { |
77 |
return 1 |
# Return 1 since we matched one of their channel flags. |
78 |
} else { |
return 1 |
79 |
|
} else { |
80 |
# Return 0 since there was no match. |
# Return 0 since there was no match. |
81 |
return 0 |
return 0 |
82 |
|
} |
83 |
} |
} |
84 |
} |
} |
85 |
} |
} |
336 |
if {![info exists retval]} { set retval $val } |
if {![info exists retval]} { set retval $val } |
337 |
} |
} |
338 |
} |
} |
339 |
# Return the $retval, or return 0 which means we didn't call any binds (failure). |
# Return the $retval, or return 0 which indicates a failure. |
340 |
if {[info exists retval]} { set retval } else { set retval 0 } |
if {[info exists retval]} { set retval } else { set retval 0 } |
341 |
} |
} |
342 |
|
|