im::floo::floolib::BMXChatManager
聊天管理器
Public Functions
Name | |
---|---|
BMXChatManager(BMXChatService service) | |
void | sendMessage(final BMXMessage msg) 发送消息,消息状态变化会通过listener通知 |
void | resendMessage(final BMXMessage msg) 重新发送消息,消息状态变化会通过listener通知 |
void | recallMessage(final BMXMessage msg) 撤回消息,消息状态变化会通过listener通知 |
void | forwardMessage(final BMXMessageList list, final BMXConversation to, final BMXMessage newMsg, final BMXCallBack callBack) 合并转发消息 |
void | forwardMessage(final BMXMessage msg) 简单转发消息,用户应当通过BMXMessage::createForwardMessage()先创建转发消息 |
void | readAllMessage(final BMXMessage msg) 标记此消息及之前全部消息为已读,该消息同步到当前用户的所有设备 |
void | removeMessage(final BMXMessage msg, final boolean synchronize) 删除此消息,该消息同步到当前用户的其它设备 |
void | removeMessage(final BMXMessage msg) |
void | ackMessage(final BMXMessage msg) 发送已读回执 |
void | readCancel(final BMXMessage msg) 设置未读 |
void | downloadThumbnail(final BMXMessage msg) 下载缩略图,下载状态变化和进度通过listener通知 缩略图生成策略,1 - 第三方服务器生成, 2 - 本地服务器生成,默认值是 1。 |
void | downloadAttachment(final BMXMessage msg) 下载附件,下载状态变化和进度通过listener通知 |
void | cancelDownloadAttachment(final BMXMessage msg) 取消下载附件 |
int | transferingNum() 正在上传或下载中的文件数 |
void | insertMessages(final BMXMessageList list, final BMXCallBack callBack) 插入消息 |
void | getMessage(final long msgId, final BMXDataCallBack< BMXMessage > callBack) 读取一条消息 |
void | deleteConversation(final long conversationId, final Boolean sync) 删除会话 |
void | openConversation(final long conversationId, final BMXConversation.Type type, final boolean createIfNotExist, final BMXDataCallBack< BMXConversation > callBack) 打开一个会话 |
void | getAllConversations(final BMXDataCallBack< BMXConversationList > callBack) 获取所有会话 |
void | getAllConversationsUnreadCount(final BMXDataCallBack< Integer > callBack) 获取所有会话的全部未读数(标记为屏蔽的个人和群组的未读数不统计在内) |
void | retrieveHistoryMessages(final BMXConversation conversation, 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< BMXMessageListList > callBack) 搜索消息 |
void | searchMessages(final String keywords, final long refTime, final long size, final BMXDataCallBack< BMXMessageListList > callBack) |
void | getGroupAckMessageUserIdList(final BMXMessage msg, final BMXDataCallBack< ListOfLongLong > callBack) 获取发送的群组消息已读用户id列表 |
void | addChatListener(BMXChatServiceListener listener) 添加聊天监听者 |
void | removeChatListener(BMXChatServiceListener listener) 移除聊天监听者 |
Public Functions Documentation
function BMXChatManager
inline BMXChatManager(
BMXChatService service
)
Example:
function sendMessage
inline void sendMessage(
final BMXMessage msg
)
发送消息,消息状态变化会通过listener通知
Parameters:
- msg 发送的消息
Example:
public void sendMessage(BMXMessage msg) {
mService.sendMessage(msg);
function resendMessage
inline void resendMessage(
final BMXMessage msg
)
重新发送消息,消息状态变化会通过listener通知
Parameters:
- msg 重新发送的消息
Example:
public void resendMessage(BMXMessage msg) {
mService.resendMessage(msg);
function recallMessage
inline void recallMessage(
final BMXMessage msg
)
撤回消息,消息状态变化会通过listener通知
Parameters:
- msg 撤回的消息
Example:
public void recallMessage(BMXMessage msg) {
mService.recallMessage(msg);
function forwardMessage
inline void forwardMessage(
final BMXMessageList list,
final BMXConversation to,
final BMXMessage newMsg,
final BMXCallBack callBack
)
合并转发消息
Parameters:
- list 转发的消息列表
- to 消息被转发到的会话
- newMsg 转发的消息列表合并后生成的新的单条转发消息
- callBack [BMXErrorCode]
Example:
public void forwardMessage(BMXMessageList list, BMXConversation to, BMXMessage newMsg, BMXCallBack callBack) {
mService.forwardMessage(list, to, newMsg, callBack);
public void forwardMessage(BMXMessage msg) {
mService.forwardMessage(msg);
function forwardMessage
inline void forwardMessage(
final BMXMessage msg
)
简单转发消息,用户应当通过BMXMessage::createForwardMessage()先创建转发消息
Parameters:
- msg 转发的消息
Example:
public void forwardMessage(BMXMessageList list, BMXConversation to, BMXMessage newMsg, BMXCallBack callBack) {
mService.forwardMessage(list, to, newMsg, callBack);
public void forwardMessage(BMXMessage msg) {
mService.forwardMessage(msg);
function readAllMessage
inline void readAllMessage(
final BMXMessage msg
)
标记此消息及之前全部消息为已读,该消息同步到当前用户的所有设备
Parameters:
- msg 需要标记为此消息以前全部消息为已读的消息
Example:
public void readAllMessage(BMXMessage msg) {
mService.readAllMessage(msg);
function removeMessage
inline void removeMessage(
final BMXMessage msg,
final boolean synchronize
)
删除此消息,该消息同步到当前用户的其它设备
Parameters:
- msg 需要删除的消息
- synchronize 是否同步到其它设备,不同步的情况下只会删除本地存储的该条消息
Example:
public void removeMessage(BMXMessage msg, boolean synchronize) {
mService.removeMessage(msg, synchronize);
public void removeMessage(BMXMessage msg) {
mService.removeMessage(msg);
function removeMessage
inline void removeMessage(
final BMXMessage msg
)
Example:
public void removeMessage(BMXMessage msg, boolean synchronize) {
mService.removeMessage(msg, synchronize);
public void removeMessage(BMXMessage msg) {
mService.removeMessage(msg);
function ackMessage
inline void ackMessage(
final BMXMessage msg
)
发送已读回执
Example:
public void ackMessage(BMXMessage msg) {
mService.ackMessage(msg);
function readCancel
inline void readCancel(
final BMXMessage msg
)
设置未读
Example:
public void readCancel(BMXMessage msg) {
mService.readCancel(msg);
function downloadThumbnail
inline void downloadThumbnail(
final BMXMessage msg
)
下载缩略图,下载状态变化和进度通过listener通知 缩略图生成策略,1 - 第三方服务器生成, 2 - 本地服务器生成,默认值是 1。
Parameters:
- msg 需要下载缩略图的消息
Example:
public void downloadThumbnail(BMXMessage msg) {
mService.downloadThumbnail(msg);
function downloadAttachment
inline void downloadAttachment(
final BMXMessage msg
)
下载附件,下载状态变化和进度通过listener通知
Parameters:
- msg 需要下载附件的消息
Example:
public void downloadAttachment(BMXMessage msg) {
mService.downloadAttachment(msg);
function cancelDownloadAttachment
inline void cancelDownloadAttachment(
final BMXMessage msg
)
取消下载附件
Parameters:
- msg 需要下载附件的消息
Example:
public void cancelDownloadAttachment(BMXMessage msg) {
mService.cancelDownloadAttachment(msg);
function transferingNum
inline int transferingNum()
正在上传或下载中的文件数
Return: 传输中的文件数
Example:
public int transferingNum() {
return mService.transferingNum();
function insertMessages
inline void insertMessages(
final BMXMessageList list,
final BMXCallBack callBack
)
插入消息
Parameters:
- list 插入消息列表
- callBack [BMXErrorCode]
Example:
public void insertMessages(BMXMessageList list, BMXCallBack callBack) {
mService.insertMessages(list, callBack);
function getMessage
inline void getMessage(
final long msgId,
final BMXDataCallBack< BMXMessage > callBack
)
读取一条消息
Parameters:
- msgId 需要获取消息的消息id
- callBack BMXMessage
Example:
public void getMessage(long msgId, BMXDataCallBack<BMXMessage> callBack) {
mService.getMessage(msgId, callBack);
function deleteConversation
inline void deleteConversation(
final long conversationId,
final Boolean sync
)
删除会话
Parameters:
- conversationId 需要删除会话的会话id
- sync 是否同步删除其它设备该会话,默认为false,仅删除本设备会话
Example:
public void deleteConversation(long conversationId, Boolean sync) {
mService.deleteConversation(conversationId, sync);
function openConversation
inline void openConversation(
final long conversationId,
final BMXConversation.Type type,
final boolean createIfNotExist,
final BMXDataCallBack< BMXConversation > callBack
)
打开一个会话
Parameters:
- conversationId 需要打开的会话的会话id
- type 会话的类型,单聊还是群聊。
- createIfNotExist 会话不存在的情况下是否要创建本地会话,默认为创建
- callBack BMXConversation
Example:
public void openConversation(long conversationId, BMXConversation.Type type,
boolean createIfNotExist, BMXDataCallBack<BMXConversation> callBack) {
mService.openConversation(conversationId, type, createIfNotExist, callBack);
function getAllConversations
inline void getAllConversations(
final BMXDataCallBack< BMXConversationList > callBack
)
获取所有会话
Parameters:
- callBack BMXConversationList
Example:
public void getAllConversations(BMXDataCallBack<BMXConversationList> callBack) {
mService.getAllConversations(callBack);
function getAllConversationsUnreadCount
inline void getAllConversationsUnreadCount(
final BMXDataCallBack< Integer > callBack
)
获取所有会话的全部未读数(标记为屏蔽的个人和群组的未读数不统计在内)
Parameters:
- callBack 未读数
Example:
public void getAllConversationsUnreadCount(BMXDataCallBack<Integer> callBack) {
mService.getAllConversationsUnreadCount(callBack);
function retrieveHistoryMessages
inline void retrieveHistoryMessages(
final BMXConversation conversation,
final long refMsgId,
final long size,
final BMXDataCallBack< BMXMessageList > callBack
)
拉取历史消息
Parameters:
- conversation 需要拉取历史消息的会话
- refMsgId 拉取会话消息的起始消息Id
- size 拉取的最大消息条数
- callBack BMXErrorCode,拉取操作获取的消息列表
Example:
public void retrieveHistoryMessages(BMXConversation conversation, long refMsgId, long size, BMXDataCallBack<BMXMessageList> callBack) {
mService.retrieveHistoryMessages(conversation, refMsgId, size, callBack);
function searchMessages
inline void searchMessages(
final String keywords,
final long refTime,
final long size,
final BMXConversation.Direction arg4,
final BMXDataCallBack< BMXMessageListList > callBack
)
搜索消息
Parameters:
- keywords 搜索的关键字
- refTime 搜索消息的起始时间
- size 搜索的最大消息条数
- arg4 消息搜索方向,默认(Direction::Up)是从更早的消息中搜索
- callBack BMXErrorCode,搜索到的消息结果列表
Example:
public void searchMessages(String keywords, long refTime, long size,
BMXDataCallBack<BMXMessageListList> callBack) {
mService.searchMessages(keywords, refTime, size, callBack);
function searchMessages
inline void searchMessages(
final String keywords,
final long refTime,
final long size,
final BMXDataCallBack< BMXMessageListList > callBack
)
Example:
public void searchMessages(String keywords, long refTime, long size,
BMXDataCallBack<BMXMessageListList> callBack) {
mService.searchMessages(keywords, refTime, size, callBack);
function getGroupAckMessageUserIdList
inline void getGroupAckMessageUserIdList(
final BMXMessage msg,
final BMXDataCallBack< ListOfLongLong > callBack
)
获取发送的群组消息已读用户id列表
Parameters:
- msg 需要获取已读用户id列表的消息
- callBack [BMXErrorCode],对该条消息已读的用户id列表
Example:
public void getGroupAckMessageUserIdList(BMXMessage msg,
BMXDataCallBack<ListOfLongLong> callBack) {
mService.getGroupAckMessageUserIdList(msg, callBack);
function addChatListener
inline void addChatListener(
BMXChatServiceListener listener
)
添加聊天监听者
Parameters:
- listener 聊天监听者
Example:
public void addChatListener(BMXChatServiceListener listener) {
mService.addChatListener(listener);
function removeChatListener
inline void removeChatListener(
BMXChatServiceListener listener
)
移除聊天监听者
Parameters:
- listener 聊天监听者
Example:
public void removeChatListener(BMXChatServiceListener listener) {
mService.removeChatListener(listener);
Updated on 2022-01-26 at 17:18:31 +0800