aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorManjeet Dahiya <manjeetdahiya@gmail.com>2009-10-24 07:00:05 +0000
committerManjeet Dahiya <manjeetdahiya@gmail.com>2009-10-24 07:00:05 +0000
commit73e0ff12326f1a44c43e3a046ba34154deffbf9c (patch)
treed7634d9eff583fb7792f09ab8fbba94453e81368 /source
parenta02e9470dea63957d703931ede50934cdac15882 (diff)
downloadqxmpp-73e0ff12326f1a44c43e3a046ba34154deffbf9c.tar.gz
Fix for Issue 12: Proxy support
Adding functions in QXmppConfiguration to specify QNetworkProxy.
Diffstat (limited to 'source')
-rw-r--r--source/QXmppConfiguration.cpp23
-rw-r--r--source/QXmppConfiguration.h6
-rw-r--r--source/QXmppStream.cpp3
3 files changed, 31 insertions, 1 deletions
diff --git a/source/QXmppConfiguration.cpp b/source/QXmppConfiguration.cpp
index d40956ea..af643d4a 100644
--- a/source/QXmppConfiguration.cpp
+++ b/source/QXmppConfiguration.cpp
@@ -192,3 +192,26 @@ void QXmppConfiguration::setSASLAuthMechanism(
{
m_SASLAuthMechanism = mech;
}
+
+/// Specifies the network proxy used for the connection made by QXmppClient.
+/// The default value is QNetworkProxy::DefaultProxy that is the proxy is
+/// determined based on the application proxy set using
+/// QNetworkProxy::setApplicationProxy().
+/// \param proxy QNetworkProxy
+
+void QXmppConfiguration::setNetworkProxy(const QNetworkProxy& proxy)
+{
+ m_networkProxy = proxy;
+}
+
+/// Returns the specified network proxy.
+/// The default value is QNetworkProxy::DefaultProxy that is the proxy is
+/// determined based on the application proxy set using
+/// QNetworkProxy::setApplicationProxy().
+/// \return QNetworkProxy
+
+QNetworkProxy QXmppConfiguration::getNetworkProxy()
+{
+ return m_networkProxy;
+}
+
diff --git a/source/QXmppConfiguration.h b/source/QXmppConfiguration.h
index 9b144b56..cb3f60e9 100644
--- a/source/QXmppConfiguration.h
+++ b/source/QXmppConfiguration.h
@@ -26,6 +26,7 @@
#define QXMPPCONFIGURATION_H
#include <QString>
+#include <QNetworkProxy>
class QXmppConfiguration
{
@@ -100,6 +101,9 @@ public:
getSASLAuthMechanism() const;
void setSASLAuthMechanism(QXmppConfiguration::SASLAuthMechanism);
+ void setNetworkProxy(const QNetworkProxy& proxy);
+ QNetworkProxy getNetworkProxy();
+
private:
QString m_host;
int m_port;
@@ -126,6 +130,8 @@ private:
StreamSecurityMode m_streamSecurityMode;
NonSASLAuthMechanism m_nonSASLAuthMechanism;
SASLAuthMechanism m_SASLAuthMechanism;
+
+ QNetworkProxy m_networkProxy;
};
#endif // QXMPPCONFIGURATION_H
diff --git a/source/QXmppStream.cpp b/source/QXmppStream.cpp
index 9c4bd5bd..70e9a4e8 100644
--- a/source/QXmppStream.cpp
+++ b/source/QXmppStream.cpp
@@ -103,9 +103,10 @@ QXmppConfiguration& QXmppStream::getConfiguration()
void QXmppStream::connect()
{
- // work with time out
log(QString("Connecting to: %1:%2").arg(getConfiguration().
getHost()).arg(getConfiguration().getPort()));
+
+ m_socket.setProxy(getConfiguration().getNetworkProxy());
m_socket.connectToHost(getConfiguration().
getHost(), getConfiguration().getPort());
}