Changeset 729 in code for trunk/upstream.go
- Timestamp:
- Nov 30, 2021, 11:02:54 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/upstream.go
r725 r729 36 36 "setname": true, 37 37 38 "draft/extended-monitor": true, 38 "draft/account-registration": true, 39 "draft/extended-monitor": true, 39 40 } 40 41 … … 301 302 Params: []string{dc.nick, "SASL authentication aborted"}, 302 303 }) 304 case "REGISTER", "VERIFY": 305 dc.SendMessage(&irc.Message{ 306 Prefix: dc.srv.prefix(), 307 Command: "FAIL", 308 Params: []string{pendingCmd.msg.Command, "TEMPORARILY_UNAVAILABLE", pendingCmd.msg.Params[0], "Command aborted"}, 309 }) 303 310 default: 304 311 panic(fmt.Errorf("Unsupported pending command %q", pendingCmd.msg.Command)) … … 319 326 func (uc *upstreamConn) enqueueCommand(dc *downstreamConn, msg *irc.Message) { 320 327 switch msg.Command { 321 case "LIST", "WHO", "AUTHENTICATE" :328 case "LIST", "WHO", "AUTHENTICATE", "REGISTER", "VERIFY": 322 329 // Supported 323 330 default: … … 633 640 Params: []string{"END"}, 634 641 }) 642 } 643 case "REGISTER", "VERIFY": 644 if dc, cmd := uc.dequeueCommand(msg.Command); dc != nil { 645 if msg.Command == "REGISTER" { 646 var account, password string 647 if err := parseMessageParams(msg, nil, &account); err != nil { 648 return err 649 } 650 if err := parseMessageParams(cmd, nil, nil, &password); err != nil { 651 return err 652 } 653 uc.network.autoSaveSASLPlain(context.TODO(), account, password) 654 } 655 656 dc.SendMessage(msg) 635 657 } 636 658 case irc.RPL_WELCOME: … … 1570 1592 } 1571 1593 1572 if command == "LIST" || command == "WHO" { 1573 dc, _ := uc.dequeueCommand(command) 1574 if dc != nil && downstreamID == 0 { 1575 downstreamID = dc.id 1576 } 1594 if dc, _ := uc.dequeueCommand(command); dc != nil && downstreamID == 0 { 1595 downstreamID = dc.id 1577 1596 } 1578 1597 … … 1583 1602 Params: []string{dc.nick, command, reason}, 1584 1603 }) 1604 }) 1605 case "FAIL": 1606 var command string 1607 if err := parseMessageParams(msg, &command); err != nil { 1608 return err 1609 } 1610 1611 if dc, _ := uc.dequeueCommand(command); dc != nil && downstreamID == 0 { 1612 downstreamID = dc.id 1613 } 1614 1615 uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) { 1616 dc.SendMessage(msg) 1585 1617 }) 1586 1618 case "ACK":
Note:
See TracChangeset
for help on using the changeset viewer.