mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
Let XEP-0202 specify the local timezone offset in the config.
This commit is contained in:
parent
ec3a14e6d9
commit
9c5885c6b6
1 changed files with 3 additions and 1 deletions
|
@ -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',
|
||||||
|
|
Loading…
Reference in a new issue