Mercurial > hg > egg-tcls
changeset 633:bc87660aa400
tj: Add max items as configurable setting.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 16 Feb 2021 12:26:40 +0200 |
parents | 68b8cf87e86e |
children | fd1c56676648 |
files | config.tj.example tj.tcl |
diffstat | 2 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/config.tj.example Mon Feb 15 13:42:42 2021 +0200 +++ b/config.tj.example Tue Feb 16 12:26:40 2021 +0200 @@ -36,6 +36,9 @@ set tj_db_file "tj.sqlite" +set tj_max_items 5 + + # Default time (hh:mm) when not specified set tj_default_time "12:00"
--- a/tj.tcl Mon Feb 15 13:42:42 2021 +0200 +++ b/tj.tcl Tue Feb 16 12:26:40 2021 +0200 @@ -207,7 +207,7 @@ # ------------------------------------------------------------------------ proc tj_cmd {unick $uhost uhand uchan uargs upublic} { - global tj_messages tj_default_id tj_default_time tj_default_desc + global tj_messages tj_default_id tj_default_time tj_default_desc tj_max_items # Check if we have a valid user if {![utl_valid_user $uhand]} { @@ -344,8 +344,8 @@ } # Check for maximum reminders - if {$nitems > 5} { - tj_msg $upublic $unick $uchan "err_too_many" [list $nitems] + if {$nitems >= $tj_max_items} { + tj_msg $upublic $unick $uchan "err_too_many" [list $nitems $tj_max_items] return 1 }