aboutsummaryrefslogtreecommitdiffstats
path: root/worker/jmap/fetch.go
Commit message (Collapse)AuthorAgeFilesLines
* treewide: replace uint32 uids with opaque stringsRobin Jarry2024-08-281-17/+5
| | | | | | | | | | | | | | | | | 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: refactor thread fetchingTim Culverhouse2024-08-201-4/+10
| | | | | | | | | | | | | | | | | | Refactor JMAP thread fetching to occur in a single request. We use a result reference method call on Email/get to fetch the message info for each message in a thread. Previously, we checked the cache and only fetched information for messages we didn't already have. This results in two requests and is typically slower for most contexts. Also, in most cases if we are fetching an email we don't already have it's because we also need to fetch the entire thread. The only case this wouldn't happen is if we get a new email in a thread. We can optimize this by fetching message info for created messages in the push method at a later time. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* jmap: fetch entire threadsTristan Partin2024-08-031-35/+39
| | | | | | | | | | Fetch an email's entire thread in the JMAP backend. Changelog-added: Fetch entire threads in the JMAP backend. Signed-off-by: Tristan Partin <tristan@partin.io> Tested-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* jmap: do not keep invalid sessions in cacheRobin Jarry2024-07-021-2/+2
| | | | | | | | | | | 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: revert fetch threads supportRobin Jarry2024-06-291-151/+32
| | | | | | | | | | | | | | This reverts commits: 9e93d9efdb88 ("jmap: fix go static check failure") 0465509eedad ("jmap: skip Email/get call if no emails to get") 9f97c698e3dd ("jmap: fetch entire threads") Issues have been reported about disappearing sent messages. Reported-by: Tristan Partin <tristan@partin.io> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tristan Partin <tristan@partin.io>
* jmap: skip Email/get call if no emails to getTristan Partin2024-06-041-0/+4
| | | | | | | | No need to send a JMAP request if there are no object to fetch. Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* jmap: fix go static check failureTristan Partin2024-05-291-1/+1
| | | | | | | | The missing variable was being set but unused. Fixes: 9f97c698e3dd ("jmap: fetch entire threads") Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
* jmap: fetch entire threadsTristan Partin2024-05-281-32/+147
| | | | | | | JMAP was missing good thread support, especially when compared to Gmail. This will fetch entire threads when possible. Signed-off-by: Tristan Partin <tristan@partin.io>
* worker: add jmap supportRobin Jarry2023-06-211-0/+196
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>