You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by "necouchman (via GitHub)" <gi...@apache.org> on 2023/01/30 20:34:19 UTC

[GitHub] [guacamole-client] necouchman commented on a diff in pull request #791: GUACAMOLE-1293: Add list/count of current users joined to a connection.

necouchman commented on code in PR #791:
URL: https://github.com/apache/guacamole-client/pull/791#discussion_r1091111246


##########
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:
   The way this is implemented, this will fire _both_ `guac_client.onmsg()`, if it's defined, as well as `guac_client.onjoin()` or `guac_client.onleave()`, if those are defined. I just want to make sure that's the intended behavior and how you see that implementation working? I'm not sure if there are other instructions that are similarly implemented, or if this is a first of its kind?



-- 
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: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org