NIM SDK API  9.0.0
Classes | Public Types | Static Public Member Functions | List of all members
nim::MsgLog Class Reference

NIM SDK提供的消息历史接口 More...

#include <nim_cpp_msglog.h>

Classes

class  AllMessageTypeList
 
class  FullTextSearchOnlineAsyncParam
 
class  QueryMsgAsyncParam
 
class  QueryMsgByKeywordOnlineParam
 
class  QueryMsgByOptionsAsyncParam
 
class  QueryMsgOnlineAsyncParam
 
class  QueryThreadHistoryMsgAsyncParam
 

Public Types

typedef std::function< void(NIMResCode res_code, const std::string &id, nim::NIMSessionType to_type, const QueryMsglogResult &result)> QueryMsgCallback
 
typedef std::function< void(NIMResCode res_code, const std::string &msg_id, const IMMessage &msg)> QuerySingleMsgCallback
 
typedef std::function< void(NIMResCode res_code, const std::string &uid, nim::NIMSessionType to_type)> ModifyMultipleMsglogCallback
 
typedef ModifyMultipleMsglogCallback BatchStatusReadCallback
 
typedef ModifyMultipleMsglogCallback BatchStatusDeleteCallback
 
typedef ModifyMultipleMsglogCallback DeleteBySessionTypeCallback
 
typedef std::function< void(NIMResCode res_code, const std::string &msg_id)> ModifySingleMsglogCallback
 
typedef ModifySingleMsglogCallback SetStatusCallback
 
typedef ModifySingleMsglogCallback SetSubStatusCallback
 
typedef ModifySingleMsglogCallback UpdateLocalExtCallback
 
typedef ModifySingleMsglogCallback WriteMsglogCallback
 
typedef ModifySingleMsglogCallback DeleteCallback
 
typedef std::function< void(const DeleteMsglogSelfNotifyParam &)> DeleteMsglogSelfNotifyCallback
 
typedef std::function< void(NIMResCode res_code)> DBFunctionCallback
 
typedef std::function< void(NIMResCode res_code)> DeleteMsglogSelfCallback
 
typedef DBFunctionCallback DeleteAllCallback
 
typedef DBFunctionCallback DeleteMsgByTimeCallback
 
typedef std::function< void(int64_t imported_count, int64_t total_count)> ImportDbPrgCallback
 
typedef std::function< void(const MessageStatusChangedResult &)> MessageStatusChangedCallback
 
typedef std::function< void(const NIMResCode, const std::string &)> DeleteHistoryOnLineAsyncCallback
 
typedef std::function< void(const NIMResCode, const std::string &, nim::NIMSessionType, uint64_t, const std::string &)> DeleteHistoryOnLineAsyncExCallback
 
typedef std::function< void(const std::list< NIMDeleteSessionHistoryMessagesNotifyInfo > &info_list)> DeleteHistoryOnLineNotifyCallback
 
typedef std::function< void(const NIMResCode res_code, const std::string &client_id, bool is_root, int reply_count)> QueryMessageIsThreadRootAsyncCallback
 
typedef std::function< void(const NIMResCode res_code, const std::string &client_id, const IMMessage &msg)> QueryMessageOnlineCallback
 
typedef std::function< void(const NIMResCode res_code, const IMMessage &root_msg, int total, uint64_t last_msg_time, const std::list< IMMessage > &msg_list)> QueryThreadHistoryMsgCallback
 
using FullTextSearchOnlineAsyncCallback = std::function< void(nim::NIMResCode res_code, const QueryMsglogResult &message_list)>
 

Static Public Member Functions

static void UnregMsglogCb ()
 
static void RegDeleteMsglogSelfNotify (const DeleteMsglogSelfNotifyCallback &cb)
 
static void RegDeleteHistoryMessagesNotify (const DeleteHistoryOnLineNotifyCallback &cb)
 
static bool QueryMsgByIDAysnc (const std::string &client_msg_id, const QuerySingleMsgCallback &cb, const std::string &json_extension="")
 
static bool QueryMsgAsync (const std::string &account_id, nim::NIMSessionType to_type, int limit_count, int64_t anchor_msg_time, const QueryMsgCallback &cb, const std::string &json_extension="")
 
static bool QueryMsgOnlineAsync (const QueryMsgOnlineAsyncParam &param, const QueryMsgCallback &cb)
 
static bool QueryMsgOnlineAsync (const std::string &id, nim::NIMSessionType to_type, int limit_count, int64_t from_time, int64_t end_time, int64_t end_msg_id, bool reverse, bool need_save_to_local, const QueryMsgCallback &cb, const std::string &json_extension="")
 
static bool QueryMsgByKeywordOnlineAsync (const MsgLog::QueryMsgByKeywordOnlineParam &param, const QueryMsgCallback &cb)
 
static bool QueryMsgOfSpecifiedTypeInASessionAsync (nim::NIMSessionType to_type, const std::string &id, int limit_count, int64_t from_time, int64_t end_time, const std::string &end_client_msg_id, bool reverse, std::list< NIMMessageType > msg_type, const QueryMsgCallback &cb, const std::string &json_extension="")
 
static bool QueryMsgByOptionsAsync (NIMMsgLogQueryRange query_range, const std::list< std::string > &ids, int limit_count, int64_t from_time, int64_t end_time, const std::string &end_client_msg_id, bool reverse, NIMMessageType msg_type, const std::string &search_content, const QueryMsgCallback &cb, const std::string &json_extension="")
 
static bool QueryMsgByOptionsAsyncEx (const QueryMsgByOptionsAsyncParam &param, const QueryMsgCallback &cb)
 
static bool BatchStatusReadAsync (const std::string &account_id, nim::NIMSessionType to_type, const BatchStatusReadCallback &cb, const std::string &json_extension="")
 
static bool BatchStatusDeleteAsync (const std::string &account_id, nim::NIMSessionType to_type, const BatchStatusDeleteCallback &cb, const std::string &json_extension="")
 
static bool BatchStatusDeleteAsyncEx (const std::string &account_id, nim::NIMSessionType to_type, bool revert_by_query_online, const BatchStatusDeleteCallback &cb, const std::string &json_extension="")
 
static bool SetStatusAsync (const std::string &msg_id, nim::NIMMsgLogStatus msglog_status, const SetStatusCallback &cb, const std::string &json_extension="")
 
static bool SetSubStatusAsync (const std::string &msg_id, nim::NIMMsgLogSubStatus msglog_sub_status, const SetSubStatusCallback &cb, const std::string &json_extension="")
 
static bool WriteMsglogToLocalAsync (const std::string &talk_id, const IMMessage &msg, bool need_update_session, const WriteMsglogCallback &cb, const std::string &json_extension="")
 
static bool WriteMsglogToLocalAsyncEx (const std::string &talk_id, const IMMessage &msg, bool need_update_session, bool compose_last_msg, const std::list< NIMMessageType > &exclude_msg_type, const WriteMsglogCallback &cb)
 static bool WriteMsglogToLocalAsyncEx(const std::string& talk_id, const IMMessage& msg, bool need_update_session, bool compose_last_msg, const std::list<NIMMessageType>& exclude_msg_type, const WriteMsglogCallback& cb) 只往本地消息历史数据库里写入一条消息(如果已存在这条消息,则更新。通常是APP的本地自定义消息,并不会发给服务器) More...
 
static bool DeleteBySessionTypeAsync (bool delete_sessions, NIMSessionType to_type, const DeleteBySessionTypeCallback &cb, const std::string &json_extension="")
 
static bool DeleteBySessionTypeAsyncEx (bool delete_sessions, NIMSessionType to_type, bool revert_by_query_online, const DeleteBySessionTypeCallback &cb, const std::string &json_extension="")
 
static bool DeleteAsync (const std::string &session_id, NIMSessionType to_type, const std::string &msg_id, const DeleteCallback &cb, const std::string &json_extension="")
 
static bool DeleteAllAsync (bool delete_sessions, const DeleteAllCallback &cb, const std::string &json_extension="")
 
static bool DeleteAllAsyncEx (bool delete_sessions, bool revert_by_query_online, const DeleteAllCallback &cb, const std::string &json_extension="")
 
static bool DeleteMsgByTimeAsync (const std::string &session_id, NIMSessionType to_type, uint64_t timestamp1, uint64_t timestamp2, const DeleteMsgByTimeCallback &cb, const std::string &json_extension="")
 
static bool DeleteMsgByTimeAsyncEx (const std::string &session_id, NIMSessionType to_type, bool revert_by_query_online, uint64_t timestamp1, uint64_t timestamp2, const DeleteMsgByTimeCallback &cb, const std::string &json_extension="")
 
static bool ExportDbAsync (const std::string &dst_path, const DBFunctionCallback &cb, const std::string &json_extension="")
 
static bool ImportDbAsync (const std::string &src_path, const DBFunctionCallback &cb, const ImportDbPrgCallback &prg_cb, const std::string &json_extension="")
 
static void SendReceiptAsync (const std::string &json_msg, const MessageStatusChangedCallback &cb)
 
static bool QuerySentMessageBeReaded (const IMMessage &msg)
 
static bool QueryReceivedMsgReceiptSent (const IMMessage &msg)
 
static void RegMessageStatusChangedCb (const MessageStatusChangedCallback &cb, const std::string &json_extension="")
 
static bool UpdateLocalExtAsync (const std::string &msg_id, const std::string &local_ext, const UpdateLocalExtCallback &cb, const std::string &json_extension="")
 
static void UnregMsgologCb ()
 
static bool ReadAllAsync (const DBFunctionCallback &cb, const std::string &json_extension="")
 
static bool ExportBackupToRemote (const LogsBackupExportInfo &export_info)
 
static bool ImportBackupFromRemote (const LogsBackupImportInfo &import_info)
 
static void CancelImportBackupFromRemote ()
 
static void CancelExportBackupToRemote ()
 
static void DeleteHistoryOnlineAsync (const std::string &accid, bool delete_roaming, const std::string &json_extension, const DeleteHistoryOnLineAsyncCallback &cb)
 
static void DeleteHistoryOnlineAsync (const std::string &accid, nim::NIMSessionType to_type, bool notify_self, const std::string &ext, const DeleteHistoryOnLineAsyncExCallback &cb)
 
static void DeleteMessageSelfAsync (const IMMessage &msg, const std::string ext, const DeleteMsglogSelfCallback &cb)
 
static void DeleteMessageSelfAsync (const std::list< std::tuple< IMMessage, std::string >> &msgs, const DeleteMsglogSelfCallback &cb)
 
static void QueryMessageIsThreadRoot (const std::string msg_client_id, const QueryMessageIsThreadRootAsyncCallback &cb)
 
static void QueryMessageOnline (const QueryMsgAsyncParam &param, const QueryMessageOnlineCallback &cb)
 
static void QueryThreadHistoryMsg (const IMMessage &msg, const QueryThreadHistoryMsgAsyncParam &param, const QueryThreadHistoryMsgCallback &cb)
 
static void FullTextSearchOnlineAsync (const FullTextSearchOnlineAsyncParam &param, const FullTextSearchOnlineAsyncCallback &cb)
 

Detailed Description

NIM SDK提供的消息历史接口

Member Typedef Documentation

◆ BatchStatusDeleteCallback

批量删除消息历史回调模板

◆ BatchStatusReadCallback

批量设置消息历史已读状态回调模板

◆ DBFunctionCallback

typedef std::function<void(NIMResCode res_code)> nim::MsgLog::DBFunctionCallback

消息历史变更回调模板

◆ DeleteAllCallback

删除全部消息历史回调模板

◆ DeleteBySessionTypeCallback

批量删除消息历史回调模板

◆ DeleteCallback

删除消息历史回调模板

◆ DeleteHistoryOnLineAsyncCallback

typedef std::function<void(const NIMResCode, const std::string&)> nim::MsgLog::DeleteHistoryOnLineAsyncCallback

删除与某账号(p2p)的所有云端历史记录与漫游消息的回调模板

◆ DeleteHistoryOnLineAsyncExCallback

typedef std::function<void(const NIMResCode, const std::string&, nim::NIMSessionType, uint64_t, const std::string&)> nim::MsgLog::DeleteHistoryOnLineAsyncExCallback

删除某一会话的云端的历史记录的回调模板

◆ DeleteHistoryOnLineNotifyCallback

typedef std::function<void(const std::list<NIMDeleteSessionHistoryMessagesNotifyInfo>& info_list)> nim::MsgLog::DeleteHistoryOnLineNotifyCallback

删除会话的云端的历史记录推送的回调模板

◆ DeleteMsgByTimeCallback

根据时间段删除部分消息历史回调模板

◆ DeleteMsglogSelfCallback

typedef std::function<void(NIMResCode res_code)> nim::MsgLog::DeleteMsglogSelfCallback

单向删除消息记录回调

◆ DeleteMsglogSelfNotifyCallback

单向删除消息记录通知回调

◆ FullTextSearchOnlineAsyncCallback

using nim::MsgLog::FullTextSearchOnlineAsyncCallback = std::function<void(nim::NIMResCode res_code, const QueryMsglogResult& message_list)>

服务器全文检索回调模板

◆ ImportDbPrgCallback

typedef std::function<void(int64_t imported_count, int64_t total_count)> nim::MsgLog::ImportDbPrgCallback

导入消息历史回调模板

◆ MessageStatusChangedCallback

发送消息已读回执通知回调模板

◆ ModifyMultipleMsglogCallback

typedef std::function<void(NIMResCode res_code, const std::string& uid, nim::NIMSessionType to_type)> nim::MsgLog::ModifyMultipleMsglogCallback

修改(多条)消息历史回调模板

◆ ModifySingleMsglogCallback

typedef std::function<void(NIMResCode res_code, const std::string& msg_id)> nim::MsgLog::ModifySingleMsglogCallback

修改(单条)消息历史回调模板

◆ QueryMessageIsThreadRootAsyncCallback

typedef std::function<void(const NIMResCode res_code, const std::string& client_id, bool is_root, int reply_count)> nim::MsgLog::QueryMessageIsThreadRootAsyncCallback

查询消息是否是thread聊天的根消息回调模板

◆ QueryMessageOnlineCallback

typedef std::function<void(const NIMResCode res_code, const std::string& client_id, const IMMessage& msg)> nim::MsgLog::QueryMessageOnlineCallback

查询某条消息的具体内容回调模板

◆ QueryMsgCallback

typedef std::function<void(NIMResCode res_code, const std::string& id, nim::NIMSessionType to_type, const QueryMsglogResult& result)> nim::MsgLog::QueryMsgCallback

查询消息历史回调模板

◆ QuerySingleMsgCallback

typedef std::function<void(NIMResCode res_code, const std::string& msg_id, const IMMessage& msg)> nim::MsgLog::QuerySingleMsgCallback

查询单条消息历史回调模板

◆ QueryThreadHistoryMsgCallback

typedef std::function< void(const NIMResCode res_code, const IMMessage& root_msg, int total, uint64_t last_msg_time, const std::list<IMMessage>& msg_list)> nim::MsgLog::QueryThreadHistoryMsgCallback

分页查询thread talk消息历史回调模板

◆ SetStatusCallback

修改消息历史状态回调模板

◆ SetSubStatusCallback

修改消息历史子状态回调模板

◆ UpdateLocalExtCallback

修改消息历史本地扩展字段内容回调模板

◆ WriteMsglogCallback

保存消息历史回调模板

Member Function Documentation

◆ BatchStatusDeleteAsync()

static bool nim::MsgLog::BatchStatusDeleteAsync ( const std::string &  account_id,
nim::NIMSessionType  to_type,
const BatchStatusDeleteCallback cb,
const std::string &  json_extension = "" 
)
static

删除某个会话的全部聊天记录

Parameters
[in]account_id要删除会话的id,account_id/uid或者tid
[in]to_type会话类型,双人0,群组1 (见nim_msglog_def.h)
[in]cb操作结果的回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ BatchStatusDeleteAsyncEx()

static bool nim::MsgLog::BatchStatusDeleteAsyncEx ( const std::string &  account_id,
nim::NIMSessionType  to_type,
bool  revert_by_query_online,
const BatchStatusDeleteCallback cb,
const std::string &  json_extension = "" 
)
static

删除某个会话的全部聊天记录

Parameters
[in]account_id要删除会话的id,account_id/uid或者tid
[in]to_type会话类型,双人0,群组1 (见nim_msglog_def.h)
[in]revert_by_online_query是否可以通过服务端查询消息记录(含入库选项)进行恢复,true:是,false:否
[in]cb操作结果的回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ BatchStatusReadAsync()

static bool nim::MsgLog::BatchStatusReadAsync ( const std::string &  account_id,
nim::NIMSessionType  to_type,
const BatchStatusReadCallback cb,
const std::string &  json_extension = "" 
)
static

批量设置已读状态

Parameters
[in]account_id查询id,account_id/uid或者tid
[in]to_type会话类型,双人0,群组1 (见nim_msglog_def.h)
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ CancelExportBackupToRemote()

static void nim::MsgLog::CancelExportBackupToRemote ( )
static

取消导出本地消息记录到云端

Returns
void

◆ CancelImportBackupFromRemote()

static void nim::MsgLog::CancelImportBackupFromRemote ( )
static

取消导入已备份在云端的消息记录

Returns
void

◆ DeleteAllAsync()

static bool nim::MsgLog::DeleteAllAsync ( bool  delete_sessions,
const DeleteAllCallback cb,
const std::string &  json_extension = "" 
)
static

删除全部消息历史

Parameters
[in]delete_sessions是否删除所有会话列表项(即全部最近联系人)。 ture则删除,并通过nim_session_reg_change_cb注册的回调通知上层kNIMSessionCommandRemoveAll事件(不会触发每个会话项的kNIMSessionCommandRemove事件); false则不删除,并将所有会话项的最后一条消息的状态kNIMSessionMsgStatus设置为已删除状态,并通过nim_session_reg_change_cb注册的回调通知上层kNIMSessionCommandAllMsgDeleted事件(不会触发每个会话项的kNIMSessionCommandUpdate事件,避免频繁通知上层)。
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ DeleteAllAsyncEx()

static bool nim::MsgLog::DeleteAllAsyncEx ( bool  delete_sessions,
bool  revert_by_query_online,
const DeleteAllCallback cb,
const std::string &  json_extension = "" 
)
static

删除全部消息历史

Parameters
[in]delete_sessions是否删除所有会话列表项(即全部最近联系人)。 ture则删除,并通过nim_session_reg_change_cb注册的回调通知上层kNIMSessionCommandRemoveAll事件(不会触发每个会话项的kNIMSessionCommandRemove事件); false则不删除,并将所有会话项的最后一条消息的状态kNIMSessionMsgStatus设置为已删除状态,并通过nim_session_reg_change_cb注册的回调通知上层kNIMSessionCommandAllMsgDeleted事件(不会触发每个会话项的kNIMSessionCommandUpdate事件,避免频繁通知上层)。
[in]revert_by_online_query是否可以通过服务端查询消息记录(含入库选项)进行恢复,true:是,false:否
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ DeleteAsync()

static bool nim::MsgLog::DeleteAsync ( const std::string &  session_id,
NIMSessionType  to_type,
const std::string &  msg_id,
const DeleteCallback cb,
const std::string &  json_extension = "" 
)
static

删除指定一条消息

Parameters
[in]session_id会话id,对方的account id或者群组tid
[in]to_type会话类型
[in]msg_id消息id
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ DeleteBySessionTypeAsync()

static bool nim::MsgLog::DeleteBySessionTypeAsync ( bool  delete_sessions,
NIMSessionType  to_type,
const DeleteBySessionTypeCallback cb,
const std::string &  json_extension = "" 
)
static

删除指定会话类型的所有消息

Parameters
[in]delete_sessions是否删除会话
[in]to_type会话类型
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ DeleteBySessionTypeAsyncEx()

static bool nim::MsgLog::DeleteBySessionTypeAsyncEx ( bool  delete_sessions,
NIMSessionType  to_type,
bool  revert_by_query_online,
const DeleteBySessionTypeCallback cb,
const std::string &  json_extension = "" 
)
static

删除指定会话类型的所有消息

Parameters
[in]delete_sessions是否删除会话
[in]to_type会话类型
[in]revert_by_online_query是否可以通过服务端查询消息记录(含入库选项)进行恢复,true:是,false:否
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ DeleteHistoryOnlineAsync() [1/2]

void nim::MsgLog::DeleteHistoryOnlineAsync ( const std::string &  accid,
bool  delete_roaming,
const std::string &  json_extension,
const DeleteHistoryOnLineAsyncCallback cb 
)
static

删除与某账号的所有云端历史记录与漫游消息(p2p)

Parameters
[in]accid对方的accid
[in]delete_roaming是否同时删除所有的漫游消息 true : 是 false : 否
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
void
Note
错误码 200:成功

◆ DeleteHistoryOnlineAsync() [2/2]

void nim::MsgLog::DeleteHistoryOnlineAsync ( const std::string &  accid,
nim::NIMSessionType  to_type,
bool  notify_self,
const std::string &  ext,
const DeleteHistoryOnLineAsyncExCallback cb 
)
static

删除某一会话的云端的历史记录[v8.0.0]

Parameters
[in]accid对方的accid(p2p:accid team:tid)
[in]to_type会话类型,双人0,群组1 (见nim_msglog_def.h)
[in]notify_self是否通知其它终端
[in]ext扩展字段
[in]cb操作结果的回调函数
Returns
void
Note
错误码 200:成功

◆ DeleteMessageSelfAsync() [1/2]

void nim::MsgLog::DeleteMessageSelfAsync ( const IMMessage msg,
const std::string  ext,
const DeleteMsglogSelfCallback cb 
)
static

单向删除某条消息记录(同时删除本地与云端)

Parameters
[in]msg要删除的消息
[in]ext用户自定义扩展字段
[in]cb操作结果的回调函数
Returns
void 无返回值
Note
错误码 200:成功

◆ DeleteMessageSelfAsync() [2/2]

void nim::MsgLog::DeleteMessageSelfAsync ( const std::list< std::tuple< IMMessage, std::string >> &  msgs,
const DeleteMsglogSelfCallback cb 
)
static

单向删除多条消息记录(同时删除本地与云端)

Parameters
[in]msg要删除的消息及自定义扩展字段
[in]cb操作结果的回调函数
Returns
void 无返回值
Note
错误码 200:成功

◆ DeleteMsgByTimeAsync()

static bool nim::MsgLog::DeleteMsgByTimeAsync ( const std::string &  session_id,
NIMSessionType  to_type,
uint64_t  from_time,
uint64_t  to_time,
const DeleteMsgByTimeCallback cb,
const std::string &  json_extension = "" 
)
static

根据时间段删除部分会话的历史消息

Parameters
[in]session_id要删除消息的会话ID
[in]to_type要删除消息的会话类型
[in]单位mstimestamp1 与 timestamp2 组成一个时间段,SDK 内部会判断大小调整入参顺序
[in]单位mstimestamp2 与 timestamp1 组成一个时间段,SDK 内部会判断大小调整入参顺序
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ DeleteMsgByTimeAsyncEx()

static bool nim::MsgLog::DeleteMsgByTimeAsyncEx ( const std::string &  session_id,
NIMSessionType  to_type,
bool  revert_by_query_online,
uint64_t  from_time,
uint64_t  to_time,
const DeleteMsgByTimeCallback cb,
const std::string &  json_extension = "" 
)
static

根据时间段删除部分会话的历史消息

Parameters
[in]session_id要删除消息的会话ID
[in]to_type要删除消息的会话类型
[in]revert_by_online_query是否可以通过服务端查询消息记录(含入库选项)进行恢复,true:是,false:否
[in]单位mstimestamp1 与 timestamp2 组成一个时间段,SDK 内部会判断大小调整入参顺序
[in]单位mstimestamp2 与 timestamp1 组成一个时间段,SDK 内部会判断大小调整入参顺序
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ ExportBackupToRemote()

static bool nim::MsgLog::ExportBackupToRemote ( const LogsBackupExportInfo export_info)
static

导出本地消息记录到云端

Parameters
[in]export_info导出需要的参数参考LogsBackupExportInfo定义
Returns
bool false : 当前有导入/导出操作正在进行中

◆ ExportDbAsync()

static bool nim::MsgLog::ExportDbAsync ( const std::string &  dst_path,
const DBFunctionCallback cb,
const std::string &  json_extension = "" 
)
static

导出整个消息历史DB文件(不包括系统消息历史)

Parameters
[in]dst_path导出时保存的目标全路径(UTF-8编码)。
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ FullTextSearchOnlineAsync()

void nim::MsgLog::FullTextSearchOnlineAsync ( const FullTextSearchOnlineAsyncParam param,
const FullTextSearchOnlineAsyncCallback cb 
)
static

在线全文检索

Parameters
[in]param全文检索参数
[in]cb全文检索结果回调函数
Returns
void 无返回值
Note
错误码 200:成功

◆ ImportBackupFromRemote()

static bool nim::MsgLog::ImportBackupFromRemote ( const LogsBackupImportInfo import_info)
static

导入已备份在云端的消息记录

Parameters
[in]export_info导入需要的参数参考LogsBackupImportInfo定义
Returns
bool false : 当前有导入/导出操作正在进行中

◆ ImportDbAsync()

static bool nim::MsgLog::ImportDbAsync ( const std::string &  src_path,
const DBFunctionCallback cb,
const ImportDbPrgCallback prg_cb,
const std::string &  json_extension = "" 
)
static

导入消息历史DB文件(不包括系统消息历史)。先验证是否自己的消息历史文件和DB加密密钥(见nim_client_def.h里的kNIMDataBaseEncryptKey),如果验证不通过,则不导入。

Parameters
[in]src_path导入源文件的全路径(UTF-8编码)。
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
[in]prg_cb导入进度的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 10600:导入消息历史时验证身份和加密密钥不通过 10601:导入消息历史时写记录失败

◆ QueryMessageIsThreadRoot()

void nim::MsgLog::QueryMessageIsThreadRoot ( const std::string  msg_client_id,
const QueryMessageIsThreadRootAsyncCallback cb 
)
static

查询某条消息是否为thread聊天的根消息

Parameters
[in]msg_client_id要查询的消息的客户端ID
[in]cb操作结果的回调函数
Returns
void 无返回值
Note
错误码 200:成功

◆ QueryMessageOnline()

void nim::MsgLog::QueryMessageOnline ( const QueryMsgAsyncParam param,
const QueryMessageOnlineCallback cb 
)
static

查询某条消息的具体内容一般用在thread talk 场景中

Parameters
[in]param要查询的消息的相关参数,可以在msglog.threadinfo中得到
[in]cb查询结果的回调函数
Returns
void 无返回值
Note
错误码 200:成功

◆ QueryMsgAsync()

static bool nim::MsgLog::QueryMsgAsync ( const std::string &  account_id,
nim::NIMSessionType  to_type,
int  limit_count,
int64_t  anchor_msg_time,
const QueryMsgCallback cb,
const std::string &  json_extension = "" 
)
static

查询本地消息

Parameters
[in]account_id查询id,account_id/uid或者tid
[in]to_type会话类型,双人0,群组1 (见nim_msglog_def.h)
[in]limit_count一次查询数量,建议20
[in]anchor_msg_time作为此次查询的定位点的消息历史的消息时间戳(上次查询最后一条消息的时间戳,按指定的时间的顺序起查,默认为逆序,2.4.0之前命名为last_name)
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb查询本地消息的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功

◆ QueryMsgByIDAysnc()

static bool nim::MsgLog::QueryMsgByIDAysnc ( const std::string &  client_msg_id,
const QuerySingleMsgCallback cb,
const std::string &  json_extension = "" 
)
static

根据消息ID查询本地(单条)消息

Parameters
[in]client_msg_id客户端消息ID
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb查询本地消息的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ QueryMsgByKeywordOnlineAsync()

static bool nim::MsgLog::QueryMsgByKeywordOnlineAsync ( const MsgLog::QueryMsgByKeywordOnlineParam param,
const QueryMsgCallback cb 
)
static

在线查询消息(不包括系统消息)

Parameters
[in]param查询参数
[in]cb在线查询消息的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 403:禁止访问(不在该群,只针对群组会话) 414:参数错误

◆ QueryMsgByOptionsAsync()

static bool nim::MsgLog::QueryMsgByOptionsAsync ( NIMMsgLogQueryRange  query_range,
const std::list< std::string > &  ids,
int  limit_count,
int64_t  from_time,
int64_t  end_time,
const std::string &  end_client_msg_id,
bool  reverse,
NIMMessageType  msg_type,
const std::string &  search_content,
const QueryMsgCallback cb,
const std::string &  json_extension = "" 
)
static

根据指定条件查询本地消息,使用此接口可以完成全局搜索等功能,具体请参阅开发手册 http://dev.netease.im/docs/product/IM%E5%8D%B3%E6%97%B6%E9%80%9A%E8%AE%AF/SDK%E5%BC%80%E5%8F%91%E9%9B%86%E6%88%90/Windows%E5%BC%80%E5%8F%91%E9%9B%86%E6%88%90/%E5%8E%86%E5%8F%B2%E8%AE%B0%E5%BD%95

Parameters
[in]query_range消息历史的检索范围(目前暂不支持某些范围的组合检索,详见NIMMsgLogQueryRange说明)
[in]ids会话id(对方的account id或者群组tid)的集合,目前暂不支持多个的组合检索,详见NIMMsgLogQueryRange说明
[in]limit_count本次查询的消息条数上限(最多100条)
[in]from_time起始时间点,单位:毫秒
[in]end_time结束时间点,单位:毫秒
[in]end_client_msg_id结束查询的最后一条消息的end_client_msg_id(不包含在查询结果中)
[in]reversetrue:反向查询(按时间正序起查,正序排列),false:按时间逆序起查,逆序排列(建议默认为false)
[in]msg_type检索的消息类型(目前只支持kNIMMessageTypeText、kNIMMessageTypeImage和kNIMMessageTypeFile这三种类型消息)
[in]search_content检索文本(目前只支持kNIMMessageTypeText和kNIMMessageTypeFile这两种类型消息的文本关键字检索,即支持文字消息和文件名的检索。如果合并检索,需使用未知类型消息kNIMMessageTypeUnknown)
[in]cb在线查询消息的回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功

◆ QueryMsgByOptionsAsyncEx()

static bool nim::MsgLog::QueryMsgByOptionsAsyncEx ( const QueryMsgByOptionsAsyncParam param,
const QueryMsgCallback cb 
)
static

根据指定条件查询本地消息,使用此接口可以完成全局搜索等功能,具体请参阅开发手册 http://dev.netease.im/docs/product/IM%E5%8D%B3%E6%97%B6%E9%80%9A%E8%AE%AF/SDK%E5%BC%80%E5%8F%91%E9%9B%86%E6%88%90/Windows%E5%BC%80%E5%8F%91%E9%9B%86%E6%88%90/%E5%8E%86%E5%8F%B2%E8%AE%B0%E5%BD%95

Parameters
[in]param查询参数
[in]cb在线查询消息的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功

◆ QueryMsgOfSpecifiedTypeInASessionAsync()

static bool nim::MsgLog::QueryMsgOfSpecifiedTypeInASessionAsync ( nim::NIMSessionType  to_type,
const std::string &  id,
int  limit_count,
int64_t  from_time,
int64_t  end_time,
const std::string &  end_client_msg_id,
bool  reverse,
std::list< NIMMessageType >  msg_type,
const QueryMsgCallback cb,
const std::string &  json_extension = "" 
)
static

根据指定条件在一个会话中查询指定单个或多个类型的本地消息

Parameters
[in]to_type会话类型,双人0,群组1 (nim_msglog_def.h)
[in]id查询id,对方的account id或者群组tid。
[in]limit_count本次查询的消息条数上限(最多100条)
[in]from_time起始时间点,单位:毫秒
[in]end_time结束时间点,单位:毫秒
[in]end_client_msg_id结束查询的最后一条消息的end_client_msg_id(不包含在查询结果中)
[in]reversetrue:反向查询(按时间正序起查,正序排列),false:按时间逆序起查,逆序排列(建议默认为false)
[in]msg_type检索的消息类型
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb在线查询消息的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功

◆ QueryMsgOnlineAsync() [1/2]

static bool nim::MsgLog::QueryMsgOnlineAsync ( const QueryMsgOnlineAsyncParam param,
const QueryMsgCallback cb 
)
static

在线查询消息(不包括系统消息)

Parameters
[in]param查询参数
[in]cb在线查询消息的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 403:禁止访问(不在该群,只针对群组会话) 414:参数错误

◆ QueryMsgOnlineAsync() [2/2]

static bool nim::MsgLog::QueryMsgOnlineAsync ( const std::string &  id,
nim::NIMSessionType  to_type,
int  limit_count,
int64_t  from_time,
int64_t  end_time,
int64_t  end_msg_id,
bool  reverse,
bool  need_save_to_local,
const QueryMsgCallback cb,
const std::string &  json_extension = "" 
)
static

在线查询消息(不包括系统消息)

Parameters
[in]id查询id,对方的account id或者群组tid。
[in]to_type会话类型,双人0,群组1 (nim_msglog_def.h)
[in]limit_count本次查询的消息条数上限(最多100条)
[in]from_time起始时间点,单位:毫秒
[in]end_time结束时间点,单位:毫秒
[in]end_msg_id结束查询的最后一条消息的server_msg_id(不包含在查询结果中)
[in]reversetrue:反向查询(按时间正序起查,正序排列),false:按时间逆序起查,逆序排列(建议默认为false)
[in]need_save_to_localtrue: 将在线查询结果保存到本地,false: 不保存
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb在线查询消息的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 403:禁止访问(不在该群,只针对群组会话) 414:参数错误

◆ QueryReceivedMsgReceiptSent()

bool nim::MsgLog::QueryReceivedMsgReceiptSent ( const IMMessage msg)
static

查询收到的消息是否已经发送过已读回执

Parameters
[in]msg消息。
Returns
bool 是否已发送过

◆ QuerySentMessageBeReaded()

bool nim::MsgLog::QuerySentMessageBeReaded ( const IMMessage msg)
static

查询自己发送的消息是否被对方已读

Parameters
[in]msg消息。
Returns
bool 是否被已读

◆ QueryThreadHistoryMsg()

void nim::MsgLog::QueryThreadHistoryMsg ( const IMMessage msg,
const QueryThreadHistoryMsgAsyncParam param,
const QueryThreadHistoryMsgCallback cb 
)
static

分页查询thread talk消息历史

Parameters
[in]param要查询的消息的相关参数,可以在msglog.threadinfo中得到
[in]cb查询结果的回调函数
Returns
void 无返回值
Note
错误码 200:成功

◆ ReadAllAsync()

static bool nim::MsgLog::ReadAllAsync ( const DBFunctionCallback cb,
const std::string &  json_extension = "" 
)
static

全部未读消息历史标记为已读

Parameters
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ RegDeleteHistoryMessagesNotify()

void nim::MsgLog::RegDeleteHistoryMessagesNotify ( const DeleteHistoryOnLineNotifyCallback cb)
static

注册删除某一会话的云端的历史记录通知回调[v8.0.0]

Parameters
[in]cb删除某一会话的云端的历史记录通知回调
Returns
void 无返回值

◆ RegDeleteMsglogSelfNotify()

void nim::MsgLog::RegDeleteMsglogSelfNotify ( const DeleteMsglogSelfNotifyCallback cb)
static

注册单向删除消息记录通知回调

Parameters
[in]cb单向删除消息记录通知回调
Returns
void 无返回值

◆ RegMessageStatusChangedCb()

void nim::MsgLog::RegMessageStatusChangedCb ( const MessageStatusChangedCallback cb,
const std::string &  json_extension = "" 
)
static

(全局回调)注册全局的消息状态变更通知(目前只支持已读状态的通知)

Parameters
[in]cb回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
void 无返回值
Note
错误码 200:成功

◆ SendReceiptAsync()

void nim::MsgLog::SendReceiptAsync ( const std::string &  json_msg,
const MessageStatusChangedCallback cb 
)
static

发送消息已读回执

Parameters
[in]json_msg已读消息json string。
[in]cb操作结果的回调函数
Returns
void 无返回值
Note
错误码 200:成功 403:服务器关闭此功能,或者应用没权限 404:请求的目标(用户或对象)不存在 10414:本地错误码,参数错误

◆ SetStatusAsync()

static bool nim::MsgLog::SetStatusAsync ( const std::string &  msg_id,
nim::NIMMsgLogStatus  msglog_status,
const SetStatusCallback cb,
const std::string &  json_extension = "" 
)
static

设置消息状态

Parameters
[in]msg_id消息id
[in]msglog_status消息状态枚举值
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ SetSubStatusAsync()

static bool nim::MsgLog::SetSubStatusAsync ( const std::string &  msg_id,
nim::NIMMsgLogSubStatus  msglog_sub_status,
const SetSubStatusCallback cb,
const std::string &  json_extension = "" 
)
static

设置消息子状态

Parameters
[in]msg_id消息id
[in]msglog_sub_status消息子状态枚举值
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ UnregMsglogCb()

void nim::MsgLog::UnregMsglogCb ( )
static

反注册Msglog提供的所有回调

Returns
void 无返回值

◆ UnregMsgologCb()

void nim::MsgLog::UnregMsgologCb ( )
static

反注册Msglog提供的所有回调

Returns
void 无返回值

◆ UpdateLocalExtAsync()

static bool nim::MsgLog::UpdateLocalExtAsync ( const std::string &  msg_id,
const std::string &  local_ext,
const UpdateLocalExtCallback cb,
const std::string &  json_extension = "" 
)
static

更新本地消息扩展字段内容

Parameters
[in]msg_id消息id
[in]local_ext本地扩展字段内容
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ WriteMsglogToLocalAsync()

static bool nim::MsgLog::WriteMsglogToLocalAsync ( const std::string &  talk_id,
const IMMessage msg,
bool  need_update_session,
const WriteMsglogCallback cb,
const std::string &  json_extension = "" 
)
static

只往本地消息历史数据库里写入一条消息(如果已存在这条消息,则更新。通常是APP的本地自定义消息,并不会发给服务器)

Parameters
[in]account_id会话id,对方的account id或者群组tid
[in]msg消息内容
[in]need_update_session是否更新会话列表(一般最新一条消息有这个需求)
[in]json_extensionjson扩展参数(备用,目前不需要)
[in]cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

◆ WriteMsglogToLocalAsyncEx()

static bool nim::MsgLog::WriteMsglogToLocalAsyncEx ( const std::string &  talk_id,
const IMMessage msg,
bool  need_update_session,
bool  compose_last_msg,
const std::list< NIMMessageType > &  exclude_msg_type,
const WriteMsglogCallback cb 
)
static

static bool WriteMsglogToLocalAsyncEx(const std::string& talk_id, const IMMessage& msg, bool need_update_session, bool compose_last_msg, const std::list<NIMMessageType>& exclude_msg_type, const WriteMsglogCallback& cb) 只往本地消息历史数据库里写入一条消息(如果已存在这条消息,则更新。通常是APP的本地自定义消息,并不会发给服务器)

Parameters
talk_id会话id,对方的account id或者群组tid
msg消息内容
need_update_session是否更新会话列表(一般最新一条消息有这个需求)
compose_last_msg如果消息历史中有该会话的消息,是否将该会话最后一条消息随会话变更上报,true 为携带,否则不携带
exclude_msg_type如果 compose_last_msg = true,则可根据需要排除指定最后一条消息的类型
cb操作结果的回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 0:失败

The documentation for this class was generated from the following file: