Mehdi Abaakouk [Mon, 20 Feb 2017 19:49:23 +0000 (20:49 +0100)]
Add IMAP keywords support
This change introduces IMAP keyword support.
* index_format gets %g, %G, %J and %Gx to display them
* pattern gets g to search/match imap keywords
* colors.c gets index_tag/index_tags to color them
* OPS gets modify-labels to edit them
* tag-transforms/tag-formats/hidden_tags can be display them in more sexy manner
Most of the code is shared with the notmuch backend.
Richard Russon [Mon, 2 Oct 2017 12:01:56 +0000 (13:01 +0100)]
merge: upstream fixes (mutt/default)
* Fix uses of context->changed as a counter.
* Make cmd_parse_fetch() more precise about setting reopen/check flags.
* Enable $reply_self for group-reply, even with $metoo unset.
Enable $reply_self for group-reply, even with $metoo unset.
For a (r)eply, the $metoo variable does not have any effect because
there is a single recipient.
However with (g)roup reply, the To was initially set to the sender,
but subsequently removed my $nometoo. The empty To line is then
replaced with the Cc line, resulting in a (logically correct but)
surprising outcome.
Change the behavior such that $nometoo will not strip a single To
recipient when $reply_self is set.
Kevin McCarthy [Wed, 27 Sep 2017 20:45:36 +0000 (13:45 -0700)]
Make cmd_parse_fetch() more precise about setting reopen/check flags.
Previously any FETCH with FLAGS would result in either
idata->reopen |= IMAP_EXPUNGE_PENDING;
-or-
idata->check_status = IMAP_FLAGS_PENDING;
being set.
This is unnecessary in the case of responses to FLAGS.SILENT updates
sent by mutt (which seem to commonly happen now-a-days).
Change imap_set_flags() to compare the old server flags against the
new ones, and report when _those_ updates would/did result in a local
header flag change. Only set one of the reopen/check_status flags in
the event of an actual change (or potential change if a local change
has been made to the header.)
Kevin McCarthy [Wed, 27 Sep 2017 02:44:11 +0000 (19:44 -0700)]
Fix uses of context->changed as a counter.
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.
Richard Russon [Tue, 26 Sep 2017 23:17:56 +0000 (00:17 +0100)]
merge: rename mutt to neomutt
* rename man pages
* move helper programs to lib dir
* move mime.types to doc dir
* contrib: change mutt references to neomutt
* build: don't install .dist files
Richard Russon [Tue, 26 Sep 2017 14:20:38 +0000 (15:20 +0100)]
merge: upstream fixes (mutt/default)
* clang-format
* Display an error message when delete mailbox fails. (see #3968)
* Updated French translation.
* Fix imap sync segfault due to inactive headers during an expunge. (closes #3971)
* Close the imap socket for the selected mailbox on error.
* Add missing IMAP_CMD_POLL flag in imap buffy check.
* Change maildir and mh check_mailbox to use dynamic sized hash. (closes #3973)
Kevin McCarthy [Tue, 26 Sep 2017 01:40:32 +0000 (18:40 -0700)]
Change maildir and mh check_mailbox to use dynamic sized hash. (closes #3973)
The original patch is by Matt Fleming, originally posted at
http://www.codeblueprint.co.uk/2017/01/15/a-kernel-devs-approach-to-improving2
The comments there indicate Matt tried to submit to trac and mutt-dev,
but ran into registration problems. Thank you for the patch, and
sorry for those problems, Matt.
I modified the patch by making the same change to the
mh_check_mailbox() code too.
Kevin McCarthy [Fri, 22 Sep 2017 18:12:25 +0000 (11:12 -0700)]
Close the imap socket for the selected mailbox on error.
The new $imap_poll_timeout calls the cmd_handle_fatal() error handler
on timeout, which is supposed to close and cleanup.
However, for the currently selected mailbox, the error handler was not
closing the socket after closing up the mailbox. This left extra
SSL/GnuTLS data around and was causing errors on an attempt to
reconnect.
Kevin McCarthy [Fri, 22 Sep 2017 18:07:27 +0000 (11:07 -0700)]
Fix imap sync segfault due to inactive headers during an expunge. (closes #3971)
Mutt has several places where it turns off h->active as a hack. For
example to avoid FLAG updates, or to exclude from imap_exec_msgset.
Unfortunately, when a reopen is allowed and the IMAP_EXPUNGE_PENDING
flag becomes set (e.g. a flag update to a modified header),
imap_expunge_mailbox() will be called by imap_cmd_finish().
The mx_update_tables() would free and remove these "inactive" headers,
despite that an EXPUNGE was not received for them. This would result
in memory leaks and segfaults due to dangling pointers in the
msn_index and uid_hash.
There should probably be a more elegant solution, removing the initial
hacks. However, this is causing a segfault, and the best solution
right now is to turn active back on for non-expunged messages in
imap_expunge_mailbox().
Extra thanks to chdiza, who bravely runs tip and found this issue
quickly.
Tokenize buffer and expand each token (path) and finally unsubscribe from it.
No pattern matching is done.
* Added subscribe-to command and updated example
* Added `subscribe-to` command (init.h)
* Added `parse_subscribe_to` prototype (init.h)
* Implemented `parse_subscribe_to` uses imap/imap.h Header (init.c)
* Example now shows folder and subfolders
Tokenize buffer and expand each token (path) and finally subscribe from it.
No pattern matching is done.
* Added return check
It should be noted, that imap_subscribe(FOO, 0) /* unsubcribe */
won't return -1, if mailbox doesn't exists.
* Added return -1, and do not silently ignore
* Added braces to satisfy styleguides
* Added better user output
* Typo Successfull -> Successful
* Reverted back to one parameter only and errors into err.
* Reverted back to one parameter only.
* Better error messages
* Error messages are now stored inside struct Buffer *err
* Changed from strfcpy -> mutt_buffer_*
* Copy&Paste Error correction
* Cleanup
* set expandtab
* set tabstop=2
* merged mutt_buffer_addstr -> mutt_buffer_printf
* corrected "Corrupted buffer" -> mutt_debug(5, ...)
* Compared with clang-format to get sure
* Reverted back bool -> int, to change this in a later PR
inside `parse_unsubscribe_from(...)` and `parse_subscribe_to(...)`
for the `imap_subscribe(...)`-call.
Kevin McCarthy [Wed, 13 Sep 2017 22:48:16 +0000 (15:48 -0700)]
Change imap copy/save and trash to sync flags, excluding deleted. (closes #3966) (closes #3860)
imap_copy_messages() uses a helper to sync the flags before performing
a server-side copy. However, it had a bug that the "deleted" flag on
a local message, if set, will be propagated to the copy too.
Change the copy sync helper to ignore the deleted flag. Then, change
the imap trash function to use the same helper.
Thanks to Anton Lindqvist for his excellent bug report, suggested
fixes, and help testing.
Kevin McCarthy [Wed, 13 Sep 2017 22:48:13 +0000 (15:48 -0700)]
Remove \Seen flag setting for imap trash. (see #3966) (see #3860)
Commit 323e3d6e5e4c has a side effect where spurious FETCH flag
updates after setting the \Seen flag can cause a sync to abort.
Remove manually setting \Seen for all trashed message before copying.
The next commit will change the imap trash function to use the same
code as the imap copy/save function for syncing the message before
server-side copying.