[Xfce4-commits] <postler:master> Strip mailto: prefix when parsing addresses

Christian Dywan noreply at xfce.org
Tue Jul 13 00:54:03 CEST 2010


Updating branch refs/heads/master
         to 4165cf1443e4e90d936b91981bd8fe35367cc951 (commit)
       from b5d8c292c2454d19d741d8035e381d05ba579485 (commit)

commit 4165cf1443e4e90d936b91981bd8fe35367cc951
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Jul 3 20:41:07 2010 +0200

    Strip mailto: prefix when parsing addresses

 postler/postler-messages.vala |    2 ++
 tests/parsing.vala            |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index 52e260e..0350347 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -312,6 +312,8 @@ public class Postler.Messages : Gtk.TreeView {
             lower--;
 
         string recipient = address.slice (lower + 1, greater);
+        if (recipient.has_prefix ("mailto:"))
+            recipient = recipient.substring (7, -1);
         if (lower == 0)
             return { recipient, recipient };
         /* TODO: Parse multiple addresses */
diff --git a/tests/parsing.vala b/tests/parsing.vala
index a8189b1..febe057 100644
--- a/tests/parsing.vala
+++ b/tests/parsing.vala
@@ -45,6 +45,7 @@ const TestCase[] addresses = {
     { "Klaus", null },
     { "kaufmann at heim.at", null },
     { "<kaufmann at heim.at>", "kaufmann at heim.at kaufmann at heim.at" },
+    { "<mailto:kaufmann at heim.at>", "kaufmann at heim.at kaufmann at heim.at" },
     { "'Klaus' <klaus at heim.at>", "Klaus klaus at heim.at" },
     { "\"Klaus\" <klaus at heim.at>", "Klaus klaus at heim.at" },
     { "=?iso-8859-1?Q?M=2C_Alf?= <alf.m at vw.de>",



More information about the Xfce4-commits mailing list