Files
DorkNet/DorkNet.Server/Data/Entities/ChatMessageEntity.cs
T
Alexa d471b418b9 Import march-2020-03-10 from private repo (scrubbed 2026-05-27)
Targets Rec Room 2020.03.10 client (also serves 2020.03.06).

Re-import after adding:
- DorkNet.ClientMod/dorknet-clientmod.json.template — config schema
  the launcher's manifest-driven patcher renders into UserData/.
- tools/build-patcher-zip.ps1 — produces dorknet-clientpatch-{key}.zip
  for v1-march-* Release uploads.
- .github/workflows/release.yml — on tag push publishes both
  dorknet-server-march_2020_03_10-win-x64.zip and
  dorknet-clientpatch-march_2020_03_10.zip as Release assets.

Same scrub rules as december; tools/build-patcher-zip.ps1 added to
the maintainer-side allow-list so it survives.
2026-05-27 01:06:12 +03:00

40 lines
1.4 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace DorkNet.Server.Data.Entities;
/// <summary>
/// In-game text-chat message. Sent to the chat.rec.net/thread
/// endpoint family; backed by a flat per-thread row table where the
/// thread id is just the canonical (lower, higher) pair of player ids
/// for DMs, or the room id for room-wide chats.
///
/// We keep a separate table from <see cref="MessageEntity"/> because
/// the wire shape and history-fetch semantics differ — chat is
/// append-and-read-recent, messages are inbox-style with read
/// receipts.
/// </summary>
public class ChatMessageEntity
{
public long Id { get; set; }
/// <summary>String thread key. Format: <c>dm:<low>:<high></c> for
/// direct messages between two players (lower id first), or
/// <c>room:<roomId></c> for room-wide chats.</summary>
[MaxLength(64)]
public string ThreadKey { get; set; } = string.Empty;
public long SenderPlayerId { get; set; }
[MaxLength(2000)]
public string Body { get; set; } = string.Empty;
public DateTime SentAt { get; set; } = DateTime.UtcNow;
/// <summary>Build the canonical DM thread key for two players.
/// Order-independent so both sides hit the same row.</summary>
public static string DmKey(long a, long b) =>
a < b ? $"dm:{a}:{b}" : $"dm:{b}:{a}";
public static string RoomKey(long roomId) => $"room:{roomId}";
}