Skip to content

Commit

Permalink
Merge pull request nandub#112 from patcon/112-irc-nick-as-uid
Browse files Browse the repository at this point in the history
Save username for both user.name and user.id
  • Loading branch information
jgable committed Feb 25, 2014
2 parents ea7a898 + 24b2d52 commit b376c08
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/irc.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ class IrcBot extends Adapter
getUserFromName: (name) ->
return @robot.brain.userForName(name) if @robot.brain?.userForName?

# Deprecated in 3.0.0
return @userForName name

getUserFromId: (id) ->
# TODO: Add logic to convert object if name matches
return @robot.brain.userForId(id) if @robot.brain?.userForId?

# Deprecated in 3.0.0
return @userForId id

createUser: (channel, from) ->
user = @getUserFromName from
unless user?
id = new Date().getTime().toString()
user = @getUserFromId id
user.name = from
user = @getUserFromId from
user.name = from

if channel.match(/^[&#]/)
user.room = channel
Expand Down

0 comments on commit b376c08

Please sign in to comment.