XMPP: Readonly multi user chat

751 Views Asked by At

I want to create MUC, where only 1 user (owner/admin) can send messages. Other users should join chat without any invintations, but only in readonly mode. (something like news feed, parser will post news to the chat each 15 minutes, anyone can join the chat and read news, but nobody can write to this chat)

I already tried:

<field
    var='muc#roomconfig_moderatedroom'>
    <value>1</value>
</field>

But any user still can write messages to the chat. And I tried:

<field
    var='muc#roomconfig_membersonly'>
    <value>1</value>
</field>

In this case users cannot join the chat.

Any suggestions?

1

There are 1 best solutions below

5
Mark On

You can use the room's voice policies to decide who can and who can't write to a room.

In your case you would need two roles for your room:

  • Visitor
  • Participant

You can disable the possibility to write messages for any user by changing its role from Participant to Visitor.

See more about how managing voices works in XEP-0045 here: http://xmpp.org/extensions/xep-0045.html#grantvoice

You need to make sure that your XMPP server implements this extension.