From d5af323057ef00ba229b542ea3afb7a4c2e910ac Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 11 Jul 2016 14:23:22 -0700 Subject: [PATCH] don't self-ignore from UsersScriptingInterface --- .../src/UsersScriptingInterface.cpp | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/libraries/script-engine/src/UsersScriptingInterface.cpp b/libraries/script-engine/src/UsersScriptingInterface.cpp index 6f863268c6..fab6f453e5 100644 --- a/libraries/script-engine/src/UsersScriptingInterface.cpp +++ b/libraries/script-engine/src/UsersScriptingInterface.cpp @@ -20,24 +20,29 @@ void UsersScriptingInterface::ignore(const QUuid& nodeID) { // enumerate the nodes to send a reliable ignore packet to each that can leverage it auto nodeList = DependencyManager::get(); - nodeList->eachMatchingNode([&nodeID](const SharedNodePointer& node)->bool { - if (node->getType() == NodeType::AudioMixer || node->getType() == NodeType::AvatarMixer) { - return true; - } else { - return false; - } - }, [&nodeID, &nodeList](const SharedNodePointer& destinationNode) { - // create a reliable NLPacket with space for the ignore UUID - auto ignorePacket = NLPacket::create(PacketType::NodeIgnoreRequest, NUM_BYTES_RFC4122_UUID, true); + if (nodeList->getSessionUUID() != nodeID) { + nodeList->eachMatchingNode([&nodeID](const SharedNodePointer& node)->bool { + if (node->getType() == NodeType::AudioMixer || node->getType() == NodeType::AvatarMixer) { + return true; + } else { + return false; + } + }, [&nodeID, &nodeList](const SharedNodePointer& destinationNode) { + // create a reliable NLPacket with space for the ignore UUID + auto ignorePacket = NLPacket::create(PacketType::NodeIgnoreRequest, NUM_BYTES_RFC4122_UUID, true); - // write the node ID to the packet - ignorePacket->write(nodeID.toRfc4122()); + // write the node ID to the packet + ignorePacket->write(nodeID.toRfc4122()); - qDebug() << "Sending packet to ignore node" << uuidStringWithoutCurlyBraces(nodeID); + qDebug() << "Sending packet to ignore node" << uuidStringWithoutCurlyBraces(nodeID); - // send off this ignore packet reliably to the matching node - nodeList->sendPacket(std::move(ignorePacket), *destinationNode); - }); - - emit ignoredNode(nodeID); + // send off this ignore packet reliably to the matching node + nodeList->sendPacket(std::move(ignorePacket), *destinationNode); + }); + + emit ignoredNode(nodeID); + } else { + qWarning() << "UsersScriptingInterface was asked to ignore a node ID which matches the current session ID, " + << "but self-ignore has no meaning."; + } }