From ef9b80e5af34ae9242694648f3691b7d50d35966 Mon Sep 17 00:00:00 2001 From: Benau Date: Fri, 10 May 2019 01:31:38 +0800 Subject: [PATCH] Add server uid to player reports table --- NETWORKING.md | 1 + src/network/protocols/server_lobby.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NETWORKING.md b/NETWORKING.md index 8b068d4ad..126cf1c20 100644 --- a/NETWORKING.md +++ b/NETWORKING.md @@ -275,6 +275,7 @@ CREATE TABLE online_id_ban CREATE TABLE player_reports ( + server_uid TEXT NOT NULL, -- Report from which server unique id (config filename) reporter_ip INTEGER UNSIGNED NOT NULL, -- IP decimal of player who reports reporter_online_id INTEGER UNSIGNED NOT NULL, -- Online id of player who reports, 0 for offline player reporter_username TEXT NOT NULL, -- Player name who reports diff --git a/src/network/protocols/server_lobby.cpp b/src/network/protocols/server_lobby.cpp index 705415957..05ce1d8e5 100644 --- a/src/network/protocols/server_lobby.cpp +++ b/src/network/protocols/server_lobby.cpp @@ -803,10 +803,11 @@ void ServerLobby::writePlayerReport(Event* event) std::string query = StringUtils::insertValues( "INSERT INTO %s " - "(reporter_ip, reporter_online_id, reporter_username, info, " - "reporting_ip, reporting_online_id, reporting_username) " - "VALUES (%u, %u, \"%s\", \"%s\", %u, %u, \"%s\");", + "(server_uid, reporter_ip, reporter_online_id, reporter_username, " + "info, reporting_ip, reporting_online_id, reporting_username) " + "VALUES (\"%s\", %u, %u, \"%s\", \"%s\", %u, %u, \"%s\");", ServerConfig::m_player_reports_table.c_str(), + ServerConfig::m_server_uid.c_str(), reporter->getAddress().getIP(), reporter_npp->getOnlineId(), StringUtils::wideToUtf8(reporter_npp->getName()).c_str(), StringUtils::wideToUtf8(info).c_str(),