Uses url_pct_encode to do the encoding. Note that url_pct_encode now
also encodes the ampersand, which shouldn't cause problems given that
it's only used for usernames and passwords otherwise.
Jenya Sovetkin [Thu, 3 Aug 2017 08:17:30 +0000 (10:17 +0200)]
nm_description_to_path: fix a mailbox type
In nm_description_to_path a mailbox type is supposed to be MUTT_NOTMUCH,
since the function queries the path of a *notmuch* mailbox using
a description string.
Pietro Cerutti [Fri, 4 Aug 2017 07:36:06 +0000 (07:36 +0000)]
Do not rely on backends setting error codes on success
From the API documentation of KyotoCabinet, TokyoCabinet and QDBM, I am
not convinced that the error code routines consistently return 0 whenever
the previous operation succeeded. Also, I am not convinced that they
return 1 whenever the previous operation failed.
It is important that we do not return 0 on failure, so let's try to get
the error code and fallback to -1 if we couldn't get anything more
specific.
Pietro Cerutti [Fri, 4 Aug 2017 06:40:41 +0000 (06:40 +0000)]
Review hcache implementation return codes
Especially, in this batch I have reviewed the return codes for fetch and
delete operations. KyotoCabinet, QDBM and TokyoCabinet were indeed
incorrectly implemented, as these backends generally return true on
success and false on failure.
I still have to investigate how to get a proper return code from QDBM.
Richard Russon [Thu, 3 Aug 2017 15:56:36 +0000 (16:56 +0100)]
merge: upstream fixes (mutt/default)
* Fix menu color calls to occur before positioning the cursor. (see #3956)
* Change imap_cmd_start() to return OK when the cmd_queue is finished. (closes #3956)
* When guessing an attachment type, don't allow text/plain if there is a null character. (see #2933)
* Add timeout parameter to mutt_socket_poll.
* Add $imap_poll_timeout to allow mailbox polling to time out.
* Convert raw_socket_poll() to use gettimeofday().
Kevin McCarthy [Sun, 23 Jul 2017 02:48:50 +0000 (19:48 -0700)]
Add $imap_poll_timeout to allow mailbox polling to time out.
Enable the polling flag for the NOOP in imap_check_mailbox(), the
STATUS command in imap_buffy_check(), and the LOGOUT command.
This is not intended to handle all blocking-IO related issues.
However, the periodic NOOP and STATUS are the most frequent places for
mutt to freeze up, especially after a laptop is sleep/woken.
Since these are quick operations with little data, this is a good place
to check if the connection is still working before hanging on a read.
Kevin McCarthy [Fri, 21 Jul 2017 00:30:05 +0000 (17:30 -0700)]
When guessing an attachment type, don't allow text/plain if there is a null character. (see #2933)
Type text/plain should not contain any null characters. Slightly
improve the type guesser by forcing an attachment with any null
characters to be application/octet-stream.
Note the type guesser could use much more improvement, but this is an
easy and obvious fix.
Kevin McCarthy [Wed, 19 Jul 2017 21:04:39 +0000 (14:04 -0700)]
Change imap_cmd_start() to return OK when the cmd_queue is finished. (closes #3956)
Some response handlers can end up recursively calling
imap_cmd_start(), processing all the command completions. If the
outer call was an imap_exec(), this would result in the loop never
being terminated (or just blocking reading a server that has already
finished all the commands).
Change the callers that are simply using it to read a response,
without having called cmd_start(), to check for IMAP_CMD_OK instead.
Currently this is just the open connection function.
Richard Russon [Wed, 26 Jul 2017 15:39:51 +0000 (16:39 +0100)]
tidy: drop unnecessary INITVAL usage
Variables with a static/global scope are automatically initialised to 0/NULL.
About 10 variables were initialised to non-zero values, but they were
reset with values from init.h before they were used.
Richard Russon [Thu, 3 Aug 2017 14:36:53 +0000 (15:36 +0100)]
merge: create library of shared code
* split out state functions
* split out parameter functions
* create library
* change code to use lib/lib.h
* move the ascii functions to the library
* move the base64 functions to the library
* move the date functions to the library
* move the exit functions to the library
* move the md5 functions to the library
* move the sha1 functions to the library
* move the memory functions to the library
* move the message functions to the library
* move the debug functions to the library
* move the string functions to the library
* move the file functions to the library
* move the buffer functions to the library
* move the hash functions to the library
* drop lib.c
* doxygen: update config
* rename the library to libmutt
Pietro Cerutti [Thu, 20 Jul 2017 14:33:55 +0000 (15:33 +0100)]
Look for ncurses headers in more dedicated locations first (#679)
This solves a problem on FreeBSD, where the base system is shipped with
ncurses 5.9 (/usr/include/ncurses.h). When building against 3rd party
ncurses 6.0 from ports (/usr/local/include/ncurses/ncurses.h), the
configure script picks up the 5.9 headers and the 6.0 library. This
might cause problems, since 6.0 is not ABI compatible with 5.0.
Richard Russon [Fri, 14 Jul 2017 21:07:37 +0000 (22:07 +0100)]
rename mutt_format_string and mutt_FormatString
`mutt_format_string` and `mutt_FormatString` were much to similarly
named to be useful. The first only does formatting. The second uses
expandos to allow custom expansion.
To avoid future confusion, I've created new names that are distinct:
mutt_format_string mutt_simple_format
mutt_FormatString mutt_expando_format
Thomas Adam [Sat, 8 Jul 2017 16:17:16 +0000 (17:17 +0100)]
compile-time output: use two lists
When asking NeoMutt for a list of compile-time features, the current
implementation assumes a mixture of options which can be enabled through
./configure, and some which default to on, without compile-time
exclusion.
It's not clear to anyone why this variable existed in the first place,
so it was decided that it should be removed.
Most of the time, AC_CHECK_LIB and AC_SEARCH_LIBS will already alter
LIBS to prepend to it the found library, so there is no real reason to
duplicate this mechanism.
Some manual assignments have been kept because either the
action-if-found was set to no-op, or because new found libraries were
appended to MUTTLIBS, so this keeps the diff minimal with the same
"behaviour".
Richard Russon [Fri, 14 Jul 2017 11:08:04 +0000 (12:08 +0100)]
merge: upstream fixes (mutt/default)
* fix signed/unsigned comparison in longest_common_prefix
* Fix crash when $postponed is on another server.
* bcache: cast to avoid implicit signed/unsigned comparison in bcache_path
* drop unused flags argument from imap_access
Kevin McCarthy [Wed, 12 Jul 2017 19:38:22 +0000 (12:38 -0700)]
Fix crash when $postponed is on another server.
imap_mxcmp() translates NULL to "INBOX". When $postponed points to a
URL with an empty or "INBOX" path, this will end up matching against a
NULL idata->mailbox in imap_status(). This resulted in a crash
because idata->ctx is also NULL.
Thanks to Olaf Hering for the detailed bug report and suggested fix.