ConvGetConvList 获取会话列表时,该接口会先返回置顶的会话,再返回未置顶的会话。您可以通过 ConvInfo 对象的 conv_is_pinned 字段,检查会话有没有置顶。// conv_is_pinned 参数为 true,表示置顶会话,否则,表示取消置顶。bool conv_is_pinned = true;TIMResult res = TencentIMSDK.ConvPinConversation(conv_id, conv_is_pinned, (int code, string desc, string user_data)=>{// 处理异步逻辑});
SetConvEventCallback(Details) 添加会话监听器,就可以在 ConvEventCallback 中获取到 ConvInfo 对象的 conv_is_pinned 字段值。根据这个字段可以判断会话的置顶状态是否变化。
示例代码如下:TencentIMSDK.SetConvEventCallback((TIMConvEvent conv_event, List<ConvInfo> conv_list, string user_data)=>{foreach(ConvInfo conv_info in conv_list) {if (conv_info.conv_is_pinned) {// 处理回调逻辑}}});
文档反馈