1
0
Fork 0
forked from External/ergo

review fixes for raw i/o notification

This commit is contained in:
Shivaram Lingamneni 2017-10-04 13:41:19 -04:00 committed by Daniel Oaks
parent aff1752d67
commit 456174ed53
2 changed files with 15 additions and 11 deletions

View file

@ -38,7 +38,7 @@ var (
)
const (
rawOutputNotice = "This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."
rawIONotice = "This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."
)
// Limits holds the maximum limits for various things such as topic lengths.
@ -90,6 +90,7 @@ type Server struct {
ctime time.Time
defaultChannelModes Modes
dlines *DLineManager
loggingRawIO bool
isupport *ISupportList
klines *KLineManager
limits Limits
@ -429,8 +430,8 @@ func (server *Server) tryRegister(c *Client) {
c.RplISupport()
server.MOTD(c)
c.Send(nil, c.nickMaskString, RPL_UMODEIS, c.nick, c.ModeString())
if server.logger.DumpingRawInOut() {
c.Notice(rawOutputNotice)
if server.logger.IsLoggingRawIO() {
c.Notice(rawIONotice)
}
}
@ -1426,7 +1427,10 @@ func (server *Server) applyConfig(config *Config, initial bool) error {
if err != nil {
return err
}
dumpingRawInOut := server.logger.DumpingRawInOut()
nowLoggingRawIO := server.logger.IsLoggingRawIO()
// notify clients if raw i/o logging was enabled by a rehash
sendRawOutputNotice := !initial && !server.loggingRawIO && nowLoggingRawIO
server.loggingRawIO = nowLoggingRawIO
if initial {
if err := server.loadDatastore(config.Datastore.Path); err != nil {
@ -1445,8 +1449,8 @@ func (server *Server) applyConfig(config *Config, initial bool) error {
sClient.Send(nil, server.name, RPL_ISUPPORT, append([]string{sClient.nick}, tokenline...)...)
}
if dumpingRawInOut {
sClient.Notice(rawOutputNotice)
if sendRawOutputNotice {
sClient.Notice(rawIONotice)
}
}
server.clients.ByNickMutex.RUnlock()