mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Watchlist entries filtering, non-deleting messages (#23737)
* adds watchlist filtering to online clients, messages no longer delete self * message-sent > message sent * missed var
This commit is contained in:
@@ -3,7 +3,6 @@ var/list/admins = list() //all clients whom are admins
|
||||
var/list/deadmins = list() //all clients who have used the de-admin verb.
|
||||
var/list/directory = list() //all ckeys with associated client
|
||||
var/list/stealthminID = list() //reference list with IDs that store ckeys, for stealthmins
|
||||
var/global/list/current_watchlist = list() //stores players that are currently online and in the watchlist
|
||||
|
||||
//Since it didn't really belong in any other category, I'm putting this here
|
||||
//This is for procs to replace all the goddamn 'in world's that are chilling around the code
|
||||
|
||||
@@ -567,7 +567,6 @@ var/datum/subsystem/garbage_collector/SSgarbage
|
||||
SearchVar(deadmins)
|
||||
SearchVar(directory)
|
||||
SearchVar(stealthminID)
|
||||
SearchVar(current_watchlist)
|
||||
SearchVar(player_list)
|
||||
SearchVar(mob_list)
|
||||
SearchVar(living_mob_list)
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
<A href='?src=\ref[src];secrets=list_job_debug'>Show Job Debug</A><BR>
|
||||
<A href='?src=\ref[src];secrets=admin_log'>Admin Log</A><BR>
|
||||
<A href='?src=\ref[src];secrets=show_admins'>Show Admin List</A><BR>
|
||||
<A href='?src=\ref[src];secrets=show_current_watchlist'>Show online players in the watchlist</A><BR>
|
||||
<BR>
|
||||
"}
|
||||
|
||||
@@ -120,13 +119,6 @@
|
||||
dat += "[ckey] - [D.rank.name]<br>"
|
||||
usr << browse(dat, "window=showadmins;size=600x500")
|
||||
|
||||
if("show_current_watchlist")
|
||||
var/dat = "<B>Watchlist: </B><HR>"
|
||||
if(current_watchlist)
|
||||
for(var/ckey in current_watchlist)
|
||||
dat += "[ckey] - [current_watchlist[ckey]]"
|
||||
usr << browse(dat, "window=showcurrentwatchlist;size=600x500")
|
||||
|
||||
if("tdomereset")
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
message_admins("[key_name_admin(usr)] has toggled [target_ckey]'s [type] made by [admin_ckey] to [secret ? "not secret" : "secret"]")
|
||||
browse_messages(target_ckey = target_ckey)
|
||||
|
||||
/proc/browse_messages(type, target_ckey, index, linkless = 0)
|
||||
/proc/browse_messages(type, target_ckey, index, linkless = 0, filter)
|
||||
if(!dbcon.IsConnected())
|
||||
usr << "<span class='danger'>Failed to establish database connection.</span>"
|
||||
return
|
||||
@@ -176,7 +176,11 @@
|
||||
output += "<a href='?_src_=holder;addmemo=1'>\[Add memo\]</a></center>"
|
||||
else if(type == "watchlist entry")
|
||||
output += "<h2><center>Watchlist entries</h2>"
|
||||
output += "<a href='?_src_=holder;addwatchempty=1'>\[Add watchlist entry\]</a></center>"
|
||||
output += "<a href='?_src_=holder;addwatchempty=1'>\[Add watchlist entry\]</a>"
|
||||
if(filter)
|
||||
output += "|<a href='?_src_=holder;showwatch=1'>\[Unfilter clients\]</a></center>"
|
||||
else
|
||||
output += "|<a href='?_src_=holder;showwatchfilter=1'>\[Filter offline clients\]</a></center>"
|
||||
output += ruler
|
||||
var/DBQuery/query_get_type_messages = dbcon.NewQuery("SELECT id, targetckey, adminckey, text, timestamp, server, lasteditor FROM [format_table_name("messages")] WHERE type = '[type]'")
|
||||
if(!query_get_type_messages.Execute())
|
||||
@@ -186,6 +190,8 @@
|
||||
while(query_get_type_messages.NextRow())
|
||||
var/id = query_get_type_messages.item[1]
|
||||
var/t_ckey = query_get_type_messages.item[2]
|
||||
if(type == "watchlist entry" && filter && !(t_ckey in directory))
|
||||
continue
|
||||
var/admin_ckey = query_get_type_messages.item[3]
|
||||
var/text = query_get_type_messages.item[4]
|
||||
var/timestamp = query_get_type_messages.item[5]
|
||||
@@ -229,6 +235,11 @@
|
||||
data += " <a href='?_src_=holder;deletemessage=[id]'>\[Delete\]</a>"
|
||||
if(type == "note")
|
||||
data += " <a href='?_src_=holder;secretmessage=[id]'>[secret ? "<b>\[Secret\]</b>" : "\[Not secret\]"]</a>"
|
||||
if(type == "message sent")
|
||||
data += " <font size='2'>Message has been sent</font>"
|
||||
if(editor_ckey)
|
||||
data += "|"
|
||||
else
|
||||
data += " <a href='?_src_=holder;editmessage=[id]'>\[Edit\]</a>"
|
||||
if(editor_ckey)
|
||||
data += " <font size='2'>Last edit by [editor_ckey] <a href='?_src_=holder;messageedits=[id]'>(Click here to see edit log)</a></font>"
|
||||
@@ -236,6 +247,8 @@
|
||||
switch(type)
|
||||
if("message")
|
||||
messagedata += data
|
||||
if("message sent")
|
||||
messagedata += data
|
||||
if("watchlist entry")
|
||||
watchdata += data
|
||||
if("note")
|
||||
@@ -303,7 +316,7 @@ proc/get_message_output(type, target_ckey)
|
||||
log_game("SQL ERROR obtaining id, adminckey, text, timestamp, lasteditor from messages table. Error : \[[err]\]\n")
|
||||
return
|
||||
while(query_get_message_output.NextRow())
|
||||
var/id = query_get_message_output.item[1]
|
||||
var/message_id = query_get_message_output.item[1]
|
||||
var/admin_ckey = query_get_message_output.item[2]
|
||||
var/text = query_get_message_output.item[3]
|
||||
var/timestamp = query_get_message_output.item[4]
|
||||
@@ -311,15 +324,19 @@ proc/get_message_output(type, target_ckey)
|
||||
switch(type)
|
||||
if("message")
|
||||
output += "<font color='red' size='3'><b>Admin message left by <span class='prefix'>[admin_ckey]</span> on [timestamp]</b></font>"
|
||||
output += "<br><font color='red'>[text]</font>"
|
||||
delete_message(id, 0)
|
||||
output += "<br><font color='red'>[text]</font><br>"
|
||||
var/DBQuery/query_message_read = dbcon.NewQuery("UPDATE [format_table_name("messages")] SET type = 'message sent' WHERE id = [message_id]")
|
||||
if(!query_message_read.Execute())
|
||||
var/err = query_message_read.ErrorMsg()
|
||||
log_game("SQL ERROR updating message type. Error : \[[err]\]\n")
|
||||
return
|
||||
if("watchlist entry")
|
||||
message_admins("<font color='red'><B>Notice: </B></font><font color='blue'>[key_name_admin(target_ckey)] is on the watchlist and has just connected - Reason: [text]</font>")
|
||||
send2irc_adminless_only("Watchlist", "[key_name(target_ckey)] is on the watchlist and has just connected - Reason: [text]")
|
||||
if("memo")
|
||||
output += "<span class='memo'>Memo by <span class='prefix'>[admin_ckey]</span> on [timestamp]"
|
||||
if(editor_ckey)
|
||||
output += "<br><span class='memoedit'>Last edit by [editor_ckey] <A href='?_src_=holder;messageedits=[id]'>(Click here to see edit log)</A></span>"
|
||||
output += "<br><span class='memoedit'>Last edit by [editor_ckey] <A href='?_src_=holder;messageedits=[message_id]'>(Click here to see edit log)</A></span>"
|
||||
output += "<br>[text]</span><br>"
|
||||
return output
|
||||
|
||||
|
||||
@@ -1087,6 +1087,9 @@
|
||||
else if(href_list["showwatch"])
|
||||
browse_messages("watchlist entry")
|
||||
|
||||
else if(href_list["showwatchfilter"])
|
||||
browse_messages("watchlist entry", filter = 1)
|
||||
|
||||
else if(href_list["showmessageckey"])
|
||||
var/target = href_list["showmessageckey"]
|
||||
browse_messages(target_ckey = target)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
SStgui.on_logout(src)
|
||||
unset_machine()
|
||||
player_list -= src
|
||||
current_watchlist -= ckey
|
||||
log_access("Logout: [key_name(src)]")
|
||||
if(admin_datums[src.ckey])
|
||||
if (ticker && ticker.current_state == GAME_STATE_PLAYING) //Only report this stuff if we are currently playing.
|
||||
|
||||
Reference in New Issue
Block a user