[evolution-data-server/camel-socks-proxy] Use the SOCKS proxy in the smtp transport



commit a1442d3cf2e64cfeba0f311675e3d3f14f4ad67a
Author: Federico Mena Quintero <federico novell com>
Date:   Thu May 13 14:48:32 2010 -0500

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

 camel/providers/smtp/camel-smtp-transport.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 41d398b..b3f63f1 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -236,6 +236,9 @@ static gboolean
 connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, CamelException *ex)
 {
 	CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
+	CamelSession *session;
+	char *socks_host;
+	int socks_port;
 	CamelStream *tcp_stream;
 	gchar *respbuf = NULL;
 	gint ret;
@@ -265,6 +268,14 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 		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 ((ret = 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]