mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
clean up originalTarget
This commit is contained in:
parent
caef3ed3a1
commit
96b9bca2d2
1 changed files with 4 additions and 5 deletions
|
|
@ -3102,22 +3102,21 @@ func markReadHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
|
||||||
|
|
||||||
// METADATA <target> <subcommand> [<and so on>...]
|
// METADATA <target> <subcommand> [<and so on>...]
|
||||||
func metadataHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) (exiting bool) {
|
func metadataHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) (exiting bool) {
|
||||||
originalTarget := msg.Params[0]
|
target := msg.Params[0]
|
||||||
target := originalTarget
|
|
||||||
|
|
||||||
config := server.Config()
|
config := server.Config()
|
||||||
if !config.Metadata.Enabled {
|
if !config.Metadata.Enabled {
|
||||||
rb.Add(nil, server.name, "FAIL", "METADATA", "FORBIDDEN", originalTarget, "Metadata is disabled on this server")
|
rb.Add(nil, server.name, "FAIL", "METADATA", "FORBIDDEN", target, "Metadata is disabled on this server")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
subcommand := strings.ToLower(msg.Params[1])
|
subcommand := strings.ToLower(msg.Params[1])
|
||||||
|
|
||||||
invalidTarget := func() {
|
invalidTarget := func() {
|
||||||
rb.Add(nil, server.name, "FAIL", "METADATA", "INVALID_TARGET", originalTarget, client.t("Invalid metadata target"))
|
rb.Add(nil, server.name, "FAIL", "METADATA", "INVALID_TARGET", target, client.t("Invalid metadata target"))
|
||||||
}
|
}
|
||||||
noKeyPerms := func(key string) {
|
noKeyPerms := func(key string) {
|
||||||
rb.Add(nil, server.name, "FAIL", "METADATA", "KEY_NO_PERMISSION", originalTarget, key, client.t("You do not have permission to perform this action"))
|
rb.Add(nil, server.name, "FAIL", "METADATA", "KEY_NO_PERMISSION", target, key, client.t("You do not have permission to perform this action"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if target == "*" {
|
if target == "*" {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue