floo::BMXMessage

Message

#include <bmx_message.h>

Inherits from BMXBaseObject

Public Types

Name
enum class DeliveryStatus { New, Delivering, Deliveried, Failed, Recalled}
Messaging state
enum class MessageType { Single, Group, System}
Message type
enum class ContentType { Text, Image, Voice, Video, File, Location, Command, Forward}
Type of message content
enum class DeliveryQos { AtLastOnce, AtMostOnce, ExactlyOnce}
Messaging quality

Public Functions

Name
virtual ~BMXMessage()
Destructor
int64_t msgId()
Message unique ID
int64_t clientMsgId()
Message client ID, only exists on message sender-side
int64_t fromId()
Message sender ID
int64_t toId()
Message receiver ID
MessageType type()
Message type
int64_t conversationId()
Conversation ID that message belongs to
DeliveryStatus deliveryStatus()
Messaging state
void setDeliveryStatus(DeliveryStatus )
Set messaging state
int64_t serverTimestamp()
Message timestamp (when received by server-side)
void setServerTimestamp(int64_t )
Set message timestamp (when received by server-side)
int64_t clientTimestamp()
Local timestamp (local time when message created or received)
void setClientTimestamp(int64_t )
Set message local timestamp
bool isPlayed()
Whether voice or video message has been played, valid only for received audio/video messages
void setIsPlayed(bool )
Set whether a voice or video message has been played, valid only for received audio or video messages
bool isPlayAcked()
Means whether playback acknowledgement received for sender, and whether playback acknowledgement sent for receiver
void setIsPlayAcked(bool )
Set playback acknowledgement
bool isReceiveMsg()
Message whether to receive
void setIsReceiveMsg(bool )
Message to set receiving condition
bool isRead()
Message read or unread mark
void setIsRead(bool )
Message read or unread mark
bool isReadAcked()
Show sender whether read acknowledgement received, and show receiver whether message read acknowledgement sent
void setIsReadAcked(bool )
Set read acknowledgement
bool isDeliveryAcked()
Show sender whether message has been delivered to the other party, and show receiver whether message delivered acknowledgement has been sent
void setIsDeliveryAcked(bool )
Set delivery acknowledgement
const std::string & content()
Message text content
void setContent(const std::string & content)
Message text content
ContentType contentType()
Message content type, attachment-type with attachment, text-type with no attachment
BMXMessageAttachmentPtr attachment()
Message attachment, BMXMessage owns the attachment and is responsible for releasing it
BMXMessageConfigPtr config()
Message settings
void setConfig(BMXMessageConfigPtr )
Set message config information
const JSON & extension()
Message extension information
void setExtension(const JSON & )
Set message extension information
DeliveryQos deliveryQos()
QOS of messaging
void setDeliveryQos(DeliveryQos qos)
Set QOS of messaging
const std::string & senderName()
Display name of message sender
void setSenderName(const std::string & senderName)
Set display name of message sender
int groupAckCount()
AckCount of read group messages
void setGroupAckCount(int count)
Set groupAckCount of read messages (an SDK internal calling interface that shall not be called by upper layer)
int groupAckUnreadCount()
AckCount of unread group messages
void setGroupAckUnreadCount(int count)
Set groupAckCount of unread messages (an SDK internal calling interface that shall not be called by upper layer)
bool groupAckReadAll()
Whether all group messages are read
int groupPlayAckCount()
AckCount of played group messages (valid only for messages with audio/video attachment)
void setGroupPlayAckCount(int count)
Set groupAckCount of played messages (an SDK internal calling interface that shall not be called by upper layer) (valid only for messages with audio/video attachment)
int groupPlayAckUnreadCount()
AckCount of unplayed group messages (valid only for messages with audio/video attachment)
void setGroupPlayAckUnreadCount(int count)
Set groupAckCount of unplayed messages (an SDK internal calling interface that shall not be called by upper layer) (valid only for messages with audio/video attachment)
bool groupPlayAckReadAll()
Whether all group messages have been played
void setPriority(int priority)
Set message diffusion priority, default 0. 0 means diffusion, and the smaller the number, the more diffused.
int priority()
Message diffusion priority
void setPushMessageMode(bool )
Set whether the message is a push.
bool isPushMessage()
Whether the message is a push
BMXMessagePtr createMessage(int64_t from, int64_t to, MessageType type, int64_t conversationId, const std::string & content)
Create a text message
BMXMessagePtr createMessage(int64_t from, int64_t to, MessageType type, int64_t conversationId, BMXMessageAttachmentPtr attachment)
Create a sent-attachment message
BMXMessagePtr createCommandMessage(int64_t from, int64_t to, MessageType type, int64_t conversationId, const std::string & content)
Create a sent command message (command message holds command information in a content field or an extension field)
BMXMessagePtr createMessage(int64_t msgId, int64_t from, int64_t to, MessageType type, int64_t conversationId, const std::string & content, int64_t serverTimestamp)
Create a received message
BMXMessagePtr createMessage(int64_t msgId, int64_t from, int64_t to, MessageType type, int64_t conversationId, BMXMessageAttachmentPtr attachment, int64_t serverTimestamp)
Create a received message
BMXMessagePtr createCommandMessage(int64_t msgId, int64_t from, int64_t to, MessageType type, int64_t conversationId, const std::string & content, int64_t serverTimestamp)
Create a received command message (command message holds command information in a content field or an extension field)
BMXMessagePtr createForwardMessage(BMXMessagePtr msg, int64_t from, int64_t to, MessageType type, int64_t conversationId)
Create a forwarding message

Public Types Documentation

enum DeliveryStatus

Enumerator Value Description
New Newly created message
Delivering Message delivering
Deliveried Message delivered
Failed Message delivery failed
Recalled Message delivery canceled

Messaging state

enum MessageType

Enumerator Value Description
Single Single chat message
Group Group chat message
System System message

Message type

enum ContentType

Enumerator Value Description
Text Text message
Image Image message
Voice Voice message
Video Video clip message
File File message
Location Location message
Command Command message
Forward Forward message

Type of message content

enum DeliveryQos

Enumerator Value Description
AtLastOnce Deliver at least once
AtMostOnce Deliver at most once
ExactlyOnce Deliver only once

Messaging quality

Public Functions Documentation

function ~BMXMessage

virtual ~BMXMessage()

Destructor

Example:

function msgId

int64_t msgId()

Message unique ID

Return: int64_t

Example:

mvwaddstr(notifyWindow, 2, 1, std::to_string(msg->msgId()).c_str());

function clientMsgId

int64_t clientMsgId()

Message client ID, only exists on message sender-side

Return: int64_t

Example:

function fromId

int64_t fromId()

Message sender ID

Return: int64_t

Example:

function toId

int64_t toId()

Message receiver ID

Return: int64_t

Example:

function type

MessageType type()

Message type

Return: MessageType

Example:

function conversationId

int64_t conversationId()

Conversation ID that message belongs to

Return: int64_t

Example:

function deliveryStatus

DeliveryStatus deliveryStatus()

Messaging state

Return: DeliveryStatus

Example:

switch (msg->deliveryStatus()) {

function setDeliveryStatus

void setDeliveryStatus(
    DeliveryStatus 
)

Set messaging state

Example:

function serverTimestamp

int64_t serverTimestamp()

Message timestamp (when received by server-side)

Return: int64_t

Example:

function setServerTimestamp

void setServerTimestamp(
    int64_t 
)

Set message timestamp (when received by server-side)

Example:

function clientTimestamp

int64_t clientTimestamp()

Local timestamp (local time when message created or received)

Return: int64_t

Example:

function setClientTimestamp

void setClientTimestamp(
    int64_t 
)

Set message local timestamp

Example:

function isPlayed

bool isPlayed()

Whether voice or video message has been played, valid only for received audio/video messages

Return: bool

Example:

function setIsPlayed

void setIsPlayed(
    bool 
)

Set whether a voice or video message has been played, valid only for received audio or video messages

Example:

function isPlayAcked

bool isPlayAcked()

Means whether playback acknowledgement received for sender, and whether playback acknowledgement sent for receiver

Return: bool

Example:

function setIsPlayAcked

void setIsPlayAcked(
    bool 
)

Set playback acknowledgement

Example:

function isReceiveMsg

bool isReceiveMsg()

Message whether to receive

Return: bool

Example:

function setIsReceiveMsg

void setIsReceiveMsg(
    bool 
)

Message to set receiving condition

Example:

function isRead

bool isRead()

Message read or unread mark

Return: bool

Example:

function setIsRead

void setIsRead(
    bool 
)

Message read or unread mark

Example:

function isReadAcked

bool isReadAcked()

Show sender whether read acknowledgement received, and show receiver whether message read acknowledgement sent

Return: bool

Example:

function setIsReadAcked

void setIsReadAcked(
    bool 
)

Set read acknowledgement

Example:

function isDeliveryAcked

bool isDeliveryAcked()

Show sender whether message has been delivered to the other party, and show receiver whether message delivered acknowledgement has been sent

Return: bool

Example:

function setIsDeliveryAcked

void setIsDeliveryAcked(
    bool 
)

Set delivery acknowledgement

Example:

function content

const std::string & content()

Message text content

Return: std::string

Example:

mvwaddstr(notifyWindow, 4, 1, msg->content().c_str());

function setContent

void setContent(
    const std::string & content
)

Message text content

Parameters:

  • content Message text content

Example:

function contentType

ContentType contentType()

Message content type, attachment-type with attachment, text-type with no attachment

Return: ContentType

Example:

function attachment

BMXMessageAttachmentPtr attachment()

Message attachment, BMXMessage owns the attachment and is responsible for releasing it

Return: BMXMessageAttachmentPtr

Example:

function config

BMXMessageConfigPtr config()

Message settings

Return: JSON(std::string)

Example:

function setConfig

void setConfig(
    BMXMessageConfigPtr 
)

Set message config information

Example:

function extension

const JSON & extension()

Message extension information

Return: JSON(std::string)

Example:

function setExtension

void setExtension(
    const JSON & 
)

Set message extension information

Example:

function deliveryQos

DeliveryQos deliveryQos()

QOS of messaging

Return: DeliveryQos

Example:

function setDeliveryQos

void setDeliveryQos(
    DeliveryQos qos
)

Set QOS of messaging

Parameters:

  • qos QOS of messaging

Example:

function senderName

const std::string & senderName()

Display name of message sender

Return: std::string

Example:

function setSenderName

void setSenderName(
    const std::string & senderName
)

Set display name of message sender

Parameters:

  • senderName Message text content

Example:

function groupAckCount

int groupAckCount()

AckCount of read group messages

Return: int

Example:

function setGroupAckCount

void setGroupAckCount(
    int count
)

Set groupAckCount of read messages (an SDK internal calling interface that shall not be called by upper layer)

Parameters:

  • count Set the number of read group messages

Example:

function groupAckUnreadCount

int groupAckUnreadCount()

AckCount of unread group messages

Return: int

Example:

function setGroupAckUnreadCount

void setGroupAckUnreadCount(
    int count
)

Set groupAckCount of unread messages (an SDK internal calling interface that shall not be called by upper layer)

Parameters:

  • count Set the number of unread group messages

Example:

function groupAckReadAll

bool groupAckReadAll()

Whether all group messages are read

Return: bool

Example:

function groupPlayAckCount

int groupPlayAckCount()

AckCount of played group messages (valid only for messages with audio/video attachment)

Return: int

Example:

function setGroupPlayAckCount

void setGroupPlayAckCount(
    int count
)

Set groupAckCount of played messages (an SDK internal calling interface that shall not be called by upper layer) (valid only for messages with audio/video attachment)

Parameters:

  • count Set the number of read group messages

Example:

function groupPlayAckUnreadCount

int groupPlayAckUnreadCount()

AckCount of unplayed group messages (valid only for messages with audio/video attachment)

Return: int

Example:

function setGroupPlayAckUnreadCount

void setGroupPlayAckUnreadCount(
    int count
)

Set groupAckCount of unplayed messages (an SDK internal calling interface that shall not be called by upper layer) (valid only for messages with audio/video attachment)

Parameters:

  • count Set the number of unplayed group messages

Example:

function groupPlayAckReadAll

bool groupPlayAckReadAll()

Whether all group messages have been played

Return: bool

Example:

function setPriority

void setPriority(
    int priority
)

Set message diffusion priority, default 0. 0 means diffusion, and the smaller the number, the more diffused.

Parameters:

  • priority Set the number of unread group messages

Value range 0-10. The default level of messages sent by ordinary users in chatroom is 5, which can be discarded. Admin level defaults to 0 and will not be discarded. Other values can be set according to business.

Example:

function priority

int priority()

Message diffusion priority

Return: int

Example:

function setPushMessageMode

void setPushMessageMode(
    bool 
)

Set whether the message is a push.

Example:

function isPushMessage

bool isPushMessage()

Whether the message is a push

Return: bool

Example:

function createMessage

static BMXMessagePtr createMessage(
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId,
    const std::string & content
)

Create a text message

Parameters:

  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id
  • content Message content

Example:

BMXMessagePtr msg = BMXMessage::createMessage(profile->userId(), toId, (BMXMessage::MessageType)type, toId, params[2]);

function createMessage

static BMXMessagePtr createMessage(
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId,
    BMXMessageAttachmentPtr attachment
)

Create a sent-attachment message

Parameters:

  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id
  • attachment Attachment

Example:

BMXMessagePtr msg = BMXMessage::createMessage(profile->userId(), toId, (BMXMessage::MessageType)type, toId, params[2]);

function createCommandMessage

static BMXMessagePtr createCommandMessage(
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId,
    const std::string & content
)

Create a sent command message (command message holds command information in a content field or an extension field)

Parameters:

  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id
  • content Message content

Example:

function createMessage

static BMXMessagePtr createMessage(
    int64_t msgId,
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId,
    const std::string & content,
    int64_t serverTimestamp
)

Create a received message

Parameters:

  • msgId Message id
  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id
  • content Message content
  • serverTimestamp Server timestamp

Example:

BMXMessagePtr msg = BMXMessage::createMessage(profile->userId(), toId, (BMXMessage::MessageType)type, toId, params[2]);

function createMessage

static BMXMessagePtr createMessage(
    int64_t msgId,
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId,
    BMXMessageAttachmentPtr attachment,
    int64_t serverTimestamp
)

Create a received message

Parameters:

  • msgId Message id
  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id
  • attachment Attachment
  • serverTimestamp Server timestamp

Example:

BMXMessagePtr msg = BMXMessage::createMessage(profile->userId(), toId, (BMXMessage::MessageType)type, toId, params[2]);

function createCommandMessage

static BMXMessagePtr createCommandMessage(
    int64_t msgId,
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId,
    const std::string & content,
    int64_t serverTimestamp
)

Create a received command message (command message holds command information in a content field or an extension field)

Parameters:

  • msgId Message id
  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id
  • content Message content
  • serverTimestamp Server timestamp

Example:

function createForwardMessage

static BMXMessagePtr createForwardMessage(
    BMXMessagePtr msg,
    int64_t from,
    int64_t to,
    MessageType type,
    int64_t conversationId
)

Create a forwarding message

Parameters:

  • msg Message to forward
  • from Message sender
  • to Message receiver
  • type Message type
  • conversationId Conversation id

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 ""