[evolution-data-server] Bug 767780 - The "References" header folded twice
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug 767780 - The "References" header folded twice
- Date: Tue, 21 Jun 2016 08:24:10 +0000 (UTC)
commit 4bf7ae569cc753aebf60f8e0d3214ebd65df806c
Author: Milan Crha <mcrha redhat com>
Date: Tue Jun 21 10:23:44 2016 +0200
Bug 767780 - The "References" header folded twice
camel/camel-mime-part.c | 40 +++++++++++++++++++++++-----------------
1 files changed, 23 insertions(+), 17 deletions(-)
---
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index ff9859f..e8e452d 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -170,26 +170,32 @@ write_references (gpointer stream,
if (!isspace (value[0]))
g_string_append_c (buffer, ' ');
- len = buffer->len;
+ /* Fold only when not folded already */
+ if (!strchr (value, '\n')) {
+ len = buffer->len;
+
+ while (*value) {
+ ids = value;
+ ide = strchr (ids + 1, '>');
+ if (ide)
+ value = ++ide;
+ else
+ ide = value = strlen (ids) + ids;
- while (*value) {
- ids = value;
- ide = strchr (ids + 1, '>');
- if (ide)
- value = ++ide;
- else
- ide = value = strlen (ids) + ids;
+ if (len > 0 && len + (ide - ids) >= CAMEL_FOLD_SIZE) {
+ g_string_append_len (buffer, "\n\t", 2);
+ len = 0;
+ }
- if (len > 0 && len + (ide - ids) >= CAMEL_FOLD_SIZE) {
- g_string_append_len (buffer, "\n\t", 2);
- len = 0;
+ g_string_append_len (buffer, ids, ide - ids);
+ len += (ide - ids);
}
-
- g_string_append_len (buffer, ids, ide - ids);
- len += (ide - ids);
+ } else {
+ g_string_append (buffer, value);
}
- g_string_append_c (buffer, '\n');
+ if (buffer->len > 0 && buffer->str[buffer->len - 1] != '\n')
+ g_string_append_c (buffer, '\n');
/* XXX For now we handle both types of streams. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]