oops! All Refactors!
This commit is contained in:
@@ -605,21 +605,49 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
|
||||
msg2 = replacetext(replacetext(msg2, "\proper", ""), "\improper", "")
|
||||
world.TgsTargetedChatBroadcast("[msg] | [msg2]", TRUE)
|
||||
|
||||
/proc/send2otherserver(source,msg,type = "Ahelp")
|
||||
var/comms_key = CONFIG_GET(string/comms_key)
|
||||
if(!comms_key)
|
||||
/**
|
||||
* Sends a message to a set of cross-communications-enabled servers using world topic calls
|
||||
*
|
||||
* Arguments:
|
||||
* * source - Who sent this message
|
||||
* * msg - The message body
|
||||
* * type - The type of message, becomes the topic command under the hood
|
||||
* * target_servers - A collection of servers to send the message to, defined in config
|
||||
* * additional_data - An (optional) associated list of extra parameters and data to send with this world topic call
|
||||
*/
|
||||
/proc/send2otherserver(source, msg, type = "Ahelp", target_servers, list/additional_data = list())
|
||||
if(!CONFIG_GET(string/comms_key))
|
||||
debug_world_log("Server cross-comms message not sent for lack of configured key")
|
||||
return
|
||||
var/list/message = list()
|
||||
message["message_sender"] = source
|
||||
message["message"] = msg
|
||||
message["source"] = "([CONFIG_GET(string/cross_comms_name)])"
|
||||
message["key"] = comms_key
|
||||
message += type
|
||||
|
||||
var/our_id = CONFIG_GET(string/cross_comms_name)
|
||||
additional_data["message_sender"] = source
|
||||
additional_data["message"] = msg
|
||||
additional_data["source"] = "([our_id])"
|
||||
additional_data += type
|
||||
|
||||
var/list/servers = CONFIG_GET(keyed_list/cross_server)
|
||||
for(var/I in servers)
|
||||
world.Export("[servers[I]]?[list2params(message)]")
|
||||
if(I == our_id) //No sending to ourselves
|
||||
continue
|
||||
if(target_servers && !(I in target_servers))
|
||||
continue
|
||||
world.send_cross_comms(I, additional_data)
|
||||
|
||||
/// Sends a message to a given cross comms server by name (by name for security).
|
||||
/world/proc/send_cross_comms(server_name, list/message, auth = TRUE)
|
||||
set waitfor = FALSE
|
||||
if (auth)
|
||||
var/comms_key = CONFIG_GET(string/comms_key)
|
||||
if(!comms_key)
|
||||
debug_world_log("Server cross-comms message not sent for lack of configured key")
|
||||
return
|
||||
message["key"] = comms_key
|
||||
var/list/servers = CONFIG_GET(keyed_list/cross_server)
|
||||
var/server_url = servers[server_name]
|
||||
if (!server_url)
|
||||
CRASH("Invalid cross comms config: [server_name]")
|
||||
world.Export("[server_url]?[list2params(message)]")
|
||||
|
||||
/proc/ircadminwho()
|
||||
var/list/message = list("Admins: ")
|
||||
|
||||
Reference in New Issue
Block a user