diff options
author | Robin Jarry <robin@jarry.cc> | 2021-12-06 23:45:58 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2021-12-06 23:50:04 +0100 |
commit | abcd327359592ca7b552585a0f3837c930b126b4 (patch) | |
tree | 7c958ba0abf2bec574a488ac8b789fb334799e68 /worker/maildir/worker.go | |
parent | f4d3c8fc77f97c1c01e85329c54c522c2cfd13bb (diff) | |
download | aerc-abcd327359592ca7b552585a0f3837c930b126b4.tar.gz |
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: f4d3c8fc77f9 ("maildir: watch for external changes")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/maildir/worker.go')
-rw-r--r-- | worker/maildir/worker.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go index 099a85c1..621b19e3 100644 --- a/worker/maildir/worker.go +++ b/worker/maildir/worker.go @@ -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 |