Allow CAP negotiation to happen with CAP REQ
See https://ircv3.net/specs/extensions/capability-negotiation > Upon receiving either a CAP LS or CAP REQ command during connection > registration, the server MUST not complete registration until the > client sends a CAP END command to indicate that capability negotiation > has ended. This commit should prevent soju from trying to authenticate the user prior to having received AUTHENTICATE messages, when the client eagerly requests capabilities with CAP REQ seeing available capabilities beforehand with CAP LS. git-svn-id: file:///srv/svn/repo/suika/trunk@590 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
parent
b19b03fa6d
commit
d061961130
@ -185,7 +185,7 @@ type downstreamConn struct {
|
||||
password string // empty after authentication
|
||||
network *network // can be nil
|
||||
|
||||
negociatingCaps bool
|
||||
negotiatingCaps bool
|
||||
capVersion int
|
||||
supportedCaps map[string]string
|
||||
caps map[string]bool
|
||||
@ -717,7 +717,7 @@ func (dc *downstreamConn) handleMessageUnregistered(msg *irc.Message) error {
|
||||
dc.logger.Printf("unhandled message: %v", msg)
|
||||
return newUnknownCommandError(msg.Command)
|
||||
}
|
||||
if dc.rawUsername != "" && dc.nick != "" && !dc.negociatingCaps {
|
||||
if dc.rawUsername != "" && dc.nick != "" && !dc.negotiatingCaps {
|
||||
return dc.register()
|
||||
}
|
||||
return nil
|
||||
@ -770,7 +770,7 @@ func (dc *downstreamConn) handleCapCommand(cmd string, args []string) error {
|
||||
}
|
||||
|
||||
if !dc.registered {
|
||||
dc.negociatingCaps = true
|
||||
dc.negotiatingCaps = true
|
||||
}
|
||||
case "LIST":
|
||||
var caps []string
|
||||
@ -832,8 +832,12 @@ func (dc *downstreamConn) handleCapCommand(cmd string, args []string) error {
|
||||
Command: "CAP",
|
||||
Params: []string{replyTo, reply, args[0]},
|
||||
})
|
||||
|
||||
if !dc.registered {
|
||||
dc.negotiatingCaps = true
|
||||
}
|
||||
case "END":
|
||||
dc.negociatingCaps = false
|
||||
dc.negotiatingCaps = false
|
||||
default:
|
||||
return ircError{&irc.Message{
|
||||
Command: err_invalidcapcmd,
|
||||
|
Loading…
x
Reference in New Issue
Block a user