Security citations are now logged to the DB (#5422)

Co-authored-by: Nick <nick@nfreader.net>
This commit is contained in:
SkyratBot
2021-05-03 15:12:59 +01:00
committed by GitHub
co-authored by Nick
parent 5e47986679
commit 336d99adcd
7 changed files with 130 additions and 2 deletions
+45
View File
@@ -352,3 +352,48 @@ Versioning
if(query_report_death)
query_report_death.Execute(async = TRUE)
qdel(query_report_death)
/datum/controller/subsystem/blackbox/proc/ReportCitation(citation, sender, sender_ic, recipient, message, fine = 0, paid = 0)
var/datum/db_query/query_report_citation = SSdbcore.NewQuery({"INSERT INTO [format_table_name("citation")]
(server_ip,
server_port,
round_id,
citation,
action,
sender,
sender_ic,
recipient,
crime,
fine,
paid,
timestamp) VALUES (
INET_ATON(:server_ip),
:port,
:round_id,
:citation,
:action,
:sender,
:sender_ic,
:recipient,
:message,
:fine,
:paid,
:timestamp
) ON DUPLICATE KEY UPDATE
paid = paid + VALUES(paid)"}, list(
"server_ip" = world.internet_address || "0",
"port" = "[world.port]",
"round_id" = GLOB.round_id,
"citation" = citation,
"action" = "Citation Created",
"sender" = sender,
"sender_ic" = sender_ic,
"recipient" = recipient,
"message" = message,
"fine" = fine,
"paid" = paid,
"timestamp" = SQLtime()
))
if(query_report_citation)
query_report_citation.Execute(async = TRUE)
qdel(query_report_citation)