aboutsummaryrefslogtreecommitdiffstats
path: root/worker/jmap/directories.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2024-06-05 17:49:46 +0200
committerRobin Jarry <robin@jarry.cc>2024-07-02 22:00:06 +0200
commit7a2372773ca870466029cf4137fde71082979a25 (patch)
treed5b9aad77b7bb6274ff37d66dc2c1f2e0fddfa61 /worker/jmap/directories.go
parent588776f42574567f907c190a5ff089256b21e598 (diff)
downloadaerc-7a2372773ca870466029cf4137fde71082979a25.tar.gz
jmap: do not keep invalid sessions in cache
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>
Diffstat (limited to 'worker/jmap/directories.go')
-rw-r--r--worker/jmap/directories.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/worker/jmap/directories.go b/worker/jmap/directories.go
index 66875cc7..07bb0762 100644
--- a/worker/jmap/directories.go
+++ b/worker/jmap/directories.go
@@ -55,7 +55,7 @@ func (w *JMAPWorker) handleListDirectories(msg *types.ListDirectories) error {
if !consistentMailboxState || len(missing) > 0 {
var req jmap.Request
- req.Invoke(&mailbox.Get{Account: w.accountId})
+ req.Invoke(&mailbox.Get{Account: w.AccountId()})
resp, err := w.Do(&req)
if err != nil {
return err
@@ -150,7 +150,7 @@ func (w *JMAPWorker) handleFetchDirectoryContents(msg *types.FetchDirectoryConte
var req jmap.Request
req.Invoke(&email.Query{
- Account: w.accountId,
+ Account: w.AccountId(),
Filter: w.translateSearch(w.selectedMbox, msg.Filter),
Sort: translateSort(msg.SortCriteria),
})
@@ -202,7 +202,7 @@ func (w *JMAPWorker) handleSearchDirectory(msg *types.SearchDirectory) error {
var req jmap.Request
req.Invoke(&email.Query{
- Account: w.accountId,
+ Account: w.AccountId(),
Filter: w.translateSearch(w.selectedMbox, msg.Criteria),
})
@@ -256,7 +256,7 @@ func (w *JMAPWorker) handleCreateDirectory(msg *types.CreateDirectory) error {
id = jmap.ID(msg.Directory)
req.Invoke(&mailbox.Set{
- Account: w.accountId,
+ Account: w.AccountId(),
Create: map[jmap.ID]*mailbox.Mailbox{
id: {
ParentID: parentId,
@@ -297,7 +297,7 @@ func (w *JMAPWorker) handleRemoveDirectory(msg *types.RemoveDirectory) error {
}
req.Invoke(&mailbox.Set{
- Account: w.accountId,
+ Account: w.AccountId(),
Destroy: []jmap.ID{id},
OnDestroyRemoveEmails: msg.Quiet,
})