parent
832d8b89a2
commit
07c962018d
@ -97,8 +97,8 @@ func main() {
|
||||
}
|
||||
|
||||
srv := soju.NewServer(db)
|
||||
// TODO: load from config/DB
|
||||
srv.Hostname = cfg.Hostname
|
||||
srv.Title = cfg.Title
|
||||
srv.LogPath = cfg.LogPath
|
||||
srv.HTTPOrigins = cfg.HTTPOrigins
|
||||
srv.AcceptProxyIPs = cfg.AcceptProxyIPs
|
||||
|
@ -38,8 +38,9 @@ type TLS struct {
|
||||
|
||||
type Server struct {
|
||||
Listen []string
|
||||
Hostname string
|
||||
TLS *TLS
|
||||
Hostname string
|
||||
Title string
|
||||
MOTDPath string
|
||||
|
||||
SQLDriver string
|
||||
@ -87,6 +88,14 @@ func parse(cfg scfg.Block) (*Server, error) {
|
||||
if err := d.ParseParams(&srv.Hostname); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "title":
|
||||
if err := d.ParseParams(&srv.Title); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "motd":
|
||||
if err := d.ParseParams(&srv.MOTDPath); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "tls":
|
||||
tls := &TLS{}
|
||||
if err := d.ParseParams(&tls.CertPath, &tls.KeyPath); err != nil {
|
||||
@ -129,10 +138,6 @@ func parse(cfg scfg.Block) (*Server, error) {
|
||||
if srv.MaxUserNetworks, err = strconv.Atoi(max); err != nil {
|
||||
return nil, fmt.Errorf("directive %q: %v", d.Name, err)
|
||||
}
|
||||
case "motd":
|
||||
if err := d.ParseParams(&srv.MOTDPath); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown directive %q", d.Name)
|
||||
}
|
||||
|
@ -104,6 +104,10 @@ The following directives are supported:
|
||||
*hostname* <name>
|
||||
Server hostname (default: system hostname).
|
||||
|
||||
*title* <title>
|
||||
Server title. This will be sent as the _ISUPPORT NETWORK_ value when clients
|
||||
don't select a specific network.
|
||||
|
||||
*tls* <cert> <key>
|
||||
Enable TLS support. The certificate and the key files must be PEM-encoded.
|
||||
|
||||
|
@ -1157,7 +1157,9 @@ func (dc *downstreamConn) welcome() error {
|
||||
if dc.network != nil {
|
||||
isupport = append(isupport, fmt.Sprintf("BOUNCER_NETID=%v", dc.network.ID))
|
||||
}
|
||||
|
||||
if dc.network == nil && dc.srv.Title != "" {
|
||||
isupport = append(isupport, "NETWORK="+encodeISUPPORT(dc.srv.Title))
|
||||
}
|
||||
if dc.network == nil && dc.caps["soju.im/bouncer-networks"] {
|
||||
isupport = append(isupport, "WHOX")
|
||||
}
|
||||
|
6
irc.go
6
irc.go
@ -761,3 +761,9 @@ func generateWHOXReply(prefix *irc.Prefix, nick, fields string, info *whoxInfo)
|
||||
Params: append([]string{nick}, params...),
|
||||
}
|
||||
}
|
||||
|
||||
var isupportEncoder = strings.NewReplacer(" ", "\\x20", "\\", "\\x5C")
|
||||
|
||||
func encodeISUPPORT(s string) string {
|
||||
return isupportEncoder.Replace(s)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user