为什么XMPP服务器会忽略我的昵称请求订阅?

Soj*_*tin 2 xmpp openfire strophe

我正在尝试通过Strophe.js(1.2.0)向XMPP服务器(OpenFire 3.9.3)发送订阅请求.

<presence type="subscribe" from="agent@localhost" to="agent3@localhost" xmlns="jabber:client">
<nick xmls="http://jabber.org/protocol/nick">agent3</nick>
</presence>
Run Code Online (Sandbox Code Playgroud)

名单项已创建,但没有昵称.

Openfire调试日志:

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>
Run Code Online (Sandbox Code Playgroud)

leg*_*cia 5

在订阅请求中包含昵称只是为了向收件人提供额外信息("这个人是谁想要加我?"),而不是在名单中设置昵称.要设置名单项目的昵称,您需要在发送订阅请求之前或之后发送名单集请求:

<iq type='set' id='roster_3'>
  <query xmlns='jabber:iq:roster'>
    <item jid='agent3@localhost' name='agent3'/>
  </query>
</iq>
Run Code Online (Sandbox Code Playgroud)