Mercurial > hg > egg-tcls
annotate weather.tcl @ 220:03579553233b
weather: Add setting for specifying channels where weather commands are available.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 30 Sep 2014 14:48:51 +0300 |
parents | 861a49abee22 |
children | f4b7b6e8fb37 |
rev | line source |
---|---|
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 ########################################################################## |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 # |
218 | 3 # Weather v0.7 by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 # (C) Copyright 2014 Tecnic Software productions (TNSP) |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 # |
183 | 6 # Requires data fetcher to be run as a cronjob, see fetch_weather.pl |
7 # for more information. | |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 # |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 # This script is freely distributable under GNU GPL (version 2) license. |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 # |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
11 ########################################################################## |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 |
220
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
13 # Channels where weather functionality is enabled |
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
14 # set weather_channels "#foobar;#baz" |
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
15 # You can use * to match substrings or everything |
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
16 set weather_channels "*" |
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
17 |
183 | 18 # Default location if none given and none set by user. |
19 # Multiple can be specified as "foo;bar;etc" | |
220
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
20 set weather_default_locations "raahe lapaluoto;tie 8 pattijoki" |
157 | 21 |
183 | 22 # Weather data file, must match the one in fetch_weather.pl's config |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
23 set weather_datafile "/home/niinuska/bot/weather.data" |
183 | 24 |
25 # Alias data file | |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
26 set weather_aliasfile "/home/niinuska/bot/weather.alias" |
183 | 27 |
28 # How often to check the weather data file for updates (in minutes) | |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
29 set weather_check_period 2 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
30 |
183 | 31 # Max number of results to be listed |
156
a1f4c163e48c
weather: Add max results limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
32 set weather_max_results 3 |
a1f4c163e48c
weather: Add max results limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
33 |
183 | 34 # ... |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
35 set weather_logmsg 1 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
36 set weather_preferredmsg "PRIVMSG" |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
37 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
38 |
157 | 39 ### |
40 ### Messages | |
41 ### | |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
42 set weather_msg_usage_prefix_1 "Käyttö: !sää " |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
43 set weather_msg_usage_prefix_2 " !sää " |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
44 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
45 set weather_msg_usage_def_set "vakio <paikka>\[;<paikka2>\] -- asettaa vakiohavaintoaseman\nvakio -- näyttää nykyisen" |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
46 set weather_msg_usage_alias "alias <alias> = <nimi> (Lisää alias-nimen, esim. alias perse = turku)" |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
47 set weather_msg_usage_unalias "unalias <alias> (Poistaa aliaksen)" |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
48 |
217
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
49 set weather_msg_usage_stations "asemat <patterni> -- listaa mittausasemat joiden nimi matsaa patternin kanssa" |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
50 |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
51 set weather_msg_usage_full "\[paikka\]\n$weather_msg_usage_def_set\n$weather_msg_usage_alias\n$weather_msg_usage_unalias\n$weather_msg_usage_stations" |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
52 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
53 set weather_msg_def_set "Vakio-havaintoasemiksi asetettu: \002%1\002." |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
54 set weather_msg_defloc "Käyttäjän \002%1\002 vakio-havaintoasemat ovat: \002%2\002." |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
55 set weather_msg_def_not_set "Vakio-havaintoasemia ei asetettu käyttäjälle \002%1\002." |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
56 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
57 set weather_msg_aliased "Aliasoitiin \002%1\002 = \002%2\002." |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
58 set weather_msg_unaliased "Unaliasoitiin \002%1\002." |
174
d94be9a1be6a
weather: Add support for listing currently defined aliases.
Matti Hamalainen <ccr@tnsp.org>
parents:
173
diff
changeset
|
59 set weather_msg_aliases "Aliakset: %1" |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
60 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
61 set weather_msg_user_not_known "Tuntematon käyttäjä." |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
62 set weather_msg_no_access "Ei oikeuksia muuttaa asetuksia." |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
63 |
217
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
64 set weather_msg_stations "Mittausasemat: %1" |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
65 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
66 set weather_msg_no_results "\002%1\002: Ei mittaustietoja." |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
67 set weather_msg_no_data_for_location "\002%1\002: Paikkakunnan tietoja ei saatu." |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
68 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
69 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
70 ########################################################################## |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
71 # No need to look below this line |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
72 ########################################################################## |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
73 set weather_name "Weather" |
218 | 74 set weather_version "0.7" |
184 | 75 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
76 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
77 ### Binding initializations |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
78 bind pub - !sää weather_cmd_pub |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
79 bind pub - !saa weather_cmd_pub |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
80 bind msg - !sää weather_cmd_msg |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
81 bind msg - !saa weather_cmd_msg |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
82 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
83 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
84 ### Initialization messages |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
85 package require textutil::split |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
86 set weather_message "$weather_name v$weather_version by ccr/TNSP" |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
87 putlog "$weather_message" |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
88 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
89 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
90 #------------------------------------------------------------------------- |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
91 proc weather_log {arg} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
92 global weather_logmsg weather_name |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
93 if {$weather_logmsg != 0} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
94 putlog "$weather_name: $arg" |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
95 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
96 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
97 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
98 |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
99 proc weather_msg_do {apublic anick achan amsg} { |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
100 global weather_preferredmsg |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
101 if {$apublic == 1} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
102 putserv "$weather_preferredmsg $achan :$amsg" |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
103 } else { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
104 putserv "$weather_preferredmsg $anick :$amsg" |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
105 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
106 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
107 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
108 |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
109 proc weather_usage {apublic anick achan amsg} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
110 global weather_msg_usage_prefix_1 weather_msg_usage_prefix_2 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
111 set nline 0 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
112 foreach aline [split $amsg "\n"] { |
203
28ee3578a6d1
Weather: Add support for usage messages without default prefix.
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
113 if {[string range $aline 0 1] == ":"} { |
28ee3578a6d1
Weather: Add support for usage messages without default prefix.
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
114 weather_msg_do $apublic $anick $achan $aline |
28ee3578a6d1
Weather: Add support for usage messages without default prefix.
Matti Hamalainen <ccr@tnsp.org>
parents:
201
diff
changeset
|
115 } elseif {$nline == 0} { |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
116 weather_msg_do $apublic $anick $achan "$weather_msg_usage_prefix_1$aline" |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
117 } else { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
118 weather_msg_do $apublic $anick $achan "$weather_msg_usage_prefix_2$aline" |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
119 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
120 incr nline |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
121 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
122 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
123 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
124 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
125 proc weather_msg {apublic anick achan amsg {aargs {}}} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
126 set narg 1 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
127 foreach marg $aargs { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
128 set amsg [string map [list "%$narg" $marg] $amsg] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
129 incr narg |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
130 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
131 weather_msg_do $apublic $anick $achan $amsg |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
132 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
133 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
134 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
135 proc weather_ctime {utime} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
136 return [clock format $utime -format "%H:%M"] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
137 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
138 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
139 |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
140 proc weather_valid_user {uhand} { |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
141 if {$uhand != "" && $uhand != "{}" && $uhand != "*"} { |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
142 return 1 |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
143 } |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
144 return 0 |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
145 } |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
146 |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
147 |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
148 #------------------------------------------------------------------------- |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
149 proc weather_load_aliases {} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
150 global weather_aliasfile weather_aliases |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
151 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
152 # Create dict |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
153 array unset weather_aliases |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
154 array set weather_aliases {} |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
155 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
156 # Read datafile |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
157 if {![catch {set ufile [open $weather_aliasfile r 0600]} uerrmsg]} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
158 while {![eof $ufile]} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
159 gets $ufile uline |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
160 set udata [split $uline "|"] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
161 if {[llength $udata] == 2} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
162 set weather_aliases([lindex $udata 0]) [lindex $udata 1] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
163 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
164 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
165 close $ufile |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
166 } else { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
167 weather_log "Could not open data file: $uerrmsg" |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
168 } |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
169 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
170 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
171 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
172 proc weather_save_aliases {} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
173 global weather_aliasfile weather_aliases |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
174 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
175 if {![catch {set ufile [open $weather_aliasfile w 0600]} uerrmsg]} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
176 foreach {ukey uvalue} [array get weather_aliases] { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
177 puts $ufile "$ukey|$uvalue" |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
178 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
179 close $ufile |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
180 } else { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
181 weather_log "Could not open data file: $uerrmsg" |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
182 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
183 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
184 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
185 |
171
5434903331df
weather: Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
167
diff
changeset
|
186 # If there exists an alias for given string/name, return it |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
187 proc weather_get_alias {uname} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
188 global weather_aliases |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
189 set utmp [array get weather_aliases $uname] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
190 if {[llength $utmp] > 0} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
191 return [lindex $utmp 1] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
192 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
193 return $uname |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
194 } |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
195 |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
196 |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
197 #------------------------------------------------------------------------- |
167
3a375ee7c106
weather: More flexible data handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
165
diff
changeset
|
198 proc weather_item {udata uindex ufmt} { |
3a375ee7c106
weather: More flexible data handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
165
diff
changeset
|
199 if {[llength $udata] > $uindex && [lindex $udata $uindex] != ""} { |
3a375ee7c106
weather: More flexible data handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
165
diff
changeset
|
200 set utmp [lindex $udata $uindex] |
3a375ee7c106
weather: More flexible data handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
165
diff
changeset
|
201 return [string map [list "@@" $utmp] $ufmt] |
3a375ee7c106
weather: More flexible data handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
165
diff
changeset
|
202 } |
3a375ee7c106
weather: More flexible data handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
165
diff
changeset
|
203 return "" |
3a375ee7c106
weather: More flexible data handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
165
diff
changeset
|
204 } |
3a375ee7c106
weather: More flexible data handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
165
diff
changeset
|
205 |
171
5434903331df
weather: Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
167
diff
changeset
|
206 |
5434903331df
weather: Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
167
diff
changeset
|
207 # Produce one location of weather data as a string |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
208 proc weather_get_data {ukey udata} { |
201 | 209 set str "\002[lindex $udata 0]\002, mitattu klo [weather_ctime [lindex $udata 2]]: \002[lindex $udata 3]°C\002" |
210 append str [weather_item $udata 5 ", @@"] | |
211 append str [weather_item $udata 6 ", kosteus \002@@%\002"] | |
215 | 212 append str [weather_item $udata 7 ", keli @@"] |
201 | 213 append str [weather_item $udata 4 ", tien pinta @@°C"] |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
214 return "${str}." |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
215 } |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
216 |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
217 |
171
5434903331df
weather: Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
167
diff
changeset
|
218 # Get data by location key |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
219 proc weather_get_key {ukey} { |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
220 global weather_data |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
221 return [weather_get_data $ukey $weather_data($ukey)] |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
222 } |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
223 |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
224 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
225 #------------------------------------------------------------------------- |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
226 proc weather_update {} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
227 global weather_datafile weather_data |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
228 |
172
2c89e47739e8
weather: Change weather data loading to not discard current data if data
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
229 # Check if we can open the weather data file |
2c89e47739e8
weather: Change weather data loading to not discard current data if data
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
230 if {![catch {set ufile [open $weather_datafile r 0600]} uerrmsg]} { |
2c89e47739e8
weather: Change weather data loading to not discard current data if data
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
231 # Create dict |
2c89e47739e8
weather: Change weather data loading to not discard current data if data
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
232 array unset weather_data |
2c89e47739e8
weather: Change weather data loading to not discard current data if data
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
233 array set weather_data {} |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
234 |
172
2c89e47739e8
weather: Change weather data loading to not discard current data if data
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
235 set wtemp_min_val 500000 |
2c89e47739e8
weather: Change weather data loading to not discard current data if data
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
236 set wtemp_max_val -500000 |
2c89e47739e8
weather: Change weather data loading to not discard current data if data
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
237 set wtemp_min_key "" |
2c89e47739e8
weather: Change weather data loading to not discard current data if data
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
238 set wtemp_max_key "" |
2c89e47739e8
weather: Change weather data loading to not discard current data if data
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
239 |
2c89e47739e8
weather: Change weather data loading to not discard current data if data
Matti Hamalainen <ccr@tnsp.org>
parents:
171
diff
changeset
|
240 # Read in the data |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
241 while {![eof $ufile]} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
242 gets $ufile uline |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
243 set udata [split $uline "|"] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
244 if {[llength $udata] > 0} { |
201 | 245 set utemp [lindex $udata 3] |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
246 set ukey [lindex $udata 0] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
247 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
248 set weather_data($ukey) $udata |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
249 |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
250 if {[string is double -strict $utemp]} { |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
251 if {$utemp < $wtemp_min_val} { |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
252 set wtemp_min_key $ukey |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
253 set wtemp_min_val $utemp |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
254 } |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
255 if {$utemp > $wtemp_max_val} { |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
256 set wtemp_max_key $ukey |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
257 set wtemp_max_val $utemp |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
258 } |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
259 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
260 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
261 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
262 close $ufile |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
263 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
264 # Store min/max |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
265 set weather_data(w_min) $weather_data($wtemp_min_key) |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
266 set weather_data(w_max) $weather_data($wtemp_max_key) |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
267 } else { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
268 weather_log "Could not open data file: $uerrmsg" |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
269 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
270 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
271 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
272 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
273 #------------------------------------------------------------------------- |
171
5434903331df
weather: Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
167
diff
changeset
|
274 # Weather data update loop |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
275 proc weather_exec {} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
276 global weather_check_period weather_running |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
277 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
278 # Perform update |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
279 weather_update |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
280 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
281 # Schedule next update |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
282 set weather_running [clock seconds] |
173
3ea14355e2d4
weather: Fix a silly bug in the weather data update loop. :S
Matti Hamalainen <ccr@tnsp.org>
parents:
172
diff
changeset
|
283 timer $weather_check_period weather_exec |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
284 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
285 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
286 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
287 #------------------------------------------------------------------------- |
171
5434903331df
weather: Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
167
diff
changeset
|
288 # Script initialization |
5434903331df
weather: Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
167
diff
changeset
|
289 #------------------------------------------------------------------------- |
5434903331df
weather: Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
167
diff
changeset
|
290 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
291 if {![info exists weather_data]} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
292 array set weather_data {} |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
293 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
294 |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
295 if {![info exists weather_aliases]} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
296 array set weather_aliases {} |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
297 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
298 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
299 if {[info exists weather_running]} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
300 set weather_last [expr [clock seconds] - $weather_running] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
301 } else { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
302 set weather_last -1 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
303 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
304 |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
305 weather_log "Loading aliases." |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
306 weather_load_aliases |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
307 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
308 if {$weather_last < 0 || $weather_last > [expr $weather_check_period * 60]} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
309 weather_log "Starting weather update." |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
310 weather_exec |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
311 } else { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
312 weather_update |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
313 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
314 |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
315 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
316 #------------------------------------------------------------------------- |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
317 proc weather_cmd {unick uhand uchan uargs upublic} { |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
318 global weather_default_locations weather_data weather_max_results weather_aliases |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
319 global weather_msg_usage_full weather_msg_usage_def_set weather_msg_user_not_known |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
320 global weather_msg_no_results weather_msg_no_data_for_location |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
321 global weather_msg_usage_alias weather_msg_usage_unalias weather_msg_defloc |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
322 global weather_msg_aliased weather_msg_unaliased weather_msg_no_access |
174
d94be9a1be6a
weather: Add support for listing currently defined aliases.
Matti Hamalainen <ccr@tnsp.org>
parents:
173
diff
changeset
|
323 global weather_msg_def_set weather_msg_def_not_set weather_msg_aliases |
217
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
324 global weather_msg_usage_stations weather_msg_stations |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
325 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
326 # Check and handle arguments |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
327 set rarglist [::textutil::split::splitx $uargs {\s+}] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
328 set rarg [lindex $rarglist 0] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
329 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
330 if {$rarg == "?" || $rarg == "help" || $rarg == "apua"} { |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
331 weather_usage $upublic $unick $uchan "$weather_msg_usage_full" |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
332 return 0 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
333 } |
217
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
334 |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
335 if {$rarg == "asemat" || $rarg == "stations"} { |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
336 # List stations/locations matching the given pattern |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
337 if {[llength $rarglist] < 2} { |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
338 weather_usage $upublic $unick $uchan $weather_msg_usage_stations |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
339 return 0 |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
340 } |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
341 |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
342 set rarg [join [lrange $rarglist 1 end] " "] |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
343 set result {} |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
344 |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
345 foreach {ukey uvalue} [array get weather_data] { |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
346 if {![string match "w_*" $ukey] && [string match -nocase "*${rarg}*" $ukey]} { |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
347 lappend result $ukey |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
348 } |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
349 } |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
350 |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
351 set res [join $result " ; "] |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
352 weather_msg $upublic $unick $uchan $weather_msg_stations [list $res] |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
353 return 0 |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
354 } elseif {$rarg == "vakio" || $rarg == "default" || $rarg == "vakiot"} { |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
355 # List or set the default weather station name patterns for this user |
67018e353536
weather: Add new sub-command for listing measurement stations matching given name pattern.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
356 |
171
5434903331df
weather: Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
167
diff
changeset
|
357 # Access check |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
358 if {![weather_valid_user $uhand]} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
359 weather_msg $upublic $unick $uchan $weather_msg_user_not_known |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
360 return 0 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
361 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
362 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
363 if {[llength $rarglist] == 1} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
364 set lista [getuser $uhand XTRA "weather_locations"] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
365 if {$lista == "" || $lista == "{}"} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
366 weather_msg $upublic $unick $uchan $weather_msg_def_not_set [list $uhand] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
367 } else { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
368 set lista [join [split $lista ";"] " ; "] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
369 weather_msg $upublic $unick $uchan $weather_msg_defloc [list $uhand $lista] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
370 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
371 } else { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
372 # Split the list of desired locations |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
373 set qlist [::textutil::split::splitx [join [lrange $rarglist 1 end] " "] {\s*\;\s*}] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
374 set nlist [lsearch -all -inline -not -exact $qlist ""] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
375 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
376 if {[llength $nlist] > 0} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
377 weather_msg $upublic $unick $uchan $weather_msg_def_set [list [join $nlist " ; "]] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
378 setuser $uhand XTRA "weather_locations" [join $nlist ";"] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
379 } else { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
380 weather_usage $upublic $unick $uchan $weather_msg_usage_def_set |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
381 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
382 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
383 return 0 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
384 } elseif {$rarg == "alias"} { |
171
5434903331df
weather: Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
167
diff
changeset
|
385 # Alias a string to another, only certain users have access (+n flag) |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
386 if {![weather_valid_user $uhand] || ![matchattr $uhand n]} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
387 weather_msg $upublic $unick $uchan $weather_msg_no_access |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
388 return 0 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
389 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
390 |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
391 set qlist [::textutil::split::splitx [join [lrange $rarglist 1 end] " "] {\s*=\s*}] |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
392 set nlist [lsearch -all -inline -not -exact $qlist ""] |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
393 if {[llength $nlist] < 2} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
394 weather_usage $upublic $unick $uchan $weather_msg_usage_alias |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
395 return 0 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
396 } |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
397 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
398 set ualias [lindex $nlist 0] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
399 set uname [lindex $nlist 1] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
400 set weather_aliases($ualias) $uname |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
401 weather_msg $upublic $unick $uchan $weather_msg_aliased [list $ualias $uname] |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
402 |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
403 weather_save_aliases |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
404 return 0 |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
405 } elseif {$rarg == "unalias"} { |
171
5434903331df
weather: Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
167
diff
changeset
|
406 # Remove one alias, only certain users have access (+n flag) |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
407 if {![weather_valid_user $uhand] || ![matchattr $uhand n]} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
408 weather_msg $upublic $unick $uchan $weather_msg_no_access |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
409 return 0 |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
410 } |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
411 |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
412 if {[llength $rarglist] < 2} { |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
413 weather_usage $upublic $unick $uchan $weather_msg_usage_unalias |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
414 return 0 |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
415 } |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
416 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
417 set ualias [lindex $rarglist 1] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
418 unset weather_aliases($ualias) |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
419 weather_msg $upublic $unick $uchan $weather_msg_unaliased [list $ualias] |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
420 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
421 weather_save_aliases |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
422 return 0 |
174
d94be9a1be6a
weather: Add support for listing currently defined aliases.
Matti Hamalainen <ccr@tnsp.org>
parents:
173
diff
changeset
|
423 } elseif {$rarg == "list"} { |
d94be9a1be6a
weather: Add support for listing currently defined aliases.
Matti Hamalainen <ccr@tnsp.org>
parents:
173
diff
changeset
|
424 # List all currently defined aliases |
d94be9a1be6a
weather: Add support for listing currently defined aliases.
Matti Hamalainen <ccr@tnsp.org>
parents:
173
diff
changeset
|
425 set ulist {} |
d94be9a1be6a
weather: Add support for listing currently defined aliases.
Matti Hamalainen <ccr@tnsp.org>
parents:
173
diff
changeset
|
426 foreach {ukey uvalue} [array get weather_aliases] { |
d94be9a1be6a
weather: Add support for listing currently defined aliases.
Matti Hamalainen <ccr@tnsp.org>
parents:
173
diff
changeset
|
427 lappend ulist "\002'$ukey' = '$uvalue'\002" |
d94be9a1be6a
weather: Add support for listing currently defined aliases.
Matti Hamalainen <ccr@tnsp.org>
parents:
173
diff
changeset
|
428 } |
d94be9a1be6a
weather: Add support for listing currently defined aliases.
Matti Hamalainen <ccr@tnsp.org>
parents:
173
diff
changeset
|
429 weather_msg $upublic $unick $uchan $weather_msg_aliases [list [join $ulist ", "]] |
d94be9a1be6a
weather: Add support for listing currently defined aliases.
Matti Hamalainen <ccr@tnsp.org>
parents:
173
diff
changeset
|
430 return 0 |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
431 } |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
432 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
433 # Get args or default location(s) |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
434 set rargs [join $rarglist " "] |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
435 if {$rargs == "" && $uhand != "" && $uhand != "{}" && $uhand != "*"} { |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
436 set rargs [getuser $uhand XTRA "weather_locations"] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
437 } |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
438 if {$rargs == ""} { |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
439 set rargs $weather_default_locations |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
440 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
441 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
442 # Handle argument list |
156
a1f4c163e48c
weather: Add max results limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
443 set nresults 0 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
444 set rarglist [::textutil::split::splitx $rargs "\s*\;\s*"] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
445 foreach rarg $rarglist { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
446 if {$rarg == "min"} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
447 # Min temp |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
448 set umin [weather_get_key "w_min"] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
449 weather_msg $upublic $unick $uchan "Min: $umin" |
156
a1f4c163e48c
weather: Add max results limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
450 incr nresults |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
451 } elseif {$rarg == "max"} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
452 # Max temp |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
453 set umax [weather_get_key "w_max"] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
454 weather_msg $upublic $unick $uchan "Max: $umax" |
156
a1f4c163e48c
weather: Add max results limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
455 incr nresults |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
456 } elseif {$rarg == "minmax" || $rarg == "min max" || $rarg == "maxmin" || $rarg == "max min"} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
457 # Min & Max temps |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
458 set umin [weather_get_key "w_min"] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
459 set umax [weather_get_key "w_max"] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
460 weather_msg $upublic $unick $uchan "Min: $umin | Max: $umax" |
156
a1f4c163e48c
weather: Add max results limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
461 incr nresults |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
462 } else { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
463 # Location match |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
464 set ufound 0 |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
465 set rarg [weather_get_alias $rarg] |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
466 foreach {ukey uvalue} [array get weather_data] { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
467 if {![string match "w_*" $ukey] && [string match -nocase "*${rarg}*" $ukey]} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
468 if {[llength $uvalue] > 0} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
469 weather_msg $upublic $unick $uchan [weather_get_data $ukey $uvalue] |
156
a1f4c163e48c
weather: Add max results limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
470 incr nresults |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
471 } else { |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
472 weather_msg $upublic $unick $uchan $weather_msg_no_results [list $ukey] |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
473 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
474 incr ufound |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
475 } |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
476 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
477 # Check for results limit |
161
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
478 if {$nresults >= $weather_max_results} { |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
479 return 0 |
2c9db9a29429
weather: More work, bugfixes.
Matti Hamalainen <ccr@tnsp.org>
parents:
157
diff
changeset
|
480 } |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
481 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
482 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
483 if {$ufound == 0} { |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
484 weather_msg $upublic $unick $uchan $weather_msg_no_data_for_location [list $rarg] |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
485 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
486 } |
163
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
487 |
bee5cd89d41c
weather: Moar work on getting the frontend script code up and running.
Matti Hamalainen <ccr@tnsp.org>
parents:
161
diff
changeset
|
488 # Check for results limit |
156
a1f4c163e48c
weather: Add max results limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
489 if {$nresults >= $weather_max_results} { |
a1f4c163e48c
weather: Add max results limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
490 return 0 |
a1f4c163e48c
weather: Add max results limit.
Matti Hamalainen <ccr@tnsp.org>
parents:
153
diff
changeset
|
491 } |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
492 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
493 return 0 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
494 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
495 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
496 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
497 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
498 #------------------------------------------------------------------------- |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
499 proc weather_cmd_pub {unick uhost uhand uchan uargs} { |
220
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
500 global weather_channels |
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
501 |
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
502 foreach akey [split $weather_channels ";"] { |
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
503 if {[string match $akey $uchan]} { |
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
504 return [weather_cmd $unick $uhand $uchan $uargs 1] |
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
505 } |
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
506 } |
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
507 |
03579553233b
weather: Add setting for specifying channels where weather commands are available.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
508 return 0 |
153
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
509 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
510 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
511 #------------------------------------------------------------------------- |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
512 proc weather_cmd_msg {unick uhost uhand uargs} { |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
513 return [weather_cmd $unick $uhand "PRIV" $uargs 0] |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
514 } |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
515 |
8b888a9f07df
New script, weather.tcl. Needs backend stuff to be implemented.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
516 # end of script |