History

Add improved functionality for `Users.kick` API.

Add banByUsername, banByFingerprint, and banByIP parameters.

Kalila L committed 5 years ago

Commit 78cc98b1 parent bab76f77 files · +91 −51Browse files

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

Unified · Split

libraries/script-engine/src/UsersScriptingInterface.cpp+4−3
@@ -4,6 +4,7 @@ · 3 unmodified lines
4//4//
5// Created by Stephen Birarda on 2016-07-11.5// Created by Stephen Birarda on 2016-07-11.
6// Copyright 2016 High Fidelity, Inc.6// Copyright 2016 High Fidelity, Inc.
7// Copyright 2021 Vircadia contributors.
7//8//
8// Distributed under the Apache License, Version 2.0.9// Distributed under the Apache License, Version 2.0.
9// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html10// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -51,15 +52,15 @@ float UsersScriptingInterface::getAvatarGain(const QUuid& nodeID) { · 41 unmodified lines
51 return DependencyManager::get<NodeList>()->getAvatarGain(nodeID);52 return DependencyManager::get<NodeList>()->getAvatarGain(nodeID);
52}53}
53 54
54void UsersScriptingInterface::kick(const QUuid& nodeID) {55void UsersScriptingInterface::kick(const QUuid& nodeID, bool banByUsername, bool banByFingerprint, bool banByIP) {
55 56
56 if (_kickConfirmationOperator) {57 if (_kickConfirmationOperator) {
57 bool waitingForKickResponse = _kickResponseLock.resultWithReadLock<bool>([&] { return _waitingForKickResponse; });58 bool waitingForKickResponse = _kickResponseLock.resultWithReadLock<bool>([&] { return _waitingForKickResponse; });
58 if (getCanKick() && !waitingForKickResponse) {59 if (getCanKick() && !waitingForKickResponse) {
59 _kickConfirmationOperator(nodeID);60 _kickConfirmationOperator(nodeID, banByUsername, banByFingerprint, banByIP);
60 }61 }
61 } else {62 } else {
62 DependencyManager::get<NodeList>()->kickNodeBySessionID(nodeID);63 DependencyManager::get<NodeList>()->kickNodeBySessionID(nodeID, banByUsername, banByFingerprint, banByIP);
63 }64 }
64}65}
65 66