Commit d6446c6c authored by Pali Rohár's avatar Pali Rohár
Browse files

Add support for SOCKS5 proxy in ICQ protocol

CCBUG: 119806
parent 55a5c85c
......@@ -421,6 +421,16 @@ If you do not currently have an ICQ account, please click the button to create o
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="edtProxyServerSocks5">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Proxy server is SOCKS5</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
......@@ -1072,5 +1082,21 @@ If you do not currently have an ICQ account, please click the button to create o
</hint>
</hints>
</connection>
<connection>
<sender>optionEnableProxy</sender>
<signal>toggled(bool)</signal>
<receiver>edtProxyServerSocks5</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>288</x>
<y>292</y>
</hint>
<hint type="destinationlabel">
<x>288</x>
<y>320</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -95,9 +95,11 @@ ICQEditAccountWidget::ICQEditAccountWidget(ICQProtocol *protocol,
mAccountSettings->edtServerEncrypted->setChecked( encryptedEntry );
bool proxyServerEnableEntry = mAccount->configGroup()->readEntry("ProxyEnable", false);
bool proxyServerSocks5Entry = mAccount->configGroup()->readEntry("ProxySocks5", false);
QString proxyServerEntry = mAccount->configGroup()->readEntry("ProxyServer", QString());
int proxyPortEntry = mAccount->configGroup()->readEntry("ProxyPort", 443);
mAccountSettings->optionEnableProxy->setChecked( proxyServerEnableEntry );
mAccountSettings->edtProxyServerSocks5->setChecked( proxyServerSocks5Entry );
mAccountSettings->edtProxyServerAddress->setText( proxyServerEntry );
mAccountSettings->edtProxyServerPort->setValue( proxyPortEntry );
......@@ -272,6 +274,7 @@ Kopete::Account *ICQEditAccountWidget::apply()
mAccount->setProxyServerEnabled( useProxy );
if ( mAccountSettings->optionEnableProxy->isChecked() )
{
mAccount->setProxyServerSocks5(mAccountSettings->edtProxyServerSocks5->isChecked());
mAccount->setProxyServerAddress(mAccountSettings->edtProxyServerAddress->text().trimmed());
mAccount->setProxyServerPort(mAccountSettings->edtProxyServerPort->value());
}
......
......@@ -733,6 +733,11 @@ void OscarAccount::setServerEncrypted( bool encrypted )
}
void OscarAccount::setProxyServerSocks5( bool enable )
{
configGroup()->writeEntry( QString::fromLatin1( "ProxySocks5" ), enable );
}
void OscarAccount::setProxyServerAddress(const QString &server)
{
configGroup()->writeEntry( QString::fromLatin1( "ProxyServer" ), server );
......@@ -1492,7 +1497,8 @@ void OscarAccount::createClientStream( ClientStream **clientStream )
{
QString proxyExp=configGroup()->readEntry( QString::fromLatin1( "ProxyServer" ), QString() );
int proxyPort=configGroup()->readEntry( QString::fromLatin1( "ProxyPort" ), 0 );
tcpSocket->setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, proxyExp, proxyPort));
bool proxySocks5=configGroup()->readEntry( QString::fromLatin1( "ProxySocks5" ), false );
tcpSocket->setProxy(QNetworkProxy(proxySocks5 ? QNetworkProxy::Socks5Proxy : QNetworkProxy::HttpProxy, proxyExp, proxyPort));
}
//TODO support for:
//-proxy requiring authentication
......
......@@ -89,6 +89,9 @@ public:
/** Set the server encryption */
void setServerEncrypted( bool encrypted );
/** Set if the proxy server is SOCKS5 */
void setProxyServerSocks5( bool enable );
/** Set the proxy server address */
void setProxyServerAddress( const QString& server );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment