how to send group (MUC) chat from a component

Hi,

While developing a MUC-based application, I'd like to set up a component to manage a couple of MUCs and send notifications to the MUCs. It doesn't work as a client normally does, even the component has been set as the owner of the MUC.

GROUPCHAT

sent:

<message type="groupchat" to="room@conference.localhost" from="my_component.localhost">
  <body>hello</body>
</message>

got:

<message from="room@conference.localhost" to="my_component.localhost" type="error">
  <body>hello</body>
  <error code="406" type="modify">
    <not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
    <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Only occupants are allowed to send messages to the conference</text>
  </error>
</message>

PRESENCE

sent:

<presence to="room@conference.localhost/my_component">
  <x xmlns="http://jabber.org/protocol/muc"/>
</presence>

got:

<presence type="error" from="room@conference.localhost/my_component">
  <x xmlns="http://jabber.org/protocol/muc"/>
  <error code="400" type="modify">
    <bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
  </error>
</presence>

My question is, how could a component send groupchat to a MUC? Which jid should be given in the stanza?
BTW, I'm using ejabberd 2.1.3.

any help will be much appreciated!
cai

setting the from jid to

setting the from jid to my_component.localhost in the stanza solved the problem. Seems this field is mandatory for components.

Syndicate content