floo::BMXConversation

Conversation

#include <bmx_conversation.h>

Inherits from BMXBaseObject

Public Types

Name
enum class Type { Single, Group, System}
Conversation type
enum class Direction { Up, Down}
Message search direction

Public Functions

Name
virtual ~BMXConversation()
Destructor
virtual int64_t conversationId() =0
Conversation Id
virtual Type type() =0
Conversation type
virtual BMXMessagePtr lastMsg() =0
Latest message
virtual int32_t unreadNumber() =0
Number of unread messages
virtual int32_t messageCount() =0
Total number of messages in conversation
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.
virtual const JSON & extension() =0
Extension information
virtual BMXErrorCode setExtension(const std::string & ext) =0
Set the Extension information
virtual const std::string & editMessage() =0
Edit message
virtual BMXErrorCode setEditMessage(const std::string & editMessage) =0
Set the Edit Message
virtual BMXErrorCode setMessagePlayedStatus(BMXMessagePtr msg, bool status) =0
Set message playback state (valid only for voice/video messages)
virtual BMXErrorCode setMessageReadStatus(BMXMessagePtr msg, bool status) =0
Set message unread state, update unread message-number
virtual BMXErrorCode setAllMessagesRead() =0
Set all messages to read, update number of unread messages
virtual BMXErrorCode updateMessageExtension(BMXMessagePtr msg) =0
Update the extend field info of a database-stored message
virtual BMXErrorCode insertMessage(BMXMessagePtr msg) =0
Insert a message
virtual BMXMessagePtr loadMessage(int64_t msgId) =0
Read a message
virtual BMXErrorCode removeAllMessages() =0
Delete all messages in sesstion
virtual BMXErrorCode loadMessages(int64_t refMsgId, size_t size, BMXMessageList & result, Direction =Direction::Up) =0
Load message, starting with latest if not specified
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
virtual BMXErrorCode searchMessages(const std::string & keywords, int64_t refTime, size_t size, BMXMessageList & result, Direction =Direction::Up) =0
Deprecated.
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
virtual BMXErrorCode searchMessages(BMXMessage::ContentType type, int64_t refTime, size_t size, BMXMessageList & result, Direction =Direction::Up) =0
Deprecated.
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.

Protected Functions

Name
BMXConversation()

Public Types Documentation

enum Type

Enumerator Value Description
Single Single chat
Group Group chat
System System notification

Conversation type

enum Direction

Enumerator Value Description
Up Fetch older message
Down Fetch newer message

Message search direction

Public Functions Documentation

function ~BMXConversation

inline virtual ~BMXConversation()

Destructor

Example:

function conversationId

virtual int64_t conversationId() =0

Conversation Id

Return: int64_t

Example:

function type

virtual Type type() =0

Conversation type

Return: Type

Example:

function lastMsg

virtual BMXMessagePtr lastMsg() =0

Latest message

Return: BMXMessagePtr

Example:

if (left->lastMsg() && right->lastMsg()) {
return left->lastMsg()->serverTimestamp() > right->lastMsg()->serverTimestamp();
} else if (left->lastMsg()) {

function unreadNumber

virtual int32_t unreadNumber() =0

Number of unread messages

Return: int32_t

Example:

function messageCount

virtual int32_t messageCount() =0

Total number of messages in conversation

Return: int32_t

Example:

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:

function extension

virtual const JSON & extension() =0

Extension information

Return: JSON(std::string)

Example:

function setExtension

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

Set the Extension information

Parameters:

  • ext Conversation extension message

Return: BMXErrorCode

Example:

function editMessage

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

Edit message

Return: std::string

Example:

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:

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:

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:

function setAllMessagesRead

virtual BMXErrorCode setAllMessagesRead() =0

Set all messages to read, update number of unread messages

Return: BMXErrorCode

Example:

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:

function insertMessage

virtual BMXErrorCode insertMessage(
    BMXMessagePtr msg
) =0

Insert a message

Parameters:

  • msg Inserted message

Return: BMXErrorCode

Example:

function loadMessage

virtual BMXMessagePtr loadMessage(
    int64_t msgId
) =0

Read a message

Parameters:

  • msgId Message id of the message to read

Return: BMXMessagePtr

Example:

function removeAllMessages

virtual BMXErrorCode removeAllMessages() =0

Delete all messages in sesstion

Return: BMXErrorCode

Example:

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:

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:

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:

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:

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:

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:

function BMXConversation

inline BMXConversation()

Example:


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

© 2019-2024 MaximTop | Homepage | Site Map Last modified time: 2024-09-26 03:17:35

results matching ""

    No results matching ""