func (b *Bot) Rehash() error {
	fname, _ := b.conf.StoreFile()
	conf := config.New().FromFile(fname)
	if !CheckConfig(conf) {
		return errInvalidConfig
	}
	b.conf.Replace(conf)
	return nil
}
Rehash loads the config from a file. It attempts to use the previously read
config file name if loaded from a file... If not it will use a default file
name. It then calls Bot.ReplaceConfig.
package bot
import (
	"fmt"
	"github.com/aarondl/ultimateq/config"
	"github.com/aarondl/ultimateq/irc"
)
const (
	errFmtNewServer = "bot: The new server (%v) could not be instantiated: %v"
)
type configCallback func(*config.Config)
func (b *Bot) ReadConfig(fn configCallback) {
	fn(b.conf)
}
func (b *Bot) WriteConfig(fn configCallback) {
	fn(b.conf)
}
func (b *Bot) ReplaceConfig(newConfig *config.Config) bool {
	if !newConfig.Validate() {
		return false
	}
	b.protectServers.Lock()
	defer b.protectServers.Unlock()  
	b.startNewServers(newConfig)
	for netID, s := range b.servers {
		if serverConf := newConfig.Network(netID); nil == serverConf {
			b.stopServer(s)
			delete(b.servers, netID)
			continue
		} else {
			s.rehashConfig(newConfig)
		}
	}
	b.conf.Replace(newConfig)
	return true
}
func (b *Bot) startNewServers(newConfig *config.Config) {
	for _, net := range newConfig.Networks() {
		if serverConf := b.conf.Network(net); nil == serverConf {
			server, err := b.createServer(net, newConfig)
			if err != nil {
				b.botEnd <- fmt.Errorf(errFmtNewServer, net, err)
				continue
			}
			b.servers[net] = server
			go b.startServer(server, true, true)
		}
	}
}
func (s *Server) rehashConfig(newConfig *config.Config) {
	oldNick, _ := s.conf.Network(s.networkID).Nick()
	newNick, _ := newConfig.Network(s.networkID).Nick()
	setNick := newNick != oldNick
	if setNick {
		s.Write([]byte(irc.NICK + " :" + newNick))
	}
}