From 483304c69798bbe647bd7b0dcf9cc21cd20ea20e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 15 Apr 2017 15:14:08 +0200 Subject: [PATCH] recognize muc self presence on nimbuzz.com MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently nimbuzz.com doesn't include status code 110 in muc self presence It does however include the full real jid in the presence’s item. We can use that as a work around to detect a self presence. --- .../java/eu/siacs/conversations/parser/PresenceParser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index eb8593f89..9f502f2c3 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -54,6 +54,7 @@ public class PresenceParser extends AbstractParser implements private void processConferencePresence(PresencePacket packet, Conversation conversation) { MucOptions mucOptions = conversation.getMucOptions(); + final Jid jid = conversation.getAccount().getJid(); final Jid from = packet.getFrom(); if (!from.isBareJid()) { final String type = packet.getAttribute("type"); @@ -66,7 +67,7 @@ public class PresenceParser extends AbstractParser implements if (item != null && !from.isBareJid()) { mucOptions.setError(MucOptions.Error.NONE); MucOptions.User user = parseItem(conversation, item, from); - if (codes.contains(MucOptions.STATUS_CODE_SELF_PRESENCE)) { + if (codes.contains(MucOptions.STATUS_CODE_SELF_PRESENCE) || (codes.isEmpty() && jid.equals(item.getAttributeAsJid("jid")))) { mucOptions.setOnline(); mucOptions.setSelf(user); if (mucOptions.onRenameListener != null) { @@ -108,8 +109,7 @@ public class PresenceParser extends AbstractParser implements } } } else if (type.equals("unavailable")) { - if (codes.contains(MucOptions.STATUS_CODE_SELF_PRESENCE) || - packet.getFrom().equals(mucOptions.getConversation().getJid())) { + if (codes.contains(MucOptions.STATUS_CODE_SELF_PRESENCE)) { if (codes.contains(MucOptions.STATUS_CODE_KICKED)) { mucOptions.setError(MucOptions.Error.KICKED); } else if (codes.contains(MucOptions.STATUS_CODE_BANNED)) {