@@ -149,17 +149,18 @@ AdvancedConnector::Proxy::operator QNetworkProxy()
149
149
// AdvancedConnector
150
150
// ----------------------------------------------------------------------------
151
151
typedef enum { Idle, Connecting, Connected } Mode;
152
- typedef enum { Force, Probe, Never } LegacySSL;
152
+ typedef enum : char { Force, Probe, Never } LegacySSL;
153
153
154
154
class AdvancedConnector ::Private {
155
155
public:
156
156
ByteStream *bs; // !< Socket to use
157
157
158
158
/* configuration values / "options" */
159
- QString opt_host; // !< explicit host from config
160
- quint16 opt_port; // !< explicit port from config
161
- LegacySSL opt_ssl; // !< Whether to use legacy SSL support
162
- Proxy proxy; // !< Proxy configuration
159
+ QString opt_host; // !< explicit host from config
160
+ quint16 opt_port; // !< explicit port from config
161
+ LegacySSL opt_ssl = Never; // !< Whether to use legacy SSL support
162
+ bool opt_srvtls = true ; // !< Whether to lookup tls port from SRV
163
+ Proxy proxy; // !< Proxy configuration
163
164
164
165
/* State tracking values */
165
166
Mode mode; // !< Idle, Connecting, Connected
@@ -242,6 +243,8 @@ void AdvancedConnector::setOptSSL(bool b)
242
243
d->opt_ssl = (b ? Force : Never);
243
244
}
244
245
246
+ void AdvancedConnector::setOptTlsSrv (bool value) { d->opt_srvtls = value; }
247
+
245
248
void AdvancedConnector::connectToServer (const QString &server)
246
249
{
247
250
#ifdef XMPP_DEBUG
@@ -335,13 +338,15 @@ void AdvancedConnector::connectToServer(const QString &server)
335
338
});
336
339
connect (s, SIGNAL (error (int )), SLOT (bs_error (int )));
337
340
338
- QStringList services = { XMPP_CLIENT_SRV };
339
341
if (!d->opt_host .isEmpty ()) { /* if custom host:port */
340
342
d->host = d->opt_host ;
341
343
d->port = d->opt_port ;
342
344
s->connectToHost (d->host , quint16 (d->port ));
343
345
return ;
344
- } else if (d->opt_ssl != Never) { /* if ssl forced or should be probed */
346
+ }
347
+
348
+ QStringList services = { XMPP_CLIENT_SRV };
349
+ if (d->opt_ssl == Never && d->opt_srvtls ) { /* if ssl forced or should be probed */
345
350
d->port = XMPP_LEGACY_PORT;
346
351
services << XMPP_CLIENT_TLS_SRV;
347
352
}
0 commit comments