mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Merge pull request #9404 from davidkelly/dk/removeKilledAvatarsFromPalLists
remove ignored avatars from PAL when they disconnect
This commit is contained in:
commit
341ac685e9
6 changed files with 34 additions and 1 deletions
|
@ -502,6 +502,10 @@ Rectangle {
|
||||||
ignored = {};
|
ignored = {};
|
||||||
gainSliderValueDB = {};
|
gainSliderValueDB = {};
|
||||||
break;
|
break;
|
||||||
|
case 'avatarDisconnected':
|
||||||
|
var sessionID = message.params[0];
|
||||||
|
delete ignored[sessionID];
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.log('Unrecognized message:', JSON.stringify(message));
|
console.log('Unrecognized message:', JSON.stringify(message));
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,6 +260,10 @@ void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar
|
||||||
}
|
}
|
||||||
if (removalReason == KillAvatarReason::TheirAvatarEnteredYourBubble || removalReason == YourAvatarEnteredTheirBubble) {
|
if (removalReason == KillAvatarReason::TheirAvatarEnteredYourBubble || removalReason == YourAvatarEnteredTheirBubble) {
|
||||||
DependencyManager::get<NodeList>()->radiusIgnoreNodeBySessionID(avatar->getSessionUUID(), true);
|
DependencyManager::get<NodeList>()->radiusIgnoreNodeBySessionID(avatar->getSessionUUID(), true);
|
||||||
|
} else if (removalReason == KillAvatarReason::AvatarDisconnected) {
|
||||||
|
// remove from node sets, if present
|
||||||
|
DependencyManager::get<NodeList>()->removeFromIgnoreMuteSets(avatar->getSessionUUID());
|
||||||
|
DependencyManager::get<UsersScriptingInterface>()->avatarDisconnected(avatar->getSessionUUID());
|
||||||
}
|
}
|
||||||
_avatarFades.push_back(removedAvatar);
|
_avatarFades.push_back(removedAvatar);
|
||||||
}
|
}
|
||||||
|
|
|
@ -847,6 +847,16 @@ void NodeList::ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeList::removeFromIgnoreMuteSets(const QUuid& nodeID) {
|
||||||
|
// don't remove yourself, or nobody
|
||||||
|
if (!nodeID.isNull() && _sessionUUID != nodeID) {
|
||||||
|
QWriteLocker ignoredSetLocker{ &_ignoredSetLock };
|
||||||
|
QWriteLocker personalMutedSetLocker{ &_personalMutedSetLock };
|
||||||
|
_ignoredNodeIDs.unsafe_erase(nodeID);
|
||||||
|
_personalMutedNodeIDs.unsafe_erase(nodeID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool NodeList::isIgnoringNode(const QUuid& nodeID) const {
|
bool NodeList::isIgnoringNode(const QUuid& nodeID) const {
|
||||||
QReadLocker ignoredSetLocker{ &_ignoredSetLock };
|
QReadLocker ignoredSetLocker{ &_ignoredSetLock };
|
||||||
return _ignoredNodeIDs.find(nodeID) != _ignoredNodeIDs.cend();
|
return _ignoredNodeIDs.find(nodeID) != _ignoredNodeIDs.cend();
|
||||||
|
|
|
@ -90,6 +90,8 @@ public:
|
||||||
bool getRequestsDomainListData() { return _requestsDomainListData; }
|
bool getRequestsDomainListData() { return _requestsDomainListData; }
|
||||||
void setRequestsDomainListData(bool isRequesting);
|
void setRequestsDomainListData(bool isRequesting);
|
||||||
|
|
||||||
|
void removeFromIgnoreMuteSets(const QUuid& nodeID);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void reset();
|
void reset();
|
||||||
void sendDomainServerCheckIn();
|
void sendDomainServerCheckIn();
|
||||||
|
|
|
@ -139,6 +139,13 @@ signals:
|
||||||
*/
|
*/
|
||||||
void usernameFromIDReply(const QString& nodeID, const QString& username, const QString& machineFingerprint);
|
void usernameFromIDReply(const QString& nodeID, const QString& username, const QString& machineFingerprint);
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Notifies scripts that a user has disconnected from the domain
|
||||||
|
* @function Users.avatar.avatarDisconnected
|
||||||
|
* @param {nodeID} NodeID The session ID of the avatar that has disconnected
|
||||||
|
*/
|
||||||
|
void avatarDisconnected(const QUuid& nodeID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool getRequestsDomainListData();
|
bool getRequestsDomainListData();
|
||||||
void setRequestsDomainListData(bool requests);
|
void setRequestsDomainListData(bool requests);
|
||||||
|
|
|
@ -580,7 +580,10 @@ function onClicked() {
|
||||||
}
|
}
|
||||||
pal.setVisible(!pal.visible);
|
pal.setVisible(!pal.visible);
|
||||||
}
|
}
|
||||||
|
function avatarDisconnected(nodeID) {
|
||||||
|
// remove from the pal list
|
||||||
|
pal.sendToQml({method: 'avatarDisconnected', params: [nodeID]});
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Button state.
|
// Button state.
|
||||||
//
|
//
|
||||||
|
@ -593,6 +596,8 @@ button.clicked.connect(onClicked);
|
||||||
pal.visibleChanged.connect(onVisibleChanged);
|
pal.visibleChanged.connect(onVisibleChanged);
|
||||||
pal.closed.connect(off);
|
pal.closed.connect(off);
|
||||||
Users.usernameFromIDReply.connect(usernameFromIDReply);
|
Users.usernameFromIDReply.connect(usernameFromIDReply);
|
||||||
|
Users.avatarDisconnected.connect(avatarDisconnected);
|
||||||
|
|
||||||
function clearLocalQMLDataAndClosePAL() {
|
function clearLocalQMLDataAndClosePAL() {
|
||||||
pal.sendToQml({ method: 'clearLocalQMLData' });
|
pal.sendToQml({ method: 'clearLocalQMLData' });
|
||||||
if (pal.visible) {
|
if (pal.visible) {
|
||||||
|
@ -615,6 +620,7 @@ Script.scriptEnding.connect(function () {
|
||||||
Window.domainConnectionRefused.disconnect(clearLocalQMLDataAndClosePAL);
|
Window.domainConnectionRefused.disconnect(clearLocalQMLDataAndClosePAL);
|
||||||
Messages.unsubscribe(CHANNEL);
|
Messages.unsubscribe(CHANNEL);
|
||||||
Messages.messageReceived.disconnect(receiveMessage);
|
Messages.messageReceived.disconnect(receiveMessage);
|
||||||
|
Users.avatarDisconnected.disconnect(avatarDisconnected);
|
||||||
off();
|
off();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue