Our first use of the userdata registry!

This commit is contained in:
Jeremy Fincher 2004-04-30 18:36:16 +00:00
parent e3b690f933
commit ae542511be

View File

@ -34,7 +34,7 @@ This plugin does weather-related stuff. It can't change the weather, though,
so don't get your hopes up. We just report it.
"""
__revision__ = "$Id"
__revision__ = "$Id$"
import plugins
@ -91,6 +91,13 @@ class Weather(callbacks.Privmsg):
channel = None
if ircutils.isChannel(msg.args[0]):
channel = msg.args[0]
if not args:
s = self.userValue('lastLocation', msg.prefix)
if s:
args = [s]
else:
location = privmsgs.getArgs(args)
self.setUserValue(msg.prefix, 'lastLocation', location)
realCommandName = self.registryValue('command', channel)
realCommand = getattr(self, realCommandName)
realCommand(irc, msg, args)
@ -346,6 +353,9 @@ conf.registerChannelValue(conf.supybot.plugins.Weather, 'convert',
automatically convert weather units to the unit specified in
supybot.plugins.Weather.temperatureUnit."""))
conf.registerUserValue(conf.users.plugins.Weather, 'lastLocation',
registry.String('', ''))
Class = Weather
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: