[Xfce4-commits] <postler:master> Render signatures with dashes and in gray

Christian Dywan noreply at xfce.org
Sun Jun 6 09:06:01 CEST 2010


Updating branch refs/heads/master
         to dc72205198d9bb9f2b722008cf27fa287b86fd6b (commit)
       from 56f4fcd181740012ec82bf6bf16f227de973c964 (commit)

commit dc72205198d9bb9f2b722008cf27fa287b86fd6b
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Jun 6 08:26:16 2010 +0200

    Render signatures with dashes and in gray

 postler/postler-content.vala |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index 8dc5139..84d0f8a 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -52,6 +52,13 @@ public class Postler.Content : WebKit.WebView {
             color: GrayText;
             border-left: 0.1em solid GrayText;
         }
+        /* Signature */
+        .signature {
+            color: GrayText;
+        }
+        .signature:before {
+            content: "——";
+        }
         /* Addresses not underlined, but underlined when hovering */
         a[href] {
             text-decoration: underline !important;
@@ -390,6 +397,7 @@ public class Postler.Content : WebKit.WebView {
 
             bool plain_text = mime_type == "text/plain";
             bool in_quote = false;
+            bool in_signature = false;
             while ((line = stream.read_line (null, null)) != null) {
                 if (multipart > 0) {
                     if (line.has_prefix ("--")) {
@@ -434,7 +442,16 @@ public class Postler.Content : WebKit.WebView {
                 }
                 catch (GLib.ConvertError error) { }
                 if (plain_text) {
-                    /* TODO: Render signature gray, beginning with "--=20" */
+                    /* Looks like a signature */
+                    if (in_signature && line[0] == '\0') {
+                        body[body_parts].append ("</span>");
+                        in_signature = false;
+                    } else if (!in_signature && line[0] == '-' && line[1] == '-'
+                            && line[2] == ' ' && line[3] == '\0') {
+                        body[body_parts].append ("<span class=\"signature\">");
+                        in_signature = true;
+                        line = "";
+                    }
                     /* Looks like quoting */
                     if (in_quote && !line.has_prefix (">")) {
                         body[body_parts].append ("</blockquote>");



More information about the Xfce4-commits mailing list