func (nm *NickMode) Equals(other *NickMode) bool {
	return reflect.DeepEqual(nm, other)
}
Tests NickMode equality.
package state
import (
	"github.com/fluffle/goirc/logging"
	"reflect"
)
type Nick struct {
	Nick, Ident, Host, Name string
	Modes                   *NickMode
	Channels                map[string]*ChanPrivs
}
type nick struct {
	nick, ident, host, name string
	modes                   *NickMode
	lookup                  map[string]*channel
	chans                   map[*channel]*ChanPrivs
}
type NickMode struct {
	Bot, Invisible, Oper, WallOps, HiddenHost, SSL bool
}
var StringToNickMode = map[string]string{}
var NickModeToString = map[string]string{
	"Bot":        "B",
	"Invisible":  "i",
	"Oper":       "o",
	"WallOps":    "w",
	"HiddenHost": "x",
	"SSL":        "z",
}
func init() {
	for k, v := range NickModeToString {
		StringToNickMode[v] = k
	}
}
func newNick(n string) *nick {
	return &nick{
		nick:   n,
		modes:  new(NickMode),
		chans:  make(map[*channel]*ChanPrivs),
		lookup: make(map[string]*channel),
	}
}
func (nk *nick) Nick() *Nick {
	n := &Nick{
		Nick:     nk.nick,
		Ident:    nk.ident,
		Host:     nk.host,
		Name:     nk.name,
		Modes:    nk.modes.Copy(),
		Channels: make(map[string]*ChanPrivs),
	}
	for c, cp := range nk.chans {
		n.Channels[c.name] = cp.Copy()
	}
	return n
}
func (nk *nick) isOn(ch *channel) (*ChanPrivs, bool) {
	cp, ok := nk.chans[ch]
	return cp.Copy(), ok
}
func (nk *nick) addChannel(ch *channel, cp *ChanPrivs) {
	if _, ok := nk.chans[ch]; !ok {
		nk.chans[ch] = cp
		nk.lookup[ch.name] = ch
	} else {
		logging.Warn("Nick.addChannel(): %s already on %s.", nk.nick, ch.name)
	}
}
func (nk *nick) delChannel(ch *channel) {
	if _, ok := nk.chans[ch]; ok {
		delete(nk.chans, ch)
		delete(nk.lookup, ch.name)
	} else {
		logging.Warn("Nick.delChannel(): %s not on %s.", nk.nick, ch.name)
	}
}
func (nk *nick) parseModes(modes string) {
	var modeop bool  
	for i := 0; i < len(modes); i++ {
		switch m := modes[i]; m {
		case '+':
			modeop = true
		case '-':
			modeop = false
		case 'B':
			nk.modes.Bot = modeop
		case 'i':
			nk.modes.Invisible = modeop
		case 'o':
			nk.modes.Oper = modeop
		case 'w':
			nk.modes.WallOps = modeop
		case 'x':
			nk.modes.HiddenHost = modeop
		case 'z':
			nk.modes.SSL = modeop
		default:
			logging.Info("Nick.ParseModes(): unknown mode char %c", m)
		}
	}
}
func (nk *Nick) IsOn(ch string) (*ChanPrivs, bool) {
	cp, ok := nk.Channels[ch]
	return cp, ok
}
func (nk *Nick) Equals(other *Nick) bool {
	return reflect.DeepEqual(nk, other)
}
func (nm *NickMode) Copy() *NickMode {
	if nm == nil {
		return nil
	}
	n := *nm
	return &n
}