Let XEP-0202 specify the local timezone offset in the config.

This commit is contained in:
Lance Stout 2011-07-03 15:41:22 -07:00
parent ec3a14e6d9
commit 9c5885c6b6

View file

@ -32,13 +32,15 @@ class xep_0202(base_plugin):
self.description = 'Entity Time' self.description = 'Entity Time'
self.stanza = stanza self.stanza = stanza
self.tz_offset = self.config.get('tz_offset', 0)
# As a default, respond to time requests with the # As a default, respond to time requests with the
# local time returned by XEP-0082. However, a # local time returned by XEP-0082. However, a
# custom function can be supplied which accepts # custom function can be supplied which accepts
# the JID of the entity to query for the time. # the JID of the entity to query for the time.
self.local_time = self.config.get('local_time', None) self.local_time = self.config.get('local_time', None)
if not self.local_time: if not self.local_time:
self.local_time = lambda x: xep_0082.datetime() self.local_time = lambda x: xep_0082.datetime(offset=self.tz_offset)
self.xmpp.registerHandler( self.xmpp.registerHandler(
Callback('Entity Time', Callback('Entity Time',