[evolution-ews] Bug #698728 - Use proxy settings to connect to the server
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Bug #698728 - Use proxy settings to connect to the server
- Date: Wed, 15 May 2013 17:45:32 +0000 (UTC)
commit 9400df7d3b762245da5437f7d268a44b5ea29545
Author: Milan Crha <mcrha redhat com>
Date: Wed May 15 19:44:28 2013 +0200
Bug #698728 - Use proxy settings to connect to the server
src/server/e-ews-connection.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index 1755ff3..c53ae11 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -80,6 +80,7 @@ struct _EEwsConnectionPrivate {
GThread *soup_thread;
GMainLoop *soup_loop;
GMainContext *soup_context;
+ EProxy *proxy;
CamelEwsSettings *settings;
GMutex password_lock;
@@ -1249,6 +1250,24 @@ create_folder_response_cb (ESoapResponse *response,
}
static void
+proxy_settings_changed (EProxy *proxy,
+ gpointer user_data)
+{
+ SoupURI *proxy_uri = NULL;
+ EEwsConnection *cnc = (EEwsConnection *) user_data;
+
+ if (!cnc || !cnc->priv || !cnc->priv->uri || !cnc->priv->soup_session)
+ return;
+
+ /* use proxy if necessary */
+ if (e_proxy_require_proxy_for_uri (proxy, cnc->priv->uri)) {
+ proxy_uri = e_proxy_peek_uri_for (proxy, cnc->priv->uri);
+ }
+
+ g_object_set (cnc->priv->soup_session, SOUP_SESSION_PROXY_URI, proxy_uri, NULL);
+}
+
+static void
ews_connection_set_settings (EEwsConnection *connection,
CamelEwsSettings *settings)
{
@@ -1342,6 +1361,11 @@ ews_connection_dispose (GObject *object)
priv->soup_context = NULL;
}
+ if (priv->proxy) {
+ g_object_unref (priv->proxy);
+ priv->proxy = NULL;
+ }
+
if (priv->settings != NULL) {
g_object_unref (priv->settings);
priv->settings = NULL;
@@ -1514,6 +1538,10 @@ e_ews_connection_init (EEwsConnection *cnc)
cnc->priv->version = E_EWS_EXCHANGE_UNKNOWN;
+ cnc->priv->proxy = e_proxy_new ();
+ e_proxy_setup_proxy (cnc->priv->proxy);
+ g_signal_connect (cnc->priv->proxy, "changed", G_CALLBACK (proxy_settings_changed), cnc);
+
if (g_getenv ("EWS_DEBUG") && (atoi (g_getenv ("EWS_DEBUG")) >= 2)) {
SoupLogger *logger;
logger = soup_logger_new (SOUP_LOGGER_LOG_BODY, -1);
@@ -1853,6 +1881,9 @@ e_ews_connection_new (const gchar *uri,
loaded_connections_permissions,
g_strdup (cnc->priv->hash_key), cnc);
+ /* update proxy with set 'uri' */
+ proxy_settings_changed (cnc->priv->proxy, cnc);
+
/* free memory */
g_mutex_unlock (&connecting);
return cnc;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]