Exemple #1
0
    public static void MsgGetMoreMsgList()
    {
        string conv_id = "287646";

        if (lastMsg == null)
        {
            Utils.Log("没有lastMsg");
            return;
        }

        MsgGetMsgListParam get_message_list_param = new MsgGetMsgListParam();

        get_message_list_param.msg_getmsglist_param_count    = 1;
        get_message_list_param.msg_getmsglist_param_last_msg = lastMsg;

        TIMResult res = TencentIMSDK.MsgGetMsgList(conv_id, TIMConvType.kTIMConv_C2C, get_message_list_param, (int code, string desc, string json_param, string user_data) =>
        {
            List <Message> messages = JsonConvert.DeserializeObject <List <Message> >(json_param);
            if (messages.Count > 0)
            {
                lastMsg = lastMsg = messages[messages.Count - 1];
            }
            addAsyncDataToConsole(code, desc, json_param, user_data);
            Utils.Log("历史消息列表Count:" + messages.Count.ToString());
        });

        Utils.Log(((int)res).ToString());
        addDataToConsole(res);
    }
Exemple #2
0
    void MsgGetMsgListSDK()
    {
        var get_message_list_param = new MsgGetMsgListParam
        {
            msg_getmsglist_param_count = 20
        };

        if (LastMessage != null)
        {
            get_message_list_param.msg_getmsglist_param_last_msg = LastMessage;
        }
        if (SelectedGroup.value > 0)
        {
            print(GroupList[SelectedGroup.value]);
            TIMResult res = TencentIMSDK.MsgGetMsgList(GroupList[SelectedGroup.value], TIMConvType.kTIMConv_Group, get_message_list_param, Utils.addAsyncStringDataToScreen(GetResult));
            Result.text = Utils.SynchronizeResult(res);
        }
        else if (SelectedFriend.value > 0)
        {
            print(FriendList[SelectedFriend.value]);
            TIMResult res = TencentIMSDK.MsgGetMsgList(FriendList[SelectedFriend.value], TIMConvType.kTIMConv_C2C, get_message_list_param, Utils.addAsyncStringDataToScreen(GetResult));
            Result.text = Utils.SynchronizeResult(res);
        }
    }