Austin Ray [Sat, 3 Aug 2019 20:34:32 +0000 (16:34 -0400)]
notmuch: ensure message_id is correct
The notmuch-backend initializes a provided email struct with content
from notmuch. In rare instances, a provided email struct has a
message_id that does not match the one from notmuch. No validation to
ensure message_ids match is performed.
An issue occurs when running nm_mbox_check(), which stores all messages
in a hash table. The incorrect message_id is the key so our email is
considered missing, reloaded into the mailbox, and a duplicate appears
in the index. This triggers a warning from neomutt regarding external
modification.
Instead, validate the message_ids to ensure a match so our hash table
keys are correct. As a result, a reload is no longer performed and
neomutt's warning need not occur.
Richard Russon [Sat, 20 Jul 2019 22:18:23 +0000 (23:18 +0100)]
merge: light refactoring
* test: sync mutt_extract_token()
* drop Buffer.destroy
* refactor: Mailbox in mutt_display_message()
* pager: reorganised the code
* context: tidy for clarity
* context: add notifications
* notify: use data to match specific callbacks
Richard Russon [Fri, 19 Jul 2019 21:48:51 +0000 (22:48 +0100)]
drop Buffer.destroy
This member controlled whether, when destroyed, a Buffer should delete
its data. The member was only used in a couple of places, so it seems
better to duplicate the data in those cases and *always* destroy it
afterwards.
* change Command to use intptr_t
* Don't read or save history if $history_file isn't set
* Omit User-Agent: header by default
* Remove unnecessary checks for strings
* Convert $header_cache_pagesize to type DT_LONG
Kevin McCarthy [Thu, 27 Jun 2019 18:06:19 +0000 (11:06 -0700)]
Convert $header_cache_pagesize to type DT_LONG
Prior to commit 4bc76c2f there was no LNUM type, and so the workaround
was to store it as a string, converting in the hcache_open_gdbm()
call.
This will not affect the user interface or config file, because DT_NUM
and DT_LNUM read in a string from the config file and convert to a
number. Quotes are used for escaping style, not passed through to the
variable setter.
So essentially this simply moves the conversion to parse_set(), and
provides feedback for a non-numeric type immediately.
Kevin McCarthy [Thu, 27 Jun 2019 22:35:12 +0000 (15:35 -0700)]
Remove unnecessary checks for strings
MuttVars of those types are set via safe_strdup(), which returns NULL
if the original is "". Thus Var implies *Var.
A good portion of the code relies on that axiom, but over the years
some (Var && *Var) checks have crept in, including from me.
This was partially because of the INITVAL("") that were in the code,
which implied (incorrectly) the initial value could be "". Commit 2f91d43e removed those to make it more clear.
This commit removes the *Var checks to make it even clearer, and help
avoid them creeping back in again.
The User-Agent: header can be fun and interesting and useful for
debugging, but it also leaks quite a bit of information about the user
and their software stack.
This represents a potential security risk (attackers can target the
particular stack) and also an anonymity risk (a user trying to
preserve their anonymity by sending mail from a non-associated account
might reveal quite a lot of information if their choice of mail user
agent is exposed).
Users who want to configure `user_agent` to `yes` can still do so, but
it makes sense to have safer defaults.
Prior to this commit, `index_hint` is initialized if `Context && !attach_msg`.
If `query_quadoption(C_Quit, _("Quit NeoMutt?")) == MUTT_YES`,
`!Context || ((check = mx_mbox_close(&Context)) == 0)` is `false` and
`(check == MUTT_NEW_MAIL) || (check == MUTT_REOPENED)` the function `update_index`
is called with parameter `index_hint`.
As one of the condition is `query_quadoption(C_Quit, _("Quit NeoMutt?")) == MUTT_YES`,
the real current position is probably not so important.
If `const void*` points to an instance of type `T`, then it should be
casted to a `const T*` instance.
If `const void*` is a pointer to an instance of type `T`, then the pointer
is `const T*`.
The instance could be `const`, or could be not, but to be on the safe
side, it's casted to `T const *const *`.
In the case of pointer-to-pointer, `const` is on the right to ease
readability; from right to leaft it reads:
A pointer to a const pointer to a const T.