############## ### getold ### ############## proc no:pre:chk {nick uhost handle chan arg} { global mysql table mychan limit error set count $arg if { $count == "" } { set count $nolimit(dupe) } set rls [string map [list "\{" "%" "\}" "%" "\[\[:cntrl:\]\]" "%" "\\" "%" "'" "%" "*" "%" " " "%"] $arg] if { $rls == "" } { set rls "%"} set mysql(conn) [mysqlconnect -host $mysql(hst) -port $mysql(prt) -user $mysql(usr) -password $mysql(pwd) -db $mysql(db)] set checkdupe [mysqlsel $mysql(conn) "SELECT $table(id),$table(tim),$table(sec),$table(rls),$table(fil),$table(meg),$table(genre) FROM $mysql(table) WHERE $table(rls) LIKE '%$rls%' ORDER BY $table(tim) DESC LIMIT $limit(pre)" -flatlist] set table_db_id [lindex $checkdupe 0] if {$table_db_id != ""} { foreach {id tim sec rls fil meg genre} $checkdupe { set thetime [unixtime] set tim_ago [no:dupe:ago $thetime $tim] set tim_day [no:dupe:day $tim] if { $fil == "0" } { putquick "PRIVMSG $chan :!addold $rls $sec [unixtime]" } } else { set ffil ""; append ffil $fil "" set mmeg ""; append mmeg $meg "" putquick "PRIVMSG $chan :!addold $rls $sec [unixtime] $ffil $mmeg" } } catch {mysqlclose $mysql(conn)} catch {mysqlclose} }