From 5a3717ef847517c3e1a903badd31bf12831a7171 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 22 Jul 2018 16:02:55 +0200 Subject: Expect BYE from server and return gracefully Signed-off-by: Florian Pritz --- lib/App/ImapNotify.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/App') diff --git a/lib/App/ImapNotify.pm b/lib/App/ImapNotify.pm index cd81538..c67c903 100644 --- a/lib/App/ImapNotify.pm +++ b/lib/App/ImapNotify.pm @@ -89,9 +89,10 @@ method loop_reconnect() { Open a connection and wait for NOTIFY notifications. When a NOTIFY notification arrives, show a notification to the user. -This method throws an exception when the connection to the server is lost. If -you want to continue waiting for new notifications, you may call this method -again. Also look at loop_reconnect(). +This method either returns when the server closes the connection or throws an +exception when the connection to the server is lost. If you want to continue +waiting for new notifications, you may call this method again. Also look at +loop_reconnect(). =cut @@ -124,6 +125,7 @@ method loop() { next if $line =~ /\* \d+ RECENT/; next if $line =~ /\* \d+ EXISTS/; next if $line =~ /\* \d+ EXPUNGE/; + last if $line =~ /\* BYE /; confess(sprintf("Got unexpected line: '%s'", $line)); } -- cgit v1.2.3-24-g4f1b