forked from Silverfish/proton-bridge
GODT-1984: Handle permanent message deletion
Only delete messages when unlabeled from trash/spam if they only exists in All Mail and (spam or trash). This patch also ports delete_from_trash.feature and use status rather than fetch to count messages in a mailboxes.
This commit is contained in:
committed by
James Houlahan
parent
df818bc2b8
commit
8f420d728c
@ -289,7 +289,9 @@ func (user *User) handleMessageEvents(ctx context.Context, messageEvents []litea
|
||||
}
|
||||
|
||||
case liteapi.EventDelete:
|
||||
return ErrNotImplemented
|
||||
if err := user.handleDeleteMessageEvent(ctx, event); err != nil {
|
||||
return fmt.Errorf("failed to handle delete message event: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,6 +333,20 @@ func (user *User) handleUpdateMessageEvent(_ context.Context, event liteapi.Mess
|
||||
}, user.updateChLock)
|
||||
}
|
||||
|
||||
func (user *User) handleDeleteMessageEvent(_ context.Context, event liteapi.MessageEvent) error { //nolint:unparam
|
||||
return safe.RLockRet(func() error {
|
||||
for _, updateCh := range user.updateCh {
|
||||
update := imap.NewMessagesDeleted(
|
||||
imap.MessageID(event.ID),
|
||||
)
|
||||
|
||||
updateCh.Enqueue(update)
|
||||
}
|
||||
|
||||
return nil
|
||||
}, user.updateChLock)
|
||||
}
|
||||
|
||||
func getMailboxName(label liteapi.Label) []string {
|
||||
var name []string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user