X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=recvattach.c;h=e71d85b731564ee68f5462b63bd20a467bb3eb5e;hb=49f1156410e9a037404101696d37b2c0d5c67564;hp=f7709158e7d1987fa6a86b9b3e23c3f6437dc1c7;hpb=d6988dab6bd378ccdf0f17aaa16de8aee1ceaf43;p=apps%2Fmadmutt.git diff --git a/recvattach.c b/recvattach.c index f770915..e71d85b 100644 --- a/recvattach.c +++ b/recvattach.c @@ -12,6 +12,8 @@ # include "config.h" #endif +#include + #include "mutt.h" #include "ascii.h" #include "enter.h" @@ -49,18 +51,20 @@ static char LastSaveFolder[_POSIX_PATH_MAX] = ""; break; \ } +#define SW (option(OPTMBOXPANE)?SidebarWidth:0) + static struct mapping_t AttachHelp[] = { {N_("Exit"), OP_EXIT}, {N_("Save"), OP_SAVE}, {N_("Pipe"), OP_PIPE}, {N_("Print"), OP_PRINT}, {N_("Help"), OP_HELP}, - {NULL} + {NULL, OP_NULL} }; static int mutt_extract_path (char *filename, char *path) { - char *tmp = mem_malloc (sizeof (char) * _POSIX_PATH_MAX); + char *tmp = p_new(char, _POSIX_PATH_MAX); char *help_ptr; help_ptr = tmp; @@ -74,7 +78,7 @@ static int mutt_extract_path (char *filename, char *path) } *help_ptr++ = *filename++; } - mem_free (&tmp); + p_delete(&tmp); return 0; } @@ -142,7 +146,7 @@ ATTACHPTR **mutt_gen_attach_list (BODY * m, } else { if (!idx[*idxlen]) - idx[*idxlen] = (ATTACHPTR *) mem_calloc (1, sizeof (ATTACHPTR)); + idx[*idxlen] = p_new(ATTACHPTR, 1); new = idx[(*idxlen)++]; new->content = m; @@ -367,7 +371,8 @@ const char *mutt_attach_fmt (char *dest, static void attach_entry (char *b, size_t blen, MUTTMENU * menu, int num) { - mutt_FormatString (b, blen, NONULL (AttachFormat), mutt_attach_fmt, + int w=(COLS-SW)>blen?blen:(COLS-SW); + mutt_FormatString (b, w, NONULL (AttachFormat), mutt_attach_fmt, (unsigned long) (((ATTACHPTR **) menu->data)[num]), M_FORMAT_ARROWCURSOR); } @@ -547,7 +552,7 @@ void mutt_save_attachment_list (FILE * fp, int tag, BODY * top, HEADER * hdr, break; } - mem_free (&directory); + p_delete(&directory); if (tag && menu) { menu->oldcurrent = menu->current; @@ -1238,12 +1243,12 @@ void mutt_view_attachments (HEADER * hdr) hdr->attach_del = 1; if (idx[idxmax]->content) idx[idxmax]->content->aptr = NULL; - mem_free (&idx[idxmax]->tree); - mem_free (&idx[idxmax]); + p_delete(&idx[idxmax]->tree); + p_delete(&idx[idxmax]); } if (hdr->attach_del) hdr->changed = 1; - mem_free (&idx); + p_delete(&idx); idxmax = 0; if (WithCrypto && need_secured && secured) {