diff --git a/Realtime/Realtime/Conversation/LCIMConversation.cs b/Realtime/Realtime/Conversation/LCIMConversation.cs index fb6c9a0..b0f4015 100644 --- a/Realtime/Realtime/Conversation/LCIMConversation.cs +++ b/Realtime/Realtime/Conversation/LCIMConversation.cs @@ -477,6 +477,9 @@ namespace LeanCloud.Realtime { if (conv.TryGetValue("objectId", out object idObj)) { Id = idObj as string; } + if (conv.TryGetValue("name", out object nameObj)) { + Name = nameObj as string; + } if (conv.TryGetValue("unique", out object uniqueObj)) { Unique = (bool)uniqueObj; } diff --git a/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs b/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs index af0455f..1f23ead 100644 --- a/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs +++ b/Realtime/Realtime/Internal/Controller/LCIMConversationController.cs @@ -43,18 +43,21 @@ namespace LeanCloud.Realtime.Internal.Controller { if (members != null) { conv.M.AddRange(members); } - if (!string.IsNullOrEmpty(name)) { - conv.N = name; - } if (temporary) { conv.TempConv = temporary; conv.TempConvTTL = temporaryTtl; } - if (properties != null) { - conv.Attr = new JsonObjectMessage { - Data = JsonConvert.SerializeObject(LCEncoder.Encode(properties)) - }; + Dictionary attrs = new Dictionary(); + if (!string.IsNullOrEmpty(name)) { + attrs["name"] = name; } + if (properties != null) { + attrs = properties.Union(attrs) + .ToDictionary(k => k.Key, v => v.Value); + } + conv.Attr = new JsonObjectMessage { + Data = JsonConvert.SerializeObject(LCEncoder.Encode(attrs)) + }; if (Client.SignatureFactory != null) { LCIMSignature signature = await Client.SignatureFactory.CreateStartConversationSignature(Client.Id, members); conv.S = signature.Signature; @@ -84,6 +87,8 @@ namespace LeanCloud.Realtime.Internal.Controller { conversation.CreatorId = Client.Id; conversation.ids = members != null ? new HashSet(members) : new HashSet(); + // 将自己加入 + conversation.ids.Add(Client.Id); conversation.CreatedAt = DateTime.Parse(response.ConvMessage.Cdate); conversation.UpdatedAt = conversation.CreatedAt; return conversation; diff --git a/Realtime/Realtime/Internal/Controller/LCIMMessageController.cs b/Realtime/Realtime/Internal/Controller/LCIMMessageController.cs index 784a895..0369be1 100644 --- a/Realtime/Realtime/Internal/Controller/LCIMMessageController.cs +++ b/Realtime/Realtime/Internal/Controller/LCIMMessageController.cs @@ -70,6 +70,7 @@ namespace LeanCloud.Realtime.Internal.Controller { AckCommand ack = response.AckMessage; message.Id = ack.Uid; message.SentTimestamp = ack.T; + message.FromClientId = Client.Id; return message; }