[Xfce4-commits] <postler:master> Omit empty and non-helpful decorative lines when replying
Christian Dywan
noreply at xfce.org
Sun Aug 1 17:14:03 CEST 2010
Updating branch refs/heads/master
to e47a1a2da8830a3b9d277b46902d658b6abcfa9e (commit)
from 39e066da975c2e0532159d87bd66fa2d6d9e0603 (commit)
commit e47a1a2da8830a3b9d277b46902d658b6abcfa9e
Author: Christian Dywan <christian at twotoasts.de>
Date: Wed Jul 28 14:11:36 2010 +0200
Omit empty and non-helpful decorative lines when replying
postler/postler-content.vala | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index b69f6e9..cc7b8b8 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -310,14 +310,39 @@ public class Postler.Content : WebKit.WebView {
break;
}
+ bool last_line_empty = true;
while ((line = stream.read_line (null, null)) != null) {
+ /* Skip effectively empty lines */
+ int position = 0;
+ do {
+ if (line[position] != '>' && line[position] != ' ')
+ break;
+ position++;
+ } while (true);
+ string effective = line.substring (position);
+ if (effective == "") {
+ if (last_line_empty)
+ continue;
+ last_line_empty = true;
+ body.append ("> \n");
+ continue;
+ }
+ /* Skip non-helpful decorative lines */
+ if (effective == "-----BEGIN PGP SIGNED MESSAGE-----"
+ || effective.has_prefix ("Hash: SHA")
+ || effective == "-----END PGP SIGNATURE-----"
+ || effective == "-----BEGIN PGP SIGNATURE-----")
+ continue;
+ last_line_empty = false;
+
size_t length = line.len ();
/* TODO: Handle encoding */
for (int i = 0; i < length; i += (quote ? 78 : 80))
body.append ((quote ? "> " : "")
+ line.substring (i, (long)(length - i)) + "\n");
}
- body.append_c ('\n');
+ if (!last_line_empty)
+ body.append_c ('\n');
} catch (GLib.Error error) {
display_error (_("Failed to quote message \"%s\": %s").printf (
contents.get_path (), error.message));
More information about the Xfce4-commits
mailing list