use updated JEP172
This commit is contained in:
		
							parent
							
								
									dfead3a31c
								
							
						
					
					
						commit
						2352ddfd02
					
				
					 3 changed files with 12 additions and 33 deletions
				
			
		|  | @ -90,16 +90,6 @@ class Connection(ConnectionHandlers): | ||||||
| 		self.vcard_supported = True | 		self.vcard_supported = True | ||||||
| 	# END __init__ | 	# 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): | 	def put_event(self, ev): | ||||||
| 		if gajim.handlers.has_key(ev[0]): | 		if gajim.handlers.has_key(ev[0]): | ||||||
| 			gajim.handlers[ev[0]](self.name, ev[1]) | 			gajim.handlers[ev[0]](self.name, ev[1]) | ||||||
|  | @ -716,8 +706,8 @@ class Connection(ConnectionHandlers): | ||||||
| 
 | 
 | ||||||
| 		# JEP-0172: user_nickname | 		# JEP-0172: user_nickname | ||||||
| 		if user_nick: | 		if user_nick: | ||||||
| 			df = self.build_user_nick(user_nick) | 			msg_iq.setTag('nick', namespace = common.xmpp.NS_NICK).setData( | ||||||
| 			msg_iq.addChild(node = df) | 				user_nick) | ||||||
| 
 | 
 | ||||||
| 		# chatstates - if peer supports jep85 or jep22, send chatstates | 		# chatstates - if peer supports jep85 or jep22, send chatstates | ||||||
| 		# please note that the only valid tag inside a message containing a <body> | 		# 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') | 		p = common.xmpp.Presence(jid, 'subscribe') | ||||||
| 		if user_nick: | 		if user_nick: | ||||||
| 			df = self.build_user_nick(user_nick) | 			msg_iq.setTag('nick', namespace = common.xmpp.NS_NICK).setData( | ||||||
| 			p.addChild(node = df) | 				user_nick) | ||||||
| 		p = self.add_sha(p) | 		p = self.add_sha(p) | ||||||
| 		if msg: | 		if msg: | ||||||
| 			p.setStatus(msg) | 			p.setStatus(msg) | ||||||
|  |  | ||||||
|  | @ -1353,15 +1353,9 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco) | ||||||
| 					if not msgtxt and chatstate_child.getTag('composing'): | 					if not msgtxt and chatstate_child.getTag('composing'): | ||||||
| 						chatstate = 'composing' | 						chatstate = 'composing' | ||||||
| 		# JEP-0172 User Nickname | 		# JEP-0172 User Nickname | ||||||
| 		user_nick = '' | 		user_nick = msg.getTagData('nick') | ||||||
| 		xtags = msg.getTags('x', attrs = {'type': 'result'}, | 		if not user_nick: | ||||||
| 			namespace = common.xmpp.NS_DATA) | 			user_nick = '' | ||||||
| 		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() |  | ||||||
| 		 | 		 | ||||||
| 		if encTag and GnuPG.USE_GPG: | 		if encTag and GnuPG.USE_GPG: | ||||||
| 			#decrypt | 			#decrypt | ||||||
|  | @ -1443,7 +1437,10 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco) | ||||||
| 		is_gc = False # is it a GC presence ? | 		is_gc = False # is it a GC presence ? | ||||||
| 		sigTag = None | 		sigTag = None | ||||||
| 		avatar_sha = 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 | 		transport_auto_auth = False | ||||||
| 		xtags = prs.getTags('x') | 		xtags = prs.getTags('x') | ||||||
| 		for x in xtags: | 		for x in xtags: | ||||||
|  | @ -1464,15 +1461,6 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco) | ||||||
| 				agent = gajim.get_server_from_jid(jid_stripped) | 				agent = gajim.get_server_from_jid(jid_stripped) | ||||||
| 				if self.connection.getRoster().getItem(agent): # to be sure it's a transport contact | 				if self.connection.getRoster().getItem(agent): # to be sure it's a transport contact | ||||||
| 					transport_auto_auth = True | 					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 = gajim.config.get_per('accounts', self.name, | ||||||
| 			'no_log_for').split() | 			'no_log_for').split() | ||||||
|  |  | ||||||
|  | @ -62,6 +62,7 @@ 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_OFFLINE      ='http://www.jabber.org/jeps/jep-0030.html'             # JEP-0013 | NS_OFFLINE      ='http://www.jabber.org/jeps/jep-0030.html'             # JEP-0013 | ||||||
| NS_PHYSLOC      ='http://jabber.org/protocol/physloc'                   # JEP-0112 | NS_PHYSLOC      ='http://jabber.org/protocol/physloc'                   # JEP-0112 | ||||||
| NS_PRESENCE     ='presence'                                             # Jabberd2 | NS_PRESENCE     ='presence'                                             # Jabberd2 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue