diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index 60ba81a4825..88454f8f689 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -250,7 +250,8 @@
verbs += /obj/admins/proc/voteres //toggle votes
verbs += /client/proc/deadchat //toggles deadchat
verbs += /client/proc/cmd_admin_mute
- verbs += /client/proc/cmd_admin_pm
+ verbs += /client/proc/cmd_admin_pm_context
+ verbs += /client/proc/cmd_admin_pm_panel
verbs += /client/proc/cmd_admin_subtle_message
verbs += /client/proc/warn
verbs += /obj/admins/proc/announce
@@ -375,7 +376,8 @@
verbs -= /obj/admins/proc/voteres //toggle votes
verbs -= /client/proc/deadchat //toggles deadchat
verbs -= /client/proc/cmd_admin_mute
- verbs -= /client/proc/cmd_admin_pm
+ verbs -= /client/proc/cmd_admin_pm_context
+ verbs -= /client/proc/cmd_admin_pm_panel
verbs -= /client/proc/cmd_admin_say
verbs -= /client/proc/cmd_admin_subtle_message
verbs -= /client/proc/warn
@@ -778,7 +780,8 @@
verbs += /client/proc/game_panel
verbs += /client/proc/player_panel
verbs += /client/proc/cmd_admin_subtle_message
- verbs += /client/proc/cmd_admin_pm
+ verbs += /client/proc/cmd_admin_pm_context
+ verbs += /client/proc/cmd_admin_pm_panel
verbs += /client/proc/cmd_admin_gib_self
verbs += /client/proc/deadchat //toggles deadchat
diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm
index f927b54b5ca..9336eac7fe5 100644
--- a/code/modules/admin/verbs/randomverbs.dm
+++ b/code/modules/admin/verbs/randomverbs.dm
@@ -85,57 +85,77 @@
log_admin("DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]): [msg]")
message_admins("\blue \bold DirectNarrate: [key_name(usr)] to ([M.name]/[M.key]): [msg]
", 1)
-/client/proc/cmd_admin_pm()
+//allows right clicking mobs to send an admin PM to their client, forwards the selected mob's client to cmd_admin_pm
+/client/proc/cmd_admin_pm_context(mob/M as mob in world)
+ set category = null
+ set name = "Admin PM Mob"
+ if(!authenticated || !holder)
+ src << "\red Error: Admin-PM-Context: Only administrators may use this command."
+ return
+ if( !ismob(M) || !M.client ) return
+ cmd_admin_pm(M.client)
+
+//shows a list of clients we could send PMs to, then forwards our choice to cmd_admin_pm
+/client/proc/cmd_admin_pm_panel()
set category = "Admin"
set name = "Admin PM"
if(!authenticated || !holder)
- src << "Only administrators may use this command."
+ src << "\red Error: Admin-PM-Panel: Only administrators may use this command."
return
-
var/list/client/targets[0]
- for(var/client/C)
- if(C.mob)
- if(istype(C.mob, /mob/new_player))
- targets["[C] - (New Player)"] = C
- else if(istype(C.mob, /mob/dead/observer))
- targets["[C] - [C.mob.name](Ghost)"] = C
+ for(var/client/T)
+ if(T.mob)
+ if(istype(T.mob, /mob/new_player))
+ targets["(New Player) - [T]"] = T
+ else if(istype(T.mob, /mob/dead/observer))
+ targets["[T.mob.name](Ghost) - [T]"] = T
else
- targets["[C] - [C.mob.real_name](as [C.mob.name])"] = C
+ targets["[T.mob.real_name](as [T.mob.name]) - [T]"] = T
else
- targets["[C] - No Mob"] = C
+ targets["(No Mob) - [T]"] = T
+ targets = sortList(targets)
+ var/target = input(usr,"To whom shall we send a message?","Admin PM",null) in targets|null
+ cmd_admin_pm(targets[target])
- var/target = input(usr,"To whom shall we send a message?","Admin PM",null) in targets
- var/client/C = targets[target]
+//takes input from cmd_admin_pm_context, cmd_admin_pm_panel or /client/Topic and sends them a PM after fetching a message to send.
+/client/proc/cmd_admin_pm(var/client/C = null)
if( !C || !istype(C,/client) )
src << "\red Error: Admin-PM: Client not found."
return
if(src.muted_complete)
src << "\red Error: Admin-PM: You are muted."
return
+
+ //get message text, limit it's length.and clean/escape html
var/t = input("Message:", "Private message to [C.key]") as text|null
- if( !(holder.rank in list("Game Admin", "Game Master")) )
+ if (!t || !C) return
+
+ if( !holder || !(holder.rank in list("Game Admin", "Game Master")) ) //clean the message if it's not sent by a GA or GM
t = sanitize(copytext(t,1,500))
+ if(!t) return
- if ( !t || !C || !C.mob ) return
+ if(holder) //an Admin sent the message
+ if(!C.holder) C << "-- Administrator private message --" //only do LOUD PMs if the target isn't an admin. Hence making admin-to-admin PMs less annoying
+ C << "Admin PM from-[key_name(src, C, 0)]: [t]"
+ if(!C.holder) C << "Click on the administrator's name to reply."
+ src << "Admin PM to-[key_name(C, src, 1)]: [t]"
- //TODO: rewrite key_name() to use something other than mobs. ~CARN
- if (usr.client && usr.client.holder)
- C << "\red Admin PM from-[key_name(usr, C.mob, 0)]: [t]"
- src << "\blue Admin PM to-[key_name(C, usr, 1)]: [t]"
- else
- if (C && C.holder)
- C << "\blue Reply PM from-[key_name(usr, C.mob, 1)]: [t]"
+ else //a non-Admin sent the message
+ if(C.holder)
+ src << "Reply PM to-[key_name(C, src, 0)]: [t]"
+ C << "Reply PM from-[key_name(src, C, 0)]: [t]"
else
- C << "\red Reply PM from-[key_name(usr, C.mob, 0)]: [t]"
- src << "\blue Reply PM to-[key_name(C.mob, usr, 0)]: [t]"
+ src << "Error: PM: Non-admin to non-admin PM communication is forbidden"
+ return
- log_admin("PM: [key_name(usr)]->[key_name(C.mob)] : [t]")
+ log_admin("PM: [key_name(src)]->[key_name(C)]: [t]")
- for(var/client/X) //there are fewer clients than mobs
+ //we don't use message_admins here because the sender/receiver might get it too
+ for(var/client/X) //there are fewer clients than mobs
if(X.holder && X.key!=usr.key && X.key!=C.key) //check client/X is an admin and isn't the sender or recipient
var/mob/K = X.mob //get X's mob
if(K)
- K << "PM: [key_name(usr, K)]->[key_name(C.mob, K)]: \blue [t]" //inform X
+ K << "PM: [key_name(src, K)]->[key_name(C, K)]: \blue [t]" //inform X
/client/proc/cmd_admin_godmode(mob/M as mob in world)
set category = "Special Verbs"
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index dcecf90e662..4b6f4665d60 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -605,58 +605,20 @@
/client/Topic(href, href_list)
- if(href_list["priv_msg"]) //All PM links have clients as their SRC-s (So that you always PM the same client even if they change mob (ghost, observe, etc.)), but PM code is in mob/topic() So this redirects the call.
- if(mob)
- mob.Topic(href, href_list)
+ if(href_list["priv_msg"])
+ var/client/C = locate(href_list["priv_msg"])
+ if(ismob(C)) //Old stuff can pass in mobs instead of clients
+ var/mob/M = C
+ C = M.client
+ cmd_admin_pm(C)
else
..()
/mob/Topic(href, href_list)
- if(href_list["priv_msg"])
- var/client/C = locate(href_list["priv_msg"])
+ if(href_list["priv_msg"]) //for priv_msg references that have yet to be updated to target clients. Forwards it to client/Topic()
+ if(client)
+ client.Topic(href, href_list)
- if(ismob(C)) //Old stuff can pass in mobs instead of clients
- var/mob/M = C
- C = M.client
-
- if(C)
- if(src.client && client.muted_complete)
- src << "You are muted have a nice day"
- return
- if (!istype(C,/client))
- src << "\red not a client."
- return
-
- if ( !( src.client.holder || C.holder ) ) //neither of the two is an admin.
- src.client << "\red Admin-player or player-admin conversation only!"
- return.
-
- //get message text, limit it's length.and clean/escape html
- var/t = input("Message:", "Private message to [C.key]") as text|null
- t = sanitize( copytext(t,1,500) )
- if (!t || !usr || !C || !usr.client) return
- if (usr.client && usr.client.holder) //Admin is messaging a player
- C << "\red -- Administrator private message --"
- C << "[key_name(usr.client, C, 0)] [t]"
- C << "Click on the administrator's name to reply."
- usr << "\blue Admin PM to [key_name(C, usr.client, 1)]: [t]"
- else
- if (C)
- if (C.holder)
- C << "\blue Reply PM from [key_name(usr.client, C, 1)]: [t]"
- else
- C << "\red Reply PM from [key_name(usr.client, C, 0)]: [t]"
- usr.client << "\blue Reply PM to [key_name(C, usr.client, 0)]: [t]"
-
- log_admin("PM: [usr.client.key]->[C.key] : [t]")
-
- //we don't use message_admins here because the sender/receiver might get it too
- for (var/mob/K in world)
- if(K && usr)
- if(K.client && K.client.holder && K.key != usr.key && K.key != C.key)
- K << "PM: [key_name(usr.client, K.client)]->[key_name(C, K.client)]: \blue [t]"
- else
- client << "\red Client disconnected"
if(href_list["mach_close"])
var/t1 = text("window=[href_list["mach_close"]]")
machine = null