From 8f6b36ba462b55ea9f600e4402e10672bf2f73ef Mon Sep 17 00:00:00 2001
From: Guilhem Moulin <guilhem@fripost.org>
Date: Thu, 23 Jul 2015 19:15:22 +0200
Subject: bugfix

---
 lib/Net/IMAP/Sync.pm | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

(limited to 'lib/Net/IMAP')

diff --git a/lib/Net/IMAP/Sync.pm b/lib/Net/IMAP/Sync.pm
index 517270b..0b95276 100644
--- a/lib/Net/IMAP/Sync.pm
+++ b/lib/Net/IMAP/Sync.pm
@@ -1182,7 +1182,7 @@ sub _select_or_examine($$$) {
     $command .= " (QRESYNC ($pcache->{UIDVALIDITY} $pcache->{HIGHESTMODSEQ} "
                            ."1:".($pcache->{UIDNEXT}-1)."))"
         if $self->_enabled('QRESYNC') and
-           ($pcache->{HIGHESTMODSEQ} // 0) > 0 and ($pcache->{UIDNEXT} // 0) > 0;
+           ($pcache->{HIGHESTMODSEQ} // 0) > 0 and ($pcache->{UIDNEXT} // 0) > 1;
 
     if ($self->{_STATE} eq 'SELECTED' and ($self->_capable('CONDSTORE') or $self->_capable('QRESYNC'))) {
         # A mailbox is currently selected and the server advertizes
@@ -1198,11 +1198,8 @@ sub _select_or_examine($$$) {
     }
 
     $self->{_STATE} = 'AUTH';
-    if ($self->_send($command) eq 'OK') {
-        $self->{_STATE} = 'SELECTED';
-    } else {
-        delete $self->{_SELECTED};
-    }
+    $self->_send($command);
+    $self->{_STATE} = 'SELECTED';
 }
 
 
-- 
cgit v1.2.3