mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-30 12:42:16 -05:00
migrate domain and host exemption into seperate class
This commit is contained in:
parent
abaabae853
commit
0d00ff0c15
@ -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);
|
||||
|
17
src/main/java/eu/siacs/conversations/xmpp/Patches.java
Normal file
17
src/main/java/eu/siacs/conversations/xmpp/Patches.java
Normal file
@ -0,0 +1,17 @@
|
||||
package eu.siacs.conversations.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
|
||||
);
|
||||
}
|
@ -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");
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user