Mercurial > hg > egg-tcls
comparison feeds.tcl @ 433:2484f438b7d3
feeds: Use utl_escape() instead of our own copy.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 09 Jan 2017 04:08:43 +0200 |
parents | 5763716060a0 |
children | 366324c417d8 |
comparison
equal
deleted
inserted
replaced
432:124b97f5a19d | 433:2484f438b7d3 |
---|---|
35 bind pub - !feeds feeds_pubfetch | 35 bind pub - !feeds feeds_pubfetch |
36 bind pub - !last feeds_publast | 36 bind pub - !last feeds_publast |
37 | 37 |
38 | 38 |
39 # ------------------------------------------------------------------------ | 39 # ------------------------------------------------------------------------ |
40 proc feeds_escape { str } { | |
41 return [string map {' ''} $str] | |
42 } | |
43 | |
44 proc feeds_smsg {uchan umsg} { | 40 proc feeds_smsg {uchan umsg} { |
45 global feeds_preferredmsg | 41 global feeds_preferredmsg |
46 putserv "$feeds_preferredmsg $uchan :$umsg" | 42 putserv "$feeds_preferredmsg $uchan :$umsg" |
47 } | 43 } |
48 | 44 |
164 # ------------------------------------------------------------------------ | 160 # ------------------------------------------------------------------------ |
165 proc feeds_publast {unick uhost uhand uchan utext} { | 161 proc feeds_publast {unick uhost uhand uchan utext} { |
166 global feeds_dbh | 162 global feeds_dbh |
167 set ufound 0 | 163 set ufound 0 |
168 | 164 |
169 set usql "SELECT url AS uurl, feed AS ufeed, title AS utitle, utime AS utime FROM feeds WHERE feed LIKE '%[string tolower [feeds_escape $utext]]%' ORDER BY utime DESC LIMIT 1" | 165 set usql "SELECT url AS uurl, feed AS ufeed, title AS utitle, utime AS utime FROM feeds WHERE feed LIKE '%[string tolower [utl_escape $utext]]%' ORDER BY utime DESC LIMIT 1" |
170 feeds_dbh eval $usql { | 166 feeds_dbh eval $usql { |
171 feeds_smsg $uchan "Uusin '$ufeed' / [feeds_ctime $utime]: $utitle -- $uurl" | 167 feeds_smsg $uchan "Uusin '$ufeed' / [feeds_ctime $utime]: $utitle -- $uurl" |
172 set ufound 1 | 168 set ufound 1 |
173 } | 169 } |
174 | 170 |