Re: [Gajim-devel] [patch] Nickname and Fullname support in the roster

2007-02-20 Thread Nikos Kouremenos
I couldn't agree more.

On 2/20/07, Yann Le Boulanger <[EMAIL PROTECTED]> wrote:
> Nikos Kouremenos wrote:
> > if this XEP http://www.xmpp.org/extensions/xep-0172.html doesn't cover
> > the nickname change event,then I don't know what to think. At least
> > propose it to be done so in that XEP
> >
>
> I just re-read this XEP, and here is what is written:
>
> "In order for a user to modify his or her nickname and notify contacts
> of that change, it is RECOMMENDED for clients to use Personal Eventing
> via Pubsub [15] (a.k.a. PEP)."
>
> so we need to support PEP ...
>
> XEP says that if we don't support PEP we can use pubsub, and if we don't
> support pubsub, we can use a message:
>
> 
>   NEW_NICK
> 
>
> this solution sounds ugly as we have to send a message to ALL our
> contacts. So we should implement PEP for that.
>
> --
> Yann
>
___
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel


Re: [Gajim-devel] [patch] Nickname and Fullname support in the roster

2007-02-20 Thread Yann Le Boulanger
Nikos Kouremenos wrote:
> if this XEP http://www.xmpp.org/extensions/xep-0172.html doesn't cover
> the nickname change event,then I don't know what to think. At least
> propose it to be done so in that XEP
> 

I just re-read this XEP, and here is what is written:

"In order for a user to modify his or her nickname and notify contacts
of that change, it is RECOMMENDED for clients to use Personal Eventing
via Pubsub [15] (a.k.a. PEP)."

so we need to support PEP ...

XEP says that if we don't support PEP we can use pubsub, and if we don't
support pubsub, we can use a message:


  NEW_NICK


this solution sounds ugly as we have to send a message to ALL our
contacts. So we should implement PEP for that.

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


Re: [Gajim-devel] [patch] Nickname and Fullname support in the roster

2007-02-19 Thread Nikos Kouremenos
if this XEP http://www.xmpp.org/extensions/xep-0172.html doesn't cover
the nickname change event,then I don't know what to think. At least
propose it to be done so in that XEP

On 2/18/07, Yann Le Boulanger <[EMAIL PROTECTED]> wrote:
> Damien THEBAULT wrote:
> > Oops, sorry, I forgot the patch.
> >
>
>
> This is an interesting patch, and a good way to do the MSN way for
> nickname: contact choose the nick he wants others see.
>
> there are 2 problems:
> - keep contact.vcard takes too much memory. vcard can be a big object as
> it contains avatar. A solution could be to have a shown_nick field that
> is filled the way you explained each time we get the vcard.
> - there are too many vcard query. I understand that we need to do some
> query because we are not advised when our contacts change their nick. So
> there is no other way than querying vcard sometimes. But to improve
> that, we can avoid querying vcard when a nick is already set by the user
> for this contact. But asking the vcard on each status change is maybe
> too much. I'll have a talk with Peter about an eventual XEP for
> spreading new nickname when we change it.
>
> --
> Yann
> ___
> Gajim-devel mailing list
> Gajim-devel@gajim.org
> https://lists.gajim.org/cgi-bin/listinfo/gajim-devel
>
___
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel


Re: [Gajim-devel] [patch] Nickname and Fullname support in the roster

2007-02-17 Thread Yann Le Boulanger
Damien THEBAULT wrote:
> Oops, sorry, I forgot the patch.
> 


This is an interesting patch, and a good way to do the MSN way for
nickname: contact choose the nick he wants others see.

there are 2 problems:
- keep contact.vcard takes too much memory. vcard can be a big object as
it contains avatar. A solution could be to have a shown_nick field that
is filled the way you explained each time we get the vcard.
- there are too many vcard query. I understand that we need to do some
query because we are not advised when our contacts change their nick. So
there is no other way than querying vcard sometimes. But to improve
that, we can avoid querying vcard when a nick is already set by the user
for this contact. But asking the vcard on each status change is maybe
too much. I'll have a talk with Peter about an eventual XEP for
spreading new nickname when we change it.

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


Re: [Gajim-devel] [patch] Nickname and Fullname support in the roster

2007-02-17 Thread Damien THEBAULT
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.0 +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):


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

[Gajim-devel] [patch] Nickname and Fullname support in the roster

2007-02-17 Thread Damien THEBAULT
Hello,

Currently, in the roster, the contact displayed name is either :
 - the name if the user choosed one or
 - the first part of the jid ("user" for [EMAIL PROTECTED])

It may be a nice feature to display the nickname of the contact. With
this patch, the contact's displayed name is :
 - the name the user entered if it did like it does actually
 - the nickname of the contact if it's available in the vcard
 - the fullname of the contact if it's available in the vcard
 - firstname "middlename" lastname of the contact if it's available
 - the first part of the jid

(This could be extended with the as the xep 0154 describe it, but this
is enough for msn transport nick and gmail fullname display)

So I added the vcard in the contact class when one is received, and the
contact in the roster is updated. Then the get_shown_name() method of
the contact returns the name as it's described above.

I don't really know where it's better to query for vcards, so I put this
in the handle_event_notify() method. It'll query the vcard at every
"contact changed show". So on startup, all contacts became online and
all those vcards are queried. But for the offline users there is no name
change, and I don't really know if the vcard query is in the right
place.
(Maybe it does too much vcard queries to the server too?)

Since It's one of my first coding with python and gajim, maybe I didn't
do it the right way, but I send this here because it may interest some
people :)

Regards,
-- 
Damien Thebault

Key C15AB8AF
Fingerprint 8FB9 8576 7033 4B45 3DF5  88E8 5471 1A44 C15A B8AF


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