maildir: watch for message renames

Messages flags can also be changed without changing directories.
Changing flags in maildirs means renaming the message files. Also take
renames into account.

Link: https://cr.yp.to/proto/maildir.html
Fixes: f4d3c8fc77 ("maildir: watch for external changes")
Signed-off-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Robin Jarry 2021-12-06 23:45:58 +01:00
parent f4d3c8fc77
commit abcd327359
1 changed files with 5 additions and 2 deletions

View File

@ -71,8 +71,11 @@ func (w *Worker) handleAction(action types.WorkerMessage) {
}
func (w *Worker) handleFSEvent(ev fsnotify.Event) {
// we only care about files being created or removed
if ev.Op != fsnotify.Create && ev.Op != fsnotify.Remove {
// we only care about files being created, removed or renamed
switch ev.Op {
case fsnotify.Create, fsnotify.Remove, fsnotify.Rename:
break
default:
return
}
// if there's not a selected directory to rescan, ignore