mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-23 11:12:44 +01:00
commit
93c17e6b98
@ -824,7 +824,9 @@ func (client *Client) RplISupport(rb *ResponseBuffer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit sets the given quit message for the client and tells the client to quit out.
|
// Quit sets the given quit message for the client.
|
||||||
|
// (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) {
|
func (client *Client) Quit(message string) {
|
||||||
client.stateMutex.Lock()
|
client.stateMutex.Lock()
|
||||||
alreadyQuit := client.isQuitting
|
alreadyQuit := client.isQuitting
|
||||||
@ -832,14 +834,20 @@ func (client *Client) Quit(message string) {
|
|||||||
client.isQuitting = true
|
client.isQuitting = true
|
||||||
client.quitMessage = message
|
client.quitMessage = message
|
||||||
}
|
}
|
||||||
|
registered := client.registered
|
||||||
|
prefix := client.nickMaskString
|
||||||
client.stateMutex.Unlock()
|
client.stateMutex.Unlock()
|
||||||
|
|
||||||
if alreadyQuit {
|
if alreadyQuit {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
quitMsg := ircmsg.MakeMessage(nil, client.nickMaskString, "QUIT", message)
|
var quitLine string
|
||||||
quitLine, _ := quitMsg.Line()
|
// #364: don't send QUIT lines to unregistered clients
|
||||||
|
if registered {
|
||||||
|
quitMsg := ircmsg.MakeMessage(nil, prefix, "QUIT", message)
|
||||||
|
quitLine, _ = quitMsg.Line()
|
||||||
|
}
|
||||||
|
|
||||||
errorMsg := ircmsg.MakeMessage(nil, "", "ERROR", message)
|
errorMsg := ircmsg.MakeMessage(nil, "", "ERROR", message)
|
||||||
errorLine, _ := errorMsg.Line()
|
errorLine, _ := errorMsg.Line()
|
||||||
|
@ -1996,6 +1996,7 @@ func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
|||||||
}
|
}
|
||||||
if !authorized {
|
if !authorized {
|
||||||
rb.Add(nil, server.name, ERR_PASSWDMISMATCH, client.nick, client.t("Password incorrect"))
|
rb.Add(nil, server.name, ERR_PASSWDMISMATCH, client.nick, client.t("Password incorrect"))
|
||||||
|
client.Quit(client.t("Password incorrect"))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2059,7 +2060,7 @@ func passHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
|||||||
password := []byte(msg.Params[0])
|
password := []byte(msg.Params[0])
|
||||||
if bcrypt.CompareHashAndPassword(serverPassword, password) != nil {
|
if bcrypt.CompareHashAndPassword(serverPassword, password) != nil {
|
||||||
rb.Add(nil, server.name, ERR_PASSWDMISMATCH, client.nick, client.t("Password incorrect"))
|
rb.Add(nil, server.name, ERR_PASSWDMISMATCH, client.nick, client.t("Password incorrect"))
|
||||||
rb.Add(nil, server.name, "ERROR", client.t("Password incorrect"))
|
client.Quit(client.t("Password incorrect"))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user