mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 11:59:40 +01:00
fix #227
This commit is contained in:
parent
9fe50731a4
commit
363b120cc5
@ -193,12 +193,6 @@ func nsDropHandler(server *Server, client *Client, command, params string, rb *R
|
|||||||
func nsGhostHandler(server *Server, client *Client, command, params string, rb *ResponseBuffer) {
|
func nsGhostHandler(server *Server, client *Client, command, params string, rb *ResponseBuffer) {
|
||||||
nick, _ := utils.ExtractParam(params)
|
nick, _ := utils.ExtractParam(params)
|
||||||
|
|
||||||
account := client.Account()
|
|
||||||
if account == "" || server.accounts.NickToAccount(nick) != account {
|
|
||||||
nsNotice(rb, client.t("You don't own that nick"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ghost := server.clients.Get(nick)
|
ghost := server.clients.Get(nick)
|
||||||
if ghost == nil {
|
if ghost == nil {
|
||||||
nsNotice(rb, client.t("No such nick"))
|
nsNotice(rb, client.t("No such nick"))
|
||||||
@ -208,6 +202,17 @@ func nsGhostHandler(server *Server, client *Client, command, params string, rb *
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
authorized := false
|
||||||
|
account := client.Account()
|
||||||
|
if account != "" {
|
||||||
|
// the user must either own the nick, or the target client
|
||||||
|
authorized = (server.accounts.NickToAccount(nick) == account) || (ghost.Account() == account)
|
||||||
|
}
|
||||||
|
if !authorized {
|
||||||
|
nsNotice(rb, client.t("You don't own that nick"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ghost.Quit(fmt.Sprintf(ghost.t("GHOSTed by %s"), client.Nick()))
|
ghost.Quit(fmt.Sprintf(ghost.t("GHOSTed by %s"), client.Nick()))
|
||||||
ghost.destroy(false)
|
ghost.destroy(false)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user