3
0
mirror of https://github.com/ergochat/ergo.git synced 2025-02-18 06:30:39 +01:00

send the actual quit message to friends

This commit is contained in:
Shivaram Lingamneni 2017-09-25 22:47:03 -04:00
parent a78a8f1130
commit 1612c141d5

View File

@ -68,6 +68,7 @@ type Client struct {
nickMaskString string // cache for nickmask string since it's used with lots of replies nickMaskString string // cache for nickmask string since it's used with lots of replies
operName string operName string
proxiedIP string // actual remote IP if using the PROXY protocol proxiedIP string // actual remote IP if using the PROXY protocol
quitMessage string
quitMessageSent bool quitMessageSent bool
quitMutex sync.Mutex quitMutex sync.Mutex
quitTimer *time.Timer quitTimer *time.Timer
@ -491,6 +492,7 @@ func (client *Client) Quit(message string) {
client.socket.SetFinalData(quitLine + errorLine) client.socket.SetFinalData(quitLine + errorLine)
client.quitMessageSent = true client.quitMessageSent = true
client.quitMessage = message
} }
} }
@ -559,8 +561,10 @@ func (client *Client) destroy() {
// send quit messages to friends // send quit messages to friends
for friend := range friends { for friend := range friends {
//TODO(dan): store quit message in user, if exists use that instead here if client.quitMessage == "" {
friend.Send(nil, client.nickMaskString, "QUIT", "Exited") client.quitMessage = "Exited"
}
friend.Send(nil, client.nickMaskString, "QUIT", client.quitMessage)
} }
if !client.exitedSnomaskSent { if !client.exitedSnomaskSent {
client.server.snomasks.Send(sno.LocalQuits, fmt.Sprintf(ircfmt.Unescape("%s$r exited the network"), client.nick)) client.server.snomasks.Send(sno.LocalQuits, fmt.Sprintf(ircfmt.Unescape("%s$r exited the network"), client.nick))