61 |
|
|
62 |
# Checks $handle for $flags, $channel is optional. |
# Checks $handle for $flags, $channel is optional. |
63 |
proc ::tcldrop::users::arraydb::matchattr {handle flags {channel {}}} { |
proc ::tcldrop::users::arraydb::matchattr {handle flags {channel {}}} { |
64 |
if {![validuser $handle]} { |
switch -- $flags { |
65 |
return 0 |
{+|+} - {*|*} - {+} - {*} { |
66 |
} else { |
# * or + means anybody, return 1. |
67 |
switch -- $flags { |
return 1 |
68 |
{-} - {-|-} - {*} - {*|*} - {|} - {+} - {} { return 1 } |
} |
69 |
{default} { |
{default} { |
70 |
if {[::tcldrop::CheckFlags [lindex [split $flags {|}] 0] [getuser $handle flags]] == 1} { |
if {![validuser $handle]} { |
71 |
# Return 1 since we matched one of their global flags. |
return 0 |
72 |
return 1 |
} elseif {[::tcldrop::CheckFlags [lindex [split $flags {|}] 0] [getuser $handle flags]] == 1} { |
73 |
} elseif {$channel != {} && [::tcldrop::CheckFlags [lindex [split $flags {|}] end] [getuser $handle flags $channel]] == 1} { |
# Return 1 since we matched one of their global flags. |
74 |
# Return 1 since we matched one of their channel flags. |
return 1 |
75 |
return 1 |
} elseif {$channel != {} && [::tcldrop::CheckFlags [lindex [split $flags {|}] end] [getuser $handle flags $channel]] == 1} { |
76 |
} else { |
# Return 1 since we matched one of their channel flags. |
77 |
# Return 0 since there was no match. |
return 1 |
78 |
return 0 |
} else { |
79 |
} |
# Return 0 since there was no match. |
80 |
|
return 0 |
81 |
} |
} |
82 |
} |
} |
83 |
} |
} |