Sending special MUC message

Steffen Larsen
Added almost 5 years ago

Hi again,

I am trying to send a "special" MUC message to all the participants in the room(which shall not be presented like normal messages in the room).

It actually just a normal group chat message, that have a namespace.

<message type="groupchat" to="test@muc." id="aad2a" xmlns="">
<nick xmlns="">MyNick</nick>

I know its a hack, but I want to catch this special message instead of just presenting it to my view.

The "problem" is that Tigase is removing this namespace (which I kind of understand, because its not a part of the protocol). Is there a way I can preserve the namespace or is there another way that I can send to all participants??

Maybe just add my own special tag instead, like so?:

<message type="groupchat" to="test@muc." id="aad2a">
<nick xmlns="">MyNick</nick>



Replies (3)

Added by Wojciech Kapcia TigaseTeam almost 5 years ago

Better approach would be second one, but please keep in mind that you should disable element filtering in MUC component, otherwise additional element will not be passed in resulting message:


Added by Artur Hefczyc TigaseTeam almost 5 years ago

The Wojciech suggestion, as mentioned, would work on if you take the second approach. The first is impossible at all. This is because the only allowed namespace for top level elements (message, iq, presence) in XMPP is "jabber:client", "jabber:server" and special namespaces for external components. So Tigase has a right to either reject packets with incorrect namespace or normalize them to allowed namespace.

Additional payload is the best option.

Added by Steffen Larsen almost 5 years ago


Yes I know its a "tweak" in the protocol design.. and I also thought that the 2. solution was the best.. But I just couldn't make it work.

Now I can do it, thanks to the filter being disabled. Thanks!

I'll do an additional payload with its own namespace, which I also have done before in another project. :-)

Because then its easier for the client to "catch" it, by namespace.

<message type="groupchat" to="test@muc." id="aad2a">
  <secret xmlns="">test</secret>
  <nick xmlns="">MyNick</nick>

-Cheers and thanks again!