Files
Robin Jarry 446d5303b9 jmap: revert fetch threads support
This reverts commits:

 9e93d9efdb ("jmap: fix go static check failure")
 0465509eed ("jmap: skip Email/get call if no emails to get")
 9f97c698e3 ("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>
2024-06-29 00:18:18 +02:00

34 lines
622 B
Go

package cache
import (
"bytes"
"encoding/gob"
"git.sr.ht/~rockorager/go-jmap/mail/email"
"git.sr.ht/~rockorager/go-jmap/mail/mailbox"
)
type jmapObject interface {
*email.Email |
*email.QueryResponse |
*mailbox.Mailbox |
*FolderContents |
*IDList
}
func marshal[T jmapObject](obj T) ([]byte, error) {
buf := bytes.NewBuffer(nil)
encoder := gob.NewEncoder(buf)
err := encoder.Encode(obj)
if err != nil {
return nil, err
}
return buf.Bytes(), nil
}
func unmarshal[T jmapObject](data []byte, obj T) error {
buf := bytes.NewBuffer(data)
decoder := gob.NewDecoder(buf)
return decoder.Decode(obj)
}