comparison tj.tcl @ 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
comparison
equal deleted inserted replaced
632:68b8cf87e86e 633:bc87660aa400
205 } 205 }
206 206
207 207
208 # ------------------------------------------------------------------------ 208 # ------------------------------------------------------------------------
209 proc tj_cmd {unick $uhost uhand uchan uargs upublic} { 209 proc tj_cmd {unick $uhost uhand uchan uargs upublic} {
210 global tj_messages tj_default_id tj_default_time tj_default_desc 210 global tj_messages tj_default_id tj_default_time tj_default_desc tj_max_items
211 211
212 # Check if we have a valid user 212 # Check if we have a valid user
213 if {![utl_valid_user $uhand]} { 213 if {![utl_valid_user $uhand]} {
214 tj_msg $upublic $unick $uchan "err_invalid_user" [list $uhand] 214 tj_msg $upublic $unick $uchan "err_invalid_user" [list $uhand]
215 return 1 215 return 1
342 tj_log "$uerrmsg on SQL:\n$usql" 342 tj_log "$uerrmsg on SQL:\n$usql"
343 return 1 343 return 1
344 } 344 }
345 345
346 # Check for maximum reminders 346 # Check for maximum reminders
347 if {$nitems > 5} { 347 if {$nitems >= $tj_max_items} {
348 tj_msg $upublic $unick $uchan "err_too_many" [list $nitems] 348 tj_msg $upublic $unick $uchan "err_too_many" [list $nitems $tj_max_items]
349 return 1 349 return 1
350 } 350 }
351 351
352 set ucreated [utl_sql_stamp_to_datetime [clock seconds]] 352 set ucreated [utl_sql_stamp_to_datetime [clock seconds]]
353 if {$umode} { 353 if {$umode} {