3

Hi i had installed ejabberd 16.04.43 in my server and its running as per as i needed.

Now i got new requirement to block a particular person to a particular user

Let me consider few users:

kandan
cash
mani
kumar
lokesh

Each of them has a particular jabber id in ejabberd and they interact with each other by using the command

add rosteritem

Now what i need is,

 **kandan blocks cash** such that any further message from kandan to cash or from cash to kandan should not deliver each other , so can anyone tell me how to implement?

i installed with mod_block , but am no where nearby to answer what i expected..!!!

Mani Kandan
  • 699
  • 1
  • 10
  • 30

2 Answers2

6

You need to add user to a privacy list with action deny. And later if you wish to unblock then set the action to allow.

Example:

<iq from='romeo@example.net/orchard' type='set' id='msg1'>
<query xmlns='jabber:iq:privacy'>
  <list name='message-jid-example'>
    <item type='jid'
          value='tybalt@example.com'
          action='deny'
          order='3'>
      <message/>
    </item>
  </list>
</query>
</iq>

documentation.

Hare Kumar
  • 699
  • 7
  • 23
3

For admin side you can send stanza using send_stanza_c2s command.

Syntax

ejabberdctl send_stanza_c2s Username Host Resourceid Stanza

block stanza:

<iq type='set' id='block123' from='user1@abc.com'>
     <block xmlns='urn:xmpp:blocking'>
        <item jid='user2@abc.com'>
        </item>
     </block>
</iq>

Example

ejabberdctl send_stanza_c2s user1 abc.com 69890942764773790857148098 "<iq type='set' id='block' from='user1@abc.com'><block xmlns='urn:xmpp:blocking'><item jid='user2@abc.com'></item></block></iq>"
Manoj R
  • 51
  • 5