mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:55:00 +02:00
PR comments; need particular fix on Master for full QA
This commit is contained in:
parent
e940daf5b4
commit
a912fec496
5 changed files with 10 additions and 19 deletions
|
@ -755,7 +755,6 @@ void DomainServerSettingsManager::processUsernameFromIDRequestPacket(QSharedPoin
|
||||||
// From the packet, pull the UUID we're identifying
|
// From the packet, pull the UUID we're identifying
|
||||||
QUuid nodeUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
QUuid nodeUUID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
||||||
|
|
||||||
// If the UUID isn't NULL...
|
|
||||||
if (!nodeUUID.isNull()) {
|
if (!nodeUUID.isNull()) {
|
||||||
// First, make sure we actually have a node with this UUID
|
// First, make sure we actually have a node with this UUID
|
||||||
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
|
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
|
||||||
|
@ -766,33 +765,25 @@ void DomainServerSettingsManager::processUsernameFromIDRequestPacket(QSharedPoin
|
||||||
// It's time to figure out the username
|
// It's time to figure out the username
|
||||||
QString verifiedUsername = matchingNode->getPermissions().getVerifiedUserName();
|
QString verifiedUsername = matchingNode->getPermissions().getVerifiedUserName();
|
||||||
|
|
||||||
// If the verified username is Empty...
|
|
||||||
if (verifiedUsername.isEmpty()) {
|
if (verifiedUsername.isEmpty()) {
|
||||||
// Make sure we're using an empty string as the Verified Username
|
// Make sure we're using an empty string as the Verified Username
|
||||||
verifiedUsername = "";
|
verifiedUsername = "";
|
||||||
}
|
}
|
||||||
// Setup the packet
|
// Setup the packet
|
||||||
auto usernameFromIDReplyPacket = NLPacket::create(PacketType::UsernameFromIDReply, NUM_BYTES_RFC4122_UUID + sizeof(verifiedUsername), true);
|
auto usernameFromIDReplyPacket = NLPacket::create(PacketType::UsernameFromIDReply, NUM_BYTES_RFC4122_UUID + sizeof(verifiedUsername), true);
|
||||||
|
|
||||||
// write the node ID to the packet
|
|
||||||
usernameFromIDReplyPacket->write(nodeUUID.toRfc4122());
|
usernameFromIDReplyPacket->write(nodeUUID.toRfc4122());
|
||||||
// write the username to the packet
|
|
||||||
usernameFromIDReplyPacket->writeString(verifiedUsername);
|
usernameFromIDReplyPacket->writeString(verifiedUsername);
|
||||||
|
|
||||||
// Ship it!
|
// Ship it!
|
||||||
limitedNodeList->sendPacket(std::move(usernameFromIDReplyPacket), *sendingNode);
|
limitedNodeList->sendPacket(std::move(usernameFromIDReplyPacket), *sendingNode);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
qWarning() << "Node username request received for unknown node. Refusing to process.";
|
qWarning() << "Node username request received for unknown node. Refusing to process.";
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// This isn't a UUID we can use
|
|
||||||
qWarning() << "Node username request received for invalid node ID. Refusing to process.";
|
qWarning() << "Node username request received for invalid node ID. Refusing to process.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
qWarning() << "Refusing to process a username request packet from node" << uuidStringWithoutCurlyBraces(sendingNode->getUUID())
|
qWarning() << "Refusing to process a username request packet from node" << uuidStringWithoutCurlyBraces(sendingNode->getUUID())
|
||||||
<< "that does not have kick permissions.";
|
<< "that does not have kick permissions.";
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,18 +76,18 @@ Rectangle {
|
||||||
case 'updateUsername':
|
case 'updateUsername':
|
||||||
// The User ID (UUID) is the first parameter in the message.
|
// The User ID (UUID) is the first parameter in the message.
|
||||||
var userId = message.params[0];
|
var userId = message.params[0];
|
||||||
// The Username String (name + UUID) is the second parameter in the message.
|
// The text that goes in the userName field is the second parameter in the message.
|
||||||
var userName = message.params[1];
|
var userName = message.params[1];
|
||||||
// If the userId is empty, we're updating "myData".
|
// If the userId is empty, we're updating "myData".
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
myData.userName = userName;
|
myData.userName = userName;
|
||||||
myCard.userName = userName;
|
myCard.userName = userName; // Defensive programming
|
||||||
} else {
|
} else {
|
||||||
// Get the index in userModel and userData associated with the passed UUID
|
// Get the index in userModel and userData associated with the passed UUID
|
||||||
var userIndex = findSessionIndex(userId);
|
var userIndex = findSessionIndex(userId);
|
||||||
// Set the userName appropriately
|
// Set the userName appropriately
|
||||||
userModel.get(userIndex).userName = userName;
|
userModel.get(userIndex).userName = userName;
|
||||||
userData[userIndex].userName = userName;
|
userData[userIndex].userName = userName; // Defensive programming
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -907,8 +907,7 @@ void NodeList::requestUsernameFromSessionID(const QUuid& nodeID) {
|
||||||
qDebug() << "Sending packet to get username of node" << uuidStringWithoutCurlyBraces(nodeID);
|
qDebug() << "Sending packet to get username of node" << uuidStringWithoutCurlyBraces(nodeID);
|
||||||
|
|
||||||
sendPacket(std::move(usernameFromIDRequestPacket), _domainHandler.getSockAddr());
|
sendPacket(std::move(usernameFromIDRequestPacket), _domainHandler.getSockAddr());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
qWarning() << "You do not have permissions to kick in this domain."
|
qWarning() << "You do not have permissions to kick in this domain."
|
||||||
<< "Request to get the username of node" << uuidStringWithoutCurlyBraces(nodeID) << "will not be sent";
|
<< "Request to get the username of node" << uuidStringWithoutCurlyBraces(nodeID) << "will not be sent";
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ const QSet<PacketType> NON_SOURCED_PACKETS = QSet<PacketType>()
|
||||||
PacketVersion versionForPacketType(PacketType packetType) {
|
PacketVersion versionForPacketType(PacketType packetType) {
|
||||||
switch (packetType) {
|
switch (packetType) {
|
||||||
case PacketType::DomainList:
|
case PacketType::DomainList:
|
||||||
return static_cast<PacketVersion>(DomainListVersion::PermissionsGrid);
|
return static_cast<PacketVersion>(DomainListVersion::GetUsernameFromUUIDSupport);
|
||||||
case PacketType::EntityAdd:
|
case PacketType::EntityAdd:
|
||||||
case PacketType::EntityEdit:
|
case PacketType::EntityEdit:
|
||||||
case PacketType::EntityData:
|
case PacketType::EntityData:
|
||||||
|
|
|
@ -228,7 +228,8 @@ enum class DomainServerAddedNodeVersion : PacketVersion {
|
||||||
|
|
||||||
enum class DomainListVersion : PacketVersion {
|
enum class DomainListVersion : PacketVersion {
|
||||||
PrePermissionsGrid = 18,
|
PrePermissionsGrid = 18,
|
||||||
PermissionsGrid
|
PermissionsGrid,
|
||||||
|
GetUsernameFromUUIDSupport
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class AudioVersion : PacketVersion {
|
enum class AudioVersion : PacketVersion {
|
||||||
|
|
Loading…
Reference in a new issue