From 290a3cea0e44899077b233d7e4ca8f97411940a3 Mon Sep 17 00:00:00 2001 From: heavyrian2012 Date: Tue, 28 Feb 2023 20:45:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8D=95=E8=81=8A=E4=BC=9A?= =?UTF-8?q?=E8=AF=9D=E7=9A=84=E5=AE=9A=E5=90=91=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/io/moquette/persistence/DatabaseStore.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/broker/src/main/java/io/moquette/persistence/DatabaseStore.java b/broker/src/main/java/io/moquette/persistence/DatabaseStore.java index 0608ba23..840fefe2 100644 --- a/broker/src/main/java/io/moquette/persistence/DatabaseStore.java +++ b/broker/src/main/java/io/moquette/persistence/DatabaseStore.java @@ -815,7 +815,7 @@ public class DatabaseStore { long beforeUid = before[0]; String sql = "select `_mid`, `_from`, `_type`, `_target`, `_line`, `_data`, `_dt`, `_to` from " + table +" where"; if (conversation.getType() == ProtoConstants.ConversationType.ConversationType_Private) { - sql += " _type = ? and _line = ? and _mid < ? and ((_target = ? and _from = ?) or (_target = ? and _from = ?))"; + sql += " _type = ? and _line = ? and _mid < ? and ((_target = ? and _from = ?) or (_target = ? and _from = ?)) and (_to = '' or _to = ?)"; } else if (conversation.getType() == ProtoConstants.ConversationType.ConversationType_Channel && !user.equals(channelOwner)) { sql += " _type = ? and _line = ? and _mid < ? and _target = ? and ((_from = ? and (_to = '' or _to = ?)) or (_from = ?))"; } else { @@ -853,6 +853,7 @@ public class DatabaseStore { statement.setString(index++, user); statement.setString(index++, user); statement.setString(index++, conversation.getTarget()); + statement.setString(index++, user); } else if (conversation.getType() == ProtoConstants.ConversationType.ConversationType_Channel && !user.equals(channelOwner)) { statement.setString(index++, channelOwner); statement.setString(index++, user);