[jdev] Correct way to remove a nickname form a roster item

Mircea Bardac dev.list at mircea.bardac.net
Fri Oct 6 07:45:29 CDT 2006


On Thursday 05 October 2006 06:20, Mark Doliner wrote:
> Hi, I'm wondering what is the correct way to remove a nickname from a
> roster item?
>
> Method 1:
> <iq type='set' id='lalala123'><query xmlns='jabber:iq:roster'><item
> jid='whoever at example.com'><group>Buddies</group></item></query></iq>
>
> Method 2:
> <iq type='set' id='lalala124'><query xmlns='jabber:iq:roster'><item
> jid='whoever at example.com'
> name=''><group>Buddies</group></item></query></iq>

According to http://www.xmpp.org/specs/rfc3921.html#def / Section B5

// --
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='jabber:iq:roster'
    xmlns='jabber:iq:roster'
    elementFormDefault='qualified'>

  <!-- ... -->
  <xs:element name='item'>
    <xs:complexType>
      <!-- .. -->
      <xs:attribute name='name' type='xs:string' use='optional'/>
      <!-- .. -->
    </xs:complexType>
  </xs:element>

  <!-- .. -->
</xs:schema>
// --

The "name" attribute of the "item" element in "jabber:iq:roster" namespace is 
optional. What I personally understand from this:
a) items can have no "name" (nickname) - when "name" is missing
b) items can have a "name" (nickname) - when "name" is present

Therefore, when you give/receive "name" that means the item has some nickname 
set, no matter what the contents of "name" is. Under these conditions, a 
client receiving name='' should list a blank space in the roster - which is 
not something you'd like, I think.

IMO, missing "name" is not the same with empty "name". 

I would go with method 1.


Regards,
Mircea

-- 
http://mircea.bardac.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.jabber.org/pipermail/jdev/attachments/20061006/0be383c3/attachment-0002.pgp>


More information about the JDev mailing list