aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2023-04-30 12:56:10 -0500
committerRobin Jarry <robin@jarry.cc>2023-05-16 17:07:50 +0200
commit6b6aaf3ae131971d05ab3f849ea3db14c6a6e055 (patch)
tree00f9055556388cf1396af6da84ef0b5b59814efe /config
parente8089e7d8f6065031814bf7d80be043536e09fe7 (diff)
downloadaerc-6b6aaf3ae131971d05ab3f849ea3db14c6a6e055.tar.gz
headers: enable partial header fetching
Enable partial header fetching by creating config values for headers to specifically include, or specifically exclude. The References field will always be fetched, regardless of the include list. Envelope data is always fetched, but is not shown with :toggle-headers, since it isn't in the RFC822 struct unless explicitly included in the list. Partial headers can break the cache on changes. Update the cache tag key to include the state of the partially-fetched headers. Partial header fetching can have a significant performance increase for IMAP, and for all backends a resource improvement. Some data to support this is below. Gathered by opening aerc, selecting a mailbox with approximately 800 messages and scrolling to the end. Received measured with nethogs, RAM from btop Received | RAM ------------------------------------- All Headers | 9,656 kb | 103 MB Minimum Headers | 896 kb | 36 MB Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'config')
-rw-r--r--config/accounts.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/config/accounts.go b/config/accounts.go
index 57ae2e66..eec6ca44 100644
--- a/config/accounts.go
+++ b/config/accounts.go
@@ -82,6 +82,8 @@ type AccountConfig struct {
Source string `ini:"source" parse:"ParseSource"`
Folders []string `ini:"folders" delim:","`
FoldersExclude []string `ini:"folders-exclude" delim:","`
+ Headers []string `ini:"headers" delim:","`
+ HeadersExclude []string `ini:"headers-exclude" delim:","`
Outgoing RemoteConfig `ini:"outgoing" parse:"ParseOutgoing"`
SignatureFile string `ini:"signature-file"`
SignatureCmd string `ini:"signature-cmd"`
@@ -182,6 +184,22 @@ If you want to disable STARTTLS, append +insecure to the schema.
if account.From == nil {
return fmt.Errorf("Expected from for account %s", _sec)
}
+ if len(account.Headers) > 0 {
+ defaults := []string{
+ "date",
+ "subject",
+ "from",
+ "sender",
+ "reply-to",
+ "to",
+ "cc",
+ "bcc",
+ "in-reply-to",
+ "message-id",
+ "references",
+ }
+ account.Headers = append(account.Headers, defaults...)
+ }
log.Debugf("accounts.conf: [%s] from = %s", account.Name, account.From)
Accounts = append(Accounts, &account)