aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorNotZed <NotZed@HelixCode.com>2000-04-21 08:56:27 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-04-21 08:56:27 +0800
commit623a9d69008bc6881a4f70a7e9127220cdb9bdff (patch)
treea81071b913b51d62ec3816a6c7ce95e312a023ca /camel
parenta54e4b10743c562aba5408d98281c8c0292bee95 (diff)
downloadgsoc2013-evolution-623a9d69008bc6881a4f70a7e9127220cdb9bdff.tar.gz
gsoc2013-evolution-623a9d69008bc6881a4f70a7e9127220cdb9bdff.tar.zst
gsoc2013-evolution-623a9d69008bc6881a4f70a7e9127220cdb9bdff.zip
Trim leading/trailing spaces off the raw headers.
2000-04-20 NotZed <NotZed@HelixCode.com> * providers/mbox/camel-mbox-summary.c (message_struct_new): Trim leading/trailing spaces off the raw headers. svn path=/trunk/; revision=2536
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog3
-rw-r--r--camel/providers/mbox/camel-mbox-summary.c22
2 files changed, 22 insertions, 3 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 1afbf83876..f868744547 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,8 @@
2000-04-20 NotZed <NotZed@HelixCode.com>
+ * providers/mbox/camel-mbox-summary.c (message_struct_new): Trim
+ leading/trailing spaces off the raw headers.
+
* MERGE NEW_PARSER branch into HEAD, fixed conflicts.
* gmime-content-field.c (_print_parameter): Duh, removed again
diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c
index 11f1c5779a..c2aad8317a 100644
--- a/camel/providers/mbox/camel-mbox-summary.c
+++ b/camel/providers/mbox/camel-mbox-summary.c
@@ -341,6 +341,22 @@ body_part_new(CamelMimeParser *mp, CamelMboxMessageContentInfo *parent, int star
return bs;
}
+static char *strdup_trim(const char *s)
+{
+ char *end;
+
+ if (s == NULL)
+ return NULL;
+
+ while (isspace(*s))
+ s++;
+ end = s+strlen(s)-1;
+ while (end>s && isspace(*end))
+ end--;
+ end = g_strndup(s, end-s+1);
+ return end;
+}
+
static CamelMboxMessageInfo *
message_struct_new(CamelMimeParser *mp, CamelMboxMessageContentInfo *parent, int start, int body, off_t xev_offset)
{
@@ -349,9 +365,9 @@ message_struct_new(CamelMimeParser *mp, CamelMboxMessageContentInfo *parent, int
ms = g_malloc0(sizeof(*ms));
/* FIXME: what about cc, sender vs from? */
- ms->info.subject = g_strdup(camel_mime_parser_header(mp, "subject", NULL));
- ms->info.from = g_strdup(camel_mime_parser_header(mp, "from", NULL));
- ms->info.to = g_strdup(camel_mime_parser_header(mp, "to", NULL));
+ ms->info.subject = strdup_trim(camel_mime_parser_header(mp, "subject", NULL));
+ ms->info.from = strdup_trim(camel_mime_parser_header(mp, "from", NULL));
+ ms->info.to = strdup_trim(camel_mime_parser_header(mp, "to", NULL));
ms->info.date_sent = header_decode_date(camel_mime_parser_header(mp, "date", NULL), NULL);
ms->info.date_received = 0;