when we receive an empty vcard, we send an empty vcard to the interface so that it knows it arrived
This commit is contained in:
		
							parent
							
								
									b3d80edfb9
								
							
						
					
					
						commit
						258c0541e0
					
				
					 2 changed files with 23 additions and 4 deletions
				
			
		| 
						 | 
					@ -21,6 +21,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# kind of events we can wait for an answer
 | 
					# kind of events we can wait for an answer
 | 
				
			||||||
VCARD_PUBLISHED = 'vcard_published'
 | 
					VCARD_PUBLISHED = 'vcard_published'
 | 
				
			||||||
 | 
					VCARD_ARRIVED = 'vcard_arrived'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import sha
 | 
					import sha
 | 
				
			||||||
| 
						 | 
					@ -1423,6 +1424,16 @@ class Connection:
 | 
				
			||||||
					self.to_be_sent.append(p)
 | 
										self.to_be_sent.append(p)
 | 
				
			||||||
			elif iq_obj.getType() == 'error':
 | 
								elif iq_obj.getType() == 'error':
 | 
				
			||||||
				self.dispatch('VCARD_NOT_PUBLISHED', ())
 | 
									self.dispatch('VCARD_NOT_PUBLISHED', ())
 | 
				
			||||||
 | 
							elif self.awaiting_answers[id][0] == VCARD_ARRIVED:
 | 
				
			||||||
 | 
								# If vcard is empty, we send to the interface an empty vcard so that
 | 
				
			||||||
 | 
								# it knows it arrived
 | 
				
			||||||
 | 
								if not iq_obj.getTag('vCard'):
 | 
				
			||||||
 | 
									jid = self.awaiting_answers[id][1]
 | 
				
			||||||
 | 
									our_jid = gajim.get_jid_from_account(self.name)
 | 
				
			||||||
 | 
									if not jid or jid == our_jid:
 | 
				
			||||||
 | 
										self.dispatch('MYVCARD', {'jid': our_jid})
 | 
				
			||||||
 | 
									else:
 | 
				
			||||||
 | 
										self.dispatch('VCARD', {'jid': jid})
 | 
				
			||||||
		del self.awaiting_answers[id]
 | 
							del self.awaiting_answers[id]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def _event_dispatcher(self, realm, event, data):
 | 
						def _event_dispatcher(self, realm, event, data):
 | 
				
			||||||
| 
						 | 
					@ -2064,6 +2075,10 @@ class Connection:
 | 
				
			||||||
		if jid:
 | 
							if jid:
 | 
				
			||||||
			iq.setTo(jid)
 | 
								iq.setTo(jid)
 | 
				
			||||||
		iq.setTag(common.xmpp.NS_VCARD + ' vCard')
 | 
							iq.setTag(common.xmpp.NS_VCARD + ' vCard')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							id = self.connection.getAnID()
 | 
				
			||||||
 | 
							iq.setID(id)
 | 
				
			||||||
 | 
							self.awaiting_answers[id] = (VCARD_ARRIVED, jid)
 | 
				
			||||||
		self.to_be_sent.append(iq)
 | 
							self.to_be_sent.append(iq)
 | 
				
			||||||
			#('VCARD', {entry1: data, entry2: {entry21: data, ...}, ...})
 | 
								#('VCARD', {entry1: data, entry2: {entry21: data, ...}, ...})
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										10
									
								
								src/gajim.py
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/gajim.py
									
										
									
									
									
								
							| 
						 | 
					@ -265,7 +265,7 @@ class Interface:
 | 
				
			||||||
		self.roster.on_status_changed(account, status)
 | 
							self.roster.on_status_changed(account, status)
 | 
				
			||||||
		if account in self.show_vcard_when_connect:
 | 
							if account in self.show_vcard_when_connect:
 | 
				
			||||||
			jid = gajim.get_jid_from_account(account)
 | 
								jid = gajim.get_jid_from_account(account)
 | 
				
			||||||
			if not self.instances[account]['infos'].has_key('vcard'):
 | 
								if not self.instances[account]['infos'].has_key(jid):
 | 
				
			||||||
				self.instances[account]['infos'][jid] = \
 | 
									self.instances[account]['infos'][jid] = \
 | 
				
			||||||
					vcard.VcardWindow(jid, account, True)
 | 
										vcard.VcardWindow(jid, account, True)
 | 
				
			||||||
				gajim.connections[account].request_vcard(jid)
 | 
									gajim.connections[account].request_vcard(jid)
 | 
				
			||||||
| 
						 | 
					@ -651,13 +651,16 @@ class Interface:
 | 
				
			||||||
		# ('VCARD', account, data)
 | 
							# ('VCARD', account, data)
 | 
				
			||||||
		'''vcard holds the vcard data'''
 | 
							'''vcard holds the vcard data'''
 | 
				
			||||||
		jid = vcard['jid']
 | 
							jid = vcard['jid']
 | 
				
			||||||
 | 
							resource = ''
 | 
				
			||||||
 | 
							if vcard.has_key('resource'):
 | 
				
			||||||
			resource = vcard['resource']
 | 
								resource = vcard['resource']
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		# vcard window
 | 
							# vcard window
 | 
				
			||||||
		win = None
 | 
							win = None
 | 
				
			||||||
		if self.instances[account]['infos'].has_key(jid):
 | 
							if self.instances[account]['infos'].has_key(jid):
 | 
				
			||||||
			win = self.instances[account]['infos'][jid]
 | 
								win = self.instances[account]['infos'][jid]
 | 
				
			||||||
		elif self.instances[account]['infos'].has_key(jid + '/' + resource):
 | 
							elif resource and self.instances[account]['infos'].has_key(
 | 
				
			||||||
 | 
								jid + '/' + resource):
 | 
				
			||||||
			win = self.instances[account]['infos'][jid + '/' + resource]
 | 
								win = self.instances[account]['infos'][jid + '/' + resource]
 | 
				
			||||||
		if win:
 | 
							if win:
 | 
				
			||||||
			win.set_values(vcard)
 | 
								win.set_values(vcard)
 | 
				
			||||||
| 
						 | 
					@ -666,7 +669,8 @@ class Interface:
 | 
				
			||||||
		win = None
 | 
							win = None
 | 
				
			||||||
		if self.instances[account]['chats'].has_key(jid):
 | 
							if self.instances[account]['chats'].has_key(jid):
 | 
				
			||||||
			win = self.instances[account]['chats'][jid]
 | 
								win = self.instances[account]['chats'][jid]
 | 
				
			||||||
		elif self.instances[account]['chats'].has_key(jid + '/' + resource):
 | 
							elif resource and self.instances[account]['chats'].has_key(
 | 
				
			||||||
 | 
								jid + '/' + resource):
 | 
				
			||||||
			win = self.instances[account]['chats'][jid + '/' + resource]
 | 
								win = self.instances[account]['chats'][jid + '/' + resource]
 | 
				
			||||||
		if win:
 | 
							if win:
 | 
				
			||||||
			# FIXME: this will be removed when we have the thread working
 | 
								# FIXME: this will be removed when we have the thread working
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue