Changeset 463 in code for trunk/downstream.go


Ignore:
Timestamp:
Mar 15, 2021, 10:41:37 PM (4 years ago)
Author:
contact
Message:

Passthrough some ISUPPORT tokens

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r461 r463  
    8080        "extended-join": "",
    8181        "multi-prefix":  "",
     82}
     83
     84// passthroughIsupport is the set of ISUPPORT tokens that are directly passed
     85// through from the upstream server to downstream clients.
     86//
     87// This is only effective in single-upstream mode.
     88var passthroughIsupport = map[string]bool{
     89        "AWAYLEN":    true,
     90        "CHANLIMIT":  true,
     91        "CHANMODES":  true,
     92        "CHANNELLEN": true,
     93        "CHANTYPES":  true,
     94        "EXCEPTS":    true,
     95        "EXTBAN":     true,
     96        "HOSTLEN":    true,
     97        "INVEX":      true,
     98        "KICKLEN":    true,
     99        "MAXLIST":    true,
     100        "MAXTARGETS": true,
     101        "MODES":      true,
     102        "NETWORK":    true,
     103        "NICKLEN":    true,
     104        "PREFIX":     true,
     105        "SAFELIST":   true,
     106        "TARGMAX":    true,
     107        "TOPICLEN":   true,
     108        "USERLEN":    true,
    82109}
    83110
     
    881908        }
    882909
    883         if uc := dc.upstream(); uc != nil && uc.isupport["NETWORK"] != nil {
    884                 isupport = append(isupport, fmt.Sprintf("NETWORK=%v", *uc.isupport["NETWORK"]))
     910        if uc := dc.upstream(); uc != nil {
     911                for k := range passthroughIsupport {
     912                        v, ok := uc.isupport[k]
     913                        if !ok {
     914                                continue
     915                        }
     916                        if v != nil {
     917                                isupport = append(isupport, fmt.Sprintf("%v=%v", k, *v))
     918                        } else {
     919                                isupport = append(isupport, k)
     920                        }
     921                }
    885922        }
    886923
     
    905942                Params:  []string{dc.nick, dc.srv.Hostname, "soju", "aiwroO", "OovaimnqpsrtklbeI"},
    906943        })
    907         // TODO: other RPL_ISUPPORT tokens
    908         dc.SendMessage(&irc.Message{
    909                 Prefix:  dc.srv.prefix(),
    910                 Command: irc.RPL_ISUPPORT,
    911                 Params:  append(append([]string{dc.nick}, isupport...), "are supported"),
    912         })
     944        for _, msg := range generateIsupport(dc.srv.prefix(), dc.nick, isupport) {
     945                dc.SendMessage(msg)
     946        }
    913947        dc.SendMessage(&irc.Message{
    914948                Prefix:  dc.srv.prefix(),
Note: See TracChangeset for help on using the changeset viewer.