interceptOnInsertOutgoingMessage

public abstract boolean interceptOnInsertOutgoingMessage(ChannelType type, String targetId, SentStatus sentStatus, MessageContent content, long sentTime)

Called before an outgoing message is inserted into the local database.

Return

true to intercept; false to pass through

Parameters

type

channel type

targetId

target channel ID (peer ID for direct, group ID for group, etc.)

sentStatus

sent status of the message

content

message content (e.g. TextMessage, ImageMessage)

sentTime

sent timestamp from getSentTime


public boolean interceptOnInsertOutgoingMessage(ChannelType type, String targetId, SentStatus sentStatus, MessageContent content, long time, OperationHandler<Message> callback)

Called before an outgoing message is inserted, with an optional result callback.

Use this overload when you need to return an asynchronous result via the callback — for example, to attach custom metadata to an image message before insertion.

Return

true to intercept; false to pass through

Parameters

type

channel type

targetId

target channel ID

sentStatus

sent status

content

message content

time

sent timestamp

callback

callback to invoke with the modified message; call onError to signal that the message should be blocked