mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-01 14:42:25 +02:00
Various proxy-related fixes. Still doesn't work properly...parts of it do but gloox jabber doesn't. (Haven't tested twitter yet.)
This commit is contained in:
parent
77e37bb325
commit
35c2fccd6c
@ -316,10 +316,10 @@ ProxyDialog::saveSettings()
|
||||
s->setProxyPassword( ui->passwordLineEdit->text() );
|
||||
s->setProxyType( ui->typeBox->itemData( ui->typeBox->currentIndex() ).toInt() );
|
||||
|
||||
// Now, if a proxy is defined, set QNAM
|
||||
if( s->proxyType() == QNetworkProxy::NoProxy || s->proxyHost().isEmpty() )
|
||||
if( s->proxyHost().isEmpty() )
|
||||
return;
|
||||
|
||||
// Now, set QNAM
|
||||
QNetworkProxy proxy( static_cast<QNetworkProxy::ProxyType>(s->proxyType()), s->proxyHost(), s->proxyPort(), s->proxyUsername(), s->proxyPassword() );
|
||||
QNetworkAccessManager* nam = TomahawkUtils::nam();
|
||||
nam->setProxy( proxy );
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <gloox/capabilities.h>
|
||||
#include <QMessageBox>
|
||||
#include <qjson/parser.h>
|
||||
#include <tomahawksettings.h>
|
||||
|
||||
#define TOMAHAWK_CAP_NODE_NAME QString::fromAscii("http://tomahawk-player.org/")
|
||||
|
||||
@ -66,6 +67,10 @@ Jabber_p::Jabber_p( const QString& jid, const QString& password, const QString&
|
||||
const_cast<gloox::Capabilities*>(caps)->setNode(TOMAHAWK_CAP_NODE_NAME.toStdString());
|
||||
}
|
||||
m_server = server;
|
||||
|
||||
qDebug() << "proxy type is " << TomahawkUtils::proxy()->type();
|
||||
|
||||
setProxy( TomahawkUtils::proxy() );
|
||||
}
|
||||
|
||||
|
||||
@ -83,11 +88,26 @@ Jabber_p::~Jabber_p()
|
||||
void
|
||||
Jabber_p::resolveHostSRV()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if( m_server.isEmpty() )
|
||||
{
|
||||
qDebug() << "No server found!";
|
||||
return;
|
||||
}
|
||||
if( TomahawkUtils::proxy()->type() == QNetworkProxy::Socks5Proxy ||
|
||||
( TomahawkUtils::proxy()->type() == QNetworkProxy::DefaultProxy &&
|
||||
QNetworkProxy::applicationProxy().type() == QNetworkProxy::Socks5Proxy ) )
|
||||
{
|
||||
if( TomahawkSettings::instance()->jabberServer().isEmpty() )
|
||||
{
|
||||
qDebug() << "Right now, you must explicitly set your jabber server if you are using a proxy, due to a bug in the DNS lookup library";
|
||||
m_server = QString();
|
||||
}
|
||||
QMetaObject::invokeMethod( this, "go", Qt::QueuedConnection );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
TomahawkUtils::DNSResolver *resolver = TomahawkUtils::dnsResolver();
|
||||
connect( resolver, SIGNAL(result(QString &)), SLOT(resolveResult(QString &)) );
|
||||
qDebug() << "Resolving SRV record of " << m_server;
|
||||
@ -99,7 +119,7 @@ Jabber_p::setProxy( QNetworkProxy* proxy )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if( !m_client.isNull() || !proxy )
|
||||
if( m_client.isNull() || !proxy )
|
||||
{
|
||||
qDebug() << "No client or no proxy";
|
||||
return;
|
||||
@ -116,6 +136,8 @@ Jabber_p::setProxy( QNetworkProxy* proxy )
|
||||
else if( proxy->type() == QNetworkProxy::Socks5Proxy )
|
||||
{
|
||||
qDebug() << "Setting proxy to SOCKS5";
|
||||
qDebug() << "proxy host = " << proxy->hostName();
|
||||
qDebug() << "proxy port = " << proxy->port();
|
||||
m_client->setConnectionImpl( new gloox::ConnectionSOCKS5Proxy( m_client.data(),
|
||||
new gloox::ConnectionTCPClient( m_client->logInstance(), proxy->hostName().toStdString(), proxy->port() ),
|
||||
m_client->logInstance(), m_client->server(), m_client->port() ) );
|
||||
@ -138,6 +160,7 @@ Jabber_p::resolveResult( QString& result )
|
||||
void
|
||||
Jabber_p::go()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if( !m_server.isEmpty() )
|
||||
m_client->setServer( m_server.toStdString() );
|
||||
else
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QList>
|
||||
#include <QHostAddress>
|
||||
#include <QHostInfo>
|
||||
#include <QNetworkProxy>
|
||||
#include <QUdpSocket>
|
||||
#include <QTimer>
|
||||
|
||||
@ -80,6 +81,7 @@ public:
|
||||
: QObject( parent ), m_sock( this ), m_port( port )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
m_sock.setProxy( QNetworkProxy::NoProxy );
|
||||
m_sock.bind( ZCONF_PORT, QUdpSocket::ShareAddress );
|
||||
connect( &m_sock, SIGNAL( readyRead() ), this, SLOT( readPacket() ) );
|
||||
}
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "audio/audioengine.h"
|
||||
#include "utils/xspfloader.h"
|
||||
|
||||
#include <lastfm/ws.h>
|
||||
#include "config.h"
|
||||
|
||||
#ifndef TOMAHAWK_HEADLESS
|
||||
@ -175,8 +176,6 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
registerMetaTypes();
|
||||
setupLogfile();
|
||||
|
||||
Echonest::Config::instance()->setAPIKey( "JRIHWEP6GPOER2QQ6" );
|
||||
|
||||
new TomahawkSettings( this );
|
||||
m_audioEngine = new AudioEngine;
|
||||
new ScanManager( this );
|
||||
@ -248,10 +247,15 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
qDebug() << "Proxy type =" << QString::number( static_cast<int>(TomahawkUtils::proxy()->type()) );
|
||||
qDebug() << "Proxy host =" << TomahawkUtils::proxy()->hostName();
|
||||
TomahawkUtils::nam()->setProxy( *TomahawkUtils::proxy() );
|
||||
lastfm::nam()->setProxy( *TomahawkUtils::proxy() );
|
||||
}
|
||||
else
|
||||
TomahawkUtils::setProxy( new QNetworkProxy( QNetworkProxy::NoProxy ) );
|
||||
|
||||
|
||||
Echonest::Config::instance()->setAPIKey( "JRIHWEP6GPOER2QQ6" );
|
||||
Echonest::Config::instance()->setNetworkAccessManager( TomahawkUtils::nam() );
|
||||
|
||||
QNetworkProxy::setApplicationProxy( *TomahawkUtils::proxy() );
|
||||
|
||||
qDebug() << "Init SIP system.";
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QVariantMap>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QPushButton>
|
||||
#include <QString>
|
||||
#include <QStackedWidget>
|
||||
@ -88,7 +87,6 @@ private:
|
||||
Ui::TomahawkWindow* ui;
|
||||
AudioControls* m_audioControls;
|
||||
TomahawkTrayIcon* m_trayIcon;
|
||||
QNetworkAccessManager m_nam;
|
||||
QPushButton* m_statusButton;
|
||||
|
||||
QAction* m_backAvailable;
|
||||
|
Loading…
x
Reference in New Issue
Block a user