From 7b4be5a461026311dff525213316172e2f573a1e Mon Sep 17 00:00:00 2001 From: serycjon Date: Wed, 23 Oct 2019 14:11:12 +0200 Subject: [PATCH 1/2] fix hooks not being run --- imapnotify/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/imapnotify/core.py b/imapnotify/core.py index 720f5ee..d1acbbf 100644 --- a/imapnotify/core.py +++ b/imapnotify/core.py @@ -131,7 +131,10 @@ async def _select_box(self, box='INBOX'): self.boxes[box]['idle'] = asyncio.ensure_future(imap_client.idle()) def _is_new_msg(self, msg): - return 'EXISTS' in msg + # msg is list of messages + for x in msg: + if 'EXISTS' in x: + return True async def _on_new_message(self, box): command = self.boxes[box]['on_new_message'] From edb8fca1e49723d4551e7061d7d848736ece4224 Mon Sep 17 00:00:00 2001 From: serycjon Date: Wed, 23 Oct 2019 14:12:59 +0200 Subject: [PATCH 2/2] add backward compatibility --- imapnotify/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/imapnotify/core.py b/imapnotify/core.py index d1acbbf..f44d1bd 100644 --- a/imapnotify/core.py +++ b/imapnotify/core.py @@ -131,7 +131,10 @@ async def _select_box(self, box='INBOX'): self.boxes[box]['idle'] = asyncio.ensure_future(imap_client.idle()) def _is_new_msg(self, msg): - # msg is list of messages + if 'EXISTS' in msg: + return True + + # if msg is list of messages for x in msg: if 'EXISTS' in x: return True