Changeset 743 in code
- Timestamp:
- Dec 4, 2021, 7:07:23 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/upstream.go
r742 r743 775 775 } 776 776 777 uc.updateMonitor() 778 777 779 uc.forEachDownstream(func(dc *downstreamConn) { 778 780 if dc.network == nil { … … 877 879 dc.updateNick() 878 880 }) 881 uc.updateMonitor() 879 882 } 880 883 case "SETNAME": … … 1521 1524 prefix := irc.ParsePrefix(target) 1522 1525 uc.monitored.SetValue(prefix.Name, online) 1526 } 1527 1528 // Check if the nick we want is now free 1529 wantNick := GetNick(&uc.user.User, &uc.network.Network) 1530 wantNickCM := uc.network.casemap(wantNick) 1531 if !online && uc.nickCM != wantNickCM { 1532 found := false 1533 for _, target := range targets { 1534 prefix := irc.ParsePrefix(target) 1535 if uc.network.casemap(prefix.Name) == wantNickCM { 1536 found = true 1537 break 1538 } 1539 } 1540 if found { 1541 uc.logger.Printf("desired nick %q is now available", wantNick) 1542 uc.SendMessage(&irc.Message{ 1543 Command: "NICK", 1544 Params: []string{wantNick}, 1545 }) 1546 } 1523 1547 } 1524 1548 … … 1688 1712 } 1689 1713 return fmt.Errorf("fatal server error: %v", text) 1690 case irc.ERR_PASSWDMISMATCH, irc.ERR_ERRONEUSNICKNAME, irc.ERR_NICKNAMEINUSE, irc.ERR_NICKCOLLISION, irc.ERR_UNAVAILRESOURCE, irc.ERR_NOPERMFORHOST, irc.ERR_YOUREBANNEDCREEP: 1714 case irc.ERR_NICKNAMEINUSE: 1715 // At this point, we haven't received ISUPPORT so we don't know the 1716 // maximum nickname length or whether the server supports MONITOR. Many 1717 // servers have NICKLEN=30 so let's just use that. 1718 if !uc.registered && len(uc.nick)+1 < 30 { 1719 uc.nick = uc.nick + "_" 1720 uc.nickCM = uc.network.casemap(uc.nick) 1721 uc.logger.Printf("desired nick is not available, falling back to %q", uc.nick) 1722 uc.SendMessage(&irc.Message{ 1723 Command: "NICK", 1724 Params: []string{uc.nick}, 1725 }) 1726 return nil 1727 } 1728 fallthrough 1729 case irc.ERR_PASSWDMISMATCH, irc.ERR_ERRONEUSNICKNAME, irc.ERR_NICKCOLLISION, irc.ERR_UNAVAILRESOURCE, irc.ERR_NOPERMFORHOST, irc.ERR_YOUREBANNEDCREEP: 1691 1730 if !uc.registered { 1692 1731 return registrationError{msg} … … 2088 2127 if _, ok := add[targetCM]; !ok { 2089 2128 addList = append(addList, targetCM) 2129 add[targetCM] = struct{}{} 2090 2130 } 2091 add[targetCM] = struct{}{}2092 2131 } else { 2093 2132 seen[targetCM] = struct{}{} … … 2095 2134 } 2096 2135 }) 2136 2137 wantNick := GetNick(&uc.user.User, &uc.network.Network) 2138 wantNickCM := uc.network.casemap(wantNick) 2139 if _, ok := add[wantNickCM]; !ok && !uc.monitored.Has(wantNick) && !uc.isOurNick(wantNick) { 2140 addList = append(addList, wantNickCM) 2141 add[wantNickCM] = struct{}{} 2142 } 2097 2143 2098 2144 removeAll := true
Note:
See TracChangeset
for help on using the changeset viewer.