that less-intelligent viewers can deal with the images
+ Revision 613.7 2003/12/21 20:02:28 error
+ * When viewing images, append the image filename to the temp filename so
+ that less-intelligent viewers can deal with the images
+
Revision 613.6 2003/12/21 19:07:28 error
* Start a new thread and fork() for image viewer (broken/disabled; for
refernce only)
Revision 613.6 2003/12/21 19:07:28 error
* Start a new thread and fork() for image viewer (broken/disabled; for
refernce only)
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
*/
void image_view(CtdlIPC *ipc, unsigned long msg)
{
*/
void image_view(CtdlIPC *ipc, unsigned long msg)
{
- char selected_part[SIZ];
+ struct parts *selected_part = NULL;
struct parts *ptr = last_message_parts;
struct parts *ptr = last_message_parts;
- scr_printf("\n");
- /* List available parts */
+ /* Run through available parts */
for (ptr = last_message_parts; ptr; ptr = ptr->next) {
if ((!strcasecmp(ptr->disposition, "attachment")
|| !strcasecmp(ptr->disposition, "inline"))
&& !strncmp(ptr->mimetype, "image/", 6)) {
for (ptr = last_message_parts; ptr; ptr = ptr->next) {
if ((!strcasecmp(ptr->disposition, "attachment")
|| !strcasecmp(ptr->disposition, "inline"))
&& !strncmp(ptr->mimetype, "image/", 6)) {
+ if (!found) {
+ found = 1;
+ selected_part = ptr;
+ strcpy(part, selected_part->number);
+ }
+#if 0
color(DIM_WHITE);
scr_printf("Part ");
color(BRIGHT_MAGENTA);
scr_printf("%s", ptr->number);
color(DIM_WHITE);
scr_printf("Part ");
color(BRIGHT_MAGENTA);
scr_printf("%s", ptr->number);
- if (!found) {
- found = 1;
- strncpy(selected_part, ptr->number, SIZ-1);
- }
color(DIM_WHITE);
scr_printf(": ");
color(BRIGHT_CYAN);
scr_printf("%s", ptr->filename);
color(DIM_WHITE);
scr_printf(" (%s, %ld bytes)\n", ptr->mimetype, ptr->length);
color(DIM_WHITE);
scr_printf(": ");
color(BRIGHT_CYAN);
scr_printf("%s", ptr->filename);
color(DIM_WHITE);
scr_printf(" (%s, %ld bytes)\n", ptr->mimetype, ptr->length);
}
}
while (found) {
found = 0;
}
}
while (found) {
found = 0;
- strprompt("View which part (0 when done)", selected_part, SIZ-1);
+ strprompt("View which part (0 when done)", part, SIZ-1);
for (ptr = last_message_parts; ptr; ptr = ptr->next) {
if ((!strcasecmp(ptr->disposition, "attachment")
|| !strcasecmp(ptr->disposition, "inline"))
&& !strncmp(ptr->mimetype, "image/", 6)
for (ptr = last_message_parts; ptr; ptr = ptr->next) {
if ((!strcasecmp(ptr->disposition, "attachment")
|| !strcasecmp(ptr->disposition, "inline"))
&& !strncmp(ptr->mimetype, "image/", 6)
- && !strcmp(ptr->number, selected_part)) {
+ && !strcmp(ptr->number, part)) {
char tmp[PATH_MAX];
char buf[SIZ];
void *file = NULL; /* The downloaded file */
char tmp[PATH_MAX];
char buf[SIZ];
void *file = NULL; /* The downloaded file */
- r = CtdlIPCAttachmentDownload(ipc, msg, selected_part, &file, progress, buf);
+ r = CtdlIPCAttachmentDownload(ipc, msg, selected_part->number, &file, progress, buf);
if (r / 100 != 2) {
scr_printf("%s\n", buf);
} else {
if (r / 100 != 2) {
scr_printf("%s\n", buf);
} else {
len = (size_t)extract_long(buf, 0);
progress(len, len);
scr_flush();
len = (size_t)extract_long(buf, 0);
progress(len, len);
scr_flush();
- strcpy(tmp, tmpnam(NULL));
+ snprintf(tmp, sizeof tmp, "%s.%s",
+ tmpnam(NULL),
+ selected_part->filename);
save_buffer(file, len, tmp);
free(file);
#if 0
save_buffer(file, len, tmp);
free(file);
#if 0