Project

General

Profile

Sending special MUC message

Steffen Larsen
Added over 4 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. test.com" id="aad2a" xmlns="http://test.com/secret">
<body>test</body>
<nick xmlns="http://jabber.org/protocol/nick">MyNick</nick>
</message>

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. test.com" id="aad2a">
<body></body>
<secret>test</secret>
<nick xmlns="http://jabber.org/protocol/nick">MyNick</nick>
</message>

-Cheers!

/Steffen


Replies (3)

Added by Wojciech Kapcia TigaseTeam over 4 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:

muc/message-filter-enabled[B]=false
Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 4 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 over 4 years ago

Hi,

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. test.com" id="aad2a">
  <body></body>
  <secret xmlns="http://test.com/secret">test</secret>
  <nick xmlns="http://jabber.org/protocol/nick">MyNick</nick>
</message>

-Cheers and thanks again!

/Steffen

    (1-3/3)