add fax machine logs (#13006)
This commit is contained in:
@@ -10,7 +10,9 @@ using Content.Server.Power.Components;
|
|||||||
using Content.Server.Power.EntitySystems;
|
using Content.Server.Power.EntitySystems;
|
||||||
using Content.Server.Tools;
|
using Content.Server.Tools;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
|
using Content.Shared.Administration.Logs;
|
||||||
using Content.Shared.Containers.ItemSlots;
|
using Content.Shared.Containers.ItemSlots;
|
||||||
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Emag.Systems;
|
using Content.Shared.Emag.Systems;
|
||||||
using Content.Shared.Fax;
|
using Content.Shared.Fax;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
@@ -33,6 +35,7 @@ public sealed class FaxSystem : EntitySystem
|
|||||||
[Dependency] private readonly ToolSystem _toolSystem = default!;
|
[Dependency] private readonly ToolSystem _toolSystem = default!;
|
||||||
[Dependency] private readonly QuickDialogSystem _quickDialog = default!;
|
[Dependency] private readonly QuickDialogSystem _quickDialog = default!;
|
||||||
[Dependency] private readonly UserInterfaceSystem _userInterface = default!;
|
[Dependency] private readonly UserInterfaceSystem _userInterface = default!;
|
||||||
|
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||||
|
|
||||||
public const string PaperSlotId = "Paper";
|
public const string PaperSlotId = "Paper";
|
||||||
|
|
||||||
@@ -213,6 +216,8 @@ public sealed class FaxSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Low,
|
||||||
|
$"{ToPrettyString(args.User):user} renamed {ToPrettyString(uid)} from \"{component.FaxName}\" to \"{newName}\"");
|
||||||
component.FaxName = newName;
|
component.FaxName = newName;
|
||||||
_popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-name-set"), uid, Filter.Pvs(uid));
|
_popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-name-set"), uid, Filter.Pvs(uid));
|
||||||
UpdateUserInterface(uid, component);
|
UpdateUserInterface(uid, component);
|
||||||
@@ -283,7 +288,7 @@ public sealed class FaxSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnSendButtonPressed(EntityUid uid, FaxMachineComponent component, FaxSendMessage args)
|
private void OnSendButtonPressed(EntityUid uid, FaxMachineComponent component, FaxSendMessage args)
|
||||||
{
|
{
|
||||||
Send(uid, component);
|
Send(uid, component, args.Session.AttachedEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRefreshButtonPressed(EntityUid uid, FaxMachineComponent component, FaxRefreshMessage args)
|
private void OnRefreshButtonPressed(EntityUid uid, FaxMachineComponent component, FaxRefreshMessage args)
|
||||||
@@ -363,7 +368,7 @@ public sealed class FaxSystem : EntitySystem
|
|||||||
/// Sends message to addressee if paper is set and a known fax is selected
|
/// Sends message to addressee if paper is set and a known fax is selected
|
||||||
/// A timeout is set after sending
|
/// A timeout is set after sending
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Send(EntityUid uid, FaxMachineComponent? component = null)
|
public void Send(EntityUid uid, FaxMachineComponent? component = null, EntityUid? sender = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref component))
|
if (!Resolve(uid, ref component))
|
||||||
return;
|
return;
|
||||||
@@ -390,6 +395,8 @@ public sealed class FaxSystem : EntitySystem
|
|||||||
};
|
};
|
||||||
_deviceNetworkSystem.QueuePacket(uid, component.DestinationFaxAddress, payload);
|
_deviceNetworkSystem.QueuePacket(uid, component.DestinationFaxAddress, payload);
|
||||||
|
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{(sender != null ? ToPrettyString(sender.Value) : "Unknown"):user} sent fax from \"{component.FaxName}\" {ToPrettyString(uid)} to {faxName} ({component.DestinationFaxAddress}): {paper.Content}");
|
||||||
|
|
||||||
component.SendTimeoutRemaining += component.SendTimeout;
|
component.SendTimeoutRemaining += component.SendTimeout;
|
||||||
|
|
||||||
_audioSystem.PlayPvs(component.SendSound, uid);
|
_audioSystem.PlayPvs(component.SendSound, uid);
|
||||||
@@ -432,6 +439,8 @@ public sealed class FaxSystem : EntitySystem
|
|||||||
|
|
||||||
if (TryComp<MetaDataComponent>(printed, out var metadata))
|
if (TryComp<MetaDataComponent>(printed, out var metadata))
|
||||||
metadata.EntityName = printout.Name;
|
metadata.EntityName = printout.Name;
|
||||||
|
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Low, $"\"{component.FaxName}\" {ToPrettyString(uid)} printed {ToPrettyString(printed)}: {printout.Content}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NotifyAdmins(string faxName)
|
private void NotifyAdmins(string faxName)
|
||||||
|
|||||||
Reference in New Issue
Block a user