mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
Merge 1.5.0 changes back to master.
This commit is contained in:
@@ -712,7 +712,10 @@ Guacamole.Client = function(tunnel) {
|
||||
|
||||
/**
|
||||
* Fired when an arbitrary message is received from the tunnel that should
|
||||
* be processed by the client.
|
||||
* be processed by the client. By default, additional message-specific
|
||||
* events such as "onjoin" and "onleave" will fire for the received message
|
||||
* after this event has been processed. An event handler for "onmsg" need
|
||||
* not be supplied if "onjoin" and/or "onleave" will be used.
|
||||
*
|
||||
* @event
|
||||
* @param {!number} msgcode
|
||||
@@ -722,9 +725,49 @@ Guacamole.Client = function(tunnel) {
|
||||
* @param {string[]} args
|
||||
* An array of arguments to be processed with the message sent to the
|
||||
* client.
|
||||
*
|
||||
* @return {boolean}
|
||||
* true if message-specific events such as "onjoin" and
|
||||
* "onleave" should be fired for this message, false otherwise. If
|
||||
* no value is returned, message-specific events will be allowed to
|
||||
* fire.
|
||||
*/
|
||||
this.onmsg = null;
|
||||
|
||||
/**
|
||||
* Fired when a user joins a shared connection.
|
||||
*
|
||||
* @event
|
||||
* @param {!string} userID
|
||||
* A unique value representing this specific user's connection to the
|
||||
* shared connection. This value is generated by the server and is
|
||||
* guaranteed to be unique relative to other users of the connection.
|
||||
*
|
||||
* @param {!string} name
|
||||
* A human-readable name representing the user that joined, such as
|
||||
* their username. This value is provided by the web application during
|
||||
* the connection handshake and is not necessarily unique relative to
|
||||
* other users of the connection.
|
||||
*/
|
||||
this.onjoin = null;
|
||||
|
||||
/**
|
||||
* Fired when a user leaves a shared connection.
|
||||
*
|
||||
* @event
|
||||
* @param {!string} userID
|
||||
* A unique value representing this specific user's connection to the
|
||||
* shared connection. This value is generated by the server and is
|
||||
* guaranteed to be unique relative to other users of the connection.
|
||||
*
|
||||
* @param {!string} name
|
||||
* A human-readable name representing the user that left, such as their
|
||||
* username. This value is provided by the web application during the
|
||||
* connection handshake and is not necessarily unique relative to other
|
||||
* users of the connection.
|
||||
*/
|
||||
this.onleave = null;
|
||||
|
||||
/**
|
||||
* Fired when a audio stream is created. The stream provided to this event
|
||||
* handler will contain its own event handlers for received data.
|
||||
@@ -1444,8 +1487,40 @@ Guacamole.Client = function(tunnel) {
|
||||
},
|
||||
|
||||
"msg" : function(parameters) {
|
||||
|
||||
if (guac_client.onmsg) guac_client.onmsg(parseInt(parameters[0]), parameters.slice(1));
|
||||
|
||||
var userID;
|
||||
var username;
|
||||
|
||||
// Fire general message handling event first
|
||||
var allowDefault = true;
|
||||
var msgid = parseInt(parameters[0]);
|
||||
if (guac_client.onmsg) {
|
||||
allowDefault = guac_client.onmsg(msgid, parameters.slice(1));
|
||||
if (allowDefault === undefined)
|
||||
allowDefault = true;
|
||||
}
|
||||
|
||||
// Fire message-specific convenience events if not prevented by the
|
||||
// "onmsg" handler
|
||||
if (allowDefault) {
|
||||
switch (msgid) {
|
||||
|
||||
case Guacamole.Client.Message.USER_JOINED:
|
||||
userID = parameters[1];
|
||||
username = parameters[2];
|
||||
if (guac_client.onjoin)
|
||||
guac_client.onjoin(userID, username);
|
||||
break;
|
||||
|
||||
case Guacamole.Client.Message.USER_LEFT:
|
||||
userID = parameters[1];
|
||||
username = parameters[2];
|
||||
if (guac_client.onleave)
|
||||
guac_client.onleave(userID, username);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user