aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java7
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/Patches.java16
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java9
-rw-r--r--src/playstore/java/de/pixart/messenger/services/PushManagementService.java2
4 files changed, 28 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 7736aa0ba..72a78362a 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -50,6 +50,7 @@ import org.openintents.openpgp.util.OpenPgpServiceConnection;
import java.io.FileDescriptor;
import java.io.FileNotFoundException;
import java.math.BigInteger;
+import java.net.URL;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
@@ -98,8 +99,8 @@ import de.pixart.messenger.generator.AbstractGenerator;
import de.pixart.messenger.generator.IqGenerator;
import de.pixart.messenger.generator.MessageGenerator;
import de.pixart.messenger.generator.PresenceGenerator;
-import de.pixart.messenger.http.HttpConnectionManager;
import de.pixart.messenger.http.AesGcmURLStreamHandlerFactory;
+import de.pixart.messenger.http.HttpConnectionManager;
import de.pixart.messenger.parser.AbstractParser;
import de.pixart.messenger.parser.IqParser;
import de.pixart.messenger.parser.MessageParser;
@@ -130,6 +131,7 @@ import de.pixart.messenger.xmpp.OnMessagePacketReceived;
import de.pixart.messenger.xmpp.OnPresencePacketReceived;
import de.pixart.messenger.xmpp.OnStatusChanged;
import de.pixart.messenger.xmpp.OnUpdateBlocklist;
+import de.pixart.messenger.xmpp.Patches;
import de.pixart.messenger.xmpp.XmppConnection;
import de.pixart.messenger.xmpp.chatstate.ChatState;
import de.pixart.messenger.xmpp.forms.Data;
@@ -144,7 +146,6 @@ import de.pixart.messenger.xmpp.stanzas.IqPacket;
import de.pixart.messenger.xmpp.stanzas.MessagePacket;
import de.pixart.messenger.xmpp.stanzas.PresencePacket;
import me.leolin.shortcutbadger.ShortcutBadger;
-import java.net.URL;
public class XmppConnectionService extends Service {
@@ -1247,7 +1248,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/de/pixart/messenger/xmpp/Patches.java b/src/main/java/de/pixart/messenger/xmpp/Patches.java
new file mode 100644
index 000000000..85b32e3d5
--- /dev/null
+++ b/src/main/java/de/pixart/messenger/xmpp/Patches.java
@@ -0,0 +1,16 @@
+package de.pixart.messenger.xmpp;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Patches {
+ public static final List<String> DISCO_EXCEPTIONS = Arrays.asList(
+ "nimbuzz.com"
+ );
+ public static final List<XmppConnection.Identity> SUFFICIENT_PUSH = Arrays.asList(
+ XmppConnection.Identity.EJABBERD
+ );
+ public static final List<XmppConnection.Identity> BAD_MUC_REFLECTION = Arrays.asList(
+ XmppConnection.Identity.SLACK
+ );
+} \ No newline at end of file
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index 4a93d1eb6..aba117b77 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -1118,10 +1118,15 @@ public class XmppConnection implements Runnable {
synchronized (this.disco) {
this.disco.clear();
}
+ Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": starting service discovery");
mPendingServiceDiscoveries.set(0);
- mWaitForDisco.set(smVersion != 0 && !account.getJid().getDomainpart().equalsIgnoreCase("nimbuzz.com"));
+ 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();
- Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": starting service discovery");
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/de/pixart/messenger/services/PushManagementService.java b/src/playstore/java/de/pixart/messenger/services/PushManagementService.java
index 30d3f1769..1c3f160fe 100644
--- a/src/playstore/java/de/pixart/messenger/services/PushManagementService.java
+++ b/src/playstore/java/de/pixart/messenger/services/PushManagementService.java
@@ -105,7 +105,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() {