| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
| |
Add a darwin implementation of FSWatcher using the fsevents package. The
implementation is behind a darwin build flag.
Co-authored-by: Ben Cohen <ben@bencohen.net>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Ben Lee-Cohen <ben@lee-cohen.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
| |
Use the FSWatcher interface to create the watcher.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Ben Lee-Cohen <ben@lee-cohen.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
| |
Implement an FSWatcher interface. The interface is used to abstract away
file system watchers, which have implementation specific backends. The
initial interface has one implementation: inotify for linux. Subsequent
commits will add a macOS watcher.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Ben Lee-Cohen <ben@lee-cohen.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Do not store the dependency in tools.go as there may be conflicts with
some indirect dependencies of aerc.
Run gofumpt and golangci-lint from their latest tagged release. This
should fix issues with go 1.20. Bonus, it drains a bit of fat from
go.sum.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
|
|
|
|
|
|
|
| |
Add account name to log of all Post/Process Message/Action logs.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Normally for emails with xoauth2, the help page says to pass the refresh
token as the password. When the refresh token expires, aerc can't fetch
the access token, and you must get a new refresh token from the external
script.
This patch implements a cycle of refresh tokens so you only need
to use an external script to fetch the refresh token once.
Once you have fetched the initial refresh token (with an external script
like mutt_xoauth2.py or https://github.com/gaoDean/oauthRefreshToken),
that refresh token is inputted as the password to aerc (as normal) to
fetch the access token. Before this patch aerc used to only fetch the
access token, but now it fetches that and a new refresh token, which it
caches in $XDG_CONFIG_HOME/aerc/<account>-xoauth2.token. In the next
opening of aerc, aerc will pull the refresh token from the cache, and
use it instead of the inputted refresh token from the password. If it is
not present in the cache, the refresh token is taken from the password
as usual.
Signed-off-by: Dean <gao.dean@hotmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
| |
These issues were all reported by the new custom analyzer introduced in
previous commit.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
|
|
|
| |
Using a list of integers is not optimal. Use a bit mask instead.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The maildir worker sends a MessagesMoved message to the UI when messages
are moved, enabling the destination directory to update it's counts. The
filesystem watcher sees the move and updates the directory currently
selected. However, an update of the UIDs in the msgstore is not
completed as it is in other workers. All other works, via some mechanism
(direct or EXPUNGE update) issue a MessagesDeleted message after a move.
Send this message to the UI for the maildir worker to have it work as
all other workers do.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
|
|
|
|
|
| |
Use list-status to perform check-mail commands, if it is available. This
provides a significant performance benefit by only requiring one IMAP
command vs one command for each mailbox.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
| |
Use the LIST-STATUS extension when listing directories. This enables the
UI to show message counts for every mailbox, in a similar behavior to
the maildir and notmuch backends.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Check for LIST-STATUS capability on IMAP servers. This will be used in
subsequent commits for improved check-mail performance.
The LIST-STATUS command allows the LIST command to also return STATUS
responses, which include message counts.
Upgrade go-imap to latest release. Add go-imap-liststatus extension.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
| |
Add IMAP extension LIST-STATUS handling to IMAP worker.
Reference: https://www.rfc-editor.org/rfc/rfc5819.html
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
| |
Simplify the error handling in ListDirectories so the Done message is
not within an else statement
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
| |
Keep the original tags when a message is moved from one maildir folder to
another.
Signed-off-by: inwit <inwit@sindominio.net>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
| |
In notmuch, a message can be represented by several identical files across the
maildir structure, which makes the operation of moving a message from a virtual
folder (showing a notmuch query) to a maildir folder problematic if the number
of files for that message is greater than 1. Since the move operation is
unambiguous when the message is represented by a single file, allow moving
messages in such cases.
Signed-off-by: inwit <inwit@sindominio.net>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Support relative terms when writing date ranges in the search and filter
commands with the -d flag. Syntax is inspired by the notmuch search
terms.
Terms can be written with spaces or underscores for a better
readability, so both "this_week" and "this week" are allowed. Terms are
not case-sensitive.
Some terms can be prefixed with either "this" or "last" where applicable
("this" is assumed by default if omitted):
- "today", "yesterday"
- ("this"|"last") "year", "month", "week"
- all weekdays (e.g. "Tuesday", "last_wed")
- all months (e.g. "January", "last_feb")
Note that "month" should always be spelled out to prevent a possible
ambiguity with "Monday".
Weekdays and months do not need to be written out completely, i.e.
"February..March" and "Feb..Mar" are both understood.
Relative date terms can be used with the <N (year|month|week|day)>
syntax where N is a positive integer indicating the number of time units
in the past from today. The units can be abbreviated with a single
letter, e.g. "1w 1d.." is the same as "1 week 1 day..".
More examples:
:filter -d yesterday
:filter -d last_monday..
:filter -d mon..sat
:filter -d 1y1m1w1d..
:search -d this_week "PATCH aerc"
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
| |
Filter and search with a date range in the imap backend.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
| |
Filter and search with a date range in the maildir backend.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Handle date ranges in the filter and search commands for searching and
filtering based on the Date: header. Implement a flag (-d) that accepts
a date range <start[..end]> where the start date is included in the
range but the end date is not, i.e. [start,end).
The start or end date can be omitted: "start", "start..", "..end", or
"start..end" are all valid inputs.
An example filter query would look like this: :filter -d 2022-11-09..
The dates should be in the YYYY-MM-DD format.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
| |
Use the same name than the builtin "log" package. That way, we do not
risk logging in the wrong place.
Suggested-by: Tim Culverhouse <tim@timculverhouse.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The main goal is to ensure that by default, the log file (if configured)
does not grow out of proportions. Most of the logging messages in aerc
are actually for debugging and/or trace purposes.
Define clear rules for logging levels. Enforce these rules everywhere.
After this patch, here is what the log file looks like after starting up
with a single account:
INFO 2022/11/24 20:26:16.147164 aerc.go:176: Starting up version 0.13.0-100-g683981479c60 (go1.18.7 amd64 linux)
INFO 2022/11/24 20:26:17.546448 account.go:254: [work] connected.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix the following error occurring when fetching new headers after IDLE:
panic: runtime error: invalid memory address or nil pointer dereference
bufio.(*Reader).fill(0xc00029af00)
bufio/bufio.go:106 +0xd8
bufio.(*Reader).Peek(0xc0006e1f00, 0x1)
bufio/bufio.go:144 +0x5d
github.com/emersion/go-message/textproto.ReadHeader(0x0?)
github.com/emersion/go-message@v0.15.0/textproto/header.go:525 +0x5f
git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleFetchMessageHeaders.func1(0xc00026e980)
git.sr.ht/~rjarry/aerc/worker/imap/fetch.go:49 +0x1ab
git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleFetchMessages.func1()
git.sr.ht/~rjarry/aerc/worker/imap/fetch.go:222 +0xa2
created by git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleFetchMessages
git.sr.ht/~rjarry/aerc/worker/imap/fetch.go:217 +0x10a
Some IMAP messages only contain flag updates, ignore them.
Reuse the same logic than handleFetchMessageBodyPart() and
handleFechFullMessages().
Fixes: https://todo.sr.ht/~rjarry/aerc/111
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: normen <normenweb@mac.com>
|
|
|
|
|
|
|
|
|
|
| |
Fallback to just using the raw In-Reply-To header content when it cannot
be properly parsed as a message-id.
Fixes: ca903d422826 ("envelope: add InReplyTo field")
Reported-by: Bence Ferdinandy <bence@ferdinandy.com>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 155f0c3f28a1 ("maildir/sort: get MessageInfos in parallel") added
parallel parsing of maildir messages. The parsing is limitted to 2x the
number of CPUs using a buffered channel. The channel is drained at the
end of the parsing, however it is not drained if a parse error is
encountered. With enough errors, this can lead to a deadlock.
Drain the channel when an error occurs.
Fixes: 155f0c3f28a1 ("maildir/sort: get MessageInfos in parallel")
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 29205fdd07c0 ("maildir/search: get MessageInfos in parallel")
introduced parallel searching of maildir backends, which improves search
and filtering performance. When no filter is specified, the search
algorithm is still used with no criteria because the FilterCriteria
field always contains "filter" as a minimum. With the new parallelized
search, the message order becomes random. Only use the search algorithm
if there is a filter specified.
If a filter *is* specified and a sort order is *not*, the messages will
go through the search algorithm and become randomized, but not sorted
back in order. Always default to a UID order sort (the same as prior to
this commit) when no sort order is specified.
Fixes: 29205fdd07c0 ("maildir/search: get MessageInfos in parallel")
Reported-by: Ben Lee-Cohen <bdc@fastmail.fm>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Ben Lee-Cohen <bdc@fastmail.fm>
|
|
|
|
|
|
|
|
|
|
| |
Add thread capability to maildir backend. Enables the maildir worker to
thread the entire folder, as opposed to only the displayed messages via
client side threads.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Inwit <inwit@sindominio.net>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
| |
Add an explicit References field to message info. This is useful for
storing information needed for threading without storing all of the
header values, keeping system RAM usage lower.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Inwit <inwit@sindominio.net>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
| |
A standard IMAP envelope response includes the In-Reply-To header field.
Add this field to the aerc model of Envelope. Update envelope parser to
set this value. Update imap worker to set this value.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Inwit <inwit@sindominio.net>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The imap worker incorrectly tries to use the REFERENCES threading
algorithm by default although some servers only support the
ORDEREDSUBJECT threading algorithm.
Use whichever threading algorithm is advertised as supported by the
server, buf prefer REFERENCES if available.
Signed-off-by: jp39 <jp39@gmx.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
| |
When moving or archiving to a very large folder, aerc requests directory
info, which can takes several seconds to receive. Also, when moving, we
post a MessagesDeleted message. Remove unnecessary call to directory
info and change posted message to the correct MessagesMoved.
Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
| |
Signed-off-by: inwit <inwit@sindominio.net>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
| |
When reading the query-map file, any white spaces before the '=' were read as
part of the query name. Trim any leading and trailing white space from the
query name.
Signed-off-by: inwit <inwit@sindominio.net>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sorting opens and reads portions of every file within a directory in
order to gather the data needed. Specifically, RFC822Headers and
BodyStructure are not needed. The RFC822Headers field stores a lot of
information, and the BodyStructure field requires parsing the body of
the email.
Don't set these two values when parsing.
Note: in my testing, this dropped sorting a 52k archive from 2.2gb of
ram usage, to < 500mb
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
| |
Searching in the maildir worker requires reading each file in the
directory. Use waitgroups and goroutines to read files in parallel.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
| |
Sorting in the maildir worker requires reading each file in the
directory. Use waitgroups and goroutines to read files in parallel.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The maildir worker's check-mail command did not include the SkipSort
directive in the DirectoryInfo, which would cause a fresh fetching of
directory contents on the selected maiboxes. This is unneeded and
resulted in every directory being sent to the msgstore and requesting a
sort.
Set SkipSort when checking mail to prevent extra calls to sort.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix the ordered insert for multiple siblings when using client-side
threading. When there are more than two siblings already in the list,
the third element will not be inserted in proper order.
Add tests and better documention for the insert node functions.
Fixes: 5eac8d60 ("thread: add method to append new node")
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sort the client-side thread siblings according to the sort criteria.
Activate this option by setting "sort-thread-siblings" to true in the ui
section of aerc.conf. "sort-thread-siblings" is false by default and the
siblings will be sorted based on their uid number.
Note that this options will only work with client-side threading and
when the backend supports sorting. Also, it comes with a slight
performance penalty.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
By default "notmuch new" will index files in place and won't move new
files from the new/ directory to cur/ because it assumes that is the
job of the email client.
During normal operation, once moved by the client, the "notmuch new"
command will "fix" the database by detecting file renames.
This workflow is a problem because we need to move the new/ files to
cur/, otherwise the maildir lib will not work properly, but at the same
time we cannot afford the notmuch database to be out of sync with the
location of message files on disk, because we rely on it for listing
folders, displaying emails, ect...
This change uses a trick that request notmuch to synchronize message
tags to maildir flags, that will effectively rename new files and cause
them to be moved into the cur/ directory.
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
| |
Add a method to retrieve the message key associated with a message file
path, if indexed in the database.
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
| |
Print "failed to remove tag" instead of "failed to add tag" when
removing tag failed.
Fixes: 5ca6022d007b ("lint: ensure errors are at least logged (errcheck)")
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
| |
Send a DirectoryInfo message when check-mail completes to re-fetch
directory content in case it changed.
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Refactor the code emitting DirectoryInfo messages. Reduce function
call indirections by retiring gatherDirectoryInfo(), buildDirInfo() and
emitDirectoryInfo(), and replacing them with getDirectoryInfo()
(aligning the code with what is done in the maildir worker by the same
occasion).
Also merge queryFromName(), which no longer needs to be called from
different places, in handleOpenDirectory().
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add the "maildir-store" account configuration option to select the
maildir store to associate with the notmuch database.
This also allows the previous changes to be backward compatible since
not specifying this option will make the backend behave the same as if
there were no changes.
Fixes: https://todo.sr.ht/~rjarry/aerc/73
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
By associating the notmuch database with a maildir store, we can add the
Copy/Move/Delete operations on messages to the notmuch backend.
This change assumes that the notmuch database location is also the root
of the maildir store.
In a previous change, we added the ability to dynamically add and remove
message files to the notmuch DB. This change uses this facility to
synchronize the database with the filesystem operations on maildir
files.
While it's still possible to use the query-map file to create virtual
folders from notmuch search queries, the sidebar is now loaded with the
folders found in the maildir store.
With notmuch, two identical but distinct message files can be indexed in
the database with the same key. This change takes extra care of only
deleting or removing message files from the maildir corresponding to the
folder that is currently selected (if any).
Implements: https://todo.sr.ht/~rjarry/aerc/88
Fixes: https://todo.sr.ht/~rjarry/aerc/73
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Replace ListFolder with a new method that returns a map indexed by
folder names instead of a list of folder names. A map is simpler to use
and more efficient in case we only want to check the presence of a
specific folder in the Maildir store.
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
| |
This change moves code that could be common to both notmuch and maildir
workers in worker/lib.
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
| |
The new IndexFile and DeleteMessage allow dynamically inserting and
removing files to/from a notmuch database.
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
| |
Multiple files on the filesystem can be referenced under a single key in
the notmuch database. MsgFilenames() returns a list of filenames
associated with an index key.
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|