Changeset 590 in code


Ignore:
Timestamp:
Sep 19, 2021, 2:50:47 PM (4 years ago)
Author:
hubert
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r586 r590  
    186186        network     *network // can be nil
    187187
    188         negociatingCaps bool
     188        negotiatingCaps bool
    189189        capVersion      int
    190190        supportedCaps   map[string]string
     
    718718                return newUnknownCommandError(msg.Command)
    719719        }
    720         if dc.rawUsername != "" && dc.nick != "" && !dc.negociatingCaps {
     720        if dc.rawUsername != "" && dc.nick != "" && !dc.negotiatingCaps {
    721721                return dc.register()
    722722        }
     
    771771
    772772                if !dc.registered {
    773                         dc.negociatingCaps = true
     773                        dc.negotiatingCaps = true
    774774                }
    775775        case "LIST":
     
    833833                        Params:  []string{replyTo, reply, args[0]},
    834834                })
     835
     836                if !dc.registered {
     837                        dc.negotiatingCaps = true
     838                }
    835839        case "END":
    836                 dc.negociatingCaps = false
     840                dc.negotiatingCaps = false
    837841        default:
    838842                return ircError{&irc.Message{
Note: See TracChangeset for help on using the changeset viewer.