mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
Add file instruction handler and event, modify parser to not drop length if only partially received.
This commit is contained in:
@@ -82,7 +82,7 @@ Guacamole.Parser = function() {
|
||||
this.receive = function(packet) {
|
||||
|
||||
// Truncate buffer as necessary
|
||||
if (start_index > 4096) {
|
||||
if (start_index > 4096 && element_end >= start_index) {
|
||||
|
||||
buffer = buffer.substring(start_index);
|
||||
|
||||
@@ -473,6 +473,18 @@ Guacamole.Client = function(tunnel) {
|
||||
*/
|
||||
this.onresize = null;
|
||||
|
||||
/**
|
||||
* Fired when a file is received. Note that this will contain the entire
|
||||
* data of the file.
|
||||
*
|
||||
* @event
|
||||
* @param {String} name A human-readable name describing the file.
|
||||
* @param {String} mimetype The mimetype of the file received.
|
||||
* @param {String} data The actual entire contents of the file,
|
||||
* base64-encoded.
|
||||
*/
|
||||
this.onfile = null;
|
||||
|
||||
// Layers
|
||||
function getBufferLayer(index) {
|
||||
|
||||
@@ -773,6 +785,15 @@ Guacamole.Client = function(tunnel) {
|
||||
guac_client.disconnect();
|
||||
},
|
||||
|
||||
"file": function(parameters) {
|
||||
if (guac_client.onfile)
|
||||
guac_client.onfile(
|
||||
parameters[0], // Name
|
||||
parameters[1], // Mimetype
|
||||
parameters[2] // Data
|
||||
);
|
||||
},
|
||||
|
||||
"identity": function(parameters) {
|
||||
|
||||
var layer = getLayer(parseInt(parameters[0]));
|
||||
|
Reference in New Issue
Block a user