remove work arounds for slack

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/entities/Account.java               |  8 
src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 12 
src/main/java/eu/siacs/conversations/xmpp/Patches.java                   |  3 
src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java            | 33 
4 files changed, 4 insertions(+), 52 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/entities/Account.java 🔗

@@ -222,14 +222,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);
     }

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java 🔗

@@ -61,7 +61,6 @@ import org.openintents.openpgp.util.OpenPgpApi;
 import org.openintents.openpgp.util.OpenPgpServiceConnection;
 
 import java.io.File;
-import java.security.SecureRandom;
 import java.security.Security;
 import java.security.cert.CertificateException;
 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.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;
@@ -818,7 +816,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;
             }
@@ -1520,9 +1518,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);
 
@@ -3654,7 +3650,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);
             }
         });
@@ -4680,7 +4676,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);
             }
         });
     }

src/main/java/eu/siacs/conversations/xmpp/Patches.java 🔗

@@ -8,7 +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
-    );
 }

src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java 🔗

@@ -2545,43 +2545,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) {