summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/jabberconnector.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2016-11-13 15:18:42 +0100
committerSlávek Banko <slavek.banko@axis.cz>2016-11-13 15:18:54 +0100
commit8fb0b52d502e633720a8caa0ea603edb1d04fd1f (patch)
treec567744b14f6019b88f43ac9f523aff16411cf67 /kopete/protocols/jabber/jabberconnector.cpp
parent56484e2a730772015af966860f220867a2f0b580 (diff)
downloadtdenetwork-8fb0b52d502e633720a8caa0ea603edb1d04fd1f.tar.gz
tdenetwork-8fb0b52d502e633720a8caa0ea603edb1d04fd1f.zip
Kopete - jabber: Process all SRV records or fallback if SRV records not exist
This resolves bug 2723 Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 244c1e03a0954ef3f3cb9716f9c90ac2fb26bf39)
Diffstat (limited to 'kopete/protocols/jabber/jabberconnector.cpp')
-rw-r--r--kopete/protocols/jabber/jabberconnector.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/kopete/protocols/jabber/jabberconnector.cpp b/kopete/protocols/jabber/jabberconnector.cpp
index 1a2febf2..d08db42e 100644
--- a/kopete/protocols/jabber/jabberconnector.cpp
+++ b/kopete/protocols/jabber/jabberconnector.cpp
@@ -47,12 +47,10 @@ void JabberConnector::connectToServer ( const TQString &server )
{
kdDebug ( JABBER_DEBUG_GLOBAL ) << k_funcinfo << "Initiating connection to " << server << endl;
+ mServer = server;
mErrorCode = KNetwork::TDESocketBase::NoError;
if( mHost.isEmpty() ) {
- if( mSrvResolver->isBusy() ) {
- mSrvResolver->stop();
- }
mSrvResolver->resolve(server, "xmpp-client", "tcp");
return;
}
@@ -90,14 +88,21 @@ void JabberConnector::slotError ( int code )
void JabberConnector::slotSrvLookup()
{
if( mSrvResolver->failed() ) {
- mErrorCode = KNetwork::TDESocketBase::LookupFailure;
- emit error ();
+ if( mErrorCode == KNetwork::TDESocketBase::NoError ) {
+ // SRV records probably not exist - try server and default port as fallback
+ if ( !mByteStream->connect ( mServer, TQString::number ( 5222 ) )) {
+ mErrorCode = mByteStream->socket()->error ();
+ }
+ }
+ if( mErrorCode != KNetwork::TDESocketBase::NoError ) {
+ emit error ();
+ }
return;
}
if( !mByteStream->connect( mSrvResolver->resultAddress().toString(), TQString::number( mSrvResolver->resultPort() ))) {
mErrorCode = mByteStream->socket()->error ();
- emit error ();
+ mSrvResolver->next();
}
}