mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[Logs] Browse room history without filters with paginated infinite scroll (#7531)
* [Logs] Browse room history without filters with paginated infinite scroll * [Logs] Continue pagination when switching log tabs --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
3cf8bdb00e
commit
94e6281d87
7 changed files with 321 additions and 91 deletions
|
|
@ -1743,12 +1743,17 @@ Response::ResponseCode AbstractServerSocketInterface::cmdGetLogHistory(const Com
|
|||
|
||||
int dateRange = cmd.date_range();
|
||||
int maximumResults = cmd.maximum_results();
|
||||
const int offset = cmd.has_offset() ? static_cast<int>(cmd.offset()) : 0;
|
||||
const QString beforeTime = cmd.has_before_time() ? QString::fromStdString(cmd.before_time()) : QString();
|
||||
|
||||
Response_ViewLogHistory *re = new Response_ViewLogHistory;
|
||||
|
||||
if (servatrice->getEnableLogQuery()) {
|
||||
QListIterator<ServerInfo_ChatMessage> messageIterator(sqlInterface->getMessageLogHistory(
|
||||
userName, ipAddress, gameName, gameID, message, chatType, gameType, roomType, dateRange, maximumResults));
|
||||
bool hasMore = false;
|
||||
QList<ServerInfo_ChatMessage> history =
|
||||
sqlInterface->getMessageLogHistory(userName, ipAddress, gameName, gameID, message, chatType, gameType,
|
||||
roomType, dateRange, maximumResults, offset, beforeTime, &hasMore);
|
||||
QListIterator<ServerInfo_ChatMessage> messageIterator(history);
|
||||
while (messageIterator.hasNext()) {
|
||||
ServerInfo_ChatMessage chatMessage = messageIterator.next();
|
||||
if (!allowPrivateChat) {
|
||||
|
|
@ -1756,6 +1761,7 @@ Response::ResponseCode AbstractServerSocketInterface::cmdGetLogHistory(const Com
|
|||
}
|
||||
re->add_log_message()->CopyFrom(chatMessage);
|
||||
}
|
||||
re->set_has_more(hasMore);
|
||||
} else {
|
||||
ServerInfo_ChatMessage chatMessage;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue