History

don't self-ignore from UsersScriptingInterface

Stephen Birarda committed 10 years ago

Commit d5af3231 parent 095bd7e1 file · +25 −20Browse files

Showing the changes to libraries/script-engine/src/UsersScriptingInterface.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/UsersScriptingInterface.cpp+25−20
@@ -20,24 +20,29 @@ void UsersScriptingInterface::ignore(const QUuid& nodeID) { · 19 unmodified lines
20 // enumerate the nodes to send a reliable ignore packet to each that can leverage it20 // enumerate the nodes to send a reliable ignore packet to each that can leverage it
21 auto nodeList = DependencyManager::get<NodeList>();21 auto nodeList = DependencyManager::get<NodeList>();
22 22
23 nodeList->eachMatchingNode([&nodeID](const SharedNodePointer& node)->bool {23 if (nodeList->getSessionUUID() != nodeID) {
24 if (node->getType() == NodeType::AudioMixer || node->getType() == NodeType::AvatarMixer) {24 nodeList->eachMatchingNode([&nodeID](const SharedNodePointer& node)->bool {
25 return true;25 if (node->getType() == NodeType::AudioMixer || node->getType() == NodeType::AvatarMixer) {
26 } else {26 return true;
27 return false;27 } else {
28 }28 return false;
29 }, [&nodeID, &nodeList](const SharedNodePointer& destinationNode) {29 }
30 // create a reliable NLPacket with space for the ignore UUID30 }, [&nodeID, &nodeList](const SharedNodePointer& destinationNode) {
31 auto ignorePacket = NLPacket::create(PacketType::NodeIgnoreRequest, NUM_BYTES_RFC4122_UUID, true);31 // create a reliable NLPacket with space for the ignore UUID
32 32 auto ignorePacket = NLPacket::create(PacketType::NodeIgnoreRequest, NUM_BYTES_RFC4122_UUID, true);
33 // write the node ID to the packet33
34 ignorePacket->write(nodeID.toRfc4122());34 // write the node ID to the packet
35 35 ignorePacket->write(nodeID.toRfc4122());
36 qDebug() << "Sending packet to ignore node" << uuidStringWithoutCurlyBraces(nodeID);36
37 37 qDebug() << "Sending packet to ignore node" << uuidStringWithoutCurlyBraces(nodeID);
38 // send off this ignore packet reliably to the matching node38
39 nodeList->sendPacket(std::move(ignorePacket), *destinationNode);39 // send off this ignore packet reliably to the matching node
40 });40 nodeList->sendPacket(std::move(ignorePacket), *destinationNode);
41 41 });
42 emit ignoredNode(nodeID);42
43 emit ignoredNode(nodeID);
44 } else {
45 qWarning() << "UsersScriptingInterface was asked to ignore a node ID which matches the current session ID, "
46 << "but self-ignore has no meaning.";
47 }
43}48}