diff options
author | Florian Pritz <bluewind@xinu.at> | 2018-07-22 16:02:55 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2018-07-22 16:02:55 +0200 |
commit | 5a3717ef847517c3e1a903badd31bf12831a7171 (patch) | |
tree | 81d94ad81b2eadf28b94c78c88b5b3760db85a07 /lib | |
parent | 13cad1519b679526b2b8f5f38dd388d0ed3a4dcd (diff) | |
download | App-ImapNotify-5a3717ef847517c3e1a903badd31bf12831a7171.tar.gz App-ImapNotify-5a3717ef847517c3e1a903badd31bf12831a7171.tar.xz |
Expect BYE from server and return gracefully
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/App/ImapNotify.pm | 8 |
1 files changed, 5 insertions, 3 deletions
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)); } |