[evolution-data-server] Setter/getter for the SOCKS proxy



commit 93b97006eb70b1949baa7cc09d5b19f79fbc47ba
Author: Federico Mena Quintero <federico novell com>
Date:   Wed May 19 17:26:15 2010 -0500

    Setter/getter for the SOCKS proxy
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 camel/camel-tcp-stream.c |   34 ++++++++++++++++++++++++++++++++--
 camel/camel-tcp-stream.h |    4 ++++
 2 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/camel/camel-tcp-stream.c b/camel/camel-tcp-stream.c
index bbc57f0..9c37e99 100644
--- a/camel/camel-tcp-stream.c
+++ b/camel/camel-tcp-stream.c
@@ -214,10 +214,40 @@ camel_tcp_stream_get_remote_address (CamelTcpStream *stream,
  * Since: 2.32
  */
 void
-camel_tcp_stream_set_socks_proxy (CamelTcpStream *stream, const char *socks_host, int socks_port)
+camel_tcp_stream_set_socks_proxy (CamelTcpStream *stream, const gchar *socks_host, gint socks_port)
 {
+	CamelTcpStreamPrivate *priv;
+
 	g_return_if_fail (CAMEL_IS_TCP_STREAM (stream));
 
-	/* FIXME */
+	priv = stream->priv;
+
+	g_free (priv->socks_host);
+	priv->socks_host = g_strdup (socks_host);
+	priv->socks_port = socks_port;
 }
 
+/**
+ * camel_tcp_stream_peek_socks_proxy:
+ * @stream: a #CamelTcpStream
+ * @socks_host_ret: location to return the name of the SOCKS host
+ * @socks_port_ret: location to return the port number in the SOCKS host
+ *
+ * Queries the SOCKS proxy that is configured for a @stream.  This will
+ * return #NULL in @socks_host_ret if no proxy is configured.
+ */
+void
+camel_tcp_stream_peek_socks_proxy (CamelTcpStream *stream, const gchar **socks_host_ret, gint *socks_port_ret)
+{
+	CamelTcpStreamPrivate *priv;
+
+	g_return_if_fail (CAMEL_IS_TCP_STREAM (stream));
+
+	priv = stream->priv;
+
+	if (socks_host_ret)
+		*socks_host_ret = priv->socks_host;
+
+	if (socks_port_ret)
+		*socks_port_ret = priv->socks_port;
+}
diff --git a/camel/camel-tcp-stream.h b/camel/camel-tcp-stream.h
index 62fd30a..33f9622 100644
--- a/camel/camel-tcp-stream.h
+++ b/camel/camel-tcp-stream.h
@@ -143,6 +143,10 @@ gint		camel_tcp_stream_getsockopt	(CamelTcpStream *stream,
 						 CamelSockOptData *data);
 gint		camel_tcp_stream_setsockopt	(CamelTcpStream *stream,
 						 const CamelSockOptData *data);
+
+void camel_tcp_stream_set_socks_proxy (CamelTcpStream *stream, const gchar *socks_host, gint socks_port);
+void camel_tcp_stream_peek_socks_proxy (CamelTcpStream *stream, const gchar **socks_host_ret, gint *socks_port_ret);
+
 struct sockaddr *
 		camel_tcp_stream_get_local_address
 						(CamelTcpStream *stream,



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