[MIRROR] Messenger fixes [MDB IGNORE] (#19449)

* Messenger fixes

* Update ntmessenger.dm

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: lessthnthree <three@lessthanthree.dk>
Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-02-26 19:07:13 -05:00
committed by GitHub
co-authored by John Willard lessthnthree lessthanthree
parent 7cd024fa5e
commit b0e5be6736
3 changed files with 41 additions and 12 deletions
@@ -54,6 +54,7 @@
var/obj/item/photo/pic = attacking_item
saved_image = pic.picture
ProcessPhoto()
user.balloon_alert(user, "photo uploaded")
return TRUE
/datum/computer_file/program/messenger/proc/ScrubMessengerList()
@@ -196,6 +197,19 @@
sending_virus = !sending_virus
return UI_UPDATE
if("PDA_selectPhoto")
if(!issilicon(usr))
return
var/mob/living/silicon/user = usr
if(!user.aicamera)
return
var/datum/picture/selected_photo = user.aicamera.selectpicture(user)
if(!selected_photo)
return
saved_image = selected_photo
ProcessPhoto()
return TRUE
/datum/computer_file/program/messenger/ui_static_data(mob/user)
var/list/data = ..()
@@ -295,7 +309,8 @@
"ref" = REF(computer),
"targets" = targets,
"rigged" = rigged,
"photo" = photo_path,
"photo" = saved_image,
"photo_path" = photo_path,
"automated" = FALSE,
))
if(rigged) //Will skip the message server and go straight to the hub so it can't be cheesed by disabling the message server machine
@@ -322,7 +337,9 @@
message_data["contents"] = html_decode(signal.format_message())
message_data["outgoing"] = TRUE
message_data["ref"] = signal.data["ref"]
message_data["photo_path"] = signal.data["photo_path"]
message_data["photo"] = signal.data["photo"]
message_data["target_details"] = signal.format_target()
// Show it to ghosts
var/ghost_message = span_name("[message_data["name"]] </span><span class='game say'>[rigged ? "Rigged" : ""] PDA Message</span> --> [span_name("[signal.format_target()]")]: <span class='message'>[signal.format_message()]")
@@ -350,6 +367,8 @@
last_text_everyone = world.time
messages += list(message_data)
saved_image = null
photo_path = null
return TRUE
/datum/computer_file/program/messenger/proc/receive_message(datum/signal/subspace/messaging/tablet_msg/signal)
@@ -360,6 +379,7 @@
message_data["outgoing"] = FALSE
message_data["ref"] = signal.data["ref"]
message_data["automated"] = signal.data["automated"]
message_data["photo_path"] = signal.data["photo_path"]
message_data["photo"] = signal.data["photo"]
messages += list(message_data)
@@ -384,9 +404,9 @@
var/inbound_message = signal.format_message()
inbound_message = emoji_parse(inbound_message)
if(ringer_status && L.is_literate())
to_chat(L, "<span class='infoplain'>[icon2html(src)] <b>PDA message from [hrefstart][signal.data["name"]] ([signal.data["job"]])[hrefend], </b>[inbound_message] [reply]</span>")
if(L.is_literate())
var/photo_message = message_data["photo"] ? " (<a href='byond://?src=[REF(signal.logged)];photo=1'>Photo</a>)" : ""
to_chat(L, span_infoplain("[icon2html(computer)] <b>PDA message from [hrefstart][signal.data["name"]] ([signal.data["job"]])[hrefend], </b>[inbound_message][photo_message] [reply]"))
if (ringer_status)
computer.ring(ringtone)
@@ -15,15 +15,15 @@
to_chat(user, span_notice("Camera mode: [in_camera_mode ? "Activated" : "Deactivated"]."))
/obj/item/camera/siliconcam/proc/selectpicture(mob/user)
var/list/nametemp = list()
RETURN_TYPE(/datum/picture)
if(!length(stored))
to_chat(usr, span_warning("No images saved"))
to_chat(user, span_notice("ERROR: No stored photos located."))
return
var/list/nametemp = list()
var/list/temp = list()
for(var/i in stored)
var/datum/picture/p = i
nametemp += p.picture_name
temp[p.picture_name] = p
for(var/datum/picture/stored_photo as anything in stored)
nametemp += stored_photo.picture_name
temp[stored_photo.picture_name] = stored_photo
var/find = tgui_input_list(user, "Select image", "Storage", nametemp)
if(isnull(find))
return
+11 -2
View File
@@ -104,6 +104,13 @@ const ContactsScreen = (props, context) => {
content={`Sort by: ${sortByJob ? 'Job' : 'Name'}`}
onClick={() => act('PDA_changeSortStyle')}
/>
{!!isSilicon && (
<Button
icon="camera"
content="Attach Photo"
onClick={() => act('PDA_selectPhoto')}
/>
)}
{!!virus_attach && (
<Button
icon="bug"
@@ -203,7 +210,7 @@ const MessageListScreen = (props, context) => {
{message.outgoing ? '(OUTGOING)' : '(INCOMING)'}
</Box>
{message.outgoing ? (
<Box bold>{message.name + ' (' + message.job + ')'}</Box>
<Box bold>{message.target_details}</Box>
) : (
<Button
transparent
@@ -220,7 +227,9 @@ const MessageListScreen = (props, context) => {
</Section>
<Section fill mt={-1}>
<Box italic>{message.contents}</Box>
{!!message.photo && <Box as="img" src={message.photo} mt={1} />}
{!!message.photo && (
<Box as="img" src={message.photo_path} mt={1} />
)}
</Section>
</Stack>
))}