Add support for downstream LIST to a single upstream
Sometimes, doing a LIST on a single upstream can be useful: if a user is already connected to Rizon and freenode, sending a LIST will contain tens of thousands of LIST replies that may not be useful if the user is interested in another upstream. This adds support for sending `LIST */network`, which follows the ELIST M mask extension, that will only send LIST to that specific network. No other masks are supported by this commit.
This commit is contained in:
parent
2d47d7067f
commit
a64e1d6761
@ -1220,8 +1220,13 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
|
||||
downstreamID: dc.id,
|
||||
pendingCommands: make(map[int64]*irc.Message),
|
||||
}
|
||||
var upstream *upstreamConn
|
||||
var upstreamChannels map[int64][]string
|
||||
if len(msg.Params) > 0 {
|
||||
uc, upstreamMask, err := dc.unmarshalEntity(msg.Params[0])
|
||||
if err == nil && upstreamMask == "*" { // LIST */network: send LIST only to one network
|
||||
upstream = uc
|
||||
} else {
|
||||
upstreamChannels = make(map[int64][]string)
|
||||
channels := strings.Split(msg.Params[0], ",")
|
||||
for _, channel := range channels {
|
||||
@ -1232,9 +1237,13 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
|
||||
upstreamChannels[uc.network.ID] = append(upstreamChannels[uc.network.ID], upstreamChannel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dc.user.pendingLISTs = append(dc.user.pendingLISTs, pl)
|
||||
dc.forEachUpstream(func(uc *upstreamConn) {
|
||||
if upstream != nil && upstream != uc {
|
||||
return
|
||||
}
|
||||
var params []string
|
||||
if upstreamChannels != nil {
|
||||
if channels, ok := upstreamChannels[uc.network.ID]; ok {
|
||||
|
Loading…
Reference in New Issue
Block a user