0

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?

Kevin
  • 546
  • 4
  • 17

1 Answers1

1

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.

Mark
  • 5,437
  • 2
  • 19
  • 29
  • Hi @Mark, thanks for your answer. As I understand, by default all new members get the status Participant. And they can write messages, unless I send to the server request to change their role from Participant to Visitor. So do I need somehow to listen for a new participants in the chat, and change their role immediately after they joined? – Kevin Oct 06 '15 at 10:28
  • That's not correct: "As a default, an unaffiliated user enters a moderated room as a visitor, and enters an open room as a participant. A member enters a room as a participant. An admin or owner enters a room as a moderator." – xnyhps Oct 06 '15 at 10:34
  • You need to make your room `open` and `moderated`. You can do this by setting the `muc#roomconfig_moderatedroom` field value to `1` and the `muc#roomconfig_passwordprotectedroom` field value set to `0`. – Mark Oct 06 '15 at 11:08
  • @Mark yes, I already tried to create moderatedroom. But when I enter the room using new account, this new member immediately has role of Participant (and I don't know why). Actually I do want, that all those who enter my moderated room were Visitors from the very beginning. – Kevin Oct 06 '15 at 12:21
  • @Dyrk ok I re-read the spec. Try creating a moderated, not passworded, members-only room with no members defined or white-listed. Non-member occupants in this case should have the role visitor according to XEP-0045. The members-only flag is defined by the field `muc#roomconfig_membersonly`. – Mark Oct 06 '15 at 12:45