Recall Message
Recall Message
Recall a specified message. Only successfully sent messages can be recalled.
By default, RC does not restrict who can recall a message. If you need to impose restrictions, consider the following options:
- The App client can restrict who can recall messages. For example, regular users in the App's business logic may not be allowed to recall messages sent by others, while administrators can recall messages sent by others.
- To prevent users from recalling messages not sent by themselves, you can submit a ticket to enable the IMLib SDK to only allow recalling messages sent by the user themselves. This restriction is enforced by the RC server, preventing users from recalling messages not sent by themselves.
Method
Future<int> recallMessage(RCIMIWMessage message, {IRCIMIWRecallMessageCallback? callback});
Parameter Description
Parameter | Type | Description |
---|---|---|
message | RCIMIWMessage | The message to be recalled |
callback | IRCIMIWRecallMessageCallback | Event callback. The SDK supports callback methods starting from version 5.3.1. Other callback methods are deprecated as of version 5.4.0. If the callback parameter is provided, only the callback will be triggered. |
Return Value
Return Value | Description |
---|---|
Future<int> | The status code of the current operation. 0 indicates success. The specific result needs to be implemented via the interface callback. Non-zero values indicate that the current operation failed, and no callback will be triggered. Refer to the error codes for detailed errors. |
Code Example
IRCIMIWRecallMessageCallback? callback = IRCIMIWRecallMessageCallback(onMessageRecalled: (int? code, RCIMIWMessage? message) {
//...
});
int? ret = await engine?.recallMessage(message, callback:callback);
Callback Method
-
onMessageRecalled
Listener for the result of the interface call.
Function(int? code, RCIMIWMessage? message)? onMessageRecalled;
Parameter Description
Parameter | Type | Description |
---|---|---|
code | int | The status code of the callback. 0 indicates success, non-zero indicates an exception. |
message | RCIMIWMessage | The recalled message |
Code Example
engine?.onMessageRecalled = (int? code, RCIMIWMessage? message) {
//...
};
Listen to Message Recall Events
Used to listen for events where a received message has been recalled. When a received message is recalled, this listener will be triggered.
Method
Function(RCIMIWMessage? message)? onRemoteMessageRecalled;
Parameter Description
Parameter | Type | Description |
---|---|---|
message | RCIMIWMessage | The original message will be replaced with a recall message |
Code Example
engine?.onRemoteMessageRecalled = (RCIMIWMessage? message) {
//...
};