From c9d158a26c56b95b87c8f2094a35c01c18250451 Mon Sep 17 00:00:00 2001 From: Mirco Bauer Date: Mon, 12 Sep 2011 15:59:17 +0200 Subject: [PATCH] Added http_proxy support to SparkleListenerIrc --- SparkleLib/SparkleListenerIrc.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SparkleLib/SparkleListenerIrc.cs b/SparkleLib/SparkleListenerIrc.cs index 282fb018..c7133e28 100644 --- a/SparkleLib/SparkleListenerIrc.cs +++ b/SparkleLib/SparkleListenerIrc.cs @@ -48,6 +48,17 @@ namespace SparkleLib { PingInterval = 60 }; + var proxy = Environment.GetEnvironmentVariable("http_proxy"); + Uri proxyUri = null; + if (!String.IsNullOrEmpty(proxy) && + Uri.TryCreate(proxy, UriKind.Absolute, out proxyUri)) { + if (proxyUri.Scheme == "http") { + this.client.ProxyType = ProxyType.Http; + this.client.ProxyHost = proxyUri.Host; + this.client.ProxyPort = proxyUri.Port; + } + } + this.client.OnConnected += delegate { base.is_connecting = false; OnConnected ();