From a801832a5573d65ee1880c9588338c9758d24ea9 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 27 Oct 2016 11:12:31 -0700 Subject: [PATCH 1/2] Fix away.js allowing any user to disable away.js --- scripts/system/away.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/away.js b/scripts/system/away.js index 79ec22967d..bbb18b26a1 100644 --- a/scripts/system/away.js +++ b/scripts/system/away.js @@ -304,7 +304,7 @@ function setEnabled(value) { var CHANNEL_AWAY_ENABLE = "Hifi-Away-Enable"; var handleMessage = function(channel, message, sender) { - if (channel === CHANNEL_AWAY_ENABLE) { + if (channel === CHANNEL_AWAY_ENABLE && sender === MyAvatar.sessionUUID) { print("away.js | Got message on Hifi-Away-Enable: ", message); setEnabled(message === 'enable'); } From 1782f97dbd9bacf23b0942beedb21d60f3a61fab Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 27 Oct 2016 11:12:41 -0700 Subject: [PATCH 2/2] Fix away.js not unsubscribing on shutdown --- scripts/system/away.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/system/away.js b/scripts/system/away.js index bbb18b26a1..96813031f1 100644 --- a/scripts/system/away.js +++ b/scripts/system/away.js @@ -344,6 +344,7 @@ Script.scriptEnding.connect(function () { Controller.mousePressEvent.disconnect(goActive); Controller.keyPressEvent.disconnect(maybeGoActive); Messages.messageReceived.disconnect(handleMessage); + Messages.unsubscribe(CHANNEL_AWAY_ENABLE); }); if (HMD.active && !HMD.mounted) {