diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index d6ca52c46a3..2531a0df089 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -1,38 +1,7 @@ -/client/var/adminhelptimerid = 0 +/proc/keywords_lookup(var/msg, var/followlink = 1) -/client/proc/giveadminhelpverb() - src.verbs |= /client/verb/adminhelp - adminhelptimerid = 0 - -//This is a list of words which are ignored by the parser when comparing message contents for names. MUST BE IN LOWER CASE! -var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","alien","as") - - - -/client/verb/adminhelp(msg as text) - set category = "Admin" - set name = "Adminhelp" - - if(say_disabled) //This is here to try to identify lag problems - usr << "Speech is currently admin-disabled." - return - - //handle muting and automuting - if(prefs.muted & MUTE_ADMINHELP) - src << "Error: Admin-PM: You cannot send adminhelps (Muted)." - return - if(src.handle_spam_prevention(msg,MUTE_ADMINHELP)) - return - - //clean the input msg - if(!msg) return - msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN)) - if(!msg) return - var/original_msg = msg - - //remove out adminhelp verb temporarily to prevent spamming of admins. - src.verbs -= /client/verb/adminhelp - adminhelptimerid = addtimer(src,"giveadminhelpverb",1200) //2 minute cooldown of admin helps + //This is a list of words which are ignored by the parser when comparing message contents for names. MUST BE IN LOWER CASE! + var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","alien","as", "i") //explode the input msg into a list var/list/msglist = text2list(msg, " ") @@ -83,15 +52,58 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey"," mobs_found += found if(!ai_found && isAI(found)) ai_found = 1 - msg += "[original_word] (?) (FLW) " + if (followlink) + msg += "[original_word](?) (FLW) " + else + msg += "[original_word](?) " continue msg += "[original_word] " + return msg + + +/client/var/adminhelptimerid = 0 + +/client/proc/giveadminhelpverb() + src.verbs |= /client/verb/adminhelp + adminhelptimerid = 0 + + +var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","alien","as", "i") + + + +/client/verb/adminhelp(msg as text) + set category = "Admin" + set name = "Adminhelp" + + if(say_disabled) //This is here to try to identify lag problems + usr << "Speech is currently admin-disabled." + return + + //handle muting and automuting + if(prefs.muted & MUTE_ADMINHELP) + src << "Error: Admin-PM: You cannot send adminhelps (Muted)." + return + if(src.handle_spam_prevention(msg,MUTE_ADMINHELP)) + return + + //clean the input msg + if(!msg) return + msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN)) + if(!msg) return + var/original_msg = msg + + //remove our adminhelp verb temporarily to prevent spamming of admins. + src.verbs -= /client/verb/adminhelp + adminhelptimerid = addtimer(src,"giveadminhelpverb",1200) //2 minute cooldown of admin helps + + msg = keywords_lookup(msg) if(!mob) return //this doesn't happen var/ref_mob = "\ref[mob]" var/ref_client = "\ref[src]" - msg = "HELP: [key_name_admin(src)] (?) (PP) (VV) (SM) (FLW) (TP)[ai_found ? " (CL)" : ""] (REJT): [msg]" + msg = "HELP: [key_name(src)] (?) (PP) (VV) (SM) (FLW) (TP) (REJT): [msg]" //send this msg to all admins diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index 944677f2350..e79649e7dc4 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -32,6 +32,26 @@ cmd_admin_pm(targets[target],null) feedback_add_details("admin_verb","APM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! +/client/proc/cmd_ahelp_reply(whom) + if(prefs.muted & MUTE_ADMINHELP) + src << "Error: Admin-PM: You are unable to use admin PM-s (muted)." + return + var/client/C + if(istext(whom)) + if(cmptext(copytext(whom,1,2),"@")) + whom = findStealthKey(whom) + C = directory[whom] + else if(istype(whom,/client)) + C = whom + if(!C) + if(holder) src << "Error: Admin-PM: Client not found." + return + message_admins("[key_name_admin(src)] has started replying to [key_name(C, 0, 0)]'s admin help.") + var/msg = input(src,"Message:", "Private message to [key_name(C, 0, 0)]") as text|null + if (!msg) + message_admins("[key_name_admin(src)] has cancelled their reply to [key_name(C, 0, 0)]'s admin help.") + return + cmd_admin_pm(whom, msg) //takes input from cmd_admin_pm_context, cmd_admin_pm_panel or /client/Topic and sends them a PM. //Fetching a message if needed. src is the sender and C is the target client @@ -71,14 +91,15 @@ if(!msg) return msg = emoji_parse(msg) + var/keywordparsedmsg = keywords_lookup(msg) if(C.holder) if(holder) //both are admins - C << "Admin PM from-[key_name(src, C, 1)]: [msg]" - src << "Admin PM to-[key_name(C, src, 1)]: [msg]" + C << "Admin PM from-[key_name(src, C, 1)]: [keywordparsedmsg]" + src << "Admin PM to-[key_name(C, src, 1)]: [keywordparsedmsg]" else //recipient is an admin but sender is not - C << "Reply PM from-[key_name(src, C, 1)]: [msg]" + C << "Reply PM from-[key_name(src, C, 1)]: [keywordparsedmsg]" src << "PM to-Admins: [msg]" //play the recieving admin the adminhelp sound (if they have them enabled) @@ -117,4 +138,4 @@ //we don't use message_admins here because the sender/receiver might get it too for(var/client/X in admins) if(X.key!=key && X.key!=C.key) //check client/X is an admin and isn't the sender or recipient - X << "PM: [key_name(src, X, 0)]->[key_name(C, X, 0)]: \blue [msg]" //inform X + X << "PM: [key_name(src, X, 0)]->[key_name(C, X, 0)]: \blue [keywordparsedmsg]" //inform X diff --git a/code/modules/admin/verbs/adminsay.dm b/code/modules/admin/verbs/adminsay.dm index 1e077bd66e9..d764f4c02fd 100644 --- a/code/modules/admin/verbs/adminsay.dm +++ b/code/modules/admin/verbs/adminsay.dm @@ -8,7 +8,7 @@ if(!msg) return log_admin("[key_name(src)] : [msg]") - + msg = keywords_lookup(msg,0) if(check_rights(R_ADMIN,0)) msg = "ADMIN: [key_name(usr, 1)] (FLW): [msg]" admins << msg diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index aeeb2713757..9f4c6ab0c13 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -31,6 +31,9 @@ //Admin PM if(href_list["priv_msg"]) + if (href_list["ahelp_reply"]) + cmd_ahelp_reply(href_list["priv_msg"]) + return cmd_admin_pm(href_list["priv_msg"],null) return