changeset: 6705:7e817890913c user: Kevin McCarthy <ke...@8t8.us> date: Fri Jul 01 13:33:20 2016 -0700 link: http://dev.mutt.org/hg/mutt/rev/7e817890913c
Check $pgp_autoinline and $pgp_replyinline if oppenc is set. (closes #3846) The first oppenc call takes place after the initial checks of $pgp_autoline and $pgp_replyinline, and doesn't go through the pgp menu. Therefore, check for $pgp_autoline and $pgp_replyinline if oppenc is set too, to avoid oppenc enabling encryption without INLINE being set in those cases. a6a4d6ed0f19 previously cleaned things up so that it is safe to set INLINE even if encryption isn't enabled. changeset: 6706:c62f5cd3c8e4 user: Kevin McCarthy <ke...@8t8.us> date: Fri Jul 01 13:39:51 2016 -0700 link: http://dev.mutt.org/hg/mutt/rev/c62f5cd3c8e4 merge stable diffs (truncated from 19974 to 950 lines): diff -r f1f1af650910 -r c62f5cd3c8e4 Makefile.am --- a/Makefile.am Tue May 24 12:08:46 2016 -0700 +++ b/Makefile.am Fri Jul 01 13:39:51 2016 -0700 @@ -56,7 +56,7 @@ mutt_idna.c mutt_sasl.c mutt_socket.c mutt_ssl.c mutt_ssl_gnutls.c \ mutt_tunnel.c pgp.c pgpinvoke.c pgpkey.c pgplib.c pgpmicalg.c \ pgppacket.c pop.c pop_auth.c pop_lib.c remailer.c resize.c sha1.c \ - smime.c smtp.c utf8.c wcwidth.c \ + sidebar.c smime.c smtp.c utf8.c wcwidth.c \ bcache.h browser.h hcache.h mbyte.h mutt_idna.h remailer.h url.h EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \ @@ -71,8 +71,8 @@ mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h \ README.SSL smime.h group.h \ muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \ - ChangeLog mkchangelog.sh mutt_idna.h \ - snprintf.c regex.c crypt-gpgme.h hcachever.sh.in sys_socket.h \ + ChangeLog mkchangelog.sh mutt_idna.h sidebar.h OPS.SIDEBAR \ + snprintf.c regex.c crypt-gpgme.h hcachever.sh.in \ txt2c.c txt2c.sh version.sh check_sec.sh EXTRA_SCRIPTS = smime_keys @@ -129,9 +129,9 @@ keymap_defs.h: $(OPS) $(srcdir)/gen_defs $(srcdir)/gen_defs $(OPS) > keymap_defs.h -keymap_alldefs.h: $(srcdir)/OPS $(srcdir)/OPS.PGP $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME $(srcdir)/gen_defs +keymap_alldefs.h: $(srcdir)/OPS $(srcdir)/OPS.SIDEBAR $(srcdir)/OPS.PGP $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME $(srcdir)/gen_defs rm -f $@ - $(srcdir)/gen_defs $(srcdir)/OPS $(srcdir)/OPS.PGP \ + $(srcdir)/gen_defs $(srcdir)/OPS $(srcdir)/OPS.SIDEBAR $(srcdir)/OPS.PGP \ $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME \ > keymap_alldefs.h diff -r f1f1af650910 -r c62f5cd3c8e4 OPS.MIX --- a/OPS.MIX Tue May 24 12:08:46 2016 -0700 +++ b/OPS.MIX Fri Jul 01 13:39:51 2016 -0700 @@ -1,7 +1,7 @@ -OP_MIX_USE "Accept the chain constructed" -OP_MIX_APPEND "Append a remailer to the chain" -OP_MIX_INSERT "Insert a remailer into the chain" -OP_MIX_DELETE "Delete a remailer from the chain" -OP_MIX_CHAIN_PREV "Select the previous element of the chain" -OP_MIX_CHAIN_NEXT "Select the next element of the chain" +OP_MIX_USE "accept the chain constructed" +OP_MIX_APPEND "append a remailer to the chain" +OP_MIX_INSERT "insert a remailer into the chain" +OP_MIX_DELETE "delete a remailer from the chain" +OP_MIX_CHAIN_PREV "select the previous element of the chain" +OP_MIX_CHAIN_NEXT "select the next element of the chain" OP_COMPOSE_MIX "send the message through a mixmaster remailer chain" diff -r f1f1af650910 -r c62f5cd3c8e4 OPS.SIDEBAR --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OPS.SIDEBAR Fri Jul 01 13:39:51 2016 -0700 @@ -0,0 +1,8 @@ +OP_SIDEBAR_NEXT "move the highlight to next mailbox" +OP_SIDEBAR_NEXT_NEW "move the highlight to next mailbox with new mail" +OP_SIDEBAR_OPEN "open highlighted mailbox" +OP_SIDEBAR_PAGE_DOWN "scroll the sidebar down 1 page" +OP_SIDEBAR_PAGE_UP "scroll the sidebar up 1 page" +OP_SIDEBAR_PREV "move the highlight to previous mailbox" +OP_SIDEBAR_PREV_NEW "move the highlight to previous mailbox with new mail" +OP_SIDEBAR_TOGGLE_VISIBLE "make the sidebar (in)visible" diff -r f1f1af650910 -r c62f5cd3c8e4 account.c --- a/account.c Tue May 24 12:08:46 2016 -0700 +++ b/account.c Fri Jul 01 13:39:51 2016 -0700 @@ -39,7 +39,7 @@ return 0; #ifdef USE_IMAP - if (a1->type == M_ACCT_TYPE_IMAP) + if (a1->type == MUTT_ACCT_TYPE_IMAP) { if (ImapUser) user = ImapUser; @@ -47,15 +47,15 @@ #endif #ifdef USE_POP - if (a1->type == M_ACCT_TYPE_POP && PopUser) + if (a1->type == MUTT_ACCT_TYPE_POP && PopUser) user = PopUser; #endif - if (a1->flags & a2->flags & M_ACCT_USER) + if (a1->flags & a2->flags & MUTT_ACCT_USER) return (!strcmp (a1->user, a2->user)); - if (a1->flags & M_ACCT_USER) + if (a1->flags & MUTT_ACCT_USER) return (!strcmp (a1->user, user)); - if (a2->flags & M_ACCT_USER) + if (a2->flags & MUTT_ACCT_USER) return (!strcmp (a2->user, user)); return 1; @@ -73,17 +73,17 @@ if (url->user) { strfcpy (account->user, url->user, sizeof (account->user)); - account->flags |= M_ACCT_USER; + account->flags |= MUTT_ACCT_USER; } if (url->pass) { strfcpy (account->pass, url->pass, sizeof (account->pass)); - account->flags |= M_ACCT_PASS; + account->flags |= MUTT_ACCT_PASS; } if (url->port) { account->port = url->port; - account->flags |= M_ACCT_PORT; + account->flags |= MUTT_ACCT_PORT; } return 0; @@ -101,9 +101,9 @@ url->port = 0; #ifdef USE_IMAP - if (account->type == M_ACCT_TYPE_IMAP) + if (account->type == MUTT_ACCT_TYPE_IMAP) { - if (account->flags & M_ACCT_SSL) + if (account->flags & MUTT_ACCT_SSL) url->scheme = U_IMAPS; else url->scheme = U_IMAP; @@ -111,9 +111,9 @@ #endif #ifdef USE_POP - if (account->type == M_ACCT_TYPE_POP) + if (account->type == MUTT_ACCT_TYPE_POP) { - if (account->flags & M_ACCT_SSL) + if (account->flags & MUTT_ACCT_SSL) url->scheme = U_POPS; else url->scheme = U_POP; @@ -121,9 +121,9 @@ #endif #ifdef USE_SMTP - if (account->type == M_ACCT_TYPE_SMTP) + if (account->type == MUTT_ACCT_TYPE_SMTP) { - if (account->flags & M_ACCT_SSL) + if (account->flags & MUTT_ACCT_SSL) url->scheme = U_SMTPS; else url->scheme = U_SMTP; @@ -131,11 +131,11 @@ #endif url->host = account->host; - if (account->flags & M_ACCT_PORT) + if (account->flags & MUTT_ACCT_PORT) url->port = account->port; - if (account->flags & M_ACCT_USER) + if (account->flags & MUTT_ACCT_USER) url->user = account->user; - if (account->flags & M_ACCT_PASS) + if (account->flags & MUTT_ACCT_PASS) url->pass = account->pass; } @@ -145,14 +145,14 @@ char prompt[SHORT_STRING]; /* already set */ - if (account->flags & M_ACCT_USER) + if (account->flags & MUTT_ACCT_USER) return 0; #ifdef USE_IMAP - else if ((account->type == M_ACCT_TYPE_IMAP) && ImapUser) + else if ((account->type == MUTT_ACCT_TYPE_IMAP) && ImapUser) strfcpy (account->user, ImapUser, sizeof (account->user)); #endif #ifdef USE_POP - else if ((account->type == M_ACCT_TYPE_POP) && PopUser) + else if ((account->type == MUTT_ACCT_TYPE_POP) && PopUser) strfcpy (account->user, PopUser, sizeof (account->user)); #endif else if (option (OPTNOCURSES)) @@ -166,7 +166,7 @@ return -1; } - account->flags |= M_ACCT_USER; + account->flags |= MUTT_ACCT_USER; return 0; } @@ -174,26 +174,26 @@ int mutt_account_getlogin (ACCOUNT* account) { /* already set */ - if (account->flags & M_ACCT_LOGIN) + if (account->flags & MUTT_ACCT_LOGIN) return 0; #ifdef USE_IMAP - else if (account->type == M_ACCT_TYPE_IMAP) + else if (account->type == MUTT_ACCT_TYPE_IMAP) { if (ImapLogin) { strfcpy (account->login, ImapLogin, sizeof (account->login)); - account->flags |= M_ACCT_LOGIN; + account->flags |= MUTT_ACCT_LOGIN; } } #endif - if (!(account->flags & M_ACCT_LOGIN)) + if (!(account->flags & MUTT_ACCT_LOGIN)) { mutt_account_getuser (account); strfcpy (account->login, account->user, sizeof (account->login)); } - account->flags |= M_ACCT_LOGIN; + account->flags |= MUTT_ACCT_LOGIN; return 0; } @@ -203,18 +203,18 @@ { char prompt[SHORT_STRING]; - if (account->flags & M_ACCT_PASS) + if (account->flags & MUTT_ACCT_PASS) return 0; #ifdef USE_IMAP - else if ((account->type == M_ACCT_TYPE_IMAP) && ImapPass) + else if ((account->type == MUTT_ACCT_TYPE_IMAP) && ImapPass) strfcpy (account->pass, ImapPass, sizeof (account->pass)); #endif #ifdef USE_POP - else if ((account->type == M_ACCT_TYPE_POP) && PopPass) + else if ((account->type == MUTT_ACCT_TYPE_POP) && PopPass) strfcpy (account->pass, PopPass, sizeof (account->pass)); #endif #ifdef USE_SMTP - else if ((account->type == M_ACCT_TYPE_SMTP) && SmtpPass) + else if ((account->type == MUTT_ACCT_TYPE_SMTP) && SmtpPass) strfcpy (account->pass, SmtpPass, sizeof (account->pass)); #endif else if (option (OPTNOCURSES)) @@ -222,19 +222,19 @@ else { snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "), - account->flags & M_ACCT_LOGIN ? account->login : account->user, + account->flags & MUTT_ACCT_LOGIN ? account->login : account->user, account->host); account->pass[0] = '\0'; if (mutt_get_password (prompt, account->pass, sizeof (account->pass))) return -1; } - account->flags |= M_ACCT_PASS; + account->flags |= MUTT_ACCT_PASS; return 0; } void mutt_account_unsetpass (ACCOUNT* account) { - account->flags &= ~M_ACCT_PASS; + account->flags &= ~MUTT_ACCT_PASS; } diff -r f1f1af650910 -r c62f5cd3c8e4 account.h --- a/account.h Tue May 24 12:08:46 2016 -0700 +++ b/account.h Fri Jul 01 13:39:51 2016 -0700 @@ -26,18 +26,18 @@ /* account types */ enum { - M_ACCT_TYPE_NONE = 0, - M_ACCT_TYPE_IMAP, - M_ACCT_TYPE_POP, - M_ACCT_TYPE_SMTP + MUTT_ACCT_TYPE_NONE = 0, + MUTT_ACCT_TYPE_IMAP, + MUTT_ACCT_TYPE_POP, + MUTT_ACCT_TYPE_SMTP }; /* account flags */ -#define M_ACCT_PORT (1<<0) -#define M_ACCT_USER (1<<1) -#define M_ACCT_LOGIN (1<<2) -#define M_ACCT_PASS (1<<3) -#define M_ACCT_SSL (1<<4) +#define MUTT_ACCT_PORT (1<<0) +#define MUTT_ACCT_USER (1<<1) +#define MUTT_ACCT_LOGIN (1<<2) +#define MUTT_ACCT_PASS (1<<3) +#define MUTT_ACCT_SSL (1<<4) typedef struct { diff -r f1f1af650910 -r c62f5cd3c8e4 addrbook.c --- a/addrbook.c Tue May 24 12:08:46 2016 -0700 +++ b/addrbook.c Fri Jul 01 13:39:51 2016 -0700 @@ -43,7 +43,7 @@ }; static const char * -alias_format_str (char *dest, size_t destlen, size_t col, char op, const char *src, +alias_format_str (char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *fmt, const char *ifstring, const char *elsestring, unsigned long data, format_flag flags) { @@ -80,7 +80,7 @@ static void alias_entry (char *s, size_t slen, MUTTMENU *m, int num) { - mutt_FormatString (s, slen, 0, NONULL (AliasFmt), alias_format_str, (unsigned long) ((ALIAS **) m->data)[num], M_FORMAT_ARROWCURSOR); + mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL (AliasFmt), alias_format_str, (unsigned long) ((ALIAS **) m->data)[num], MUTT_FORMAT_ARROWCURSOR); } static int alias_tag (MUTTMENU *menu, int n, int m) diff -r f1f1af650910 -r c62f5cd3c8e4 alias.c --- a/alias.c Tue May 24 12:08:46 2016 -0700 +++ b/alias.c Fri Jul 01 13:39:51 2016 -0700 @@ -269,9 +269,9 @@ if (mutt_check_alias_name (buf, fixed, sizeof (fixed))) { - switch (mutt_yesorno (_("Warning: This alias name may not work. Fix it?"), M_YES)) + switch (mutt_yesorno (_("Warning: This alias name may not work. Fix it?"), MUTT_YES)) { - case M_YES: + case MUTT_YES: strfcpy (buf, fixed, sizeof (buf)); goto retry_name; case -1: @@ -326,7 +326,7 @@ buf[0] = 0; rfc822_write_address (buf, sizeof (buf), new->addr, 1); snprintf (prompt, sizeof (prompt), _("[%s = %s] Accept?"), new->name, buf); - if (mutt_yesorno (prompt, M_YES) != M_YES) + if (mutt_yesorno (prompt, MUTT_YES) != MUTT_YES) { mutt_free_alias (&new); return; @@ -344,7 +344,7 @@ Aliases = new; strfcpy (buf, NONULL (AliasFile), sizeof (buf)); - if (mutt_get_field (_("Save to file: "), buf, sizeof (buf), M_FILE) != 0) + if (mutt_get_field (_("Save to file: "), buf, sizeof (buf), MUTT_FILE) != 0) return; mutt_expand_path (buf, sizeof (buf)); if ((rc = fopen (buf, "a+"))) @@ -423,6 +423,8 @@ { if (dry) return -1; + if (l == (size_t)(-1)) + memset (&mb, 0, sizeof (mbstate_t)); *dest++ = '_'; rv = -1; } diff -r f1f1af650910 -r c62f5cd3c8e4 attach.c --- a/attach.c Tue May 24 12:08:46 2016 -0700 +++ b/attach.c Fri Jul 01 13:39:51 2016 -0700 @@ -94,7 +94,7 @@ int rc = 0; snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); - if (rfc1524_mailcap_lookup (a, type, entry, M_COMPOSE)) + if (rfc1524_mailcap_lookup (a, type, entry, MUTT_COMPOSE)) { if (entry->composecommand || entry->composetypecommand) { @@ -110,7 +110,7 @@ a->filename, newfile)); if (safe_symlink (a->filename, newfile) == -1) { - if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES) != M_YES) + if (mutt_yesorno (_("Can't match nametemplate, continue?"), MUTT_YES) != MUTT_YES) goto bailout; } else @@ -229,7 +229,7 @@ int rc = 0; snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); - if (rfc1524_mailcap_lookup (a, type, entry, M_EDIT)) + if (rfc1524_mailcap_lookup (a, type, entry, MUTT_EDIT)) { if (entry->editcommand) { @@ -242,7 +242,7 @@ a->filename, newfile)); if (safe_symlink (a->filename, newfile) == -1) { - if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES) != M_YES) + if (mutt_yesorno (_("Can't match nametemplate, continue?"), MUTT_YES) != MUTT_YES) goto bailout; } else @@ -350,8 +350,8 @@ if (WithCrypto && is_message && a->hdr && (a->hdr->security & ENCRYPT) && !crypt_valid_passphrase(a->hdr->security)) return (rc); - use_mailcap = (flag == M_MAILCAP || - (flag == M_REGULAR && mutt_needs_mailcap (a))); + use_mailcap = (flag == MUTT_MAILCAP || + (flag == MUTT_REGULAR && mutt_needs_mailcap (a))); snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); if (use_mailcap) @@ -359,12 +359,12 @@ entry = rfc1524_new_entry (); if (!rfc1524_mailcap_lookup (a, type, entry, 0)) { - if (flag == M_REGULAR) + if (flag == MUTT_REGULAR) { /* fallback to view as text */ rfc1524_free_entry (&entry); mutt_error _("No matching mailcap entry found. Viewing as text."); - flag = M_AS_TEXT; + flag = MUTT_AS_TEXT; use_mailcap = 0; } else @@ -397,7 +397,7 @@ /* send case: the file is already there */ if (safe_symlink (a->filename, tempfile) == -1) { - if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES) == M_YES) + if (mutt_yesorno (_("Can't match nametemplate, continue?"), MUTT_YES) == MUTT_YES) strfcpy (tempfile, a->filename, sizeof (tempfile)); else goto return_error; @@ -502,7 +502,7 @@ { /* Don't use mailcap; the attachment is viewed in the pager */ - if (flag == M_AS_TEXT) + if (flag == MUTT_AS_TEXT) { /* just let me see the raw data */ if (fp) @@ -524,7 +524,7 @@ goto return_error; } decode_state.fpin = fp; - decode_state.flags = M_CHARCONV; + decode_state.flags = MUTT_CHARCONV; mutt_decode_attachment(a, &decode_state); if (fclose(decode_state.fpout) == EOF) dprint(1, (debugfile, "mutt_view_attachment:%d fclose errno=%d %s\n", __LINE__, pagerfile, errno, strerror(errno))); @@ -544,7 +544,7 @@ /* Use built-in handler */ set_option (OPTVIEWATTACH); /* disable the "use 'v' to view this part" * message in case of error */ - if (mutt_decode_save_attachment (fp, a, pagerfile, M_DISPLAY, 0)) + if (mutt_decode_save_attachment (fp, a, pagerfile, MUTT_DISPLAY, 0)) { unset_option (OPTVIEWATTACH); goto return_error; @@ -576,7 +576,7 @@ info.hdr = hdr; rc = mutt_do_pager (descrip, pagerfile, - M_PAGER_ATTACHMENT | (is_message ? M_PAGER_MESSAGE : 0), &info); + MUTT_PAGER_ATTACHMENT | (is_message ? MUTT_PAGER_MESSAGE : 0), &info); *pagerfile = '\0'; } else @@ -691,9 +691,9 @@ static FILE * mutt_save_attachment_open (char *path, int flags) { - if (flags == M_SAVE_APPEND) + if (flags == MUTT_SAVE_APPEND) return fopen (path, "a"); - if (flags == M_SAVE_OVERWRITE) + if (flags == MUTT_SAVE_OVERWRITE) return fopen (path, "w"); /* __FOPEN_CHECKED__ */ return safe_fopen (path, "w"); @@ -729,23 +729,23 @@ fseeko (fp, m->offset, 0); if (fgets (buf, sizeof (buf), fp) == NULL) return -1; - if (mx_open_mailbox(path, M_APPEND | M_QUIET, &ctx) == NULL) + if (mx_open_mailbox(path, MUTT_APPEND | MUTT_QUIET, &ctx) == NULL) return -1; - if ((msg = mx_open_new_message (&ctx, hn, is_from (buf, NULL, 0, NULL) ? 0 : M_ADD_FROM)) == NULL) + if ((msg = mx_open_new_message (&ctx, hn, is_from (buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM)) == NULL) { mx_close_mailbox(&ctx, NULL); return -1; } - if (ctx.magic == M_MBOX || ctx.magic == M_MMDF) + if (ctx.magic == MUTT_MBOX || ctx.magic == MUTT_MMDF) chflags = CH_FROM | CH_UPDATE_LEN; - chflags |= (ctx.magic == M_MAILDIR ? CH_NOSTATUS : CH_UPDATE); + chflags |= (ctx.magic == MUTT_MAILDIR ? CH_NOSTATUS : CH_UPDATE); if (_mutt_copy_message (msg->fp, fp, hn, hn->content, 0, chflags) == 0 && mx_commit_message (msg, &ctx) == 0) r = 0; else r = -1; - mx_close_message (&msg); + mx_close_message (&ctx, &msg); mx_close_mailbox (&ctx, NULL); return r; } @@ -818,9 +818,9 @@ memset (&s, 0, sizeof (s)); s.flags = displaying; - if (flags == M_SAVE_APPEND) + if (flags == MUTT_SAVE_APPEND) s.fpout = fopen (path, "a"); - else if (flags == M_SAVE_OVERWRITE) + else if (flags == MUTT_SAVE_OVERWRITE) s.fpout = fopen (path, "w"); /* __FOPEN_CHECKED__ */ else s.fpout = safe_fopen (path, "w"); @@ -861,12 +861,12 @@ mutt_parse_part (s.fpin, m); if (m->noconv || is_multipart (m)) - s.flags |= M_CHARCONV; + s.flags |= MUTT_CHARCONV; } else { s.fpin = fp; - s.flags |= M_CHARCONV; + s.flags |= MUTT_CHARCONV; } mutt_body_handler (m, &s); @@ -905,7 +905,7 @@ snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); - if (rfc1524_mailcap_lookup (a, type, NULL, M_PRINT)) + if (rfc1524_mailcap_lookup (a, type, NULL, MUTT_PRINT)) { char command[_POSIX_PATH_MAX+STRING]; rfc1524_entry *entry; @@ -914,7 +914,7 @@ dprint (2, (debugfile, "Using mailcap...\n")); entry = rfc1524_new_entry (); - rfc1524_mailcap_lookup (a, type, entry, M_PRINT); + rfc1524_mailcap_lookup (a, type, entry, MUTT_PRINT); if (rfc1524_expand_filename (entry->nametemplate, a->filename, newfile, sizeof (newfile))) { @@ -922,7 +922,7 @@ { if (safe_symlink(a->filename, newfile) == -1) { - if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES) != M_YES) + if (mutt_yesorno (_("Can't match nametemplate, continue?"), MUTT_YES) != MUTT_YES) { rfc1524_free_entry (&entry); return 0; @@ -996,7 +996,7 @@ fpout = NULL; mutt_mktemp (newfile, sizeof (newfile)); - if (mutt_decode_save_attachment (fp, a, newfile, M_PRINTING, 0) == 0) + if (mutt_decode_save_attachment (fp, a, newfile, MUTT_PRINTING, 0) == 0) { dprint (2, (debugfile, "successfully decoded %s type attachment to %s\n", diff -r f1f1af650910 -r c62f5cd3c8e4 browser.c --- a/browser.c Tue May 24 12:08:46 2016 -0700 +++ b/browser.c Fri Jul 01 13:39:51 2016 -0700 @@ -68,7 +68,6 @@ { FREE (&((state->entry)[c].name)); FREE (&((state->entry)[c].desc)); - FREE (&((state->entry)[c].st)); } #ifdef USE_IMAP FREE (&state->folder); @@ -142,7 +141,7 @@ } static const char * -folder_format_str (char *dest, size_t destlen, size_t col, char op, const char *src, +folder_format_str (char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *fmt, const char *ifstring, const char *elsestring, unsigned long data, format_flag flags) { @@ -152,7 +151,7 @@ FOLDER *folder = (FOLDER *) data; struct passwd *pw; struct group *gr; - int optional = (flags & M_FORMAT_OPTIONAL); + int optional = (flags & MUTT_FORMAT_OPTIONAL); switch (op) { @@ -163,7 +162,7 @@ case 'd': case 'D': - if (folder->ff->st != NULL) + if (folder->ff->local) { int do_locales = TRUE; @@ -175,13 +174,13 @@ } } else { tnow = time (NULL); - t_fmt = tnow - folder->ff->st->st_mtime < 31536000 ? "%b %d %H:%M" : "%b %d %Y"; + t_fmt = tnow - folder->ff->mtime < 31536000 ? "%b %d %H:%M" : "%b %d %Y"; } if (do_locales) setlocale(LC_TIME, NONULL (Locale)); /* use environment if $locale is not set */ else setlocale(LC_TIME, "C"); - strftime (date, sizeof (date), t_fmt, localtime (&folder->ff->st->st_mtime)); + strftime (date, sizeof (date), t_fmt, localtime (&folder->ff->mtime)); mutt_format_s (dest, destlen, fmt, date); } @@ -200,27 +199,27 @@ s = NONULL (folder->ff->name); snprintf (fn, sizeof (fn), "%s%s", s, - folder->ff->st ? (S_ISLNK (folder->ff->st->st_mode) ? "@" : - (S_ISDIR (folder->ff->st->st_mode) ? "/" : - ((folder->ff->st->st_mode & S_IXUSR) != 0 ? "*" : ""))) : ""); + folder->ff->local ? (S_ISLNK (folder->ff->mode) ? "@" : + (S_ISDIR (folder->ff->mode) ? "/" : + ((folder->ff->mode & S_IXUSR) != 0 ? "*" : ""))) : ""); mutt_format_s (dest, destlen, fmt, fn); break; } case 'F': - if (folder->ff->st != NULL) + if (folder->ff->local) { snprintf (permission, sizeof (permission), "%c%c%c%c%c%c%c%c%c%c", - S_ISDIR(folder->ff->st->st_mode) ? 'd' : (S_ISLNK(folder->ff->st->st_mode) ? 'l' : '-'), - (folder->ff->st->st_mode & S_IRUSR) != 0 ? 'r': '-', - (folder->ff->st->st_mode & S_IWUSR) != 0 ? 'w' : '-', - (folder->ff->st->st_mode & S_ISUID) != 0 ? 's' : (folder->ff->st->st_mode & S_IXUSR) != 0 ? 'x': '-', - (folder->ff->st->st_mode & S_IRGRP) != 0 ? 'r' : '-', - (folder->ff->st->st_mode & S_IWGRP) != 0 ? 'w' : '-', - (folder->ff->st->st_mode & S_ISGID) != 0 ? 's' : (folder->ff->st->st_mode & S_IXGRP) != 0 ? 'x': '-', - (folder->ff->st->st_mode & S_IROTH) != 0 ? 'r' : '-', - (folder->ff->st->st_mode & S_IWOTH) != 0 ? 'w' : '-', - (folder->ff->st->st_mode & S_ISVTX) != 0 ? 't' : (folder->ff->st->st_mode & S_IXOTH) != 0 ? 'x': '-'); + S_ISDIR(folder->ff->mode) ? 'd' : (S_ISLNK(folder->ff->mode) ? 'l' : '-'), + (folder->ff->mode & S_IRUSR) != 0 ? 'r': '-', + (folder->ff->mode & S_IWUSR) != 0 ? 'w' : '-', + (folder->ff->mode & S_ISUID) != 0 ? 's' : (folder->ff->mode & S_IXUSR) != 0 ? 'x': '-', + (folder->ff->mode & S_IRGRP) != 0 ? 'r' : '-', + (folder->ff->mode & S_IWGRP) != 0 ? 'w' : '-', + (folder->ff->mode & S_ISGID) != 0 ? 's' : (folder->ff->mode & S_IXGRP) != 0 ? 'x': '-', + (folder->ff->mode & S_IROTH) != 0 ? 'r' : '-', + (folder->ff->mode & S_IWOTH) != 0 ? 'w' : '-', + (folder->ff->mode & S_ISVTX) != 0 ? 't' : (folder->ff->mode & S_IXOTH) != 0 ? 'x': '-'); mutt_format_s (dest, destlen, fmt, permission); } #ifdef USE_IMAP @@ -237,14 +236,14 @@ break; case 'g': - if (folder->ff->st != NULL) + if (folder->ff->local) { - if ((gr = getgrgid (folder->ff->st->st_gid))) + if ((gr = getgrgid (folder->ff->gid))) mutt_format_s (dest, destlen, fmt, gr->gr_name); else { snprintf (tmp, sizeof (tmp), "%%%sld", fmt); - snprintf (dest, destlen, tmp, folder->ff->st->st_gid); + snprintf (dest, destlen, tmp, folder->ff->gid); } } else @@ -252,10 +251,10 @@ break; case 'l': - if (folder->ff->st != NULL) + if (folder->ff->local) { snprintf (tmp, sizeof (tmp), "%%%sd", fmt); - snprintf (dest, destlen, tmp, folder->ff->st->st_nlink); + snprintf (dest, destlen, tmp, folder->ff->nlink); } else mutt_format_s (dest, destlen, fmt, ""); @@ -280,9 +279,9 @@ break; case 's': - if (folder->ff->st != NULL) + if (folder->ff->local) { - mutt_pretty_size(fn, sizeof(fn), folder->ff->st->st_size); + mutt_pretty_size(fn, sizeof(fn), folder->ff->size); snprintf (tmp, sizeof (tmp), "%%%ss", fmt); snprintf (dest, destlen, tmp, fn); } @@ -296,14 +295,14 @@ break; case 'u': - if (folder->ff->st != NULL) + if (folder->ff->local) { - if ((pw = getpwuid (folder->ff->st->st_uid))) + if ((pw = getpwuid (folder->ff->uid))) mutt_format_s (dest, destlen, fmt, pw->pw_name); else { snprintf (tmp, sizeof (tmp), "%%%sld", fmt); - snprintf (dest, destlen, tmp, folder->ff->st->st_uid); + snprintf (dest, destlen, tmp, folder->ff->uid); } } else @@ -317,9 +316,9 @@ } if (optional) - mutt_FormatString (dest, destlen, col, ifstring, folder_format_str, data, 0); - else if (flags & M_FORMAT_OPTIONAL) - mutt_FormatString (dest, destlen, col, elsestring, folder_format_str, data, 0); + mutt_FormatString (dest, destlen, col, cols, ifstring, folder_format_str, data, 0); + else if (flags & MUTT_FORMAT_OPTIONAL) + mutt_FormatString (dest, destlen, col, cols, elsestring, folder_format_str, data, 0); return (src); } @@ -343,10 +342,14 @@ (state->entry)[state->entrylen].mode = s->st_mode; (state->entry)[state->entrylen].mtime = s->st_mtime; (state->entry)[state->entrylen].size = s->st_size; + (state->entry)[state->entrylen].gid = s->st_gid; + (state->entry)[state->entrylen].uid = s->st_uid; + (state->entry)[state->entrylen].nlink = s->st_nlink; - (state->entry)[state->entrylen].st = safe_malloc (sizeof (struct stat)); - memcpy ((state->entry)[state->entrylen].st, s, sizeof (struct stat)); + (state->entry)[state->entrylen].local = 1; } + else + (state->entry)[state->entrylen].local = 0; (state->entry)[state->entrylen].new = new; (state->entry)[state->entrylen].name = safe_strdup (name); @@ -515,8 +518,8 @@ folder.ff = &((struct folder_file *) menu->data)[num]; folder.num = num; - mutt_FormatString (s, slen, 0, NONULL(FolderFormat), folder_format_str, - (unsigned long) &folder, M_FORMAT_ARROWCURSOR); + mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL(FolderFormat), folder_format_str, + (unsigned long) &folder, MUTT_FORMAT_ARROWCURSOR); } static void init_menu (struct browser_state *state, MUTTMENU *menu, char *title, @@ -579,9 +582,9 @@ MUTTMENU *menu; struct stat st; int i, killPrefix = 0; - int multiple = (flags & M_SEL_MULTI) ? 1 : 0; - int folder = (flags & M_SEL_FOLDER) ? 1 : 0; - int buffy = (flags & M_SEL_BUFFY) ? 1 : 0; + int multiple = (flags & MUTT_SEL_MULTI) ? 1 : 0; + int folder = (flags & MUTT_SEL_FOLDER) ? 1 : 0; + int buffy = (flags & MUTT_SEL_BUFFY) ? 1 : 0; buffy = buffy && folder; @@ -964,7 +967,7 @@ } snprintf (msg, sizeof (msg), _("Really delete mailbox \"%s\"?"), mx.mbox); - if (mutt_yesorno (msg, M_NO) == M_YES) + if (mutt_yesorno (msg, MUTT_NO) == MUTT_YES) { if (!imap_delete_mailbox (Context, mx)) { @@ -1001,7 +1004,7 @@ buf[len]='/'; } - if (mutt_get_field (_("Chdir to: "), buf, sizeof (buf), M_FILE) == 0 && + if (mutt_get_field (_("Chdir to: "), buf, sizeof (buf), MUTT_FILE) == 0 && buf[0]) { buffy = 0; @@ -1205,7 +1208,7 @@ case OP_BROWSER_NEW_FILE: snprintf (buf, sizeof (buf), "%s/", LastDir); - if (mutt_get_field (_("New file name: "), buf, sizeof (buf), M_FILE) == 0) + if (mutt_get_field (_("New file name: "), buf, sizeof (buf), MUTT_FILE) == 0) { strfcpy (f, buf, flen); destroy_state (&state); @@ -1248,7 +1251,7 @@ b = mutt_make_file_attach (buf); if (b != NULL) { - mutt_view_attachment (NULL, b, M_REGULAR, NULL, NULL, 0); + mutt_view_attachment (NULL, b, MUTT_REGULAR, NULL, NULL, 0); mutt_free_body (&b); menu->redraw = REDRAW_FULL; } diff -r f1f1af650910 -r c62f5cd3c8e4 browser.h --- a/browser.h Tue May 24 12:08:46 2016 -0700 +++ b/browser.h Fri Jul 01 13:39:51 2016 -0700 @@ -24,7 +24,9 @@ mode_t mode; off_t size; time_t mtime; - struct stat *st; + uid_t uid; + gid_t gid; + nlink_t nlink; char *name; char *desc; @@ -37,6 +39,7 @@ unsigned selectable : 1; unsigned inferiors : 1; #endif + unsigned local : 1; /* folder is on local filesystem */ unsigned tagged : 1; }; diff -r f1f1af650910 -r c62f5cd3c8e4 buffy.c --- a/buffy.c Tue May 24 12:08:46 2016 -0700 +++ b/buffy.c Fri Jul 01 13:39:51 2016 -0700 @@ -27,6 +27,10 @@ #include "mutt_curses.h" +#ifdef USE_SIDEBAR +#include "sidebar.h" +#endif + #ifdef USE_IMAP #include "imap.h" #endif @@ -41,6 +45,7 @@ #include <stdio.h> static time_t BuffyTime = 0; /* last time we started checking for mail */ +static time_t BuffyStatsTime = 0; /* last time we check performed mail_check_stats */ time_t BuffyDoneTime = 0; /* last time we knew for sure how much mail there was. */ static short BuffyCount = 0; /* how many boxes with new mail */ static short BuffyNotify = 0; /* # of unnotified new boxes */ @@ -124,7 +129,7 @@ typ = mx_get_magic (path); - if (typ != M_MBOX && typ != M_MMDF) + if (typ != MUTT_MBOX && typ != MUTT_MMDF) return 0; if ((f = fopen (path, "rb"))) @@ -196,9 +201,13 @@ static BUFFY *buffy_new (const char *path) { BUFFY* buffy; + char rp[PATH_MAX] = ""; + char *r = NULL; buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY)); strfcpy (buffy->path, path, sizeof (buffy->path)); + r = realpath (path, rp); + strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath)); buffy->next = NULL; buffy->magic = 0; @@ -215,19 +224,22 @@ BUFFY **tmp,*tmp1; char buf[_POSIX_PATH_MAX]; struct stat sb; - char f1[PATH_MAX], f2[PATH_MAX]; - char *p, *q; + char f1[PATH_MAX]; + char *p; while (MoreArgs (s)) { mutt_extract_token (path, s, 0); strfcpy (buf, path->data, sizeof (buf)); - if(data == M_UNMAILBOXES && mutt_strcmp(buf,"*") == 0) + if(data == MUTT_UNMAILBOXES && mutt_strcmp(buf,"*") == 0) { for (tmp = &Incoming; *tmp;) { tmp1=(*tmp)->next; +#ifdef USE_SIDEBAR + mutt_sb_notify_mailbox (*tmp, 0); +#endif buffy_free (tmp); *tmp=tmp1; } @@ -243,27 +255,33 @@ p = realpath (buf, f1); for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next)) { - q = realpath ((*tmp)->path, f2); - if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0) + if (mutt_strcmp (p ? p : buf, (*tmp)->realpath) == 0) { dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path)); break; } } - if(data == M_UNMAILBOXES) + if(data == MUTT_UNMAILBOXES) { if(*tmp) { tmp1=(*tmp)->next; +#ifdef USE_SIDEBAR + mutt_sb_notify_mailbox (*tmp, 0); +#endif buffy_free (tmp); *tmp=tmp1; } continue; } - if (!*tmp)