remove work arounds for slack

(cherry picked from commit 97d9cb7dd53c127b170db41d2e3ed3b4da415e8f)
This commit is contained in:
Daniel Gultsch 2023-01-01 12:05:49 +01:00 committed by Arne
parent 05845985c3
commit 2e7adc6223
4 changed files with 6 additions and 55 deletions

View file

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

View file

@ -189,7 +189,6 @@ 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;
@ -862,7 +861,7 @@ public class XmppConnectionService extends Service {
case Intent.ACTION_SEND:
Uri uri = intent.getData();
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;
}
@ -1826,9 +1825,7 @@ public class XmppConnectionService extends Service {
}
}
MessagePacket packet = null;
final boolean addToConversation = (conversation.getMode() != Conversation.MODE_MULTI
|| !Patches.BAD_MUC_REFLECTION.contains(account.getServerIdentity()))
&& !message.edited();
final boolean addToConversation = !message.edited();
boolean saveInDb = addToConversation;
message.setStatus(Message.STATUS_WAITING);
@ -4156,7 +4153,7 @@ public class XmppConnectionService extends Service {
}
});
} 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);
}
});
@ -5300,7 +5297,7 @@ public class XmppConnectionService extends Service {
mAvatarService.clear(account);
sendIqPacket(account, request, (account1, packet) -> {
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

@ -1,5 +1,6 @@
package eu.siacs.conversations.xmpp;
import java.util.Arrays;
import java.util.List;
@ -7,10 +8,4 @@ public class Patches {
public static final List<String> DISCO_EXCEPTIONS = Arrays.asList(
"nimbuzz.com"
);
public static final List<XmppConnection.Identity> BAD_MUC_REFLECTION = Arrays.asList(
XmppConnection.Identity.SLACK
);
public static final List<String> ENCRYPTION_EXCEPTIONS = Arrays.asList(
"support@monocles.de"
);
}
}

View file

@ -2689,43 +2689,10 @@ public class XmppConnection implements Runnable {
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() {
return mXmppConnectionService.getIqGenerator();
}
public enum Identity {
FACEBOOK,
SLACK,
EJABBERD,
PROSODY,
NIMBUZZ,
UNKNOWN
}
private class MyKeyManager implements X509KeyManager {
@Override
public String chooseClientAlias(String[] strings, Principal[] principals, Socket socket) {