[MIRROR] Refactors admin PMs to be hopefully more resilient [MDB IGNORE] (#15348)

* Refactors admin PMs to be hopefully more resilient

* autoconflict resolution

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-08-04 15:47:52 +01:00
committed by GitHub
co-authored by LemonInTheDark Gandalf
parent 299eb5bba6
commit def879e5b4
9 changed files with 653 additions and 323 deletions
+1
View File
@@ -59,6 +59,7 @@
#define span_info(str) ("<span class='info'>" + str + "</span>")
#define span_infoplain(str) ("<span class='infoplain'>" + str + "</span>")
#define span_interface(str) ("<span class='interface'>" + str + "</span>")
#define span_linkify(str) ("<span class='linkify'>" + str + "</span>")
#define span_looc(str) ("<span class='looc'>" + str + "</span>")
#define span_medal(str) ("<span class='medal'>" + str + "</span>")
#define span_medradio(str) ("<span class='medradio'>" + str + "</span>")
+1 -1
View File
@@ -207,7 +207,7 @@ GLOBAL_LIST_INIT(testing_global_profiler, list("_PROFILE_NAME" = "Global"))
if(key)
if(C?.holder && C.holder.fakekey && !include_name)
if(include_link)
. += "<a href='?priv_msg=[C.findStealthKey()]'>"
. += "<a href='?priv_msg=[C.getStealthKey()]'>"
. += "Administrator"
else
if(include_link)
+1 -1
View File
@@ -524,7 +524,7 @@ GLOBAL_LIST_EMPTY(species_list)
// Displays a message in deadchat, sent by source. source is not linkified, message is, to avoid stuff like character names to be linkified.
// Automatically gives the class deadsay to the whole message (message + source)
/proc/deadchat_broadcast(message, source=null, mob/follow_target=null, turf/turf_target=null, speaker_key=null, message_type=DEADCHAT_REGULAR, admin_only=FALSE)
message = span_deadsay("[source]<span class='linkify'>[message]</span>")
message = span_deadsay("[source][span_linkify(message)]")
for(var/mob/M in GLOB.player_list)
var/chat_toggles = TOGGLES_DEFAULT_CHAT
+1 -1
View File
@@ -32,7 +32,7 @@
* Datum for generating a message overlay on the map
*/
/datum/chatmessage
/// The visual element of the chat messsage
/// The visual element of the chat message
var/image/message
/// The location in which the message is appearing
var/atom/message_loc
+30 -16
View File
@@ -407,24 +407,38 @@ GLOBAL_PROTECT(admin_verbs_poll)
holder.poll_list_panel()
SSblackbox.record_feedback("tally", "admin_verb", 1, "Server Poll Management") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/findStealthKey(txt)
if(txt)
for(var/P in GLOB.stealthminID)
if(GLOB.stealthminID[P] == txt)
return P
txt = GLOB.stealthminID[ckey]
return txt
/// Returns this client's stealthed ckey
/client/proc/getStealthKey()
return GLOB.stealthminID[ckey]
/// Takes a stealthed ckey as input, returns the true key it represents
/proc/findTrueKey(stealth_key)
if(!stealth_key)
return
for(var/potentialKey in GLOB.stealthminID)
if(GLOB.stealthminID[potentialKey] == stealth_key)
return potentialKey
/// Hands back a stealth ckey to use, guarenteed to be unique
/proc/generateStealthCkey()
var/guess = rand(0, 1000)
var/text_guess
var/valid_found = FALSE
while(valid_found == FALSE)
valid_found = TRUE
text_guess = "@[num2text(guess)]"
// We take a guess at some number, and if it's not in the existing stealthmin list we exit
for(var/key in GLOB.stealthminID)
// If it is in the list tho, we up one number, and redo the loop
if(GLOB.stealthminID[key] == text_guess)
guess += 1
valid_found = FALSE
break
return text_guess
/client/proc/createStealthKey()
var/num = (rand(0,1000))
var/i = 0
while(i == 0)
i = 1
for(var/P in GLOB.stealthminID)
if(num == GLOB.stealthminID[P])
num++
i = 0
GLOB.stealthminID["[ckey]"] = "@[num2text(num)]"
GLOB.stealthminID["[ckey]"] = generateStealthCkey()
/client/proc/stealth()
set category = "Admin"
+2 -2
View File
@@ -416,7 +416,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
msg = sanitize(copytext_char(msg, 1, MAX_MESSAGE_LEN))
var/ref_src = "[REF(src)]"
//Message to be sent to all admins
var/admin_msg = span_adminnotice(span_adminhelp("Ticket [TicketHref("#[id]", ref_src)]</span><b>: [LinkedReplyName(ref_src)] [FullMonty(ref_src)]:</b> <span class='linkify'>[keywords_lookup(msg)]"))
var/admin_msg = span_adminnotice(span_adminhelp("Ticket [TicketHref("#[id]", ref_src)]</span><b>: [LinkedReplyName(ref_src)] [FullMonty(ref_src)]:</b> [span_linkify(keywords_lookup(msg))]"))
AddInteraction("<font color='red'>[LinkedReplyName(ref_src)]: [msg]</font>", player_message = "<font color='red'>[LinkedReplyName(ref_src)]: [msg]</font>")
log_admin_private("Ticket #[id]: [key_name(initiator)]: [msg]")
@@ -434,7 +434,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
//show it to the person adminhelping too
to_chat(initiator,
type = MESSAGE_TYPE_ADMINPM,
html = span_adminnotice("PM to-<b>Admins</b>: <span class='linkify'>[msg]</span>"),
html = span_adminnotice("PM to-<b>Admins</b>: [span_linkify(msg)]"),
confidential = TRUE)
SSblackbox.LogAhelp(id, "Ticket Opened", msg, null, initiator.ckey, urgent = urgent)
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -41,7 +41,7 @@
var/msg_tmp = msg
GLOB.requests.pray(usr.client, msg, usr.job == JOB_CHAPLAIN)
msg = span_adminnotice("[icon2html(cross, GLOB.admins)]<b><font color=[font_color]>[prayer_type][deity ? " (to [deity])" : ""]: </font>[ADMIN_FULLMONTY(src)] [ADMIN_SC(src)]:</b> <span class='linkify'>[msg]</span>")
msg = span_adminnotice("[icon2html(cross, GLOB.admins)]<b><font color=[font_color]>[prayer_type][deity ? " (to [deity])" : ""]: </font>[ADMIN_FULLMONTY(src)] [ADMIN_SC(src)]:</b> [span_linkify(msg)]")
for(var/client/C in GLOB.admins)
if(C.prefs.chat_toggles & CHAT_PRAYER)
to_chat(C, msg, confidential = TRUE)
+2
View File
@@ -1,4 +1,6 @@
/proc/emoji_parse(text) //turns :ai: into an emoji in text.
if(!text)
return text
. = text
if(!CONFIG_GET(flag/emojis))
return