[Xfce4-commits] <postler:master> Handle partial quoting of recipients
Christian Dywan
noreply at xfce.org
Fri Feb 25 02:30:02 CET 2011
Updating branch refs/heads/master
to caa95ca4936f4276baa1eba6ee31fd0ea4397a27 (commit)
from 59f8505924e2b00393c39b2c94e364383ea11a35 (commit)
commit caa95ca4936f4276baa1eba6ee31fd0ea4397a27
Author: Christian Dywan <christian at twotoasts.de>
Date: Fri Feb 25 01:54:43 2011 +0100
Handle partial quoting of recipients
postler/postler-messages.vala | 13 +++----------
tests/parsing.vala | 1 +
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index c85e7f9..c31308c 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -445,16 +445,9 @@ public class Postler.Messages : Gtk.TreeView {
return { recipient, recipient };
/* Remove double or single quotes around the name */
- long quote_open = 0;
- long quote_close = lower - 1;
- if (address[quote_open] == '\'' || address[quote_open] == '"') {
- quote_open++;
- quote_close--;
- if (address[quote_close] == '\'' || address[quote_close] == '"')
- quote_close = quote_close - 1;
- }
-
- return { address.substring (quote_open, quote_close), recipient };
+ long first = address.has_prefix ("'") || address.has_prefix ("\"") ? 1 : 0;
+ return { address.substring (first, lower - 1)
+ .replace ("' ", "").replace ("\"", "").chomp (), recipient };
}
public void clear () {
diff --git a/tests/parsing.vala b/tests/parsing.vala
index 9d55e43..e1394da 100644
--- a/tests/parsing.vala
+++ b/tests/parsing.vala
@@ -67,6 +67,7 @@ const TestCase[] addresses = {
{ "'Klaus' <klaus at heim.at>", "Klaus klaus at heim.at" },
{ "\"Klaus\" <klaus at heim.at>", "Klaus klaus at heim.at" },
{ "Bert O'Brian <bert+ at uni.edu>", "Bert O'Brian bert+ at uni.edu" },
+ { "\"gtk+\" (b.g.o) <b at g.o>", "gtk+ (b.g.o) b at g.o" },
{ "=?iso-8859-1?Q?M=2C_Alf?= <alf.m at vw.de>",
"=?iso-8859-1?Q?M=2C_Alf?= alf.m at vw.de" }
};
More information about the Xfce4-commits
mailing list