Implement nest instruction.

This commit is contained in:
Michael Jumper
2012-10-20 20:09:13 -07:00
parent f2f6173c7d
commit 9b9981acc3

View File

@@ -270,6 +270,9 @@ Guacamole.Client = function(tunnel) {
// No initial buffers
var buffers = [];
// No initial parsers
var parsers = [];
tunnel.onerror = function(message) {
if (guac_client.onerror)
guac_client.onerror(message);
@@ -464,6 +467,21 @@ Guacamole.Client = function(tunnel) {
}
function getParser(index) {
var parser = parsers[index];
// If parser not yet created, create it, and tie to the
// oninstruction handler of the tunnel.
if (parser == null) {
parser = parsers[index] = new Guacamole.Parser();
parser.oninstruction = tunnel.oninstruction;
}
return parser;
}
/**
* Handlers for all defined layer properties.
* @private
@@ -747,6 +765,11 @@ Guacamole.Client = function(tunnel) {
if (guac_client.onname) guac_client.onname(parameters[0]);
},
"nest": function(parameters) {
var parser = getParser(parseInt(parameters[0]));
parser.receive(parameters[1]);
},
"png": function(parameters) {
var channelMask = parseInt(parameters[0]);