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,15 +121,13 @@ 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 == "" {
if sd.quitMessage == "" { message = "Connection closed"
sd.quitMessage = "Connection closed" }
return true if sd.quitMessage == "" {
} else {
return false
}
} else {
sd.quitMessage = message sd.quitMessage = message
return true return true
} else {
return false
} }
} }