[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 16:47:52 +02:00
committed by GitHub
parent 299eb5bba6
commit def879e5b4
9 changed files with 653 additions and 323 deletions
+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)