Chatclient fixes 2 (#16587)

* Fixes the chat client and services.

* oh how we love you

* lemme talk to 'em...

* a

* m

* lilas

* bro

---------

Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
Matt Atlas
2023-06-29 14:31:42 +02:00
committed by GitHub
parent dd0730580f
commit 1645af37cc
6 changed files with 112 additions and 49 deletions

View File

@@ -13,6 +13,7 @@
var/datum/ntnet_user/my_user
var/datum/ntnet_conversation/focused_conv
var/datum/ntnet_conversation/active
var/netadmin_mode = FALSE // Administrator mode (invisible to other users + bypasses passwords)
var/set_offline = FALSE // appear "invisible"
@@ -120,6 +121,29 @@
data["netadmin_mode"] = netadmin_mode
data["can_netadmin_mode"] = can_run(user, FALSE, access_network)
data["message_mute"] = message_mute
if(active && active.can_interact(src))
var/ref = text_ref(active)
var/can_interact = active.can_interact(src)
var/can_manage = active.can_manage(src)
var/list/our_channel = list(
"ref" = ref,
"title" = active.get_title(src),
"direct" = active.direct,
"password" = !!active.password,
"can_interact" = can_interact,
"can_manage" = can_manage,
"focused" = (focused_conv == active)
)
if(can_interact)
our_channel["users"] = list()
for(var/datum/ntnet_user/U in active.users)
var/uref = text_ref(U)
our_channel["users"] += list(list("ref" = uref, "username" = U.username))
data["active"] = our_channel
data["msg"] = active.messages
else
data["active"] = null
data["msg"] = null
return data
@@ -147,7 +171,6 @@
for(var/datum/ntnet_user/U in channel.users)
var/uref = text_ref(U)
our_channel["users"] += list(list("ref" = uref, "username" = U.username))
data["msg"] = channel.messages
data["channels"] += list(our_channel)
data["users"] = list()
@@ -194,7 +217,6 @@
if(ishuman(user))
user.visible_message("[SPAN_BOLD("\The [user]")] taps on [user.get_pronoun("his")] [computer.lexical_name]'s screen.")
conv.cl_send(src, message, user)
computer.update_static_data_for_all_viewers()
. = TRUE
if(action == "focus")
@@ -224,10 +246,22 @@
computer.update_static_data_for_all_viewers()
. = TRUE
if(action == "set_active")
if(isnull(params["set_active"]))
active = null
. = TRUE
else
var/datum/ntnet_conversation/conv = locate(params["set_active"])
if(istype(conv))
active = conv
. = TRUE
if(action == "leave")
var/datum/ntnet_conversation/conv = locate(params["leave"])
if(istype(conv))
conv.cl_leave(src)
if(active)
active = null
computer.update_static_data_for_all_viewers()
. = TRUE