diff --git a/Client/Forms/FormRoom.cs b/Client/Forms/FormRoom.cs index 7fbeae3..584d07c 100644 --- a/Client/Forms/FormRoom.cs +++ b/Client/Forms/FormRoom.cs @@ -75,6 +75,8 @@ private void txtChat_KeyDown(object sender, KeyEventArgs e) e.SuppressKeyPress = true; picSend_Click(sender, new EventArgs()); } + else if (e.KeyCode == Keys.Escape) + Close(); } private void picSend_Click(object sender, EventArgs e) { diff --git a/Server/Classes/Client.cs b/Server/Classes/Client.cs index 3218c73..19e7d87 100644 --- a/Server/Classes/Client.cs +++ b/Server/Classes/Client.cs @@ -213,7 +213,7 @@ public void Recieve() else Log("Room", $"{p.room.target} 채팅방 조회"); - Send(new ChatsPacket(Database.GetChats(p.room, p.until))); + Send(new ChatsPacket(Database.GetChats(p.room.id, p.until))); } } else if (packet.type == PacketType.Chat) diff --git a/Server/Classes/Database.cs b/Server/Classes/Database.cs index c6edbf9..b3f7066 100644 --- a/Server/Classes/Database.cs +++ b/Server/Classes/Database.cs @@ -288,11 +288,11 @@ public static Chat GetLastChat(Room room) } return null; } - public static List GetChats(Room room, DateTime until) + public static List GetChats(string roomId, DateTime until) { List chats = new List(); MySqlCommand cmd = new MySqlCommand( - $"SELECT * FROM chat WHERE room_id='{Filter(room.id)}'" + $"SELECT * FROM chat WHERE room_id='{Filter(roomId)}'" + "AND chat_date < @chat_date_until LIMIT 100", con); cmd.Parameters.AddWithValue("@chat_date_until", until);