From 0ea184b3da8bcf2e614fb09af789f0b847e123a9 Mon Sep 17 00:00:00 2001 From: hiro Date: Tue, 13 Jul 2010 04:25:19 +0000 Subject: message/partial: allow Content-Type without total parameter. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2609 ee746299-78ed-0310-b773-934348b2243d --- libsylph/procmime.c | 2 +- libsylph/procmsg.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'libsylph') diff --git a/libsylph/procmime.c b/libsylph/procmime.c index 2789563f..dfbda477 100644 --- a/libsylph/procmime.c +++ b/libsylph/procmime.c @@ -770,7 +770,7 @@ void procmime_scan_content_type_partial(const gchar *content_type, procmime_mime_params_free(mparams); - if (t > 0 && n > 0 && t >= n && id_str) { + if (n > 0 && (t == 0 || t >= n) && id_str) { *total = t; *part_id = id_str; *number = n; diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c index 6c384aa6..f1e88b08 100644 --- a/libsylph/procmsg.c +++ b/libsylph/procmsg.c @@ -1773,9 +1773,10 @@ gint procmsg_concat_partial_messages(GSList *mlist, const gchar *file) if (procheader_get_one_field(buf, sizeof(buf), fp, hentry) == -1) goto skip; - procmime_scan_content_type_partial(buf + strlen(hentry[0].name), &t, &cur_id, &n); - if (n == 0 || t > 100 || n > t) { - debug_print("skip\n"); + procmime_scan_content_type_partial(buf + strlen(hentry[0].name), + &t, &cur_id, &n); + if (n == 0 || n > 100 || t > 100 || (t > 0 && n > t)) { + debug_print("bad partial number (%d/%d), skip\n", n, t); g_free(cur_id); goto skip; } @@ -1786,7 +1787,8 @@ gint procmsg_concat_partial_messages(GSList *mlist, const gchar *file) if (total == 0) total = t; - if (total != t || strcmp(part_id, cur_id) != 0) { + if ((t > 0 && total != t) || (total > 0 && n > total) || + strcmp(part_id, cur_id) != 0) { debug_print("skip\n"); g_free(cur_id); goto skip; @@ -1808,6 +1810,11 @@ skip: g_print("part_id = %s , total = %d\n", part_id, total); g_free(part_id); + if (total == 0) { + debug_print("total number not found\n"); + return -1; + } + /* check if all pieces exist */ for (i = 0; i < total; i++) { if (msg_array[i] == NULL) { -- cgit v1.2.3