Reputation: 2734
I'm trying to send a subscribe request to XMPP server (OpenFire 3.9.3) via Strophe.js (1.2.0).
<presence type="subscribe" from="agent@localhost" to="agent3@localhost" xmlns="jabber:client">
<nick xmls="http://jabber.org/protocol/nick">agent3</nick>
</presence>
The roster item is created, but without a nickname.
Openfire debug log:
2015.04.22 11:57:43 XMPPServlet - 447b9ca3ad42f7bc78e09d35b882dfb3 : onMessage : Received : <presence type='subscribe' from='agent@localhost' to='agent3@localhost' xmlns='jabber:client'><nick xmls='http://jabber.org/protocol/nick'>agent3</nick></presence>
2015.04.22 11:57:43 XMPPServlet - 447b9ca3ad42f7bc78e09d35b882dfb3 : Delivered : <iq type="set" id="232-173" to="agent@localhost/f0ddfe38-7bdd-fc6b-04a7-e63a7e30bf89"><query xmlns="jabber:iq:roster"><item jid="agent3@localhost" ask="subscribe" subscription="none"/></query></iq>
Upvotes: 2
Views: 613
Reputation: 41568
Including a nickname in a subscription request is only meant to provide extra information to the recipient ("who is this person who wants to add me?"), not to set the nickname in the roster. To set the nickname of the roster item, you need to send a roster set request, either before or after sending the subscription request:
<iq type='set' id='roster_3'>
<query xmlns='jabber:iq:roster'>
<item jid='agent3@localhost' name='agent3'/>
</query>
</iq>
Upvotes: 5