[geary/mjog/imap-connection-fixes: 95/110] Update Geary.Imap.Command API
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/imap-connection-fixes: 95/110] Update Geary.Imap.Command API
- Date: Sat, 21 Mar 2020 07:20:37 +0000 (UTC)
commit 5e5ff82e5d9ffcf5115500ccb06d9322118f1788
Author: Michael Gratton <mike vee net>
Date: Sun Dec 29 12:32:45 2019 +1030
Update Geary.Imap.Command API
Make the class abstract, since it only gets used by subclases. Allow
a null cancellable when waiting for the command to complete.
src/engine/imap/command/imap-command.vala | 6 +++---
test/engine/imap/transport/imap-client-connection-test.vala | 12 ++++++++++--
2 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/engine/imap/command/imap-command.vala b/src/engine/imap/command/imap-command.vala
index 570fe3ba..58163671 100644
--- a/src/engine/imap/command/imap-command.vala
+++ b/src/engine/imap/command/imap-command.vala
@@ -17,7 +17,7 @@
*
* See [[http://tools.ietf.org/html/rfc3501#section-6]]
*/
-public class Geary.Imap.Command : BaseObject {
+public abstract class Geary.Imap.Command : BaseObject {
/**
* Default timeout to wait for a server response for a command.
@@ -97,7 +97,7 @@ public class Geary.Imap.Command : BaseObject {
*
* @see Tag
*/
- public Command(string name, string[]? args = null) {
+ protected Command(string name, string[]? args = null) {
this.tag = Tag.get_unassigned();
this.name = name;
if (args != null) {
@@ -250,7 +250,7 @@ public class Geary.Imap.Command : BaseObject {
* cancelled, if the command timed out, or if the command's
* response was bad.
*/
- public async void wait_until_complete(GLib.Cancellable cancellable)
+ public async void wait_until_complete(GLib.Cancellable? cancellable)
throws GLib.Error {
yield this.complete_lock.wait_async(cancellable);
diff --git a/test/engine/imap/transport/imap-client-connection-test.vala
b/test/engine/imap/transport/imap-client-connection-test.vala
index 56f6029b..c98f0dc5 100644
--- a/test/engine/imap/transport/imap-client-connection-test.vala
+++ b/test/engine/imap/transport/imap-client-connection-test.vala
@@ -8,6 +8,14 @@
class Geary.Imap.ClientConnectionTest : TestCase {
+ private class TestCommand : Command {
+
+ public TestCommand() {
+ base("TEST");
+ }
+
+ }
+
private TestServer? server = null;
@@ -88,7 +96,7 @@ class Geary.Imap.ClientConnectionTest : TestCase {
assert_true(test_article.is_in_idle(), "Post idle command timeout");
- var command = new Command("TEST");
+ var command = new TestCommand();
test_article.send_command(command);
command.wait_until_complete.begin(null, this.async_complete_full);
command.wait_until_complete.end(async_result());
@@ -121,7 +129,7 @@ class Geary.Imap.ClientConnectionTest : TestCase {
test_article.connect_async.begin(null, this.async_complete_full);
test_article.connect_async.end(async_result());
- var command = new Command("TEST");
+ var command = new TestCommand();
command.response_timed_out.connect(() => { timed_out = true; });
test_article.send_command(command);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]