aboutsummaryrefslogtreecommitdiff
path: root/libsylph
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2010-07-13 04:25:19 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2010-07-13 04:25:19 +0000
commit0ea184b3da8bcf2e614fb09af789f0b847e123a9 (patch)
treed4934a49e6ddbf632446a99ad84305d1796a6ee9 /libsylph
parentec14e81935047bd2b2182595b76650b5f2fef893 (diff)
message/partial: allow Content-Type without total parameter.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2609 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r--libsylph/procmime.c2
-rw-r--r--libsylph/procmsg.c15
2 files changed, 12 insertions, 5 deletions
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) {