NIM Unity SDK V2.6.0
载入中...
搜索中...
未找到
静态 Public 成员函数 | 所有成员列表
NIM.Messagelog.MessagelogAPI类 参考

静态 Public 成员函数

static void QuerylogById (string clientMsgId, QueryLogByMsgIdResultDelegate action)
 根据消息ID查询本地(单条)消息
 
static void QueryMsglogLocally (string accountId, NIMSessionType sType, int limit, long msgAnchorTimetag, QueryMsglogResultDelegate action)
 查询本地消息(按时间逆序起查,逆序排列)
 
static void QueryMsglogLocally (QueryMsglogParams args, QueryMsglogResultDelegate action)
 包含起止时间的历史消息查询
 
static void QueryMsglogOnline (string id, NIMSessionType sType, int limit, long sTimetag, long eTimetag, long endMsgId, bool reverse, bool saveLocal, QueryMsglogResultDelegate action)
 在线查询消息
 
static void QueryMsglogOnline (string id, NIMSessionType sType, int limit, long sTimetag, long eTimetag, long endMsgId, bool reverse, bool saveLocal, bool autoDownloadAttach, QueryMsglogResultDelegate action)
 在线查询消息
 
static void QueryMsglogByCustomCondition (NIMMsgLogQueryRange range, string[] ids, int limit, long sTimetag, long eTimetag, string endMsgId, bool reverse, NIMMessageType msgType, string searchContent, QueryMsglogResultDelegate action)
 根据指定条件查询本地消息,使用此接口可以完成全局搜索等功能,具体请参阅开发手册 http://dev.netease.im/docs?doc=pc&#历史记录
 
static void MarkMessagesStatusRead (string id, NIMSessionType sType, OperateMsglogResultDelegate action)
 批量设置未读状态为已读消息状态
 
static void BatchDeleteMeglog (string id, NIMSessionType sType, OperateMsglogResultDelegate action)
 批量删除指定对话的消息。删除成功后,将相应会话项的最后一条消息的状态kNIMSessionMsgStatus设置为已删除状态
 
static void SetMsglogStatus (string msgId, NIMMsgLogStatus status, OperateSingleLogResultDelegate action)
 设置消息状态
 
static void SetMsglogSubStatus (string msgId, NIMMsgLogSubStatus status, OperateSingleLogResultDelegate action)
 设置消息子状态
 
static void WriteMsglog (string uid, bool need_update_session, NIMIMMessage msg, OperateSingleLogResultDelegate action)
 往本地消息历史数据库里写入一条消息(如果已存在这条消息,则更新。通常是APP的本地自定义消息,并不会发给服务器)
 
static void DeleteMsglogsBySessionType (NIMSessionType sType, bool deleteSessions, OperateMsglogResultDelegate action)
 删除指定会话类型的所有消息
 
static void DeleteSpecifiedMsglog (string sid, NIMSessionType sType, string msgId, OperateSingleLogResultDelegate action)
 删除指定一条消息
 
static void ClearAll (bool deleteSessions, CommonOperationResultDelegate action)
 删除全部消息历史
 
static void ExportDatabaseFile (string destPath, CommonOperationResultDelegate action)
 导出整个消息历史DB文件(不包括系统消息历史) android 和 ios 平台下不可用
 
static void ImportDatabase (string srcPath, CommonOperationResultDelegate action, ImportProgressDelegate prg)
 导入消息历史DB文件(不包括系统消息历史)。先验证是否自己的消息历史文件和DB加密密钥,如果验证不通过,则不导入。 android 和 ios 平台下不可用
 
static bool IsMessageBeReaded (NIMIMMessage msg, string jsonExtension=null)
 消息是否已经被查看
 
static void SendReceipt (NIMIMMessage msg, MsglogStatusChangedDelegate cb, string jsonExtension=null)
 发送已读回执
 
static void RegMsglogStatusChangedCb (MsglogStatusChangedDelegate cb)
 注册全局的消息状态变更通知(目前只支持已读状态的通知)
 
static void UpdateLocalExt (string msgId, string localExt, UpdateLocalExtDelegate cb)
 更新本地扩展字段内容
 

成员函数说明

◆ QuerylogById()

static void NIM.Messagelog.MessagelogAPI.QuerylogById ( string  clientMsgId,
QueryLogByMsgIdResultDelegate  action 
)
inlinestatic

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

参数
clientMsgId
action

◆ QueryMsglogLocally() [1/2]

static void NIM.Messagelog.MessagelogAPI.QueryMsglogLocally ( string  accountId,
NIMSessionType  sType,
int  limit,
long  msgAnchorTimetag,
QueryMsglogResultDelegate  action 
)
inlinestatic

查询本地消息(按时间逆序起查,逆序排列)

参数
accountId会话id,对方的account id或者群组tid
sType会话类型
limit一次查询数量,建议20
msgAnchorTimetag上次查询最后一条消息的时间戳(按时间逆序起查,即最小的时间戳)
action

◆ QueryMsglogLocally() [2/2]

static void NIM.Messagelog.MessagelogAPI.QueryMsglogLocally ( QueryMsglogParams  args,
QueryMsglogResultDelegate  action 
)
inlinestatic

包含起止时间的历史消息查询

参数
args查询参数
action查询结果回调通知

◆ QueryMsglogOnline() [1/2]

static void NIM.Messagelog.MessagelogAPI.QueryMsglogOnline ( string  id,
NIMSessionType  sType,
int  limit,
long  sTimetag,
long  eTimetag,
long  endMsgId,
bool  reverse,
bool  saveLocal,
QueryMsglogResultDelegate  action 
)
inlinestatic

在线查询消息

参数
id会话id,对方的account id或者群组tid
sType会话类型
limit本次查询的消息条数上限(最多100条)
sTimetag起始时间点,单位:毫秒
eTimetag结束时间点,单位:毫秒
endMsgId结束查询的最后一条消息的server_msg_id(不包含在查询结果中)
reversetrue:反向查询(按时间正序起查,正序排列),false:按时间逆序起查,逆序排列(建议默认为false)
saveLocaltrue: 将在线查询结果保存到本地,false: 不保存
action

◆ QueryMsglogOnline() [2/2]

static void NIM.Messagelog.MessagelogAPI.QueryMsglogOnline ( string  id,
NIMSessionType  sType,
int  limit,
long  sTimetag,
long  eTimetag,
long  endMsgId,
bool  reverse,
bool  saveLocal,
bool  autoDownloadAttach,
QueryMsglogResultDelegate  action 
)
inlinestatic

在线查询消息

参数
id会话id,对方的account id或者群组tid
sType会话类型
limit本次查询的消息条数上限(最多100条)
sTimetag起始时间点,单位:毫秒
eTimetag结束时间点,单位:毫秒
endMsgId结束查询的最后一条消息的server_msg_id(不包含在查询结果中)
reversetrue:反向查询(按时间正序起查,正序排列),false:按时间逆序起查,逆序排列(建议默认为false)
saveLocaltrue: 将在线查询结果保存到本地,false: 不保存
autoDownloadAttach查询结果回来后,是否需要sdk自动下载消息附件
action

◆ QueryMsglogByCustomCondition()

static void NIM.Messagelog.MessagelogAPI.QueryMsglogByCustomCondition ( NIMMsgLogQueryRange  range,
string[]  ids,
int  limit,
long  sTimetag,
long  eTimetag,
string  endMsgId,
bool  reverse,
NIMMessageType  msgType,
string  searchContent,
QueryMsglogResultDelegate  action 
)
inlinestatic

根据指定条件查询本地消息,使用此接口可以完成全局搜索等功能,具体请参阅开发手册 http://dev.netease.im/docs?doc=pc&#历史记录

参数
range消息历史的检索范围
ids会话id(对方的account id或者群组tid)的集合
limit本次查询的消息条数上限(默认100条)
sTimetag起始时间点,单位:毫秒
eTimetag结束时间点,单位:毫秒
endMsgId结束查询的最后一条消息的client_msg_id(不包含在查询结果中)(暂不启用)
reversetrue:反向查询(按时间正序起查,正序排列),false:按时间逆序起查,逆序排列(建议默认为false)
msgType检索的消息类型(目前只支持kNIMMessageTypeText、kNIMMessageTypeImage和kNIMMessageTypeFile这三种类型消息)
searchContent检索文本(目前只支持kNIMMessageTypeText和kNIMMessageTypeFile这两种类型消息的文本关键字检索, 即支持文字消息和文件名的检索。 如果合并检索,需使用未知类型消息kNIMMessageTypeUnknown)
action

◆ MarkMessagesStatusRead()

static void NIM.Messagelog.MessagelogAPI.MarkMessagesStatusRead ( string  id,
NIMSessionType  sType,
OperateMsglogResultDelegate  action 
)
inlinestatic

批量设置未读状态为已读消息状态

参数
id
sType
action

◆ BatchDeleteMeglog()

static void NIM.Messagelog.MessagelogAPI.BatchDeleteMeglog ( string  id,
NIMSessionType  sType,
OperateMsglogResultDelegate  action 
)
inlinestatic

批量删除指定对话的消息。删除成功后,将相应会话项的最后一条消息的状态kNIMSessionMsgStatus设置为已删除状态

参数
id会话id,对方的account id或者群组tid
sType会话类型
action

◆ SetMsglogStatus()

static void NIM.Messagelog.MessagelogAPI.SetMsglogStatus ( string  msgId,
NIMMsgLogStatus  status,
OperateSingleLogResultDelegate  action 
)
inlinestatic

设置消息状态

参数
msgId
status
action

◆ SetMsglogSubStatus()

static void NIM.Messagelog.MessagelogAPI.SetMsglogSubStatus ( string  msgId,
NIMMsgLogSubStatus  status,
OperateSingleLogResultDelegate  action 
)
inlinestatic

设置消息子状态

参数
msgId
status
action

◆ WriteMsglog()

static void NIM.Messagelog.MessagelogAPI.WriteMsglog ( string  uid,
bool  need_update_session,
NIMIMMessage  msg,
OperateSingleLogResultDelegate  action 
)
inlinestatic

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

参数
uid会话id,对方的account id或者群组tid
need_update_session是否更新会话列表(一般最新一条消息会有更新的需求)
msg消息体
action操作结果的回调函数

◆ DeleteMsglogsBySessionType()

static void NIM.Messagelog.MessagelogAPI.DeleteMsglogsBySessionType ( NIMSessionType  sType,
bool  deleteSessions,
OperateMsglogResultDelegate  action 
)
inlinestatic

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

参数
sType会话类型
deleteSessions是否删除指定会话类型的所有会话列表项
action

◆ DeleteSpecifiedMsglog()

static void NIM.Messagelog.MessagelogAPI.DeleteSpecifiedMsglog ( string  sid,
NIMSessionType  sType,
string  msgId,
OperateSingleLogResultDelegate  action 
)
inlinestatic

删除指定一条消息

参数
sid
sType
msgId
action

◆ ClearAll()

static void NIM.Messagelog.MessagelogAPI.ClearAll ( bool  deleteSessions,
CommonOperationResultDelegate  action 
)
inlinestatic

删除全部消息历史

参数
deleteSessions是否删除所有会话列表项(即全部最近联系人)
action

◆ ExportDatabaseFile()

static void NIM.Messagelog.MessagelogAPI.ExportDatabaseFile ( string  destPath,
CommonOperationResultDelegate  action 
)
inlinestatic

导出整个消息历史DB文件(不包括系统消息历史) android 和 ios 平台下不可用

参数
destPath导出时保存的目标全路径
action

◆ ImportDatabase()

static void NIM.Messagelog.MessagelogAPI.ImportDatabase ( string  srcPath,
CommonOperationResultDelegate  action,
ImportProgressDelegate  prg 
)
inlinestatic

导入消息历史DB文件(不包括系统消息历史)。先验证是否自己的消息历史文件和DB加密密钥,如果验证不通过,则不导入。 android 和 ios 平台下不可用

参数
srcPath
action
prg

◆ IsMessageBeReaded()

static bool NIM.Messagelog.MessagelogAPI.IsMessageBeReaded ( NIMIMMessage  msg,
string  jsonExtension = null 
)
inlinestatic

消息是否已经被查看

参数
msg
jsonExtension
返回

◆ RegMsglogStatusChangedCb()

static void NIM.Messagelog.MessagelogAPI.RegMsglogStatusChangedCb ( MsglogStatusChangedDelegate  cb)
inlinestatic

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

参数
cb

◆ UpdateLocalExt()

static void NIM.Messagelog.MessagelogAPI.UpdateLocalExt ( string  msgId,
string  localExt,
UpdateLocalExtDelegate  cb 
)
inlinestatic

更新本地扩展字段内容

参数
msgId消息Id
localExt消息本地扩展字段内容
cb操作结果的回调函数

该类的文档由以下文件生成: