changeset 311:adc519c72f53

urllog: Various cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 31 Jan 2015 00:43:06 +0200
parents d56509a6f435
children 2371cd2b3f67
files urllog.tcl
diffstat 1 files changed, 5 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/urllog.tcl	Wed Jan 28 13:57:45 2015 +0200
+++ b/urllog.tcl	Sat Jan 31 00:43:06 2015 +0200
@@ -150,14 +150,6 @@
 }
 
 
-proc urllog_clean_title {utitle} {
-  if {[catch {set utitle [encoding convertto "iso8859-15" $utitle]} cerrmsg]} {
-    putlog "Could not convert title encoding: $cerrmsg"
-  }
-  return $utitle
-}
-
-
 #-------------------------------------------------------------------------
 set urllog_shorturl_str "ABCDEFGHIJKLNMOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
 
@@ -201,7 +193,7 @@
     }
     append qstr "($uuser/$uchan@[urllog_ctime $utime])"
     if {[string length $utitle] > 0} {
-      set qstr "$urlmsg_alreadyknown - '[urllog_clean_title $utitle]' $qstr"
+      set qstr "$urlmsg_alreadyknown - '$utitle' $qstr"
     } else {
       set qstr "$urlmsg_alreadyknown $qstr"
     }
@@ -237,7 +229,7 @@
     set qstr ""
   }
   if {[string length $urlTitle] > 0} {
-    urllog_verb_msg $urlNick $urlChan "'[urllog_clean_title $urlTitle]' ([urllog_chop_url $urlStr]) $qstr"
+    urllog_verb_msg $urlNick $urlChan "'$urlTitle' ([urllog_chop_url $urlStr]) $qstr"
   } else {
     urllog_verb_msg $urlNick $urlChan "[urllog_chop_url $urlStr] $qstr"
   }
@@ -461,13 +453,9 @@
     set uenc_http2 [urllog_sanitize_encoding $uenc_http]
     set uenc_doc2 [urllog_sanitize_encoding $uenc_doc]
 
+    # Check if the document has specified encoding
     # KLUDGE!
     set uencoding $uenc_http2
-
-#    putlog "got charsets : http='$uenc_http', doc='$uenc_doc' / sanitized http='$uenc_http2', doc='$uenc_doc2'"
-
-
-    # Check if the document has specified encoding
     if {$uenc_doc != ""} {
       # Does it differ from what HTTP says?
       if {$uenc_http != "" && $uenc_doc != $uenc_http && $uenc_doc2 != $uenc_http2} {
@@ -479,6 +467,8 @@
       set uencoding "iso8859-1"
     }
 
+    urllog_log "Charsets: http='$uenc_http', doc='$uenc_doc' / sanitized http='$uenc_http2', doc='$uenc_doc2' -> '$uencoding'"
+
     # Get the document title, if any
     set urlTitle ""
     if {[regexp -nocase -- "<title>(.\*\?)</title>" $udata umatches urlTitle]} {