LANYINGDevelopers
Web & Mini ProgramiOSAndroidC++Server API

floo::BMXConversation#

Conversation

#include <bmx_conversation.h>

Inherits from BMXBaseObject

Public Types#

Name
enum classType { Single, Group, System}
Conversation type
enum classDirection { Up, Down}
Message search direction

Public Functions#

Name
virtual~BMXConversation()
Destructor
virtual int64_tconversationId() =0
Conversation Id
virtual Typetype() =0
Conversation type
virtual BMXMessagePtrlastMsg() =0
Latest message
virtual int32_tunreadNumber() =0
Number of unread messages
virtual int32_tmessageCount() =0
Total number of messages in conversation
virtual boolisMuteNotification() =0
Whether the user is alerted to the message, without which the conversation total number of unread messages does not count this conversation.
virtual const JSON &extension() =0
Extension information
virtual BMXErrorCodesetExtension(const std::string & ext) =0
Set the Extension information
virtual const std::string &editMessage() =0
Edit message
virtual BMXErrorCodesetEditMessage(const std::string & editMessage) =0
Set the Edit Message
virtual BMXErrorCodesetMessagePlayedStatus(BMXMessagePtr msg, bool status) =0
Set message playback state (valid only for voice/video messages)
virtual BMXErrorCodesetMessageReadStatus(BMXMessagePtr msg, bool status) =0
Set message unread state, update unread message-number
virtual BMXErrorCodesetAllMessagesRead() =0
Set all messages to read, update number of unread messages
virtual BMXErrorCodeupdateMessageExtension(BMXMessagePtr msg) =0
Update the extend field info of a database-stored message
virtual BMXErrorCodeinsertMessage(BMXMessagePtr msg) =0
Insert a message
virtual BMXMessagePtrloadMessage(int64_t msgId) =0
Read a message
virtual BMXErrorCoderemoveAllMessages() =0
Delete all messages in sesstion
virtual BMXErrorCodeloadMessages(int64_t refMsgId, size_t size, BMXMessageList & result, Direction =Direction::Up) =0
Load message, starting with latest if not specified
virtual BMXErrorCodesearchMessagesByKeyWords(const std::string & keywords, int64_t refTime, size_t size, BMXMessageList & result, Direction =Direction::Up) =0
Search for messages, starting with latest if not specified
virtual BMXErrorCodesearchMessages(const std::string & keywords, int64_t refTime, size_t size, BMXMessageList & result, Direction =Direction::Up) =0
Deprecated.
virtual BMXErrorCodesearchMessagesByType(BMXMessage::ContentType type, int64_t refTime, size_t size, BMXMessageList & result, Direction =Direction::Up) =0
Search for messages by type, starting with latest if not specified
virtual BMXErrorCodesearchMessages(BMXMessage::ContentType type, int64_t refTime, size_t size, BMXMessageList & result, Direction =Direction::Up) =0
Deprecated.
virtual BMXErrorCoderefreshConversation() =0
Read the total message-number from current conversation of the database, forces to update the total message-number and unread message-number.

Protected Functions#

Public Types Documentation#

enum Type#

EnumeratorValueDescription
SingleSingle chat
GroupGroup chat
SystemSystem notification

Conversation type

enum Direction#

EnumeratorValueDescription
UpFetch older messages
DownFetch newer message

Message search direction

Public Functions Documentation#

function ~BMXConversation#

inline virtual ~BMXConversation()

Destructor

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="~BMXConversation" %}{% endlanying_code_snippet %}

function conversationId#

virtual int64_t conversationId() =0

Conversation Id

Return: int64_t

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="conversationId" %}{% endlanying_code_snippet %}

function type#

virtual Type type() =0

Conversation type

Return: Type

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="type" %}{% endlanying_code_snippet %}

function lastMsg#

virtual BMXMessagePtr lastMsg() =0

Latest message

Return: BMXMessagePtr

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="lastMsg" %}{% endlanying_code_snippet %}

function unreadNumber#

virtual int32_t unreadNumber() =0

Number of unread messages

Return: int32_t

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="unreadNumber" %}{% endlanying_code_snippet %}

function messageCount#

virtual int32_t messageCount() =0

Total number of messages in conversation

Return: int32_t

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="messageCount" %}{% endlanying_code_snippet %}

function isMuteNotification#

virtual bool isMuteNotification() =0

Whether the user is alerted to the message, without which the conversation total number of unread messages does not count this conversation.

Return: bool

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="isMuteNotification" %}{% endlanying_code_snippet %}

function extension#

virtual const JSON & extension() =0

Extension information

Return: JSON(std::string)

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="extension" %}{% endlanying_code_snippet %}

function setExtension#

virtual BMXErrorCode setExtension(
    const std::string & ext
) =0

Set the Extension information

Parameters:

  • ext Conversation extension message

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="setExtension" %}{% endlanying_code_snippet %}

function editMessage#

virtual const std::string & editMessage() =0

Edit message

Return: std::string

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="editMessage" %}{% endlanying_code_snippet %}

function setEditMessage#

virtual BMXErrorCode setEditMessage(
    const std::string & editMessage
) =0

Set the Edit Message

Parameters:

  • editMessage Text message being edited by conversation

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="setEditMessage" %}{% endlanying_code_snippet %}

function setMessagePlayedStatus#

virtual BMXErrorCode setMessagePlayedStatus(
    BMXMessagePtr msg,
    bool status
) =0

Set message playback state (valid only for voice/video messages)

Parameters:

  • msg Message for which playback state needs to be set
  • status Whether the message has been played

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="setMessagePlayedStatus" %}{% endlanying_code_snippet %}

function setMessageReadStatus#

virtual BMXErrorCode setMessageReadStatus(
    BMXMessagePtr msg,
    bool status
) =0

Set message unread state, update unread message-number

Parameters:

  • msg Message for which the read state needs to be set
  • status Whether the message is set to read

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="setMessageReadStatus" %}{% endlanying_code_snippet %}

function setAllMessagesRead#

virtual BMXErrorCode setAllMessagesRead() =0

Set all messages to read, update number of unread messages

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="setAllMessagesRead" %}{% endlanying_code_snippet %}

function updateMessageExtension#

virtual BMXErrorCode updateMessageExtension(
    BMXMessagePtr msg
) =0

Update the extend field info of a database-stored message

Parameters:

  • msg The message that needs to change the extension information when the msg section has updated its extension field

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="updateMessageExtension" %}{% endlanying_code_snippet %}

function insertMessage#

virtual BMXErrorCode insertMessage(
    BMXMessagePtr msg
) =0

Insert a message

Parameters:

  • msg Inserted message

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="insertMessage" %}{% endlanying_code_snippet %}

function loadMessage#

virtual BMXMessagePtr loadMessage(
    int64_t msgId
) =0

Read a message

Parameters:

  • msgId Message id of the message to read

Return: BMXMessagePtr

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="loadMessage" %}{% endlanying_code_snippet %}

function removeAllMessages#

virtual BMXErrorCode removeAllMessages() =0

Delete all messages in sesstion

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="removeAllMessages" %}{% endlanying_code_snippet %}

function loadMessages#

virtual BMXErrorCode loadMessages(
    int64_t refMsgId,
    size_t size,
    BMXMessageList & result,
    Direction  =Direction::Up
) =0

Load message, starting with latest if not specified

Parameters:

  • refMsgId Start id of the message to load
  • size Maximum number of searched messages
  • result List of loaded messages returned by database
  • Direction Message loading direction, default to load earlier messages

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="loadMessages" %}{% endlanying_code_snippet %}

function searchMessagesByKeyWords#

virtual BMXErrorCode searchMessagesByKeyWords(
    const std::string & keywords,
    int64_t refTime,
    size_t size,
    BMXMessageList & result,
    Direction  =Direction::Up
) =0

Search for messages, starting with latest if not specified

Parameters:

  • keywords Keyword for search message
  • refTime Start time of message search
  • size Maximum number of searched messages
  • result List of searched message results
  • Direction Message search direction, default (Direction::Up)means search from earlier messages.

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="searchMessagesByKeyWords" %}{% endlanying_code_snippet %}

function searchMessages#

virtual BMXErrorCode searchMessages(
    const std::string & keywords,
    int64_t refTime,
    size_t size,
    BMXMessageList & result,
    Direction  =Direction::Up
) =0

Deprecated.

Parameters:

  • keywords Keyword for search message
  • refTime Start time of message search
  • size Maximum number of searched messages
  • result List of searched message results
  • Direction Message search direction, default (Direction::Up)means search from earlier messages.

Return: BMXErrorCode

use searchMessagesByKeyWords instead.

Search for messages, starting with latest if not specified

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="searchMessages" %}{% endlanying_code_snippet %}

function searchMessagesByType#

virtual BMXErrorCode searchMessagesByType(
    BMXMessage::ContentType type,
    int64_t refTime,
    size_t size,
    BMXMessageList & result,
    Direction  =Direction::Up
) =0

Search for messages by type, starting with latest if not specified

Parameters:

  • type Type of search message
  • refTime Start time of message search
  • size Maximum number of searched messages
  • result List of searched message results
  • Direction Message search direction, default (Direction::Up)means search from earlier messages.

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="searchMessagesByType" %}{% endlanying_code_snippet %}

function searchMessages#

virtual BMXErrorCode searchMessages(
    BMXMessage::ContentType type,
    int64_t refTime,
    size_t size,
    BMXMessageList & result,
    Direction  =Direction::Up
) =0

Deprecated.

Parameters:

  • type Type of search message
  • refTime Start time of message search
  • size Maximum number of searched messages
  • result List of searched message results
  • Direction Message search direction, default (Direction::Up)means search from earlier messages.

Return: BMXErrorCode

use searchMessagesByType instead.

Search for messages by type, starting with latest if not specified

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="searchMessages" %}{% endlanying_code_snippet %}

function refreshConversation#

virtual BMXErrorCode refreshConversation() =0

Read the total message-number from current conversation of the database, forces to update the total message-number and unread message-number.

Return: BMXErrorCode

Protected Functions Documentation#

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="refreshConversation" %}{% endlanying_code_snippet %}

function BMXConversation#

inline BMXConversation()

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXConversation",function="BMXConversation" %}{% endlanying_code_snippet %}

Updated on 2022-01-26 at 17:20:40 +0800

Generated API content with concise AI notes where context helps.