From e5cc414b541a6a0711175d0729bc8d80ded1519b Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Wed, 8 Jun 2011 00:38:09 +0100 Subject: [PATCH 1/3] listener irc: Fix race condition joining channel when not connected --- SparkleLib/SparkleListenerIrc.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SparkleLib/SparkleListenerIrc.cs b/SparkleLib/SparkleListenerIrc.cs index 73874c37..8ab5f5bb 100644 --- a/SparkleLib/SparkleListenerIrc.cs +++ b/SparkleLib/SparkleListenerIrc.cs @@ -56,10 +56,12 @@ namespace SparkleLib { }; this.client.OnDisconnected += delegate { + base.is_connecting = false; OnDisconnected (); }; this.client.OnError += delegate { + base.is_connecting = false; OnDisconnected (); }; @@ -118,9 +120,12 @@ namespace SparkleLib { { string channel = "#" + folder_identifier; if (!base.channels.Contains (channel)) { - SparkleHelpers.DebugInfo ("ListenerIrc", "Joining channel " + channel); base.channels.Add (channel); - this.client.RfcJoin (channel); + + if (IsConnected) { + SparkleHelpers.DebugInfo ("ListenerIrc", "Joining channel " + channel); + this.client.RfcJoin (channel); + } } } From 2a6d7f18f3ee205a3812a5f2de491cb7cb7e9af5 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Wed, 8 Jun 2011 01:29:34 +0100 Subject: [PATCH 2/3] config: never let user name be null or empty --- SparkleLib/SparkleConfig.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/SparkleLib/SparkleConfig.cs b/SparkleLib/SparkleConfig.cs index 614d1fb9..e9603269 100644 --- a/SparkleLib/SparkleConfig.cs +++ b/SparkleLib/SparkleConfig.cs @@ -56,7 +56,7 @@ namespace SparkleLib { private void CreateInitialConfig () { - string user_name = "Unknown"; + string user_name = Environment.UserName; if (SparkleBackend.Platform == PlatformID.Unix || SparkleBackend.Platform == PlatformID.MacOSX) { @@ -64,12 +64,10 @@ namespace SparkleLib { user_name = new UnixUserInfo (UnixEnvironment.UserName).RealName; user_name = user_name.TrimEnd (",".ToCharArray()); - } else { - user_name = Environment.UserName; } if (string.IsNullOrEmpty (user_name)) - user_name = "Unknown"; + user_name = Environment.UserName; TextWriter writer = new StreamWriter (Path); string n = Environment.NewLine; From 0a845a336fb620f95ce803998c92f1f4987c4161 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Wed, 8 Jun 2011 02:04:54 +0100 Subject: [PATCH 3/3] Work with repos on host names with a dash in them --- SparkleLib/SparkleFetcherBase.cs | 2 +- SparkleLib/SparkleRepoBase.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index 8a48e818..37e2984e 100644 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -187,7 +187,7 @@ namespace SparkleLib { private string GetHost (string url) { - Regex regex = new Regex (@"(@|://)([a-z0-9\.]+)(/|:)"); + Regex regex = new Regex (@"(@|://)([a-z0-9\.-]+)(/|:)"); Match match = regex.Match (url); if (match.Success) diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index 90a4bba0..cf9d5ac6 100644 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -139,7 +139,7 @@ namespace SparkleLib { public string Domain { get { - Regex regex = new Regex (@"(@|://)([a-z0-9\.]+)(/|:)"); + Regex regex = new Regex (@"(@|://)([a-z0-9\.-]+)(/|:)"); Match match = regex.Match (SparkleConfig.DefaultConfig.GetUrlForFolder (Name)); if (match.Success)