xmppstrophe

XMPP block messages


I am trying to block communications in my XMPP client (Built on top of strophe.js). The problem is it only blocks my messages to a contact I am trying to "mute" BUT doesn't block any incoming messages from that contact.

Here is the logic (based on http://xmpp.org/rfcs/rfc3921.html#privacy):

1) Add "bill@domain.me" to my "block" list

var recipient = "bill@domain.me"
var block = $iq({type: 'set'}).c('query', {xmlns: 'jabber:iq:privacy'}).
c('list', {name: 'block'}).
c('item', {type: 'jid', value: recipient, action: 'deny', order: 1}).
c('message');

2) Make this list active

var setListActive = $iq({type: 'set'}).c('query', {xmlns: 'jabber:iq:privacy'}).c("active", {name: "block"});           
SGN.connection.sendIQ(setListActive);

What could be the problem?


Solution

  • I might be wrong but what I've understood is it is the way it should work.

    If you check the list you were adding jids to you'll see that they are all there:

    var getMyPrivacyList = $iq({type: 'get'}).c('query', {xmlns: 'jabber:iq:privacy'}).c("list", {name: "block"});          
    APP.connection.sendIQ(getMyPrivacyList,function success(response) { console.log(response) });
    

    However if you want to block incoming messages you'd have to manually check senders's jids against this list every time message comes in.