func (s *State) UserModes(nickorhost, channel string) (UserModes, bool) {
	s.protect.RLock()
	defer s.protect.RUnlock()
	var modes UserModes
	if channelModes := s.userModes(nickorhost, channel); channelModes != nil {
		modes = *channelModes
		return modes, true
	}
	return modes, false
}
UserModes gets the channel modes of a nick or host for the given channel.
The bool returned is false if the user or the channel does not exist.
package data
import (
	"errors"
	"strings"
	"sync"
	"github.com/aarondl/ultimateq/irc"
)
var (
	errNetInfoMissing = errors.New("data: NetworkInfo missing")
)
type Self struct {
	User
	ChannelModes
}
type State struct {
	selfUser  *User
	selfModes ChannelModes
	channels map[string]*Channel
	users    map[string]*User
	channelUsers map[string]map[string]channelUser
	userChannels map[string]map[string]userChannel
	kinds *modeKinds
	protect sync.RWMutex
}
func NewState(netInfo *irc.NetworkInfo) (*State, error) {
	state := &State{}
	if err := state.SetNetworkInfo(netInfo); err != nil {
		return nil, err
	}
	state.selfModes = NewChannelModes(&modeKinds{})
	state.channels = make(map[string]*Channel)
	state.users = make(map[string]*User)
	state.channelUsers = make(map[string]map[string]channelUser)
	state.userChannels = make(map[string]map[string]userChannel)
	return state, nil
}
func (s *State) SetNetworkInfo(ni *irc.NetworkInfo) error {
	s.protect.Lock()
	defer s.protect.Unlock()
	if ni == nil {
		return errNetInfoMissing
	}
	if s.kinds != nil {
		return s.kinds.update(ni.Prefix(), ni.Chanmodes())
	}
	kinds, err := newModeKinds(ni.Prefix(), ni.Chanmodes())
	if err != nil {
		return err
	}
	s.kinds = kinds
	return nil
}
func (s *State) Self() Self {
	return Self{*s.selfUser, s.selfModes.Clone()}
}
func (s *State) User(nickorhost string) (User, bool) {
	s.protect.RLock()
	defer s.protect.RUnlock()
	nick := strings.ToLower(irc.Nick(nickorhost))
	var user User
	u, ok := s.users[nick]
	if ok {
		user = *u
	}
	return user, ok
}
func (s *State) Channel(channel string) (Channel, bool) {
	s.protect.RLock()
	defer s.protect.RUnlock()
	var ch Channel
	c, ok := s.channels[strings.ToLower(channel)]
	if ok {
		ch = *c.Clone()
	}
	return ch, ok
}