Mercurial > hg > egg-tcls
diff urllog.tcl @ 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 | 8175ef52889b |
children | 5d886e2137d5 |
line wrap: on
line diff
--- 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 }