[evolution-data-server/camel-socks-proxy: 2/2] Add camel_session_set/get_socks_proxy()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/camel-socks-proxy: 2/2] Add camel_session_set/get_socks_proxy()
- Date: Wed, 12 May 2010 21:05:41 +0000 (UTC)
commit dc254023b6dc3a91b36fbfe37c6915fea64ecc05
Author: Federico Mena Quintero <federico novell com>
Date: Wed May 12 15:00:54 2010 -0500
Add camel_session_set/get_socks_proxy()
This is the only API that clients should need to call to
set a SOCKS proxy for Camel's TCP connections.
Signed-off-by: Federico Mena Quintero <federico novell com>
camel/camel-private.h | 2 ++
camel/camel-session.c | 23 +++++++++++++++++++++++
camel/camel-session.h | 7 +++++++
3 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-private.h b/camel/camel-private.h
index 51fc00f..f235ab4 100644
--- a/camel/camel-private.h
+++ b/camel/camel-private.h
@@ -97,6 +97,8 @@ struct _CamelSessionPrivate {
GHashTable *thread_msg_op;
GHashTable *junk_headers;
+ char *socks_proxy_host;
+ int socks_proxy_port;
};
#define CAMEL_SESSION_LOCK(f, l) \
diff --git a/camel/camel-session.c b/camel/camel-session.c
index 5b626ac..93f5b49 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -159,6 +159,29 @@ camel_session_construct (CamelSession *session, const gchar *storage_path)
session->storage_path = g_strdup (storage_path);
}
+void
+camel_session_set_socks_proxy (CamelSession *session, const gchar *socks_host, int socks_port)
+{
+ g_return_if_fail (CAMEL_IS_SESSION (session));
+
+ if (session->priv->socks_proxy_host)
+ g_free (session->priv->socks_proxy_host);
+
+ session->priv->socks_proxy_host = g_strdup (socks_host);
+ session->priv->socks_proxy_port = socks_port;
+}
+
+void
+camel_session_get_socks_proxy (CamelSession *session, const char **host_ret, int *port_ret)
+{
+ g_return_if_fail (CAMEL_IS_SESSION (session));
+ g_return_if_fail (host_ret != NULL);
+ g_return_if_fail (port_ret != NULL);
+
+ *host_ret = g_strdup (session->priv->socks_proxy_host);
+ *port_ret = session->priv->socks_proxy_port;
+}
+
static CamelService *
get_service (CamelSession *session, const gchar *url_string,
CamelProviderType type, CamelException *ex)
diff --git a/camel/camel-session.h b/camel/camel-session.h
index e6d6455..f063c42 100644
--- a/camel/camel-session.h
+++ b/camel/camel-session.h
@@ -132,6 +132,13 @@ CamelType camel_session_get_type (void);
void camel_session_construct (CamelSession *session,
const gchar *storage_path);
+void camel_session_set_socks_proxy (CamelSession *session,
+ const gchar *socks_host,
+ gint socks_port);
+void camel_session_get_socks_proxy (CamelSession *session,
+ const char **host_ret,
+ int *port_ret);
+
CamelService * camel_session_get_service (CamelSession *session,
const gchar *url_string,
CamelProviderType type,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]