remove work arounds for slack

This commit is contained in:
Daniel Gultsch 2023-01-01 12:05:49 +01:00
parent 33850ae603
commit 97d9cb7dd5
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
4 changed files with 4 additions and 52 deletions

View file

@ -222,14 +222,6 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
this.displayName = displayName; this.displayName = displayName;
} }
public XmppConnection.Identity getServerIdentity() {
if (xmppConnection == null) {
return XmppConnection.Identity.UNKNOWN;
} else {
return xmppConnection.getServerIdentity();
}
}
public Contact getSelfContact() { public Contact getSelfContact() {
return getRoster().getContact(jid); return getRoster().getContact(jid);
} }

View file

@ -61,7 +61,6 @@ import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpServiceConnection; import org.openintents.openpgp.util.OpenPgpServiceConnection;
import java.io.File; import java.io.File;
import java.security.SecureRandom;
import java.security.Security; import java.security.Security;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
@ -154,7 +153,6 @@ import eu.siacs.conversations.xmpp.OnMessagePacketReceived;
import eu.siacs.conversations.xmpp.OnPresencePacketReceived; import eu.siacs.conversations.xmpp.OnPresencePacketReceived;
import eu.siacs.conversations.xmpp.OnStatusChanged; import eu.siacs.conversations.xmpp.OnStatusChanged;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import eu.siacs.conversations.xmpp.Patches;
import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.chatstate.ChatState;
import eu.siacs.conversations.xmpp.forms.Data; import eu.siacs.conversations.xmpp.forms.Data;
@ -818,7 +816,7 @@ public class XmppConnectionService extends Service {
case Intent.ACTION_SEND: case Intent.ACTION_SEND:
Uri uri = intent.getData(); Uri uri = intent.getData();
if (uri != null) { if (uri != null) {
Log.d(Config.LOGTAG, "received uri permission for " + uri.toString()); Log.d(Config.LOGTAG, "received uri permission for " + uri);
} }
return START_STICKY; return START_STICKY;
} }
@ -1520,9 +1518,7 @@ public class XmppConnectionService extends Service {
} }
MessagePacket packet = null; MessagePacket packet = null;
final boolean addToConversation = (conversation.getMode() != Conversation.MODE_MULTI final boolean addToConversation = !message.edited();
|| !Patches.BAD_MUC_REFLECTION.contains(account.getServerIdentity()))
&& !message.edited();
boolean saveInDb = addToConversation; boolean saveInDb = addToConversation;
message.setStatus(Message.STATUS_WAITING); message.setStatus(Message.STATUS_WAITING);
@ -3654,7 +3650,7 @@ public class XmppConnectionService extends Service {
} }
}); });
} else { } else {
Log.d(Config.LOGTAG, "failed to request vcard " + response.toString()); Log.d(Config.LOGTAG, "failed to request vcard " + response);
callback.onAvatarPublicationFailed(R.string.error_publish_avatar_no_server_support); callback.onAvatarPublicationFailed(R.string.error_publish_avatar_no_server_support);
} }
}); });
@ -4680,7 +4676,7 @@ public class XmppConnectionService extends Service {
mAvatarService.clear(account); mAvatarService.clear(account);
sendIqPacket(account, request, (account1, packet) -> { sendIqPacket(account, request, (account1, packet) -> {
if (packet.getType() == IqPacket.TYPE.ERROR) { if (packet.getType() == IqPacket.TYPE.ERROR) {
Log.d(Config.LOGTAG, account1.getJid().asBareJid() + ": unable to modify nick name " + packet.toString()); Log.d(Config.LOGTAG, account1.getJid().asBareJid() + ": unable to modify nick name " + packet);
} }
}); });
} }

View file

@ -8,7 +8,4 @@ public class Patches {
public static final List<String> DISCO_EXCEPTIONS = Arrays.asList( public static final List<String> DISCO_EXCEPTIONS = Arrays.asList(
"nimbuzz.com" "nimbuzz.com"
); );
public static final List<XmppConnection.Identity> BAD_MUC_REFLECTION = Arrays.asList(
XmppConnection.Identity.SLACK
);
} }

View file

@ -2545,43 +2545,10 @@ public class XmppConnection implements Runnable {
this.mInteractive = interactive; this.mInteractive = interactive;
} }
public Identity getServerIdentity() {
synchronized (this.disco) {
ServiceDiscoveryResult result = disco.get(account.getJid().getDomain());
if (result == null) {
return Identity.UNKNOWN;
}
for (final ServiceDiscoveryResult.Identity id : result.getIdentities()) {
if (id.getType().equals("im")
&& id.getCategory().equals("server")
&& id.getName() != null) {
switch (id.getName()) {
case "Prosody":
return Identity.PROSODY;
case "ejabberd":
return Identity.EJABBERD;
case "Slack-XMPP":
return Identity.SLACK;
}
}
}
}
return Identity.UNKNOWN;
}
private IqGenerator getIqGenerator() { private IqGenerator getIqGenerator() {
return mXmppConnectionService.getIqGenerator(); return mXmppConnectionService.getIqGenerator();
} }
public enum Identity {
FACEBOOK,
SLACK,
EJABBERD,
PROSODY,
NIMBUZZ,
UNKNOWN
}
private class MyKeyManager implements X509KeyManager { private class MyKeyManager implements X509KeyManager {
@Override @Override
public String chooseClientAlias(String[] strings, Principal[] principals, Socket socket) { public String chooseClientAlias(String[] strings, Principal[] principals, Socket socket) {