From 3e787de994b0eafc20dce071194d1245a81bb68d Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Mon, 24 Feb 2020 21:45:21 -0500 Subject: [PATCH] handle kiwi's BEFORE * --- irc/handlers.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/irc/handlers.go b/irc/handlers.go index 350c0c5e..4e898e11 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -551,8 +551,15 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.IrcMessage, r if maxChathistoryLimit == 0 { return } + preposition := strings.ToLower(msg.Params[0]) + target = msg.Params[1] 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 pieces := strings.SplitN(param, "=", 2) if len(pieces) < 2 { @@ -580,8 +587,6 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.IrcMessage, r return } - preposition := strings.ToLower(msg.Params[0]) - target = msg.Params[1] channel, sequence, err = server.GetHistorySequence(nil, client, target) if err != nil || sequence == nil { return