Changeset 73 in code for trunk/upstream.go


Ignore:
Timestamp:
Mar 4, 2020, 2:44:13 PM (5 years ago)
Author:
contact
Message:

Allow clients to specify an upstream name in their username

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/upstream.go

    r72 r73  
    101101}
    102102
     103func (uc *upstreamConn) forEachDownstream(f func(*downstreamConn)) {
     104        uc.user.forEachDownstream(func(dc *downstreamConn) {
     105                if dc.upstream != nil && dc.upstream != uc.upstream {
     106                        return
     107                }
     108                f(dc)
     109        })
     110}
     111
    103112func (uc *upstreamConn) getChannel(name string) (*upstreamChannel, error) {
    104113        ch, ok := uc.channels[name]
     
    141150                        }
    142151
    143                         uc.user.forEachDownstream(func(dc *downstreamConn) {
     152                        uc.forEachDownstream(func(dc *downstreamConn) {
    144153                                dc.SendMessage(&irc.Message{
    145154                                        Prefix:  dc.marshalUserPrefix(uc, msg.Prefix),
     
    211220                        }
    212221
    213                         uc.user.forEachDownstream(func(dc *downstreamConn) {
     222                        uc.forEachDownstream(func(dc *downstreamConn) {
    214223                                dc.SendMessage(&irc.Message{
    215224                                        Prefix:  dc.marshalUserPrefix(uc, msg.Prefix),
     
    241250                        }
    242251
    243                         uc.user.forEachDownstream(func(dc *downstreamConn) {
     252                        uc.forEachDownstream(func(dc *downstreamConn) {
    244253                                dc.SendMessage(&irc.Message{
    245254                                        Prefix:  dc.marshalUserPrefix(uc, msg.Prefix),
     
    327336                ch.complete = true
    328337
    329                 uc.user.forEachDownstream(func(dc *downstreamConn) {
     338                uc.forEachDownstream(func(dc *downstreamConn) {
    330339                        forwardChannel(dc, ch)
    331340                })
Note: See TracChangeset for help on using the changeset viewer.