[smuxi: 74/111] Engine(-Tests): fixed matching git+ssh:// URLs



commit 74f5044be7541e97d5393d55f700b127a691adf3
Author: Mirco Bauer <meebey meebey net>
Date:   Wed Jan 15 05:31:33 2014 +0100

    Engine(-Tests): fixed matching git+ssh:// URLs

 src/Engine-Tests/MessageBuilderTests.cs     |    7 +++++++
 src/Engine/Config/MessageBuilderSettings.cs |    7 ++++---
 2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/Engine-Tests/MessageBuilderTests.cs b/src/Engine-Tests/MessageBuilderTests.cs
index 4983738..fabc8ef 100644
--- a/src/Engine-Tests/MessageBuilderTests.cs
+++ b/src/Engine-Tests/MessageBuilderTests.cs
@@ -513,6 +513,13 @@ namespace Smuxi.Engine
             builder.TimeStamp = DateTime.MinValue;
             builder.Append(new 
UrlMessagePartModel("http://www.stack.nl/~jilles/cgi-bin/hgwebdir.cgi/charybdis/raw-rev/9d769851c1c7";));
             TestMessage(msg, builder.ToMessage());
+
+            msg = "<RAOF> meebey: Associated mono branch is master-experimental in 
git+ssh://git.debian.org/~/public_git/mono.git";
+            builder = new MessageBuilder();
+            builder.TimeStamp = DateTime.MinValue;
+            builder.Append(new TextMessagePartModel("<RAOF> meebey: Associated mono branch is 
master-experimental in "));
+            builder.Append(new UrlMessagePartModel("git+ssh://git.debian.org/~/public_git/mono.git"));
+            TestMessage(msg, builder.ToMessage());
         }
 
         [Test]
diff --git a/src/Engine/Config/MessageBuilderSettings.cs b/src/Engine/Config/MessageBuilderSettings.cs
index d7974c4..774f3d8 100644
--- a/src/Engine/Config/MessageBuilderSettings.cs
+++ b/src/Engine/Config/MessageBuilderSettings.cs
@@ -77,7 +77,8 @@ namespace Smuxi.Engine
             string user_domain = user + domain;
             string user_domain_port = "(?:" + user + ")?" + domain_port;
             string path = @"/(?:["+ path_chars +"]*["+ path_last_chars +"]+)?";
-            string address = user_domain_port + "(?:" + path + ")?";
+            string protocol = @"[a-z][a-z0-9\-+]*://";
+            string protocol_user_domain_port_path = protocol + user_domain_port + "(?:" + path + ")?";
 
             // facebook attachment
             var regex = new Regex(
@@ -89,9 +90,9 @@ namespace Smuxi.Engine
                 TextFormat = "{1}",
             });
 
-            // protocol://domain
+            // protocol://user domain:port/path
             regex = new Regex(
-                @"[a-z][a-z0-9\-]*://" + address,
+                protocol_user_domain_port_path,
                 RegexOptions.IgnoreCase | RegexOptions.Compiled
             );
             BuiltinSmartLinks.Add(new SmartLink(regex));


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