Skip to content

Commit

Permalink
Finish
Browse files Browse the repository at this point in the history
  • Loading branch information
geoje committed May 31, 2021
1 parent 668d83d commit 0078cdf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Client/Forms/FormRoom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion Server/Classes/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Server/Classes/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ public static Chat GetLastChat(Room room)
}
return null;
}
public static List<Chat> GetChats(Room room, DateTime until)
public static List<Chat> GetChats(string roomId, DateTime until)
{
List<Chat> chats = new List<Chat>();
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);
Expand Down

0 comments on commit 0078cdf

Please sign in to comment.