Geary.Imap: Add Quirks object to collect all IMAP service quirk config

This commit is contained in:
Michael Gratton 2020-05-01 15:40:18 +10:00 committed by Michael James Gratton
parent 865765a24f
commit ddb3a899fb
12 changed files with 73 additions and 24 deletions

View file

@ -38,7 +38,7 @@ class Geary.Imap.ClientConnectionTest : TestCase {
}
public void connect_disconnect() throws GLib.Error {
var test_article = new ClientConnection(new_endpoint());
var test_article = new ClientConnection(new_endpoint(), new Quirks());
test_article.connect_async.begin(null, this.async_completion);
test_article.connect_async.end(async_result());
@ -69,7 +69,7 @@ class Geary.Imap.ClientConnectionTest : TestCase {
const int IDLE_TIMEOUT = 1;
var test_article = new ClientConnection(
new_endpoint(), COMMAND_TIMEOUT, IDLE_TIMEOUT
new_endpoint(), new Quirks(), COMMAND_TIMEOUT, IDLE_TIMEOUT
);
test_article.connect_async.begin(null, this.async_completion);
test_article.connect_async.end(async_result());
@ -123,7 +123,9 @@ class Geary.Imap.ClientConnectionTest : TestCase {
bool recv_fail = false;
bool timed_out = false;
var test_article = new ClientConnection(new_endpoint(), TIMEOUT);
var test_article = new ClientConnection(
new_endpoint(), new Quirks(), TIMEOUT
);
test_article.sent_command.connect(() => { sent = true; });
test_article.receive_failure.connect(() => { recv_fail = true; });
test_article.connect_async.begin(null, this.async_completion);

View file

@ -43,7 +43,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
);
this.server.add_script_line(WAIT_FOR_DISCONNECT, "");
var test_article = new ClientSession(new_endpoint());
var test_article = new ClientSession(new_endpoint(), new Quirks());
assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin(
@ -69,7 +69,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
);
this.server.add_script_line(WAIT_FOR_DISCONNECT, "");
var test_article = new ClientSession(new_endpoint());
var test_article = new ClientSession(new_endpoint(), new Quirks());
test_article.connect_async.begin(
CONNECT_TIMEOUT, null, this.async_completion
);
@ -87,7 +87,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
public void connect_timeout() throws GLib.Error {
this.server.add_script_line(WAIT_FOR_DISCONNECT, "");
var test_article = new ClientSession(new_endpoint());
var test_article = new ClientSession(new_endpoint(), new Quirks());
GLib.Timer timer = new GLib.Timer();
timer.start();
@ -115,7 +115,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
);
this.server.add_script_line(WAIT_FOR_DISCONNECT, "");
var test_article = new ClientSession(new_endpoint());
var test_article = new ClientSession(new_endpoint(), new Quirks());
test_article.connect_async.begin(
CONNECT_TIMEOUT, null, this.async_completion
);
@ -147,7 +147,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
this.server.add_script_line(SEND_LINE, "a001 OK ohhai");
this.server.add_script_line(WAIT_FOR_DISCONNECT, "");
var test_article = new ClientSession(new_endpoint());
var test_article = new ClientSession(new_endpoint(), new Quirks());
assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin(
@ -184,7 +184,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
this.server.add_script_line(SEND_LINE, "a001 OK laters");
this.server.add_script_line(DISCONNECT, "");
var test_article = new ClientSession(new_endpoint());
var test_article = new ClientSession(new_endpoint(), new Quirks());
assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin(
@ -215,7 +215,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
this.server.add_script_line(SEND_LINE, "a002 OK laters");
this.server.add_script_line(DISCONNECT, "");
var test_article = new ClientSession(new_endpoint());
var test_article = new ClientSession(new_endpoint(), new Quirks());
assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin(
@ -260,7 +260,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
this.server.add_script_line(SEND_LINE, "a004 OK there");
this.server.add_script_line(WAIT_FOR_DISCONNECT, "");
var test_article = new ClientSession(new_endpoint());
var test_article = new ClientSession(new_endpoint(), new Quirks());
assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin(
@ -304,7 +304,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
this.server.add_script_line(SEND_LINE, "a002 OK there");
this.server.add_script_line(WAIT_FOR_DISCONNECT, "");
var test_article = new ClientSession(new_endpoint());
var test_article = new ClientSession(new_endpoint(), new Quirks());
assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin(
@ -367,7 +367,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
this.server.add_script_line(SEND_LINE, "a003 OK there");
this.server.add_script_line(WAIT_FOR_DISCONNECT, "");
var test_article = new ClientSession(new_endpoint());
var test_article = new ClientSession(new_endpoint(), new Quirks());
assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin(

View file

@ -47,7 +47,7 @@ class Geary.Imap.DeserializerTest : TestCase {
public override void set_up() {
this.stream = new MemoryInputStream();
this.deser = new Deserializer(ID, this.stream);
this.deser = new Deserializer(ID, this.stream, new Quirks());
}
public override void tear_down() {

View file

@ -28,7 +28,10 @@ class Integration.Imap.ClientSession : TestCase {
public override void set_up() {
this.session = new Geary.Imap.ClientSession(
this.config.target
this.config.target,
Geary.Imap.ClientService.new_quirks_for_provider(
this.config.provider
)
);
}