Changeset 297 in code for trunk/downstream.go


Ignore:
Timestamp:
May 27, 2020, 9:43:04 PM (5 years ago)
Author:
delthas
Message:

Add support for downstream NICK to a single upstream

Users often have different nicks on different upstreams, and we should
support changing the user nick on a single upstream.

This adds support for a new trivial extension, NICK nick/network,
which will change the nick on the specified network, and do nothing for
the other networks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r296 r297  
    934934                }
    935935
     936                var upstream *upstreamConn
     937                if dc.upstream() == nil {
     938                        uc, unmarshaledNick, err := dc.unmarshalEntity(nick)
     939                        if err == nil { // NICK nick/network: NICK only on a specific upstream
     940                                upstream = uc
     941                                nick = unmarshaledNick
     942                        }
     943                }
     944
    936945                var err error
    937946                dc.forEachNetwork(func(n *network) {
    938                         if err != nil {
     947                        if err != nil || (upstream != nil && upstream.network != n) {
    939948                                return
    940949                        }
     
    947956
    948957                dc.forEachUpstream(func(uc *upstreamConn) {
    949                         uc.SendMessage(msg)
     958                        if upstream != nil && upstream != uc {
     959                                return
     960                        }
     961                        uc.SendMessage(&irc.Message{
     962                                Command: "NICK",
     963                                Params:  []string{nick},
     964                        })
    950965                })
    951966
Note: See TracChangeset for help on using the changeset viewer.