Add support for leaving rooms

FossilOrigin-Name: 193ebad6ad2eb698fb1c14250d1319d24ee42363dbc2a053ca6e9f5f600048f2
This commit is contained in:
Jonathan Schleifer 2020-10-03 17:50:07 +00:00
parent 54f1802e89
commit 191a6412ae
7 changed files with 186 additions and 2 deletions

View file

@ -80,15 +80,31 @@ OF_APPLICATION_DELEGATE(Tests)
- (void)joinRoom
{
[_client joinRoom: @"#test:nil.im"
OFString *room = @"#test:nil.im";
[_client joinRoom: room
block: ^ (OFString *roomID, id exception) {
if (exception != nil) {
of_log(@"Failed to join room: %@", exception);
of_log(@"Failed to join room %@: %@", room, exception);
[OFApplication terminateWithStatus: 1];
}
of_log(@"Joined room %@", roomID);
[self leaveRoom: roomID];
}];
}
- (void)leaveRoom: (OFString *)roomID
{
[_client leaveRoom: roomID
block: ^ (id exception) {
if (exception != nil) {
of_log(@"Failed to leave room %@: %@", exception);
[OFApplication terminateWithStatus: 1];
}
of_log(@"Left room %@", roomID);
[self logOut];
}];
}