Allow CAP command when registered

This commit is contained in:
Simon Ser 2020-03-16 15:11:08 +01:00
parent bdfb8634e9
commit 9b777922ae
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -339,7 +339,6 @@ func (dc *downstreamConn) handleMessageUnregistered(msg *irc.Message) error {
if err := parseMessageParams(msg, &subCmd); err != nil {
return err
}
subCmd = strings.ToUpper(subCmd)
if err := dc.handleCapCommand(subCmd, msg.Params[1:]); err != nil {
return err
}
@ -354,6 +353,8 @@ func (dc *downstreamConn) handleMessageUnregistered(msg *irc.Message) error {
}
func (dc *downstreamConn) handleCapCommand(cmd string, args []string) error {
cmd = strings.ToUpper(cmd)
replyTo := dc.nick
if !dc.registered {
replyTo = "*"
@ -620,6 +621,14 @@ func (dc *downstreamConn) runUntilRegistered() error {
func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
switch msg.Command {
case "CAP":
var subCmd string
if err := parseMessageParams(msg, &subCmd); err != nil {
return err
}
if err := dc.handleCapCommand(subCmd, msg.Params[1:]); err != nil {
return err
}
case "PING":
dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(),