mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 03:53:26 -08:00
[Server] Serve the server list through the database interface (#7855)
This commit is contained in:
parent
f8f8fffa6b
commit
f1ee6bdc2d
4 changed files with 47 additions and 7 deletions
|
|
@ -743,13 +743,10 @@ void Servatrice::updateServerList()
|
|||
serverListMutex.lock();
|
||||
serverList.clear();
|
||||
|
||||
QSqlQuery *query = servatriceDatabaseInterface->prepareQuery(
|
||||
"select id, ssl_cert, hostname, address, game_port, control_port from {prefix}_servers order by id asc");
|
||||
servatriceDatabaseInterface->execSqlQuery(query);
|
||||
while (query->next()) {
|
||||
ServerProperties prop(query->value(0).toInt(), QSslCertificate(query->value(1).toString().toUtf8()),
|
||||
query->value(2).toString(), QHostAddress(query->value(3).toString()),
|
||||
query->value(4).toInt(), query->value(5).toInt());
|
||||
const auto serverListEntries = servatriceDatabaseInterface->getServerListEntries();
|
||||
for (const auto &entry : serverListEntries) {
|
||||
ServerProperties prop(entry.id, QSslCertificate(entry.sslCert), entry.hostname, QHostAddress(entry.address),
|
||||
entry.gamePort, entry.controlPort);
|
||||
serverList.append(prop);
|
||||
qDebug() << QString("#%1 CERT=%2 NAME=%3 IP=%4:%5 CPORT=%6")
|
||||
.arg(prop.id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue