[elghinn] fix entity time support (xep 90 and 202)

This commit is contained in:
Yann Leboulanger 2007-06-03 14:00:09 +00:00
parent 21a53f70ad
commit 3d4c7bf547
3 changed files with 80 additions and 74 deletions

View File

@ -566,14 +566,14 @@ class Connection(ConnectionHandlers):
iq = common.xmpp.Iq('get', to = pingTo.get_full_jid()) iq = common.xmpp.Iq('get', to = pingTo.get_full_jid())
iq.addChild(name = 'ping', namespace = common.xmpp.NS_PING) iq.addChild(name = 'ping', namespace = common.xmpp.NS_PING)
def _on_response(resp): def _on_response(resp):
timePong = time.time() timePong = time_time()
if not common.xmpp.isResultNode(resp): if not common.xmpp.isResultNode(resp):
self.dispatch('PING_ERROR', (pingTo)) self.dispatch('PING_ERROR', (pingTo))
return return
timeDiff = round(timePong - timePing,2) timeDiff = round(timePong - timePing,2)
self.dispatch('PING_REPLY', (pingTo, timeDiff)) self.dispatch('PING_REPLY', (pingTo, timeDiff))
self.dispatch('PING_SENT', (pingTo)) self.dispatch('PING_SENT', (pingTo))
timePing = time.time() timePing = time_time()
self.connection.SendAndCallForResponse(iq, _on_response) self.connection.SendAndCallForResponse(iq, _on_response)
def get_active_default_lists(self): def get_active_default_lists(self):
@ -850,7 +850,7 @@ class Connection(ConnectionHandlers):
' ([This message is *encrypted* (See :JEP:`27`])' ' ([This message is *encrypted* (See :JEP:`27`])'
else: else:
# Encryption failed, do not send message # Encryption failed, do not send message
tim = time.localtime() tim = localtime()
self.dispatch('MSGNOTSENT', (jid, error, msgtxt, tim)) self.dispatch('MSGNOTSENT', (jid, error, msgtxt, tim))
return 3 return 3
if msgtxt and not xhtml and gajim.config.get( if msgtxt and not xhtml and gajim.config.get(
@ -1264,7 +1264,7 @@ class Connection(ConnectionHandlers):
self.connection.send(p) self.connection.send(p)
# Save the time we quit to avoid duplicate logs AND be faster than # Save the time we quit to avoid duplicate logs AND be faster than
# get that date from DB # get that date from DB
self.last_history_line[jid] = time.time() self.last_history_line[jid] = time_time()
def gc_set_role(self, room_jid, nick, role, reason = ''): def gc_set_role(self, room_jid, nick, role, reason = ''):
'''role is for all the life of the room so it's based on nick''' '''role is for all the life of the room so it's based on nick'''

View File

@ -18,13 +18,13 @@
## ##
import os import os
import time
import base64 import base64
import sha import sha
import socket import socket
import sys import sys
from time import localtime, strftime, gmtime from time import (altzone, daylight, gmtime, localtime, mktime, strftime,
strptime, time as time_time, timezone, tzname)
from calendar import timegm from calendar import timegm
import socks5 import socks5
@ -412,7 +412,7 @@ class ConnectionBytestream:
def _ResultCB(self, con, iq_obj): def _ResultCB(self, con, iq_obj):
gajim.log.debug('_ResultCB') gajim.log.debug('_ResultCB')
# if we want to respect jep-0065 we have to check for proxy # if we want to respect xep-0065 we have to check for proxy
# activation result in any result iq # activation result in any result iq
real_id = unicode(iq_obj.getAttr('id')) real_id = unicode(iq_obj.getAttr('id'))
if real_id[:3] != 'au_': if real_id[:3] != 'au_':
@ -586,12 +586,12 @@ class ConnectionBytestream:
class ConnectionDisco: class ConnectionDisco:
''' hold xmpppy handlers and public methods for discover services''' ''' hold xmpppy handlers and public methods for discover services'''
def discoverItems(self, jid, node = None, id_prefix = None): def discoverItems(self, jid, node = None, id_prefix = None):
'''According to JEP-0030: jid is mandatory, '''According to XEP-0030: jid is mandatory,
name, node, action is optional.''' name, node, action is optional.'''
self._discover(common.xmpp.NS_DISCO_ITEMS, jid, node, id_prefix) self._discover(common.xmpp.NS_DISCO_ITEMS, jid, node, id_prefix)
def discoverInfo(self, jid, node = None, id_prefix = None): def discoverInfo(self, jid, node = None, id_prefix = None):
'''According to JEP-0030: '''According to XEP-0030:
For identity: category, type is mandatory, name is optional. For identity: category, type is mandatory, name is optional.
For feature: var is mandatory''' For feature: var is mandatory'''
self._discover(common.xmpp.NS_DISCO_INFO, jid, node, id_prefix) self._discover(common.xmpp.NS_DISCO_INFO, jid, node, id_prefix)
@ -738,6 +738,9 @@ class ConnectionDisco:
if (node is None or extension == 'xhtml') and not gajim.config.get('ignore_incoming_xhtml'): if (node is None or extension == 'xhtml') and not gajim.config.get('ignore_incoming_xhtml'):
q.addChild('feature', attrs = {'var': common.xmpp.NS_XHTML_IM}) q.addChild('feature', attrs = {'var': common.xmpp.NS_XHTML_IM})
if node is None:
q.addChild('feature', attrs = {'var': common.xmpp.NS_TIME_REVISED})
if q.getChildren(): if q.getChildren():
self.connection.send(iq) self.connection.send(iq)
raise common.xmpp.NodeProcessed raise common.xmpp.NodeProcessed
@ -749,7 +752,7 @@ class ConnectionDisco:
def _DiscoverInfoCB(self, con, iq_obj): def _DiscoverInfoCB(self, con, iq_obj):
gajim.log.debug('DiscoverInfoCB') gajim.log.debug('DiscoverInfoCB')
# According to JEP-0030: # According to XEP-0030:
# For identity: category, type is mandatory, name is optional. # For identity: category, type is mandatory, name is optional.
# For feature: var is mandatory # For feature: var is mandatory
identities, features, data = [], [], [] identities, features, data = [], [], []
@ -822,7 +825,7 @@ class ConnectionVcard:
return p return p
def add_caps(self, p): def add_caps(self, p):
''' advertise our capabilities in presence stanza (jep-0115)''' ''' advertise our capabilities in presence stanza (xep-0115)'''
c = p.setTag('c', namespace = common.xmpp.NS_CAPS) c = p.setTag('c', namespace = common.xmpp.NS_CAPS)
c.setAttr('node', 'http://gajim.org/caps') c.setAttr('node', 'http://gajim.org/caps')
ext = [] ext = []
@ -1034,7 +1037,7 @@ class ConnectionVcard:
elif self.awaiting_answers[id][0] == METACONTACTS_ARRIVED: elif self.awaiting_answers[id][0] == METACONTACTS_ARRIVED:
if iq_obj.getType() == 'result': if iq_obj.getType() == 'result':
# Metacontact tags # Metacontact tags
# http://www.jabber.org/jeps/jep-XXXX.html # http://www.xmpp.org/extensions/xep-0209.html
meta_list = {} meta_list = {}
query = iq_obj.getTag('query') query = iq_obj.getTag('query')
storage = query.getTag('storage') storage = query.getTag('storage')
@ -1212,7 +1215,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
def _PrivateCB(self, con, iq_obj): def _PrivateCB(self, con, iq_obj):
''' '''
Private Data (JEP 048 and 049) Private Data (XEP 048 and 049)
''' '''
gajim.log.debug('PrivateCB') gajim.log.debug('PrivateCB')
query = iq_obj.getTag('query') query = iq_obj.getTag('query')
@ -1221,7 +1224,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
ns = storage.getNamespace() ns = storage.getNamespace()
if ns == 'storage:bookmarks': if ns == 'storage:bookmarks':
# Bookmarked URLs and Conferences # Bookmarked URLs and Conferences
# http://www.jabber.org/jeps/jep-0048.html # http://www.xmpp.org/extensions/xep-0048.html
confs = storage.getTags('conference') confs = storage.getTags('conference')
for conf in confs: for conf in confs:
autojoin_val = conf.getAttr('autojoin') autojoin_val = conf.getAttr('autojoin')
@ -1242,7 +1245,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
elif ns == 'gajim:prefs': elif ns == 'gajim:prefs':
# Preferences data # Preferences data
# http://www.jabber.org/jeps/jep-0049.html # http://www.xmpp.org/extensions/xep-0049.html
#TODO: implement this #TODO: implement this
pass pass
elif ns == 'storage:rosternotes': elif ns == 'storage:rosternotes':
@ -1262,7 +1265,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
ns = storage_tag.getNamespace() ns = storage_tag.getNamespace()
if ns == 'storage:metacontacts': if ns == 'storage:metacontacts':
self.metacontacts_supported = False self.metacontacts_supported = False
# Private XML Storage (JEP49) is not supported by server # Private XML Storage (XEP49) is not supported by server
# Continue connecting # Continue connecting
self.connection.initRoster() self.connection.initRoster()
@ -1335,18 +1338,21 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
gajim.log.debug('TimeCB') gajim.log.debug('TimeCB')
iq_obj = iq_obj.buildReply('result') iq_obj = iq_obj.buildReply('result')
qp = iq_obj.getTag('query') qp = iq_obj.getTag('query')
qp.setTagData('utc', strftime("%Y%m%dT%T", gmtime())) qp.setTagData('utc', strftime('%Y%m%dT%T', gmtime()))
qp.setTagData('tz', strftime("%Z", gmtime())) qp.setTagData('tz', tzname[daylight])
qp.setTagData('display', strftime("%c", localtime())) qp.setTagData('display', strftime('%c', localtime()))
self.connection.send(iq_obj) self.connection.send(iq_obj)
raise common.xmpp.NodeProcessed raise common.xmpp.NodeProcessed
def _TimeRevisedCB(self, con, iq_obj): def _TimeRevisedCB(self, con, iq_obj):
gajim.log.debug('TimeRevisedCB') gajim.log.debug('TimeRevisedCB')
iq_obj = iq_obj.buildReply('result') iq_obj = iq_obj.buildReply('result')
qp = iq_obj.setTag('time') qp = iq_obj.setTag('time',
qp.setTagData('utc', strftime("%Y-%m-%dT%TZ", gmtime())) namespace=common.xmpp.NS_TIME_REVISED)
qp.setTagData('tzo', "%+03d:00"% (-time.timezone/(60*60))) qp.setTagData('utc', strftime('%Y-%m-%dT%TZ', gmtime()))
zone = -(timezone, altzone)[daylight] / 60
tzo = (zone / 60, abs(zone % 60))
qp.setTagData('tzo', '%+03d:%02d' % (tzo))
self.connection.send(iq_obj) self.connection.send(iq_obj)
raise common.xmpp.NodeProcessed raise common.xmpp.NodeProcessed
@ -1408,8 +1414,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
mtype = msg.getType() mtype = msg.getType()
subject = msg.getSubject() # if not there, it's None subject = msg.getSubject() # if not there, it's None
tim = msg.getTimestamp() tim = msg.getTimestamp()
tim = time.strptime(tim, '%Y%m%dT%H:%M:%S') tim = strptime(tim, '%Y%m%dT%H:%M:%S')
tim = time.localtime(timegm(tim)) tim = localtime(timegm(tim))
frm = helpers.get_full_jid_from_iq(msg) frm = helpers.get_full_jid_from_iq(msg)
jid = helpers.get_jid_from_iq(msg) jid = helpers.get_jid_from_iq(msg)
no_log_for = gajim.config.get_per('accounts', self.name, no_log_for = gajim.config.get_per('accounts', self.name,
@ -1429,10 +1435,10 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
invite = None invite = None
delayed = msg.getTag('x', namespace = common.xmpp.NS_DELAY) != None delayed = msg.getTag('x', namespace = common.xmpp.NS_DELAY) != None
msg_id = None msg_id = None
composing_jep = None composing_xep = None
# FIXME: Msn transport (CMSN1.2.1 and PyMSN0.10) do NOT RECOMMENDED # FIXME: Msn transport (CMSN1.2.1 and PyMSN0.10) do NOT RECOMMENDED
# invitation # invitation
# stanza (MUC JEP) remove in 2007, as we do not do NOT RECOMMENDED # stanza (MUC XEP) remove in 2007, as we do not do NOT RECOMMENDED
xtags = msg.getTags('x') xtags = msg.getTags('x')
for xtag in xtags: for xtag in xtags:
if xtag.getNamespace() == common.xmpp.NS_CONFERENCE and not invite: if xtag.getNamespace() == common.xmpp.NS_CONFERENCE and not invite:
@ -1441,22 +1447,22 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
return return
# chatstates - look for chatstate tags in a message if not delayed # chatstates - look for chatstate tags in a message if not delayed
if not delayed: if not delayed:
composing_jep = False composing_xep = False
children = msg.getChildren() children = msg.getChildren()
for child in children: for child in children:
if child.getNamespace() == 'http://jabber.org/protocol/chatstates': if child.getNamespace() == 'http://jabber.org/protocol/chatstates':
chatstate = child.getName() chatstate = child.getName()
composing_jep = 'JEP-0085' composing_xep = 'XEP-0085'
break break
# No JEP-0085 support, fallback to JEP-0022 # No XEP-0085 support, fallback to XEP-0022
if not chatstate: if not chatstate:
chatstate_child = msg.getTag('x', namespace = common.xmpp.NS_EVENT) chatstate_child = msg.getTag('x', namespace = common.xmpp.NS_EVENT)
if chatstate_child: if chatstate_child:
chatstate = 'active' chatstate = 'active'
composing_jep = 'JEP-0022' composing_xep = 'XEP-0022'
if not msgtxt and chatstate_child.getTag('composing'): if not msgtxt and chatstate_child.getTag('composing'):
chatstate = 'composing' chatstate = 'composing'
# JEP-0172 User Nickname # XEP-0172 User Nickname
user_nick = msg.getTagData('nick') user_nick = msg.getTagData('nick')
if not user_nick: if not user_nick:
user_nick = '' user_nick = ''
@ -1495,7 +1501,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
if not self.last_history_line.has_key(jid): if not self.last_history_line.has_key(jid):
return return
self.dispatch('GC_MSG', (frm, msgtxt, tim, has_timestamp, msghtml)) self.dispatch('GC_MSG', (frm, msgtxt, tim, has_timestamp, msghtml))
if self.name not in no_log_for and not int(float(time.mktime(tim)))\ if self.name not in no_log_for and not int(float(mktime(tim)))\
<= self.last_history_line[jid] and msgtxt: <= self.last_history_line[jid] and msgtxt:
gajim.logger.write('gc_msg', frm, msgtxt, tim = tim) gajim.logger.write('gc_msg', frm, msgtxt, tim = tim)
return return
@ -1523,7 +1529,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
if treat_as: if treat_as:
mtype = treat_as mtype = treat_as
self.dispatch('MSG', (frm, msgtxt, tim, encrypted, mtype, self.dispatch('MSG', (frm, msgtxt, tim, encrypted, mtype,
subject, chatstate, msg_id, composing_jep, user_nick, msghtml)) subject, chatstate, msg_id, composing_xep, user_nick, msghtml))
# END messageCB # END messageCB
def _pubsubEventCB(self, con, msg): def _pubsubEventCB(self, con, msg):
@ -1578,7 +1584,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
sigTag = None sigTag = None
ns_muc_user_x = None ns_muc_user_x = None
avatar_sha = None avatar_sha = None
# JEP-0172 User Nickname # XEP-0172 User Nickname
user_nick = prs.getTagData('nick') user_nick = prs.getTagData('nick')
if not user_nick: if not user_nick:
user_nick = '' user_nick = ''
@ -1597,10 +1603,10 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
avatar_sha = x.getTagData('photo') avatar_sha = x.getTagData('photo')
contact_nickname = x.getTagData('nickname') contact_nickname = x.getTagData('nickname')
elif namespace == common.xmpp.NS_DELAY: elif namespace == common.xmpp.NS_DELAY:
# JEP-0091 # XEP-0091
tim = prs.getTimestamp() tim = prs.getTimestamp()
tim = time.strptime(tim, '%Y%m%dT%H:%M:%S') tim = strptime(tim, '%Y%m%dT%H:%M:%S')
timestamp = time.localtime(timegm(tim)) timestamp = localtime(timegm(tim))
elif namespace == 'http://delx.cjb.net/protocol/roster-subsync': elif namespace == 'http://delx.cjb.net/protocol/roster-subsync':
# see http://trac.gajim.org/ticket/326 # see http://trac.gajim.org/ticket/326
agent = gajim.get_server_from_jid(jid_stripped) agent = gajim.get_server_from_jid(jid_stripped)
@ -1732,10 +1738,10 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
# detect a subscription loop # detect a subscription loop
if not self.subscribed_events.has_key(jid_stripped): if not self.subscribed_events.has_key(jid_stripped):
self.subscribed_events[jid_stripped] = [] self.subscribed_events[jid_stripped] = []
self.subscribed_events[jid_stripped].append(time.time()) self.subscribed_events[jid_stripped].append(time_time())
block = False block = False
if len(self.subscribed_events[jid_stripped]) > 5: if len(self.subscribed_events[jid_stripped]) > 5:
if time.time() - self.subscribed_events[jid_stripped][0] < 5: if time_time() - self.subscribed_events[jid_stripped][0] < 5:
block = True block = True
self.subscribed_events[jid_stripped] = self.subscribed_events[jid_stripped][1:] self.subscribed_events[jid_stripped] = self.subscribed_events[jid_stripped][1:]
if block: if block:
@ -1752,10 +1758,10 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
# detect a unsubscription loop # detect a unsubscription loop
if not self.subscribed_events.has_key(jid_stripped): if not self.subscribed_events.has_key(jid_stripped):
self.subscribed_events[jid_stripped] = [] self.subscribed_events[jid_stripped] = []
self.subscribed_events[jid_stripped].append(time.time()) self.subscribed_events[jid_stripped].append(time_time())
block = False block = False
if len(self.subscribed_events[jid_stripped]) > 5: if len(self.subscribed_events[jid_stripped]) > 5:
if time.time() - self.subscribed_events[jid_stripped][0] < 5: if time_time() - self.subscribed_events[jid_stripped][0] < 5:
block = True block = True
self.subscribed_events[jid_stripped] = self.subscribed_events[jid_stripped][1:] self.subscribed_events[jid_stripped] = self.subscribed_events[jid_stripped][1:]
if block: if block:

View File

@ -21,71 +21,71 @@ xmpp-related data structures.
from simplexml import Node,NodeBuilder,ustr from simplexml import Node,NodeBuilder,ustr
import time import time
NS_ACTIVITY ='http://jabber.org/protocol/activity' # JEP-0108 NS_ACTIVITY ='http://jabber.org/protocol/activity' # XEP-0108
NS_ADDRESS ='http://jabber.org/protocol/address' # JEP-0033 NS_ADDRESS ='http://jabber.org/protocol/address' # XEP-0033
NS_AGENTS ='jabber:iq:agents' NS_AGENTS ='jabber:iq:agents'
NS_AMP ='http://jabber.org/protocol/amp' NS_AMP ='http://jabber.org/protocol/amp'
NS_AMP_ERRORS =NS_AMP+'#errors' NS_AMP_ERRORS =NS_AMP+'#errors'
NS_AUTH ='jabber:iq:auth' NS_AUTH ='jabber:iq:auth'
NS_BIND ='urn:ietf:params:xml:ns:xmpp-bind' NS_BIND ='urn:ietf:params:xml:ns:xmpp-bind'
NS_BROWSE ='jabber:iq:browse' NS_BROWSE ='jabber:iq:browse'
NS_BYTESTREAM ='http://jabber.org/protocol/bytestreams' # JEP-0065 NS_BYTESTREAM ='http://jabber.org/protocol/bytestreams' # XEP-0065
NS_CAPS ='http://jabber.org/protocol/caps' # JEP-0115 NS_CAPS ='http://jabber.org/protocol/caps' # XEP-0115
NS_CHATSTATES ='http://jabber.org/protocol/chatstates' # JEP-0085 NS_CHATSTATES ='http://jabber.org/protocol/chatstates' # XEP-0085
NS_CLIENT ='jabber:client' NS_CLIENT ='jabber:client'
NS_COMMANDS ='http://jabber.org/protocol/commands' NS_COMMANDS ='http://jabber.org/protocol/commands'
NS_COMPONENT_ACCEPT='jabber:component:accept' NS_COMPONENT_ACCEPT='jabber:component:accept'
NS_COMPONENT_1 ='http://jabberd.jabberstudio.org/ns/component/1.0' NS_COMPONENT_1 ='http://jabberd.jabberstudio.org/ns/component/1.0'
NS_COMPRESS ='http://jabber.org/protocol/compress' # JEP-0138 NS_COMPRESS ='http://jabber.org/protocol/compress' # XEP-0138
NS_CONFERENCE ='jabber:x:conference' NS_CONFERENCE ='jabber:x:conference'
NS_DATA ='jabber:x:data' # JEP-0004 NS_DATA ='jabber:x:data' # XEP-0004
NS_DELAY ='jabber:x:delay' NS_DELAY ='jabber:x:delay'
NS_DIALBACK ='jabber:server:dialback' NS_DIALBACK ='jabber:server:dialback'
NS_DISCO ='http://jabber.org/protocol/disco' NS_DISCO ='http://jabber.org/protocol/disco'
NS_DISCO_INFO =NS_DISCO+'#info' NS_DISCO_INFO =NS_DISCO+'#info'
NS_DISCO_ITEMS =NS_DISCO+'#items' NS_DISCO_ITEMS =NS_DISCO+'#items'
NS_ENCRYPTED ='jabber:x:encrypted' # JEP-0027 NS_ENCRYPTED ='jabber:x:encrypted' # XEP-0027
NS_EVENT ='jabber:x:event' # JEP-0022 NS_EVENT ='jabber:x:event' # XEP-0022
NS_FEATURE ='http://jabber.org/protocol/feature-neg' NS_FEATURE ='http://jabber.org/protocol/feature-neg'
NS_FILE ='http://jabber.org/protocol/si/profile/file-transfer' # JEP-0096 NS_FILE ='http://jabber.org/protocol/si/profile/file-transfer' # XEP-0096
NS_GEOLOC ='http://jabber.org/protocol/geoloc' # JEP-0080 NS_GEOLOC ='http://jabber.org/protocol/geoloc' # XEP-0080
NS_GROUPCHAT ='gc-1.0' NS_GROUPCHAT ='gc-1.0'
NS_HTTP_AUTH ='http://jabber.org/protocol/http-auth' # JEP-0070 NS_HTTP_AUTH ='http://jabber.org/protocol/http-auth' # XEP-0070
NS_HTTP_BIND ='http://jabber.org/protocol/httpbind' # JEP-0124 NS_HTTP_BIND ='http://jabber.org/protocol/httpbind' # XEP-0124
NS_IBB ='http://jabber.org/protocol/ibb' NS_IBB ='http://jabber.org/protocol/ibb'
NS_INVISIBLE ='presence-invisible' # Jabberd2 NS_INVISIBLE ='presence-invisible' # Jabberd2
NS_IQ ='iq' # Jabberd2 NS_IQ ='iq' # Jabberd2
NS_LAST ='jabber:iq:last' NS_LAST ='jabber:iq:last'
NS_MESSAGE ='message' # Jabberd2 NS_MESSAGE ='message' # Jabberd2
NS_MOOD ='http://jabber.org/protocol/mood' # JEP-0107 NS_MOOD ='http://jabber.org/protocol/mood' # XEP-0107
NS_MUC ='http://jabber.org/protocol/muc' NS_MUC ='http://jabber.org/protocol/muc'
NS_MUC_USER =NS_MUC+'#user' NS_MUC_USER =NS_MUC+'#user'
NS_MUC_ADMIN =NS_MUC+'#admin' NS_MUC_ADMIN =NS_MUC+'#admin'
NS_MUC_OWNER =NS_MUC+'#owner' NS_MUC_OWNER =NS_MUC+'#owner'
NS_NICK ='http://jabber.org/protocol/nick' # JEP-0172 NS_NICK ='http://jabber.org/protocol/nick' # XEP-0172
NS_OFFLINE ='http://www.jabber.org/jeps/jep-0030.html' # JEP-0013 NS_OFFLINE ='http://www.jabber.org/jeps/jep-0030.html' # XEP-0013
NS_PHYSLOC ='http://jabber.org/protocol/physloc' # JEP-0112 NS_PHYSLOC ='http://jabber.org/protocol/physloc' # XEP-0112
NS_PRESENCE ='presence' # Jabberd2 NS_PRESENCE ='presence' # Jabberd2
NS_PRIVACY ='jabber:iq:privacy' NS_PRIVACY ='jabber:iq:privacy'
NS_PRIVATE ='jabber:iq:private' NS_PRIVATE ='jabber:iq:private'
NS_PROFILE ='http://jabber.org/protocol/profile' # JEP-0154 NS_PROFILE ='http://jabber.org/protocol/profile' # XEP-0154
NS_PUBSUB ='http://jabber.org/protocol/pubsub' # JEP-0060 NS_PUBSUB ='http://jabber.org/protocol/pubsub' # XEP-0060
NS_REGISTER ='jabber:iq:register' NS_REGISTER ='jabber:iq:register'
NS_ROSTER ='jabber:iq:roster' NS_ROSTER ='jabber:iq:roster'
NS_ROSTERX ='http://jabber.org/protocol/rosterx' # JEP-0144 NS_ROSTERX ='http://jabber.org/protocol/rosterx' # XEP-0144
NS_RPC ='jabber:iq:rpc' # JEP-0009 NS_RPC ='jabber:iq:rpc' # XEP-0009
NS_SASL ='urn:ietf:params:xml:ns:xmpp-sasl' NS_SASL ='urn:ietf:params:xml:ns:xmpp-sasl'
NS_SEARCH ='jabber:iq:search' NS_SEARCH ='jabber:iq:search'
NS_SERVER ='jabber:server' NS_SERVER ='jabber:server'
NS_SESSION ='urn:ietf:params:xml:ns:xmpp-session' NS_SESSION ='urn:ietf:params:xml:ns:xmpp-session'
NS_SI ='http://jabber.org/protocol/si' # JEP-0096 NS_SI ='http://jabber.org/protocol/si' # XEP-0096
NS_SI_PUB ='http://jabber.org/protocol/sipub' # JEP-0137 NS_SI_PUB ='http://jabber.org/protocol/sipub' # XEP-0137
NS_SIGNED ='jabber:x:signed' # JEP-0027 NS_SIGNED ='jabber:x:signed' # XEP-0027
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' # JEP-0900 NS_TIME ='jabber:iq:time' # XEP-0900
NS_TIME_REVISED ='http://www.xmpp.org/extensions/xep-0202.html#ns' # JEP-0202 NS_TIME_REVISED ='urn:xmpp:time' # XEP-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'
@ -94,11 +94,11 @@ NS_GTALKSETTING ='google:setting'
NS_VCARD_UPDATE =NS_VCARD+':x:update' NS_VCARD_UPDATE =NS_VCARD+':x:update'
NS_VERSION ='jabber:iq:version' NS_VERSION ='jabber:iq:version'
NS_PING ='urn:xmpp:ping' # XEP-0199 NS_PING ='urn:xmpp:ping' # XEP-0199
NS_WAITINGLIST ='http://jabber.org/protocol/waitinglist' # JEP-0130 NS_WAITINGLIST ='http://jabber.org/protocol/waitinglist' # XEP-0130
NS_XHTML_IM ='http://jabber.org/protocol/xhtml-im' # JEP-0071 NS_XHTML_IM ='http://jabber.org/protocol/xhtml-im' # XEP-0071
NS_XHTML = 'http://www.w3.org/1999/xhtml' # " NS_XHTML = 'http://www.w3.org/1999/xhtml' # "
NS_DATA_LAYOUT ='http://jabber.org/protocol/xdata-layout' # JEP-0141 NS_DATA_LAYOUT ='http://jabber.org/protocol/xdata-layout' # XEP-0141
NS_DATA_VALIDATE='http://jabber.org/protocol/xdata-validate' # JEP-0122 NS_DATA_VALIDATE='http://jabber.org/protocol/xdata-validate' # XEP-0122
NS_XMPP_STREAMS ='urn:ietf:params:xml:ns:xmpp-streams' NS_XMPP_STREAMS ='urn:ietf:params:xml:ns:xmpp-streams'
xmpp_stream_error_conditions=""" xmpp_stream_error_conditions="""
@ -422,7 +422,7 @@ class Message(Protocol):
self.setTagData('body',val) self.setTagData('body',val)
def setXHTML(self,val,xmllang=None): def setXHTML(self,val,xmllang=None):
""" Sets the xhtml text of the message (JEP-0071). """ Sets the xhtml text of the message (XEP-0071).
The parameter is the "inner html" to the body.""" The parameter is the "inner html" to the body."""
try: try:
if xmllang: if xmllang:
@ -590,7 +590,7 @@ class Error(Protocol):
class DataField(Node): class DataField(Node):
""" This class is used in the DataForm class to describe the single data item. """ This class is used in the DataForm class to describe the single data item.
If you are working with jabber:x:data (JEP-0004, JEP-0068, JEP-0122) If you are working with jabber:x:data (XEP-0004, XEP-0068, XEP-0122)
then you will need to work with instances of this class. """ then you will need to work with instances of this class. """
def __init__(self,name=None,value=None,typ=None,required=0,desc=None,options=[],node=None): def __init__(self,name=None,value=None,typ=None,required=0,desc=None,options=[],node=None):
""" Create new data field of specified name,value and type. """ Create new data field of specified name,value and type.
@ -667,7 +667,7 @@ class DataField(Node):
class DataForm(Node): class DataForm(Node):
""" DataForm class. Used for manipulating dataforms in XMPP. """ DataForm class. Used for manipulating dataforms in XMPP.
Relevant JEPs: 0004, 0068, 0122. Relevant XEPs: 0004, 0068, 0122.
Can be used in disco, pub-sub and many other applications.""" Can be used in disco, pub-sub and many other applications."""
def __init__(self, typ=None, data=[], title=None, node=None): def __init__(self, typ=None, data=[], title=None, node=None):
""" """