[Xfce4-commits] <postler:master> Include name and address in linkified addresses

Christian Dywan noreply at xfce.org
Thu Mar 3 00:14:02 CET 2011


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

commit 745defc61f990724b8f6afc66571e9e6158a543d
Author: Christian Dywan <christian at twotoasts.de>
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 <kl at ha.at>", "<a href=\"kl at ha.at\" title=\"Kl <kl at ha.at>\">Kl</a>" },
+    { "Kl <kl at ha.at>", "<a href=\"Kl <kl at ha.at>\" title=\"Kl <kl at ha.at>\">Kl</a>" },
     { "kl at ha.at", "<a href=\"kl at ha.at\" title=\"kl at ha.at\">kl at ha.at</a>" },
     { "\"Kl\" <kl at ha.at>",
-      "<a href=\"kl at ha.at\" title=\""Kl" <kl at ha.at>\">Kl</a>" },
+      "<a href=\""Kl" <kl at ha.at>\" title=\""Kl" <kl at ha.at>\">Kl</a>" },
     { "=?iso-8859-1?Q?M=2C_Alf?= <alf.m at vw.de>",
-      "<a href=\"alf.m at vw.de\" "
+      "<a href=\"=?iso-8859-1?Q?M=2C_Alf?= <alf.m at vw.de>\" "
       + "title=\"=?iso-8859-1?Q?M=2C_Alf?= <alf.m at vw.de>\">"
       + "=?iso-8859-1?Q?M=2C_Alf?=</a>" }
 };
@@ -101,7 +101,7 @@ void parsing_headers_linkify () {
     }
     assert_string_equal (Postler.Content.linkify_address ("Kl <kl at ha.at>",
         "?from=Kl <kl at ha.at>&subject=Re: Tomaten"),
-      "<a href=\"kl at ha.at?from=Kl <kl at ha.at>&subject=Re: Tomaten\" "
+      "<a href=\"Kl <kl at ha.at>?from=Kl <kl at ha.at>&subject=Re: Tomaten\" "
       + "title=\"Kl <kl at ha.at>\">Kl</a>");
 }
 



More information about the Xfce4-commits mailing list