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

View file

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