diff weather.tcl @ 558:e0ff67318a99

weather: Rename some message ids, cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 09 Jul 2020 12:41:52 +0300
parents b6b92f64013c
children 15bc88a1477a
line wrap: on
line diff
--- a/weather.tcl	Thu Jul 09 12:40:23 2020 +0300
+++ b/weather.tcl	Thu Jul 09 12:41:52 2020 +0300
@@ -25,15 +25,11 @@
 package require textutil::split
 
 set weather_name "Weather"
-set weather_version "2.0.0"
-
-
-### Initialization messages
-set weather_message "$weather_name v$weather_version (C) 2014-2020 ccr/TNSP"
-putlog "$weather_message"
+set weather_message "$weather_name v2.0.0 (C) 2014-2020 ccr/TNSP"
 
 
 #-------------------------------------------------------------------------
+### Utility functions
 proc weather_log {umsg} {
   global weather_log_enable weather_name
   if {$weather_log_enable != 0} {
@@ -293,7 +289,7 @@
   set rcmd [lindex $rarglist 0]
 
   if {$rcmd == "?" || $rcmd == "help" || $rcmd == "apua"} {
-    foreach ukey $weather_messages(usage_full) {
+    foreach ukey $weather_messages(help_full) {
       weather_msg $upublic $unick $uchan $ukey
     }
     return 0
@@ -302,7 +298,7 @@
   if {$rcmd == "asemat" || $rcmd == "stations"} {
     # List stations/locations matching the given pattern
     if {[llength $rarglist] < 2} {
-      weather_msg $upublic $unick $uchan "usage_stations"
+      weather_msg $upublic $unick $uchan "help_stations"
       return 0
     }
 
@@ -331,7 +327,7 @@
     # List stations nearest to given coordinates
     set qargs [join [lrange $rarglist 1 end] ""]
     if {![regexp {@?(\d+|\d+\.\d+|\.\d+)\s*,\s*(\d+|\d+\.\d+|\.\d+)} $qargs -> d_lat d_lng]} {
-      weather_msg $upublic $unick $uchan "usage_nearest"
+      weather_msg $upublic $unick $uchan "help_nearest"
       return 0
     }
 
@@ -391,7 +387,7 @@
         weather_msg $upublic $unick $uchan "def_set_to" [list [join $nlist " ; "]]
         setuser $uhand XTRA "weather_locations" [join $nlist ";"]
       } else {
-        weather_msg $upublic $unick $uchan "usage_def_set"
+        weather_msg $upublic $unick $uchan "help_def_set"
       }
     }
     return 0
@@ -405,7 +401,7 @@
     set qlist [::textutil::split::splitx [join [lrange $rarglist 1 end] " "] {\s*=\s*}]
     set nlist [lsearch -all -inline -not -exact $qlist ""]
     if {[llength $nlist] < 2} {
-      weather_msg $upublic $unick $uchan "usage_alias"
+      weather_msg $upublic $unick $uchan "help_alias"
       return 0
     }
 
@@ -430,7 +426,7 @@
     }
 
     if {[llength $rarglist] < 2} {
-      weather_msg $upublic $unick $uchan "usage_unalias"
+      weather_msg $upublic $unick $uchan "help_unalias"
       return 0
     }
 
@@ -539,6 +535,8 @@
 #-------------------------------------------------------------------------
 # Script initialization
 #-------------------------------------------------------------------------
+putlog "$weather_message"
+
 
 if {![info exists weather_data]} {
   array set weather_data {}