robust create user: allow new userid to be to generate a new random one; handle possible case of a weareble being a inventory link

httptests
UbitUmarov 2018-04-14 23:05:46 +01:00
parent 90482182e5
commit 7c9c5cfedf
1 changed files with 14 additions and 3 deletions

View File

@ -407,7 +407,7 @@ namespace OpenSim.Services.UserAccountService
else email = cmdparams[5];
if (cmdparams.Length < 7)
rawPrincipalId = MainConsole.Instance.CmdPrompt("User ID", UUID.Random().ToString());
rawPrincipalId = MainConsole.Instance.CmdPrompt("User ID (enter for random)", "");
else
rawPrincipalId = cmdparams[6];
@ -417,7 +417,9 @@ namespace OpenSim.Services.UserAccountService
model = cmdparams[7];
UUID principalId = UUID.Zero;
if (!UUID.TryParse(rawPrincipalId, out principalId))
if(String.IsNullOrWhiteSpace(rawPrincipalId))
principalId = UUID.Random();
else if (!UUID.TryParse(rawPrincipalId, out principalId))
throw new Exception(string.Format("ID {0} is not a valid UUID", rawPrincipalId));
CreateUser(UUID.Zero, principalId, firstName, lastName, password, email, model);
@ -823,6 +825,7 @@ namespace OpenSim.Services.UserAccountService
return;
}
try
{
CopyWearablesAndAttachments(destinationAgent, modelAccount.PrincipalID, modelAppearance);
@ -876,12 +879,20 @@ namespace OpenSim.Services.UserAccountService
for (int i = 0; i < wearables.Length; i++)
{
wearable = wearables[i];
m_log.DebugFormat("[XXX]: Getting item {0} from avie {1}", wearable[0].ItemID, source);
if (wearable[0].ItemID != UUID.Zero)
{
m_log.DebugFormat("[XXX]: Getting item {0} from avie {1}", wearable[0].ItemID, source);
// Get inventory item and copy it
InventoryItemBase item = m_InventoryService.GetItem(source, wearable[0].ItemID);
if(item != null && item.AssetType == (int)AssetType.Link)
{
if(item.AssetID == UUID.Zero )
item = null;
else
item = m_InventoryService.GetItem(source, item.AssetID);
}
if (item != null)
{
InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);