[misc] XEP-0202 (Entity Time) support. fixes #2830

This commit is contained in:
Yann Leboulanger 2006-12-28 16:27:41 +00:00
parent 4b97963abb
commit 70bf104cfc
2 changed files with 13 additions and 2 deletions

View File

@ -24,7 +24,7 @@ import sha
import socket import socket
import sys import sys
from time import localtime, strftime, gmtime from time import localtime, strftime, gmtime, timezone
from calendar import timegm from calendar import timegm
import socks5 import socks5
@ -1314,7 +1314,15 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
self.connection.send(iq_obj) self.connection.send(iq_obj)
raise common.xmpp.NodeProcessed 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): def _gMailNewMailCB(self, con, gm):
'''Called when we get notified of new mail messages in gmail account''' '''Called when we get notified of new mail messages in gmail account'''
if not gm.getTag('new-mail'): if not gm.getTag('new-mail'):
@ -1962,6 +1970,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
common.xmpp.NS_VERSION) common.xmpp.NS_VERSION)
con.RegisterHandler('iq', self._TimeCB, 'get', con.RegisterHandler('iq', self._TimeCB, 'get',
common.xmpp.NS_TIME) common.xmpp.NS_TIME)
con.RegisterHandler('iq', self._TimeRevisedCB, 'get',
common.xmpp.NS_TIME_REVISED)
con.RegisterHandler('iq', self._LastCB, 'get', con.RegisterHandler('iq', self._LastCB, 'get',
common.xmpp.NS_LAST) common.xmpp.NS_LAST)
con.RegisterHandler('iq', self._LastResultCB, 'result', con.RegisterHandler('iq', self._LastResultCB, 'result',

View File

@ -85,6 +85,7 @@ NS_STANZAS ='urn:ietf:params:xml:ns:xmpp-stanzas'
NS_STREAM ='http://affinix.com/jabber/stream' NS_STREAM ='http://affinix.com/jabber/stream'
NS_STREAMS ='http://etherx.jabber.org/streams' NS_STREAMS ='http://etherx.jabber.org/streams'
NS_TIME ='jabber:iq:time' # JEP-0900 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_TLS ='urn:ietf:params:xml:ns:xmpp-tls'
NS_VACATION ='http://jabber.org/protocol/vacation' NS_VACATION ='http://jabber.org/protocol/vacation'
NS_VCARD ='vcard-temp' NS_VCARD ='vcard-temp'