Getting very close.

This commit is contained in:
Zach Fox 2016-12-29 11:35:20 -08:00
parent af1c67a252
commit bb2b48d424
7 changed files with 10 additions and 47 deletions
assignment-client/src
interface/resources/qml/hifi
libraries
scripts/system

View file

@ -62,7 +62,6 @@ private slots:
void handleNegotiateAudioFormat(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
void handleNodeKilled(SharedNodePointer killedNode);
void handleNodeIgnoreRequestPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
void handleNodeUnignoreRequestPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
void handleNodePersonalMuteRequestPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
void handleNodePersonalMuteStatusRequestPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
void handleRadiusIgnoreRequestPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);

View file

@ -41,7 +41,6 @@ private slots:
void handleAvatarIdentityPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
void handleKillAvatarPacket(QSharedPointer<ReceivedMessage> message);
void handleNodeIgnoreRequestPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
void handleNodeUnignoreRequestPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
void handleRadiusIgnoreRequestPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
void handleRequestsDomainListDataPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
void domainSettingsRequestComplete();

View file

@ -398,7 +398,6 @@ Item {
myData.audioLevel = audioLevel;
myCard.audioLevel = audioLevel; // Defensive programming
} else {
console.log("userid:" + userId);
var userIndex = findSessionIndex(userId);
userModel.get(userIndex).audioLevel = audioLevel;
userData[userIndex].audioLevel = audioLevel; // Defensive programming
@ -410,14 +409,7 @@ Item {
var enabled = message.params[1];
var userIndex = findSessionIndex(userId);
userModel.get(userIndex).personalMute.property = enabled;
userData[userIndex].personalMute.property = enabled; // Defensive programming
break;
case 'updateIgnoredStatus':
var userId = message.params[0];
var enabled = message.params[1];
var userIndex = findSessionIndex(userId);
userModel.get(userIndex).ignore.property = enabled;
userData[userIndex].ignore.property = enabled; // Defensive programming
userData[userIndex].personalMute.property = enabled; // Defensive programming
break;
default:
console.log('Unrecognized message:', JSON.stringify(message));

View file

@ -795,7 +795,8 @@ void NodeList::ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled) {
ignorePacket->write(nodeID.toRfc4122());
ignorePacket->writePrimitive(ignoreEnabled);
qCDebug(networking) << "Sending packet to" << (ignoreEnabled ? "ignore" : "unignore") << "node" << uuidStringWithoutCurlyBraces(nodeID);
qCDebug(networking) << "Sending packet to" << (destinationNode->getType() == NodeType::AudioMixer ? "AudioMixer" : "AvatarMixer") << "to"
<< (ignoreEnabled ? "ignore" : "unignore") << "node" << uuidStringWithoutCurlyBraces(nodeID);
// send off this ignore packet reliably to the matching node
sendPacket(std::move(ignorePacket), *destinationNode);
@ -849,18 +850,6 @@ void NodeList::maybeSendIgnoreSetToNode(SharedNodePointer newNode) {
}
}
void NodeList::processPersonalMuteStatusReply(QSharedPointer<ReceivedMessage> message) {
// read the UUID from the packet
QString nodeUUIDString = (QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID))).toString();
// read the personal mute status
bool isPersonalMuted;
message->readPrimitive(&isPersonalMuted);
qCDebug(networking) << "Got personal muted status" << isPersonalMuted << "for node" << nodeUUIDString;
emit personalMuteStatusReply(nodeUUIDString, isPersonalMuted);
}
void NodeList::personalMuteNodeBySessionID(const QUuid& nodeID, bool muteEnabled) {
// cannot personal mute yourself, or nobody
if (!nodeID.isNull() && _sessionUUID != nodeID) {

View file

@ -29,9 +29,9 @@ void UsersScriptingInterface::ignore(const QUuid& nodeID, bool ignoreEnabled) {
DependencyManager::get<NodeList>()->ignoreNodeBySessionID(nodeID, ignoreEnabled);
}
void UsersScriptingInterface::requestIgnoreStatus(const QUuid& nodeID) {
// ask the Audio Mixer via the NodeList for the Personal Mute status associated with the given session ID
DependencyManager::get<NodeList>()->isIgnoringNode(nodeID);
bool UsersScriptingInterface::getIgnoreStatus(const QUuid& nodeID) {
// ask the NodeList for the Ignore status associated with the given session ID
return DependencyManager::get<NodeList>()->isIgnoringNode(nodeID);
}
void UsersScriptingInterface::personalMute(const QUuid& nodeID, bool muteEnabled) {

View file

@ -40,11 +40,11 @@ public slots:
void ignore(const QUuid& nodeID, bool ignoreEnabled);
/**jsdoc
* Requests a bool containing whether you have ignored the given Avatar UUID.
* @function Users.requestIgnoreStatus
* Gets a bool containing whether you have ignored the given Avatar UUID.
* @function Users.getIgnoreStatus
* @param {nodeID} nodeID The node or session ID of the user whose ignore status you want.
*/
void requestIgnoreStatus(const QUuid& nodeID);
bool getIgnoreStatus(const QUuid& nodeID);
/**jsdoc
* Mute another user for you and you only.
@ -138,12 +138,6 @@ signals:
*/
void personalMuteStatusReply(const QString& nodeID, bool isPersonalMuted);
/**jsdoc
* Notifies scripts of the Ignore status associated with a UUID.
* @function Users.ignoreStatusReply
*/
void ignoreStatusReply(const QString& nodeID, bool isIgnored);
private:
bool getRequestsDomainListData();
void setRequestsDomainListData(bool requests);

View file

@ -137,7 +137,7 @@ function populateUserList() {
// (as long as we're not requesting it for our own ID)
if (id) {
Users.requestPersonalMuteStatus(id);
Users.requestIgnoreStatus(id);
avatarPalDatum['ignore'] = Users.getIgnoreStatus(id);
}
data.push(avatarPalDatum);
if (id) { // No overlay for ourself.
@ -173,14 +173,6 @@ function personalMuteStatusReply(id, isPersonalMuted) {
pal.sendToQml({ method: 'updatePersonalMutedStatus', params: data });
}
// The function that handles the ignored status from the AudioMixer/AvatarMixer
function ignoreStatusReply(id, isIgnored) {
var data = [id, isIgnored];
print('Ignored Status Data:', JSON.stringify(data));
// Ship the data off to QML
pal.sendToQml({ method: 'updateIgnoredStatus', params: data });
}
var pingPong = true;
function updateOverlays() {
var eye = Camera.position;
@ -352,7 +344,6 @@ pal.visibleChanged.connect(onVisibleChanged);
pal.closed.connect(off);
Users.usernameFromIDReply.connect(usernameFromIDReply);
Users.personalMuteStatusReply.connect(personalMuteStatusReply);
Users.ignoreStatusReply.connect(ignoreStatusReply);
function onIgnore(sessionId) { // make it go away in the usual way, since we'll still get data keeping it live
// Why doesn't this work from .qml? (crashes)
@ -371,7 +362,6 @@ Script.scriptEnding.connect(function () {
Users.usernameFromIDReply.disconnect(usernameFromIDReply);
Users.ignoredNode.disconnect(onIgnore);
Users.personalMuteStatusReply.disconnect(personalMuteStatusReply);
Users.ignoreStatusReply.disconnect(ignoreStatusReply);
off();
});