prose-im / prose-core-client

Prose core XMPP client manager & protocols.
https://prose.org
Mozilla Public License 2.0
20 stars 3 forks source link

Reactions in MUC room should target message via StanzaId #60

Closed nesium closed 7 months ago

nesium commented 7 months ago

Sent or received reactions in MUC rooms are not displayed when having a chat with a user using e.g. Movim.

The reason is that we're targeting messages for reactions via their id while in MUC rooms they should be targeted via their stanza id:

When a user chooses to react to a message with a certain emoji, the client sends a stanza containing a element. The chosen emoji is included in a element within the element. The message is referred to by including its id or in MUCs its stanza-id as defined in Unique and Stable Stanza IDs (XEP-0359) [6] in the 'id' attribute of the reactions element.

See: https://xmpp.org/extensions/xep-0444.html#sending-reactions

This detail should be hidden from the core-client users. Which means that the core needs to translate ids into stanza ids when sending a reaction, while translating stanza ids into ids when receiving a reaction and dispatching an event.

Furthermore not only Room needs to take the room type into account when sending a reaction, Message::reducing_messages needs to take this into account as well while the MessagesRepository needs to fetch messages not only targeted by their id but also by their stanza id.