mirror of
https://github.com/mjl-/mox.git
synced 2025-07-16 05:54:39 +03:00
imapserver: implement PREVIEW extension (RFC 8970), and store previews in message database
We were already generating previews of plain text parts for the webmail interface, but we didn't store them, so were generating the previews each time messages were listed. Now we store previews in the database for faster handling. And we also generate previews for html parts if needed. We use the first part that has textual content. For IMAP, the previews can be requested by an IMAP client. When we get the "LAZY" variant, which doesn't require us to generate a preview, we generate it anyway, because it should be fast enough. So don't make clients first ask for "PREVIEW (LAZY)" and then again a request for "PREVIEW". We now also generate a preview when a message is added to the account. Except for imports. It would slow us down, the previews aren't urgent, and they will be generated on-demand at first-request.
This commit is contained in:
@ -2115,7 +2115,7 @@
|
||||
"Fields": [
|
||||
{
|
||||
"Name": "Message",
|
||||
"Docs": "Without ParsedBuf and MsgPrefix, for size.",
|
||||
"Docs": "Without ParsedBuf and MsgPrefix, for size. With Preview, even with value not yet stored in the database.",
|
||||
"Typewords": [
|
||||
"Message"
|
||||
]
|
||||
@ -2149,13 +2149,6 @@
|
||||
"bool"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "FirstLine",
|
||||
"Docs": "Of message body, for showing as preview.",
|
||||
"Typewords": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "MatchQuery",
|
||||
"Docs": "If message does not match query, it can still be included because of threading.",
|
||||
@ -2613,6 +2606,14 @@
|
||||
"uint8"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Preview",
|
||||
"Docs": "If non-nil, a preview of the message based on text and/or html parts of the message. Used in the webmail and IMAP PREVIEW extension. If non-nil, it is empty if no preview could be created, or the message has not textual content or couldn't be parsed. Previews are typically created when delivering a message, but not when importing messages, for speed. Previews are generated on first request (in the webmail, or through the IMAP fetch attribute \"PREVIEW\" (without \"LAZY\")), and stored with the message at that time. The preview is at most 256 characters (can be more bytes), with detected quoted text replaced with \"[...\"].",
|
||||
"Typewords": [
|
||||
"nullable",
|
||||
"string"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "ParsedBuf",
|
||||
"Docs": "ParsedBuf message structure. Currently saved as JSON of message.Part because bstore cannot yet store recursive types. Created when first needed, and saved in the database. todo: once replaced with non-json storage, remove date fixup in ../message/part.go.",
|
||||
|
Reference in New Issue
Block a user