3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

fix a bug in SetQuitMessage

Quit messages aren't supposed to clobber each other under any
circumstances, but actually only the default "Connection closed"
message was non-clobbering, all others would clobber.
This commit is contained in:
Shivaram Lingamneni 2019-05-22 20:29:19 -04:00
parent 174115deb6
commit 99de53264e

View File

@ -121,16 +121,14 @@ type Session struct {
// sets the session quit message, if there isn't one already // sets the session quit message, if there isn't one already
func (sd *Session) SetQuitMessage(message string) (set bool) { func (sd *Session) SetQuitMessage(message string) (set bool) {
if message == "" { if message == "" {
message = "Connection closed"
}
if sd.quitMessage == "" { if sd.quitMessage == "" {
sd.quitMessage = "Connection closed" sd.quitMessage = message
return true return true
} else { } else {
return false return false
} }
} else {
sd.quitMessage = message
return true
}
} }
// set the negotiated message length based on session capabilities // set the negotiated message length based on session capabilities