Use the SOCKS proxy in the imapx server
authorFederico Mena Quintero <federico@novell.com>
Thu, 13 May 2010 19:46:18 +0000 (14:46 -0500)
committerFederico Mena Quintero <federico@novell.com>
Wed, 2 Jun 2010 22:15:40 +0000 (17:15 -0500)
Signed-off-by: Federico Mena Quintero <federico@novell.com>
camel/providers/imapx/camel-imapx-server.c

index 811f8e0..c81c17d 100644 (file)
@@ -2122,6 +2122,8 @@ gboolean
 imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex)
 {
        CamelStream * tcp_stream = NULL;
+       char *socks_host;
+       int socks_port;
        CamelSockOptData sockopt;
        gint ret, ssl_mode = 0;
 
@@ -2165,6 +2167,13 @@ imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex)
        is->is_ssl_stream = FALSE;
 #endif /* HAVE_SSL */
 
+       camel_session_get_socks_proxy (is->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);
+       }
+
        hints.ai_socktype = SOCK_STREAM;
        ai = camel_getaddrinfo(is->url->host, serv, &hints, ex);
        if (ex && ex->id && ex->id != CAMEL_EXCEPTION_USER_CANCEL && port != NULL) {