// XEP-0077 func (d *dialer) negotiateInBandRegistration(c interfaces.Conn) (bool, error) { if c.Features().InBandRegistration == nil { return false, nil } user := d.getJIDLocalpart() return c.RegisterAccount(user, d.password) }
// RFC 6120, section 5.4 func (d *dialer) negotiateSTARTTLS(c interfaces.Conn, conn net.Conn) error { // RFC 6120, section 5.3 mandatoryToNegotiate := c.Features().StartTLS.Required.Local == "required" if c.Config().SkipTLS && !mandatoryToNegotiate { return nil } // Section 5.2 states: // "Support for STARTTLS is REQUIRED in XMPP client and server implementations" if c.Features().StartTLS.XMLName.Local == "" { return errors.New("xmpp: server doesn't support TLS") } if err := d.startTLS(c, conn); err != nil { return err } return c.SendInitialStreamHeader() }