diff --git a/src/accounts/xmpp/sip/TomahawkXmppMessageFactory.cpp b/src/accounts/xmpp/sip/TomahawkXmppMessageFactory.cpp index 7cf4f6a88..c7e2c5c42 100644 --- a/src/accounts/xmpp/sip/TomahawkXmppMessageFactory.cpp +++ b/src/accounts/xmpp/sip/TomahawkXmppMessageFactory.cpp @@ -142,7 +142,7 @@ void TomahawkXmppMessageFactory::serialize(Payload *extension, QXmlStreamWriter if ( info.isVisible() ) { QHostAddress ha = QHostAddress( info.host() ); - if ( ( Servent::isValidExternalIP( ha ) && ha.protocol() == QAbstractSocket::IPv4Protocol ) || ( ha.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol ) ) + if ( ( Servent::isValidExternalIP( ha ) && ha.protocol() == QAbstractSocket::IPv4Protocol ) || ( ha.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol ) || ( ha.isNull() && !info.host().isEmpty() ) ) { // For comapability reasons, this shall be put as the last candidate (this is the IP/host that would have been sent in previous versions) lastInfo = QSharedPointer( new SipInfo( info ) ); diff --git a/src/libtomahawk/network/Servent.cpp b/src/libtomahawk/network/Servent.cpp index 88e388485..126bc932a 100644 --- a/src/libtomahawk/network/Servent.cpp +++ b/src/libtomahawk/network/Servent.cpp @@ -398,7 +398,7 @@ Servent::getSipInfoForOldVersions( const QList& sipInfos ) const foreach ( SipInfo _info, sipInfos ) { QHostAddress ha = QHostAddress( _info.host() ); - if ( ( Servent::isValidExternalIP( ha ) && ha.protocol() == QAbstractSocket::IPv4Protocol ) || ( ha.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol ) ) + if ( ( Servent::isValidExternalIP( ha ) && ha.protocol() == QAbstractSocket::IPv4Protocol ) || ( ha.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol ) || ( ha.isNull() && !_info.host().isEmpty() )) { info = _info; break; @@ -931,7 +931,7 @@ Servent::connectToPeer(const peerinfo_ptr& peerInfo, const QList& sipIn // Check that we are not connecting to ourselves foreach( QHostAddress ha, m_externalAddresses ) { - if ( QHostAddress( info.host() ) == ha) + if ( info.host() == ha.toString() ) { peerInfoDebug(peerInfo) << Q_FUNC_INFO << "Tomahawk won't try to connect to" << info.host() << ":" << info.port() << ": same IP as ourselves."; connectToPeer( peerInfo, sipInfo, conn );