44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
OFURL *homeserver = [OFURL URLWithString: environment[@"OBJMATRIX_HS"]];
[MTXClient logInWithUser: environment[@"OBJMATRIX_USER"]
password: environment[@"OBJMATRIX_PASS"]
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]];
[OFApplication terminateWithStatus: 1];
}
[of_stdout writeFormat: @"Logged in client: %@\n", client];
[OFApplication terminate];
}];
}
@end
|
|
<
<
<
<
<
|
>
>
>
>
>
>
>
>
>
|
>
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
OFURL *homeserver = [OFURL URLWithString: environment[@"OBJMATRIX_HS"]];
[MTXClient logInWithUser: environment[@"OBJMATRIX_USER"]
password: environment[@"OBJMATRIX_PASS"]
homeserver: homeserver
block: ^ (MTXClient *client, id exception) {
if (exception != nil) {
of_log(@"Error logging in: %@", exception);
[OFApplication terminateWithStatus: 1];
}
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
|