im::floo::floolib::BMXConversation

会话

Inherits from BMXBaseObject

Public Functions

Name
synchronized void delete()
long conversationId()
会话Id
BMXConversation.Type type()
会话类型
BMXMessage lastMsg()
最新消息
int unreadNumber()
未读消息数
int messageCount()
会话中所有消息的数量
boolean isMuteNotification()
是否提醒用户消息,不提醒的情况下会话总未读数不会统计该会话计数。
String extension()
扩展信息
[BMXErrorCode] setExtension(String ext)
设置扩展信息
String editMessage()
编辑消息
[BMXErrorCode] setEditMessage(String editMessage)
设置编辑消息
[BMXErrorCode] searchMessagesByKeyWords(String keywords, long refTime, long size, BMXMessageList result, BMXConversation.Direction arg4)
搜索消息,如果不指定则从最新消息开始
[BMXErrorCode] searchMessagesByKeyWords(String keywords, long refTime, long size, BMXMessageList result)
[BMXErrorCode] searchMessagesByType(BMXMessage.ContentType type, long refTime, long size, BMXMessageList result, BMXConversation.Direction arg4)
按照类型搜索消息,如果不指定则从最新消息开始
[BMXErrorCode] searchMessagesByType(BMXMessage.ContentType type, long refTime, long size, BMXMessageList result)
void setMessagePlayedStatus(final BMXMessage msg, final boolean status, final BMXCallBack callBack)
设置消息播放状态(只对语音/视频消息有效)
void setMessageReadStatus(final BMXMessage msg, final boolean status, final BMXCallBack callBack)
设置消息未读状态,更新未读消息数
void setAllMessagesRead(final BMXCallBack callBack)
把所有消息设置为已读,更新未读消息数
void updateMessageExtension(final BMXMessage msg, final BMXCallBack callBack)
更新一条数据库存储消息的扩展字段信息
void insertMessage(final BMXMessage msg, final BMXCallBack callBack)
插入一条消息
void loadMessage(final long msgId, final BMXDataCallBack< BMXMessage > callBack)
读取一条消息
void removeAllMessages(final BMXCallBack callBack)
删除会话中的所有消息
void loadMessages(final long refMsgId, final long size, final BMXConversation.Direction arg3, final BMXDataCallBack< BMXMessageList > callBack)
加载消息,如果不指定则从最新消息开始
void loadMessages(final long refMsgId, final long size, final BMXDataCallBack< BMXMessageList > callBack)
void searchMessages(final String keywords, final long refTime, final long size, final BMXConversation.Direction arg4, final BMXDataCallBack< BMXMessageList > callBack)
搜索消息,如果不指定则从最新消息开始
void searchMessages(final String keywords, final long refTime, final long size, final BMXDataCallBack< BMXMessageList > callBack)
void searchMessages(final BMXMessage.ContentType type, final long refTime, final long size, final BMXConversation.Direction arg4, final BMXDataCallBack< BMXMessageList > callBack)
按照类型搜索消息,如果不指定则从最新消息开始
void searchMessages(final BMXMessage.ContentType type, final long refTime, final long size, final BMXDataCallBack< BMXMessageList > callBack)
void refreshConversation(final BMXCallBack callBack)
读取数据库当前会话所有消息数量,强制更新conversation的消息总数和未读消息数。

Protected Functions

Name
BMXConversation(long cPtr, boolean cMemoryOwn)
void finalize()
long getCPtr(BMXConversation obj)

Public Functions Documentation

function delete

inline synchronized void delete()

Example:

function conversationId

inline long conversationId()

会话Id

Return: int64_t

Example:

    return;
}
ListOfLongLong rosterIds = new ListOfLongLong();
ListOfLongLong groupIds = new ListOfLongLong();
for (int i = 0; i < conversationList.size(); i++) {
    BMXConversation conversation = conversationList.get(i);
    if (conversation == null) {
        continue;
    }
    if (conversation.type() == BMXConversation.Type.Single) {
        if (RosterFetcher.getFetcher().getRoster(conversation.conversationId()) == null) {
            rosterIds.add(conversation.conversationId());
        }
    } else if (conversation.type() == BMXConversation.Type.Group) {
        if (RosterFetcher.getFetcher().getGroup(conversation.conversationId()) == null) {
            groupIds.add(conversation.conversationId());
        }
    }
}
if (!rosterIds.isEmpty()) {
}
ListOfLongLong rosterIds = new ListOfLongLong();
ListOfLongLong groupIds = new ListOfLongLong();
for (int i = 0; i < conversationList.size(); i++) {
    BMXConversation conversation = conversationList.get(i);
    if (conversation == null) {
        continue;
    }
    if (conversation.type() == BMXConversation.Type.Single) {
        if (RosterFetcher.getFetcher().getRoster(conversation.conversationId()) == null) {
            rosterIds.add(conversation.conversationId());
        }
    } else if (conversation.type() == BMXConversation.Type.Group) {
        if (RosterFetcher.getFetcher().getGroup(conversation.conversationId()) == null) {
            groupIds.add(conversation.conversationId());
        }
    }
}
if (!rosterIds.isEmpty()) {
    RosterManager.getInstance().getRosterList(rosterIds, true, (bmxErrorCode, itemList) -> {
for (int i = 0; i < conversationList.size(); i++) {
    BMXConversation conversation = conversationList.get(i);
    if (conversation == null) {
        continue;
    }
    if (conversation.type() == BMXConversation.Type.Single) {
        if (RosterFetcher.getFetcher().getRoster(conversation.conversationId()) == null) {
            rosterIds.add(conversation.conversationId());
        }
    } else if (conversation.type() == BMXConversation.Type.Group) {
        if (RosterFetcher.getFetcher().getGroup(conversation.conversationId()) == null) {
            groupIds.add(conversation.conversationId());
        }
    }
}
if (!rosterIds.isEmpty()) {
    RosterManager.getInstance().getRosterList(rosterIds, true, (bmxErrorCode, itemList) -> {
        if (BaseManager.bmxFinish(bmxErrorCode)) {
            RosterFetcher.getFetcher().putRosters(itemList);
            if (mAdapter != null) {
    BMXConversation conversation = conversationList.get(i);
    if (conversation == null) {
        continue;
    }
    if (conversation.type() == BMXConversation.Type.Single) {
        if (RosterFetcher.getFetcher().getRoster(conversation.conversationId()) == null) {
            rosterIds.add(conversation.conversationId());
        }
    } else if (conversation.type() == BMXConversation.Type.Group) {
        if (RosterFetcher.getFetcher().getGroup(conversation.conversationId()) == null) {
            groupIds.add(conversation.conversationId());
        }
    }
}
if (!rosterIds.isEmpty()) {
    RosterManager.getInstance().getRosterList(rosterIds, true, (bmxErrorCode, itemList) -> {
        if (BaseManager.bmxFinish(bmxErrorCode)) {
            RosterFetcher.getFetcher().putRosters(itemList);
            if (mAdapter != null) {
                mAdapter.notifyDataSetChanged();
TextView time = holder.findViewById(R.id.session_time);
TextView tvUnReadCount = holder.findViewById(R.id.session_unread_num);
ImageView ivDisturb = holder.findViewById(R.id.session_disturb);

BMXConversation item = getItem(position);
// 是否开启免打扰
boolean isDisturb = false;
BMXConversation.Type type = item == null ? null : item.type();
String name = "";
if (type != null && type == BMXConversation.Type.Single) {
    BMXRosterItem rosterItem = RosterFetcher.getFetcher().getRoster(item.conversationId());
    if (rosterItem != null && !TextUtils.isEmpty(rosterItem.alias())) {
        name = rosterItem.alias();
    } else if (rosterItem != null && !TextUtils.isEmpty(rosterItem.nickname())) {
        name = rosterItem.nickname();
    } else if (rosterItem != null) {
        name = rosterItem.username();
    }
    if (item.conversationId() == 0){
        name = mContext.getString(R.string.sys_msg);
String name = "";
if (type != null && type == BMXConversation.Type.Single) {
    BMXRosterItem rosterItem = RosterFetcher.getFetcher().getRoster(item.conversationId());
    if (rosterItem != null && !TextUtils.isEmpty(rosterItem.alias())) {
        name = rosterItem.alias();
    } else if (rosterItem != null && !TextUtils.isEmpty(rosterItem.nickname())) {
        name = rosterItem.nickname();
    } else if (rosterItem != null) {
        name = rosterItem.username();
    }
    if (item.conversationId() == 0){
        name = mContext.getString(R.string.sys_msg);
    }
    ChatUtils.getInstance().showRosterAvatar(rosterItem, avatar, mConfig);
    isDisturb = rosterItem != null && rosterItem.isMuteNotification();
} else if (type != null && type == BMXConversation.Type.Group) {
    BMXGroup groupItem = RosterFetcher.getFetcher().getGroup(item.conversationId());
    name = groupItem != null ? groupItem.name() : "";
    ChatUtils.getInstance().showGroupAvatar(groupItem, avatar, mGroupConfig);
    isDisturb = groupItem != null && groupItem.msgMuteMode() != null
        name = rosterItem.nickname();
    } else if (rosterItem != null) {
        name = rosterItem.username();
    }
    if (item.conversationId() == 0){
        name = mContext.getString(R.string.sys_msg);
    }
    ChatUtils.getInstance().showRosterAvatar(rosterItem, avatar, mConfig);
    isDisturb = rosterItem != null && rosterItem.isMuteNotification();
} else if (type != null && type == BMXConversation.Type.Group) {
    BMXGroup groupItem = RosterFetcher.getFetcher().getGroup(item.conversationId());
    name = groupItem != null ? groupItem.name() : "";
    ChatUtils.getInstance().showGroupAvatar(groupItem, avatar, mGroupConfig);
    isDisturb = groupItem != null && groupItem.msgMuteMode() != null
            && groupItem.msgMuteMode() == BMXGroup.MsgMuteMode.MuteChat;
} else {
    ChatUtils.getInstance().showRosterAvatar(null, avatar, mConfig);
}
BMXMessage lastMsg = item == null ? null : item.lastMsg();
int unReadCount = item == null ? 0 : item.unreadNumber();
@Override
public void setChatInfo(BMXMessage.MessageType chatType, final long myUserId, long chatId) {
    mChatType = chatType;
    mMyUserId = myUserId;
    mChatId = chatId;
    mSendUtils = new MessageSendUtils();
    if (mConversation == null || mConversation.conversationId() != chatId) {
        BMXDataCallBack<BMXConversation> callBack = (bmxErrorCode, bmxConversation) -> {
            if (BaseManager.bmxFinish(bmxErrorCode) && bmxConversation != null) {
                mConversation = bmxConversation;
                // 设置已读
                if (mConversation.unreadNumber() > 0) {
                    mConversation.setAllMessagesRead(null);
                }
                // 获取草稿
                if (mView != null) {
                    mView.setControlBarText(mConversation.editMessage());
                }
                if (chatType != null && chatType == BMXMessage.MessageType.Single) {
                    initChatData(0);

function type

inline BMXConversation.Type type()

会话类型

Return: [Type]

Example:

if (conversationList == null || conversationList.isEmpty()) {
    return;
}
ListOfLongLong rosterIds = new ListOfLongLong();
ListOfLongLong groupIds = new ListOfLongLong();
for (int i = 0; i < conversationList.size(); i++) {
    BMXConversation conversation = conversationList.get(i);
    if (conversation == null) {
        continue;
    }
    if (conversation.type() == BMXConversation.Type.Single) {
        if (RosterFetcher.getFetcher().getRoster(conversation.conversationId()) == null) {
            rosterIds.add(conversation.conversationId());
        }
    } else if (conversation.type() == BMXConversation.Type.Group) {
        if (RosterFetcher.getFetcher().getGroup(conversation.conversationId()) == null) {
            groupIds.add(conversation.conversationId());
        }
    }
ListOfLongLong groupIds = new ListOfLongLong();
for (int i = 0; i < conversationList.size(); i++) {
    BMXConversation conversation = conversationList.get(i);
    if (conversation == null) {
        continue;
    }
    if (conversation.type() == BMXConversation.Type.Single) {
        if (RosterFetcher.getFetcher().getRoster(conversation.conversationId()) == null) {
            rosterIds.add(conversation.conversationId());
        }
    } else if (conversation.type() == BMXConversation.Type.Group) {
        if (RosterFetcher.getFetcher().getGroup(conversation.conversationId()) == null) {
            groupIds.add(conversation.conversationId());
        }
    }
}
if (!rosterIds.isEmpty()) {
    RosterManager.getInstance().getRosterList(rosterIds, true, (bmxErrorCode, itemList) -> {
        if (BaseManager.bmxFinish(bmxErrorCode)) {
            RosterFetcher.getFetcher().putRosters(itemList);
ShapeImageView avatar = holder.findViewById(R.id.session_avatar);
TextView tvTitle = holder.findViewById(R.id.session_title);
TextView desc = holder.findViewById(R.id.session_desc);
TextView time = holder.findViewById(R.id.session_time);
TextView tvUnReadCount = holder.findViewById(R.id.session_unread_num);
ImageView ivDisturb = holder.findViewById(R.id.session_disturb);

BMXConversation item = getItem(position);
// 是否开启免打扰
boolean isDisturb = false;
BMXConversation.Type type = item == null ? null : item.type();
String name = "";
if (type != null && type == BMXConversation.Type.Single) {
    BMXRosterItem rosterItem = RosterFetcher.getFetcher().getRoster(item.conversationId());
    if (rosterItem != null && !TextUtils.isEmpty(rosterItem.alias())) {
        name = rosterItem.alias();
    } else if (rosterItem != null && !TextUtils.isEmpty(rosterItem.nickname())) {
        name = rosterItem.nickname();
    } else if (rosterItem != null) {
        name = rosterItem.username();
if (conversationList == null || conversationList.isEmpty()) {
    return;
}
ListOfLongLong rosterIds = new ListOfLongLong();
ListOfLongLong groupIds = new ListOfLongLong();
for (int i = 0; i < conversationList.size(); i++) {
    BMXConversation conversation = conversationList.get(i);
    if (conversation == null) {
        continue;
    }
    if (conversation.type() == BMXConversation.Type.Single) {
        if (RosterFetcher.getFetcher().getRoster(conversation.conversationId()) == null) {
            rosterIds.add(conversation.conversationId());
        }
    } else if (conversation.type() == BMXConversation.Type.Group) {
        if (RosterFetcher.getFetcher().getGroup(conversation.conversationId()) == null) {
            groupIds.add(conversation.conversationId());
        }
    }
ListOfLongLong groupIds = new ListOfLongLong();
for (int i = 0; i < conversationList.size(); i++) {
    BMXConversation conversation = conversationList.get(i);
    if (conversation == null) {
        continue;
    }
    if (conversation.type() == BMXConversation.Type.Single) {
        if (RosterFetcher.getFetcher().getRoster(conversation.conversationId()) == null) {
            rosterIds.add(conversation.conversationId());
        }
    } else if (conversation.type() == BMXConversation.Type.Group) {
        if (RosterFetcher.getFetcher().getGroup(conversation.conversationId()) == null) {
            groupIds.add(conversation.conversationId());
        }
    }
}
if (!rosterIds.isEmpty()) {
    RosterManager.getInstance().getRosterList(rosterIds, true, (bmxErrorCode, itemList) -> {
        if (BaseManager.bmxFinish(bmxErrorCode)) {
            RosterFetcher.getFetcher().putRosters(itemList);

function lastMsg

inline BMXMessage lastMsg()

最新消息

Return: BMXMessagePtr

Example:

    isDisturb = rosterItem != null && rosterItem.isMuteNotification();
} else if (type != null && type == BMXConversation.Type.Group) {
    BMXGroup groupItem = RosterFetcher.getFetcher().getGroup(item.conversationId());
    name = groupItem != null ? groupItem.name() : "";
    ChatUtils.getInstance().showGroupAvatar(groupItem, avatar, mGroupConfig);
    isDisturb = groupItem != null && groupItem.msgMuteMode() != null
            && groupItem.msgMuteMode() == BMXGroup.MsgMuteMode.MuteChat;
} else {
    ChatUtils.getInstance().showRosterAvatar(null, avatar, mConfig);
}
BMXMessage lastMsg = item == null ? null : item.lastMsg();
int unReadCount = item == null ? 0 : item.unreadNumber();
if (isDisturb) {
    tvUnReadCount.setVisibility(View.GONE);
    ivDisturb.setVisibility(unReadCount > 0 ? View.VISIBLE : View.GONE);
} else {
    ivDisturb.setVisibility(View.GONE);
    if (unReadCount > 0) {
        tvUnReadCount.setVisibility(View.VISIBLE);
        tvUnReadCount.setText(String.valueOf(unReadCount));

function unreadNumber

inline int unreadNumber()

未读消息数

Return: int32_t

Example:

} else if (type != null && type == BMXConversation.Type.Group) {
    BMXGroup groupItem = RosterFetcher.getFetcher().getGroup(item.conversationId());
    name = groupItem != null ? groupItem.name() : "";
    ChatUtils.getInstance().showGroupAvatar(groupItem, avatar, mGroupConfig);
    isDisturb = groupItem != null && groupItem.msgMuteMode() != null
            && groupItem.msgMuteMode() == BMXGroup.MsgMuteMode.MuteChat;
} else {
    ChatUtils.getInstance().showRosterAvatar(null, avatar, mConfig);
}
BMXMessage lastMsg = item == null ? null : item.lastMsg();
int unReadCount = item == null ? 0 : item.unreadNumber();
if (isDisturb) {
    tvUnReadCount.setVisibility(View.GONE);
    ivDisturb.setVisibility(unReadCount > 0 ? View.VISIBLE : View.GONE);
} else {
    ivDisturb.setVisibility(View.GONE);
    if (unReadCount > 0) {
        tvUnReadCount.setVisibility(View.VISIBLE);
        tvUnReadCount.setText(String.valueOf(unReadCount));
    } else {
    };
    if (chatType != null && chatType == BMXMessage.MessageType.Single) {
        ChatManager.getInstance().openConversation(chatId, BMXConversation.Type.Single,
                true, callBack);
    } else if (chatType != null && chatType == BMXMessage.MessageType.Group) {
        ChatManager.getInstance().openConversation(chatId, BMXConversation.Type.Group, true,
                callBack);
    }
} else {
    // 设置已读
    if (mConversation.unreadNumber() > 0) {
        mConversation.setAllMessagesRead(null);
    }
    // 获取草稿
    if (mView != null) {
        mView.setControlBarText(mConversation.editMessage());
    }
    if (chatType != null && chatType == BMXMessage.MessageType.Single) {
        initChatData(0);
if (mConversation.unreadNumber() > 0) {

function messageCount

inline int messageCount()

会话中所有消息的数量

Return: int32_t

Example:

function isMuteNotification

inline boolean isMuteNotification()

是否提醒用户消息,不提醒的情况下会话总未读数不会统计该会话计数。

Return: bool

Example:

function extension

inline String extension()

扩展信息

Return: JSON(std::string)

Example:

function setExtension

inline BMXErrorCode setExtension(
    String ext
)

设置扩展信息

Parameters:

  • ext 会话扩展消息

Return: [BMXErrorCode]

Example:

function editMessage

inline String editMessage()

编辑消息

Return: std::string

Example:

    ivDisturb.setVisibility(View.GONE);
    if (unReadCount > 0) {
        tvUnReadCount.setVisibility(View.VISIBLE);
        tvUnReadCount.setText(String.valueOf(unReadCount));
    } else {
        tvUnReadCount.setVisibility(View.GONE);
    }
}
tvTitle.setText(TextUtils.isEmpty(name) ? "" : name);
time.setText(lastMsg != null ? TimeUtils.millis2StringOnConversationList(mContext, lastMsg.serverTimestamp()) : "");
String draft = item == null ? "" : item.editMessage();
if (!TextUtils.isEmpty(draft)) {
    // 有草稿
    SpannableStringBuilder spannable = new SpannableStringBuilder();
    String draftText = mContext.getString(R.string.draft);
    SpannableString spannableString = new SpannableString(draftText);
    spannableString.setSpan(new ForegroundColorSpan(Color.RED), 0, draftText.length(),
            Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    spannable.append(spannableString).append(draft);
    desc.setText(spannable);
        ChatManager.getInstance().openConversation(chatId, BMXConversation.Type.Group, true,
                callBack);
    }
} else {
    // 设置已读
    if (mConversation.unreadNumber() > 0) {
        mConversation.setAllMessagesRead(null);
    }
    // 获取草稿
    if (mView != null) {
        mView.setControlBarText(mConversation.editMessage());
    }
    if (chatType != null && chatType == BMXMessage.MessageType.Single) {
        initChatData(0);
    }
}
UserManager.getInstance().getProfile(false, (bmxErrorCode, bmxUserProfile) -> {
    if (BaseManager.bmxFinish(bmxErrorCode)) {
        myUserName = bmxUserProfile == null ? "" : bmxUserProfile.username();
mView.setControlBarText(mConversation.editMessage());

function setEditMessage

inline BMXErrorCode setEditMessage(
    String editMessage
)

设置编辑消息

Parameters:

  • editMessage 会话正在编辑的文本消息

Return: [BMXErrorCode]

Example:

@Override
public void onPause() {
    stopAudio();
    // 聊天页面返回需要更新会话的草稿
    if (mConversation != null) {
        mConversation.setEditMessage(mView == null ? "" : mView.getControlBarText());
    }
    // 同步未读
    readAllMessage();

function searchMessagesByKeyWords

inline BMXErrorCode searchMessagesByKeyWords(
    String keywords,
    long refTime,
    long size,
    BMXMessageList result,
    BMXConversation.Direction arg4
)

搜索消息,如果不指定则从最新消息开始

Parameters:

  • keywords 搜索消息的关键字
  • refTime 搜索消息的起始时间
  • size 最大加载消息条数
  • result 搜索到的消息结果列表
  • arg4 消息搜索方向,默认(Direction::Up)是从更早的消息中搜索

Return: [BMXErrorCode]

Example:

function searchMessagesByKeyWords

inline BMXErrorCode searchMessagesByKeyWords(
    String keywords,
    long refTime,
    long size,
    BMXMessageList result
)

Example:

function searchMessagesByType

inline BMXErrorCode searchMessagesByType(
    BMXMessage.ContentType type,
    long refTime,
    long size,
    BMXMessageList result,
    BMXConversation.Direction arg4
)

按照类型搜索消息,如果不指定则从最新消息开始

Parameters:

  • type 搜索消息的类型
  • refTime 搜索消息的起始时间
  • size 最大加载消息条数
  • result 搜索到的消息结果列表
  • arg4 消息搜索方向,默认(Direction::Up)是从更早的消息中搜索

Return: [BMXErrorCode]

Example:

function searchMessagesByType

inline BMXErrorCode searchMessagesByType(
    BMXMessage.ContentType type,
    long refTime,
    long size,
    BMXMessageList result
)

Example:

function setMessagePlayedStatus

inline void setMessagePlayedStatus(
    final BMXMessage msg,
    final boolean status,
    final BMXCallBack callBack
)

设置消息播放状态(只对语音/视频消息有效)

Parameters:

  • msg 需要设置播放状态的消息
  • status 消息是否已经播放
  • callBack 回调

Example:

function setMessageReadStatus

inline void setMessageReadStatus(
    final BMXMessage msg,
    final boolean status,
    final BMXCallBack callBack
)

设置消息未读状态,更新未读消息数

Parameters:

  • msg 需要设置消息已读状态的消息
  • status 消息是否设置已读
  • callBack 回调

Example:

function setAllMessagesRead

inline void setAllMessagesRead(
    final BMXCallBack callBack
)

把所有消息设置为已读,更新未读消息数

Parameters:

  • callBack 回调

Example:

    if (chatType != null && chatType == BMXMessage.MessageType.Single) {
        ChatManager.getInstance().openConversation(chatId, BMXConversation.Type.Single,
                true, callBack);
    } else if (chatType != null && chatType == BMXMessage.MessageType.Group) {
        ChatManager.getInstance().openConversation(chatId, BMXConversation.Type.Group, true,
                callBack);
    }
} else {
    // 设置已读
    if (mConversation.unreadNumber() > 0) {
        mConversation.setAllMessagesRead(null);
    }
    // 获取草稿
    if (mView != null) {
        mView.setControlBarText(mConversation.editMessage());
    }
    if (chatType != null && chatType == BMXMessage.MessageType.Single) {
        initChatData(0);
    }
mConversation.setAllMessagesRead(null);

function updateMessageExtension

inline void updateMessageExtension(
    final BMXMessage msg,
    final BMXCallBack callBack
)

更新一条数据库存储消息的扩展字段信息

Parameters:

  • msg 需要更改扩展信息的消息此时msg部分已经更新扩展字椴信息
  • callBack 回调

Example:

function insertMessage

inline void insertMessage(
    final BMXMessage msg,
    final BMXCallBack callBack
)

插入一条消息

Parameters:

  • msg 插入的消息
  • callBack 回调

Example:

function loadMessage

inline void loadMessage(
    final long msgId,
    final BMXDataCallBack< BMXMessage > callBack
)

读取一条消息

Parameters:

  • msgId 需要读取的消息的消息id
  • callBack 回调

Example:

function removeAllMessages

inline void removeAllMessages(
    final BMXCallBack callBack
)

删除会话中的所有消息

Parameters:

  • callBack 回调

Example:

function loadMessages

inline void loadMessages(
    final long refMsgId,
    final long size,
    final BMXConversation.Direction arg3,
    final BMXDataCallBack< BMXMessageList > callBack
)

加载消息,如果不指定则从最新消息开始

Parameters:

  • refMsgId 加载消息的起始id
  • size 最大加载消息条数
  • arg3 加载消息的方向,默认是加载更早的消息
  • callBack 回调

Example:

mConversation.loadMessages(msgId, MessageConfig.DEFAULT_PAGE_SIZE,
mConversation.loadMessages(msgId, MessageConfig.DEFAULT_PAGE_SIZE,

function loadMessages

inline void loadMessages(
    final long refMsgId,
    final long size,
    final BMXDataCallBack< BMXMessageList > callBack
)

Example:

mConversation.loadMessages(msgId, MessageConfig.DEFAULT_PAGE_SIZE,
mConversation.loadMessages(msgId, MessageConfig.DEFAULT_PAGE_SIZE,

function searchMessages

inline void searchMessages(
    final String keywords,
    final long refTime,
    final long size,
    final BMXConversation.Direction arg4,
    final BMXDataCallBack< BMXMessageList > callBack
)

搜索消息,如果不指定则从最新消息开始

Parameters:

  • keywords 搜索消息的关键字
  • refTime 搜索消息的起始时间
  • size 最大加载消息条数
  • arg4 消息搜索方向,默认(Direction::Up)是从更早的消息中搜索
  • callBack 回调

Example:

function searchMessages

inline void searchMessages(
    final String keywords,
    final long refTime,
    final long size,
    final BMXDataCallBack< BMXMessageList > callBack
)

Example:

function searchMessages

inline void searchMessages(
    final BMXMessage.ContentType type,
    final long refTime,
    final long size,
    final BMXConversation.Direction arg4,
    final BMXDataCallBack< BMXMessageList > callBack
)

按照类型搜索消息,如果不指定则从最新消息开始

Parameters:

  • type 搜索消息的类型
  • refTime 搜索消息的起始时间
  • size 最大加载消息条数
  • arg4 消息搜索方向,默认(Direction::Up)是从更早的消息中搜索
  • callBack 回调

Example:

function searchMessages

inline void searchMessages(
    final BMXMessage.ContentType type,
    final long refTime,
    final long size,
    final BMXDataCallBack< BMXMessageList > callBack
)

Example:

function refreshConversation

inline void refreshConversation(
    final BMXCallBack callBack
)

读取数据库当前会话所有消息数量,强制更新conversation的消息总数和未读消息数。

Parameters:

  • callBack 回调

Protected Functions Documentation

Example:

function BMXConversation

inline BMXConversation(
    long cPtr,
    boolean cMemoryOwn
)

Example:

function finalize

inline void finalize()

Example:

function getCPtr

static inline long getCPtr(
    BMXConversation obj
)

Example:


Updated on 2022-01-26 at 17:18:31 +0800

© 2019-2024 美信拓扑 | 官网 | 网站地图 该文件修订时间: 2024-12-07 06:49:06