Showing the changes to libraries/script-engine/src/UsersScriptingInterface.cpp (1 of 7 files). Show all
Unified · Split
| @@ -14,34 +14,6 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <NodeList.h> |
| 15 | 15 | |
| 16 | 16 | void UsersScriptingInterface::ignore(const QUuid& nodeID) { |
| 17 | − // setup the ignore packet we send to all nodes (that currently handle it) | |
| 18 | − // to ignore the data (audio/avatar) for this user | |
| 19 | − | |
| 20 | − // enumerate the nodes to send a reliable ignore packet to each that can leverage it | |
| 21 | − auto nodeList = DependencyManager::get<NodeList>(); | |
| 22 | − | |
| 23 | − if (!nodeID.isNull() && nodeList->getSessionUUID() != nodeID) { | |
| 24 | − nodeList->eachMatchingNode([&nodeID](const SharedNodePointer& node)->bool { | |
| 25 | − if (node->getType() == NodeType::AudioMixer || node->getType() == NodeType::AvatarMixer) { | |
| 26 | − return true; | |
| 27 | − } else { | |
| 28 | − return false; | |
| 29 | − } | |
| 30 | − }, [&nodeID, &nodeList](const SharedNodePointer& destinationNode) { | |
| 31 | − // create a reliable NLPacket with space for the ignore UUID | |
| 32 | − auto ignorePacket = NLPacket::create(PacketType::NodeIgnoreRequest, NUM_BYTES_RFC4122_UUID, true); | |
| 33 | − | |
| 34 | − // write the node ID to the packet | |
| 35 | − ignorePacket->write(nodeID.toRfc4122()); | |
| 36 | − | |
| 37 | − qDebug() << "Sending packet to ignore node" << uuidStringWithoutCurlyBraces(nodeID); | |
| 38 | − | |
| 39 | − // send off this ignore packet reliably to the matching node | |
| 40 | − nodeList->sendPacket(std::move(ignorePacket), *destinationNode); | |
| 41 | − }); | |
| 42 | − | |
| 43 | − emit ignoredNode(nodeID); | |
| 44 | − } else { | |
| 45 | − qWarning() << "UsersScriptingInterface::ignore called with an invalid ID or an ID which matches the current session ID."; | |
| 46 | − } | |
| 17 | + // ask the NodeList to ignore this user (based on the session ID of their node) | |
| 18 | + DependencyManager::get<NodeList>()->ignoreNodeBySessionID(nodeID); | |
| 47 | 19 | } |