From b3a7e5c996904ac8dad24b6784f5db4a84510c2f Mon Sep 17 00:00:00 2001 From: Alex Jaspersen Date: Thu, 30 Apr 2020 04:38:19 +0000 Subject: [PATCH] Set default user modes when always-on clients reconnect. Add default-user-modes configuration to conventional.yaml. Fix comment on DefaultUserModes. --- conventional.yaml | 6 ++++++ irc/client.go | 4 ++++ irc/modes.go | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/conventional.yaml b/conventional.yaml index e3929a83..0c9df059 100644 --- a/conventional.yaml +++ b/conventional.yaml @@ -430,6 +430,12 @@ accounts: offer-list: #- "oragono.test" + # modes that are set by default when a user connects + # if unset, no user modes will be set by default + # +i is invisible (a user's channels are hidden from whois replies) + # see /QUOTE HELP umodes for more user modes + # default-user-modes: +i + # support for deferring password checking to an external LDAP server # you should probably ignore this section! consult the grafana docs for details: # https://grafana.com/docs/grafana/latest/auth/ldap/ diff --git a/irc/client.go b/irc/client.go index a50959c3..b636678a 100644 --- a/irc/client.go +++ b/irc/client.go @@ -375,6 +375,10 @@ func (server *Server) AddAlwaysOnClient(account ClientAccount, chnames []string, alwaysOn: true, } + for _, defaultMode := range config.Accounts.defaultUserModes { + client.SetMode(defaultMode, true) + } + client.SetMode(modes.TLS, true) client.writerSemaphore.Initialize(1) client.history.Initialize(0, 0) diff --git a/irc/modes.go b/irc/modes.go index 4372f9bb..86912474 100644 --- a/irc/modes.go +++ b/irc/modes.go @@ -22,7 +22,7 @@ var ( } // DefaultUserModes are set on all users when they login. - // this can be overridden in the `server` config, with the `default-user-modes` key + // this can be overridden in the `accounts` config, with the `default-user-modes` key DefaultUserModes = modes.Modes{} )