about summary refs log tree commit diff stats
path: root/worker/maildir
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2021-12-06 23:45:58 +0100
committerRobin Jarry <robin@jarry.cc>2021-12-06 23:50:04 +0100
commitabcd327359592ca7b552585a0f3837c930b126b4 (patch)
tree7c958ba0abf2bec574a488ac8b789fb334799e68 /worker/maildir
parentf4d3c8fc77f97c1c01e85329c54c522c2cfd13bb (diff)
downloadaerc-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')
-rw-r--r--worker/maildir/worker.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index 099a85c..621b19e 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
d='n152' href='#n152'>152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243