mirror of
https://github.com/mjl-/mox.git
synced 2025-06-27 23:08:14 +03:00

Keeping the message files around, and the message details in the database, is useful for IMAP sessions that haven't seen/processed the removal of a message yet and try to fetch it. Before, we would return errors. Similarly, a session that has a mailbox selected that is removed can (at least in theory) still read messages. The mechanics to do this need keeping removed mailboxes around too. JMAP needs that anyway, so we now keep modseq/createseq/expunged history for mailboxes too. And while we're at it, for annotations as well. For future JMAP support, we now also keep the mailbox parent id around for a mailbox, with an upgrade step to set the field for existing mailboxes and fixing up potential missing parents (which could possibly have happened in an obscure corner case that I doubt anyone ran into).
16 lines
265 B
Go
16 lines
265 B
Go
package mox
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// ParentMailboxName returns the name of the parent mailbox, returning empty if
|
|
// there is no parent.
|
|
func ParentMailboxName(name string) string {
|
|
i := strings.LastIndex(name, "/")
|
|
if i < 0 {
|
|
return ""
|
|
}
|
|
return name[:i]
|
|
}
|