我想添加阻止,解除阻止和检索阻止用户在我的聊天Web应用程序中列出的功能。Quickblox:在WEB聊天中阻止解除阻止和阻止列表
对于这一点,我修改quickblox.js通过添加新功能,将会在下面_enableCarbons()
功能块列表如下:
getBlockList: function() {
iq = $iq({
//from: connection.jid, //Also tried to sent this but same response was received
type: 'get',
id: connection.getUniqueId('sendIQ')
}).c('blocklist', {
xmlns: "urn:xmpp:blocking"
});
connection.sendIQ(iq, function(stanza) {
console.log("response of getBlockList",stanza);
callback();
});
}
在调用上面下面的XML功能被发送到服务器:
<iq type="get" id="3:sendIQ" xmlns="jabber:client">
<blocklist xmlns="urn:xmpp:blocking"></blocklist>
</iq>
这作为回应请发送以下xml:
<iq id="3:sendIQ" to="[email protected]/1220770403-quickblox-228541" type="error" xmlns="jabber:client">
<blocklist xmlns="urn:xmpp:blocking"></blocklist>
<error type="cancel" code="501">
<feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></feature-not-implemented>
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" xml:lang="en">Feature not supported yet.</text>
</error>
</iq>
请让我知道如果我需要发送其他事情或一些错误我在做。 我跟着http://xmpp.org/extensions/xep-0191.html链接检索块列表
我也跟着XEP-0016,并通过代码将用户添加到隐私列表的改变:
block : function(userId,callback) {
iq = $iq({
from: connection.jid,
type: 'set',
id: connection.getUniqueId('sendIQ')
}).c('query', {
xmlns: "jabber:iq:privacy"
}).c('list',{
name : 'public'
}).c('item',{
type : 'jid',
value : this.helpers.getUserJid(userId, this.service.getSession().application_id),
action : 'deny',
order : new Date().getTime()
});
connection.sendIQ(iq, function(stanza) {
console.log("response of getBlockList",stanza);
callback(stanza);
});
}
此发送以下XML:
<iq from="[email protected]/1220770403-quickblox-233195" type="set" id="3:sendIQ" xmlns="jabber:client">
<query xmlns="jabber:iq:privacy">
<list name="public">
<item type="jid" value="[email protected]" action="deny" order="1444815897276"></item>
</list>
</query>
</iq>
回应,我从服务器得到的是:
<iq id="3:sendIQ" to="[email protected]/1220770403-quickblox-233195" type="error" xmlns="jabber:client">
<query xmlns="jabber:iq:privacy">
<list name="public">
<item value="[email protected]" action="deny" order="1444815897276" type="jid"></item>
</list>
</query>
<error type="modify" code="400">
<bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></bad-request>
</error>
输入代码在这里
我也尝试过,但在错误请求的响应中出错。我刚刚更新了我的帖子,请检查并让我知道那里有什么问题。 –
必须包含'订单'属性,其值必须是列表中所有项目中唯一的非负整数。 (如果客户端尝试创建或更新具有非唯一订单值的列表,则服务器必须向客户端返回 节错误。) –
如何在发送请求时识别订单号是唯一的在列表中添加项目。 –