From ec3417be79dde3eaf5d254cd6eedfd80ae27ed71 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Sun, 16 Feb 2025 01:32:29 -0500 Subject: [PATCH] fix #2218 The client's own QUIT line should respect server-time --- irc/client.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/irc/client.go b/irc/client.go index 85750519..821b0403 100644 --- a/irc/client.go +++ b/irc/client.go @@ -1187,12 +1187,18 @@ func (client *Client) LoggedIntoAccount() bool { // (You must ensure separately that destroy() is called, e.g., by returning `true` from // the command handler or calling it yourself.) func (client *Client) Quit(message string, session *Session) { + nuh := client.NickMaskString() + now := time.Now().UTC() + setFinalData := func(sess *Session) { message := sess.quitMessage var finalData []byte // #364: don't send QUIT lines to unregistered clients if client.registered { - quitMsg := ircmsg.MakeMessage(nil, client.nickMaskString, "QUIT", message) + quitMsg := ircmsg.MakeMessage(nil, nuh, "QUIT", message) + if session.capabilities.Has(caps.ServerTime) { + quitMsg.SetTag("time", now.Format(utils.IRCv3TimestampFormat)) + } finalData, _ = quitMsg.LineBytesStrict(false, MaxLineLen) }