From: Art Cancro Date: Fri, 26 Sep 2008 16:16:16 +0000 (+0000) Subject: DLAT and OPNA now accept either a part number or a content-id. X-Git-Tag: v7.86~1905 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=3006dbbd20cfb03dee4dfff987374a2827844a29 DLAT and OPNA now accept either a part number or a content-id. --- diff --git a/citadel/ical_dezonify.c b/citadel/ical_dezonify.c index 662840c41..0e95bdc71 100644 --- a/citadel/ical_dezonify.c +++ b/citadel/ical_dezonify.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include "citadel.h" #include "server.h" diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 9ccc60a9a..b809bec20 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -931,8 +931,8 @@ void list_this_part(char *name, char *filename, char *partnum, char *disp, ma = (struct ma_info *)cbuserdata; if (ma->is_ma == 0) { - cprintf("part=%s|%s|%s|%s|%s|%ld\n", - name, filename, partnum, disp, cbtype, (long)length); + cprintf("part=%s|%s|%s|%s|%s|%ld|%s\n", + name, filename, partnum, disp, cbtype, (long)length, cbid); } } @@ -982,29 +982,31 @@ void mime_download(char *name, char *filename, char *partnum, char *disp, char *encoding, char *cbid, void *cbuserdata) { - /* Silently go away if there's already a download open... */ + /* Silently go away if there's already a download open. */ if (CC->download_fp != NULL) return; - /* ...or if this is not the desired section */ - if (strcasecmp(CC->download_desired_section, partnum)) - return; - - CC->download_fp = tmpfile(); - if (CC->download_fp == NULL) - return; - - fwrite(content, length, 1, CC->download_fp); - fflush(CC->download_fp); - rewind(CC->download_fp); - - OpenCmdResult(filename, cbtype); + if ( + (!IsEmptyStr(partnum) && (!strcasecmp(CC->download_desired_section, partnum))) + || (!IsEmptyStr(cbid) && (!strcasecmp(CC->download_desired_section, cbid))) + ) { + CC->download_fp = tmpfile(); + if (CC->download_fp == NULL) + return; + + fwrite(content, length, 1, CC->download_fp); + fflush(CC->download_fp); + rewind(CC->download_fp); + + OpenCmdResult(filename, cbtype); + } } /* - * Callback function for mime parser that outputs a section all at once + * Callback function for mime parser that outputs a section all at once. + * We can specify the desired section by part number *or* content-id. */ void mime_spew_section(char *name, char *filename, char *partnum, char *disp, void *content, char *cbtype, char *cbcharset, size_t length, @@ -1012,14 +1014,14 @@ void mime_spew_section(char *name, char *filename, char *partnum, char *disp, { int *found_it = (int *)cbuserdata; - /* ...or if this is not the desired section */ - if (strcasecmp(CC->download_desired_section, partnum)) - return; - - *found_it = 1; - - cprintf("%d %d\n", BINARY_FOLLOWS, (int)length); - client_write(content, length); + if ( + (!IsEmptyStr(partnum) && (!strcasecmp(CC->download_desired_section, partnum))) + || (!IsEmptyStr(cbid) && (!strcasecmp(CC->download_desired_section, cbid))) + ) { + *found_it = 1; + cprintf("%d %d\n", BINARY_FOLLOWS, (int)length); + client_write(content, length); + } }