[evolution-data-server/camel-socks-proxy] Use the SOCKS proxy in the imap4 store



commit a59606de3973c468608c926b5b172e9bbc695341
Author: Federico Mena Quintero <federico novell com>
Date:   Thu May 13 14:02:23 2010 -0500

    Use the SOCKS proxy in the imap4 store
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 camel/providers/imap4/camel-imap4-store.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/camel/providers/imap4/camel-imap4-store.c b/camel/providers/imap4/camel-imap4-store.c
index d7f35e6..002cc06 100644
--- a/camel/providers/imap4/camel-imap4-store.c
+++ b/camel/providers/imap4/camel-imap4-store.c
@@ -228,6 +228,9 @@ static gboolean
 connect_to_server (CamelIMAP4Engine *engine, struct addrinfo *ai, gint ssl_mode, CamelException *ex)
 {
 	CamelService *service = engine->service;
+	CamelSession *session;
+	char *socks_host;
+	int socks_port;
 	CamelSockOptData sockopt;
 	CamelStream *tcp_stream;
 #ifdef HAVE_SSL
@@ -253,6 +256,14 @@ connect_to_server (CamelIMAP4Engine *engine, struct addrinfo *ai, gint ssl_mode,
 		tcp_stream = camel_tcp_stream_raw_new ();
 	}
 
+	session = camel_service_get_session (service);
+	camel_session_get_socks_proxy (session, &socks_host, &socks_port);
+
+	if (socks_host) {
+		camel_tcp_stream_set_socks_proxy ((CamelTcpStream *) tcp_stream, socks_host, socks_port);
+		g_free (socks_host);
+	}
+
 	if (camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai) == -1) {
 		if (errno == EINTR)
 			camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]