Mercurial > hg > egg-tcls
changeset 315:7a987b22a817
urllog: Add new configuration option urllog_msg_channels.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 27 Feb 2015 17:39:54 +0200 |
parents | 1cf897164a25 |
children | 682adbf6f09f |
files | config.urllog.example urllog.tcl |
diffstat | 2 files changed, 16 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/config.urllog.example Fri Feb 27 17:38:27 2015 +0200 +++ b/config.urllog.example Fri Feb 27 17:39:54 2015 +0200 @@ -13,6 +13,10 @@ # You can use * to match substrings or everything set urllog_log_channels "#tnsp;#fireball;#mazmlame" +# Channels where URLLog announces URL titles and so on +# By default we set this to same as urllog_log_channels +set urllog_msg_channels $urllog_log_channels + # Filename of the SQLite URL database file set urllog_db_file "urllog.sqlite"
--- a/urllog.tcl Fri Feb 27 17:38:27 2015 +0200 +++ b/urllog.tcl Fri Feb 27 17:39:54 2015 +0200 @@ -182,6 +182,7 @@ #------------------------------------------------------------------------- proc urllog_exists {urlStr urlNick urlHost urlChan} { global urldb urlmsg_alreadyknown urllog_shorturl + global urllog_msg_channels set usql "SELECT id AS uid, utime AS utime, url AS uurl, user AS uuser, host AS uhost, chan AS uchan, title AS utitle FROM urls WHERE url='[utl_escape $urlStr]'" urldb eval $usql { @@ -197,7 +198,10 @@ } else { set qstr "$urlmsg_alreadyknown $qstr" } - urllog_verb_msg $urlNick $urlChan $qstr + + if {[utl_match_delim_list $urllog_msg_channels $uchan]} { + urllog_verb_msg $urlNick $urlChan $qstr + } return 0 } return 1 @@ -537,15 +541,12 @@ } ### Check the channel - foreach akey [split $urllog_log_channels ";"] { - if {[string match $akey $uchan]} { - ### Do the URL checking - foreach str [split $utext " "] { - if {[regexp "((ftp|http|https)://\[^\[:space:\]\]+|^(www|ftp)\.\[^\[:space:\]\]+)" $str ulink]} { - urllog_check_url $str $unick $uhost $uchan - } + if {[utl_match_delim_list $urllog_log_channels $uchan]} { + ### Do the URL checking + foreach str [split $utext " "] { + if {[regexp "((ftp|http|https)://\[^\[:space:\]\]+|^(www|ftp)\.\[^\[:space:\]\]+)" $str ulink]} { + urllog_check_url $str $unick $uhost $uchan } - return 0 } } @@ -620,10 +621,8 @@ proc urllog_pub_urlfind {unick uhost uhand uchan utext} { global urllog_search_channels - foreach akey [split $urllog_search_channels ";"] { - if {[string match $akey $uchan]} { - return [urllog_find $unick $uhand $uchan $utext 1] - } + if {[utl_match_delim_list $urllog_search_channels $uchan]} { + return [urllog_find $unick $uhand $uchan $utext 1] } return 0 }