aboutsummaryrefslogtreecommitdiffstats
path: root/worker/jmap/directories.go
Commit message (Collapse)AuthorAgeFilesLines
* treewide: replace uint32 uids with opaque stringsRobin Jarry2024-08-281-4/+4
| | | | | | | | | | | | | | | | | Add a new models.UID type (an alias to string). Replace all occurrences of uint32 being used as message UID or thread UID with models.UID. Update all workers to only expose models.UID values and deal with the conversion internally. Only IMAP needs to convert these to uint32. All other backends already use plain strings as message identifiers, in which case no conversion is even needed. The directory tree implementation needed to be heavily refactored in order to accommodate thread UID not being usable as a list index. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* jmap: do not keep invalid sessions in cacheRobin Jarry2024-07-021-5/+5
| | | | | | | | | | | If a session is found in the cache, check that it works by issuing a GetIdentities request. If that request fails, invalidate the cache and go through the authentication. Ensure that the session is valid and explicitly fail if it is not. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com>
* jmap: fix message list order directionRobin Jarry2024-06-051-1/+1
| | | | | | | | | | | | | Since the update to go-jmap 0.5.0, the IsAscending property is now taken into account even if it is false. The initial JMAP implementation wrongfully assumed the behaviour and inverted the sort -r logic. Fix that so that messages are ordered as expected. Link: https://git.sr.ht/~rockorager/go-jmap/commit/1db959676c10398a8 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* jmap: fix error messageTristan Partin2024-05-291-1/+1
| | | | | | | | A v1 got committed when a v2 existed. Fixes: f9113810cc6c ("jmap: invalidate cache if mailbox state is not consistent") Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* jmap: invalidate cache if mailbox state is not consistentTristan Partin2024-05-281-11/+28
| | | | | | | | | We weren't checking if the cached state was the same as the remote state before reading it. This led to aerc not knowing about new mailboxes on the remote. Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* search: use a common api for all workersRobin Jarry2023-10-281-33/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Define a SearchCriteria structure. Update the FetchDirectoryContents, FetchDirectoryThreaded and SearchDirectory worker messages to include this SearchCriteria structure instead of a []string slice. Parse the search arguments in a single place into a SearchCriteria structure and use it to search/filter via the message store. Update all workers to use that new API. Clarify the man page indicating that notmuch supports searching with aerc's syntax and also with notmuch specific syntax. getopt is no longer needed, remove it from go.mod. NB: to support more complex search filters in JMAP, we need to use an email.Filter interface. Since GOB does not support encoding/decoding interfaces, store the raw SearchCriteria and []SortCriterion values in the cached FolderContents. Translate them to JMAP API objects when sending an email.Query request to the server. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* jmap: avoid displaying archive folder when use-labels=trueRobin Jarry2023-06-251-1/+8
| | | | | | | | | | When archiving a message, the counts of archive folder are changed. When use-labels=true, the archive folder is hidden and should remain so. Do not send updates to the UI. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* worker: add jmap supportRobin Jarry2023-06-211-0/+360
Add support for JMAP backends. This is on par with IMAP features with some additions specific to JMAP: * tagging * sending emails This makes use of git.sr.ht/~rockorager/go-jmap for the low level interaction with the JMAP server. The transport is JSON over HTTPS. For now, only oauthbearer with token is supported. If this proves useful, we may need to file for an official three-legged oauth support at JMAP providers. I have tested most features and this seems to be reliable. There are some quirks with the use-labels option. Especially when moving and deleting messages from the "All mail" virtual folder (see aerc-jmap(5)). Overall, the user experience is nice and there are a lot less background updates issues than with IMAP (damn IDLE mode hanging after restoring from sleep). I know that not everyone has access to a JMAP provider. For those interested, there are at least these two commercial offerings: https://www.fastmail.com/ https://www.topicbox.com/ And, if you host your own mail, you can use a JMAP capable server: https://stalw.art/jmap/ https://www.cyrusimap.org/imap/download/installation/http/jmap.html Link: https://www.rfc-editor.org/rfc/rfc8620.html Link: https://www.rfc-editor.org/rfc/rfc8621.html Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>