Blocklist Management
After adding a user to the blocklist, you will no longer receive any one-to-one chat messages from that user.
- Adding to the blocklist is a one-way operation. For example, if user A blocks user B, it means B cannot send messages to A (error code
405
). However, A can still send messages to B, and B will receive them normally. - There is an upper limit to the total number of users a single user can block, which depends on the pricing plan. For the Chat Premium Plan and Chat Ultimate Plan, the limit is 3000 users. For other plans, please refer to the Service Limits section in the Feature Comparison Table.
- By default, sending one-to-one messages via the server API is not restricted by the blocklist. To enable this restriction, set
verifyBlacklist
to1
when calling the API.
Add to Blocklist
Add a specified user (userId
) to the current user's blocklist. After the operation is successful, the current user can still send messages to the blocked user, but the blocked user cannot send one-to-one chat messages to the current user.
[[RCIMClient sharedRCIMClient] addToBlacklist:@"userId" success:^{
} error:^(RCErrorCode status) {
}];
Parameter | Type | Description |
---|---|---|
userId | NSString | User ID |
successBlock | Block | Callback for successful addition |
errorBlock | Block | Callback for failed addition. status returns the error code RCErrorCode. |
Remove from Blocklist
Remove a specified user (userId
) from the current user's blocklist.
[[RCIMClient sharedRCIMClient] removeFromBlacklist:@"userId" success:^{
} error:^(RCErrorCode status) {
}];
Parameter | Type | Description |
---|---|---|
userId | NSString | User ID |
successBlock | Block | Callback for successful removal |
errorBlock | Block | Callback for failed removal. status returns the error code RCErrorCode. |
Check if a User is in the Blocklist
Check if a specified user (userId
) is in the current user's blocklist based on the user ID.
[[RCIMClient sharedRCIMClient] getBlacklistStatus:@"userId" success:^(int bizStatus) {
} error:^(RCErrorCode status) {
}];
Parameter | Type | Description |
---|---|---|
userId | NSString | User ID |
successBlock | Block | Callback for successful query. bizStatus indicates whether the user is in the blocklist. 0 means the user is in the blocklist, 101 means the user is not in the blocklist. |
errorBlock | Block | Callback for failed query. status returns the error code RCErrorCode. |
Query Blocklist
Get the current user's blocklist.
[[RCIMClient sharedRCIMClient] getBlacklist:^(NSArray *blockUserIds) {
} error:^(RCErrorCode status) {
}];
Parameter | Type | Description |
---|---|---|
successBlock | Block | Callback for successful query. blockUserIds returns an NSArray containing the user IDs in the blocklist. |
errorBlock | Block | Callback for failed query. status returns the error code RCErrorCode. |