MTXClient: Add support for logging out

FossilOrigin-Name: c29845b7b81229ea7bf062304824a4087c160629216064ae1a647fe8286826bb
This commit is contained in:
Jonathan Schleifer 2020-10-03 16:21:34 +00:00
parent 023ed62f5a
commit 77a2d20fc7
11 changed files with 209 additions and 25 deletions

View file

@ -48,17 +48,22 @@ OF_APPLICATION_DELEGATE(Tests)
homeserver: homeserver
block: ^ (MTXClient *client, id exception) {
if (exception != nil) {
[of_stdout writeFormat: @"Error logging in: %@\n",
exception];
if ([exception isKindOfClass:
MTXLoginFailedException.class])
[of_stdout writeFormat: @"Response: %@\n",
[exception response]];
of_log(@"Error logging in: %@", exception);
[OFApplication terminateWithStatus: 1];
}
[of_stdout writeFormat: @"Logged in client: %@\n", client];
[OFApplication terminate];
of_log(@"Logged in client: %@", client);
[client asyncLogOutWithBlock: ^ (id exception) {
if (exception != nil) {
of_log(@"Failed to log out: %@\n", exception);
[OFApplication terminateWithStatus: 1];
}
of_log(@"Logged out client");
[OFApplication terminate];
}];
}];
}
@end