[geary/mjog/711-home-pl-compat: 10/10] imap: Ignore UIDNEXT 0 values sent from servers
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/711-home-pl-compat: 10/10] imap: Ignore UIDNEXT 0 values sent from servers
- Date: Sun, 22 Mar 2020 04:50:00 +0000 (UTC)
commit 3b7919055166914829d933d0f508ff75566f7680
Author: Michael Gratton <mike vee net>
Date: Wed Mar 18 23:59:35 2020 +1100
imap: Ignore UIDNEXT 0 values sent from servers
Some mail servers e.g hMailServer and whatever is used by home.pl
(dovecot?) sends UIDNEXT 0. Just ignore these since there nothing else
that can be done.
See #711
src/engine/imap/api/imap-folder-session.vala | 15 ++++++++++++++-
src/engine/imap/response/imap-status-data.vala | 21 ++++++++++++++++++---
2 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/src/engine/imap/api/imap-folder-session.vala b/src/engine/imap/api/imap-folder-session.vala
index c94da4bc..e83f2f50 100644
--- a/src/engine/imap/api/imap-folder-session.vala
+++ b/src/engine/imap/api/imap-folder-session.vala
@@ -253,7 +253,20 @@ private class Geary.Imap.FolderSession : Geary.Imap.SessionObject {
break;
case ResponseCodeType.UIDNEXT:
- this.folder.properties.uid_next = response_code.get_uid_next();
+ try {
+ this.folder.properties.uid_next = response_code.get_uid_next();
+ } catch (ImapError.INVALID err) {
+ // Some mail servers e.g hMailServer and
+ // whatever is used by home.pl (dovecot?)
+ // sends UIDNEXT 0. Just ignore these since
+ // there nothing else that can be done. See
+ // GNOME/geary#711
+ if (response_code.get_as_string(1).as_int64() == 0) {
+ warning("Ignoring bad UIDNEXT 0 from server");
+ } else {
+ throw err;
+ }
+ }
break;
case ResponseCodeType.UIDVALIDITY:
diff --git a/src/engine/imap/response/imap-status-data.vala b/src/engine/imap/response/imap-status-data.vala
index 9c1786e9..40d897f9 100644
--- a/src/engine/imap/response/imap-status-data.vala
+++ b/src/engine/imap/response/imap-status-data.vala
@@ -101,7 +101,20 @@ public class Geary.Imap.StatusData : Object {
break;
case StatusDataType.UIDNEXT:
- uid_next = new UID.checked(valuep.as_int64());
+ try {
+ uid_next = new UID.checked(valuep.as_int64());
+ } catch (ImapError.INVALID err) {
+ // Some mail servers e.g hMailServer and
+ // whatever is used by home.pl (dovecot?)
+ // sends UIDNEXT 0. Just ignore these
+ // since there nothing else that can be
+ // done. See GNOME/geary#711
+ if (valuep.as_int64() == 0) {
+ warning("Ignoring bad UIDNEXT 0 from server");
+ } else {
+ throw err;
+ }
+ }
break;
case StatusDataType.UIDVALIDITY:
@@ -118,8 +131,10 @@ public class Geary.Imap.StatusData : Object {
break;
}
} catch (ImapError ierr) {
- message("Bad value at %d/%d in STATUS response \"%s\": %s", ctr, ctr + 1,
- server_data.to_string(), ierr.message);
+ warning(
+ "Bad value at %d/%d in STATUS response \"%s\": %s",
+ ctr, ctr + 1, server_data.to_string(), ierr.message
+ );
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]