[Remail] [PATCH v2 5/5] remaild: also notify on IN_MOVED_TO events

Andreas Rammhold andi at notmuch.email
Mon Mar 2 17:11:39 CET 2020


From: Andreas Rammhold <andreas at rammhold.de>

Some MTAs move mails into the maildir after constructing them in some
temporary path.

Signed-off-by: Andreas Rammhold <andreas at rammhold.de>
---
 remail/remaild.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/remail/remaild.py b/remail/remaild.py
index fad7d37..db512eb 100644
--- a/remail/remaild.py
+++ b/remail/remaild.py
@@ -31,6 +31,11 @@ class EventHandler(pyinotify.ProcessEvent):
         self.mailer.queue_newmail(event.pathname)
         pass
 
+    def process_IN_MOVED_TO(self, event):
+        self.mailer.queue_newmail(event.pathname)
+        pass
+
+
 class remaild(object):
     """
     The remail daemon.
@@ -132,7 +137,7 @@ class remaild(object):
         wm = pyinotify.WatchManager()
         self.inotifier = pyinotify.AsyncNotifier(wm, EventHandler(self))
         ndir = pathlib.Path(self.config.maildir) / 'new'
-        wm.add_watch(str(ndir.resolve()), pyinotify.IN_CREATE)
+        wm.add_watch(str(ndir.resolve()), pyinotify.IN_CREATE | pyinotify.IN_MOVED_TO)
 
     def stop_inotifier(self):
         '''
-- 
2.25.1




More information about the Remail mailing list