Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't send 'locate' cmd response to WS #161

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CelesteNet.Server.ChatModule/CMDs/CmdLocate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override void Run(CmdEnv env, List<ICmdArg>? args) {

// the DataChat above was constructed with self so that the spam check in PrepareAndLog doesn't break,
// and we do need to PrepareAndLog because we need a valid msg ID...
chat = Chat.PrepareAndLog(null, chat);
chat = Chat.PrepareAndLog(null, chat, false);

if (chat != null) {
chat.Player = OtherPlayer;
Expand Down
12 changes: 8 additions & 4 deletions CelesteNet.Server.FrontendModule/Frontend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ private void OnSessionStart(CelesteNetPlayerSession session) {
"sess_join", PlayerSessionToFrontend(session, frontendWS.IsAuthorized, true)
));
TryBroadcastUpdate(Settings.APIPrefix + "/status");
//TryBroadcastUpdate(Settings.APIPrefix + "/players");
session.OnEnd += OnSessionEnd;
}

Expand All @@ -150,7 +149,6 @@ private void OnSessionEnd(CelesteNetPlayerSession session, DataPlayerInfo? lastP
"sess_leave", PlayerSessionToFrontend(session, frontendWS.IsAuthorized, true)
));
TryBroadcastUpdate(Settings.APIPrefix + "/status");
//TryBroadcastUpdate(Settings.APIPrefix + "/players");
}

private void OnDisconnect(CelesteNetServer server, CelesteNetConnection con, CelesteNetPlayerSession? session) {
Expand All @@ -163,7 +161,9 @@ private void OnBroadcastChannels(Channels obj) {
}

private void OnChannelMove(CelesteNetPlayerSession session, Channel? from, Channel? to) {
BroadcastCMD(false, "chan_move",
BroadcastCMD(
from?.IsPrivate == true || to?.IsPrivate == true,
"chan_move",
new {
session.SessionID,
fromID = from?.ID,
Expand All @@ -185,7 +185,11 @@ private void OnCreateChannel(Channel channel, int total) {
}

private void OnRemoveChannel(string name, uint id, int total) {
BroadcastCMD(false, "chan_remove",
// it would've been better to also pass the `Channel` instance into this tbh
// but I'm not gonna change the event/delegate signature at this point...
BroadcastCMD(
name.StartsWith(Channels.PrefixPrivate),
"chan_remove",
new {
Name = name,
ID = id,
Expand Down