summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/lrstanley/girc/client.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-12-02 23:58:02 +0100
committerWim <wim@42.be>2017-12-02 23:58:02 +0100
commit788d3b32ac50430ee38feb996d068860beaa679e (patch)
tree51d0fdf1b9fa70c25cda534a2bfe866ac57804ae /vendor/github.com/lrstanley/girc/client.go
parent1d414cf2fdbbf642307bea81756d95b6793a0f9d (diff)
downloadmatterbridge-msglm-788d3b32ac50430ee38feb996d068860beaa679e.tar.gz
matterbridge-msglm-788d3b32ac50430ee38feb996d068860beaa679e.tar.bz2
matterbridge-msglm-788d3b32ac50430ee38feb996d068860beaa679e.zip
Update vendor lrstanley/girc and readme
Diffstat (limited to 'vendor/github.com/lrstanley/girc/client.go')
-rw-r--r--vendor/github.com/lrstanley/girc/client.go44
1 files changed, 39 insertions, 5 deletions
diff --git a/vendor/github.com/lrstanley/girc/client.go b/vendor/github.com/lrstanley/girc/client.go
index 403a7aec..501554b9 100644
--- a/vendor/github.com/lrstanley/girc/client.go
+++ b/vendor/github.com/lrstanley/girc/client.go
@@ -464,9 +464,9 @@ func (c *Client) GetHost() string {
return c.state.host
}
-// Channels returns the active list of channels that the client is in.
+// ChannelList returns the active list of channel names that the client is in.
// Panics if tracking is disabled.
-func (c *Client) Channels() []string {
+func (c *Client) ChannelList() []string {
c.panicIfNotTracking()
c.state.RLock()
@@ -482,9 +482,26 @@ func (c *Client) Channels() []string {
return channels
}
-// Users returns the active list of users that the client is tracking across
-// all files. Panics if tracking is disabled.
-func (c *Client) Users() []string {
+// Channels returns the active channels that the client is in. Panics if
+// tracking is disabled.
+func (c *Client) Channels() []*Channel {
+ c.panicIfNotTracking()
+
+ c.state.RLock()
+ channels := make([]*Channel, len(c.state.channels))
+ var i int
+ for channel := range c.state.channels {
+ channels[i] = c.state.channels[channel].Copy()
+ i++
+ }
+ c.state.RUnlock()
+
+ return channels
+}
+
+// UserList returns the active list of nicknames that the client is tracking
+// across all networks. Panics if tracking is disabled.
+func (c *Client) UserList() []string {
c.panicIfNotTracking()
c.state.RLock()
@@ -500,6 +517,23 @@ func (c *Client) Users() []string {
return users
}
+// Users returns the active users that the client is tracking across all
+// networks. Panics if tracking is disabled.
+func (c *Client) Users() []*User {
+ c.panicIfNotTracking()
+
+ c.state.RLock()
+ users := make([]*User, len(c.state.users))
+ var i int
+ for user := range c.state.users {
+ users[i] = c.state.users[user].Copy()
+ i++
+ }
+ c.state.RUnlock()
+
+ return users
+}
+
// LookupChannel looks up a given channel in state. If the channel doesn't
// exist, nil is returned. Panics if tracking is disabled.
func (c *Client) LookupChannel(name string) *Channel {