From 6412b0796180745465321345767b7f1f68bab4f8 Mon Sep 17 00:00:00 2001 From: imndx Date: Tue, 30 Mar 2021 15:09:46 +0800 Subject: [PATCH] update insertMessage --- .../java/cn/wildfirechat/remote/ChatManager.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/client/src/main/java/cn/wildfirechat/remote/ChatManager.java b/client/src/main/java/cn/wildfirechat/remote/ChatManager.java index 0c61b4c98..b2aa32cfa 100644 --- a/client/src/main/java/cn/wildfirechat/remote/ChatManager.java +++ b/client/src/main/java/cn/wildfirechat/remote/ChatManager.java @@ -1424,14 +1424,20 @@ public Message insertMessage(Conversation conversation, String sender, long mess Message message = new Message(); message.conversation = conversation; message.content = content; - message.sender = sender; message.status = status; message.messageUid = messageUid; message.serverTime = serverTime; - if (this.userId.equals(sender)) { - message.direction = MessageDirection.Send; - } else { + + message.direction = MessageDirection.Send; + if(status.value() >= MessageStatus.Mentioned.value()){ message.direction = MessageDirection.Receive; + if(conversation.type == Conversation.ConversationType.Single){ + message.sender = conversation.target; + }else { + message.sender = sender; + } + }else { + message.sender = getUserId(); } try {