Closed gsohn closed 3 years ago
I don't see that problem, it works for me. Maybe you have some configuration in ejabberd.yml, or provide some arguments in API wrong?
I wrote a small script with this content:
ejabberdctl register user2 localhost mypass11
ejabberdctl create_room room1 conference.localhost localhost
ejabberdctl change_room_option room1 conference.localhost moderated true
ejabberdctl get_room_options room1 conference.localhost | grep moderated
ejabberdctl set_room_affiliation room1 conference.localhost user2@localhost owner
ejabberdctl get_room_affiliations room1 conference.localhost
ejabberdctl subscribe_room user2@localhost UseR2 room1@conference.localhost urn:xmpp:mucsub:nodes:messages
ejabberdctl send_message groupchat user2@localhost room1@conference.localhost "" testcommandmess
Then execute it:
$ ./3525.txt
User user2@localhost successfully registered
moderated true
user2 localhost owner
urn:xmpp:mucsub:nodes:messages
Now I login with another account (user1), join the room, and the room history contains that message:
<message to='user1@localhost/tka1'
from='room1@conference.localhost/UseR2'
type='groupchat'
id='16625923151172334846'>
<archived by='room1@conference.localhost'
id='1612974673594959'
xmlns='urn:xmpp:mam:tmp'/>
<stanza-id by='room1@conference.localhost'
id='1612974673594959'
xmlns='urn:xmpp:sid:0'/>
<addresses xmlns='http://jabber.org/protocol/address'>
<address jid='user2@localhost'
type='ofrom'/>
</addresses>
<delay from='room1@conference.localhost'
stamp='2021-02-10T16:31:13.664042Z'
xmlns='urn:xmpp:delay'/>
<body>testcommandmess</body>
</message>
Thanks for your reply.
I tested using the ejabberdctl commands you mentionned and still got an error when sending the message :/
I think this depends is room has members_by_default flag set. With it we allows sending message by all subscribers, but without it we only check if user role is a moderator/member, and since subscribers are offline they don't have any role set. Probably we could add try to get role for them from affiliation (by reusing get_default_role?)
Hello,
Yes, members_by_default is set as false
Yes, members_by_default is set as false
That is not the default value for that option, right? So you changed the default configuration, did not mention it, and still complain about some problem...
If you want some help, first of all show your configuration, the exact API calls you run including arguments, and any other information that may be required to reproduce your problem.
Sorry, I wasn't complaining... Just trying to make things work.
Here's our ejabberd conf :
Then we called the commands as the same order you mentioned in your first message. The user is created using ejabberd API. Then we use:
Thanks
Ok, I can reproduce your problem using your configuration in ejabberd 21.01. The problem is solved when using a recent ejabberd compiled from current source code.
This problem got reported and fixed some weeks ago, see https://github.com/processone/ejabberd/issues/3485
I think this something different, and patch from that will not help (in that other tickets, messages are sent correctly, just not displayed by clients, in this one message are rejected and aren't propagated).
This should be fixed by 14871c54acb9f5eeb98cc57faca1ec1d92133a22.
Ejabberd version: 21.01
We created a room with moderated option as true. Using the API, we added a user into room subscribers list and set his affiliation as owner.
When we are trying to send a message using API (with send_stanza command), the error above occurs:
It seems this happen because the user is not listed as a room occupant, but as he's owner (or admin) of the room, shouldn't he be allowed to send messages to this moderated room ?