19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#import "MTXClient.h"
#import "MTXRequest.h"
#import "MTXLoginFailedException.h"
#import "MTXLogoutFailedException.h"
static void
validateHomeserver(OFURL *homeserver)
{
if (![homeserver.scheme isEqual: @"http"] &&
|
>
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#import "MTXClient.h"
#import "MTXRequest.h"
#import "MTXFetchRoomListFailedException.h"
#import "MTXLoginFailedException.h"
#import "MTXLogoutFailedException.h"
static void
validateHomeserver(OFURL *homeserver)
{
if (![homeserver.scheme isEqual: @"http"] &&
|
197
198
199
200
201
202
203
204
205
206
207
|
statusCode: statusCode
response: response]);
return;
}
block(nil);
}];
objc_autoreleasePoolPop(pool);
}
@end
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
statusCode: statusCode
response: response]);
return;
}
block(nil);
}];
objc_autoreleasePoolPop(pool);
}
- (void)asyncFetchRoomList: (mtx_client_room_list_block_t)block
{
void *pool = objc_autoreleasePoolPush();
MTXRequest *request =
[self requestWithPath: @"/_matrix/client/r0/joined_rooms"];
[request asyncPerformWithBlock: ^ (mtx_response_t response,
int statusCode, id exception) {
if (exception != nil) {
block(nil, exception);
return;
}
if (statusCode != 200 || response[@"joined_rooms"] == nil) {
block(nil, [MTXFetchRoomListFailedException
exceptionWithClient: self
statusCode: statusCode
response: response]);
return;
}
block(response[@"joined_rooms"], nil);
}];
objc_autoreleasePoolPop(pool);
}
@end
|