Remove Geary.Imap.ClientSession lifecyle signals
They aren't being used, and clients should use lifecycle methods to determine these events anyway.
This commit is contained in:
parent
57a1ef3f73
commit
ca7cc04ab2
1 changed files with 21 additions and 39 deletions
|
|
@ -302,18 +302,10 @@ public class Geary.Imap.ClientSession : BaseObject, Logging.Source {
|
||||||
// Connection state changes
|
// Connection state changes
|
||||||
//
|
//
|
||||||
|
|
||||||
public signal void connected();
|
/** Emitted when the session is disconnected for any reason. */
|
||||||
|
|
||||||
public signal void session_denied(string? reason);
|
|
||||||
|
|
||||||
public signal void authorized();
|
|
||||||
|
|
||||||
public signal void logged_out();
|
|
||||||
|
|
||||||
public signal void login_failed(StatusResponse? response);
|
|
||||||
|
|
||||||
public signal void disconnected(DisconnectReason reason);
|
public signal void disconnected(DisconnectReason reason);
|
||||||
|
|
||||||
|
/** Emitted when an IMAP command status response is received. */
|
||||||
public signal void status_response_received(StatusResponse status_response);
|
public signal void status_response_received(StatusResponse status_response);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -658,17 +650,14 @@ public class Geary.Imap.ClientSession : BaseObject, Logging.Source {
|
||||||
/**
|
/**
|
||||||
* Connect to the server.
|
* Connect to the server.
|
||||||
*
|
*
|
||||||
* This performs no transaction or session initiation with the server. See {@link login_async}
|
* This performs no transaction or session initiation with the
|
||||||
* and {@link initiate_session_async} for next steps.
|
* server. See {@link login_async} and {@link
|
||||||
|
* initiate_session_async} for next steps.
|
||||||
*
|
*
|
||||||
* The signals {@link connected} or {@link session_denied} will be fired in the context of this
|
* If the connection fails (if this call throws an Error) the
|
||||||
* call, depending on the results of the connection greeting from the server. However,
|
* ClientSession will be disconnected, even if the error was from
|
||||||
* command should only be transmitted (login, initiate session, etc.) after this call has
|
* the server (that is, not a network problem). The {@link
|
||||||
* completed.
|
* ClientSession} should be discarded.
|
||||||
*
|
|
||||||
* If the connection fails (if this call throws an Error) the ClientSession will be disconnected,
|
|
||||||
* even if the error was from the server (that is, not a network problem). The
|
|
||||||
* {@link ClientSession} should be discarded.
|
|
||||||
*/
|
*/
|
||||||
public async void connect_async(GLib.Cancellable? cancellable)
|
public async void connect_async(GLib.Cancellable? cancellable)
|
||||||
throws GLib.Error {
|
throws GLib.Error {
|
||||||
|
|
@ -687,9 +676,9 @@ public class Geary.Imap.ClientSession : BaseObject, Logging.Source {
|
||||||
// connect and let ClientConnection's signals drive the show
|
// connect and let ClientConnection's signals drive the show
|
||||||
try {
|
try {
|
||||||
yield cx.connect_async(cancellable);
|
yield cx.connect_async(cancellable);
|
||||||
} catch (Error err) {
|
fsm.issue(Event.CONNECTED);
|
||||||
|
} catch (GLib.Error err) {
|
||||||
fsm.issue(Event.SEND_ERROR, null, null, err);
|
fsm.issue(Event.SEND_ERROR, null, null, err);
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1090,19 +1079,12 @@ public class Geary.Imap.ClientSession : BaseObject, Logging.Source {
|
||||||
if (!validate_state_change_cmd(completion_response))
|
if (!validate_state_change_cmd(completion_response))
|
||||||
return state;
|
return state;
|
||||||
|
|
||||||
// Remember: only you can prevent firing signals inside state transition handlers
|
uint new_state = State.AUTHORIZED;
|
||||||
switch (completion_response.status) {
|
if (completion_response.status != OK) {
|
||||||
case Status.OK:
|
debug("LOGIN failed: %s", completion_response.to_string());
|
||||||
fsm.do_post_transition(() => { authorized(); });
|
new_state = State.NOAUTH;
|
||||||
|
|
||||||
return State.AUTHORIZED;
|
|
||||||
|
|
||||||
default:
|
|
||||||
debug("LOGIN failed: %s", completion_response.to_string());
|
|
||||||
fsm.do_post_transition((resp) => { login_failed((StatusResponse)resp); }, completion_response);
|
|
||||||
|
|
||||||
return State.NOAUTH;
|
|
||||||
}
|
}
|
||||||
|
return new_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -1523,7 +1505,6 @@ public class Geary.Imap.ClientSession : BaseObject, Logging.Source {
|
||||||
|
|
||||||
if (params.proceed) {
|
if (params.proceed) {
|
||||||
yield command_transaction_async(cmd, cancellable);
|
yield command_transaction_async(cmd, cancellable);
|
||||||
logged_out();
|
|
||||||
yield do_disconnect(DisconnectReason.LOCAL_CLOSE);
|
yield do_disconnect(DisconnectReason.LOCAL_CLOSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1569,10 +1550,11 @@ public class Geary.Imap.ClientSession : BaseObject, Logging.Source {
|
||||||
private uint on_logging_out_recv_completion(uint state, uint event, void *user, Object? object) {
|
private uint on_logging_out_recv_completion(uint state, uint event, void *user, Object? object) {
|
||||||
StatusResponse completion_response = (StatusResponse) object;
|
StatusResponse completion_response = (StatusResponse) object;
|
||||||
|
|
||||||
if (!validate_state_change_cmd(completion_response))
|
uint new_state = state;
|
||||||
return state;
|
if (validate_state_change_cmd(completion_response)) {
|
||||||
|
new_state = State.CLOSED;
|
||||||
return State.CLOSED;
|
}
|
||||||
|
return new_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue