Network tab sends
ChatNetwork.Rewrite sends a plain line typed on a network tab as /<command> global <text> while on the network (not sent off it); commands are unchanged. ChatModel.OnSend applies it only on a tab owned by an active chatTabs entry that declares network. On is unknown (treated as on) until the join status exists. The input placeholder follows the state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fea33eb41b
commit
726e0287f2
5 changed files with 116 additions and 1 deletions
|
|
@ -41,6 +41,8 @@
|
|||
<Compile Include="..\..\src\RynthCore.Engine\UI\Data\ChatServerTabs.cs" Link="Engine\ChatServerTabs.cs" />
|
||||
<!-- 2026-11-15: pinned tab bookkeeping. -->
|
||||
<Compile Include="..\..\src\RynthCore.Engine\UI\Data\ChatPins.cs" Link="Engine\ChatPins.cs" />
|
||||
<!-- 2026-11-15: network tab sends. -->
|
||||
<Compile Include="..\..\src\RynthCore.Engine\UI\Data\ChatNetwork.cs" Link="Engine\ChatNetwork.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ internal static class Program
|
|||
ServerTabDiscovery();
|
||||
ServerTabPlans();
|
||||
PinBookkeeping();
|
||||
NetworkRewrite();
|
||||
SharedFileReload();
|
||||
LineColorTags();
|
||||
LineColorKinds();
|
||||
|
|
@ -1606,6 +1607,37 @@ internal static class Program
|
|||
}
|
||||
|
||||
// 2026-11-15: pinned tab bookkeeping (ChatPins), pure.
|
||||
private static void NetworkRewrite()
|
||||
{
|
||||
Case("Rewrite_PlainText");
|
||||
Check(ChatNetwork.Rewrite("hello all", "derethnetwork", true) == "/derethnetwork global hello all", "on the network: sent through the command");
|
||||
Check(ChatNetwork.Rewrite("hello all", "derethnetwork", false) == null, "off the network: not sent");
|
||||
|
||||
Case("Rewrite_CommandsPassThrough");
|
||||
Check(ChatNetwork.Rewrite("/tell Bob@coldeve, hi", "dn", true) == "/tell Bob@coldeve, hi", "/tell unchanged on");
|
||||
Check(ChatNetwork.Rewrite("/tell Bob@coldeve, hi", "dn", false) == "/tell Bob@coldeve, hi", "/tell unchanged off");
|
||||
Check(ChatNetwork.Rewrite("@derethnetwork on", "dn", true) == "@derethnetwork on", "@command unchanged on");
|
||||
Check(ChatNetwork.Rewrite("@derethnetwork on", "dn", false) == "@derethnetwork on", "@command unchanged off");
|
||||
|
||||
Case("Rewrite_Trimmed");
|
||||
Check(ChatNetwork.Rewrite(" hi there ", "dn", true) == "/dn global hi there", "leading and trailing spaces trimmed");
|
||||
Check(ChatNetwork.Rewrite(" /tell Bob, hi ", "dn", true) == "/tell Bob, hi", "a command after spaces is still a command");
|
||||
Check(ChatNetwork.Rewrite(" @dn on", "dn", false) == "@dn on", "an @command after spaces is still a command");
|
||||
|
||||
Case("Rewrite_Empty");
|
||||
Check(ChatNetwork.Rewrite("", "dn", true) == null && ChatNetwork.Rewrite("", "dn", false) == null, "empty is never sent");
|
||||
Check(ChatNetwork.Rewrite(" \t ", "dn", true) == null && ChatNetwork.Rewrite(" ", "dn", false) == null, "whitespace only is never sent");
|
||||
|
||||
Case("NetworkState_DefaultsUnknown");
|
||||
Check(ChatNetwork.On == null && ChatNetwork.OnOrUnknown, "unknown by default and treated as on");
|
||||
ChatNetwork.On = false;
|
||||
Check(ChatNetwork.On == false && !ChatNetwork.OnOrUnknown, "off");
|
||||
ChatNetwork.On = true;
|
||||
Check(ChatNetwork.On == true && ChatNetwork.OnOrUnknown, "on");
|
||||
ChatNetwork.On = null;
|
||||
Check(ChatNetwork.On == null, "reset to unknown");
|
||||
}
|
||||
|
||||
private static void PinBookkeeping()
|
||||
{
|
||||
Case("Toggle_AddsAtEndAndRemoves");
|
||||
|
|
|
|||
Loading…
Reference in a new issue