* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
{
idx = mutt_gen_attach_list (m->parts, m->type, idx, idxlen, idxmax, level, compose);
}
else
{
if (!idx[*idxlen])
{
idx = mutt_gen_attach_list (m->parts, m->type, idx, idxlen, idxmax, level, compose);
}
else
{
if (!idx[*idxlen])
- idx = mutt_gen_attach_list (m->parts, m->type, idx, idxlen, idxmax, level + 1, compose);
+ idx = mutt_gen_attach_list (m->parts, m->type, idx, idxlen, idxmax, level + 1, compose);
- if (mutt_is_text_part (aptr->content) &&
- mutt_get_body_charset (charset, sizeof (charset), aptr->content))
- mutt_format_s (dest, destlen, prefix, charset);
- else
- mutt_format_s (dest, destlen, prefix, "");
+ if (mutt_is_text_part (aptr->content) &&
+ mutt_get_body_charset (charset, sizeof (charset), aptr->content))
+ mutt_format_s (dest, destlen, prefix, charset);
+ else
+ mutt_format_s (dest, destlen, prefix, "");
- snprintf (fmt, sizeof (fmt), "%%%sc", prefix);
- snprintf (dest, destlen, fmt, aptr->content->type != TYPETEXT ||
- aptr->content->noconv ? 'n' : 'c');
+ snprintf (fmt, sizeof (fmt), "%%%sc", prefix);
+ snprintf (dest, destlen, fmt, aptr->content->type != TYPETEXT ||
+ aptr->content->noconv ? 'n' : 'c');
- if (aptr->content->description)
- {
- mutt_format_s (dest, destlen, prefix, aptr->content->description);
- break;
- }
- if (mutt_is_message_type(aptr->content->type, aptr->content->subtype) &&
- MsgFmt && aptr->content->hdr)
- {
- char s[SHORT_STRING];
- _mutt_make_string (s, sizeof (s), MsgFmt, NULL, aptr->content->hdr,
- M_FORMAT_FORCESUBJ | M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR);
- if (*s)
- {
- mutt_format_s (dest, destlen, prefix, s);
- break;
- }
- }
- if (!aptr->content->filename)
- {
- mutt_format_s (dest, destlen, prefix, "<no description>");
- break;
- }
+ if (aptr->content->description)
+ {
+ mutt_format_s (dest, destlen, prefix, aptr->content->description);
+ break;
+ }
+ if (mutt_is_message_type(aptr->content->type, aptr->content->subtype) &&
+ MsgFmt && aptr->content->hdr)
+ {
+ char s[SHORT_STRING];
+ _mutt_make_string (s, sizeof (s), MsgFmt, NULL, aptr->content->hdr,
+ M_FORMAT_FORCESUBJ | M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR);
+ if (*s)
+ {
+ mutt_format_s (dest, destlen, prefix, s);
+ break;
+ }
+ }
+ if (!aptr->content->filename)
+ {
+ mutt_format_s (dest, destlen, prefix, "<no description>");
+ break;
+ }
- if (aptr->content->filename && *aptr->content->filename == '/')
- {
- char path[_POSIX_PATH_MAX];
-
- strfcpy (path, aptr->content->filename, sizeof (path));
- mutt_pretty_mailbox (path);
- mutt_format_s (dest, destlen, prefix, path);
- }
- else
- mutt_format_s (dest, destlen, prefix, NONULL (aptr->content->filename));
+ if (aptr->content->filename && *aptr->content->filename == '/')
+ {
+ char path[_POSIX_PATH_MAX];
+
+ strfcpy (path, aptr->content->filename, sizeof (path));
+ mutt_pretty_mailbox (path);
+ mutt_format_s (dest, destlen, prefix, path);
+ }
+ else
+ mutt_format_s (dest, destlen, prefix, NONULL (aptr->content->filename));
- mutt_format_s (dest, destlen, prefix,
- ENCODING (aptr->content->encoding));
+ mutt_format_s (dest, destlen, prefix,
+ ENCODING (aptr->content->encoding));
- snprintf (dest, destlen, "%c",
- (aptr->content->disposition == DISPINLINE) ? 'I' : 'A');
+ snprintf (dest, destlen, "%c",
+ (aptr->content->disposition == DISPINLINE) ? 'I' : 'A');
- snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
- snprintf (dest, destlen, fmt, aptr->num + 1);
+ snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
+ snprintf (dest, destlen, fmt, aptr->num + 1);
- mutt_pretty_size (tmp, sizeof(tmp), l);
- mutt_format_s (dest, destlen, prefix, tmp);
+ mutt_pretty_size (tmp, sizeof(tmp), l);
+ mutt_format_s (dest, destlen, prefix, tmp);
- body->encoding != ENCBASE64 &&
- body->encoding != ENCQUOTEDPRINTABLE &&
- mutt_is_message_type(body->type, body->subtype))
+ body->encoding != ENCBASE64 &&
+ body->encoding != ENCQUOTEDPRINTABLE &&
+ mutt_is_message_type(body->type, body->subtype))
- ret = mutt_get_field_att (_("Save to file ('.' for last used folder): ")
- , buf, sizeof (buf), M_FILE | M_CLEAR);
- if (((ret != 0) && (ret != 2)) || (!buf[0]))
+ ret = mutt_get_field (prompt, buf, sizeof (buf), M_FILE | M_CLEAR | M_LASTFOLDER);
+ if (((ret != 0) && (ret != 2)) || (!buf[0] && ret != 2))
- strfcpy (buf, LastSaveFolder, sizeof (buf));
- strcat(buf,body->filename);
+ char tmpbuf[_POSIX_PATH_MAX];
+ snprintf(tmpbuf,sizeof(tmpbuf),"%s%s",LastSaveFolder,buf);
+ strfcpy (buf, tmpbuf, sizeof (buf));
- body->hdr &&
- body->encoding != ENCBASE64 &&
- body->encoding != ENCQUOTEDPRINTABLE &&
- mutt_is_message_type (body->type, body->subtype));
+ body->hdr &&
+ body->encoding != ENCBASE64 &&
+ body->encoding != ENCQUOTEDPRINTABLE &&
+ mutt_is_message_type (body->type, body->subtype));
- if (!buf[0])
- {
- int append = 0;
-
- strfcpy (buf, NONULL (top->filename), sizeof (buf));
- if (mutt_get_field (_("Save to file: "), buf, sizeof (buf),
- M_FILE | M_CLEAR) != 0 || !buf[0])
- return;
- mutt_expand_path (buf, sizeof (buf));
- if (mutt_check_overwrite (top->filename, buf, tfile,
- sizeof (tfile), &append, NULL))
- return;
- rc = mutt_save_attachment (fp, top, tfile, append, hdr);
- if (rc == 0 && AttachSep && (fpout = fopen (tfile,"a")) != NULL)
- {
- fprintf(fpout, "%s", AttachSep);
- fclose (fpout);
- }
- }
- else
- {
- rc = mutt_save_attachment (fp, top, tfile, M_SAVE_APPEND, hdr);
- if (rc == 0 && AttachSep && (fpout = fopen (tfile,"a")) != NULL)
- {
- fprintf(fpout, "%s", AttachSep);
- fclose (fpout);
- }
- }
+ if (!buf[0])
+ {
+ int append = 0;
+
+ strfcpy (buf, NONULL (top->filename), sizeof (buf));
+ if (mutt_get_field (_("Save to file: "), buf, sizeof (buf),
+ M_FILE | M_CLEAR) != 0 || !buf[0])
+ return;
+ mutt_expand_path (buf, sizeof (buf));
+ if (mutt_check_overwrite (top->filename, buf, tfile,
+ sizeof (tfile), &append, NULL))
+ return;
+ rc = mutt_save_attachment (fp, top, tfile, append, hdr);
+ if (rc == 0 && AttachSep && (fpout = fopen (tfile,"a")) != NULL)
+ {
+ fprintf(fpout, "%s", AttachSep);
+ fclose (fpout);
+ }
+ }
+ else
+ {
+ rc = mutt_save_attachment (fp, top, tfile, M_SAVE_APPEND, hdr);
+ if (rc == 0 && AttachSep && (fpout = fopen (tfile,"a")) != NULL)
+ {
+ fprintf(fpout, "%s", AttachSep);
+ fclose (fpout);
+ }
+ }
- if (tag && menu && top->aptr)
- {
- menu->oldcurrent = menu->current;
- menu->current = top->aptr->num;
- menu_check_recenter (menu);
- menu->redraw |= REDRAW_MOTION;
-
- menu_redraw (menu);
- }
- if (mutt_query_save_attachment (fp, top, hdr, &directory) == -1)
- break;
+ if (tag && menu && top->aptr)
+ {
+ menu->oldcurrent = menu->current;
+ menu->current = top->aptr->num;
+ menu_check_recenter (menu);
+ menu->redraw |= REDRAW_MOTION;
+
+ menu_redraw (menu);
+ }
+ if (mutt_query_save_attachment (fp, top, hdr, &directory) == -1)
+ break;
static void
pipe_attachment_list (char *command, FILE *fp, int tag, BODY *top, int filter,
static void
pipe_attachment_list (char *command, FILE *fp, int tag, BODY *top, int filter,
}
else if (top->parts)
pipe_attachment_list (command, fp, tag, top->parts, filter, state);
}
else if (top->parts)
pipe_attachment_list (command, fp, tag, top->parts, filter, state);
memset (&state, 0, sizeof (STATE));
if (mutt_get_field ((filter ? _("Filter through: ") : _("Pipe to: ")),
memset (&state, 0, sizeof (STATE));
if (mutt_get_field ((filter ? _("Filter through: ") : _("Pipe to: ")),
- if (ascii_strcasecmp ("text/plain", top->subtype) &&
- ascii_strcasecmp ("application/postscript", top->subtype))
- {
- if (!mutt_can_decode (top))
- {
- mutt_error (_("I dont know how to print %s attachments!"), type);
- return (0);
- }
- }
+ if (ascii_strcasecmp ("text/plain", top->subtype) &&
+ ascii_strcasecmp ("application/postscript", top->subtype))
+ {
+ if (!mutt_can_decode (top))
+ {
+ mutt_error (_("I dont know how to print %s attachments!"), type);
+ return (0);
+ }
+ }
snprintf (type, sizeof (type), "%s/%s", TYPE (top), top->subtype);
if (!option (OPTATTACHSPLIT) && !rfc1524_mailcap_lookup (top, type, NULL, M_PRINT))
{
snprintf (type, sizeof (type), "%s/%s", TYPE (top), top->subtype);
if (!option (OPTATTACHSPLIT) && !rfc1524_mailcap_lookup (top, type, NULL, M_PRINT))
{
- if (!ascii_strcasecmp ("text/plain", top->subtype) ||
- !ascii_strcasecmp ("application/postscript", top->subtype))
- pipe_attachment (fp, top, state);
- else if (mutt_can_decode (top))
- {
- /* decode and print */
-
- char newfile[_POSIX_PATH_MAX] = "";
- FILE *ifp;
-
- mutt_mktemp (newfile);
- if (mutt_decode_save_attachment (fp, top, newfile, M_PRINTING, 0) == 0)
- {
- if ((ifp = fopen (newfile, "r")) != NULL)
- {
- mutt_copy_stream (ifp, state->fpout);
- fclose (ifp);
- if (AttachSep)
- state_puts (AttachSep, state);
- }
- }
- mutt_unlink (newfile);
- }
+ if (!ascii_strcasecmp ("text/plain", top->subtype) ||
+ !ascii_strcasecmp ("application/postscript", top->subtype))
+ pipe_attachment (fp, top, state);
+ else if (mutt_can_decode (top))
+ {
+ /* decode and print */
+
+ char newfile[_POSIX_PATH_MAX] = "";
+ FILE *ifp;
+
+ mutt_mktemp (newfile);
+ if (mutt_decode_save_attachment (fp, top, newfile, M_PRINTING, 0) == 0)
+ {
+ if ((ifp = fopen (newfile, "r")) != NULL)
+ {
+ mutt_copy_stream (ifp, state->fpout);
+ fclose (ifp);
+ if (AttachSep)
+ state_puts (AttachSep, state);
+ }
+ }
+ mutt_unlink (newfile);
+ }
- /* when we edit the content-type, we should redisplay the attachment
- immediately */
- mutt_edit_content_type (hdr, idx[menu->current]->content, fp);
+ /* when we edit the content-type, we should redisplay the attachment
+ immediately */
+ mutt_edit_content_type (hdr, idx[menu->current]->content, fp);
/* functions which are passed through from the pager */
case OP_CHECK_TRADITIONAL:
if (!(WithCrypto & APPLICATION_PGP) || (hdr && hdr->security & PGP_TRADITIONAL_CHECKED))
/* functions which are passed through from the pager */
case OP_CHECK_TRADITIONAL:
if (!(WithCrypto & APPLICATION_PGP) || (hdr && hdr->security & PGP_TRADITIONAL_CHECKED))
attach_collapse (b->parts, 1, 1, 0);
else if (b->type == TYPEMULTIPART || mutt_is_message_type (b->type, b->subtype))
attach_collapse (b->parts, collapse, i, 0);
attach_collapse (b->parts, 1, 1, 0);
else if (b->type == TYPEMULTIPART || mutt_is_message_type (b->type, b->subtype))
attach_collapse (b->parts, collapse, i, 0);
- mutt_view_attachment (fp, idx[menu->current]->content, M_MAILCAP,
- hdr, idx, idxlen);
- menu->redraw = REDRAW_FULL;
- break;
+ mutt_view_attachment (fp, idx[menu->current]->content, M_MAILCAP,
+ hdr, idx, idxlen);
+ menu->redraw = REDRAW_FULL;
+ break;
- mutt_view_attachment (fp, idx[menu->current]->content, M_AS_TEXT,
- hdr, idx, idxlen);
- menu->redraw = REDRAW_FULL;
- break;
+ mutt_view_attachment (fp, idx[menu->current]->content, M_AS_TEXT,
+ hdr, idx, idxlen);
+ menu->redraw = REDRAW_FULL;
+ break;
- mutt_print_attachment_list (fp, menu->tagprefix,
- menu->tagprefix ? cur : idx[menu->current]->content);
- break;
+ mutt_print_attachment_list (fp, menu->tagprefix,
+ menu->tagprefix ? cur : idx[menu->current]->content);
+ break;
- mutt_pipe_attachment_list (fp, menu->tagprefix,
- menu->tagprefix ? cur : idx[menu->current]->content, 0);
- break;
+ mutt_pipe_attachment_list (fp, menu->tagprefix,
+ menu->tagprefix ? cur : idx[menu->current]->content, 0);
+ break;
- mutt_save_attachment_list (fp, menu->tagprefix,
- menu->tagprefix ? cur : idx[menu->current]->content, hdr, menu);
+ mutt_save_attachment_list (fp, menu->tagprefix,
+ menu->tagprefix ? cur : idx[menu->current]->content, hdr, menu);
- if (!menu->tagprefix)
- {
- if (idx[menu->current]->parent_type == TYPEMULTIPART)
- {
- idx[menu->current]->content->deleted = 1;
- if (option (OPTRESOLVE) && menu->current < menu->max - 1)
- {
- menu->current++;
- menu->redraw = REDRAW_MOTION_RESYNCH;
- }
- else
- menu->redraw = REDRAW_CURRENT;
- }
- else
- mutt_message _(
- "Only deletion of multipart attachments is supported.");
- }
- else
- {
- int x;
-
- for (x = 0; x < menu->max; x++)
- {
- if (idx[x]->content->tagged)
- {
- if (idx[x]->parent_type == TYPEMULTIPART)
- {
- idx[x]->content->deleted = 1;
- menu->redraw = REDRAW_INDEX;
- }
- else
- mutt_message _(
- "Only deletion of multipart attachments is supported.");
- }
- }
- }
- }
+ if (!menu->tagprefix)
+ {
+ if (idx[menu->current]->parent_type == TYPEMULTIPART)
+ {
+ idx[menu->current]->content->deleted = 1;
+ if (option (OPTRESOLVE) && menu->current < menu->max - 1)
+ {
+ menu->current++;
+ menu->redraw = REDRAW_MOTION_RESYNCH;
+ }
+ else
+ menu->redraw = REDRAW_CURRENT;
+ }
+ else
+ mutt_message _(
+ "Only deletion of multipart attachments is supported.");
+ }
+ else
+ {
+ int x;
+
+ for (x = 0; x < menu->max; x++)
+ {
+ if (idx[x]->content->tagged)
+ {
+ if (idx[x]->parent_type == TYPEMULTIPART)
+ {
+ idx[x]->content->deleted = 1;
+ menu->redraw = REDRAW_INDEX;
+ }
+ else
+ mutt_message _(
+ "Only deletion of multipart attachments is supported.");
+ }
+ }
+ }
+ }
- idx[menu->current]->content->deleted = 0;
- if (option (OPTRESOLVE) && menu->current < menu->max - 1)
- {
- menu->current++;
- menu->redraw = REDRAW_MOTION_RESYNCH;
- }
- else
- menu->redraw = REDRAW_CURRENT;
+ idx[menu->current]->content->deleted = 0;
+ if (option (OPTRESOLVE) && menu->current < menu->max - 1)
+ {
+ menu->current++;
+ menu->redraw = REDRAW_MOTION_RESYNCH;
+ }
+ else
+ menu->redraw = REDRAW_CURRENT;
- int x;
-
- for (x = 0; x < menu->max; x++)
- {
- if (idx[x]->content->tagged)
- {
- idx[x]->content->deleted = 0;
- menu->redraw = REDRAW_INDEX;
- }
- }
+ int x;
+
+ for (x = 0; x < menu->max; x++)
+ {
+ if (idx[x]->content->tagged)
+ {
+ idx[x]->content->deleted = 0;
+ menu->redraw = REDRAW_INDEX;
+ }
+ }
- CHECK_ATTACH;
- mutt_attach_forward (fp, hdr, idx, idxlen,
- menu->tagprefix ? NULL : idx[menu->current]->content, SENDNEWS);
- menu->redraw = REDRAW_FULL;
- break;
+ CHECK_ATTACH;
+ mutt_attach_forward (fp, hdr, idx, idxlen,
+ menu->tagprefix ? NULL : idx[menu->current]->content, SENDNEWS);
+ menu->redraw = REDRAW_FULL;
+ break;
- CHECK_ATTACH;
-
- if (!idx[menu->current]->content->hdr->env->followup_to ||
- mutt_strcasecmp (idx[menu->current]->content->hdr->env->followup_to, "poster") ||
- query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES)
- {
- mutt_attach_reply (fp, hdr, idx, idxlen,
- menu->tagprefix ? NULL : idx[menu->current]->content,
- SENDNEWS|SENDREPLY);
- menu->redraw = REDRAW_FULL;
- break;
- }
+ CHECK_ATTACH;
+
+ if (!idx[menu->current]->content->hdr->env->followup_to ||
+ mutt_strcasecmp (idx[menu->current]->content->hdr->env->followup_to, "poster") ||
+ query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES)
+ {
+ mutt_attach_reply (fp, hdr, idx, idxlen,
+ menu->tagprefix ? NULL : idx[menu->current]->content,
+ SENDNEWS|SENDREPLY);
+ menu->redraw = REDRAW_FULL;
+ break;
+ }
- mx_close_message (&msg);
- hdr->attach_del = 0;
- while (idxmax-- > 0)
- {
- if (!idx[idxmax])
- continue;
- if (idx[idxmax]->content && idx[idxmax]->content->deleted)
- hdr->attach_del = 1;
- if (idx[idxmax]->content)
- idx[idxmax]->content->aptr = NULL;
- FREE (&idx[idxmax]->tree);
- FREE (&idx[idxmax]);
- }
- if (hdr->attach_del)
- hdr->changed = 1;
- FREE (&idx);
- idxmax = 0;
+ mx_close_message (&msg);
+ hdr->attach_del = 0;
+ while (idxmax-- > 0)
+ {
+ if (!idx[idxmax])
+ continue;
+ if (idx[idxmax]->content && idx[idxmax]->content->deleted)
+ hdr->attach_del = 1;
+ if (idx[idxmax]->content)
+ idx[idxmax]->content->aptr = NULL;
+ FREE (&idx[idxmax]->tree);
+ FREE (&idx[idxmax]);
+ }
+ if (hdr->attach_del)
+ hdr->changed = 1;
+ FREE (&idx);
+ idxmax = 0;