Updating branch refs/heads/master to a0b632ee8bdb94f548dbf90bc6162a8c5df567ec (commit) from d2184aa24128fb47ab42da46fb99209b11bc873a (commit)
commit a0b632ee8bdb94f548dbf90bc6162a8c5df567ec Author: Christian Dywan <christ...@twotoasts.de> Date: Wed Jul 28 13:31:57 2010 +0200 Render nested blocks of quotes postler/postler-content.vala | 39 +++++++++++++++++++++++++++++---------- 1 files changed, 29 insertions(+), 10 deletions(-) diff --git a/postler/postler-content.vala b/postler/postler-content.vala index 084cd5f..9dd34b9 100644 --- a/postler/postler-content.vala +++ b/postler/postler-content.vala @@ -550,7 +550,7 @@ public class Postler.Content : WebKit.WebView { } bool plain_text = mime_type == "text/plain"; - bool in_quote = false; + int in_quote = 0; bool in_signature = false; string inner_boundary = ""; while ((line = stream.read_line (null, null)) != null) { @@ -633,17 +633,36 @@ public class Postler.Content : WebKit.WebView { line = ""; } /* Looks like quoting */ - if (in_quote && !line.has_prefix (">")) { - body[body_parts].append ("</blockquote>"); - in_quote = false; + if (in_quote > 0 || line.has_prefix ("> ")) { + /* Determine level of nesting */ + int quote_mark = 0; + int position = 0; + do { + if (line[position] == '>') + quote_mark++; + else if (line[position] != ' ') + break; + position++; + } while (true); + + if (quote_mark < in_quote) + body[body_parts].append ("</blockquote>"); + else if (quote_mark > in_quote) + body[body_parts].append ("<blockquote>"); + in_quote = quote_mark; } - else if (!in_quote && line.has_prefix (">")) { - body[body_parts].append ("<blockquote>"); - in_quote = true; - } - if (in_quote && line[0] == '>' && line[1] == ' ') + + if (in_quote > 0 && line[0] == '>' && line[1] == ' ') { line = line.substring (2); - else if (in_quote && line[0] == '>' && line[1] == '\0') + int position = 0; + do { + if (line[position] != '>' && line[position] != ' ') + break; + position++; + } while (true); + line = line.substring (position); + } + else if (in_quote > 0 && line[0] == '>' && line[1] == '\0') line = line.substring (1); } body[body_parts].append (line); _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits