diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 45 |
1 files changed, 43 insertions, 2 deletions
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 | |||
827 | agent.CapsPath, agent.AgentID); | 827 | agent.CapsPath, agent.AgentID); |
828 | cap.RegisterHandlers(); | 828 | cap.RegisterHandlers(); |
829 | cap.AddNewInventoryItem = this.AddInventoryItem; | 829 | cap.AddNewInventoryItem = this.AddInventoryItem; |
830 | cap.ItemUpdatedCall = this.UpdateInventoryItemAsset; | ||
830 | if (capsHandlers.ContainsKey(agent.AgentID)) | 831 | if (capsHandlers.ContainsKey(agent.AgentID)) |
831 | { | 832 | { |
832 | MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + | 833 | MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + |
@@ -1023,7 +1024,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1023 | { | 1024 | { |
1024 | ScriptEngines.Add(ScriptEngine); | 1025 | ScriptEngines.Add(ScriptEngine); |
1025 | 1026 | ||
1026 | ScriptEngine.InitializeEngine(this, m_logger); | 1027 | ScriptEngine.InitializeEngine(this, m_logger); |
1027 | } | 1028 | } |
1028 | #endregion | 1029 | #endregion |
1029 | 1030 | ||
@@ -1046,7 +1047,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1046 | 1047 | ||
1047 | public void AddInventoryItem(LLUUID userID, InventoryItemBase item) | 1048 | public void AddInventoryItem(LLUUID userID, InventoryItemBase item) |
1048 | { | 1049 | { |
1049 | if(this.Avatars.ContainsKey(userID)) | 1050 | if (this.Avatars.ContainsKey(userID)) |
1050 | { | 1051 | { |
1051 | this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); | 1052 | this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); |
1052 | } | 1053 | } |
@@ -1062,5 +1063,45 @@ namespace OpenSim.Region.Environment.Scenes | |||
1062 | } | 1063 | } |
1063 | } | 1064 | } |
1064 | 1065 | ||
1066 | public LLUUID UpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data) | ||
1067 | { | ||
1068 | if (this.Avatars.ContainsKey(userID)) | ||
1069 | { | ||
1070 | return this.UpdateInventoryItemAsset(this.Avatars[userID].ControllingClient, itemID, data); | ||
1071 | } | ||
1072 | return LLUUID.Zero; | ||
1073 | } | ||
1074 | |||
1075 | public LLUUID UpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) | ||
1076 | { | ||
1077 | CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); | ||
1078 | if (userInfo != null) | ||
1079 | { | ||
1080 | if (userInfo.RootFolder != null) | ||
1081 | { | ||
1082 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | ||
1083 | if (item != null) | ||
1084 | { | ||
1085 | AssetBase asset; | ||
1086 | asset = new AssetBase(); | ||
1087 | asset.FullID = LLUUID.Random(); | ||
1088 | asset.Type = (sbyte)item.assetType; | ||
1089 | asset.InvType = (sbyte)item.invType; | ||
1090 | asset.Name = item.inventoryName; | ||
1091 | asset.Data = data; | ||
1092 | this.assetCache.AddAsset(asset); | ||
1093 | |||
1094 | item.assetID = asset.FullID; | ||
1095 | userInfo.updateItem(remoteClient.AgentId, item); | ||
1096 | |||
1097 | remoteClient.SendInventoryItemUpdate(item); | ||
1098 | |||
1099 | return (asset.FullID); | ||
1100 | } | ||
1101 | } | ||
1102 | } | ||
1103 | return LLUUID.Zero; | ||
1104 | } | ||
1105 | |||
1065 | } | 1106 | } |
1066 | } | 1107 | } |