From 09a793ff9cf2eaa9aecb6ba7c6f801f5bc0d426c Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 7 Feb 2020 13:31:09 +0100 Subject: [PATCH] Handle downstream JOIN messages --- downstream.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/downstream.go b/downstream.go index ebb15d3..0283358 100644 --- a/downstream.go +++ b/downstream.go @@ -246,6 +246,21 @@ func (c *downstreamConn) handleMessageRegistered(msg *irc.Message) error { c.user.forEachUpstream(func(uc *upstreamConn) { uc.messages <- msg }) + case "JOIN": + var name string + if err := parseMessageParams(msg, &name); err != nil { + return err + } + + if ch, _ := c.user.getChannel(name); ch != nil { + break // already joined + } + + // TODO: extract network name from channel name + return ircError{&irc.Message{ + Command: irc.ERR_NOSUCHCHANNEL, + Params: []string{name, "Channel name ambiguous"}, + }} case "MODE": var name string if err := parseMessageParams(msg, &name); err != nil {