ludi_comm = {};

// List of message templates, compiled as handlebars template functions.

ludi_comm.serverMessages  = [
	{id:0, kernelMsgId: "server_welcome"},
	{id:1, kernelMsgId: "server_invalidRequireName"},
	{id:2, kernelMsgId: "server_invalidNameChange"},
	{id:3, kernelMsgId: "server_filtersChanged"},
	{id:4, kernelMsgId: "server_leftChatroom"},
	{id:5, kernelMsgId: "server_haveFun"},
	{id:6, kernelMsgId: "server_hasJoinedRoom"},
	{id:7, kernelMsgId: "server_invalidName"},		
];

ludi_comm.action = function (data) {
	/* mlif-action: 
		data.user.name
		data.type = 'echo'
		data.message.loc
		data.message.action
		data.message.item1
		data.message.item2
	*/

}

ludi_comm.joinGame = function (data) {
	if (typeof socket == "object" && user.name) { 
		socket.emit('join-game', data);	
	}
}

ludi_comm.leaveGame = function (data) {
	if (typeof socket == "object" && user.name) { 
		socket.emit('leave-game', data);	
	}
}

ludi_comm.joinLoc = function (data) {
	if (typeof socket == "object" && user.name) { 
		socket.emit('join-loc', data);	
	}
}

ludi_comm.leaveLoc = function (data) {
	if (typeof socket == "object" && user.name) { 
		socket.emit('leave-loc', data);	
	}
}


ludi_comm.messageSend = function (data) {
	// first storage message
	

	if (typeof socket == "object" && user.name) { 
		socket.emit('chat', data);	
	}
}


ludi_comm.updateProfile = function () {

	// to-do: send user profile to server:

}



			