 			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)

http = require('http')
EventEmitter = require('events').EventEmitter
Encoder = require('node-html-encoder').Encoder

# create our entity encoder for decoding chat messages
encoder = new Encoder('entity')

	# sane functions. This is the actual API
	# any function who differs in name from the ttfm ones have a copy that calls said ttfm function
	# this is for API compatibility between ttapi and plugapi
	joinRoom: (name, callback)=>
		@sendRPC 'room.join', [name], (data)=>
			for user in data['room']['users']
				@room.addUser user
			callback.apply @, arguments

	# alias for ttapi compatibility
	roomRegister: (name, callback)->
