Mercurial > hg > egg-tcls
comparison urllog.tcl @ 422:880a07485275
Add utl_ctime() to utillib and use it elsewhere.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 08 Jan 2017 03:52:15 +0200 |
parents | 9dd4d2e3a4ac |
children | 825cac46b1cb |
comparison
equal
deleted
inserted
replaced
421:0f7524550aa2 | 422:880a07485275 |
---|---|
101 global urllog_log_enable urllog_name | 101 global urllog_log_enable urllog_name |
102 | 102 |
103 if {$urllog_log_enable != 0} { | 103 if {$urllog_log_enable != 0} { |
104 putlog "$urllog_name: $arg" | 104 putlog "$urllog_name: $arg" |
105 } | 105 } |
106 } | |
107 | |
108 | |
109 proc urllog_ctime {utime} { | |
110 if {$utime == "" || $utime == "*"} { | |
111 set utime 0 | |
112 } | |
113 return [clock format $utime -format "%d.%m.%Y %H:%M"] | |
114 } | 106 } |
115 | 107 |
116 | 108 |
117 proc urllog_isnumber {uarg} { | 109 proc urllog_isnumber {uarg} { |
118 foreach i [split $uarg {}] { | 110 foreach i [split $uarg {}] { |
190 if {$urllog_shorturl != 0} { | 182 if {$urllog_shorturl != 0} { |
191 set qstr "[urllog_get_short $uid] " | 183 set qstr "[urllog_get_short $uid] " |
192 } else { | 184 } else { |
193 set qstr "" | 185 set qstr "" |
194 } | 186 } |
195 append qstr "($uuser/$uchan@[urllog_ctime $utime])" | 187 append qstr "($uuser/$uchan@[utl_ctime $utime])" |
196 if {[string length $utitle] > 0} { | 188 if {[string length $utitle] > 0} { |
197 set qstr "$urlmsg_alreadyknown - '$utitle' $qstr" | 189 set qstr "$urlmsg_alreadyknown - '$utitle' $qstr" |
198 } else { | 190 } else { |
199 set qstr "$urlmsg_alreadyknown $qstr" | 191 set qstr "$urlmsg_alreadyknown $qstr" |
200 } | 192 } |
614 incr iresults | 606 incr iresults |
615 set shortURL $uurl | 607 set shortURL $uurl |
616 if {$urllog_shorturl != 0 && $uid != ""} { | 608 if {$urllog_shorturl != 0 && $uid != ""} { |
617 set shortURL "$shortURL [urllog_get_short $uid]" | 609 set shortURL "$shortURL [urllog_get_short $uid]" |
618 } | 610 } |
619 urllog_msg $upublic $unick $uchan "#$iresults: $shortURL ($uuser@[urllog_ctime $utime])" | 611 urllog_msg $upublic $unick $uchan "#$iresults: $shortURL ($uuser@[utl_ctime $utime])" |
620 } | 612 } |
621 | 613 |
622 if {$iresults == 0} { | 614 if {$iresults == 0} { |
623 # If no URLs were found | 615 # If no URLs were found |
624 urllog_msg $upublic $unick $uchan $urlmsg_nomatch | 616 urllog_msg $upublic $unick $uchan $urlmsg_nomatch |