1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 16:29:43 +01:00

Make less usage of QHostAddress when dealing with DNS records.

This commit is contained in:
Uwe L. Korn 2013-05-22 11:12:41 +02:00
parent 3823bce04e
commit e16028f164
2 changed files with 3 additions and 3 deletions
src
accounts/xmpp/sip
libtomahawk/network

@ -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<SipInfo>( new SipInfo( info ) );

@ -398,7 +398,7 @@ Servent::getSipInfoForOldVersions( const QList<SipInfo>& 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<SipInfo>& 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 );