       console.log('left %s', channel)
 
       self.receive new LeaveMessage(null)
+
+  createUser: (channel, from) ->
+      user = @userForName from
+      unless user?
+        id = (new Date().getTime() / 1000).toString().replace('.','')
+        user = @userForId id
+        user.name = from
+
+      if channel.match(/^[&#]/)
+        user.room = channel
+      else
+        user.room = null
+      user
 
   kick: (channel, client, message) ->
     @bot.emit 'raw',

    bot.addListener 'join', (channel, who) ->
        console.log('%s has joined %s', who, channel)

        user = self.userForName who
        self.receive new EnterMessage(user)

    bot.addListener 'part', (channel, who, reason) ->
        console.log('%s has left %s: %s', who, channel, reason)

        user = self.userForName who
        self.receive new LeaveMessage(user)

    bot.addListener 'kick', (channel, who, _by, reason) ->
        console.log('%s was kicked from %s by %s: %s', who, channel, _by, reason)


exports.use = (robot) ->
  new IrcBot robot
