From cce36fcbb7834f731e5117981ef5f55f27ec11a2 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 31 Aug 2019 15:43:20 +0200 Subject: include pgp sig and status in presence to non anon muc --- .../messenger/generator/PresenceGenerator.java | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/main/java/de/pixart/messenger/generator/PresenceGenerator.java') diff --git a/src/main/java/de/pixart/messenger/generator/PresenceGenerator.java b/src/main/java/de/pixart/messenger/generator/PresenceGenerator.java index b89783e07..02bd5b078 100644 --- a/src/main/java/de/pixart/messenger/generator/PresenceGenerator.java +++ b/src/main/java/de/pixart/messenger/generator/PresenceGenerator.java @@ -50,15 +50,20 @@ public class PresenceGenerator extends AbstractGenerator { return selfPresence(account, status, true); } - public PresencePacket selfPresence(Account account, Presence.Status status, boolean includePgpAnnouncement) { - PresencePacket packet = new PresencePacket(); - if (status.toShowString() != null) { - packet.addChild("show").setContent(status.toShowString()); - } - packet.setFrom(account.getJid()); - final String sig = account.getPgpSignature(); - if (includePgpAnnouncement && sig != null && mXmppConnectionService.getPgpEngine() != null) { - packet.addChild("x", "jabber:x:signed").setContent(sig); + public PresencePacket selfPresence(final Account account, final Presence.Status status, final boolean personal) { + final PresencePacket packet = new PresencePacket(); + if (personal) { + final String sig = account.getPgpSignature(); + final String message = account.getPresenceStatusMessage(); + if (status.toShowString() != null) { + packet.addChild("show").setContent(status.toShowString()); + } + if (!TextUtils.isEmpty(message)) { + packet.addChild(new Element("status").setContent(message)); + } + if (sig != null && mXmppConnectionService.getPgpEngine() != null) { + packet.addChild("x", "jabber:x:signed").setContent(sig); + } } final String capHash = getCapHash(account); if (capHash != null) { -- cgit v1.2.3