diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm
index 5141b612ed3..115feb5731e 100644
--- a/code/modules/admin/verbs/adminhelp.dm
+++ b/code/modules/admin/verbs/adminhelp.dm
@@ -510,19 +510,13 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Adminhelp") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
if(current_ticket)
- if(alert(usr, "You already have a ticket open. Is this for the same issue?",,"Yes","No") != "No")
- if(current_ticket)
- current_ticket.MessageNoRecipient(msg)
- current_ticket.TimeoutVerb()
- return
- else
- to_chat(usr, "Ticket not found, creating new one...", confidential = TRUE)
- else
- current_ticket.AddInteraction("[key_name_admin(usr)] opened a new ticket.")
- current_ticket.Close()
+ current_ticket.MessageNoRecipient(msg)
+ current_ticket.TimeoutVerb()
+ return
new /datum/admin_help(msg, src, FALSE)
+
//
// LOGGING
//
diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm
index 34f30b9c698..58af87b0b0d 100644
--- a/code/modules/admin/verbs/adminpm.dm
+++ b/code/modules/admin/verbs/adminpm.dm
@@ -58,6 +58,14 @@
if (!msg)
message_admins("[key_name_admin(src)] has cancelled their reply to [key_name_admin(C, 0, 0)]'s admin help.")
return
+ if(!C) //We lost the client during input, disconnected or relogged.
+ if(GLOB.directory[AH.initiator_ckey]) // Client has reconnected, lets try to recover
+ whom = GLOB.directory[AH.initiator_ckey]
+ else
+ to_chat(src, "Error: Admin-PM: Client not found.", confidential = TRUE)
+ to_chat(src, "Message not sent:
[msg]", confidential = TRUE)
+ AH.AddInteraction("No client found, message not sent:
[msg]")
+ 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.
@@ -73,6 +81,8 @@
return
var/client/recipient
+ var/recipient_ckey // Stored in case client is deleted between this and after the message is input
+ var/datum/admin_help/recipient_ticket // Stored in case client is deleted between this and after the message is input
var/external = 0
if(istext(whom))
if(whom[1] == "@")
@@ -84,6 +94,12 @@
else if(istype(whom, /client))
recipient = whom
+ if(!recipient)
+ to_chat(src, "Error: Admin-PM: Client not found.", confidential = TRUE)
+ return
+
+ recipient_ckey = recipient.ckey
+ recipient_ticket = recipient.current_ticket
if(external)
if(!externalreplyamount) //to prevent people from spamming irc/discord
@@ -99,16 +115,6 @@
else
- if(!recipient)
- if(holder)
- to_chat(src, "Error: Admin-PM: Client not found.", confidential = TRUE)
- if(msg)
- to_chat(src, msg, confidential = TRUE)
- return
- else if(msg) // you want to continue if there's no message instead of returning now
- current_ticket.MessageNoRecipient(msg)
- return
-
//get message text, limit it's length.and clean/escape html
if(!msg)
msg = input(src,"Message:", "Private message to [recipient.holder?.fakekey ? "an Administrator" : key_name(recipient, 0, 0)].") as message|null
@@ -116,16 +122,24 @@
if(!msg)
return
- if(prefs.muted & MUTE_ADMINHELP)
- to_chat(src, "Error: Admin-PM: You are unable to use admin PM-s (muted).", confidential = TRUE)
- return
-
- if(!recipient)
+ if(!recipient)
+ if(GLOB.directory[recipient_ckey]) // Client has reconnected, lets try to recover
+ recipient = GLOB.directory[recipient_ckey]
+ else
if(holder)
to_chat(src, "Error: Admin-PM: Client not found.", confidential = TRUE)
+ to_chat(src, "Message not sent:
[msg]", confidential = TRUE)
+ if(recipient_ticket)
+ recipient_ticket.AddInteraction("No client found, message not sent:
[msg]")
+ return
else
current_ticket.MessageNoRecipient(msg)
- return
+ return
+
+
+ if(prefs.muted & MUTE_ADMINHELP)
+ to_chat(src, "Error: Admin-PM: You are unable to use admin PM-s (muted).", confidential = TRUE)
+ return
if (src.handle_spam_prevention(msg,MUTE_ADMINHELP))
return
@@ -149,8 +163,11 @@
externalreplyamount--
send2adminchat("[AH ? "#[AH.id] " : ""]Reply: [ckey]", rawmsg)
else
- if(recipient.holder)
- if(holder) //both are admins
+ var/badmin = FALSE //Lets figure out if an admin is getting bwoinked.
+ if(holder && recipient.holder && !current_ticket) //Both are admins, and this is not a reply to our own ticket.
+ badmin = TRUE
+ if(recipient.holder && !badmin)
+ if(holder)
to_chat(recipient, "Admin PM from-[key_name(src, recipient, 1)]: [keywordparsedmsg]", confidential = TRUE)
to_chat(src, "Admin PM to-[key_name(recipient, src, 1)]: [keywordparsedmsg]", confidential = TRUE)