3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 10:42:52 +01:00

handle kiwi's BEFORE *

This commit is contained in:
Shivaram Lingamneni 2020-02-24 21:45:21 -05:00
parent b45f8436a4
commit 3e787de994

View File

@ -551,8 +551,15 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.IrcMessage, r
if maxChathistoryLimit == 0 { if maxChathistoryLimit == 0 {
return return
} }
preposition := strings.ToLower(msg.Params[0])
target = msg.Params[1]
parseQueryParam := func(param string) (msgid string, timestamp time.Time, err error) { parseQueryParam := func(param string) (msgid string, timestamp time.Time, err error) {
if param == "*" && (preposition == "before" || preposition == "between") {
// XXX compatibility with kiwi, which as of February 2020 is
// using BEFORE * as a synonym for LATEST *
return
}
err = utils.ErrInvalidParams err = utils.ErrInvalidParams
pieces := strings.SplitN(param, "=", 2) pieces := strings.SplitN(param, "=", 2)
if len(pieces) < 2 { if len(pieces) < 2 {
@ -580,8 +587,6 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.IrcMessage, r
return return
} }
preposition := strings.ToLower(msg.Params[0])
target = msg.Params[1]
channel, sequence, err = server.GetHistorySequence(nil, client, target) channel, sequence, err = server.GetHistorySequence(nil, client, target)
if err != nil || sequence == nil { if err != nil || sequence == nil {
return return