From 9e54917ff838195bba3a03755acaf2c7c452622e Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Sat, 23 Jul 2011 11:37:32 -0400 Subject: [PATCH] Remove now-unnecessary and buggy proxy code in jabber plugin --- .../infosystem/infosystemworker.cpp | 9 ---- src/sip/jabber/jabber.cpp | 42 ------------------- src/sip/jabber/jabber.h | 4 -- 3 files changed, 55 deletions(-) diff --git a/src/libtomahawk/infosystem/infosystemworker.cpp b/src/libtomahawk/infosystem/infosystemworker.cpp index 38976aaae..1cd811fda 100644 --- a/src/libtomahawk/infosystem/infosystemworker.cpp +++ b/src/libtomahawk/infosystem/infosystemworker.cpp @@ -359,15 +359,6 @@ InfoSystemWorker::newNam() newNam->setProxyFactory( newProxyFactory ); m_nam = QWeakPointer< QNetworkAccessManager >( newNam ); - QNetworkProxy m_usedProxy = oldProxyFactory->queryProxy( QNetworkProxyQuery( "www.google.com", 5522 ) ).first(); - QNetworkProxy proxyToUse = newProxyFactory->queryProxy( QNetworkProxyQuery( "www.google.com", 5522 ) ).first(); - qDebug() << Q_FUNC_INFO << "proxyToUse host: " << proxyToUse.hostName() << ", usedProxy host: " << m_usedProxy.hostName(); - qDebug() << Q_FUNC_INFO << "proxyToUse port: " << proxyToUse.port() << ", usedProxy port: " << m_usedProxy.port(); - qDebug() << Q_FUNC_INFO << "proxyToUse user: " << proxyToUse.user() << ", usedProxy user: " << m_usedProxy.user(); - qDebug() << Q_FUNC_INFO << "proxyToUse pass: " << proxyToUse.password() << ", usedProxy pass: " << m_usedProxy.password(); - qDebug() << Q_FUNC_INFO << "proxyToUse type: " << proxyToUse.type() << ", usedProxy type: " << m_usedProxy.type(); - qDebug() << Q_FUNC_INFO << "proxyToUse caps: " << proxyToUse.capabilities() << ", usedProxy caps: " << m_usedProxy.capabilities(); - emit namChanged( m_nam.data() ); //FIXME: Currently leaking nam/proxyfactory above -- how to change in a thread-safe way? diff --git a/src/sip/jabber/jabber.cpp b/src/sip/jabber/jabber.cpp index f5266934e..da8cb4926 100644 --- a/src/sip/jabber/jabber.cpp +++ b/src/sip/jabber/jabber.cpp @@ -153,30 +153,6 @@ JabberPlugin::~JabberPlugin() delete m_ui; } -void -JabberPlugin::refreshProxy() -{ - qDebug() << Q_FUNC_INFO; - - if( !m_client->connection() ) - return; - - QNetworkProxy proxyToUse = TomahawkUtils::proxyFactory()->queryProxy( QNetworkProxyQuery( m_currentServer, m_currentPort ) ).first(); - m_usedProxy = proxyToUse; - - if( proxyToUse.type() != QNetworkProxy::NoProxy && ( m_currentServer.isEmpty() || !(m_currentPort > 0) ) ) - { - qDebug() << Q_FUNC_INFO << " proxy type is not noproxy but no server/port set"; - // patches are welcome in Jreen that implement jdns through proxy - emit error( SipPlugin::ConnectionError, - tr( "You need to set hostname and port of your jabber server, if you want to use it through a proxy" ) ); - return; - } - - qDebug() << Q_FUNC_INFO << " proxy type is NoProxy ? " << (proxyToUse.type() == QNetworkProxy::NoProxy ? "true" : "false" ); - qobject_cast( m_client->connection() )->setProxy( proxyToUse ); -} - const QString JabberPlugin::name() const @@ -227,8 +203,6 @@ JabberPlugin::connectPlugin( bool startup ) return true; //FIXME: should i return false here?! } - refreshProxy(); - qDebug() << "Connecting to the XMPP server..." << m_client->jid().full(); //FIXME: we're badly workarounding some missing reconnection api here, to be fixed soon @@ -523,22 +497,6 @@ JabberPlugin::checkSettings() if ( m_currentPort != readPort() ) reconnect = true; - QNetworkProxy proxyToUse = TomahawkUtils::proxyFactory()->queryProxy( QNetworkProxyQuery( m_currentServer, m_currentPort ) ).first(); - qDebug() << Q_FUNC_INFO << "proxyToUse host: " << proxyToUse.hostName() << ", usedProxy host: " << m_usedProxy.hostName(); - qDebug() << Q_FUNC_INFO << "proxyToUse port: " << proxyToUse.port() << ", usedProxy port: " << m_usedProxy.port(); - qDebug() << Q_FUNC_INFO << "proxyToUse user: " << proxyToUse.user() << ", usedProxy user: " << m_usedProxy.user(); - qDebug() << Q_FUNC_INFO << "proxyToUse pass: " << proxyToUse.password() << ", usedProxy pass: " << m_usedProxy.password(); - qDebug() << Q_FUNC_INFO << "proxyToUse type: " << proxyToUse.type() << ", usedProxy type: " << m_usedProxy.type(); - qDebug() << Q_FUNC_INFO << "proxyToUse caps: " << proxyToUse.capabilities() << ", usedProxy caps: " << m_usedProxy.capabilities(); - if ( proxyToUse.hostName() != m_usedProxy.hostName() || - proxyToUse.port() != m_usedProxy.port() || - proxyToUse.user() != m_usedProxy.user() || - proxyToUse.password() != m_usedProxy.password() || - proxyToUse.type() != m_usedProxy.type() || - proxyToUse.capabilities() != m_usedProxy.capabilities() - ) - reconnect = true; - m_currentUsername = accountName(); m_currentPassword = readPassword(); m_currentServer = readServer(); diff --git a/src/sip/jabber/jabber.h b/src/sip/jabber/jabber.h index d71bcdd5f..1d12bb7de 100644 --- a/src/sip/jabber/jabber.h +++ b/src/sip/jabber/jabber.h @@ -38,7 +38,6 @@ #include #include -#include #include #define MYNAME "SIPJREEN" @@ -95,7 +94,6 @@ public slots: void sendMsg( const QString& to, const QString& msg ); void broadcastMsg( const QString &msg ); void addContact( const QString &jid, const QString& msg = QString() ); - void refreshProxy(); void showAddFriendDialog(); protected: @@ -159,8 +157,6 @@ private: enum IqContext { NoContext, RequestDisco, RequestedDisco, SipMessageSent, RequestedVCard, RequestVersion, RequestedVersion }; QStringList m_legacy_peers; AvatarManager *m_avatarManager; - - QNetworkProxy m_usedProxy; }; #endif