Updating branch refs/heads/master
         to 745defc61f990724b8f6afc66571e9e6158a543d (commit)
       from e44573c1791eaba704d81afa1852d29ce3a7084a (commit)

commit 745defc61f990724b8f6afc66571e9e6158a543d
Author: Christian Dywan <[email protected]>
Date:   Wed Mar 2 23:41:00 2011 +0100

    Include name and address in linkified addresses

 postler/postler-content.vala |   10 ++++------
 tests/parsing.vala           |    8 ++++----
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index ccc5049..7df08c6 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -217,17 +217,15 @@ public class Postler.Content : WebKit.WebView {
                 continue;
             }
             string[] parsed = Postler.Messages.parse_address (address);
-            string name = parsed[0];
-            string cleaned = parsed[1];
-            string quoted = html_escape (cleaned);
-            string original = html_escape (address);
+            string name = html_escape (parsed[0]);
+            string quoted = html_escape (address);
             if (linkified.len > 0)
                linkified.append (", ");
             linkified.append ("<a href=\"" + quoted + (arguments != null ? 
arguments : "") +
-                "\" title=\"" + original + "\">" + name + "</a>");
+                "\" title=\"" + quoted + "\">" + name + "</a>");
             if (edit_icon != "")
                 linkified.append ((" <a href=\"contact:%s:%s\">%s</a>").printf 
(
-                                  name, quoted, edit_icon));
+                                  name, html_escape (parsed[1]), edit_icon));
         }
         return linkified.str;
     }
diff --git a/tests/parsing.vala b/tests/parsing.vala
index e1394da..b93ae01 100644
--- a/tests/parsing.vala
+++ b/tests/parsing.vala
@@ -83,12 +83,12 @@ void parsing_headers_address () {
 }
 
 const TestCase[] linkifies = {
-    { "Kl <[email protected]>", "<a href=\"[email protected]\" title=\"Kl 
&lt;[email protected]&gt;\">Kl</a>" },
+    { "Kl <[email protected]>", "<a href=\"Kl &lt;[email protected]&gt;\" title=\"Kl 
&lt;[email protected]&gt;\">Kl</a>" },
     { "[email protected]", "<a href=\"[email protected]\" 
title=\"[email protected]\">[email protected]</a>" },
     { "\"Kl\" <[email protected]>",
-      "<a href=\"[email protected]\" title=\"&quot;Kl&quot; 
&lt;[email protected]&gt;\">Kl</a>" },
+      "<a href=\"&quot;Kl&quot; &lt;[email protected]&gt;\" title=\"&quot;Kl&quot; 
&lt;[email protected]&gt;\">Kl</a>" },
     { "=?iso-8859-1?Q?M=2C_Alf?= <[email protected]>",
-      "<a href=\"[email protected]\" "
+      "<a href=\"=?iso-8859-1?Q?M=2C_Alf?= &lt;[email protected]&gt;\" "
       + "title=\"=?iso-8859-1?Q?M=2C_Alf?= &lt;[email protected]&gt;\">"
       + "=?iso-8859-1?Q?M=2C_Alf?=</a>" }
 };
@@ -101,7 +101,7 @@ void parsing_headers_linkify () {
     }
     assert_string_equal (Postler.Content.linkify_address ("Kl <[email protected]>",
         "?from=Kl &lt;[email protected]&gt;&subject=Re: Tomaten"),
-      "<a href=\"[email protected]?from=Kl &lt;[email protected]&gt;&subject=Re: Tomaten\" "
+      "<a href=\"Kl &lt;[email protected]&gt;?from=Kl &lt;[email protected]&gt;&subject=Re: 
Tomaten\" "
       + "title=\"Kl &lt;[email protected]&gt;\">Kl</a>");
 }
 
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to