force tls for registrations as well

iNPUTmice created

Change summary

src/eu/siacs/conversations/xmpp/XmppConnection.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Detailed changes

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

@@ -583,10 +583,10 @@ public class XmppConnection implements Runnable {
 		} else if (compressionAvailable()) {
 			sendCompressionZlib();
 		} else if (this.streamFeatures.hasChild("register")
-				&& (account.isOptionSet(Account.OPTION_REGISTER))) {
+				&& account.isOptionSet(Account.OPTION_REGISTER) && usingEncryption) {
 			sendRegistryRequest();
 		} else if (!this.streamFeatures.hasChild("register")
-				&& (account.isOptionSet(Account.OPTION_REGISTER))) {
+				&& account.isOptionSet(Account.OPTION_REGISTER)) {
 			changeStatus(Account.STATUS_REGISTRATION_NOT_SUPPORTED);
 			disconnect(true);
 		} else if (this.streamFeatures.hasChild("mechanisms")
@@ -606,6 +606,9 @@ public class XmppConnection implements Runnable {
 			this.tagWriter.writeStanzaAsync(resume);
 		} else if (this.streamFeatures.hasChild("bind") && shouldBind) {
 			sendBindRequest();
+		} else {
+			Log.d(Config.LOGTAG,account.getJid()+": incompatible server. disconnecting");
+			disconnect(true);
 		}
 	}