fix replies without callback handling

This commit is contained in:
kosyak 2024-05-21 21:26:36 +02:00
parent 162b0bf928
commit ead327d30a

View file

@ -875,14 +875,14 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable
private StringBuilder removeReplyFallback(Message message, Message replyMessage) {
StringBuilder sb = new StringBuilder(message.body);
List<Element> replyFallback = message.getFallbacks("urn:xmpp:reply:0");
if (replyFallback.isEmpty()) {
return sb;
}
if (replyMessage != null && replyMessage.edits.isEmpty()) {
sb.replace(0, replyMessage.body.codePointCount(0, replyMessage.body.length()) + 3, "");
} else {
List<Element> replyFallback = message.getFallbacks("urn:xmpp:reply:0");
if (replyFallback.isEmpty()) {
return sb;
}
Element bodyFallback = replyFallback.get(0).findChild("body");
int startCodePoint = Integer.parseInt(bodyFallback.getAttribute("start"));
int endCodePoint = Integer.parseInt(bodyFallback.getAttribute("end"));