Files
CHOMPStation2/code/modules/admin/verbs/adminpm.dm
Cael_Aislinn aae42d928a Merge branch 'incremental_tg' r5200 into bs12_with_tgport
Conflicts:
	baystation12.dme
	code/__HELPERS/global_lists.dm
	code/__HELPERS/type2type.dm
	code/__HELPERS/unsorted.dm
	code/datums/datumvars.dm
	code/datums/disease.dm
	code/datums/organs/organ_external.dm
	code/datums/supplypacks.dm
	code/defines/obj.dm
	code/game/area/areas.dm
	code/game/atoms.dm
	code/game/gamemodes/cult/cult_structures.dm
	code/game/gamemodes/cult/runes.dm
	code/game/gamemodes/events.dm
	code/game/gamemodes/events/ninja_equipment.dm
	code/game/gamemodes/events/space_ninja.dm
	code/game/gamemodes/game_mode.dm
	code/game/gamemodes/gameticker.dm
	code/game/hud.dm
	code/game/jobs/access.dm
	code/game/jobs/job/civilian.dm
	code/game/machinery/alarm.dm
	code/game/machinery/cloning.dm
	code/game/machinery/computer/cloning.dm
	code/game/machinery/computer/medical.dm
	code/game/machinery/computer/syndicate_shuttle.dm
	code/game/machinery/telecomms/broadcaster.dm
	code/game/machinery/telecomms/machine_interactions.dm
	code/game/objects/effects/decals/contraband.dm
	code/game/objects/effects/signs.dm
	code/game/objects/items/devices/PDA/PDA.dm
	code/game/objects/items/devices/PDA/cart.dm
	code/game/objects/items/weapons/photography.dm
	code/game/objects/structures/door_assembly.dm
	code/game/objects/structures/window.dm
	code/game/sound.dm
	code/game/verbs/ooc.dm
	code/global.dm
	code/modules/DetectiveWork/detective_work.dm
	code/modules/DetectiveWork/evidence.dm
	code/modules/DetectiveWork/footprints_and_rag.dm
	code/modules/DetectiveWork/scanner.dm
	code/modules/admin/player_panel.dm
	code/modules/admin/verbs/adminhelp.dm
	code/modules/admin/verbs/adminpm.dm
	code/modules/awaymissions/gateway.dm
	code/modules/client/client defines.dm
	code/modules/client/client procs.dm
	code/modules/client/preferences.dm
	code/modules/clothing/spacesuits/rig.dm
	code/modules/mining/machine_processing.dm
	code/modules/mining/machine_stacking.dm
	code/modules/mining/mint.dm
	code/modules/mining/ores_coins.dm
	code/modules/mining/satchel_ore_boxdm.dm
	code/modules/mob/living/carbon/alien/alien.dm
	code/modules/mob/living/carbon/carbon.dm
	code/modules/mob/living/carbon/carbon_defines.dm
	code/modules/mob/living/carbon/human/human_damage.dm
	code/modules/mob/living/carbon/human/life.dm
	code/modules/mob/living/carbon/human/update_icons.dm
	code/modules/mob/living/living.dm
	code/modules/mob/living/say.dm
	code/modules/mob/mob.dm
	code/modules/mob/mob_cleanup.dm
	code/modules/mob/mob_defines.dm
	code/modules/mob/mob_transformation_simple.dm
	code/modules/mob/new_player/login.dm
	code/modules/mob/new_player/new_player.dm
	code/modules/mob/new_player/preferences_setup.dm
	code/modules/mob/new_player/savefile.dm
	code/modules/mob/new_player/sprite_accessories.dm
	code/modules/paperwork/folders.dm
	code/modules/paperwork/paper.dm
	code/modules/paperwork/photocopier.dm
	code/modules/projectiles/guns/energy/special.dm
	code/modules/projectiles/guns/projectile/automatic.dm
	code/setup.dm
	code/unused/mining/datum_processing_recipe.dm
	code/unused/powerarmor/powerarmor.dm
	code/world.dm
	html/changelog.html
	icons/effects/96x96.dmi
	icons/mob/head.dmi
	icons/mob/items_lefthand.dmi
	icons/mob/items_righthand.dmi
	icons/mob/suit.dmi
	icons/obj/clothing/hats.dmi
	icons/obj/clothing/suits.dmi
	icons/obj/hydroponics.dmi
	icons/obj/items.dmi
	icons/turf/areas.dmi
	icons/turf/walls.dmi
	maps/RandomZLevels/fileList.txt
	maps/RandomZLevels/spacebattle.dmm

Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
2013-01-07 00:23:22 +10:00

122 lines
5.2 KiB
Plaintext

//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 mob_list)
set category = null
set name = "Admin PM Mob"
if(!holder)
src << "<font color='red'>Error: Admin-PM-Context: Only administrators may use this command.</font>"
return
if( !ismob(M) || !M.client ) return
cmd_admin_pm(M.client,null)
feedback_add_details("admin_verb","APMM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
//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(!holder)
src << "<font color='red'>Error: Admin-PM-Panel: Only administrators may use this command.</font>"
return
var/list/client/targets[0]
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["[T.mob.real_name](as [T.mob.name]) - [T]"] = T
else
targets["(No Mob) - [T]"] = T
var/list/sorted = sortList(targets)
var/target = input(src,"To whom shall we send a message?","Admin PM",null) in sorted|null
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!
//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
/client/proc/cmd_admin_pm(var/client/C, var/msg)
if(prefs.muted & MUTE_ADMINHELP)
src << "<font color='red'>Error: Admin-PM: You are unable to use admin PM-s (muted).</font>"
return
if(!istype(C,/client))
if(holder) src << "<font color='red'>Error: Admin-PM: Client not found.</font>"
else adminhelp(msg) //admin we are replying to left. adminhelp instead
return
//get message text, limit it's length.and clean/escape html
if(!msg)
msg = input(src,"Message:", "Private message to [C.key]") as text|null
if(!msg) return
if(!C)
if(holder) src << "<font color='red'>Error: Admin-PM: Client not found.</font>"
else adminhelp(msg) //admin we are replying to has vanished, adminhelp instead
return
if (src.handle_spam_prevention(msg,MUTE_ADMINHELP))
return
//clean the message if it's not sent by a high-rank admin
if(!check_rights(R_SERVER|R_DEBUG,0))
msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
if(!msg) return
if(C.holder)
if(holder) //both are admins
if(holder.rank == "Moderator") //If moderator
C << "<font color='maroon'>Mod PM from-<b>[key_name(src, C, 1)]</b>: [msg]</font>"
src << "<font color='blue'>Mod PM to-<b>[key_name(C, src, 1)]</b>: [msg]</font>"
else
C << "<font color='red'>Admin PM from-<b>[key_name(src, C, 1)]</b>: [msg]</font>"
src << "<font color='blue'>Admin PM to-<b>[key_name(C, src, 1)]</b>: [msg]</font>"
else //recipient is an admin but sender is not
C << "<font color='red'>Reply PM from-<b>[key_name(src, C, 1)]</b>: [msg]</font>"
src << "<font color='blue'>PM to-<b>Admins</b>: [msg]</font>"
//play the recieving admin the adminhelp sound (if they have them enabled)
if(C.prefs.toggles & SOUND_ADMINHELP)
C << 'sound/effects/adminhelp.ogg'
else
if(holder) //sender is an admin but recipient is not. Do BIG RED TEXT
if(holder.rank == "Moderator")
C << "<font color='maroon'>Mod PM from-<b>[key_name(src, C, 0)]</b>: [msg]</font>"
C << "<font color='maroon'><i>Click on the moderators's name to reply.</i></font>"
src << "<font color='blue'>Mod PM to-<b>[key_name(C, src, 1)]</b>: [msg]</font>"
else
C << "<font color='red' size='4'><b>-- Administrator private message --</b></font>"
C << "<font color='red'>Admin PM from-<b>[key_name(src, C, 0)]</b>: [msg]</font>"
C << "<font color='red'><i>Click on the administrator's name to reply.</i></font>"
src << "<font color='blue'>Admin PM to-<b>[key_name(C, src, 1)]</b>: [msg]</font>"
//always play non-admin recipients the adminhelp sound
C << 'sound/effects/adminhelp.ogg'
//AdminPM popup for ApocStation and anybody else who wants to use it. Set it with POPUP_ADMIN_PM in config.txt ~Carn
if(config.popup_admin_pm)
spawn() //so we don't hold the caller proc up
var/sender = src
var/sendername = key
var/reply = input(C, msg,"Admin PM from-[sendername]", "") as text|null //show message and await a reply
if(C && reply)
if(sender)
C.cmd_admin_pm(sender,reply) //sender is still about, let's reply to them
else
adminhelp(reply) //sender has left, adminhelp instead
return
else //neither are admins
src << "<font color='red'>Error: Admin-PM: Non-admin to non-admin PM communication is forbidden.</font>"
return
log_admin("PM: [key_name(src)]->[key_name(C)]: [msg]")
//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 << "<B><font color='blue'>PM: [key_name(src, X, 0)]-&gt;[key_name(C, X, 0)]:</B> \blue [msg]</font>" //inform X