1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-16 14:01:58 +02:00

Add initial configuration message support to external resolvers, send proxy info

This commit is contained in:
Jeff Mitchell 2011-07-30 14:36:03 -04:00
parent 9120f6436c
commit 75596c6744

View File

@ -19,6 +19,8 @@
#include "scriptresolver.h"
#include <QtEndian>
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkProxy>
#include "artist.h"
#include "album.h"
@ -52,6 +54,25 @@ ScriptResolver::ScriptResolver( const QString& exe )
m_error = Tomahawk::ExternalResolver::FileNotFound;
else
m_proc.start( filePath() );
if ( !TomahawkUtils::nam() )
return;
// Send a configutaion message with any information the resolver might need
// For now, only the proxy information is sent
QVariantMap m;
m.insert( "_msgtype", "config" );
TomahawkUtils::NetworkProxyFactory* factory = dynamic_cast<TomahawkUtils::NetworkProxyFactory*>( TomahawkUtils::nam()->proxyFactory() );
QNetworkProxy proxy = factory->proxy();
QString proxyType = ( proxy.type() == QNetworkProxy::Socks5Proxy ? "socks5" : "none" );
m.insert( "proxytype", proxyType );
m.insert( "proxyhost", proxy.hostName() );
m.insert( "proxyport", proxy.port() );
m.insert( "proxyuser", proxy.user() );
m.insert( "proxypass", proxy.password() );
m.insert( "noproxyhosts", factory->noProxyHosts() );
QByteArray data = m_serializer.serialize( m );
sendMsg( data );
}