Changeset 768 in code
- Timestamp:
- Feb 4, 2022, 1:01:27 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/downstream.go
r761 r768 352 352 f(dc.network) 353 353 } else if dc.isMultiUpstream { 354 dc.user.forEachNetwork(f) 354 for _, network := range dc.user.networks { 355 f(network) 356 } 355 357 } 356 358 } … … 776 778 777 779 var match *network 778 dc.user.forEachNetwork(func(net *network){780 for _, net := range dc.user.networks { 779 781 if net.ID == id { 780 782 match = net 783 break 781 784 } 782 } )785 } 783 786 if match == nil { 784 787 return ircError{&irc.Message{ … … 1437 1440 if dc.caps["soju.im/bouncer-networks-notify"] { 1438 1441 dc.SendBatch("soju.im/bouncer-networks", nil, nil, func(batchRef irc.TagValue) { 1439 dc.user.forEachNetwork(func(network *network){1442 for _, network := range dc.user.networks { 1440 1443 idStr := fmt.Sprintf("%v", network.ID) 1441 1444 attrs := getNetworkAttrs(network) … … 1446 1449 Params: []string{"NETWORK", idStr, attrs.String()}, 1447 1450 }) 1448 } )1451 } 1449 1452 }) 1450 1453 } … … 2749 2752 case "LISTNETWORKS": 2750 2753 dc.SendBatch("soju.im/bouncer-networks", nil, nil, func(batchRef irc.TagValue) { 2751 dc.user.forEachNetwork(func(network *network){2754 for _, network := range dc.user.networks { 2752 2755 idStr := fmt.Sprintf("%v", network.ID) 2753 2756 attrs := getNetworkAttrs(network) … … 2758 2761 Params: []string{"NETWORK", idStr, attrs.String()}, 2759 2762 }) 2760 } )2763 } 2761 2764 }) 2762 2765 case "ADDNETWORK": -
trunk/service.go
r757 r768 507 507 func handleServiceNetworkStatus(ctx context.Context, dc *downstreamConn, params []string) error { 508 508 n := 0 509 dc.user.forEachNetwork(func(net *network){509 for _, net := range dc.user.networks { 510 510 var statuses []string 511 511 var details string … … 542 542 543 543 n++ 544 } )544 } 545 545 546 546 if n == 0 { … … 970 970 971 971 if *networkName == "" { 972 dc.user.forEachNetwork(sendNetwork) 972 for _, net := range dc.user.networks { 973 sendNetwork(net) 974 } 973 975 } else { 974 976 net := dc.user.getNetwork(*networkName) -
trunk/user.go
r752 r768 465 465 } 466 466 467 func (u *user) forEachNetwork(f func(*network)) {468 for _, network := range u.networks {469 f(network)470 }471 }472 473 467 func (u *user) forEachUpstream(f func(uc *upstreamConn)) { 474 468 for _, network := range u.networks { … … 993 987 // Re-connect to networks which use the default realname 994 988 var needUpdate []Network 995 u.forEachNetwork(func(net *network){989 for _, net := range u.networks { 996 990 if net.Realname == "" { 997 991 needUpdate = append(needUpdate, net.Network) 998 992 } 999 } )993 } 1000 994 1001 995 var netErr error
Note:
See TracChangeset
for help on using the changeset viewer.