be less redundant
This commit is contained in:
parent
6788aa81f8
commit
e57ac9cdb4
@ -437,11 +437,11 @@ func (c *Client) Channels() []string {
|
|||||||
|
|
||||||
// Lookup looks up a given channel in state. If the channel doesn't exist,
|
// Lookup looks up a given channel in state. If the channel doesn't exist,
|
||||||
// channel is nil.
|
// channel is nil.
|
||||||
func (c *Client) Lookup(name string) (channel *Channel) {
|
func (c *Client) Lookup(name string) *Channel {
|
||||||
c.state.mu.Lock()
|
c.state.mu.Lock()
|
||||||
defer c.state.mu.Unlock()
|
defer c.state.mu.Unlock()
|
||||||
|
|
||||||
channel = c.state.lookupChannel(name)
|
channel := c.state.lookupChannel(name)
|
||||||
if channel == nil {
|
if channel == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
2
state.go
2
state.go
@ -194,7 +194,7 @@ func (c *Channel) Len() int {
|
|||||||
|
|
||||||
// Lookup looks up a user in a channel based on a given nickname. If the
|
// Lookup looks up a user in a channel based on a given nickname. If the
|
||||||
// user wasn't found, user is nil.
|
// user wasn't found, user is nil.
|
||||||
func (c *Channel) Lookup(nick string) (user *User) {
|
func (c *Channel) Lookup(nick string) *User {
|
||||||
for k, v := range c.users {
|
for k, v := range c.users {
|
||||||
if strings.ToLower(k) == strings.ToLower(nick) {
|
if strings.ToLower(k) == strings.ToLower(nick) {
|
||||||
// No need to have a copy, as if one has access to a channel,
|
// No need to have a copy, as if one has access to a channel,
|
||||||
|
Loading…
Reference in New Issue
Block a user