mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 03:17:06 +02:00
some code-review induced changes
This commit is contained in:
parent
a6c3bcd8d8
commit
79aa450332
3 changed files with 16 additions and 13 deletions
|
@ -3129,21 +3129,17 @@ void Application::loadServerlessDomain(QUrl domainURL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
clearDomainOctreeDetails();
|
clearDomainOctreeDetails();
|
||||||
|
getMyAvatar()->setSessionUUID(QUuid()); // clear the sessionID
|
||||||
|
NodePermissions permissions; // deny all permissions
|
||||||
|
permissions.setAll(false);
|
||||||
|
nodeList->setPermissions(permissions);
|
||||||
|
|
||||||
if (domainURL.isEmpty()) {
|
if (domainURL.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid serverlessSessionID = QUuid::createUuid();
|
|
||||||
getMyAvatar()->setSessionUUID(serverlessSessionID);
|
|
||||||
DependencyManager::get<NodeList>()->setSessionUUID(serverlessSessionID);
|
|
||||||
|
|
||||||
// there is no domain-server to tell us our permissions, so enable all
|
|
||||||
NodePermissions permissions;
|
|
||||||
permissions.setAll(true);
|
|
||||||
DependencyManager::get<NodeList>()->setPermissions(permissions);
|
|
||||||
|
|
||||||
// we can't import directly into the main tree because we would need to lock it, and
|
// we can't import directly into the main tree because we would need to lock it, and
|
||||||
// Octree::readFromURL calls loop.exec which can run code which will also attempt to lock the tree.
|
// Octree::readFromURL calls loop.exec which can run code which will also attempt to lock the tree.
|
||||||
EntityTreePointer tmpTree(new EntityTree());
|
EntityTreePointer tmpTree(new EntityTree());
|
||||||
|
@ -3153,6 +3149,14 @@ void Application::loadServerlessDomain(QUrl domainURL) {
|
||||||
tmpTree->setMyAvatar(myAvatar);
|
tmpTree->setMyAvatar(myAvatar);
|
||||||
bool success = tmpTree->readFromURL(domainURL.toString());
|
bool success = tmpTree->readFromURL(domainURL.toString());
|
||||||
if (success) {
|
if (success) {
|
||||||
|
QUuid serverlessSessionID = QUuid::createUuid();
|
||||||
|
getMyAvatar()->setSessionUUID(serverlessSessionID);
|
||||||
|
nodeList->setSessionUUID(serverlessSessionID);
|
||||||
|
|
||||||
|
// there is no domain-server to tell us our permissions, so enable all
|
||||||
|
permissions.setAll(true);
|
||||||
|
nodeList->setPermissions(permissions);
|
||||||
|
|
||||||
tmpTree->reaverageOctreeElements();
|
tmpTree->reaverageOctreeElements();
|
||||||
tmpTree->sendEntities(&_entityEditSender, getEntities()->getTree(), 0, 0, 0);
|
tmpTree->sendEntities(&_entityEditSender, getEntities()->getTree(), 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,9 +309,10 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
|
||||||
bool isPossiblePlaceName(QString possiblePlaceName) {
|
bool isPossiblePlaceName(QString possiblePlaceName) {
|
||||||
bool result { false };
|
bool result { false };
|
||||||
int length = possiblePlaceName.length();
|
int length = possiblePlaceName.length();
|
||||||
static const int MINIMUM_PLACENAME_LENGTH = 4;
|
static const int MINIMUM_PLACENAME_LENGTH = 2;
|
||||||
static const int MAXIMUM_PLACENAME_LENGTH = 64;
|
static const int MAXIMUM_PLACENAME_LENGTH = 64;
|
||||||
if (possiblePlaceName != "localhost" && length >= MINIMUM_PLACENAME_LENGTH && length <= MAXIMUM_PLACENAME_LENGTH) {
|
if (possiblePlaceName.toLower() != "localhost" &&
|
||||||
|
length >= MINIMUM_PLACENAME_LENGTH && length <= MAXIMUM_PLACENAME_LENGTH) {
|
||||||
const QRegExp PLACE_NAME_REGEX = QRegExp("^[0-9A-Za-z](([0-9A-Za-z]|-(?!-))*[^\\W_]$|$)");
|
const QRegExp PLACE_NAME_REGEX = QRegExp("^[0-9A-Za-z](([0-9A-Za-z]|-(?!-))*[^\\W_]$|$)");
|
||||||
result = PLACE_NAME_REGEX.indexIn(possiblePlaceName) == 0;
|
result = PLACE_NAME_REGEX.indexIn(possiblePlaceName) == 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
|
|
||||||
#include "NetworkingConstants.h"
|
#include "NetworkingConstants.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue