File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -1583,6 +1583,21 @@ NS_REFINED_FOR_SWIFT;
15831583 success : (void (^)(void ))success
15841584 failure : (void (^)(NSError *error))failure ;
15851585
1586+ /* *
1587+ Report a room.
1588+
1589+ @param roomId the id of the room.
1590+ @param reason the redaction reason (optional).
1591+
1592+ @param success A block object called when the operation succeeds.
1593+ @param failure A block object called when the operation fails.
1594+
1595+ @return a MXHTTPOperation instance.
1596+ */
1597+ -(MXHTTPOperation *)reportRoom : (NSString *)roomId
1598+ reason : (NSString *)reason
1599+ success : (void (^)(void ))success
1600+ failure : (void (^)(NSError *))failure ;
15861601
15871602/* *
15881603 Report an event.
Original file line number Diff line number Diff line change @@ -3091,6 +3091,29 @@ - (MXHTTPOperation*)redactEvent:(NSString*)eventId
30913091 }
30923092 failure: ^(NSError *error) {
30933093 MXStrongifyAndReturnIfNil (self);
3094+ [self dispatchFailure: error inBlock: failure];
3095+ }];
3096+ }
3097+
3098+ -(MXHTTPOperation *)reportRoom : (NSString *)roomId
3099+ reason : (NSString *)reason
3100+ success : (void (^)(void ))success
3101+ failure : (void (^)(NSError *))failure
3102+ {
3103+ NSString *path = [NSString stringWithFormat: @" %@ /org.matrix.msc4151/rooms/%@ /report" , kMXAPIPrefixPathUnstable , roomId];
3104+
3105+ NSDictionary *parameters = @{ @" reason" : reason.length > 0 ? reason : @" " };
3106+
3107+ MXWeakify (self);
3108+ return [httpClient requestWithMethod: @" POST"
3109+ path: path
3110+ parameters: parameters
3111+ success: ^(NSDictionary *JSONResponse) {
3112+ MXStrongifyAndReturnIfNil (self);
3113+ [self dispatchSuccess: success];
3114+ }
3115+ failure: ^(NSError *error) {
3116+ MXStrongifyAndReturnIfNil (self);
30943117 [self dispatchFailure: error inBlock: failure];
30953118 }];
30963119}
You can’t perform that action at this time.
0 commit comments