Implement XEP-0461: Message Replies#648
Conversation
… 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)
| * @param reply Reply element | ||
| * @param replyBody body that is marked as reply | ||
| */ | ||
| void onReplyReceived(Message message, ReplyElement reply, String replyBody); |
There was a problem hiding this comment.
What is a usage scenario for the listener?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
This commit adds support for XEP-0461 (Message Replies) in Smack. Key changes include:
This enables message reply functionality in XMPP, with support for service discovery.
Related: XEP-0461 (https://xmpp.org/extensions/xep-0461.html)