~emersion/soju-dev

Send correct CHATHISTORY error messages v1 APPLIED

Hubert Hirtz: 1
 Send correct CHATHISTORY error messages

 1 files changed, 4 insertions(+), 4 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/soju-dev/patches/20765/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] Send correct CHATHISTORY error messages Export this patch

---

This fixes a long-standing bug which was introduced
by delthas <delthas@dille.cc>, who wanted these error
codes to be in the spec (see thumbs up [0]).

[0] https://github.com/ircv3/ircv3-specifications/pull/393#discussion_r350210018

 downstream.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/downstream.go b/downstream.go
index 952686b..93643a8 100644
--- a/downstream.go
+++ b/downstream.go
@@ -1822,7 +1822,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
		if !ok {
			return ircError{&irc.Message{
				Command: irc.ERR_UNKNOWNCOMMAND,
				Params:  []string{dc.nick, subcommand, "Unknown command"},
				Params:  []string{dc.nick, "CHATHISTORY", "Unknown command"},
			}}
		}

@@ -1836,7 +1836,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
		if len(criteriaParts) != 2 || criteriaParts[0] != "timestamp" {
			return ircError{&irc.Message{
				Command: "FAIL",
				Params:  []string{"CHATHISTORY", "UNKNOWN_CRITERIA", criteria, "Unknown criteria"},
				Params:  []string{"CHATHISTORY", "INVALID_PARAMS", subcommand, criteria, "Unknown criteria"},
			}}
		}

@@ -1844,7 +1844,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
		if err != nil {
			return ircError{&irc.Message{
				Command: "FAIL",
				Params:  []string{"CHATHISTORY", "INVALID_CRITERIA", criteria, "Invalid criteria"},
				Params:  []string{"CHATHISTORY", "INVALID_PARAMS", subcommand, criteria, "Invalid criteria"},
			}}
		}

@@ -1852,7 +1852,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
		if err != nil || limit < 0 || limit > dc.srv.HistoryLimit {
			return ircError{&irc.Message{
				Command: "FAIL",
				Params:  []string{"CHATHISTORY", "INVALID_LIMIT", limitStr, "Invalid limit"},
				Params:  []string{"CHATHISTORY", "INVALID_PARAMS", subcommand, limitStr, "Invalid limit"},
			}}
		}

-- 
2.30.1
Pushed, thanks!