changeset 603:577763cb8864

urllog: Improve title handling in "URL is known" messages.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 04 Feb 2021 18:01:31 +0200
parents a09401d4ac8c
children 543f1d72361e
files config.urllog.example urllog.tcl
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/config.urllog.example	Thu Feb 04 13:51:34 2021 +0200
+++ b/config.urllog.example	Thu Feb 04 18:01:31 2021 +0200
@@ -162,13 +162,14 @@
   "url_added_long_has_title" "'@1@' (@4@)"
   "url_added_long_no_title" "@3@"
 
-  "url_known_short" "wanha!"
-  "url_known_long" "wanha!"
+  "url_known_has_title" "'@2@' "
+  "url_known_no_title" ""
+  "url_known_short" "wanha! @5@@7@ (@1@@@4@)"
+  "url_known_long" "wanha! @5@@6@ (@1@@@4@)"
 
 
   "search_result_has_title" "'@2@' "
   "search_result_no_title" ""
-
   "search_result_short" "#@1@: @4@@5@ @6@ (@2@ @ @3@)"
   "search_result_long" "#@1@: @4@@5@ (@2@ @ @3@)"
 
--- a/urllog.tcl	Thu Feb 04 13:51:34 2021 +0200
+++ b/urllog.tcl	Thu Feb 04 18:01:31 2021 +0200
@@ -157,10 +157,16 @@
     urllog_log "URL said by $urlNick ($urlStr) already known"
 
     if {[utl_match_delim_list $urllog_pub_channels $uchan]} {
+      if {[string length $utitle] > 0} {
+        set stitle [utl_str_map_values [urllog_qm "url_known_has_title"] [list $utitle [urllog_chop_str $utitle $urllog_add_title_max]]]
+      } else {
+        set stitle [urllog_qm "url_known_no_title"]
+      }
+
       if {$urllog_shorturl_enable != 0} {
-        urllog_verb_msg 1 $urlNick $urlChan "url_known_short" [list $uuser $uchan $uhost [utl_ctime $utime] $utitle $uurl [urllog_get_short $uid]]
+        urllog_verb_msg 1 $urlNick $urlChan "url_known_short" [list $uuser $uchan $uhost [utl_ctime $utime] $stitle $uurl [urllog_get_short $uid]]
       } else {
-        urllog_verb_msg 1 $urlNick $urlChan "url_known_long" [list $uuser $uchan $uhost [utl_ctime $utime] $utitle $uurl]
+        urllog_verb_msg 1 $urlNick $urlChan "url_known_long" [list $uuser $uchan $uhost [utl_ctime $utime] $stitle $uurl]
       }
     }
     return 1