Project

General

Profile

MUC component strips out <message/> stanza attributes

HaXkil The
Added over 4 years ago

Hi,

It appeared, that MUC component strips out <message/> stanza attributes in message sent to room occupants.

E.g. user A sends message to the room:

<message xml:lang="en" id="messageID" from="a@chat/resource" to="room@muc.chat" type="groupchat">
    <body>...</body>
</message>

User B ( who is room occupant ) receives message:

<message from="room@muc.chat/UserA" to="b@chat/resource" type="groupchat">
    <body>...</body>
</message>

It doesn't contain xml:lang attribute.

Seems like this happens because tigase.muc.modules.GroupchatMessageModule

contains code to send message, which creates new <message/> stanza omitting all attributes:

    public void sendMessagesToAllOccupants(final Room room, final JID fromJID, final Element... content)
            throws TigaseStringprepException {

            ...

            for (JID jid : occupantJids) {

                Packet message = Packet.packetInstance(new Element("message", new String[] { "type", "from", "to" },
                        new String[] { "groupchat", fromJID.toString(), jid.toString() }));
                message.setXMLNS(Packet.CLIENT_XMLNS);


                if (content != null) {
                    for (Element sub : content) {
                        if (sub != null) {
                            message.getElement().addChild(sub);
                        }
                    }
                }
                writer.write(message);
            }
        }
    }

Is there any workaround or could you change the way <message/> stanzas' attributes are handled?

Thank you!


Replies (6)

(1)
Avatar?id=6098&size=32x32

Added by Bartosz Malkowski TigaseTeam over 4 years ago

No. There is no workaround.

It requires rewrite GroupchatMessageModule

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 4 years ago

Bartek, as far as I remember, there is/was a configuration option for MUC to allow for passing payload included in message. Can it be used in this case?

Added by Wojciech Kapcia TigaseTeam over 4 years ago

AFAIR it was only related to the child elements, not the attributes of .

(1)
Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 4 years ago

Ah, right, thanks.

Added by HaXkil The about 4 years ago

Hi guys. Are there any update on this?

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam about 4 years ago

Nothing has changed on this topic in last 3 months.

    (1-6/6)