From a979808493b20362ab3fe06ac68e5370622ceafa Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 14 Aug 2007 19:19:09 +0000 Subject: preliminary support for editing notecards and scripts. Although there seems to sometimes be a problem of when you login again, old notecards and scripts will have their permissions messed up and you won't be able to even view their text. This seems to be related to the client's cache, and if you clear your client's cache, on the next login they should be fine again. [I have a couple of ideas about what might be causing this so hopefully will have it fixed soon.] --- OpenSim/Region/Environment/Scenes/Scene.cs | 45 ++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 73133d4..bfc3ee8 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -827,6 +827,7 @@ namespace OpenSim.Region.Environment.Scenes agent.CapsPath, agent.AgentID); cap.RegisterHandlers(); cap.AddNewInventoryItem = this.AddInventoryItem; + cap.ItemUpdatedCall = this.UpdateInventoryItemAsset; if (capsHandlers.ContainsKey(agent.AgentID)) { MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + @@ -1023,7 +1024,7 @@ namespace OpenSim.Region.Environment.Scenes { ScriptEngines.Add(ScriptEngine); - ScriptEngine.InitializeEngine(this, m_logger); + ScriptEngine.InitializeEngine(this, m_logger); } #endregion @@ -1046,7 +1047,7 @@ namespace OpenSim.Region.Environment.Scenes public void AddInventoryItem(LLUUID userID, InventoryItemBase item) { - if(this.Avatars.ContainsKey(userID)) + if (this.Avatars.ContainsKey(userID)) { this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); } @@ -1062,5 +1063,45 @@ namespace OpenSim.Region.Environment.Scenes } } + public LLUUID UpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data) + { + if (this.Avatars.ContainsKey(userID)) + { + return this.UpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data); + } + return LLUUID.Zero; + } + + public LLUUID UpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) + { + CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); + if (userInfo != null) + { + if (userInfo.RootFolder != null) + { + InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); + if (item != null) + { + AssetBase asset; + asset = new AssetBase(); + asset.FullID = LLUUID.Random(); + asset.Type = (sbyte)item.assetType; + asset.InvType = (sbyte)item.invType; + asset.Name = item.inventoryName; + asset.Data = data; + this.assetCache.AddAsset(asset); + + item.assetID = asset.FullID; + userInfo.updateItem(remoteClient.AgentId, item); + + remoteClient.SendInventoryItemUpdate(item); + + return (asset.FullID); + } + } + } + return LLUUID.Zero; + } + } } -- cgit v1.1