forked from mirror/monocles_chat_clean
Support latest retract/moderate xeps too
(cherry picked from commit e5200409731d37971bf2c8823fd0b23fccef3558)
This commit is contained in:
parent
58542a8ffe
commit
30b567ea6c
2 changed files with 9 additions and 5 deletions
|
@ -485,11 +485,14 @@ public class MessageParser extends AbstractParser implements Consumer<im.convers
|
|||
if (fasten != null) {
|
||||
replaceElement = fasten.findChild("retract", "urn:xmpp:message-retract:0");
|
||||
if (replaceElement == null) replaceElement = fasten.findChild("moderated", "urn:xmpp:message-moderate:0");
|
||||
if (replaceElement != null) {
|
||||
final String reason = replaceElement.findChildContent("reason", "urn:xmpp:message-moderate:0");
|
||||
replacementId = fasten.getAttribute("id");
|
||||
packet.setBody(reason == null ? "" : reason);
|
||||
}
|
||||
}
|
||||
if (replaceElement == null) replaceElement = packet.findChild("retract", "urn:xmpp:message-retract:1");
|
||||
if (replaceElement == null) replaceElement = packet.findChild("moderate", "urn:xmpp:message-moderate:1");
|
||||
if (replaceElement != null) {
|
||||
var reason = replaceElement.findChildContent("reason", "urn:xmpp:message-moderate:0");
|
||||
if (reason == null) reason = replaceElement.findChildContent("reason", "urn:xmpp:message-moderate:1");
|
||||
replacementId = (fasten == null ? replaceElement : fasten).getAttribute("id");
|
||||
packet.setBody(reason == null ? "" : reason);
|
||||
}
|
||||
}
|
||||
LocalizedContent body = packet.getBody();
|
||||
|
|
|
@ -46,6 +46,7 @@ public class Message extends Stanza {
|
|||
}
|
||||
|
||||
public void setBody(final String text) {
|
||||
removeChild(findChild("body"));
|
||||
this.addExtension(new Body(text));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue