mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Added chat history to a room that is displayed on join.
With this update a new chat history definition is added on a per room bases which allows operators to specify the number of chat messages to store and present to the user on join. Please see the sample ini for room definitions.
This commit is contained in:
parent
f97a7e8370
commit
87a64da1bc
23 changed files with 141 additions and 16 deletions
|
|
@ -600,8 +600,19 @@ Response::ResponseCode Server_ProtocolHandler::cmdJoinRoom(const Command_JoinRoo
|
|||
|
||||
Event_RoomSay joinMessageEvent;
|
||||
joinMessageEvent.set_message(r->getJoinMessage().toStdString());
|
||||
joinMessageEvent.set_message_type(Event_RoomSay::Welcome);
|
||||
rc.enqueuePostResponseItem(ServerMessage::ROOM_EVENT, r->prepareRoomEvent(joinMessageEvent));
|
||||
|
||||
ServerInfo_ChatMessage chatMessage; for (int i = 0; i < r->chatHistory.size(); ++i) {
|
||||
chatMessage = r->chatHistory.at(i);
|
||||
qDebug() << QString::fromStdString(chatMessage.message()).simplified();
|
||||
Event_RoomSay roomChatHistory;
|
||||
roomChatHistory.set_message(chatMessage.sender_name() + ": " + chatMessage.message());
|
||||
roomChatHistory.set_message_type(Event_RoomSay::ChatHistory);
|
||||
roomChatHistory.set_time_of(QDateTime::fromString(QString::fromStdString(chatMessage.time())).toMSecsSinceEpoch());
|
||||
rc.enqueuePostResponseItem(ServerMessage::ROOM_EVENT, r->prepareRoomEvent(roomChatHistory));
|
||||
}
|
||||
|
||||
Response_JoinRoom *re = new Response_JoinRoom;
|
||||
r->getInfo(*re->mutable_room_info(), true);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue