1. 24 Aug, 2018 1 commit
    • Kevin J. McCarthy's avatar
      Display an error message if syncing fails. · fa620776
      Kevin J. McCarthy authored
      Ticket 36 reported an issue where a maildir was removed while the
      mailbox was opened.  Later, attempting to sync displayed the message
      "Writing xxx...", which remained on the screen.  The reporter actually
      thought mutt was frozen, but it was simply that on a sync error Mutt
      wasn't clearing or updating the message window.
      
      There is some error message handling for mbox.c check_mailbox, but I
      don't think that is the right place to further propogate messages.
      Instead, add an error to the same place the initial "Writing..."
      message is created.
      fa620776
  2. 28 Jul, 2018 1 commit
    • Kevin J. McCarthy's avatar
      Fix -z and -Z options to work with IMAP. · 911df435
      Kevin J. McCarthy authored
      -Z did not work if $imap_passive was set (the default).  I think using
      the option implies the desire to open a new connection and check
      buffy at startup, so temporarily turn it off during the buffy.
      
      -z was not hooked up for IMAP.  Change it to call imap_status().  This
      also requires $imap_passive be unset, so temporarily turn the option
      off too.
      911df435
  3. 26 Jul, 2018 2 commits
  4. 18 Jun, 2018 1 commit
    • Kevin J. McCarthy's avatar
      Convert context and buffy to use nanosecond timestamps. · 120f63a9
      Kevin J. McCarthy authored
      The inotify interface has an unfortunate side effect of making Mutt
      react too quickly to new mail.  Sometimes, the mail is only
      half-delivered when the mailbox is checked.  Because Mutt is using the
      stat mtime - seconds resolution - this means it won't realize there
      are more messages delivered during the same second.
      
      Nanosecond resolution fields were standardized in POSIX.1-2008, so
      check for and use those if they are available.
      120f63a9
  5. 10 Nov, 2017 1 commit
  6. 27 Sep, 2017 1 commit
    • Kevin J. McCarthy's avatar
      Fix uses of context->changed as a counter. · 0bcb77a6
      Kevin J. McCarthy authored
      The first was in mx_update_tables(), but only when "not committing".
      This is used by mh/maildir during an "occult" update, and in imap when
      expunging the mailbox.  It meant to simply turn on changed when a
      single changed header is seen.
      
      The second use was in imap_sync_message_for_copy().  Previously this
      was used for a server side copy/save, but is now also used for
      fast-trash copying.  Remove the code that was trying to decrement the
      counter: this function is not capable of properly setting a status
      bit.
      0bcb77a6
  7. 14 Jul, 2017 1 commit
  8. 23 May, 2017 1 commit
    • Kevin J. McCarthy's avatar
      Fix memory leak when closing mailbox and using the sidebar. · 5bd31d1e
      Kevin J. McCarthy authored
      The code updating the sidebar counts decremented the msgcount, but did
      not set it back to the original value.  Which means fastclose was not
      freeing all the headers.
      
      Update the sidebar only when something is deleted, since I don't
      believe it's required otherwise and the code is a bit cleaner that
      way.
      5bd31d1e
  9. 22 May, 2017 1 commit
  10. 05 May, 2017 1 commit
    • Kevin J. McCarthy's avatar
      Fix sidebar count updates when closing mailbox. (closes #3938) · 4b4049c8
      Kevin J. McCarthy authored
      The context unread and flagged counts were being updated too early in
      mx_close_mailbox().  Cancelling at any of the following prompts would
      leave them in an incorrect state.  Additionally, $move could increase
      the delete count (for flagged messages), and $delete, if answered no,
      could turn off message deletion.
      
      Move all the sidebar buffy stat updating to the bottom of the
      function, after all the prompts and processing.
      4b4049c8
  11. 26 Apr, 2017 1 commit
  12. 10 Feb, 2017 1 commit
    • Kevin J. McCarthy's avatar
      Change "allow_dups" into a flag at hash creation. · 43561289
      Kevin J. McCarthy authored
      Instead of having an "allow_dups" parameter for hash_insert(), add a
      flag, MUTT_HASH_ALLOW_DUPS, to hash_create().
      
      Currently ReverseAlias, subj_hash, and thread_hash allow duplicate
      keys.  Change those hashes to pass the flag at creation, and remove
      the last parameter from all callers of hash_insert().
      43561289
  13. 29 Jan, 2017 1 commit
    • Kevin J. McCarthy's avatar
      Improve the label completion hash table usage. · 9ae62494
      Kevin J. McCarthy authored
      Move the hash table inside the Context.  Hook message arrival/deletion
      to update the label hash.
      
      Change the label hash to strdup keys.
      
      Use hash_find_elem when updating the counter, to reduce unnecessary
      add/delete operations.
      9ae62494
  14. 15 Jan, 2017 2 commits
    • Kevin J. McCarthy's avatar
      Improve error handling in mbox magic detection. · 354b88e4
      Kevin J. McCarthy authored
      Thanks to Simon Ruderich for pointing out several small issues with
      the previous commit.
      354b88e4
    • David Champion's avatar
      Allow initial blank lines in local mailboxes. · 4d3e0bc6
      David Champion authored
      Some mailbox-creation tools erroneously append a blank line to a file
      before appending a UNIXv7-format mail message, resulting in mailboxes
      that are intended to be valid "mbox" folders but are not.  Notably old
      versions of Mailman do this, making archive files that cannot be read by
      mutt.
      
      This patch causes mutt to skip leading NLs and CRs when detecting magic.
      4d3e0bc6
  15. 14 Nov, 2016 4 commits
    • Kevin J. McCarthy's avatar
      Create mx_ops.sync operation. Refactor compress to use the mx_ops.sync. · d3705ea8
      Kevin J. McCarthy authored
      Change compress.sync_mailbox() to lock the compressed mailbox around
      both the tempfile sync and compress operations.  This will prevent
      changes made inbetween the two syncs from being overwritten.
      
      Thanks to Damien Riegel for his original patch refactoring
      mx_ops.sync, which this patch is partially based upon.
      d3705ea8
    • Kevin J. McCarthy's avatar
      Compress: fix several logic and memory bugs. · 203c84f9
      Kevin J. McCarthy authored
      setup_paths leaks memory: realpath is already set in mx_open_mailbox()
      
      restore_paths is unneeded.  mx_fastclose_mailbox() will free stuff,
      and nothing is looking at the path once we are closing or aborting.
      
      Make a copy of the hooks.  Otherwise 'unhook *' will leave dangling
      pointers.
      
      Add compress_info freeing inside mx_fastclose_mailbox().  Only free
      inside compress.c when we want to prevent close() from doing anything.
      
      close_mailbox() didn't preserve ctx->path on error.
      
      execute_command() didn't return an error if the mutt_system() command
      failed.
      
      mx_open_mailbox_append() should check mutt_comp_can_append() only for
      the case that the mailbox doesn't exist.  When it exists,
      mx_get_magic() has already looked at the file contents before checking
      for matching open_hooks.
      
      In open_append_mailbox() if no append hook is defined, it should't
      call ci->open() if the mailbox doesn't exist.  It should act just like
      append and create a temporary file.
      
      check_mailbox() needs more work.  For now, at least have it properly
      close the mailbox on error.
      203c84f9
    • Kevin J. McCarthy's avatar
      Compress: prefix external functions with "mutt_" · 56075cc8
      Kevin J. McCarthy authored
      Also, include compress.h in compress.c so the mx_comp_ops doesn't need
      to be redeclared.
      56075cc8
    • Kevin J. McCarthy's avatar
      Compress patch from the neomutt repository. · 9bf6d74e
      Kevin J. McCarthy authored
      With the following changes:
      - po/de.po changes trimmed to just the compress additions.
      
      - Move the sample muttrc to contrib, and add it to the Makefile.am so it is
        distributed.  Remove the sample vimrc.
      
      - Remove extra fluff from manual.
      
      Thanks to Roland Rosenfeld for the original patch, and to the NeoMutt
      team for their work cleaning up the patch.
      9bf6d74e
  16. 08 Nov, 2016 1 commit
    • Kevin J. McCarthy's avatar
      Move mbox close-append logic inside mbox_close_mailbox(). · e9de2043
      Kevin J. McCarthy authored
      The mx_fastclose_mailbox() calls mx_ops->close(), which invokes
      mbox_close_mailbox().
      
      Also, close the ctx->fp inside mbox_close_mailbox().  This way, the
      (to be added) compress logic can call the mx_ops->close() instead of
      "knowing" to close the fp before recompressing.
      
      mx_fastclose_mailbox() will safe_fclose() the fp again, but I'm
      leaving it there just in case I missed a usage of the fp in some other
      part of the code.
      
      Thanks to Damien Riegel for the original patch.
      e9de2043
  17. 21 Sep, 2016 1 commit
    • Kevin J. McCarthy's avatar
      Check for NULL mx_ops in mx.c · 038eacdb
      Kevin J. McCarthy authored
      Eike Rathke reported this happening when in an IMAP index view the
      underlying connection was terminated, ctx->mx_ops was NULL and thus
      accessing ctx->mx_ops->check segfaulted.
      
      Thanks also to Eike Rathke for the initial patch, for which I expanded
      the checks to other functions.
      038eacdb
  18. 03 Aug, 2016 1 commit
  19. 02 Aug, 2016 1 commit
    • Kevin J. McCarthy's avatar
      Use a different flag in mx_open_mailbox_append() when mailbox doesn't exist. · 9ff7dfc1
      Kevin J. McCarthy authored
      The previous commit re-used MUTT_NEWFOLDER, but the meaning of that
      flag is slightly different: it causes mbox to use fopen with mode "w",
      and is used only for the case of a brand-new mktemp-generated mbox.
      
      Setting it for other non-existing mbox files leads to a race condition
      between the stat and the fopen/lock, and so could end up truncating an
      existing mailbox created in-between!
      
      Create a different flag, MUTT_APPENDNEW to notify the open_append()
      functions that the mailbox doesn't exist.  Change maildir and mh to
      check for that flag to create their directory structures.
      9ff7dfc1
  20. 01 Aug, 2016 2 commits
  21. 22 Jul, 2016 1 commit
  22. 21 Jul, 2016 1 commit
  23. 18 Jul, 2016 2 commits
    • Kevin J. McCarthy's avatar
      Add imap-fast-trash patch. · 848dbae2
      Kevin J. McCarthy authored
      This is based on the patch by Paul Miller.
      
      Modifications are:
      
      * Create a new flag, MUTT_TRASH for imap_make_msg_set(), rather than
        use MUTT_EXPIRED.
      
      * Change imap_make_msg_set(MUTT_TRASH) to only look at
        hdrs[n]->deleted && !hdrs[n]->purge, behaving like MUTT_TAG, rather
        than looking at the HEADER_DATA.
      
      * Reimplement imap_fast_trash() based on imap_copy_message().
        It looks the old version was too, but it lacked handling of TRYCREATE
        and also queued the UID COPY but didn't exec it.  (Presumably this
        happened in the subsequent sync).
      
      * Move the Context magic and mx_is_imap() checks outside of
        imap_fast_trash()
      848dbae2
    • Kevin J. McCarthy's avatar
      Add the trash folder patch. · 347c517c
      Kevin J. McCarthy authored
      This is based on the trash folder patch by Cedric Duval.
      Modifications to the original patch are:
      
      * Use a flag called M_PURGE instead of M_APPENDED.  The same flag is
        then used in the following "purge" patch instead of adding a
        different flag.
      
      * Removed the counter in context.  The existing context->deleted
        is all that's needed.
      
      * Removed the "auto unset M_PURGE" when M_DELETED is unset inside
        _mutt_set_flag(), although this is convenient, it easily leads to
        header->purge not being reset in a few situations.
      
      * Reset purge flag along with the deleted flag if $delete is answered
        no.
      
      * Set M_PURGE on an edited message. (edit_one_message())
      
      * Preserve purge flag in mutt_reopen_mailbox()
      
      * Turn off OPTCONFIRMAPPEND when saving to the trash, rather than
        hardcoding it off in mutt_save_confirm().  That way, normal save to the
        folder will respect the option.
      347c517c
  24. 23 Jun, 2016 1 commit
    • Kevin J. McCarthy's avatar
      Change sidebar to consistently use realpath for context and buffy comparison. · 149eb79e
      Kevin J. McCarthy authored
      The original sidebar patch contained a half-implemented attempt to use
      realpath() mailbox paths for comparison.  (Presumably so the open mailbox
      remains highlighted despite symlink issues).
      
      Add realpath to the Context, and set it when opening a mailbox.
      Remove sidebar ifdef for the buffy member, and always set it there too.
      
      Change the sidebar to use the realpath for comparison everywhere.
      
      mutt_buffy_check() is using stat device and inode for comparison.
      Perhaps this can be changed to use realpath instead, but that's beyond
      the scope of this patch.
      149eb79e
  25. 18 Jun, 2016 9 commits