implement Client.IsInChannel()

This commit is contained in:
Liam Stanley 2016-12-10 04:14:03 -05:00
parent 6f29f62e7f
commit a693871695

@ -12,6 +12,7 @@ import (
"io/ioutil"
"log"
"net"
"strings"
"sync"
"time"
)
@ -431,6 +432,15 @@ func (c *Client) GetChannels() map[string]*Channel {
return c.state.channels
}
// IsInChannel returns true if the client is in channel.
func (c *Client) IsInChannel(channel string) bool {
c.state.m.RLock()
_, inChannel := c.state.channels[strings.ToLower(channel)]
c.state.m.RUnlock()
return inChannel
}
// Who tells the client to update it's channel/user records. Does not update
// internal state if tracking is disabled.
func (c *Client) Who(target string) error {