From 9892ff8d77776e1bda90dc1111d297824803cbd6 Mon Sep 17 00:00:00 2001 From: kosyak Date: Mon, 5 Aug 2024 22:54:41 +0200 Subject: [PATCH] better replies fallback --- .../java/eu/siacs/conversations/entities/Message.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index b66c5a58a..ccdc2ec2b 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -356,7 +356,15 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable } public Message reply() { - Message m = new Message(conversation, QuoteHelper.quote(MessageUtils.prepareQuote(this)) + "\n", ENCRYPTION_NONE); + Message m; + String name = getAvatarName(); + + if (name != null && !name.isEmpty()) { + m = new Message(conversation, QuoteHelper.quote("<" + name + ">" + "\n" + MessageUtils.prepareQuote(this)) + "\n", ENCRYPTION_NONE); + } else { + m = new Message(conversation, QuoteHelper.quote(MessageUtils.prepareQuote(this)) + "\n", ENCRYPTION_NONE); + } + m.addPayload( new Element("reply", "urn:xmpp:reply:0") .setAttribute("to", getCounterpart())