Oops, sorry, I forgot the patch.
-- 
Damien Thebault

Key C15AB8AF
Fingerprint 8FB9 8576 7033 4B45 3DF5  88E8 5471 1A44 C15A B8AF
diff -udr -x '*~' -x '*.pyc' gajim-0.11_ori/src/common/contacts.py gajim-0.11/src/common/contacts.py
--- gajim-0.11_ori/src/common/contacts.py	2006-11-21 23:27:35.000000000 +0100
+++ gajim-0.11/src/common/contacts.py	2007-02-17 15:58:21.784065046 +0100
@@ -57,6 +57,32 @@
 	def get_shown_name(self):
 		if self.name:
 			return self.name
+		# see xep 0154
+		if hasattr(self, 'vcard'):
+			## nickname
+			if self.vcard.has_key('NICKNAME'):
+				return self.vcard['NICKNAME']
+			## display name
+			if self.vcard.has_key('FN'):
+				return self.vcard['FN']
+			# given "middle" family
+			name = ''
+			space_required = False
+			if self.vcard.has_key('N_GIVEN'):
+				name += self.vcard['N_GIVEN']
+				space_required = True
+			if self.vcard.has_key('N_MIDDLE'):
+				if space_required:
+					name += ' '
+				name += '"' + self.vcard['N_MIDDLE'] + '"'
+				space_required = True
+			if self.vcard.has_key('N_FAMILY'):
+				if space_required:
+					name += ' '
+				name += self.vcard['N_FAMILY']
+			if name:
+				return name
+		# username from the jid
 		return self.jid.split('@')[0]
 
 	def is_hidden_from_roster(self):
diff -udr -x '*~' -x '*.pyc' gajim-0.11_ori/src/gajim.py gajim-0.11/src/gajim.py
--- gajim-0.11_ori/src/gajim.py	2007-02-17 16:05:11.850250801 +0100
+++ gajim-0.11/src/gajim.py	2007-02-17 16:07:03.501935041 +0100
@@ -466,6 +466,9 @@
 		# Update contact
 		jid_list = gajim.contacts.get_jid_list(account)
 		if ji in jid_list or jid == gajim.get_jid_from_account(account):
+			# on event change, request the vcard, this may be too much!
+			gajim.connections[account].request_vcard(ji)
+			
 			lcontact = gajim.contacts.get_contacts_from_jid(account, ji)
 			contact1 = None
 			resources = []
@@ -902,6 +905,13 @@
 		if vcard.has_key('resource'):
 			resource = vcard['resource']
 		
+		# update contact vcard
+		lcontact = gajim.contacts.get_contacts_from_jid(account, jid)
+		for c in lcontact:
+			c.vcard = vcard
+		# update roster
+		self.roster.draw_contact(jid, account)
+		
 		# vcard window
 		win = None
 		if self.instances[account]['infos'].has_key(jid):

Attachment: signature.asc
Description: Ceci est une partie de message numériquement signée

_______________________________________________
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel

Reply via email to