powered by Jive Software

Smack 4.2.1-SNAPSHOT Roster#createEntry has extra attribute subscription='none' not defined in RFC 6121

Per the document RFC 6121 section 2.3 as attached below; it does not specifically mention the requirements of an attribute ‘subscription’ during adding a roster Item that was included in Smack 4.2.1-SNAPSHOT. This however does not impact the ejabberd xmpp server correct handling of the request. I have also performed the similar test on a Pidgin client in adding a new buddy, Pidgin client sends IQ set exactly as specified per RFC 6121 section 2.3.1

============ RFC 6121 =============

2.3. Adding a Roster Item

2.3.1. Request

At any time, a client can add an item to the roster. This is done by

sending a roster set containing a new item.

C: <iq from=‘juliet@example.com/balcony’

id=‘ph1xaz53’

type=‘set’>

<item jid=‘nurse@example.com’

name=‘Nurse’>

Servants

============= aTalk log for Roster#createEntry ===============

06-09 11:35:18.756 D/aTalk: [53] impl.protocol.jabber.ServerStoredContactListJabberImpl.addContact().462 Adding contact newx@atalk.org to parent=JabberGroup.friends, childContacts=0:[]

06-09 11:35:18.766 D/SMACK: SENT (1): <item jid=‘newx@atalk.org’ name=‘newx@atalk.org’ subscription=‘none’>friends

06-09 11:35:19.116 D/SMACK: RECV (1): friends

06-09 11:35:19.126 D/SMACK: RECV (1):

06-09 11:35:19.126 D/aTalk: [47] impl.protocol.jabber.ServerStoredContactListJabberImpl.entriesAdded().1300 entriesAdded [newx@atalk.org]

06-09 11:35:19.126 D/SMACK: SENT (1): Chong Meng Enged341d7cb4d39f423989c0cf5fe8d9527be3ffde</ph oto>

06-09 11:35:19.126 D/aTalk: [47] impl.protocol.jabber.OperationSetPersistentPresenceJabberImpl.firePresenceStatu sChanged().1415 Received a status update for buddy = newx@atalk.org

06-09 11:35:19.126 D/SMACK: SENT (1):

06-09 11:35:19.156 D/SMACK: SENT (1): friends

06-09 11:35:19.246 D/SMACK: RECV (1): friends

06-09 11:35:19.266 D/SMACK: SENT (1):

06-09 11:35:19.446 D/SMACK: RECV (1): friends

06-09 11:35:19.446 D/SMACK: RECV (1):

=========== Pidgin XMPP Console log - during Add Buddy… ===================

C:

atalk member

friends

C:

S:

atalk member

friends

C:

S:

S:

atalk member

friends

C:

According to RFC 6120 § 2.1.2.5 the default value of the subscription attribute is ‘none’. The section furthermore states that

In a roster set (Section 2.1.5), the ‘subscription’ attribute MAY be

included with a value of “remove”, which indicates that the item is

to be removed from the roster; in a roster set the server MUST ignore

all values of the ‘subscription’ attribute other than “remove”.

So Smack’s behavior is standard compliant. You should check if newer ejabberd servers also have issues with a set ‘subscription’ attribute and report that to the ejabberd developers if so.

Since ‘none’ is the default, Smack could suppress the generation of the attribute in that case. But that is merely an optimization.

Thanks for the clarification. Have no problem whichever direction Smack decides to take. As mentioned in my previous message, ejabberd xmpp server version 17.03 did ignore the extra attributes as required by document specification, and response accordingly.

I started a more detail investigation, as earlier I faced the similar Smack response timeout even when reply has been received. I thought aTalk ‘add buddy’ was incorrectly implemented. Hence I proceed to check how other client e.g. Pidgin implementation on the ‘add buddy’ feature that lead to whole observation.

Thanks again for the input.

===============aTalk log - add buddy with response timeout ===========================

06-09 10:07:56.656 D/SMACK: SENT (0): friends

06-09 10:07:56.776 D/SMACK: RECV (0):

06-09 10:07:56.836 D/SMACK: RECV (0): friends

06-09 10:07:56.836 D/SMACK: RECV (0):

06-09 10:08:46.656 W/System.err: org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 50000ms (~50s). Waited for response using: IQReplyFilter: iqAndIdFilter (AndFilter: (OrFilter: (IQTypeFilter: type=error, IQTypeFilter: type=result), StanzaIdFilter: id=q7qX8-90)), : fromFilter (OrFilter: (FromMatchesFilter (full): null, FromMatchesFilter (ignoreResourcepart): newx@atalk.org, FromMatchesFilter (full): atalk.org)).

06-09 10:08:46.666 W/System.err: at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:2 53)

06-09 10:08:46.666 W/System.err: at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:2 08)

06-09 10:08:46.666 W/System.err: at org.jivesoftware.smack.roster.Roster.createEntry(Roster.java:622)