# HG changeset patch # User Matti Hamalainen # Date 1422001530 -7200 # Node ID da239a953e242c9019bf7a9f277fbc8ffdc25d56 # Parent 8f5daf6631d9fe108f7dd49303b060eadfe40c53 urllog: Change some setting names, etc. diff -r 8f5daf6631d9 -r da239a953e24 config.urllog.example --- a/config.urllog.example Fri Jan 23 10:17:32 2015 +0200 +++ b/config.urllog.example Fri Jan 23 10:25:30 2015 +0200 @@ -43,12 +43,13 @@ # 1 = Enable logging of various script actions into bot's log # 0 = Don't. -set urllog_logmsg 1 +set urllog_log_enable 1 # 1 = Check URLs for validity and existence before adding. -# 0 = No checks. Add _anything_ that looks like an URL to the database. -set urllog_check 1 +# 0 = No checks. Add almost _anything_ that looks like an URL to the database. +# (You probably want this enabled.) +set urllog_extra_checks 1 ### diff -r 8f5daf6631d9 -r da239a953e24 urllog.tcl --- a/urllog.tcl Fri Jan 23 10:17:32 2015 +0200 +++ b/urllog.tcl Fri Jan 23 10:25:30 2015 +0200 @@ -65,13 +65,15 @@ ### HTTP module initialization ::http::config -useragent "$urllog_name/$urllog_version" -if {$http_use_proxy != 0} { +if {[info exists http_use_proxy] && $http_use_proxy != 0} { ::http::config -proxyhost $http_proxy_host -proxyport $http_proxy_port + putlog " (Using proxy $http_proxy_host:$http_proxy_port)" } -if {$http_tls_support != 0} { +if {[info exists http_tls_support] && $http_tls_support != 0} { package require tls ::http::register https 443 [list ::tls::socket -request 1 -require 1 -tls1 1 -cadir $http_tls_cadir] + putlog " (TLS/SSL support enabled)" } ### SQLite database initialization @@ -80,12 +82,7 @@ exit 2 } - -if {$http_use_proxy != 0} { - putlog " (Using proxy $http_proxy_host:$http_proxy_port)" -} - -if {$urllog_check != 0} { +if {$urllog_extra_checks != 0} { putlog " (Additional URL validity checks enabled)" } @@ -96,9 +93,9 @@ #------------------------------------------------------------------------- ### Utility functions proc urllog_log {arg} { - global urllog_logmsg urllog_name + global urllog_log_enable urllog_name - if {$urllog_logmsg != 0} { + if {$urllog_log_enable != 0} { putlog "$urllog_name: $arg" } } @@ -294,7 +291,7 @@ #------------------------------------------------------------------------- proc urllog_validate_url { urlNick urlChan urlMStr urlMProto } { - global urllog_tlds urllog_check urlmsg_nosuchhost urllog_httprep + global urllog_tlds urllog_extra_checks urlmsg_nosuchhost urllog_httprep global urllog_shorturl_prefix urllog_shorturl upvar 1 $urlMStr urlStr upvar 1 $urlMProto urlProto @@ -381,7 +378,7 @@ #------------------------------------------------------------------------- proc urllog_check_url {urlStr urlNick urlHost urlChan} { - global urllog_encoding http_tls_support urlmsg_errorgettingdoc urllog_check + global urllog_encoding http_tls_support urlmsg_errorgettingdoc urllog_extra_checks ### Does the URL already exist? if {![urllog_exists $urlStr $urlNick $urlHost $urlChan]} { @@ -394,8 +391,8 @@ return 1 } - ### Do we perform additional optional checks? - if {$urllog_check == 0 || !(($http_tls_support != 0 && $u_proto == "https") || $u_proto == "http")} { + ### Do we perform additional checks? + if {$urllog_extra_checks == 0 || !(($http_tls_support != 0 && $u_proto == "https") || $u_proto == "http")} { # No optional checks, or it's not http/https. # Just add the URL, if it does not exist already. urllog_addurl $urlStr $urlNick $urlHost $urlChan ""