[misc] XEP-0202 (Entity Time) support. fixes #2830
This commit is contained in:
parent
4b97963abb
commit
70bf104cfc
|
@ -24,7 +24,7 @@ import sha
|
|||
import socket
|
||||
import sys
|
||||
|
||||
from time import localtime, strftime, gmtime
|
||||
from time import localtime, strftime, gmtime, timezone
|
||||
from calendar import timegm
|
||||
|
||||
import socks5
|
||||
|
@ -1314,7 +1314,15 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
|||
self.connection.send(iq_obj)
|
||||
raise common.xmpp.NodeProcessed
|
||||
|
||||
|
||||
def _TimeRevisedCB(self, con, iq_obj):
|
||||
gajim.log.debug('TimeRevisedCB')
|
||||
iq_obj = iq_obj.buildReply('result')
|
||||
qp = iq_obj.setTag('time')
|
||||
qp.setTagData('utc', strftime("%Y-%m-%dT%TZ", gmtime()))
|
||||
qp.setTagData('tzo', "%+03d:00"% (time.timezone/(60*60)))
|
||||
self.connection.send(iq_obj)
|
||||
raise common.xmpp.NodeProcessed
|
||||
|
||||
def _gMailNewMailCB(self, con, gm):
|
||||
'''Called when we get notified of new mail messages in gmail account'''
|
||||
if not gm.getTag('new-mail'):
|
||||
|
@ -1962,6 +1970,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
|||
common.xmpp.NS_VERSION)
|
||||
con.RegisterHandler('iq', self._TimeCB, 'get',
|
||||
common.xmpp.NS_TIME)
|
||||
con.RegisterHandler('iq', self._TimeRevisedCB, 'get',
|
||||
common.xmpp.NS_TIME_REVISED)
|
||||
con.RegisterHandler('iq', self._LastCB, 'get',
|
||||
common.xmpp.NS_LAST)
|
||||
con.RegisterHandler('iq', self._LastResultCB, 'result',
|
||||
|
|
|
@ -85,6 +85,7 @@ NS_STANZAS ='urn:ietf:params:xml:ns:xmpp-stanzas'
|
|||
NS_STREAM ='http://affinix.com/jabber/stream'
|
||||
NS_STREAMS ='http://etherx.jabber.org/streams'
|
||||
NS_TIME ='jabber:iq:time' # JEP-0900
|
||||
NS_TIME_REVISED ='http://www.xmpp.org/extensions/xep-0202.html#ns' # JEP-0202
|
||||
NS_TLS ='urn:ietf:params:xml:ns:xmpp-tls'
|
||||
NS_VACATION ='http://jabber.org/protocol/vacation'
|
||||
NS_VCARD ='vcard-temp'
|
||||
|
|
Loading…
Reference in New Issue