necouchman commented on code in PR #791:
URL: https://github.com/apache/guacamole-client/pull/791#discussion_r1092426743
##########
guacamole-common-js/src/main/webapp/modules/Client.js:
##########
@@ -1416,8 +1450,31 @@ Guacamole.Client = function(tunnel) {
},
"msg" : function(parameters) {
-
- if (guac_client.onmsg) guac_client.onmsg(parseInt(parameters[0]),
parameters.slice(1));
+
+ var userID;
+ var username;
+
+ var msgid = parseInt(parameters[0]);
+ if (guac_client.onmsg)
+ guac_client.onmsg(msgid, parameters.slice(1));
+
+ 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;
+
+ }
Review Comment:
I'd be fine with that - or adding a `default:` to the `switch()` statement?
I don't know that I have a strong preference one way or the other - mainly I
just wanted to make sure that firing both the `onmsg()` handler and then the
`onjoin()` or `onleave()` handler was the intentional and not any sort of an
"oops, forgot to handle `return` the `onmsg()` call, etc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]