}
/* returns -1 on error, 0 or the return code from mutt_do_pager() on success */
-int mutt_view_attachment(FILE *fp, BODY *a, int flag, HEADER *hdr, ATTACHPTR **idx, short idxlen)
+int mutt_view_attachment(FILE *fp, BODY *a, int flag, HEADER *hdr, struct AttachPtr **idx, short idxlen)
{
char tempfile[_POSIX_PATH_MAX] = "";
char pagerfile[_POSIX_PATH_MAX] = "";
#include "mutt_menu.h"
-typedef struct attachptr
+struct AttachPtr
{
BODY *content;
int parent_type;
int level;
int num;
bool unowned : 1; /* don't unlink on detach */
-} ATTACHPTR;
+};
-ATTACHPTR **mutt_gen_attach_list(BODY *m, int parent_type, ATTACHPTR **idx,
+struct AttachPtr **mutt_gen_attach_list(BODY *m, int parent_type, struct AttachPtr **idx,
short *idxlen, short *idxmax, int level, int compose);
-void mutt_update_tree(ATTACHPTR **idx, short idxlen);
+void mutt_update_tree(struct AttachPtr **idx, short idxlen);
int mutt_view_attachment(FILE *fp, BODY *a, int flag, HEADER *hdr,
- ATTACHPTR **idx, short idxlen);
+ struct AttachPtr **idx, short idxlen);
int mutt_tag_attach(MUTTMENU *menu, int n, int m);
int mutt_attach_display_loop(MUTTMENU *menu, int op, FILE *fp, HEADER *hdr, BODY *cur,
- ATTACHPTR ***idxp, short *idxlen, short *idxmax, int recv);
+ struct AttachPtr ***idxp, short *idxlen, short *idxmax, int recv);
void mutt_save_attachment_list(FILE *fp, int tag, BODY *top, HEADER *hdr, MUTTMENU *menu);
void mutt_pipe_attachment_list(FILE *fp, int tag, BODY *top, int filter);
void mutt_print_attachment_list(FILE *fp, int tag, BODY *top);
-void mutt_attach_bounce(FILE *fp, HEADER *hdr, ATTACHPTR **idx, short idxlen, BODY *cur);
-void mutt_attach_resend(FILE *fp, HEADER *hdr, ATTACHPTR **idx, short idxlen, BODY *cur);
-void mutt_attach_forward(FILE *fp, HEADER *hdr, ATTACHPTR **idx, short idxlen,
+void mutt_attach_bounce(FILE *fp, HEADER *hdr, struct AttachPtr **idx, short idxlen, BODY *cur);
+void mutt_attach_resend(FILE *fp, HEADER *hdr, struct AttachPtr **idx, short idxlen, BODY *cur);
+void mutt_attach_forward(FILE *fp, HEADER *hdr, struct AttachPtr **idx, short idxlen,
BODY *cur, int flags);
-void mutt_attach_reply(FILE *fp, HEADER *hdr, ATTACHPTR **idx, short idxlen,
+void mutt_attach_reply(FILE *fp, HEADER *hdr, struct AttachPtr **idx, short idxlen,
BODY *cur, int flags);
#endif /* _MUTT_ATTACH_H */
static void snd_entry(char *b, size_t blen, MUTTMENU *menu, int num)
{
mutt_FormatString(b, blen, 0, MuttIndexWindow->cols, NONULL(AttachFormat), mutt_attach_fmt,
- (unsigned long) (((ATTACHPTR **) menu->data)[num]),
+ (unsigned long) (((struct AttachPtr **) menu->data)[num]),
MUTT_FORMAT_STAT_FILE | MUTT_FORMAT_ARROWCURSOR);
}
}
#endif /* MIXMASTER */
-static int check_attachments(ATTACHPTR **idx, short idxlen)
+static int check_attachments(struct AttachPtr **idx, short idxlen)
{
int i, r;
struct stat st;
static int delete_attachment(MUTTMENU *menu, short *idxlen, int x)
{
- ATTACHPTR **idx = (ATTACHPTR **) menu->data;
+ struct AttachPtr **idx = (struct AttachPtr **) menu->data;
int y;
menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
return 0;
}
-static void update_idx(MUTTMENU *menu, ATTACHPTR **idx, short idxlen)
+static void update_idx(MUTTMENU *menu, struct AttachPtr **idx, short idxlen)
{
idx[idxlen]->level = (idxlen > 0) ? idx[idxlen - 1]->level : 0;
if (idxlen)
{
size_t s;
unsigned short i;
- ATTACHPTR **idx = menu->data;
+ struct AttachPtr **idx = menu->data;
CONTENT *info = NULL;
BODY *b = NULL;
char buf[LONG_STRING];
char fname[_POSIX_PATH_MAX];
MUTTMENU *menu = NULL;
- ATTACHPTR **idx = NULL;
+ struct AttachPtr **idx = NULL;
short idxlen = 0;
short idxmax = 0;
int i, close = 0;
break;
if (idxlen == idxmax)
{
- safe_realloc(&idx, sizeof(ATTACHPTR *) * (idxmax += 5));
+ safe_realloc(&idx, sizeof(struct AttachPtr *) * (idxmax += 5));
menu->data = idx;
}
- idx[idxlen] = safe_calloc(1, sizeof(ATTACHPTR));
+ idx[idxlen] = safe_calloc(1, sizeof(struct AttachPtr));
if ((idx[idxlen]->content = crypt_pgp_make_key_attachment(NULL)) != NULL)
{
update_idx(menu, idx, idxlen++);
if (idxlen + numfiles >= idxmax)
{
- safe_realloc(&idx, sizeof(ATTACHPTR *) * (idxmax += 5 + numfiles));
+ safe_realloc(&idx, sizeof(struct AttachPtr *) * (idxmax += 5 + numfiles));
menu->data = idx;
}
for (i = 0; i < numfiles; i++)
{
char *att = files[i];
- idx[idxlen] = safe_calloc(1, sizeof(ATTACHPTR));
+ idx[idxlen] = safe_calloc(1, sizeof(struct AttachPtr));
idx[idxlen]->unowned = true;
idx[idxlen]->content = mutt_make_file_attach(att);
if (idx[idxlen]->content != NULL)
if (idxlen + Context->tagged >= idxmax)
{
- safe_realloc(&idx, sizeof(ATTACHPTR *) * (idxmax += 5 + Context->tagged));
+ safe_realloc(&idx, sizeof(struct AttachPtr *) * (idxmax += 5 + Context->tagged));
menu->data = idx;
}
h = Context->hdrs[i];
if (h->tagged)
{
- idx[idxlen] = safe_calloc(1, sizeof(ATTACHPTR));
+ idx[idxlen] = safe_calloc(1, sizeof(struct AttachPtr));
idx[idxlen]->content = mutt_make_message_attach(Context, h, 1);
if (idx[idxlen]->content != NULL)
update_idx(menu, idx, idxlen++);
}
if (idxlen == idxmax)
{
- safe_realloc(&idx, sizeof(ATTACHPTR *) * (idxmax += 5));
+ safe_realloc(&idx, sizeof(struct AttachPtr *) * (idxmax += 5));
menu->data = idx;
}
}
safe_fclose(&fp);
- idx[idxlen] = safe_calloc(1, sizeof(ATTACHPTR));
+ idx[idxlen] = safe_calloc(1, sizeof(struct AttachPtr));
if ((idx[idxlen]->content = mutt_make_file_attach(fname)) == NULL)
{
mutt_error(_("What we have here is a failure to make an attachment"));
struct body *parts; /* parts of a multipart or message/rfc822 */
struct header *hdr; /* header information for message/rfc822 */
- struct attachptr *aptr; /* Menu information, used in recvattach.c */
+ struct AttachPtr *aptr; /* Menu information, used in recvattach.c */
signed short attach_count;
HEADER *hdr; /* current message */
BODY *bdy; /* current attachment */
FILE *fp; /* source stream */
- ATTACHPTR **idx; /* attachment information */
+ struct AttachPtr **idx; /* attachment information */
short idxlen;
} pager_t;
{ N_("Print"), OP_PRINT }, { N_("Help"), OP_HELP }, { NULL, 0 },
};
-void mutt_update_tree(ATTACHPTR **idx, short idxlen)
+void mutt_update_tree(struct AttachPtr **idx, short idxlen)
{
char buf[STRING];
char *s = NULL;
}
}
-ATTACHPTR **mutt_gen_attach_list(BODY *m, int parent_type, ATTACHPTR **idx,
+struct AttachPtr **mutt_gen_attach_list(BODY *m, int parent_type, struct AttachPtr **idx,
short *idxlen, short *idxmax, int level, int compose)
{
- ATTACHPTR *new = NULL;
+ struct AttachPtr *new = NULL;
int i;
for (; m; m = m->next)
{
if (*idxlen == *idxmax)
{
- safe_realloc(&idx, sizeof(ATTACHPTR *) * ((*idxmax) += 5));
+ safe_realloc(&idx, sizeof(struct AttachPtr *) * ((*idxmax) += 5));
for (i = *idxlen; i < *idxmax; i++)
idx[i] = NULL;
}
else
{
if (!idx[*idxlen])
- idx[*idxlen] = safe_calloc(1, sizeof(ATTACHPTR));
+ idx[*idxlen] = safe_calloc(1, sizeof(struct AttachPtr));
new = idx[(*idxlen)++];
new->content = m;
char fmt[16];
char tmp[SHORT_STRING];
char charset[SHORT_STRING];
- ATTACHPTR *aptr = (ATTACHPTR *) data;
+ struct AttachPtr *aptr = (struct AttachPtr *) data;
int optional = (flags & MUTT_FORMAT_OPTIONAL);
size_t l;
static void attach_entry(char *b, size_t blen, MUTTMENU *menu, int num)
{
mutt_FormatString(b, blen, 0, MuttIndexWindow->cols, NONULL(AttachFormat), mutt_attach_fmt,
- (unsigned long) (((ATTACHPTR **) menu->data)[num]),
+ (unsigned long) (((struct AttachPtr **) menu->data)[num]),
MUTT_FORMAT_ARROWCURSOR);
}
int mutt_tag_attach(MUTTMENU *menu, int n, int m)
{
- BODY *cur = ((ATTACHPTR **) menu->data)[n]->content;
+ BODY *cur = ((struct AttachPtr **) menu->data)[n]->content;
bool ot = cur->tagged;
cur->tagged = (m >= 0 ? m : !cur->tagged);
print_attachment_list(fp, tag, top, &state);
}
-static void update_attach_index(BODY *cur, ATTACHPTR ***idxp, short *idxlen,
+static void update_attach_index(BODY *cur, struct AttachPtr ***idxp, short *idxlen,
short *idxmax, MUTTMENU *menu)
{
- ATTACHPTR **idx = *idxp;
+ struct AttachPtr **idx = *idxp;
while (--(*idxlen) >= 0)
idx[(*idxlen)]->content = NULL;
*idxlen = 0;
int mutt_attach_display_loop(MUTTMENU *menu, int op, FILE *fp, HEADER *hdr, BODY *cur,
- ATTACHPTR ***idxp, short *idxlen, short *idxmax, int recv)
+ struct AttachPtr ***idxp, short *idxlen, short *idxmax, int recv)
{
- ATTACHPTR **idx = *idxp;
+ struct AttachPtr **idx = *idxp;
do
{
BODY *cur = NULL;
MESSAGE *msg = NULL;
FILE *fp = NULL;
- ATTACHPTR **idx = NULL;
+ struct AttachPtr **idx = NULL;
short idxlen = 0;
short idxmax = 0;
int flags = 0;
return true;
}
-static bool check_all_msg(ATTACHPTR **idx, short idxlen, BODY *cur, bool err)
+static bool check_all_msg(struct AttachPtr **idx, short idxlen, BODY *cur, bool err)
{
short i;
/* can we decode all tagged attachments? */
-static short check_can_decode(ATTACHPTR **idx, short idxlen, BODY *cur)
+static short check_can_decode(struct AttachPtr **idx, short idxlen, BODY *cur)
{
short i;
return 1;
}
-static short count_tagged(ATTACHPTR **idx, short idxlen)
+static short count_tagged(struct AttachPtr **idx, short idxlen)
{
short count = 0;
short i;
/* count the number of tagged children below a multipart or message
* attachment.
*/
-static short count_tagged_children(ATTACHPTR **idx, short idxlen, short i)
+static short count_tagged_children(struct AttachPtr **idx, short idxlen, short i)
{
short level = idx[i]->level;
short count = 0;
** The bounce function, from the attachment menu
**
**/
-void mutt_attach_bounce(FILE *fp, HEADER *hdr, ATTACHPTR **idx, short idxlen, BODY *cur)
+void mutt_attach_bounce(FILE *fp, HEADER *hdr, struct AttachPtr **idx, short idxlen, BODY *cur)
{
short i;
char prompt[STRING];
**
**
**/
-void mutt_attach_resend(FILE *fp, HEADER *hdr, ATTACHPTR **idx, short idxlen, BODY *cur)
+void mutt_attach_resend(FILE *fp, HEADER *hdr, struct AttachPtr **idx, short idxlen, BODY *cur)
{
short i;
**/
/* try to find a common parent message for the tagged attachments. */
-static HEADER *find_common_parent(ATTACHPTR **idx, short idxlen, short nattach)
+static HEADER *find_common_parent(struct AttachPtr **idx, short idxlen, short nattach)
{
short i;
short nchildren;
* Note: This and the calling procedure could be optimized quite a
* bit. For now, it's not worth the effort.
*/
-static bool is_parent(short i, ATTACHPTR **idx, short idxlen, BODY *cur)
+static bool is_parent(short i, struct AttachPtr **idx, short idxlen, BODY *cur)
{
short level = idx[i]->level;
return 0;
}
-static HEADER *find_parent(ATTACHPTR **idx, short idxlen, BODY *cur, short nattach)
+static HEADER *find_parent(struct AttachPtr **idx, short idxlen, BODY *cur, short nattach)
{
short i;
HEADER *parent = NULL;
/* Attach all the body parts which can't be decoded.
* This code is shared by forwarding and replying. */
-static BODY **copy_problematic_attachments(FILE *fp, BODY **last, ATTACHPTR **idx,
+static BODY **copy_problematic_attachments(FILE *fp, BODY **last, struct AttachPtr **idx,
short idxlen, short force)
{
short i;
* forward one or several MIME bodies
* (non-message types)
*/
-static void attach_forward_bodies(FILE *fp, HEADER *hdr, ATTACHPTR **idx,
+static void attach_forward_bodies(FILE *fp, HEADER *hdr, struct AttachPtr **idx,
short idxlen, BODY *cur, short nattach, int flags)
{
short i;
* while, on the attachment menu, messages are referenced through
* the attachment index.
*/
-static void attach_forward_msgs(FILE *fp, HEADER *hdr, ATTACHPTR **idx,
+static void attach_forward_msgs(FILE *fp, HEADER *hdr, struct AttachPtr **idx,
short idxlen, BODY *cur, int flags)
{
HEADER *curhdr = NULL;
ci_send_message(flags, tmphdr, *tmpbody ? tmpbody : NULL, NULL, curhdr);
}
-void mutt_attach_forward(FILE *fp, HEADER *hdr, ATTACHPTR **idx, short idxlen,
+void mutt_attach_forward(FILE *fp, HEADER *hdr, struct AttachPtr **idx, short idxlen,
BODY *cur, int flags)
{
short nattach;
*
* Note that this code is horribly similar to envelope_defaults () from send.c.
*/
-static int attach_reply_envelope_defaults(ENVELOPE *env, ATTACHPTR **idx,
+static int attach_reply_envelope_defaults(ENVELOPE *env, struct AttachPtr **idx,
short idxlen, HEADER *parent, int flags)
{
ENVELOPE *curenv = NULL;
mutt_make_post_indent(Context, cur, tmpfp);
}
-void mutt_attach_reply(FILE *fp, HEADER *hdr, ATTACHPTR **idx, short idxlen,
+void mutt_attach_reply(FILE *fp, HEADER *hdr, struct AttachPtr **idx, short idxlen,
BODY *cur, int flags)
{
short mime_reply_any = 0;