diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 009d71d9f..0c49b9e75 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -126,6 +126,7 @@ import eu.siacs.conversations.xmpp.OnMessagePacketReceived; import eu.siacs.conversations.xmpp.OnPresencePacketReceived; import eu.siacs.conversations.xmpp.OnStatusChanged; import eu.siacs.conversations.xmpp.OnUpdateBlocklist; +import eu.siacs.conversations.xmpp.Patches; import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.forms.Data; @@ -1200,7 +1201,7 @@ public class XmppConnectionService extends Service { account.deactivateGracePeriod(); MessagePacket packet = null; final boolean addToConversation = (conversation.getMode() != Conversation.MODE_MULTI - || account.getServerIdentity() != XmppConnection.Identity.SLACK) + || !Patches.BAD_MUC_REFLECTION.contains(account.getServerIdentity())) && !message.edited(); boolean saveInDb = addToConversation; message.setStatus(Message.STATUS_WAITING); diff --git a/src/main/java/eu/siacs/conversations/xmpp/Patches.java b/src/main/java/eu/siacs/conversations/xmpp/Patches.java new file mode 100644 index 000000000..8eb91f158 --- /dev/null +++ b/src/main/java/eu/siacs/conversations/xmpp/Patches.java @@ -0,0 +1,17 @@ +package eu.siacs.conversations.xmpp; + + +import java.util.Arrays; +import java.util.List; + +public class Patches { + public static final List DISCO_EXCEPTIONS = Arrays.asList( + "nimbuzz.com" + ); + public static final List SUFFICIENT_PUSH = Arrays.asList( + XmppConnection.Identity.EJABBERD + ); + public static final List BAD_MUC_REFLECTION = Arrays.asList( + XmppConnection.Identity.SLACK + ); +} diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index b5bc0fa0d..e2b5d0bb6 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -1088,10 +1088,15 @@ public class XmppConnection implements Runnable { synchronized (this.disco) { this.disco.clear(); } - mPendingServiceDiscoveries.set(0); - mWaitForDisco.set(smVersion != 0 && !account.getJid().getDomainpart().equalsIgnoreCase("nimbuzz.com")); - lastDiscoStarted = SystemClock.elapsedRealtime(); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": starting service discovery"); + mPendingServiceDiscoveries.set(0); + if (smVersion == 0 || Patches.DISCO_EXCEPTIONS.contains(account.getJid().getDomainpart())) { + Log.d(Config.LOGTAG,account.getJid().toBareJid()+": do not wait for service discovery"); + mWaitForDisco.set(false); + } else { + mWaitForDisco.set(true); + } + lastDiscoStarted = SystemClock.elapsedRealtime(); mXmppConnectionService.scheduleWakeUpCall(Config.CONNECT_DISCO_TIMEOUT, account.getUuid().hashCode()); Element caps = streamFeatures.findChild("c"); final String hash = caps == null ? null : caps.getAttribute("hash"); diff --git a/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java b/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java index cfcef1b3d..62032f683 100644 --- a/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java +++ b/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java @@ -15,6 +15,7 @@ import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xmpp.OnIqPacketReceived; +import eu.siacs.conversations.xmpp.Patches; import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.forms.Data; import eu.siacs.conversations.xmpp.jid.InvalidJidException; @@ -110,7 +111,7 @@ public class PushManagementService { } public boolean availableAndUseful(Account account) { - return account.getServerIdentity() == XmppConnection.Identity.EJABBERD && available(account); + return Patches.SUFFICIENT_PUSH.contains(account.getServerIdentity()) && available(account); } private boolean playServicesAvailable() {