[evolution-data-server] 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] Add camel_session_set/get_socks_proxy()
- Date: Wed, 2 Jun 2010 22:49:28 +0000 (UTC)
commit d59da86912ec590028573997f3d30f4c1ae37622
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-session.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
camel/camel-session.h | 8 ++++++++
2 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-session.c b/camel/camel-session.c
index a091873..df3e98a 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -64,6 +64,9 @@ struct _CamelSessionPrivate {
GHashTable *thread_msg_op;
GHashTable *junk_headers;
+ char *socks_proxy_host;
+ int socks_proxy_port;
+
guint check_junk : 1;
guint network_available : 1;
guint online : 1;
@@ -1101,3 +1104,44 @@ camel_session_unlock (CamelSession *session,
g_return_if_reached ();
}
}
+
+/**
+ * camel_session_set_socks_proxy:
+ * @session: A #CamelSession
+ * @socks_host: Hostname of the SOCKS proxy, or #NULL for none.
+ * @socks_port: Port number of the SOCKS proxy
+ *
+ * Sets a SOCKS proxy that will be used throughout the @session for TCP connections.
+ */
+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;
+}
+
+/**
+ * camel_session_get_socks_proxy:
+ * @session: A #CamelSession
+ * @host_ret: Location to return the SOCKS proxy hostname
+ * @port_ret: Location to return the SOCKS proxy port
+ *
+ * Queries the SOCKS proxy that is configured for a @session. This will
+ * put #NULL in @hosts_ret if there is no proxy configured.
+ */
+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;
+}
+
diff --git a/camel/camel-session.h b/camel/camel-session.h
index 76c7f60..8ad79e8 100644
--- a/camel/camel-session.h
+++ b/camel/camel-session.h
@@ -155,6 +155,14 @@ struct _CamelSessionClass {
GType 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]