From 9d7567f46d67f0ceadefedcd7824b6bdd87d4e52 Mon Sep 17 00:00:00 2001 From: tkdrg Date: Fri, 19 Dec 2014 22:39:28 -0300 Subject: [PATCH] Adds cfg option to let players see their own notes This lets players see the admin notes that have been added to their ckey, by using a verb in the OOC tab. This is a config option and is off by default. --- code/controllers/configuration.dm | 3 +++ code/game/verbs/ooc.dm | 11 +++++++++++ code/modules/admin/player_notes.dm | 24 +++++++++++++++++++++++- code/modules/client/client procs.dm | 7 ++++++- config/config.txt | 5 ++++- 5 files changed, 47 insertions(+), 3 deletions(-) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 0501caf3db1..cf125f94aba 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -64,6 +64,7 @@ var/admin_legacy_system = 0 //Defines whether the server uses the legacy admin system with admins.txt or the SQL system. Config option in config.txt var/ban_legacy_system = 0 //Defines whether the server uses the legacy banning system with the files in /data or the SQL system. Config option in config.txt var/use_age_restriction_for_jobs = 0 //Do jobs use account age restrictions? --requires database + var/see_own_notes = 0 //Can players see their own admin notes (read-only)? Config option in config.txt //game_options.txt configs var/force_random_names = 0 @@ -281,6 +282,8 @@ global.comms_key = value if(value != "default_pwd" && length(value) > 6) //It's the default value or less than 6 characters long, warn badmins global.comms_allowed = 1 + if("see_own_notes") + config.see_own_notes = 1 else diary << "Unknown setting in configuration: '[name]'" diff --git a/code/game/verbs/ooc.dm b/code/game/verbs/ooc.dm index 2eb21269c60..36aae7f0fc5 100644 --- a/code/game/verbs/ooc.dm +++ b/code/game/verbs/ooc.dm @@ -109,3 +109,14 @@ var/global/normal_ooc_colour = "#002eb8" src << "
[join_motd]
" else src << "The Message of the Day has not been set." + +/client/proc/self_notes() + set name = "View Admin Notes" + set category = "OOC" + set desc = "View the notes that admins have written about you" + + if(!config.see_own_notes) + usr << "Sorry, that function is not enabled on this server." + return + + see_own_notes() diff --git a/code/modules/admin/player_notes.dm b/code/modules/admin/player_notes.dm index c906cd1b778..26c5719eddf 100644 --- a/code/modules/admin/player_notes.dm +++ b/code/modules/admin/player_notes.dm @@ -4,13 +4,35 @@ #define NOTESFILE "data/player_notes.sav" //where the player notes are saved +/proc/see_own_notes() + if(!config.see_own_notes) + return + var/ckey = usr.client.ckey + if(!ckey) + usr << "Error: No ckey found." + return + var/savefile/notesfile = new(NOTESFILE) + if(!notesfile) + usr << "Error: Cannot access [NOTESFILE]" + return + notesfile.cd = "/[ckey]" + var/dat = "Notes for [ckey]:
" + while(!notesfile.eof) + var/note + notesfile >> note + dat += note + var/datum/browser/popup = new(usr, "player_notes", "Player Notes", 700, 400) + popup.set_content(dat) + popup.open() + + datum/admins/proc/notes_show(var/ckey) usr << browse("Player Notes[notes_gethtml(ckey)]","window=player_notes;size=700x400") datum/admins/proc/notes_gethtml(var/ckey) var/savefile/notesfile = new(NOTESFILE) - if(!notesfile) return "Error: Cannot access [NOTESFILE]" + if(!notesfile) return "Error: Cannot access [NOTESFILE]" if(ckey) . = "Notes for [ckey]: \[+\]
" notesfile.cd = "/[ckey]" diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index ae95989af85..324096d42af 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -133,6 +133,7 @@ var/next_external_rsc = 0 if((global.comms_key == "default_pwd" || length(global.comms_key) <= 6) && global.comms_allowed) //It's the default value or less than 6 characters long, but it somehow didn't disable comms. src << "The server's API key is either too short or is the default value! Consider changing it immediately!" + add_verbs_from_config() set_client_age_from_db() if (!ticker || ticker.current_state == GAME_STATE_PREGAME) @@ -218,6 +219,10 @@ var/next_external_rsc = 0 var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `[format_table_name("connection_log")]` (`id`,`datetime`,`serverip`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),'[serverip]','[sql_ckey]','[sql_ip]','[sql_computerid]');") query_accesslog.Execute() +/client/proc/add_verbs_from_config() + if(config.see_own_notes) + verbs += /client/proc/self_notes + #undef TOPIC_SPAM_DELAY #undef UPLOAD_LIMIT @@ -306,4 +311,4 @@ var/next_external_rsc = 0 'icons/stamp_icons/large_stamp-cap.png', 'icons/stamp_icons/large_stamp-qm.png', 'icons/stamp_icons/large_stamp-law.png' - ) + ) diff --git a/config/config.txt b/config/config.txt index d3fb04150a5..0d112194334 100644 --- a/config/config.txt +++ b/config/config.txt @@ -152,4 +152,7 @@ TICKCOMP 0 #AUTOMUTE_ON ## Communication key for receiving data through world/Topic(), you don't want to give this out -#COMMS_KEY default_pwd \ No newline at end of file +#COMMS_KEY default_pwd + +## Uncomment this to let players see their own notes (they can still be set by admins only) +#SEE_OWN_NOTES