use updated JEP172

This commit is contained in:
Yann Leboulanger 2006-09-07 21:11:50 +00:00
parent dfead3a31c
commit 2352ddfd02
3 changed files with 12 additions and 33 deletions

View File

@ -90,16 +90,6 @@ class Connection(ConnectionHandlers):
self.vcard_supported = True
# END __init__
def build_user_nick(self, user_nick):
df = common.xmpp.DataForm(typ = 'result')
field = df.setField('FORM_TYPE')
field.setType('hidden')
field.setValue(common.xmpp.NS_PROFILE)
field = df.setField('nickname')
field.delAttr('type')
field.setValue(user_nick)
return df
def put_event(self, ev):
if gajim.handlers.has_key(ev[0]):
gajim.handlers[ev[0]](self.name, ev[1])
@ -716,8 +706,8 @@ class Connection(ConnectionHandlers):
# JEP-0172: user_nickname
if user_nick:
df = self.build_user_nick(user_nick)
msg_iq.addChild(node = df)
msg_iq.setTag('nick', namespace = common.xmpp.NS_NICK).setData(
user_nick)
# chatstates - if peer supports jep85 or jep22, send chatstates
# please note that the only valid tag inside a message containing a <body>
@ -792,8 +782,8 @@ class Connection(ConnectionHandlers):
p = common.xmpp.Presence(jid, 'subscribe')
if user_nick:
df = self.build_user_nick(user_nick)
p.addChild(node = df)
msg_iq.setTag('nick', namespace = common.xmpp.NS_NICK).setData(
user_nick)
p = self.add_sha(p)
if msg:
p.setStatus(msg)

View File

@ -1353,15 +1353,9 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
if not msgtxt and chatstate_child.getTag('composing'):
chatstate = 'composing'
# JEP-0172 User Nickname
user_nick = ''
xtags = msg.getTags('x', attrs = {'type': 'result'},
namespace = common.xmpp.NS_DATA)
for xtag in xtags:
df = common.xmpp.DataForm(node = xtag)
field = df.getField('FORM_TYPE')
if not field or field.getValue() != common.xmpp.NS_PROFILE:
continue
user_nick = df.getField('nickname').getValue()
user_nick = msg.getTagData('nick')
if not user_nick:
user_nick = ''
if encTag and GnuPG.USE_GPG:
#decrypt
@ -1443,7 +1437,10 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
is_gc = False # is it a GC presence ?
sigTag = None
avatar_sha = None
user_nick = '' # for JEP-0172
# JEP-0172 User Nickname
user_nick = prs.getTagData('nick')
if not user_nick:
user_nick = ''
transport_auto_auth = False
xtags = prs.getTags('x')
for x in xtags:
@ -1464,15 +1461,6 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
agent = gajim.get_server_from_jid(jid_stripped)
if self.connection.getRoster().getItem(agent): # to be sure it's a transport contact
transport_auto_auth = True
if namespace == common.xmpp.NS_DATA:
# JEP-0172
df = common.xmpp.DataForm(node = x)
if df.getType() != 'result':
continue
field = df.getField('FORM_TYPE')
if not field or field.getValue() != common.xmpp.NS_PROFILE:
continue
user_nick = df.getField('nickname').getValue()
no_log_for = gajim.config.get_per('accounts', self.name,
'no_log_for').split()

View File

@ -62,6 +62,7 @@ NS_MUC ='http://jabber.org/protocol/muc'
NS_MUC_USER =NS_MUC+'#user'
NS_MUC_ADMIN =NS_MUC+'#admin'
NS_MUC_OWNER =NS_MUC+'#owner'
NS_NICK ='http://jabber.org/protocol/nick' # JEP-0172
NS_OFFLINE ='http://www.jabber.org/jeps/jep-0030.html' # JEP-0013
NS_PHYSLOC ='http://jabber.org/protocol/physloc' # JEP-0112
NS_PRESENCE ='presence' # Jabberd2