From 78b123be72490484326aba6c36901a57090feba0 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 6 Apr 2020 18:49:39 +0200 Subject: [PATCH] Log TOPIC messages See [1]. [1]: https://github.com/znc/znc/blob/82c4ad8362c6b2f4406770c54a5e10a40fdba548/modules/log.cpp#L486 --- logger.go | 6 ++++++ upstream.go | 1 + 2 files changed, 7 insertions(+) diff --git a/logger.go b/logger.go index b6504e6..f3c107e 100644 --- a/logger.go +++ b/logger.go @@ -100,6 +100,12 @@ func formatMessage(msg *irc.Message) string { reason = msg.Params[0] } return fmt.Sprintf("*** Quits: %s (%s@%s) (%s)", msg.Prefix.Name, msg.Prefix.User, msg.Prefix.Host, reason) + case "TOPIC": + var topic string + if len(msg.Params) > 1 { + topic = msg.Params[1] + } + return fmt.Sprintf("*** %s changes topic to '%s'", msg.Prefix.Name, topic) case "MODE": return fmt.Sprintf("*** %s sets mode: %s", msg.Prefix.Name, strings.Join(msg.Params[1:], " ")) case "NOTICE": diff --git a/upstream.go b/upstream.go index 83add5a..46f2183 100644 --- a/upstream.go +++ b/upstream.go @@ -745,6 +745,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error { } else { ch.Topic = "" } + uc.appendLog(ch.Name, msg) uc.forEachDownstream(func(dc *downstreamConn) { params := []string{dc.marshalChannel(uc, name)} if ch.Topic != "" {