mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 09:33:36 +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;
|
||||
}
|
||||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
clearDomainOctreeDetails();
|
||||
getMyAvatar()->setSessionUUID(QUuid()); // clear the sessionID
|
||||
NodePermissions permissions; // deny all permissions
|
||||
permissions.setAll(false);
|
||||
nodeList->setPermissions(permissions);
|
||||
|
||||
if (domainURL.isEmpty()) {
|
||||
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
|
||||
// Octree::readFromURL calls loop.exec which can run code which will also attempt to lock the tree.
|
||||
EntityTreePointer tmpTree(new EntityTree());
|
||||
|
@ -3153,6 +3149,14 @@ void Application::loadServerlessDomain(QUrl domainURL) {
|
|||
tmpTree->setMyAvatar(myAvatar);
|
||||
bool success = tmpTree->readFromURL(domainURL.toString());
|
||||
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->sendEntities(&_entityEditSender, getEntities()->getTree(), 0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -309,9 +309,10 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
|
|||
bool isPossiblePlaceName(QString possiblePlaceName) {
|
||||
bool result { false };
|
||||
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;
|
||||
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_]$|$)");
|
||||
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
|
||||
//
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
#include "NetworkingConstants.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue