WEBIRC: Export fields so the config loads properly

This commit is contained in:
Daniel Oaks 2017-10-15 18:15:18 +10:00
parent 34987ba53a
commit e1868f8a47
2 changed files with 8 additions and 8 deletions

@ -398,7 +398,7 @@ func LoadConfig(filename string) (config *Config, err error) {
var newWebIRC []webircConfig
for _, webirc := range config.Server.WebIRC {
// skip webirc blocks with no hosts (such as the example one)
if len(webirc.hosts) == 0 {
if len(webirc.Hosts) == 0 {
continue
}

@ -16,15 +16,15 @@ import (
)
type webircConfig struct {
passwordString string `yaml:"password"`
password []byte `yaml:"password-bytes"`
hosts []string
PasswordString string `yaml:"password"`
Password []byte `yaml:"password-bytes"`
Hosts []string
}
// ProcessPassword populates our password.
func (wc *webircConfig) ProcessPassword() error {
password, error := passwd.DecodePasswordHash(wc.passwordString)
wc.password = password
password, error := passwd.DecodePasswordHash(wc.PasswordString)
wc.Password = password
return error
}
@ -40,11 +40,11 @@ func webircHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
server.configurableStateMutex.RLock()
defer server.configurableStateMutex.RUnlock()
for _, info := range server.webirc {
for _, address := range info.hosts {
for _, address := range info.Hosts {
if clientHostname == address || clientAddress == address {
// confirm password
givenPassword := msg.Params[0]
if passwd.ComparePasswordString(info.password, givenPassword) == nil {
if passwd.ComparePasswordString(info.Password, givenPassword) == nil {
proxiedIP := msg.Params[3]
return client.ApplyProxiedIP(proxiedIP)