Skip to content

Implement XEP-0461: Message Replies#648

Open
ismael221 wants to merge 2 commits into
igniterealtime:masterfrom
ismael221:reply
Open

Implement XEP-0461: Message Replies#648
ismael221 wants to merge 2 commits into
igniterealtime:masterfrom
ismael221:reply

Conversation

@ismael221

Copy link
Copy Markdown

This commit adds support for XEP-0461 (Message Replies) in Smack. Key changes include:

Introduced ReplyManager to handle message replies, including adding, removing, and listening for replies.
Added ReplyElement  class to represent the reply element.
Implemented ReplyFilter to detect messages containing replies.
Integrated reply handling with XMPP service discovery.
Added ReplyListener for applications to handle incoming replies.
Included unit tests to verify functionality.

This enables message reply functionality in XMPP, with support for service discovery.

Related: XEP-0461 (https://xmpp.org/extensions/xep-0461.html)

… changes include:

    Introduced ReplyManager to handle message replies, including adding, removing, and listening for replies.
    Added ReplyElement  class to represent the reply element.
    Implemented ReplyFilter to detect messages containing replies.
    Integrated reply handling with XMPP service discovery.
    Added ReplyListener for applications to handle incoming replies.
    Included unit tests to verify functionality.

This enables message reply functionality in XMPP, with support for service discovery.

Related: XEP-0461 (https://xmpp.org/extensions/xep-0461.html)
@ismael221 ismael221 marked this pull request as draft February 18, 2025 14:11
@ismael221 ismael221 marked this pull request as ready for review February 19, 2025 08:01
@ismael221 ismael221 requested a review from yurtpage December 16, 2025 13:08
* @param reply Reply element
* @param replyBody body that is marked as reply
*/
void onReplyReceived(Message message, ReplyElement reply, String replyBody);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a usage scenario for the listener?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The listener is triggered when an incoming message contains a ReplyElement.
A common scenario is messaging applications where users reply to a specific message. The listener allows the application to extract the original referenced message and display the reply context in the chat UI, similar to how replies work in apps like WhatsApp or Telegram.

public static final String NAMESPACE = "urn:xmpp:reply:0";
public static final String ELEMENT = "reply";

private final String replyTo;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This filed can be a FullJid or for 1:1 chats it can be a BareJid. Also thei field can be null. I'm not sure why to bother to set the field if we always can get the author of the original comment by the message ID. But this is a question to the XEP, just saying.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. According to the XEP the field may contain a FullJid or BareJid and it may also be absent. Here we only expose the value if it is present in the message stanza.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants