Austin Ray [Wed, 22 May 2019 20:40:03 +0000 (16:40 -0400)]
fix: stop CUR_EMAIL underflow in entire-thread
entire-thread will underflow CUR_EMAIL macro if no mailbox is
configured. To prevent this, call 'prereq()' before any other logic.
'prereq()' will ensure we have a mailbox thus preventing the underflow.
flatcap deserves credit for identifying the solution.
Richard Russon [Thu, 23 May 2019 11:33:38 +0000 (12:33 +0100)]
merge: Convert Address to use TAILQ
* Define an AddressList structure using TAILQ
* Add functions to convert to/from Address/AddressList
* Use AddressList in mutt_addrlist_dedupe
* Use AddressList in mutt_addr_parse_list
* Const'ify parameter to mutt_addr_copy
* Implement mutt_addresslist_new
* Use AddressList in mutt_addr_copy_list
* Use AddressList in mutt_addr_free, implement mutt_addresslist_free_one
* Use AddressList in mutt_addr_remove_from_list
* Use AddressList in mutt_addr_qualify
* Use AddressList in mutt_addr_append
* Use AddressList in mutt_addr_cmp_strict
* Use AddressList in mutt_addr_has_recips
* Use AddressList in mutt_addr_search
* Use AddressList in mutt_addr_remove_xrefs
* Tidy Address free'ing functions
* Use AddressList in mutt_addr_write
* Use AddressList in mutt_addrlist_to_intl and mutt_addrlist_to_local
* Convert mutt_addr_remove_from_list and mutt_addr_remove_xrefs API to AddressList
* Convert Alias to use AddressList
* Convert Envelope addresses to AddressList
* Fix variadic function
* Fix recursive alias lookup
* Cleanup Address API: mutt_addr_cmp_strict -> mutt_addresslist_equal
* Cleanup Address API: parse and free
* Cleanup Address API: mutt_addresslist_qualify
* Cleanup Address API: mutt_addr_write
* Fix and refactor mutt_is_list_recipient and mutt_is_subscribed_list_recipient
* Fix match_user
* Cleanup Address API: unexpose mutt_addr_is_(intl|local)
* Cleanup Address API: unexpose mutt_addr_mbox_to_udomain
* Cleanup Address API: mutt_addr_remove_from_list -> mutt_addresslist_remove
* Cleanup Address API: mutt_addr_remove_xrefs -> mutt_addresslist_remove_xrefs
* Cleanup Address API: unexpose mutt_addr_set_(intl|local)
* Cleanup Address API: mutt_addrlist_dedupe -> mutt_addresslist_dedupe
* Cleanup Address API: mutt_addrlist_to_(intl|local) -> mutt_addresslist_to_(intl|local)
* Remove "next" pointer from struct Address: conversion to TAILQ is complete
* Merge AddressNode into Address
* Rename mutt_addresslist_* to mutt_addrlist_*
* Provide mutt_addrlist_append and mutt_addrlist_prepend
* doxy: fix comments
* test: update basic address tests
* remove 'mutt_' from static functions
* Add tests for mutt_addr_cmp
* Add tests for mutt_addr_cat, explain what it does does in the Doxygen block
* Add tests for mutt_addr_copy
* Add tests for mutt_addr_free
* Add tests for mutt_addr_valid_msgid
* Add test for mutt_addrlist_append and mutt_addrlist_prepend
* Add tests for mutt_addrlist_copy
* Add test for mutt_addrlist_dedupe, fix mutt_addrlist_parse
* Run clang-format over test/address
* Add tests for mutt_addrlist_equal
* Add tests for mutt_addrlist_free_all
* Add tests for mutt_addrlist_free_one
* Add tests for mutt_addrlist_free
* Boolify uses of Address' group
* tidy code
* Revert queue.h formatting
* Rename mutt_addrlist_has_recips to mutt_addrlist_count_recips and add tests
* Kill duplicate copyright line
* Rename mutt_addrlist_free_all into mutt_addrlist_clear, remove freeing functions
* Add tests for mutt_addrlist_count_recips
* Add tests for mutt_addrlist_parse + slight refactor and fix return value
* Slightly refactor mutt_addrlist_parse2
* Avoid leak in the test for mutt_addrlist_parse
* Add tests for mutt_addrlist_parse2
* Add tests for mutt_addrlist_qualify
* Sort address functions by name
* Add helper to create and populate an Address, avoid leaks in tests
* Simplify mutt_default_from
* Add tests formutt_addrlist_remove_xrefs
* Add tests for mutt_addrlist_remove
* Add (basic) tests for mutt_addrlist_to_(intl|local)
* Add tests for mutt_addrlist_write + make it more readable
* Fix test for mutt_addrlist_write and avoid leak
* Add mutt_addr_to_local
* Test addresses with comments in mutt_addrlist_parse
* Run clang-format over test/address
Pietro Cerutti [Sun, 19 May 2019 12:47:18 +0000 (12:47 +0000)]
Rename mutt_addrlist_free_all into mutt_addrlist_clear, remove freeing functions
No facilities are provided for the heap allocation and freeing of
AddressLists. The suggested usage is to to have AddressLists as
variables on the stack.
Pietro Cerutti [Fri, 17 May 2019 13:42:58 +0000 (13:42 +0000)]
Provide mutt_addrlist_append and mutt_addrlist_prepend
These are one-liners that call TAILQ_INSERT_TAIL and TAILQ_INSERT_HEAD,
but the macros have the ugly side-effect of evaluating their arguments
multiple times, so TAILQ_INSERT_TAIL(list, new_element()); doesn't do
what you would expect.
Andres Freund [Tue, 21 May 2019 23:50:54 +0000 (16:50 -0700)]
Avoid redundant sort in entire-thread.
918885f added, indirectly, a mutt_sort_headers() call to
nm_read_entire_thread() (via mutt_mailbox_changed() ->
ctx_mailbox_changed() -> ctx_update()), but didn't remove the sort
after nm_read_entire_thread() in mutt_index_menu().
Andres Freund [Tue, 21 May 2019 23:13:10 +0000 (16:13 -0700)]
entire-thread: determine current position before resorting.
Previously oldcur was determined after nm_read_entire_thread(),
leading to entire-thread unintentionally jumping to the first message
in the thread.
Before 918885f32db41 that used to work, because mutt_sort_headers()
wasn't called from within nm_read_entire_thread().
Fix by moving determination of pre nm_read_entire_thread() count a few
lines up. Also reuse existing oldcount variable, rather than
'oc' (which could also be oldcur).
Richard Russon [Thu, 16 May 2019 11:55:40 +0000 (12:55 +0100)]
don't check for empty config strings
The config system stores empty strings as NULL.
Config variables must not be set directly, but using the config system
(this gives us validation and notifications).