rendered paste bodyproc 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),$table(nuke_reason) 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 reason} $checkdupe {
if {$fil == "NULL" || $fil == "" || $fil == "0"} {
set fil "-"
}
if {$meg == "NULL" || $meg == "" || $meg == "0" || $meg == "0.0"} {
set meg "-"
}
if {$genre == "NULL" || $genre == ""} {
set genre "-"
}
if {$reason == "NULL" || $reason == "" || $reason == "0"} {
set reason "-"
}
set thetime [unixtime]
set tim_ago [no:dupe:ago $thetime $tim]
set tim_day [no:dupe:day $tim]
putquick "PRIVMSG $chan :!addold $rls $sec $tim $fil $meg $genre $reason"
}
catch {mysqlclose $mysql(conn)}
catch {mysqlclose}
}
}