From 9b85475fe429f7c9e45c46ed6418f1edb7971a01 Mon Sep 17 00:00:00 2001 From: Alex Dunn Date: Wed, 3 Jun 2020 19:47:57 -0700 Subject: [PATCH] add new setting to suppress join/leave announcements --- chatroom.go | 9 ++++++--- settings.go | 1 + settings_example.json | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/chatroom.go b/chatroom.go index 5632bb8..00d4b68 100644 --- a/chatroom.go +++ b/chatroom.go @@ -109,8 +109,9 @@ func (cr *ChatRoom) Join(conn *chatConnection, data common.JoinData) (*Client, e } else { client.Send(playingCommand) } - cr.AddEventMsg(common.EvJoin, data.Name, data.Color) - + if !settings.LetThemLurk { + cr.AddEventMsg(common.EvJoin, data.Name, data.Color) + } sendHiddenMessage(common.CdJoin, nil) sendHiddenMessage(common.CdEmote, common.Emotes) @@ -135,7 +136,9 @@ func (cr *ChatRoom) Leave(name, color string) { client.conn.Close() cr.delClient(id) - cr.AddEventMsg(common.EvLeave, name, color) + if !settings.LetThemLurk { + cr.AddEventMsg(common.EvLeave, name, color) + } common.LogChatf("[leave] %s %s\n", host, name) } diff --git a/settings.go b/settings.go index ab5d3a8..a96a442 100644 --- a/settings.go +++ b/settings.go @@ -26,6 +26,7 @@ type Settings struct { AdminPassword string ApprovedEmotes []string // list of channels that have been approved for emote use. Global emotes are always "approved". Bans []BanInfo + LetThemLurk bool // whether or not to announce users joining/leaving chat ListenAddress string LogFile string LogLevel common.LogLevel diff --git a/settings_example.json b/settings_example.json index 04ec2c3..53b35e5 100644 --- a/settings_example.json +++ b/settings_example.json @@ -2,6 +2,7 @@ "AdminPassword": "", "ApprovedEmotes": null, "Bans": [], + "LetThemLurk": false, "ListenAddress": ":8089", "LogFile": "thelog.log", "LogLevel": "debug",