mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
Merge pull request #13557 from AffectedArc07/nttc-filtering
Re-adds NTTC filtering
This commit is contained in:
@@ -171,6 +171,8 @@ GLOBAL_LIST_EMPTY(tcomms_machines)
|
||||
var/vname
|
||||
/// List of all channels this can be sent or recieved on
|
||||
var/list/zlevels = list()
|
||||
/// Should this signal be re-broadcasted (Can be modified by NTTC, defaults to TRUE)
|
||||
var/pass = TRUE
|
||||
|
||||
/**
|
||||
* Destructor for the TCM datum.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#define UI_TAB_CONFIG "CONFIG"
|
||||
#define UI_TAB_LINKS "LINKS"
|
||||
#define UI_TAB_FILTER "FILTER"
|
||||
|
||||
/**
|
||||
* # Telecommunications Core
|
||||
@@ -81,6 +82,11 @@
|
||||
// Now we can run NTTC
|
||||
tcm = nttc.modify_message(tcm)
|
||||
|
||||
// If the signal shouldnt be broadcast, dont broadcast it
|
||||
if(!tcm.pass)
|
||||
// We still return TRUE here because the signal was handled, even though we didnt broadcast
|
||||
return TRUE
|
||||
|
||||
// Now we generate the list of where that signal should go to
|
||||
tcm.zlevels = reachable_zlevels
|
||||
tcm.zlevels |= tcm.source_level
|
||||
@@ -168,6 +174,9 @@
|
||||
data["entries"] += list(list("addr" = "\ref[R]", "net_id" = R.network_id, "sector" = R.loc.z, "status" = status, "status_color" = status_color))
|
||||
// End the shit
|
||||
|
||||
if(ui_tab == UI_TAB_FILTER)
|
||||
data["filtered_users"] = nttc.filtering
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/tcomms/core/Topic(href, href_list)
|
||||
@@ -177,7 +186,7 @@
|
||||
|
||||
if(href_list["tab"])
|
||||
// Make sure its a valid tab
|
||||
if(href_list["tab"] in list(UI_TAB_CONFIG, UI_TAB_LINKS))
|
||||
if(href_list["tab"] in list(UI_TAB_CONFIG, UI_TAB_LINKS, UI_TAB_FILTER))
|
||||
ui_tab = href_list["tab"]
|
||||
|
||||
// Check if they did a href, but only for that current tab
|
||||
@@ -257,9 +266,35 @@
|
||||
to_chat(usr, "<span class='notice'>Successfully changed password from <b>[link_password]</b> to <b>[new_password]</b>.</span>")
|
||||
link_password = new_password
|
||||
|
||||
if(ui_tab == UI_TAB_FILTER)
|
||||
if(href_list["add_filter"])
|
||||
// This is a stripped input because I did NOT come this far for this system to be abused by HTML injection
|
||||
var/name_to_add = stripped_input(usr, "Enter a name to add to the filtering list", "Name Entry")
|
||||
if(name_to_add == "")
|
||||
return
|
||||
if(name_to_add in nttc.filtering)
|
||||
to_chat(usr, "<span class='alert'><b>ERROR:</b> User already in filtering list.</span>")
|
||||
else
|
||||
nttc.filtering |= name_to_add
|
||||
log_action(usr, "has added [name_to_add] to the NTTC filter list on core with ID [network_id]", TRUE)
|
||||
to_chat(usr, "<span class='notice'>Successfully added <b>[name_to_add]</b> to the NTTC filtering list.</span>")
|
||||
|
||||
|
||||
if(href_list["remove_filter"])
|
||||
var/name_to_remove = href_list["remove_filter"]
|
||||
if(!(name_to_remove in nttc.filtering))
|
||||
to_chat(usr, "<span class='alert'><b>ERROR:</b> Name does not exist in filter list. Please file an issue report.</span>")
|
||||
else
|
||||
var/confirm = alert(usr, "Are you sure you want to remove [name_to_remove] from the filtering list?", "Confirm Removal", "Yes", "No")
|
||||
if(confirm == "Yes")
|
||||
nttc.filtering -= name_to_remove
|
||||
log_action(usr, "has removed [name_to_remove] from the NTTC filter list on core with ID [network_id]", TRUE)
|
||||
to_chat(usr, "<span class='notice'>Successfully removed <b>[name_to_remove]</b> from the NTTC filtering list.</span>")
|
||||
|
||||
|
||||
// Hack to speed update the nanoUI
|
||||
SSnanoui.update_uis(src)
|
||||
|
||||
#undef UI_TAB_CONFIG
|
||||
#undef UI_TAB_LINKS
|
||||
#undef UI_TAB_FILTER
|
||||
|
||||
@@ -153,6 +153,10 @@
|
||||
var/list/job_card_styles = list(
|
||||
JOB_STYLE_1, JOB_STYLE_2, JOB_STYLE_3, JOB_STYLE_4
|
||||
)
|
||||
|
||||
// List of people who will get blocked out of comms
|
||||
var/list/filtering = list()
|
||||
|
||||
// Used to determine what languages are allowable for conversion. Generated during runtime.
|
||||
var/list/valid_languages = list("--DISABLE--")
|
||||
|
||||
@@ -220,6 +224,9 @@
|
||||
|
||||
// Primary signal modification. This is where all of the variables behavior are actually implemented.
|
||||
/datum/nttc_configuration/proc/modify_message(datum/tcomms_message/tcm)
|
||||
// Check if they should be blacklisted right off the bat. We can save CPU if the message wont even be processed
|
||||
if(tcm.sender_name in filtering)
|
||||
tcm.pass = FALSE
|
||||
// All job and coloring shit
|
||||
if(toggle_job_color || toggle_name_color)
|
||||
var/job = tcm.sender_job
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{{:helper.link('Device Configuration', 'wrench', {'tab' : "CONFIG"}, data.tab == "CONFIG" ? 'selected' : '')}}
|
||||
{{:helper.link('Device Links', 'link', {'tab' : "LINKS"}, data.tab == "LINKS" ? 'selected' : '')}}
|
||||
{{:helper.link('User Filtering', 'user-times', {'tab' : "FILTER"}, data.tab == "FILTER" ? 'selected' : '')}}
|
||||
|
||||
{{if data.tab == "CONFIG"}}
|
||||
<h1>Core Configuration</h1>
|
||||
@@ -136,4 +137,47 @@
|
||||
{{/for}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else data.tab == "FILTER"}}
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table,
|
||||
td,
|
||||
th {
|
||||
border: 1px solid #ffffff;
|
||||
}
|
||||
.infoButton {
|
||||
background: none;
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
<h1>Filtering List</h1>
|
||||
<div class="item">
|
||||
<div class="itemLabel">
|
||||
{{:helper.link('Add User', 'plus', {'add_filter': 1})}}
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<table style='width: 100%; text-align: center; background-color: #272727;'>
|
||||
<colgroup>
|
||||
<col span="1" style="width: 90%;">
|
||||
<col span="1" style="width: 10%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Remove</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{for data.filtered_users}}
|
||||
<tr>
|
||||
<td>{{:value}}</td>
|
||||
<td>{{:helper.link('Remove', 'times', {'remove_filter' : value}, null, 'infoButton')}}</td>
|
||||
</tr>
|
||||
{{/for}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{/if}}
|
||||
|
||||
Reference in New Issue
Block a user