There is no problem if i do this:
Code: Select all
set rs [mysqlsel $sql "SELECT command, private FROM commands " -flatlist]
# f.e. rs = "first 1 second 1 third 1"
# my commands starts with a dot
# priv is a switch (0 = channel only, 1 = both, 2 = private only)
foreach {cmd priv} $rs {
if {$priv != 2} {
bind pub - ".$cmd" $cmd
} elseif {$priv != 0} {
bind msg - ".$cmd" priv:$cmd
}
}
proc first {nick uhost hand chan text} {
if {$text == ""} {
putlog "first"
} else {
putlog "first, text = $text"
}
}
proc second {nick uhost hand chan text} {
if {$text == ""} {
putlog "second"
} else {
putlog "second, text = $text"
}
}
proc third {nick uhost hand chan text} {
if {$text == ""} {
putlog "third"
} else {
putlog "third, text = $text"
}
}
proc priv:first {nick uhost hand text} {
if {$text == ""} {
putlog "first"
} else {
putlog "first, text = $text"
}
}
proc priv:second {nick uhost hand text} {
if {$text == ""} {
putlog "second"
} else {
putlog "second, text = $text"
}
}
proc priv:third {nick uhost hand text} {
if {$text == ""} {
putlog "third"
} else {
putlog "third, text = $text"
}
}
And i want to make it work:
Code: Select all
foreach {cmd priv} $rs {
if {$priv != 2} {
bind pub - ".$cmd" {$cmd $_pub1 $_pub2 $_pub3 $_pub4 $_pub5; #}
} elseif {$priv != 0} {
bind msg - ".$cmd" {$cmd $_msg1 $_msg2 $_msg3 "" $_msg4; #}
}
}
proc first {nick uhost hand chan text} {
if {$text == ""} {
putlog "first"
} else {
putlog "first, text = $text"
}
}
proc second {nick uhost hand chan text} {
if {$text == ""} {
putlog "second"
} else {
putlog "second, text = $text"
}
}
proc third {nick uhost hand chan text} {
if {$text == ""} {
putlog "third"
} else {
putlog "third, text = $text"
}
}
I think, there is something wrong with my syntax.