From aeb063f6f8f0992342a6af95e55073d7caa58647 Mon Sep 17 00:00:00 2001 From: oneRain Date: Mon, 13 Apr 2020 10:46:49 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=A2=9E=E5=8A=A0=20rcp=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Internal/Controller/LCIMRcpController.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Realtime/Internal/Controller/LCIMRcpController.cs diff --git a/Realtime/Internal/Controller/LCIMRcpController.cs b/Realtime/Internal/Controller/LCIMRcpController.cs new file mode 100644 index 0000000..7760117 --- /dev/null +++ b/Realtime/Internal/Controller/LCIMRcpController.cs @@ -0,0 +1,29 @@ +using System.Threading.Tasks; +using LeanCloud.Realtime.Protocol; + +namespace LeanCloud.Realtime.Internal.Controller { + internal class LCIMRcpController : LCIMController { + internal LCIMRcpController(LCIMClient client) : base(client) { + + } + + #region 消息处理 + + internal override async Task OnNotification(GenericCommand notification) { + RcpCommand rcp = notification.RcpMessage; + string convId = rcp.Cid; + string msgId = rcp.Id; + long timestamp = rcp.T; + bool isRead = rcp.Read; + string fromId = rcp.From; + LCIMConversation conversation = await Client.GetOrQueryConversation(convId); + if (isRead) { + Client.OnMessageRead?.Invoke(conversation, msgId); + } else { + Client.OnMessageDelivered?.Invoke(conversation, msgId); + } + } + + #endregion + } +}