[Vasily Chekalkin] JEP 90 support (Entity Time). Fixes #2239
This commit is contained in:
parent
2785639d52
commit
213e7f095b
2 changed files with 14 additions and 1 deletions
|
@ -24,6 +24,7 @@ import sha
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from time import localtime, strftime, gmtime
|
||||||
from calendar import timegm
|
from calendar import timegm
|
||||||
|
|
||||||
import socks5
|
import socks5
|
||||||
|
@ -1245,6 +1246,16 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
|
||||||
jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who)
|
jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who)
|
||||||
self.dispatch('OS_INFO', (jid_stripped, resource, client_info, os_info))
|
self.dispatch('OS_INFO', (jid_stripped, resource, client_info, os_info))
|
||||||
|
|
||||||
|
def _TimeCB(self, con, iq_obj):
|
||||||
|
gajim.log.debug('TimeCB')
|
||||||
|
iq_obj = iq_obj.buildReply('result')
|
||||||
|
qp = iq_obj.getTag('query')
|
||||||
|
qp.setTagData('utc', strftime("%Y%m%dT%T", gmtime()))
|
||||||
|
qp.setTagData('tz', strftime("%Z", gmtime()))
|
||||||
|
qp.setTagData('display', strftime("%c", localtime()))
|
||||||
|
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'''
|
||||||
|
@ -1841,6 +1852,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
|
||||||
common.xmpp.NS_DISCO_INFO)
|
common.xmpp.NS_DISCO_INFO)
|
||||||
con.RegisterHandler('iq', self._VersionCB, 'get',
|
con.RegisterHandler('iq', self._VersionCB, 'get',
|
||||||
common.xmpp.NS_VERSION)
|
common.xmpp.NS_VERSION)
|
||||||
|
con.RegisterHandler('iq', self._TimeCB, 'get',
|
||||||
|
common.xmpp.NS_TIME)
|
||||||
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',
|
||||||
|
|
|
@ -83,7 +83,7 @@ NS_SIGNED ='jabber:x:signed' # JEP-00
|
||||||
NS_STANZAS ='urn:ietf:params:xml:ns:xmpp-stanzas'
|
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'
|
NS_TIME ='jabber:iq:time' # JEP-0900
|
||||||
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'
|
||||||
|
|
Loading…
Add table
Reference in a new issue