diff options
Diffstat (limited to 'pith/mailcmd.c')
-rw-r--r-- | pith/mailcmd.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/pith/mailcmd.c b/pith/mailcmd.c index 73be580c..ad3e409e 100644 --- a/pith/mailcmd.c +++ b/pith/mailcmd.c @@ -755,7 +755,7 @@ do_broach_folder(char *newfolder, CONTEXT_S *new_context, MAILSTREAM **streamp, snprintf(status_msg, sizeof(status_msg), "%sOpening \"", do_reopen ? "Re-" : ""); fname = folder_name_decoded((unsigned char *)newfolder); - strncat(status_msg, pretty_fn(fname ? (char*) fname : newfolder), + strncat(status_msg, pretty_fn(fname ? (char *) fname : newfolder), sizeof(status_msg)-strlen(status_msg) - 2); if(fname) fs_give((void **)&fname); status_msg[sizeof(status_msg)-2] = '\0'; @@ -1469,8 +1469,11 @@ expunge_and_close(MAILSTREAM *stream, char **final_msg, long unsigned int flags) && context_isambig(folder))){ ret = 'y'; } - else if(pith_opt_expunge_prompt) - ret = (*pith_opt_expunge_prompt)(stream, pretty_fn(folder), delete_count); + else if(pith_opt_expunge_prompt){ + unsigned char *fname = folder_name_decoded((unsigned char *)folder); + ret = (*pith_opt_expunge_prompt)(stream, pretty_fn((char *)fname), delete_count); + if(fname) fs_give((void **) &fname); + } /* get this message back in queue */ if(moved_msg) @@ -1479,6 +1482,7 @@ expunge_and_close(MAILSTREAM *stream, char **final_msg, long unsigned int flags) if(ret == 'y'){ long filtered; + unsigned char *fname = folder_name_decoded((unsigned char *)folder); filtered = any_lflagged(sp_msgmap(stream), MN_EXLD); @@ -1487,13 +1491,14 @@ expunge_and_close(MAILSTREAM *stream, char **final_msg, long unsigned int flags) no_close ? "" : "Clos", no_close ? "" : ing, no_close ? "" : " \"", - no_close ? "" : pretty_fn(folder), + no_close ? "" : pretty_fn((char *)fname), no_close ? "" : "\". ", final_msg ? "Kept" : "Keeping", comatose(stream->nmsgs - filtered - delete_count), plural(stream->nmsgs - filtered - delete_count), ing, long2string(delete_count)); + if(fname) fs_give((void **)&fname); if(final_msg) *final_msg = cpystr(buff2); else @@ -1566,11 +1571,12 @@ expunge_and_close(MAILSTREAM *stream, char **final_msg, long unsigned int flags) } if(!no_close){ + unsigned char *fname = folder_name_decoded((unsigned char *)folder); if(stream->nmsgs){ snprintf(buff2, sizeof(buff2), "Clos%s folder \"%.*s\". %s%s%s message%s.", ing, - sizeof(buff2)-50, pretty_fn(folder), + sizeof(buff2)-50, pretty_fn((char *) fname), final_msg ? "Kept" : "Keeping", (stream->nmsgs == 1L) ? " single" : " all ", (stream->nmsgs > 1L) @@ -1579,8 +1585,9 @@ expunge_and_close(MAILSTREAM *stream, char **final_msg, long unsigned int flags) } else{ snprintf(buff2, sizeof(buff2), "Clos%s empty folder \"%.*s\"", - ing, sizeof(buff2)-50, pretty_fn(folder)); + ing, sizeof(buff2)-50, pretty_fn((char *) fname)); } + if(fname) fs_give((void **)&fname); if(final_msg) *final_msg = cpystr(buff2); @@ -1626,7 +1633,9 @@ expunge_and_close(MAILSTREAM *stream, char **final_msg, long unsigned int flags) delete_count++; if(delete_count && pith_opt_expunge_prompt){ - ret = (*pith_opt_expunge_prompt)(stream, pretty_fn(folder), delete_count); + unsigned char *fname = folder_name_decoded((unsigned char *)folder); + ret = (*pith_opt_expunge_prompt)(stream, pretty_fn((char *) fname), delete_count); + if(fname) fs_give((void **)&fname); if(ret == 'y'){ char seq[64]; @@ -1639,10 +1648,13 @@ expunge_and_close(MAILSTREAM *stream, char **final_msg, long unsigned int flags) if(F_ON(F_NEWS_CROSS_DELETE, ps_global)) cross_delete_crossposts(stream); } - else + else{ + unsigned char *fname = folder_name_decoded((unsigned char *)folder); snprintf(buff2, sizeof(buff2), "Clos%s read-only folder \"%.*s\". No changes to save", - ing, sizeof(buff2)-60, pretty_fn(folder)); + ing, sizeof(buff2)-60, pretty_fn((char *) fname)); + if(fname) fs_give((void **)&fname); + } if(final_msg) *final_msg = cpystr(buff2); |