Handle downstream PART messages

This commit is contained in:
Simon Ser 2020-02-07 13:36:32 +01:00
parent 09a793ff9c
commit 69a35069ef
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
2 changed files with 17 additions and 1 deletions

View File

@ -261,6 +261,19 @@ func (c *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
Command: irc.ERR_NOSUCHCHANNEL,
Params: []string{name, "Channel name ambiguous"},
}}
case "PART":
var name string
if err := parseMessageParams(msg, &name); err != nil {
return err
}
ch, err := c.user.getChannel(name)
if err != nil {
return err
}
ch.conn.messages <- msg
// TODO: remove channel from upstream config
case "MODE":
var name string
if err := parseMessageParams(msg, &name); err != nil {

View File

@ -75,7 +75,10 @@ func (u *user) getChannel(name string) (*upstreamChannel, error) {
}
})
if channel == nil {
return nil, fmt.Errorf("unknown channel %q", name)
return nil, ircError{&irc.Message{
Command: irc.ERR_NOSUCHCHANNEL,
Params: []string{name, "No such channel"},
}}
}
return channel, nil
}