Geary.Imap: Make command cancellable a property of the command object
Since both submitting a command no longer requires a cancellable, and it is desirable to avoid sending a queued command that has already been cancelled beforehand, add a new `Command.should_send` Cancellable property to specify if a command should (still) be sent or not, and stop passing a cancellable to ClientSession when submitting commands. Allow call sites to pass in existing cancellable objects, and thus also add it it as a ctor property to the Command class and all subclasses. Lastly, throw a cancelled exception in `wait_until_complete` if send was cancelled so that the caller knows what happened. Remove redundant cancellable argument from `Imap.Client.command_transaction_async` and rename it to `submit_command` to make it more obvious about what it does.
This commit is contained in:
parent
67f0678b1d
commit
85e9046c71
33 changed files with 382 additions and 189 deletions
|
|
@ -16,7 +16,7 @@ class Geary.Imap.CreateCommandTest : TestCase {
|
|||
|
||||
public void basic_create() throws Error {
|
||||
assert_equal(
|
||||
new CreateCommand(new MailboxSpecifier("owatagusiam/")).to_string(),
|
||||
new CreateCommand(new MailboxSpecifier("owatagusiam/"), null).to_string(),
|
||||
"---- create owatagusiam/"
|
||||
);
|
||||
}
|
||||
|
|
@ -25,7 +25,8 @@ class Geary.Imap.CreateCommandTest : TestCase {
|
|||
assert_equal(
|
||||
new CreateCommand.special_use(
|
||||
new MailboxSpecifier("Everything"),
|
||||
ALL_MAIL
|
||||
ALL_MAIL,
|
||||
null
|
||||
).to_string(),
|
||||
"---- create Everything (use (\\All))"
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue