Chat / Unreal
Current version: v3
Chat Unreal v3
Chat Unreal
Chat
Unreal
Home
/
Chat
/
Unreal
/
Messages

Update a message

A user can update any of their own text and file messages sent. An error is returned if a user attempts to update another user's messages. In addition, channel operators can update any messages sent in the channel.

User messageFile message
// The MESSAGE_ID below indicates the unique message ID of a UserMessage object to update.
channel->UpdateUserMessage(MESSAGE, MESSAGE_TEXT, DATA, CUSTOM_TYPE, [](SBDUserMessage* userMessage, SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }

    // The message is successfully updated.
    // Through the userMessage parameter of the handler callback function,
    // you can check if the update is done correctly.
});

If a message is updated, the MessageUpdated() method in the channel event handler will be invoked on all channel participants' devices except the one that updated the message.

class MyChannelHandler : public SBDChannelHandler {
    void MessageUpdated(SBDBaseChannel* channel, SBDBaseMessage* message) {
        // Invoke when a message is updated.
    }
});

SBDMain::AddChannelHandler(UNIQUE_HANDLER_ID, new MyChannelHandler());