diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 9d7b08af1..efa88b5dd 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -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', diff --git a/src/common/xmpp/protocol.py b/src/common/xmpp/protocol.py index daf309773..735642cb0 100644 --- a/src/common/xmpp/protocol.py +++ b/src/common/xmpp/protocol.py @@ -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'