Handle downstream JOIN messages

This commit is contained in:
Simon Ser 2020-02-07 13:31:09 +01:00
parent 2e5395f20b
commit 09a793ff9c
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -246,6 +246,21 @@ func (c *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
c.user.forEachUpstream(func(uc *upstreamConn) { c.user.forEachUpstream(func(uc *upstreamConn) {
uc.messages <- msg 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": case "MODE":
var name string var name string
if err := parseMessageParams(msg, &name); err != nil { if err := parseMessageParams(msg, &name); err != nil {