mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
explicit error message when feature is disabled
This commit is contained in:
parent
911eacdcbe
commit
79f6fb0fc3
1 changed files with 6 additions and 3 deletions
|
|
@ -700,11 +700,13 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.Message, rb *
|
||||||
var channel *Channel
|
var channel *Channel
|
||||||
var sequence history.Sequence
|
var sequence history.Sequence
|
||||||
var err error
|
var err error
|
||||||
var listTargets bool
|
var disabled, listTargets bool
|
||||||
var targets []history.TargetListing
|
var targets []history.TargetListing
|
||||||
defer func() {
|
defer func() {
|
||||||
// errors are sent either without a batch, or in a draft/labeled-response batch as usual
|
// errors are sent either without a batch, or in a draft/labeled-response batch as usual
|
||||||
if err == utils.ErrInvalidParams {
|
if disabled {
|
||||||
|
rb.Add(nil, server.name, "FAIL", "CHATHISTORY", "MESSAGE_ERROR", msg.Params[0], client.t("That feature is disabled"))
|
||||||
|
} else if err == utils.ErrInvalidParams {
|
||||||
rb.Add(nil, server.name, "FAIL", "CHATHISTORY", "INVALID_PARAMS", msg.Params[0], client.t("Invalid parameters"))
|
rb.Add(nil, server.name, "FAIL", "CHATHISTORY", "INVALID_PARAMS", msg.Params[0], client.t("Invalid parameters"))
|
||||||
} else if !listTargets && sequence == nil {
|
} else if !listTargets && sequence == nil {
|
||||||
rb.Add(nil, server.name, "FAIL", "CHATHISTORY", "INVALID_TARGET", msg.Params[0], utils.SafeErrorParam(target), client.t("Messages could not be retrieved"))
|
rb.Add(nil, server.name, "FAIL", "CHATHISTORY", "INVALID_TARGET", msg.Params[0], utils.SafeErrorParam(target), client.t("Messages could not be retrieved"))
|
||||||
|
|
@ -730,7 +732,8 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.Message, rb *
|
||||||
|
|
||||||
config := server.Config()
|
config := server.Config()
|
||||||
maxChathistoryLimit := config.History.ChathistoryMax
|
maxChathistoryLimit := config.History.ChathistoryMax
|
||||||
if maxChathistoryLimit == 0 {
|
if !config.History.Enabled || maxChathistoryLimit == 0 {
|
||||||
|
disabled = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
preposition := strings.ToLower(msg.Params[0])
|
preposition := strings.ToLower(msg.Params[0])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue