diff --git a/client.go b/client.go index 855e20a..903886f 100644 --- a/client.go +++ b/client.go @@ -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 {