1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 03:40:16 +02:00

Add proxy support to the sip plugins and the sip handler

This commit is contained in:
Dominik Schmidt
2011-05-08 15:44:17 +02:00
parent 6c8252cefb
commit 6118432dd7
4 changed files with 17 additions and 4 deletions

View File

@@ -367,6 +367,7 @@ SipHandler::connectPlugin( bool startup, const QString &pluginId )
if ( sip->pluginId() == pluginId ) if ( sip->pluginId() == pluginId )
{ {
Q_ASSERT( m_enabledPlugins.contains( sip ) ); // make sure the plugin we're connecting is enabled. should always be the case Q_ASSERT( m_enabledPlugins.contains( sip ) ); // make sure the plugin we're connecting is enabled. should always be the case
sip->setProxy( m_proxy );
sip->connectPlugin( startup ); sip->connectPlugin( startup );
} }
} }
@@ -417,6 +418,17 @@ SipHandler::toggleConnect()
connectAll(); connectAll();
} }
void
SipHandler::setProxy( const QNetworkProxy& proxy )
{
qDebug() << Q_FUNC_INFO;
m_proxy = proxy;
foreach( SipPlugin* sip, m_allPlugins )
sip->setProxy( proxy );
}
void void
SipHandler::onPeerOnline( const QString& jid ) SipHandler::onPeerOnline( const QString& jid )

View File

@@ -67,6 +67,8 @@ public slots:
void toggleConnect(); void toggleConnect();
void setProxy( const QNetworkProxy &proxy );
// create a new plugin of the given name. the name is the value returned in SipPluginFactory::pluginName // create a new plugin of the given name. the name is the value returned in SipPluginFactory::pluginName
// be default sip plugins are NOt connected when created // be default sip plugins are NOt connected when created
SipPlugin* createPlugin( const QString& factoryName ); SipPlugin* createPlugin( const QString& factoryName );
@@ -116,6 +118,7 @@ private:
QList< SipPlugin* > m_enabledPlugins; QList< SipPlugin* > m_enabledPlugins;
QList< SipPlugin* > m_connectedPlugins; QList< SipPlugin* > m_connectedPlugins;
bool m_connected; bool m_connected;
QNetworkProxy m_proxy;
//TODO: move this to source //TODO: move this to source
QHash<QString, QVariantMap> m_peersSipInfos; QHash<QString, QVariantMap> m_peersSipInfos;

View File

@@ -87,7 +87,7 @@ public slots:
virtual void addContact( const QString &jid, const QString& msg = QString() ) = 0; virtual void addContact( const QString &jid, const QString& msg = QString() ) = 0;
virtual void sendMsg( const QString& to, const QString& msg ) = 0; virtual void sendMsg( const QString& to, const QString& msg ) = 0;
void setProxy( const QNetworkProxy &proxy ); virtual void setProxy( const QNetworkProxy &proxy );
signals: signals:
void error( int, const QString& ); void error( int, const QString& );

View File

@@ -534,10 +534,8 @@ TomahawkApp::setupSIP()
#endif #endif
qDebug() << "Connecting SIP classes"; qDebug() << "Connecting SIP classes";
SipHandler::instance()->setProxy( *TomahawkUtils::proxy() );
SipHandler::instance()->loadFromConfig( true ); SipHandler::instance()->loadFromConfig( true );
// m_sipHandler->setProxy( *TomahawkUtils::proxy() );
} }
} }