diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-02-21 19:09:45 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-02-21 19:09:45 +0100 |
commit | 5466ee4d56db3b79161556ff95cc45aa928fc168 (patch) | |
tree | 0ee3da88469756cefb34547fc0d6a07c9f500ab7 /src | |
parent | 52b6155d726e8d4379729f73cc78a9c1ecc35f93 (diff) |
Deduplicate presences
possibly fixes #303
Diffstat (limited to 'src')
4 files changed, 7 insertions, 11 deletions
diff --git a/src/main/java/de/pixart/messenger/generator/MessageGenerator.java b/src/main/java/de/pixart/messenger/generator/MessageGenerator.java index e66261be7..7bc39dc2e 100644 --- a/src/main/java/de/pixart/messenger/generator/MessageGenerator.java +++ b/src/main/java/de/pixart/messenger/generator/MessageGenerator.java @@ -48,7 +48,7 @@ public class MessageGenerator extends AbstractGenerator { } else if (message.getType() == Message.TYPE_PRIVATE) { //TODO files and images might be private as well packet.setTo(message.getCounterpart()); packet.setType(MessagePacket.TYPE_CHAT); - packet.addChild("x","http://jabber.org/protocol/muc#user"); + packet.addChild("x", "http://jabber.org/protocol/muc#user"); if (this.mXmppConnectionService.indicateReceived()) { packet.addChild("request", "urn:xmpp:receipts"); } @@ -85,7 +85,9 @@ public class MessageGenerator extends AbstractGenerator { packet.setAxolotlMessage(axolotlMessage.toElement()); packet.setBody(OMEMO_FALLBACK_MESSAGE); packet.addChild("store", "urn:xmpp:hints"); - packet.addChild("encryption", "urn:xmpp:eme:0").setAttribute("name", "OMEMO").setAttribute("namespace", AxolotlService.PEP_PREFIX); + packet.addChild("encryption", "urn:xmpp:eme:0") + .setAttribute("name", "OMEMO") + .setAttribute("namespace", AxolotlService.PEP_PREFIX); return packet; } @@ -98,10 +100,6 @@ public class MessageGenerator extends AbstractGenerator { return packet; } - private static boolean recipientSupportsOmemo(Message message) { - Contact c = message.getContact(); - return c != null && c.getPresences().allOrNonSupport(AxolotlService.PEP_DEVICE_LIST_NOTIFY); - } public static void addMessageHints(MessagePacket packet) { packet.addChild("private", "urn:xmpp:carbons:2"); diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 995d2ae97..03f347519 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -2661,10 +2661,7 @@ public class XmppConnectionService extends Service { account.pendingConferenceJoins.remove(conversation); account.pendingConferenceLeaves.remove(conversation); if (account.getStatus() == Account.State.ONLINE) { - - //disabled for testing strange MUC leaves sendPresencePacket(account, mPresenceGenerator.leave(conversation.getMucOptions())); - conversation.resetMucOptions(); if (onConferenceJoined != null) { conversation.getMucOptions().flagNoAutoPushConfiguration(); diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 975e4f768..4c97fb129 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -2864,7 +2864,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke service.sendChatState(conversation); } if (broadcastLastActivity) { - service.sendPresence(conversation.getAccount(), false); //send new presence but don't include idle because we are not + //service.sendPresence(conversation.getAccount(), false); //send new presence but don't include idle because we are not } updateSendButton(); } diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index 98d3b6dba..dd82ab7bb 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -1193,6 +1193,7 @@ public class XmppConnection implements Runnable { final boolean requestDiscoItemsFirst = !account.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY); if (requestDiscoItemsFirst) { sendServiceDiscoveryItems(Jid.of(account.getServer())); + getAdHocFeatures(Jid.of(account.getServer())); } if (discoveryResult == null) { sendServiceDiscoveryInfo(Jid.of(account.getServer())); @@ -1204,6 +1205,7 @@ public class XmppConnection implements Runnable { sendServiceDiscoveryInfo(account.getJid().asBareJid()); if (!requestDiscoItemsFirst) { sendServiceDiscoveryItems(Jid.of(account.getServer())); + getAdHocFeatures(Jid.of(account.getServer())); } if (!mWaitForDisco.get()) { @@ -1300,7 +1302,6 @@ public class XmppConnection implements Runnable { for (Jid jid : items) { sendServiceDiscoveryInfo(jid); } - getAdHocFeatures(server); } else { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": could not query disco items of " + server); } |