changeset 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 4e09bcc48851
children b8bf9d7666b6
files weather.tcl
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/weather.tcl	Tue Sep 30 14:47:58 2014 +0300
+++ b/weather.tcl	Tue Sep 30 14:48:51 2014 +0300
@@ -10,9 +10,14 @@
 #
 ##########################################################################
 
+# Channels where weather functionality is enabled
+# set weather_channels "#foobar;#baz"
+# You can use * to match substrings or everything
+set weather_channels "*"
+
 # Default location if none given and none set by user.
 # Multiple can be specified as "foo;bar;etc"
-set weather_default_locations "raahe"
+set weather_default_locations "raahe lapaluoto;tie 8 pattijoki"
 
 # Weather data file, must match the one in fetch_weather.pl's config
 set weather_datafile "/home/niinuska/bot/weather.data"
@@ -492,7 +497,15 @@
 
 #-------------------------------------------------------------------------
 proc weather_cmd_pub {unick uhost uhand uchan uargs} {
-  return [weather_cmd $unick $uhand $uchan $uargs 1]
+  global weather_channels
+
+  foreach akey [split $weather_channels ";"] {
+    if {[string match $akey $uchan]} {
+      return [weather_cmd $unick $uhand $uchan $uargs 1]
+    }
+  }
+
+  return 0
 }
 
 #-------------------------------------------------------------------------