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



commit 897cfa76d50178bafe3f819336e20520be1e652f
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 |   26 ++++++++++++++++++++++++--
 camel/camel-tcp-stream.h |    3 ++-
 2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/camel/camel-tcp-stream.c b/camel/camel-tcp-stream.c
index 2cf387e..aa4fdc7 100644
--- a/camel/camel-tcp-stream.c
+++ b/camel/camel-tcp-stream.c
@@ -190,11 +190,33 @@ camel_tcp_stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *dat
  * this @stream will instead go through the proxy.
  */
 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));
+
+	priv = stream->priv;
+
+	g_free (priv->socks_host);
+	priv->socks_host = g_strdup (socks_host);
+	priv->socks_port = socks_port;
+}
+
+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));
 
-	/* FIXME */
+	priv = stream->priv;
+
+	if (socks_host_ret)
+		*socks_host_ret = priv->socks_host;
+
+	if (socks_port_ret)
+		*socks_port_ret = priv->socks_port;
 }
 
 static struct sockaddr *
diff --git a/camel/camel-tcp-stream.h b/camel/camel-tcp-stream.h
index cc71258..7d7bc1d 100644
--- a/camel/camel-tcp-stream.h
+++ b/camel/camel-tcp-stream.h
@@ -116,7 +116,8 @@ gint         camel_tcp_stream_connect    (CamelTcpStream *stream, struct addrinf
 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 char *socks_host, int socks_port);
+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, socklen_t *len);
 struct sockaddr *camel_tcp_stream_get_remote_address (CamelTcpStream *stream, socklen_t *len);



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