Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs OpenSim/Region/CoreModules/World/Land/LandObject.cs OpenSim/Region/Framework/Scenes/Scene.Inventory.cs OpenSim/Region/Framework/Scenes/SceneObjectPart.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.csavinationmerge
commit
b39de2425c
|
@ -162,7 +162,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
invFetch.owner_id, invFetch.folder_id, invFetch.owner_id,
|
invFetch.owner_id, invFetch.folder_id, invFetch.owner_id,
|
||||||
invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version);
|
invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version);
|
||||||
|
|
||||||
if (inv.Folders != null)
|
if (inv != null && inv.Folders != null)
|
||||||
{
|
{
|
||||||
foreach (InventoryFolderBase invFolder in inv.Folders)
|
foreach (InventoryFolderBase invFolder in inv.Folders)
|
||||||
{
|
{
|
||||||
|
@ -170,7 +170,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inv.Items != null)
|
if (inv != null && inv.Items != null)
|
||||||
{
|
{
|
||||||
foreach (InventoryItemBase invItem in inv.Items)
|
foreach (InventoryItemBase invItem in inv.Items)
|
||||||
{
|
{
|
||||||
|
|
|
@ -662,11 +662,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e);
|
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw " + e.ToString());
|
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e.StackTrace);
|
||||||
SendHTML500(response);
|
SendHTML500(response);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
@ -1923,7 +1923,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
folderBlock.FolderID = folder.ID;
|
folderBlock.FolderID = folder.ID;
|
||||||
folderBlock.ParentID = folder.ParentID;
|
folderBlock.ParentID = folder.ParentID;
|
||||||
folderBlock.Type = -1;
|
//folderBlock.Type = -1;
|
||||||
|
folderBlock.Type = (sbyte)folder.Type;
|
||||||
folderBlock.Name = Util.StringToBytes256(folder.Name);
|
folderBlock.Name = Util.StringToBytes256(folder.Name);
|
||||||
|
|
||||||
return folderBlock;
|
return folderBlock;
|
||||||
|
@ -4360,7 +4361,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
block.OwnerID = sop.OwnerID;
|
block.OwnerID = sop.OwnerID;
|
||||||
|
|
||||||
block.ItemID = sop.FromUserInventoryItemID;
|
block.ItemID = sop.FromUserInventoryItemID;
|
||||||
block.FolderID = UUID.Zero; // sop.FromFolderID ??
|
block.FolderID = UUID.Zero; // sog.FromFolderID ??
|
||||||
block.FromTaskID = UUID.Zero; // ???
|
block.FromTaskID = UUID.Zero; // ???
|
||||||
block.InventorySerial = (short)sop.InventorySerial;
|
block.InventorySerial = (short)sop.InventorySerial;
|
||||||
|
|
||||||
|
@ -5082,7 +5083,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
|
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
|
||||||
if (data.ParentGroup.IsAttachment)
|
if (data.ParentGroup.IsAttachment)
|
||||||
{
|
{
|
||||||
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID);
|
update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID);
|
||||||
update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16));
|
update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -285,7 +285,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
// At the moment we can only deal with a single attachment
|
// At the moment we can only deal with a single attachment
|
||||||
if (attachments.Count != 0)
|
if (attachments.Count != 0)
|
||||||
{
|
{
|
||||||
UUID oldAttachmentItemID = attachments[0].GetFromItemID();
|
UUID oldAttachmentItemID = attachments[0].FromItemID;
|
||||||
|
|
||||||
if (oldAttachmentItemID != UUID.Zero)
|
if (oldAttachmentItemID != UUID.Zero)
|
||||||
DetachSingleAttachmentToInvInternal(sp, oldAttachmentItemID);
|
DetachSingleAttachmentToInvInternal(sp, oldAttachmentItemID);
|
||||||
|
@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the new attachment to inventory if we don't already have it.
|
// Add the new attachment to inventory if we don't already have it.
|
||||||
UUID newAttachmentItemID = group.GetFromItemID();
|
UUID newAttachmentItemID = group.FromItemID;
|
||||||
if (newAttachmentItemID == UUID.Zero)
|
if (newAttachmentItemID == UUID.Zero)
|
||||||
newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;
|
newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
List<SceneObjectGroup> existingAttachments = sp.GetAttachments();
|
List<SceneObjectGroup> existingAttachments = sp.GetAttachments();
|
||||||
foreach (SceneObjectGroup so in existingAttachments)
|
foreach (SceneObjectGroup so in existingAttachments)
|
||||||
{
|
{
|
||||||
if (so.GetFromItemID() == itemID)
|
if (so.FromItemID == itemID)
|
||||||
{
|
{
|
||||||
alreadyOn = true;
|
alreadyOn = true;
|
||||||
break;
|
break;
|
||||||
|
@ -393,7 +393,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (so.AttachedAvatar != sp.UUID)
|
if (so.AttachedAvatar != sp.UUID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UUID inventoryID = so.GetFromItemID();
|
UUID inventoryID = so.FromItemID;
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}",
|
// "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}",
|
||||||
|
@ -410,9 +410,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
|
m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
|
||||||
|
|
||||||
sp.RemoveAttachment(so);
|
sp.RemoveAttachment(so);
|
||||||
|
so.FromItemID = UUID.Zero;
|
||||||
|
|
||||||
SceneObjectPart rootPart = so.RootPart;
|
SceneObjectPart rootPart = so.RootPart;
|
||||||
rootPart.FromItemID = UUID.Zero;
|
|
||||||
so.AbsolutePosition = sp.AbsolutePosition;
|
so.AbsolutePosition = sp.AbsolutePosition;
|
||||||
so.AttachedAvatar = UUID.Zero;
|
so.AttachedAvatar = UUID.Zero;
|
||||||
rootPart.SetParentLocalId(0);
|
rootPart.SetParentLocalId(0);
|
||||||
|
@ -526,7 +526,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
|
|
||||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
|
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
|
||||||
|
|
||||||
InventoryItemBase item = new InventoryItemBase(grp.GetFromItemID(), sp.UUID);
|
InventoryItemBase item = new InventoryItemBase(grp.FromItemID, sp.UUID);
|
||||||
item = m_scene.InventoryService.GetItem(item);
|
item = m_scene.InventoryService.GetItem(item);
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
|
@ -698,7 +698,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||||
|
|
||||||
// sets itemID so client can show item as 'attached' in inventory
|
// sets itemID so client can show item as 'attached' in inventory
|
||||||
grp.SetFromItemID(item.ID);
|
grp.FromItemID = item.ID;
|
||||||
|
|
||||||
if (m_scene.AddInventoryItem(item))
|
if (m_scene.AddInventoryItem(item))
|
||||||
{
|
{
|
||||||
|
@ -734,7 +734,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (entity is SceneObjectGroup)
|
if (entity is SceneObjectGroup)
|
||||||
{
|
{
|
||||||
group = (SceneObjectGroup)entity;
|
group = (SceneObjectGroup)entity;
|
||||||
if (group.GetFromItemID() == itemID)
|
if (group.FromItemID == itemID)
|
||||||
{
|
{
|
||||||
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
|
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
|
||||||
sp.RemoveAttachment(group);
|
sp.RemoveAttachment(group);
|
||||||
|
@ -946,7 +946,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
// Calls attach with a Zero position
|
// Calls attach with a Zero position
|
||||||
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false))
|
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false))
|
||||||
{
|
{
|
||||||
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId);
|
||||||
|
|
||||||
// Save avatar attachment information
|
// Save avatar attachment information
|
||||||
m_log.Debug(
|
m_log.Debug(
|
||||||
|
@ -969,7 +969,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
|
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
|
||||||
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
|
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
|
||||||
if (sp != null && group != null)
|
if (sp != null && group != null)
|
||||||
DetachSingleAttachmentToInv(sp, group.GetFromItemID());
|
DetachSingleAttachmentToInv(sp, group.FromItemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Client_OnDetachAttachmentIntoInv(UUID itemID, IClientAPI remoteClient)
|
private void Client_OnDetachAttachmentIntoInv(UUID itemID, IClientAPI remoteClient)
|
||||||
|
|
|
@ -120,8 +120,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(attSo.IsTemporary, Is.False);
|
Assert.That(attSo.IsTemporary, Is.False);
|
||||||
|
|
||||||
// Check item status
|
// Check item status
|
||||||
Assert.That(m_presence.Appearance.GetAttachpoint(
|
Assert.That(
|
||||||
attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest));
|
m_presence.Appearance.GetAttachpoint(attSo.FromItemID),
|
||||||
|
Is.EqualTo((int)AttachmentPoint.Chest));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -562,12 +562,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// Finally, kill the agent we just created at the destination.
|
// Finally, kill the agent we just created at the destination.
|
||||||
m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID);
|
m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID);
|
||||||
|
|
||||||
|
sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
||||||
{
|
{
|
||||||
logout = false;
|
logout = false;
|
||||||
return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
|
bool success = m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent)
|
protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent)
|
||||||
|
|
|
@ -51,8 +51,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
private bool m_Initialized = false;
|
private bool m_Initialized = false;
|
||||||
|
|
||||||
private bool m_RestrictInventoryAccessAbroad = false;
|
|
||||||
|
|
||||||
private GatekeeperServiceConnector m_GatekeeperConnector;
|
private GatekeeperServiceConnector m_GatekeeperConnector;
|
||||||
|
|
||||||
#region ISharedRegionModule
|
#region ISharedRegionModule
|
||||||
|
@ -71,10 +69,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if (name == Name)
|
if (name == Name)
|
||||||
{
|
{
|
||||||
InitialiseCommon(source);
|
InitialiseCommon(source);
|
||||||
IConfig transferConfig = source.Configs["HGEntityTransferModule"];
|
|
||||||
if (transferConfig != null)
|
|
||||||
m_RestrictInventoryAccessAbroad = transferConfig.GetBoolean("RestrictInventoryAccessAbroad", false);
|
|
||||||
|
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,34 +88,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
client.OnTeleportHomeRequest += TriggerTeleportHome;
|
client.OnTeleportHomeRequest += TriggerTeleportHome;
|
||||||
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
|
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
|
||||||
client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed);
|
client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed);
|
||||||
client.OnCompleteMovementToRegion += new Action<IClientAPI, bool>(OnCompleteMovementToRegion);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnCompleteMovementToRegion(IClientAPI client, bool arg2)
|
|
||||||
{
|
|
||||||
// HACK HACK -- just seeing how the viewer responds
|
|
||||||
// Let's send the Suitcase or the real root folder folder for incoming HG agents
|
|
||||||
// Visiting agents get their suitcase contents; incoming local users get their real root folder's content
|
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: OnCompleteMovementToRegion of user {0}", client.AgentId);
|
|
||||||
object sp = null;
|
|
||||||
if (client.Scene.TryGetScenePresence(client.AgentId, out sp))
|
|
||||||
{
|
|
||||||
if (sp is ScenePresence)
|
|
||||||
{
|
|
||||||
AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId);
|
|
||||||
if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: ViaHGLogin");
|
|
||||||
if (m_RestrictInventoryAccessAbroad)
|
|
||||||
{
|
|
||||||
RestoreRootFolderContents(client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public override void RegionLoaded(Scene scene)
|
public override void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
base.RegionLoaded(scene);
|
base.RegionLoaded(scene);
|
||||||
|
@ -131,12 +99,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
|
m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
|
|
||||||
scene.AddCommand(
|
|
||||||
"HG", this, "send inventory",
|
|
||||||
"send inventory",
|
|
||||||
"Don't use this",
|
|
||||||
HandleSendInventory);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -209,8 +171,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
|
bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
|
||||||
logout = success; // flag for later logout from this grid; this is an HG TP
|
logout = success; // flag for later logout from this grid; this is an HG TP
|
||||||
|
|
||||||
if (success && m_RestrictInventoryAccessAbroad)
|
if (success)
|
||||||
RemoveRootFolderContents(sp.ControllingClient);
|
sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason);
|
return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TriggerTeleportHome(UUID id, IClientAPI client)
|
public void TriggerTeleportHome(UUID id, IClientAPI client)
|
||||||
|
@ -330,15 +292,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fail(ScenePresence sp, GridRegion finalDestination, bool logout)
|
|
||||||
{
|
|
||||||
base.Fail(sp, finalDestination, logout);
|
|
||||||
if (logout && m_RestrictInventoryAccessAbroad)
|
|
||||||
{
|
|
||||||
RestoreRootFolderContents(sp.ControllingClient);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IUserAgentVerificationModule
|
#region IUserAgentVerificationModule
|
||||||
|
@ -393,60 +346,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void RemoveRootFolderContents(IClientAPI client)
|
|
||||||
{
|
|
||||||
// TODO tell the viewer to remove the root folder's content
|
|
||||||
if (client is IClientCore)
|
|
||||||
{
|
|
||||||
IClientCore core = (IClientCore)client;
|
|
||||||
IClientInventory inv;
|
|
||||||
|
|
||||||
if (core.TryGet<IClientInventory>(out inv))
|
|
||||||
{
|
|
||||||
InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId);
|
|
||||||
if (root != null)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory for user {0}", client.AgentId);
|
|
||||||
InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID);
|
|
||||||
UUID[] ids = new UUID[content.Folders.Count];
|
|
||||||
int i = 0;
|
|
||||||
foreach (InventoryFolderBase f in content.Folders)
|
|
||||||
ids[i++] = f.ID;
|
|
||||||
inv.SendRemoveInventoryFolders(ids);
|
|
||||||
ids = new UUID[content.Items.Count];
|
|
||||||
i = 0;
|
|
||||||
foreach (InventoryItemBase it in content.Items)
|
|
||||||
ids[i++] = it.ID;
|
|
||||||
inv.SendRemoveInventoryItems(ids);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RestoreRootFolderContents(IClientAPI client)
|
|
||||||
{
|
|
||||||
if (client is IClientCore)
|
|
||||||
{
|
|
||||||
IClientCore core = (IClientCore)client;
|
|
||||||
IClientInventory inv;
|
|
||||||
|
|
||||||
if (core.TryGet<IClientInventory>(out inv))
|
|
||||||
{
|
|
||||||
InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId);
|
|
||||||
client.SendBulkUpdateInventory(root);
|
|
||||||
//if (root != null)
|
|
||||||
//{
|
|
||||||
// m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory for user {0}", client.AgentId);
|
|
||||||
// InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID);
|
|
||||||
// m_log.DebugFormat("[XXX]: Folder name {0}, id {1}, parent {2}", root.Name, root.ID, root.ParentID);
|
|
||||||
// foreach (InventoryItemBase i in content.Items)
|
|
||||||
// m_log.DebugFormat("[XXX]: Name={0}, folderID={1}", i.Name, i.Folder);
|
|
||||||
|
|
||||||
// inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray());
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private GridRegion MakeRegion(AgentCircuitData aCircuit)
|
private GridRegion MakeRegion(AgentCircuitData aCircuit)
|
||||||
{
|
{
|
||||||
|
@ -465,13 +364,5 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void HandleSendInventory(string module, string[] cmd)
|
|
||||||
{
|
|
||||||
m_Scenes[0].ForEachClient(delegate(IClientAPI client)
|
|
||||||
{
|
|
||||||
RestoreRootFolderContents(client);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Client;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Services.Connectors.Hypergrid;
|
using OpenSim.Services.Connectors.Hypergrid;
|
||||||
|
@ -57,6 +58,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
private string m_HomeURI;
|
private string m_HomeURI;
|
||||||
private bool m_OutboundPermission;
|
private bool m_OutboundPermission;
|
||||||
private string m_ThisGatekeeper;
|
private string m_ThisGatekeeper;
|
||||||
|
private bool m_RestrictInventoryAccessAbroad;
|
||||||
|
|
||||||
// private bool m_Initialized = false;
|
// private bool m_Initialized = false;
|
||||||
|
|
||||||
|
@ -90,6 +92,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
m_HomeURI = thisModuleConfig.GetString("HomeURI", m_HomeURI);
|
m_HomeURI = thisModuleConfig.GetString("HomeURI", m_HomeURI);
|
||||||
m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
|
m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
|
||||||
m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty);
|
m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty);
|
||||||
|
m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!");
|
m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!");
|
||||||
|
@ -105,13 +108,79 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
base.AddRegion(scene);
|
base.AddRegion(scene);
|
||||||
m_assMapper = new HGAssetMapper(scene, m_HomeURI);
|
m_assMapper = new HGAssetMapper(scene, m_HomeURI);
|
||||||
scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem;
|
scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem;
|
||||||
|
scene.EventManager.OnTeleportStart += TeleportStart;
|
||||||
|
scene.EventManager.OnTeleportFail += TeleportFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Event handlers
|
#region Event handlers
|
||||||
|
|
||||||
|
protected override void OnNewClient(IClientAPI client)
|
||||||
|
{
|
||||||
|
base.OnNewClient(client);
|
||||||
|
client.OnCompleteMovementToRegion += new Action<IClientAPI, bool>(OnCompleteMovementToRegion);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void OnCompleteMovementToRegion(IClientAPI client, bool arg2)
|
||||||
|
{
|
||||||
|
//m_log.DebugFormat("[HG INVENTORY ACCESS MODULE]: OnCompleteMovementToRegion of user {0}", client.Name);
|
||||||
|
object sp = null;
|
||||||
|
if (client.Scene.TryGetScenePresence(client.AgentId, out sp))
|
||||||
|
{
|
||||||
|
if (sp is ScenePresence)
|
||||||
|
{
|
||||||
|
AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId);
|
||||||
|
if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
|
||||||
|
{
|
||||||
|
if (m_RestrictInventoryAccessAbroad)
|
||||||
|
{
|
||||||
|
IUserManagement uMan = m_Scene.RequestModuleInterface<IUserManagement>();
|
||||||
|
if (uMan.IsLocalGridUser(client.AgentId))
|
||||||
|
ProcessInventoryForComingHome(client);
|
||||||
|
else
|
||||||
|
ProcessInventoryForArriving(client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout)
|
||||||
|
{
|
||||||
|
if (gridLogout && m_RestrictInventoryAccessAbroad)
|
||||||
|
{
|
||||||
|
IUserManagement uMan = m_Scene.RequestModuleInterface<IUserManagement>();
|
||||||
|
if (uMan != null && uMan.IsLocalGridUser(client.AgentId))
|
||||||
|
{
|
||||||
|
// local grid user
|
||||||
|
ProcessInventoryForHypergriding(client);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Foreigner
|
||||||
|
ProcessInventoryForLeaving(client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void TeleportFail(IClientAPI client, bool gridLogout)
|
||||||
|
{
|
||||||
|
if (gridLogout && m_RestrictInventoryAccessAbroad)
|
||||||
|
{
|
||||||
|
IUserManagement uMan = m_Scene.RequestModuleInterface<IUserManagement>();
|
||||||
|
if (uMan.IsLocalGridUser(client.AgentId))
|
||||||
|
{
|
||||||
|
ProcessInventoryForComingHome(client);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ProcessInventoryForArriving(client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel)
|
public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel)
|
||||||
{
|
{
|
||||||
string userAssetServer = string.Empty;
|
string userAssetServer = string.Empty;
|
||||||
|
@ -236,8 +305,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
protected override InventoryItemBase GetItem(UUID agentID, UUID itemID)
|
protected override InventoryItemBase GetItem(UUID agentID, UUID itemID)
|
||||||
{
|
{
|
||||||
InventoryItemBase item = base.GetItem(agentID, itemID);
|
InventoryItemBase item = base.GetItem(agentID, itemID);
|
||||||
|
@ -248,5 +315,84 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Inventory manipulation upon arriving/leaving
|
||||||
|
|
||||||
|
//
|
||||||
|
// These 2 are for local and foreign users coming back, respectively
|
||||||
|
//
|
||||||
|
|
||||||
|
private void ProcessInventoryForComingHome(IClientAPI client)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[HG INVENTORY ACCESS MODULE]: Restoring root folder for local user {0}", client.Name);
|
||||||
|
if (client is IClientCore)
|
||||||
|
{
|
||||||
|
IClientCore core = (IClientCore)client;
|
||||||
|
IClientInventory inv;
|
||||||
|
|
||||||
|
if (core.TryGet<IClientInventory>(out inv))
|
||||||
|
{
|
||||||
|
InventoryFolderBase root = m_Scene.InventoryService.GetRootFolder(client.AgentId);
|
||||||
|
InventoryCollection content = m_Scene.InventoryService.GetFolderContent(client.AgentId, root.ID);
|
||||||
|
|
||||||
|
inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessInventoryForArriving(IClientAPI client)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// These 2 are for local and foreign users going away respectively
|
||||||
|
//
|
||||||
|
|
||||||
|
private void ProcessInventoryForHypergriding(IClientAPI client)
|
||||||
|
{
|
||||||
|
if (client is IClientCore)
|
||||||
|
{
|
||||||
|
IClientCore core = (IClientCore)client;
|
||||||
|
IClientInventory inv;
|
||||||
|
|
||||||
|
if (core.TryGet<IClientInventory>(out inv))
|
||||||
|
{
|
||||||
|
InventoryFolderBase root = m_Scene.InventoryService.GetRootFolder(client.AgentId);
|
||||||
|
if (root != null)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[HG INVENTORY ACCESS MODULE]: Changing root inventory for user {0}", client.Name);
|
||||||
|
InventoryCollection content = m_Scene.InventoryService.GetFolderContent(client.AgentId, root.ID);
|
||||||
|
List<UUID> fids = new List<UUID>();
|
||||||
|
List<UUID> iids = new List<UUID>();
|
||||||
|
List<InventoryFolderBase> keep = new List<InventoryFolderBase>();
|
||||||
|
|
||||||
|
foreach (InventoryFolderBase f in content.Folders)
|
||||||
|
{
|
||||||
|
if (f.Name != "My Suitcase")
|
||||||
|
{
|
||||||
|
f.Name = f.Name + " (Unavailable)";
|
||||||
|
keep.Add(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// items directly under the root folder
|
||||||
|
foreach (InventoryItemBase it in content.Items)
|
||||||
|
it.Name = it.Name + " (Unavailable)"; ;
|
||||||
|
|
||||||
|
// Send the new names
|
||||||
|
inv.SendBulkUpdateInventory(keep.ToArray(), content.Items.ToArray());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessInventoryForLeaving(IClientAPI client)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -674,9 +674,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
//
|
//
|
||||||
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
|
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
|
||||||
{
|
{
|
||||||
if (so.RootPart.FromFolderID != UUID.Zero && userID == remoteClient.AgentId)
|
if (so.FromFolderID != UUID.Zero && userID == remoteClient.AgentId)
|
||||||
{
|
{
|
||||||
InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID);
|
InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID);
|
||||||
if (f != null)
|
if (f != null)
|
||||||
folder = m_Scene.InventoryService.GetFolder(f);
|
folder = m_Scene.InventoryService.GetFolder(f);
|
||||||
}
|
}
|
||||||
|
@ -1012,7 +1012,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootPart.FromFolderID = item.Folder;
|
so.FromFolderID = item.Folder;
|
||||||
|
|
||||||
// Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
|
// Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
|
||||||
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
|
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
|
||||||
|
@ -1071,7 +1071,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
rootPart.TrimPermissions();
|
rootPart.TrimPermissions();
|
||||||
|
|
||||||
if (isAttachment)
|
if (isAttachment)
|
||||||
so.SetFromItemID(item.ID);
|
so.FromItemID = item.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -297,14 +297,35 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
return m_LocalGridInventoryService.CreateUserInventory(userID);
|
return m_LocalGridInventoryService.CreateUserInventory(userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
|
public List<InventoryFolderBase> GetInventorySkeleton(UUID userID)
|
||||||
{
|
{
|
||||||
return m_LocalGridInventoryService.GetInventorySkeleton(userId);
|
string invURL = GetInventoryServiceURL(userID);
|
||||||
|
|
||||||
|
if (invURL == null) // not there, forward to local inventory connector to resolve
|
||||||
|
return m_LocalGridInventoryService.GetInventorySkeleton(userID);
|
||||||
|
|
||||||
|
IInventoryService connector = GetConnector(invURL);
|
||||||
|
|
||||||
|
return connector.GetInventorySkeleton(userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryCollection GetUserInventory(UUID userID)
|
public InventoryCollection GetUserInventory(UUID userID)
|
||||||
{
|
{
|
||||||
return null;
|
string invURL = GetInventoryServiceURL(userID);
|
||||||
|
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetUserInventory for {0} {1}", userID, invURL);
|
||||||
|
|
||||||
|
if (invURL == null) // not there, forward to local inventory connector to resolve
|
||||||
|
return m_LocalGridInventoryService.GetUserInventory(userID);
|
||||||
|
|
||||||
|
InventoryCollection c = m_Cache.GetUserInventory(userID);
|
||||||
|
if (c != null)
|
||||||
|
return c;
|
||||||
|
|
||||||
|
IInventoryService connector = GetConnector(invURL);
|
||||||
|
c = connector.GetUserInventory(userID);
|
||||||
|
|
||||||
|
m_Cache.Cache(userID, c);
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
|
public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
|
||||||
|
@ -362,8 +383,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (invURL == null) // not there, forward to local inventory connector to resolve
|
if (invURL == null) // not there, forward to local inventory connector to resolve
|
||||||
return m_LocalGridInventoryService.GetFolderContent(userID, folderID);
|
return m_LocalGridInventoryService.GetFolderContent(userID, folderID);
|
||||||
|
|
||||||
IInventoryService connector = GetConnector(invURL);
|
InventoryCollection c = m_Cache.GetFolderContent(userID, folderID);
|
||||||
|
if (c != null)
|
||||||
|
{
|
||||||
|
m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent found content in cache " + folderID);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
IInventoryService connector = GetConnector(invURL);
|
||||||
return connector.GetFolderContent(userID, folderID);
|
return connector.GetFolderContent(userID, folderID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -377,8 +404,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (invURL == null) // not there, forward to local inventory connector to resolve
|
if (invURL == null) // not there, forward to local inventory connector to resolve
|
||||||
return m_LocalGridInventoryService.GetFolderItems(userID, folderID);
|
return m_LocalGridInventoryService.GetFolderItems(userID, folderID);
|
||||||
|
|
||||||
IInventoryService connector = GetConnector(invURL);
|
List<InventoryItemBase> items = m_Cache.GetFolderItems(userID, folderID);
|
||||||
|
if (items != null)
|
||||||
|
{
|
||||||
|
m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems found items in cache " + folderID);
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
IInventoryService connector = GetConnector(invURL);
|
||||||
return connector.GetFolderItems(userID, folderID);
|
return connector.GetFolderItems(userID, folderID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
private static ExpiringCache<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>();
|
private static ExpiringCache<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>();
|
||||||
private static ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>>();
|
private static ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>>();
|
||||||
|
private static ExpiringCache<UUID, InventoryCollection> m_Inventories = new ExpiringCache<UUID, InventoryCollection>();
|
||||||
|
|
||||||
public void Cache(UUID userID, InventoryFolderBase root)
|
public void Cache(UUID userID, InventoryFolderBase root)
|
||||||
{
|
{
|
||||||
|
@ -55,5 +56,55 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Cache(UUID userID, InventoryCollection inv)
|
||||||
|
{
|
||||||
|
lock (m_Inventories)
|
||||||
|
m_Inventories.AddOrUpdate(userID, inv, 120);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryCollection GetUserInventory(UUID userID)
|
||||||
|
{
|
||||||
|
InventoryCollection inv = null;
|
||||||
|
if (m_Inventories.TryGetValue(userID, out inv))
|
||||||
|
return inv;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
||||||
|
{
|
||||||
|
InventoryCollection inv = null;
|
||||||
|
InventoryCollection c;
|
||||||
|
if (m_Inventories.TryGetValue(userID, out inv))
|
||||||
|
{
|
||||||
|
c = new InventoryCollection();
|
||||||
|
c.UserID = userID;
|
||||||
|
|
||||||
|
c.Folders = inv.Folders.FindAll(delegate(InventoryFolderBase f)
|
||||||
|
{
|
||||||
|
return f.ParentID == folderID;
|
||||||
|
});
|
||||||
|
c.Items = inv.Items.FindAll(delegate(InventoryItemBase i)
|
||||||
|
{
|
||||||
|
return i.Folder == folderID;
|
||||||
|
});
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
||||||
|
{
|
||||||
|
InventoryCollection inv = null;
|
||||||
|
if (m_Inventories.TryGetValue(userID, out inv))
|
||||||
|
{
|
||||||
|
List<InventoryItemBase> items = inv.Items.FindAll(delegate(InventoryItemBase i)
|
||||||
|
{
|
||||||
|
return i.Folder == folderID;
|
||||||
|
});
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public InventoryCollection GetUserInventory(UUID userID)
|
public InventoryCollection GetUserInventory(UUID userID)
|
||||||
{
|
{
|
||||||
return null;
|
return m_RemoteConnector.GetUserInventory(userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
|
public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
|
||||||
|
@ -193,11 +193,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
{
|
{
|
||||||
InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID, folderID);
|
InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID, folderID);
|
||||||
|
|
||||||
if (UserManager != null)
|
if (invCol != null && UserManager != null)
|
||||||
{
|
{
|
||||||
// Protect ourselves against the caller subsequently modifying the items list
|
// Protect ourselves against the caller subsequently modifying the items list
|
||||||
List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items);
|
List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items);
|
||||||
|
|
||||||
|
if (items != null && items.Count > 0)
|
||||||
Util.FireAndForget(delegate
|
Util.FireAndForget(delegate
|
||||||
{
|
{
|
||||||
foreach (InventoryItemBase item in items)
|
foreach (InventoryItemBase item in items)
|
||||||
|
|
|
@ -464,7 +464,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
if (d.GroupID == LandData.GroupID)
|
if (d.GroupID == LandData.GroupID)
|
||||||
{
|
{
|
||||||
m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout);
|
m_groupMemberCache.Add(avatar, true, m_groupMemberCacheTimeout);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -472,10 +472,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sp.ControllingClient.IsGroupMember(LandData.GroupID))
|
return sp.ControllingClient.IsGroupMember(LandData.GroupID);
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -506,6 +506,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public delegate void PrimsLoaded(Scene s);
|
public delegate void PrimsLoaded(Scene s);
|
||||||
public event PrimsLoaded OnPrimsLoaded;
|
public event PrimsLoaded OnPrimsLoaded;
|
||||||
|
|
||||||
|
public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout);
|
||||||
|
public event TeleportStart OnTeleportStart;
|
||||||
|
|
||||||
|
public delegate void TeleportFail(IClientAPI client, bool gridLogout);
|
||||||
|
public event TeleportFail OnTeleportFail;
|
||||||
|
|
||||||
public class MoneyTransferArgs : EventArgs
|
public class MoneyTransferArgs : EventArgs
|
||||||
{
|
{
|
||||||
public UUID sender;
|
public UUID sender;
|
||||||
|
@ -2487,5 +2493,48 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TriggerTeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout)
|
||||||
|
{
|
||||||
|
TeleportStart handler = OnTeleportStart;
|
||||||
|
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
foreach (TeleportStart d in handler.GetInvocationList())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
d(client, destination, finalDestination, teleportFlags, gridLogout);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TeleportStart failed - continuing {0} - {1}",
|
||||||
|
e.Message, e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TriggerTeleportFail(IClientAPI client, bool gridLogout)
|
||||||
|
{
|
||||||
|
TeleportFail handler = OnTeleportFail;
|
||||||
|
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
foreach (TeleportFail d in handler.GetInvocationList())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
d(client, gridLogout);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TeleportFail failed - continuing {0} - {1}",
|
||||||
|
e.Message, e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ using OpenMetaverse.Packets;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework;
|
using OpenSim.Region.Framework;
|
||||||
|
using OpenSim.Framework.Client;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||||
|
|
||||||
|
@ -117,20 +118,43 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
public bool AddInventoryItem(InventoryItemBase item)
|
public bool AddInventoryItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
InventoryFolderBase folder;
|
if (item.Folder != UUID.Zero && InventoryService.AddItem(item))
|
||||||
|
|
||||||
if (item.Folder == UUID.Zero)
|
|
||||||
{
|
{
|
||||||
folder = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
|
int userlevel = 0;
|
||||||
if (folder == null)
|
if (Permissions.IsGod(item.Owner))
|
||||||
{
|
{
|
||||||
folder = InventoryService.GetRootFolder(item.Owner);
|
userlevel = 1;
|
||||||
|
}
|
||||||
|
EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel);
|
||||||
|
|
||||||
if (folder == null)
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item.Folder = folder.ID;
|
// OK so either the viewer didn't send a folderID or AddItem failed
|
||||||
|
UUID originalFolder = item.Folder;
|
||||||
|
InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
|
||||||
|
if (f != null)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[AGENT INVENTORY]: Found folder {0} type {1} for item {2}",
|
||||||
|
f.Name, (AssetType)f.Type, item.Name);
|
||||||
|
|
||||||
|
item.Folder = f.ID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f = InventoryService.GetRootFolder(item.Owner);
|
||||||
|
if (f != null)
|
||||||
|
{
|
||||||
|
item.Folder = f.ID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[AGENT INVENTORY]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
|
||||||
|
item.Owner, item.Name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InventoryService.AddItem(item))
|
if (InventoryService.AddItem(item))
|
||||||
|
@ -142,6 +166,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel);
|
EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel);
|
||||||
|
|
||||||
|
if (originalFolder != UUID.Zero)
|
||||||
|
{
|
||||||
|
// Tell the viewer that the item didn't go there
|
||||||
|
ChangePlacement(item, f);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -154,6 +184,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ChangePlacement(InventoryItemBase item, InventoryFolderBase f)
|
||||||
|
{
|
||||||
|
ScenePresence sp = GetScenePresence(item.Owner);
|
||||||
|
if (sp != null)
|
||||||
|
{
|
||||||
|
if (sp.ControllingClient is IClientCore)
|
||||||
|
{
|
||||||
|
IClientCore core = (IClientCore)sp.ControllingClient;
|
||||||
|
IClientInventory inv;
|
||||||
|
|
||||||
|
if (core.TryGet<IClientInventory>(out inv))
|
||||||
|
{
|
||||||
|
InventoryFolderBase parent = new InventoryFolderBase(f.ParentID, f.Owner);
|
||||||
|
parent = InventoryService.GetFolder(parent);
|
||||||
|
inv.SendRemoveInventoryItems(new UUID[] { item.ID });
|
||||||
|
inv.SendBulkUpdateInventory(new InventoryFolderBase[0], new InventoryItemBase[] { item });
|
||||||
|
string message = "The item was placed in folder " + f.Name;
|
||||||
|
if (parent != null)
|
||||||
|
message += " under " + parent.Name;
|
||||||
|
sp.ControllingClient.SendAgentAlertMessage(message, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add the given inventory item to a user's inventory.
|
/// Add the given inventory item to a user's inventory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2085,7 +2140,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||||
|
|
||||||
// sets itemID so client can show item as 'attached' in inventory
|
// sets itemID so client can show item as 'attached' in inventory
|
||||||
grp.SetFromItemID(item.ID);
|
grp.FromItemID = item.ID;
|
||||||
|
|
||||||
if (AddInventoryItem(item))
|
if (AddInventoryItem(item))
|
||||||
remoteClient.SendInventoryItemCreateUpdate(item, 0);
|
remoteClient.SendInventoryItemCreateUpdate(item, 0);
|
||||||
|
|
|
@ -2249,12 +2249,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (rootPart.PhysActor != null)
|
|
||||||
// {
|
|
||||||
// PhysicsScene.RemovePrim(rootPart.PhysActor);
|
|
||||||
// rootPart.PhysActor = null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (UnlinkSceneObject(group, false))
|
if (UnlinkSceneObject(group, false))
|
||||||
{
|
{
|
||||||
EventManager.TriggerObjectBeingRemovedFromScene(group);
|
EventManager.TriggerObjectBeingRemovedFromScene(group);
|
||||||
|
@ -2668,7 +2662,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup grp = sceneObject;
|
SceneObjectGroup grp = sceneObject;
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID);
|
"[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID);
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
|
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
|
||||||
|
|
||||||
|
|
|
@ -775,7 +775,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
set { m_LoopSoundSlavePrims = value; }
|
set { m_LoopSoundSlavePrims = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// The UUID for the Region this Object is in.
|
/// <summary>
|
||||||
|
/// The UUID for the region this object is in.
|
||||||
|
/// </summary>
|
||||||
public UUID RegionUUID
|
public UUID RegionUUID
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -788,6 +790,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The item ID that this object was rezzed from, if applicable.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// If not applicable will be UUID.Zero
|
||||||
|
/// </remarks>
|
||||||
|
public UUID FromItemID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The folder ID that this object was rezzed from, if applicable.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// If not applicable will be UUID.Zero
|
||||||
|
/// </remarks>
|
||||||
|
public UUID FromFolderID { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// ~SceneObjectGroup()
|
// ~SceneObjectGroup()
|
||||||
|
@ -851,18 +869,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFromItemID(UUID AssetId)
|
|
||||||
{
|
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
|
||||||
for (int i = 0; i < parts.Length; i++)
|
|
||||||
parts[i].FromItemID = AssetId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID GetFromItemID()
|
|
||||||
{
|
|
||||||
return m_rootPart.FromItemID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes.
|
/// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1498,7 +1504,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
|
|
||||||
detachedpos = avatar.AbsolutePosition;
|
detachedpos = avatar.AbsolutePosition;
|
||||||
RootPart.FromItemID = UUID.Zero;
|
FromItemID = UUID.Zero;
|
||||||
|
|
||||||
AbsolutePosition = detachedpos;
|
AbsolutePosition = detachedpos;
|
||||||
AttachedAvatar = UUID.Zero;
|
AttachedAvatar = UUID.Zero;
|
||||||
|
@ -3379,6 +3385,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_rootPart.AttachedPos = pos;
|
m_rootPart.AttachedPos = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RootPart.GetStatusSandbox())
|
if (RootPart.GetStatusSandbox())
|
||||||
{
|
{
|
||||||
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
|
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
|
||||||
|
@ -3389,8 +3396,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
|
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AbsolutePosition = pos;
|
|
||||||
|
|
||||||
|
AbsolutePosition = pos;
|
||||||
HasGroupChanged = true;
|
HasGroupChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4032,7 +4039,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public virtual string ExtraToXmlString()
|
public virtual string ExtraToXmlString()
|
||||||
{
|
{
|
||||||
return "<ExtraFromItemID>" + GetFromItemID().ToString() + "</ExtraFromItemID>";
|
return "<ExtraFromItemID>" + FromItemID.ToString() + "</ExtraFromItemID>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ExtraFromXmlString(string xmlstr)
|
public virtual void ExtraFromXmlString(string xmlstr)
|
||||||
|
@ -4044,7 +4051,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
UUID uuid = UUID.Zero;
|
UUID uuid = UUID.Zero;
|
||||||
UUID.TryParse(id, out uuid);
|
UUID.TryParse(id, out uuid);
|
||||||
|
|
||||||
SetFromItemID(uuid);
|
FromItemID = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetOwnerChangeFlag()
|
public void ResetOwnerChangeFlag()
|
||||||
|
|
|
@ -126,9 +126,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Is this sop a root part?
|
/// Is this a root part?
|
||||||
/// </value>
|
/// </value>
|
||||||
|
/// <remarks>
|
||||||
|
/// This will return true even if the whole object is attached to an avatar.
|
||||||
|
/// </remarks>
|
||||||
public bool IsRoot
|
public bool IsRoot
|
||||||
{
|
{
|
||||||
get { return ParentGroup.RootPart == this; }
|
get { return ParentGroup.RootPart == this; }
|
||||||
|
@ -160,15 +162,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// If another thread is simultaneously turning physics off on this part then this refernece could become
|
/// If another thread is simultaneously turning physics off on this part then this refernece could become
|
||||||
/// null at any time.
|
/// null at any time.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public PhysicsActor PhysActor
|
public PhysicsActor PhysActor { get; set; }
|
||||||
{
|
|
||||||
get { return m_physActor; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat("[SOP]: PhysActor set to {0} for {1} {2}", value, Name, UUID);
|
|
||||||
m_physActor = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Xantor 20080528 Sound stuff:
|
//Xantor 20080528 Sound stuff:
|
||||||
// Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
|
// Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
|
||||||
|
@ -189,10 +183,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public uint TimeStampTerse;
|
public uint TimeStampTerse;
|
||||||
|
|
||||||
public UUID FromItemID;
|
|
||||||
|
|
||||||
public UUID FromFolderID;
|
|
||||||
|
|
||||||
// The following two are to hold the attachment data
|
// The following two are to hold the attachment data
|
||||||
// while an object is inworld
|
// while an object is inworld
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
|
@ -275,7 +265,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private bool m_passTouches;
|
private bool m_passTouches;
|
||||||
|
|
||||||
private PhysicsActor m_physActor;
|
|
||||||
protected Vector3 m_acceleration;
|
protected Vector3 m_acceleration;
|
||||||
protected Vector3 m_angularVelocity;
|
protected Vector3 m_angularVelocity;
|
||||||
|
|
||||||
|
@ -1149,6 +1138,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The parent ID of this part.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// If this is a root part which is not attached to an avatar then the value will be 0.
|
||||||
|
/// If this is a root part which is attached to an avatar then the value is the local id of that avatar.
|
||||||
|
/// If this is a child part then the value is the local ID of the root part.
|
||||||
|
/// </remarks>
|
||||||
public uint ParentID
|
public uint ParentID
|
||||||
{
|
{
|
||||||
get { return _parentID; }
|
get { return _parentID; }
|
||||||
|
@ -1847,9 +1844,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// if (VolumeDetectActive)
|
// if (VolumeDetectActive)
|
||||||
// isPhantom = false;
|
// isPhantom = false;
|
||||||
|
|
||||||
// Added clarification.. since A rigid body is an object that you can kick around, etc.
|
|
||||||
// bool RigidBody = isPhysical && !isPhantom;
|
|
||||||
|
|
||||||
// The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition
|
// The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition
|
||||||
// or flexible
|
// or flexible
|
||||||
// if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible))
|
// if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible))
|
||||||
|
@ -1876,7 +1870,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
PhysActor = null;
|
PhysActor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basic Physics can also return null as well as an exception catch.
|
|
||||||
PhysicsActor pa = PhysActor;
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
if (pa != null)
|
if (pa != null)
|
||||||
|
@ -4859,7 +4852,52 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This removes the part from physics
|
/// Adds this part to the physics scene.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This method also sets the PhysActor property.</remarks>
|
||||||
|
/// <param name="rigidBody">Add this prim with a rigid body.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// The physics actor. null if there was a failure.
|
||||||
|
/// </returns>
|
||||||
|
private PhysicsActor AddToPhysics(bool rigidBody)
|
||||||
|
{
|
||||||
|
PhysicsActor pa;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pa = ParentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||||
|
string.Format("{0}/{1}", Name, UUID),
|
||||||
|
Shape,
|
||||||
|
AbsolutePosition,
|
||||||
|
Scale,
|
||||||
|
RotationOffset,
|
||||||
|
rigidBody,
|
||||||
|
m_localId);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
|
||||||
|
pa = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: Ideally we wouldn't set the property here to reduce situations where threads changing physical
|
||||||
|
// properties can stop on each other. However, DoPhysicsPropertyUpdate() currently relies on PhysActor
|
||||||
|
// being set.
|
||||||
|
PhysActor = pa;
|
||||||
|
|
||||||
|
// Basic Physics can also return null as well as an exception catch.
|
||||||
|
if (pa != null)
|
||||||
|
{
|
||||||
|
pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
|
||||||
|
pa.SetMaterial(Material);
|
||||||
|
DoPhysicsPropertyUpdate(rigidBody, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pa;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This removes the part from the physics scene.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This isn't the same as turning off physical, since even without being physical the prim has a physics
|
/// This isn't the same as turning off physical, since even without being physical the prim has a physics
|
||||||
|
|
|
@ -3617,6 +3617,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the mass.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>
|
||||||
|
/// The mass.
|
||||||
|
/// </returns>
|
||||||
|
public float GetMass()
|
||||||
|
{
|
||||||
|
PhysicsActor pa = PhysicsActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
|
return pa.Mass;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
internal void PushForce(Vector3 impulse)
|
internal void PushForce(Vector3 impulse)
|
||||||
{
|
{
|
||||||
if (PhysicsActor != null)
|
if (PhysicsActor != null)
|
||||||
|
|
|
@ -1294,7 +1294,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero);
|
OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero);
|
||||||
|
|
||||||
|
|
||||||
// Need to send a group membership update to the client
|
// Need to send a group membership update to the client
|
||||||
// UDP version doesn't seem to behave nicely. But we're going to send it out here
|
// UDP version doesn't seem to behave nicely. But we're going to send it out here
|
||||||
// with an empty group membership to hopefully remove groups being displayed due
|
// with an empty group membership to hopefully remove groups being displayed due
|
||||||
|
@ -1305,6 +1304,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray);
|
SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray);
|
||||||
remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray);
|
remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray);
|
||||||
|
|
||||||
|
if (remoteClient.AgentId == dataForAgentID)
|
||||||
|
remoteClient.RefreshGroupMembership();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2271,11 +2271,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
|
protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if (part.ParentID == 0)
|
|
||||||
|
Vector3 pos;
|
||||||
|
|
||||||
|
if (!part.IsRoot)
|
||||||
{
|
{
|
||||||
return new LSL_Vector(part.AbsolutePosition.X,
|
pos = part.OffsetPosition;
|
||||||
part.AbsolutePosition.Y,
|
|
||||||
part.AbsolutePosition.Z);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2287,11 +2288,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new LSL_Vector(part.OffsetPosition.X,
|
pos = part.AbsolutePosition;
|
||||||
part.OffsetPosition.Y,
|
|
||||||
part.OffsetPosition.Z);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos);
|
||||||
|
|
||||||
|
return new LSL_Vector(pos.X, pos.Y, pos.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSetRot(LSL_Rotation rot)
|
public void llSetRot(LSL_Rotation rot)
|
||||||
|
@ -3165,8 +3168,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Float llGetMass()
|
public LSL_Float llGetMass()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
if (m_host.ParentGroup.IsAttachment)
|
||||||
|
{
|
||||||
|
ScenePresence attachedAvatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
|
||||||
|
|
||||||
|
if (attachedAvatar != null)
|
||||||
|
{
|
||||||
|
return attachedAvatar.GetMass();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_host.IsRoot)
|
||||||
|
{
|
||||||
|
return m_host.ParentGroup.GetMass();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return m_host.GetMass();
|
return m_host.GetMass();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void llCollisionFilter(string name, string id, int accept)
|
public void llCollisionFilter(string name, string id, int accept)
|
||||||
{
|
{
|
||||||
|
@ -3334,7 +3361,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
SceneObjectPart host = (SceneObjectPart)o;
|
SceneObjectPart host = (SceneObjectPart)o;
|
||||||
|
|
||||||
SceneObjectGroup grp = host.ParentGroup;
|
SceneObjectGroup grp = host.ParentGroup;
|
||||||
UUID itemID = grp.GetFromItemID();
|
UUID itemID = grp.FromItemID;
|
||||||
ScenePresence presence = World.GetScenePresence(host.OwnerID);
|
ScenePresence presence = World.GetScenePresence(host.OwnerID);
|
||||||
|
|
||||||
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
||||||
|
@ -7782,14 +7809,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case (int)ScriptBaseClass.PRIM_POSITION:
|
case (int)ScriptBaseClass.PRIM_POSITION:
|
||||||
if (remain < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
v=rules.GetVector3Item(idx++);
|
|
||||||
positionChanged = true;
|
|
||||||
currentPosition = GetSetPosTarget(part, v, currentPosition);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
|
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
|
||||||
if (remain < 1)
|
if (remain < 1)
|
||||||
return;
|
return;
|
||||||
|
@ -11154,6 +11173,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case ScriptBaseClass.OBJECT_CREATOR:
|
case ScriptBaseClass.OBJECT_CREATOR:
|
||||||
ret.Add(new LSL_String(UUID.Zero.ToString()));
|
ret.Add(new LSL_String(UUID.Zero.ToString()));
|
||||||
break;
|
break;
|
||||||
|
// For the following 8 see the Object version below
|
||||||
|
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_SERVER_COST:
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_STREAMING_COST:
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PHYSICS_COST:
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Invalid or unhandled constant.
|
||||||
|
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11191,6 +11239,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case ScriptBaseClass.OBJECT_CREATOR:
|
case ScriptBaseClass.OBJECT_CREATOR:
|
||||||
ret.Add(new LSL_String(obj.CreatorID.ToString()));
|
ret.Add(new LSL_String(obj.CreatorID.ToString()));
|
||||||
break;
|
break;
|
||||||
|
// The following 8 I have intentionaly coded to return zero. They are part of
|
||||||
|
// "Land Impact" calculations. These calculations are probably not applicable
|
||||||
|
// to OpenSim, required figures (cpu/memory usage) are not currently tracked
|
||||||
|
// I have intentionally left these all at zero rather than return possibly
|
||||||
|
// missleading numbers
|
||||||
|
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
|
||||||
|
// in SL this currently includes crashed scripts
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT:
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_SCRIPT_MEMORY:
|
||||||
|
// The value returned in SL for mono scripts is 65536 * number of active scripts
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
||||||
|
// Average cpu time per simulator frame expended on all scripts in the objetc
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
||||||
|
// according to the SL wiki A prim or linkset will have prim
|
||||||
|
// equivalent of the number of prims in a linkset if it does not
|
||||||
|
// contain a mesh anywhere in the link set or is not a normal prim
|
||||||
|
// The value returned in SL for normal prims is prim count
|
||||||
|
ret.Add(new LSL_Integer(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_SERVER_COST:
|
||||||
|
// The value returned in SL for normal prims is prim count
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_STREAMING_COST:
|
||||||
|
// The value returned in SL for normal prims is prim count * 0.06
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
case ScriptBaseClass.OBJECT_PHYSICS_COST:
|
||||||
|
// The value returned in SL for normal prims is prim count
|
||||||
|
ret.Add(new LSL_Float(0));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Invalid or unhandled constant.
|
||||||
|
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -481,6 +481,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int DEBUG_CHANNEL = 0x7FFFFFFF;
|
public const int DEBUG_CHANNEL = 0x7FFFFFFF;
|
||||||
public const int PUBLIC_CHANNEL = 0x00000000;
|
public const int PUBLIC_CHANNEL = 0x00000000;
|
||||||
|
|
||||||
|
// Constants for llGetObjectDetails
|
||||||
|
public const int OBJECT_UNKNOWN_DETAIL = -1;
|
||||||
public const int OBJECT_NAME = 1;
|
public const int OBJECT_NAME = 1;
|
||||||
public const int OBJECT_DESC = 2;
|
public const int OBJECT_DESC = 2;
|
||||||
public const int OBJECT_POS = 3;
|
public const int OBJECT_POS = 3;
|
||||||
|
@ -489,6 +491,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
public const int OBJECT_OWNER = 6;
|
public const int OBJECT_OWNER = 6;
|
||||||
public const int OBJECT_GROUP = 7;
|
public const int OBJECT_GROUP = 7;
|
||||||
public const int OBJECT_CREATOR = 8;
|
public const int OBJECT_CREATOR = 8;
|
||||||
|
public const int OBJECT_RUNNING_SCRIPT_COUNT = 9;
|
||||||
|
public const int OBJECT_TOTAL_SCRIPT_COUNT = 10;
|
||||||
|
public const int OBJECT_SCRIPT_MEMORY = 11;
|
||||||
|
public const int OBJECT_SCRIPT_TIME = 12;
|
||||||
|
public const int OBJECT_PRIM_EQUIVALENCE = 13;
|
||||||
|
public const int OBJECT_SERVER_COST = 14;
|
||||||
|
public const int OBJECT_STREAMING_COST = 15;
|
||||||
|
public const int OBJECT_PHYSICS_COST = 16;
|
||||||
|
|
||||||
// Can not be public const?
|
// Can not be public const?
|
||||||
public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);
|
public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);
|
||||||
|
|
|
@ -114,6 +114,8 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
return HandleCreateUserInventory(request);
|
return HandleCreateUserInventory(request);
|
||||||
case "GETINVENTORYSKELETON":
|
case "GETINVENTORYSKELETON":
|
||||||
return HandleGetInventorySkeleton(request);
|
return HandleGetInventorySkeleton(request);
|
||||||
|
case "GETUSERINVENTORY":
|
||||||
|
return HandleGetUserInventory(request);
|
||||||
case "GETROOTFOLDER":
|
case "GETROOTFOLDER":
|
||||||
return HandleGetRootFolder(request);
|
return HandleGetRootFolder(request);
|
||||||
case "GETFOLDERFORTYPE":
|
case "GETFOLDERFORTYPE":
|
||||||
|
@ -153,7 +155,7 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e);
|
m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
|
@ -248,6 +250,45 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
return encoding.GetBytes(xmlString);
|
return encoding.GetBytes(xmlString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte[] HandleGetUserInventory(Dictionary<string, object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||||
|
UUID principal = UUID.Zero;
|
||||||
|
UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
|
||||||
|
|
||||||
|
InventoryCollection icoll = m_InventoryService.GetUserInventory(principal);
|
||||||
|
if (icoll != null)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> folders = new Dictionary<string, object>();
|
||||||
|
int i = 0;
|
||||||
|
if (icoll.Folders != null)
|
||||||
|
{
|
||||||
|
foreach (InventoryFolderBase f in icoll.Folders)
|
||||||
|
{
|
||||||
|
folders["folder_" + i.ToString()] = EncodeFolder(f);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
result["FOLDERS"] = folders;
|
||||||
|
}
|
||||||
|
if (icoll.Items != null)
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
Dictionary<string, object> items = new Dictionary<string, object>();
|
||||||
|
foreach (InventoryItemBase it in icoll.Items)
|
||||||
|
{
|
||||||
|
items["item_" + i.ToString()] = EncodeItem(it);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
result["ITEMS"] = items;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
byte[] HandleGetRootFolder(Dictionary<string,object> request)
|
byte[] HandleGetRootFolder(Dictionary<string,object> request)
|
||||||
{
|
{
|
||||||
Dictionary<string,object> result = new Dictionary<string,object>();
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
@ -294,13 +335,17 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
{
|
{
|
||||||
Dictionary<string, object> folders = new Dictionary<string, object>();
|
Dictionary<string, object> folders = new Dictionary<string, object>();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
if (icoll.Folders != null)
|
||||||
|
{
|
||||||
foreach (InventoryFolderBase f in icoll.Folders)
|
foreach (InventoryFolderBase f in icoll.Folders)
|
||||||
{
|
{
|
||||||
folders["folder_" + i.ToString()] = EncodeFolder(f);
|
folders["folder_" + i.ToString()] = EncodeFolder(f);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
result["FOLDERS"] = folders;
|
result["FOLDERS"] = folders;
|
||||||
|
}
|
||||||
|
if (icoll.Items != null)
|
||||||
|
{
|
||||||
i = 0;
|
i = 0;
|
||||||
Dictionary<string, object> items = new Dictionary<string, object>();
|
Dictionary<string, object> items = new Dictionary<string, object>();
|
||||||
foreach (InventoryItemBase it in icoll.Items)
|
foreach (InventoryItemBase it in icoll.Items)
|
||||||
|
@ -310,6 +355,7 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
}
|
}
|
||||||
result["ITEMS"] = items;
|
result["ITEMS"] = items;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string xmlString = ServerUtils.BuildXmlResponse(result);
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
|
|
@ -111,19 +111,21 @@ namespace OpenSim.Services.Connectors
|
||||||
if (ret.Count == 0)
|
if (ret.Count == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"];
|
||||||
|
|
||||||
|
List<InventoryFolderBase> fldrs = new List<InventoryFolderBase>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (Object o in ret.Values)
|
foreach (Object o in folders.Values)
|
||||||
folders.Add(BuildFolder((Dictionary<string, object>)o));
|
fldrs.Add(BuildFolder((Dictionary<string, object>)o));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping folder list: {0}", e.Message);
|
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping folder list: {0}", e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return folders;
|
return fldrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryFolderBase GetRootFolder(UUID principalID)
|
public InventoryFolderBase GetRootFolder(UUID principalID)
|
||||||
|
@ -492,12 +494,41 @@ namespace OpenSim.Services.Connectors
|
||||||
return int.Parse(ret["RESULT"].ToString());
|
return int.Parse(ret["RESULT"].ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// These are either obsolete or unused
|
|
||||||
//
|
|
||||||
public InventoryCollection GetUserInventory(UUID principalID)
|
public InventoryCollection GetUserInventory(UUID principalID)
|
||||||
{
|
{
|
||||||
|
InventoryCollection inventory = new InventoryCollection();
|
||||||
|
inventory.Folders = new List<InventoryFolderBase>();
|
||||||
|
inventory.Items = new List<InventoryItemBase>();
|
||||||
|
inventory.UserID = principalID;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Dictionary<string, object> ret = MakeRequest("GETUSERINVENTORY",
|
||||||
|
new Dictionary<string, object> {
|
||||||
|
{ "PRINCIPAL", principalID.ToString() }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ret == null)
|
||||||
return null;
|
return null;
|
||||||
|
if (ret.Count == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
Dictionary<string, object> folders =
|
||||||
|
(Dictionary<string, object>)ret["FOLDERS"];
|
||||||
|
Dictionary<string, object> items =
|
||||||
|
(Dictionary<string, object>)ret["ITEMS"];
|
||||||
|
|
||||||
|
foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
|
||||||
|
inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o));
|
||||||
|
foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i
|
||||||
|
inventory.Items.Add(BuildItem((Dictionary<string, object>)o));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetUserInventory: {0}", e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetUserInventory(UUID principalID, InventoryReceiptCallback callback)
|
public void GetUserInventory(UUID principalID, InventoryReceiptCallback callback)
|
||||||
|
|
|
@ -105,6 +105,12 @@ namespace OpenSim.Services.HypergridService
|
||||||
return new List<InventoryFolderBase>();
|
return new List<InventoryFolderBase>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override InventoryCollection GetUserInventory(UUID userID)
|
||||||
|
{
|
||||||
|
// NOGO for this inventory service
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public override InventoryFolderBase GetRootFolder(UUID principalID)
|
public override InventoryFolderBase GetRootFolder(UUID principalID)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[HG INVENTORY SERVICE]: GetRootFolder for {0}", principalID);
|
//m_log.DebugFormat("[HG INVENTORY SERVICE]: GetRootFolder for {0}", principalID);
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace OpenSim.Services.HypergridService
|
||||||
|
|
||||||
private UserAccountCache m_Cache;
|
private UserAccountCache m_Cache;
|
||||||
|
|
||||||
private ExpiringCache<UUID, List<XInventoryFolder>> m_SuitcaseTrees = new ExpiringCache<UUID,List<XInventoryFolder>>();
|
private ExpiringCache<UUID, List<XInventoryFolder>> m_SuitcaseTrees = new ExpiringCache<UUID, List<XInventoryFolder>>();
|
||||||
|
|
||||||
public HGSuitcaseInventoryService(IConfigSource config, string configName)
|
public HGSuitcaseInventoryService(IConfigSource config, string configName)
|
||||||
: base(config, configName)
|
: base(config, configName)
|
||||||
|
@ -104,11 +104,72 @@ namespace OpenSim.Services.HypergridService
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override List<InventoryFolderBase> GetInventorySkeleton(UUID principalID)
|
public override List<InventoryFolderBase> GetInventorySkeleton(UUID principalID)
|
||||||
{
|
{
|
||||||
// NOGO for this inventory service
|
XInventoryFolder suitcase = GetSuitcaseXFolder(principalID);
|
||||||
return new List<InventoryFolderBase>();
|
XInventoryFolder root = GetRootXFolder(principalID);
|
||||||
|
|
||||||
|
List<XInventoryFolder> tree = GetFolderTree(suitcase.folderID);
|
||||||
|
if (tree == null || (tree != null && tree.Count == 0))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
||||||
|
foreach (XInventoryFolder x in tree)
|
||||||
|
{
|
||||||
|
folders.Add(ConvertToOpenSim(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
SetAsRootFolder(suitcase, root);
|
||||||
|
folders.Add(ConvertToOpenSim(suitcase));
|
||||||
|
|
||||||
|
return folders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override InventoryCollection GetUserInventory(UUID userID)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Get Suitcase inventory for user {0}", userID);
|
||||||
|
InventoryCollection userInventory = new InventoryCollection();
|
||||||
|
userInventory.UserID = userID;
|
||||||
|
userInventory.Folders = new List<InventoryFolderBase>();
|
||||||
|
userInventory.Items = new List<InventoryItemBase>();
|
||||||
|
|
||||||
|
XInventoryFolder suitcase = GetSuitcaseXFolder(userID);
|
||||||
|
XInventoryFolder root = GetRootXFolder(userID);
|
||||||
|
|
||||||
|
List<XInventoryFolder> tree = GetFolderTree(suitcase.folderID);
|
||||||
|
if (tree == null || (tree != null && tree.Count == 0))
|
||||||
|
{
|
||||||
|
SetAsRootFolder(suitcase, root);
|
||||||
|
userInventory.Folders.Add(ConvertToOpenSim(suitcase));
|
||||||
|
return userInventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<InventoryItemBase> items;
|
||||||
|
foreach (XInventoryFolder f in tree)
|
||||||
|
{
|
||||||
|
// Add the items of this subfolder
|
||||||
|
items = GetFolderItems(userID, f.folderID);
|
||||||
|
if (items != null && items.Count > 0)
|
||||||
|
{
|
||||||
|
userInventory.Items.AddRange(items);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the folder itself
|
||||||
|
userInventory.Folders.Add(ConvertToOpenSim(f));
|
||||||
|
}
|
||||||
|
|
||||||
|
items = GetFolderItems(userID, suitcase.folderID);
|
||||||
|
if (items != null && items.Count > 0)
|
||||||
|
{
|
||||||
|
userInventory.Items.AddRange(items);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetAsRootFolder(suitcase, root);
|
||||||
|
userInventory.Folders.Add(ConvertToOpenSim(suitcase));
|
||||||
|
|
||||||
|
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetUserInventory for user {0} returning {1} folders and {2} items",
|
||||||
|
userID, userInventory.Folders.Count, userInventory.Items.Count);
|
||||||
|
return userInventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override InventoryFolderBase GetRootFolder(UUID principalID)
|
public override InventoryFolderBase GetRootFolder(UUID principalID)
|
||||||
|
@ -131,51 +192,92 @@ namespace OpenSim.Services.HypergridService
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder. Creating it...", principalID);
|
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder. Creating it...", principalID);
|
||||||
// make one, and let's add it to the user's inventory as a direct child of the root folder
|
// make one, and let's add it to the user's inventory as a direct child of the root folder
|
||||||
|
// In the DB we tag it as type 100, but we use -1 (Unknown) outside
|
||||||
suitcase = CreateFolder(principalID, root.folderID, 100, "My Suitcase");
|
suitcase = CreateFolder(principalID, root.folderID, 100, "My Suitcase");
|
||||||
if (suitcase == null)
|
if (suitcase == null)
|
||||||
m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder");
|
m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder");
|
||||||
|
|
||||||
m_Database.StoreFolder(suitcase);
|
m_Database.StoreFolder(suitcase);
|
||||||
|
|
||||||
|
// Create System folders
|
||||||
|
CreateSystemFolders(principalID, suitcase.folderID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now let's change the folder ID to match that of the real root folder
|
SetAsRootFolder(suitcase, root);
|
||||||
SetAsRootFolder(suitcase, root.folderID);
|
|
||||||
|
|
||||||
return ConvertToOpenSim(suitcase);
|
return ConvertToOpenSim(suitcase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void CreateSystemFolders(UUID principalID, UUID rootID)
|
||||||
|
{
|
||||||
|
m_log.Debug("[HG SUITCASE INVENTORY SERVICE]: Creating System folders under Suitcase...");
|
||||||
|
XInventoryFolder[] sysFolders = GetSystemFolders(principalID, rootID);
|
||||||
|
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Animation) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.Animation, "Animations");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Bodypart) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.Bodypart, "Body Parts");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.CallingCard) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.CallingCard, "Calling Cards");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.Clothing, "Clothing");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.Gesture, "Gestures");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.Landmark, "Landmarks");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.LostAndFoundFolder) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.LostAndFoundFolder, "Lost And Found");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Notecard) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.Notecard, "Notecards");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Object) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.Object, "Objects");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.SnapshotFolder) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.SnapshotFolder, "Photo Album");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.LSLText) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.LSLText, "Scripts");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Sound) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.Sound, "Sounds");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Texture) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.Texture, "Textures");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.TrashFolder, "Trash");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.FavoriteFolder) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.FavoriteFolder, "Favorites");
|
||||||
|
if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.CurrentOutfitFolder) return true; return false; }))
|
||||||
|
CreateFolder(principalID, rootID, (int)AssetType.CurrentOutfitFolder, "Current Outfit");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
|
public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type);
|
//m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type);
|
||||||
return GetRootFolder(principalID);
|
XInventoryFolder suitcase = GetSuitcaseXFolder(principalID);
|
||||||
|
XInventoryFolder[] folders = m_Database.GetFolders(
|
||||||
|
new string[] { "agentID", "type", "parentFolderID" },
|
||||||
|
new string[] { principalID.ToString(), ((int)type).ToString(), suitcase.folderID.ToString() });
|
||||||
|
|
||||||
|
if (folders.Length == 0)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no folder for type {0} for user {1}", type, principalID);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[HG SUITCASE INVENTORY SERVICE]: Found folder {0} {1} for type {2} for user {3}",
|
||||||
|
folders[0].folderName, folders[0].folderID, type, principalID);
|
||||||
|
|
||||||
|
return ConvertToOpenSim(folders[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
|
public override InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
|
||||||
{
|
{
|
||||||
InventoryCollection coll = null;
|
InventoryCollection coll = null;
|
||||||
XInventoryFolder suitcase = GetSuitcaseXFolder(principalID);
|
XInventoryFolder suitcase = GetSuitcaseXFolder(principalID);
|
||||||
XInventoryFolder root = GetRootXFolder(principalID);
|
|
||||||
|
|
||||||
if (!IsWithinSuitcaseTree(folderID, root, suitcase))
|
if (!IsWithinSuitcaseTree(folderID, suitcase))
|
||||||
return new InventoryCollection();
|
return new InventoryCollection();
|
||||||
|
|
||||||
if (folderID == root.folderID) // someone's asking for the root folder, we'll give them the suitcase
|
|
||||||
{
|
|
||||||
if (suitcase != null)
|
|
||||||
{
|
|
||||||
coll = base.GetFolderContent(principalID, suitcase.folderID);
|
|
||||||
foreach (InventoryFolderBase f in coll.Folders)
|
|
||||||
f.ParentID = root.folderID;
|
|
||||||
foreach (InventoryItemBase i in coll.Items)
|
|
||||||
i.Folder = root.folderID;
|
|
||||||
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent for root folder returned content for suitcase folder");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
coll = base.GetFolderContent(principalID, folderID);
|
coll = base.GetFolderContent(principalID, folderID);
|
||||||
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent for non-root folder {0}", folderID);
|
|
||||||
}
|
|
||||||
if (coll == null)
|
if (coll == null)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Something wrong with user {0}'s suitcase folder", principalID);
|
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Something wrong with user {0}'s suitcase folder", principalID);
|
||||||
|
@ -188,10 +290,9 @@ namespace OpenSim.Services.HypergridService
|
||||||
{
|
{
|
||||||
// Let's do a bit of sanity checking, more than the base service does
|
// Let's do a bit of sanity checking, more than the base service does
|
||||||
// make sure the given folder exists under the suitcase tree of this user
|
// make sure the given folder exists under the suitcase tree of this user
|
||||||
XInventoryFolder root = GetRootXFolder(principalID);
|
|
||||||
XInventoryFolder suitcase = GetSuitcaseXFolder(principalID);
|
XInventoryFolder suitcase = GetSuitcaseXFolder(principalID);
|
||||||
|
|
||||||
if (!IsWithinSuitcaseTree(folderID, root, suitcase))
|
if (!IsWithinSuitcaseTree(folderID, suitcase))
|
||||||
return new List<InventoryItemBase>();
|
return new List<InventoryItemBase>();
|
||||||
|
|
||||||
return base.GetFolderItems(principalID, folderID);
|
return base.GetFolderItems(principalID, folderID);
|
||||||
|
@ -199,52 +300,40 @@ namespace OpenSim.Services.HypergridService
|
||||||
|
|
||||||
public override bool AddFolder(InventoryFolderBase folder)
|
public override bool AddFolder(InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
|
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID);
|
||||||
// Let's do a bit of sanity checking, more than the base service does
|
// Let's do a bit of sanity checking, more than the base service does
|
||||||
// make sure the given folder's parent folder exists under the suitcase tree of this user
|
// make sure the given folder's parent folder exists under the suitcase tree of this user
|
||||||
XInventoryFolder root = GetRootXFolder(folder.Owner);
|
|
||||||
XInventoryFolder suitcase = GetSuitcaseXFolder(folder.Owner);
|
XInventoryFolder suitcase = GetSuitcaseXFolder(folder.Owner);
|
||||||
|
|
||||||
if (!IsWithinSuitcaseTree(folder.ParentID, root, suitcase))
|
if (!IsWithinSuitcaseTree(folder.ParentID, suitcase))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// OK, it's legit
|
// OK, it's legit
|
||||||
// Check if it's under the Root folder directly
|
|
||||||
if (folder.ParentID == root.folderID)
|
|
||||||
{
|
|
||||||
// someone's trying to add a subfolder of the root folder, we'll add it to the suitcase instead
|
|
||||||
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder for root folder for user {0}. Adding in suitcase instead", folder.Owner);
|
|
||||||
folder.ParentID = suitcase.folderID;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.AddFolder(folder);
|
return base.AddFolder(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateFolder(InventoryFolderBase folder)
|
public override bool UpdateFolder(InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
XInventoryFolder root = GetRootXFolder(folder.Owner);
|
|
||||||
XInventoryFolder suitcase = GetSuitcaseXFolder(folder.Owner);
|
XInventoryFolder suitcase = GetSuitcaseXFolder(folder.Owner);
|
||||||
|
|
||||||
if (!IsWithinSuitcaseTree(folder.ID, root, suitcase))
|
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version);
|
||||||
|
if (!IsWithinSuitcaseTree(folder.ID, suitcase))
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For all others
|
||||||
return base.UpdateFolder(folder);
|
return base.UpdateFolder(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool MoveFolder(InventoryFolderBase folder)
|
public override bool MoveFolder(InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
XInventoryFolder root = GetRootXFolder(folder.Owner);
|
|
||||||
XInventoryFolder suitcase = GetSuitcaseXFolder(folder.Owner);
|
XInventoryFolder suitcase = GetSuitcaseXFolder(folder.Owner);
|
||||||
|
|
||||||
if (!IsWithinSuitcaseTree(folder.ID, root, suitcase) || !IsWithinSuitcaseTree(folder.ParentID, root, suitcase))
|
if (!IsWithinSuitcaseTree(folder.ID, suitcase) || !IsWithinSuitcaseTree(folder.ParentID, suitcase))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (folder.ParentID == root.folderID)
|
|
||||||
{
|
|
||||||
// someone's trying to add a subfolder of the root folder, we'll add it to the suitcase instead
|
|
||||||
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder to root folder for user {0}. Moving it to suitcase instead", folder.Owner);
|
|
||||||
folder.ParentID = suitcase.folderID;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.MoveFolder(folder);
|
return base.MoveFolder(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,31 +353,21 @@ namespace OpenSim.Services.HypergridService
|
||||||
{
|
{
|
||||||
// Let's do a bit of sanity checking, more than the base service does
|
// Let's do a bit of sanity checking, more than the base service does
|
||||||
// make sure the given folder's parent folder exists under the suitcase tree of this user
|
// make sure the given folder's parent folder exists under the suitcase tree of this user
|
||||||
XInventoryFolder root = GetRootXFolder(item.Owner);
|
|
||||||
XInventoryFolder suitcase = GetSuitcaseXFolder(item.Owner);
|
XInventoryFolder suitcase = GetSuitcaseXFolder(item.Owner);
|
||||||
|
|
||||||
if (!IsWithinSuitcaseTree(item.Folder, root, suitcase))
|
if (!IsWithinSuitcaseTree(item.Folder, suitcase))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// OK, it's legit
|
// OK, it's legit
|
||||||
// Check if it's under the Root folder directly
|
|
||||||
if (item.Folder == root.folderID)
|
|
||||||
{
|
|
||||||
// someone's trying to add a subfolder of the root folder, we'll add it to the suitcase instead
|
|
||||||
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddItem for root folder for user {0}. Adding in suitcase instead", item.Owner);
|
|
||||||
item.Folder = suitcase.folderID;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.AddItem(item);
|
return base.AddItem(item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool UpdateItem(InventoryItemBase item)
|
public override bool UpdateItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
XInventoryFolder root = GetRootXFolder(item.Owner);
|
|
||||||
XInventoryFolder suitcase = GetSuitcaseXFolder(item.Owner);
|
XInventoryFolder suitcase = GetSuitcaseXFolder(item.Owner);
|
||||||
|
|
||||||
if (!IsWithinSuitcaseTree(item.Folder, root, suitcase))
|
if (!IsWithinSuitcaseTree(item.Folder, suitcase))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return base.UpdateItem(item);
|
return base.UpdateItem(item);
|
||||||
|
@ -298,43 +377,43 @@ namespace OpenSim.Services.HypergridService
|
||||||
{
|
{
|
||||||
// Principal is b0rked. *sigh*
|
// Principal is b0rked. *sigh*
|
||||||
|
|
||||||
XInventoryFolder root = GetRootXFolder(items[0].Owner);
|
|
||||||
XInventoryFolder suitcase = GetSuitcaseXFolder(items[0].Owner);
|
XInventoryFolder suitcase = GetSuitcaseXFolder(items[0].Owner);
|
||||||
|
|
||||||
if (!IsWithinSuitcaseTree(items[0].Folder, root, suitcase))
|
if (!IsWithinSuitcaseTree(items[0].Folder, suitcase))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach (InventoryItemBase it in items)
|
|
||||||
if (it.Folder == root.folderID)
|
|
||||||
{
|
|
||||||
// someone's trying to add a subfolder of the root folder, we'll add it to the suitcase instead
|
|
||||||
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItem to root folder for user {0}. Moving it to suitcase instead", it.Owner);
|
|
||||||
it.Folder = suitcase.folderID;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.MoveItems(principalID, items);
|
return base.MoveItems(principalID, items);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let these pass. Use inherited methods.
|
|
||||||
public override bool DeleteItems(UUID principalID, List<UUID> itemIDs)
|
public override bool DeleteItems(UUID principalID, List<UUID> itemIDs)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override InventoryItemBase GetItem(InventoryItemBase item)
|
public new InventoryItemBase GetItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
InventoryItemBase it = base.GetItem(item);
|
InventoryItemBase it = base.GetItem(item);
|
||||||
XInventoryFolder root = GetRootXFolder(it.Owner);
|
if (it == null)
|
||||||
XInventoryFolder suitcase = GetSuitcaseXFolder(it.Owner);
|
|
||||||
|
|
||||||
if (it != null)
|
|
||||||
{
|
{
|
||||||
if (!IsWithinSuitcaseTree(it.Folder, root, suitcase))
|
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve item {0} ({1}) in folder {2}",
|
||||||
|
item.Name, item.ID, item.Folder);
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
XInventoryFolder suitcase = GetSuitcaseXFolder(it.Owner);
|
||||||
|
if (suitcase == null)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Root or Suitcase are null for user {0}",
|
||||||
|
it.Owner);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (it.Folder == suitcase.folderID)
|
if (!IsWithinSuitcaseTree(it.Folder, suitcase))
|
||||||
it.Folder = root.folderID;
|
{
|
||||||
|
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase",
|
||||||
|
it.Name, it.Folder);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// UserAccount user = m_Cache.GetUser(it.CreatorId);
|
// UserAccount user = m_Cache.GetUser(it.CreatorId);
|
||||||
|
|
||||||
|
@ -342,24 +421,20 @@ namespace OpenSim.Services.HypergridService
|
||||||
// if (user != null && it != null && (it.CreatorData == null || it.CreatorData == string.Empty))
|
// if (user != null && it != null && (it.CreatorData == null || it.CreatorData == string.Empty))
|
||||||
// it.CreatorData = m_HomeURL + ";" + user.FirstName + " " + user.LastName;
|
// it.CreatorData = m_HomeURL + ";" + user.FirstName + " " + user.LastName;
|
||||||
//}
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
public new InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
InventoryFolderBase f = base.GetFolder(folder);
|
InventoryFolderBase f = base.GetFolder(folder);
|
||||||
XInventoryFolder root = GetRootXFolder(f.Owner);
|
|
||||||
XInventoryFolder suitcase = GetSuitcaseXFolder(f.Owner);
|
|
||||||
|
|
||||||
if (f != null)
|
if (f != null)
|
||||||
{
|
{
|
||||||
if (!IsWithinSuitcaseTree(f.ID, root, suitcase))
|
XInventoryFolder suitcase = GetSuitcaseXFolder(f.Owner);
|
||||||
return null;
|
|
||||||
|
|
||||||
if (f.ParentID == suitcase.folderID)
|
if (!IsWithinSuitcaseTree(f.ID, suitcase))
|
||||||
f.ParentID = root.folderID;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
|
@ -409,20 +484,19 @@ namespace OpenSim.Services.HypergridService
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAsRootFolder(XInventoryFolder suitcase, UUID rootID)
|
private void SetAsRootFolder(XInventoryFolder suitcase, XInventoryFolder root)
|
||||||
{
|
{
|
||||||
suitcase.folderID = rootID;
|
suitcase.type = (short)AssetType.Folder;
|
||||||
suitcase.parentFolderID = UUID.Zero;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<XInventoryFolder> GetFolderTree(UUID root)
|
private List<XInventoryFolder> GetFolderTree(UUID folder)
|
||||||
{
|
{
|
||||||
List<XInventoryFolder> t = null;
|
List<XInventoryFolder> t = null;
|
||||||
if (m_SuitcaseTrees.TryGetValue(root, out t))
|
if (m_SuitcaseTrees.TryGetValue(folder, out t))
|
||||||
return t;
|
return t;
|
||||||
|
|
||||||
t = GetFolderTreeRecursive(root);
|
t = GetFolderTreeRecursive(folder);
|
||||||
m_SuitcaseTrees.AddOrUpdate(root, t, 120);
|
m_SuitcaseTrees.AddOrUpdate(folder, t, 120);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,10 +521,17 @@ namespace OpenSim.Services.HypergridService
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsWithinSuitcaseTree(UUID folderID, XInventoryFolder root, XInventoryFolder suitcase)
|
/// <summary>
|
||||||
|
/// Return true if the folderID is a subfolder of the Suitcase or the suitcase folder itself
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="folderID"></param>
|
||||||
|
/// <param name="root"></param>
|
||||||
|
/// <param name="suitcase"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private bool IsWithinSuitcaseTree(UUID folderID, XInventoryFolder suitcase)
|
||||||
{
|
{
|
||||||
List<XInventoryFolder> tree = new List<XInventoryFolder>();
|
List<XInventoryFolder> tree = new List<XInventoryFolder>();
|
||||||
tree.Add(root); // Warp! the tree is the real root folder plus the children of the suitcase folder
|
tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder
|
||||||
tree.AddRange(GetFolderTree(suitcase.folderID));
|
tree.AddRange(GetFolderTree(suitcase.folderID));
|
||||||
XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl)
|
XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl)
|
||||||
{
|
{
|
||||||
|
@ -463,4 +544,5 @@ namespace OpenSim.Services.HypergridService
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,9 @@ namespace OpenSim.Services.InventoryService
|
||||||
{
|
{
|
||||||
public class XInventoryService : ServiceBase, IInventoryService
|
public class XInventoryService : ServiceBase, IInventoryService
|
||||||
{
|
{
|
||||||
// private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
// LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
// MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected IXInventoryData m_Database;
|
protected IXInventoryData m_Database;
|
||||||
protected bool m_AllowDelete = true;
|
protected bool m_AllowDelete = true;
|
||||||
|
@ -113,7 +113,7 @@ namespace OpenSim.Services.InventoryService
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
XInventoryFolder[] sysFolders = GetSystemFolders(principalID);
|
XInventoryFolder[] sysFolders = GetSystemFolders(principalID, rootFolder.ID);
|
||||||
|
|
||||||
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Animation) return true; return false; }))
|
if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Animation) return true; return false; }))
|
||||||
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Animation, "Animations");
|
CreateFolder(principalID, rootFolder.ID, (int)AssetType.Animation, "Animations");
|
||||||
|
@ -163,13 +163,13 @@ namespace OpenSim.Services.InventoryService
|
||||||
return newFolder;
|
return newFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual XInventoryFolder[] GetSystemFolders(UUID principalID)
|
protected virtual XInventoryFolder[] GetSystemFolders(UUID principalID, UUID rootID)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting system folders for {0}", principalID);
|
// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting system folders for {0}", principalID);
|
||||||
|
|
||||||
XInventoryFolder[] allFolders = m_Database.GetFolders(
|
XInventoryFolder[] allFolders = m_Database.GetFolders(
|
||||||
new string[] { "agentID" },
|
new string[] { "agentID", "parentFolderID" },
|
||||||
new string[] { principalID.ToString() });
|
new string[] { principalID.ToString(), rootID.ToString() });
|
||||||
|
|
||||||
XInventoryFolder[] sysFolders = Array.FindAll(
|
XInventoryFolder[] sysFolders = Array.FindAll(
|
||||||
allFolders,
|
allFolders,
|
||||||
|
@ -301,16 +301,26 @@ namespace OpenSim.Services.InventoryService
|
||||||
|
|
||||||
public virtual bool AddFolder(InventoryFolderBase folder)
|
public virtual bool AddFolder(InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
|
//m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID);
|
||||||
InventoryFolderBase check = GetFolder(folder);
|
InventoryFolderBase check = GetFolder(folder);
|
||||||
if (check != null)
|
if (check != null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (folder.Type == (short)AssetType.Folder || folder.Type == (short)AssetType.Unknown ||
|
||||||
|
GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null)
|
||||||
|
{
|
||||||
XInventoryFolder xFolder = ConvertFromOpenSim(folder);
|
XInventoryFolder xFolder = ConvertFromOpenSim(folder);
|
||||||
return m_Database.StoreFolder(xFolder);
|
return m_Database.StoreFolder(xFolder);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
m_log.DebugFormat("[XINVENTORY]: Folder {0} of type {1} already exists", folder.Name, folder.Type);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool UpdateFolder(InventoryFolderBase folder)
|
public virtual bool UpdateFolder(InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
|
//m_log.DebugFormat("[XINVENTORY]: Update folder {0} {1} ({2})", folder.Name, folder.Type, folder.ID);
|
||||||
XInventoryFolder xFolder = ConvertFromOpenSim(folder);
|
XInventoryFolder xFolder = ConvertFromOpenSim(folder);
|
||||||
InventoryFolderBase check = GetFolder(folder);
|
InventoryFolderBase check = GetFolder(folder);
|
||||||
if (check == null)
|
if (check == null)
|
||||||
|
@ -319,9 +329,13 @@ namespace OpenSim.Services.InventoryService
|
||||||
if (check.Type != -1 || xFolder.type != -1)
|
if (check.Type != -1 || xFolder.type != -1)
|
||||||
{
|
{
|
||||||
if (xFolder.version < check.Version)
|
if (xFolder.version < check.Version)
|
||||||
|
{
|
||||||
|
//m_log.DebugFormat("[XINVENTORY]: {0} < {1} can't do", xFolder.version, check.Version);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
check.Version = (ushort)xFolder.version;
|
check.Version = (ushort)xFolder.version;
|
||||||
xFolder = ConvertFromOpenSim(check);
|
xFolder = ConvertFromOpenSim(check);
|
||||||
|
//m_log.DebugFormat("[XINVENTORY]: Storing {0} {1} {2}", xFolder.folderName, xFolder.version, xFolder.type);
|
||||||
return m_Database.StoreFolder(xFolder);
|
return m_Database.StoreFolder(xFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,13 +513,30 @@ namespace OpenSim.Services.InventoryService
|
||||||
return m_Database.GetAssetPermissions(principalID, assetID);
|
return m_Database.GetAssetPermissions(principalID, assetID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CM never needed those. Left unimplemented.
|
public virtual InventoryCollection GetUserInventory(UUID userID)
|
||||||
// Obsolete in core
|
|
||||||
//
|
|
||||||
public InventoryCollection GetUserInventory(UUID userID)
|
|
||||||
{
|
{
|
||||||
return null;
|
InventoryCollection userInventory = new InventoryCollection();
|
||||||
|
userInventory.UserID = userID;
|
||||||
|
userInventory.Folders = new List<InventoryFolderBase>();
|
||||||
|
userInventory.Items = new List<InventoryItemBase>();
|
||||||
|
|
||||||
|
List<InventoryFolderBase> skel = GetInventorySkeleton(userID);
|
||||||
|
if (skel != null)
|
||||||
|
{
|
||||||
|
foreach (InventoryFolderBase f in skel)
|
||||||
|
{
|
||||||
|
InventoryCollection c = GetFolderContent(userID, f.ID);
|
||||||
|
if (c != null && c.Items != null && c.Items.Count > 0)
|
||||||
|
userInventory.Items.AddRange(c.Items);
|
||||||
|
if (c != null && c.Folders != null && c.Folders.Count > 0)
|
||||||
|
userInventory.Folders.AddRange(c.Folders);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
m_log.DebugFormat("[XINVENTORY SERVICE]: GetUserInventory for user {0} returning {1} folders and {2} items",
|
||||||
|
userID, userInventory.Folders.Count, userInventory.Items.Count);
|
||||||
|
return userInventory;
|
||||||
|
}
|
||||||
|
|
||||||
public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
|
public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -525,6 +556,9 @@ namespace OpenSim.Services.InventoryService
|
||||||
|
|
||||||
newFolder.ParentID = folder.parentFolderID;
|
newFolder.ParentID = folder.parentFolderID;
|
||||||
newFolder.Type = (short)folder.type;
|
newFolder.Type = (short)folder.type;
|
||||||
|
// Viewer can't understand anything that's not in it's LLFolderType enum
|
||||||
|
if (newFolder.Type == 100)
|
||||||
|
newFolder.Type = -1;
|
||||||
newFolder.Version = (ushort)folder.version;
|
newFolder.Version = (ushort)folder.version;
|
||||||
newFolder.Name = folder.folderName;
|
newFolder.Name = folder.folderName;
|
||||||
newFolder.Owner = folder.agentID;
|
newFolder.Owner = folder.agentID;
|
||||||
|
|
Loading…
Reference in New Issue