3
0
mirror of https://github.com/ergochat/ergo.git synced 2025-02-22 16:40:41 +01:00

Merge pull request #2219 from slingamn/quit_tags

fix #2218
This commit is contained in:
Shivaram Lingamneni 2025-02-16 02:20:13 -05:00 committed by GitHub
commit 4ced4ef328
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1187,12 +1187,18 @@ func (client *Client) LoggedIntoAccount() bool {
// (You must ensure separately that destroy() is called, e.g., by returning `true` from // (You must ensure separately that destroy() is called, e.g., by returning `true` from
// the command handler or calling it yourself.) // the command handler or calling it yourself.)
func (client *Client) Quit(message string, session *Session) { func (client *Client) Quit(message string, session *Session) {
nuh := client.NickMaskString()
now := time.Now().UTC()
setFinalData := func(sess *Session) { setFinalData := func(sess *Session) {
message := sess.quitMessage message := sess.quitMessage
var finalData []byte var finalData []byte
// #364: don't send QUIT lines to unregistered clients // #364: don't send QUIT lines to unregistered clients
if client.registered { 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) finalData, _ = quitMsg.LineBytesStrict(false, MaxLineLen)
} }