Skip to content

Commit

Permalink
remove use of unneeded rfc1459 conversion (#31)
Browse files Browse the repository at this point in the history
The lookupUser function already converts the argument to an RFC 1459
compliant nick and there is no need to convert it twice.
  • Loading branch information
nmeum authored and lrstanley committed Dec 24, 2018
1 parent 14ace77 commit a39e11b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ func handleJOIN(c *Client, e Event) {
channel = c.state.lookupChannel(channelName)
}

user := c.state.lookupUser(e.Source.ID())
user := c.state.lookupUser(e.Source.Name)
if user == nil {
if ok := c.state.createUser(e.Source); !ok {
c.state.Unlock()
return
}
user = c.state.lookupUser(e.Source.ID())
user = c.state.lookupUser(e.Source.Name)
}

defer c.state.notify(c, UPDATE_STATE)
Expand Down Expand Up @@ -472,7 +472,7 @@ func handleNAMES(c *Client, e Event) {
}

c.state.createUser(s)
user := c.state.lookupUser(s.ID())
user := c.state.lookupUser(s.Name)
if user == nil {
continue
}
Expand Down Expand Up @@ -501,7 +501,7 @@ func updateLastActive(c *Client, e Event) {
c.state.Lock()

// Update the users last active time, if they exist.
user := c.state.lookupUser(e.Source.ID())
user := c.state.lookupUser(e.Source.Name)
if user == nil {
c.state.Unlock()
return
Expand Down
6 changes: 3 additions & 3 deletions cap.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func handleCHGHOST(c *Client, e Event) {
}

c.state.Lock()
user := c.state.lookupUser(e.Source.ID())
user := c.state.lookupUser(e.Source.Name)
if user != nil {
user.Ident = e.Params[0]
user.Host = e.Params[1]
Expand All @@ -206,7 +206,7 @@ func handleCHGHOST(c *Client, e Event) {
// when users are no longer away, or when they are away.
func handleAWAY(c *Client, e Event) {
c.state.Lock()
user := c.state.lookupUser(e.Source.ID())
user := c.state.lookupUser(e.Source.Name)
if user != nil {
user.Extras.Away = e.Trailing
}
Expand All @@ -229,7 +229,7 @@ func handleACCOUNT(c *Client, e Event) {
}

c.state.Lock()
user := c.state.lookupUser(e.Source.ID())
user := c.state.lookupUser(e.Source.Name)
if user != nil {
user.Extras.Account = account
}
Expand Down

0 comments on commit a39e11b

Please sign in to comment.