 			when 'ping' then @sendRPC 'user.pong'
 			# these are all for ttapi event name compatibility
 			# leave them here, don't document them, purely convenience
-			when 'userJoin' then @emit 'registered', msg.data
-			when 'userLeave' then @emit 'registered', msg.data
+			when 'userJoin' 
+				@room.addUser(msg.data)
+				@emit 'registered', msg.data
+			when 'userLeave'
+				@room.remUser(msg.data.id)
+				@emit 'registered', msg.data
 			when 'chat'
 				msg.data.message = encoder.htmlDecode(msg.data.message)
 				@emit 'speak', msg.data
 			when 'voteUpdate' then @emit 'update_votes', msg.data
 			when 'djAdvance'
-				#logger.log('New song', msg.data)
+				@room.setDjs(msg.data.djs)
+				@room.setMedia(msg.data.media)
 				@historyID = msg.data.historyID
 			when undefined then logger.log('UNKNOWN MESSAGE FORMAT', msg)
 		if (msg.type)

	skipSong: (callback)->
		@sendRPC "moderate.skip", @historyID, callback


module.exports = PlugAPI

		if (!key)
			throw new Error("You must pass the authentication cookie into the PlugAPI object to connect correctly")
		@rpcHandlers = {}
		@room = new Room()

	setLogObject: (c)->
		logger = c
