[geary/wip/156-mailbox-not-exist: 1/2] Only throw an error when an IMAP command returns BAD, not NO
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/156-mailbox-not-exist: 1/2] Only throw an error when an IMAP command returns BAD, not NO
- Date: Sun, 31 Mar 2019 15:02:53 +0000 (UTC)
commit d6e19352f99dc9be4b01809b47d5c6b935cec7bf
Author: Michael Gratton <mike vee net>
Date: Sat Mar 30 18:58:41 2019 +1100
Only throw an error when an IMAP command returns BAD, not NO
Fixes bailing out when a STATUS returns BAD due to a mailbox not
existing.
src/engine/imap/command/imap-command.vala | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
---
diff --git a/src/engine/imap/command/imap-command.vala b/src/engine/imap/command/imap-command.vala
index 76964b17..990b0fc9 100644
--- a/src/engine/imap/command/imap-command.vala
+++ b/src/engine/imap/command/imap-command.vala
@@ -243,9 +243,17 @@ public class Geary.Imap.Command : BaseObject {
);
}
+ check_has_status();
+
// Since this is part of the public API, perform a strict
// check on the status code.
- check_status(true);
+ if (this.status.status == Status.BAD) {
+ throw new ImapError.SERVER_ERROR(
+ "%s: Command failed: %s",
+ to_brief_string(),
+ this.status.to_string()
+ );
+ }
}
public virtual string to_string() {
@@ -276,9 +284,8 @@ public class Geary.Imap.Command : BaseObject {
this.response_timer.reset();
this.complete_lock.blind_notify();
cancel_send();
- // Since this gets called by the client connection only check
- // for an expected server response, good or bad
- check_status(false);
+
+ check_has_status();
}
/**
@@ -340,7 +347,7 @@ public class Geary.Imap.Command : BaseObject {
}
}
- private void check_status(bool require_okay) throws ImapError {
+ private void check_has_status() throws ImapError {
if (this.status == null) {
throw new ImapError.SERVER_ERROR(
"%s: No command response was received",
@@ -355,16 +362,6 @@ public class Geary.Imap.Command : BaseObject {
this.status.to_string()
);
}
-
- // XXX should we be distinguishing between NO and BAD
- // responses here?
- if (require_okay && this.status.status != Status.OK) {
- throw new ImapError.SERVER_ERROR(
- "%s: Command failed: %s",
- to_brief_string(),
- this.status.to_string()
- );
- }
}
private string to_brief_string() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]