aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2012-09-24 20:14:00 +0100
committerMelanie2012-09-24 20:14:00 +0100
commitbbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6 (patch)
tree2ac67907f6333bbbc9e4d821c6607b53d0e22acb /OpenSim/Region
parentMerge branch 'master' into careminster (diff)
parentHG Rez object: warn the user if the item or asset cannot be found. (diff)
downloadopensim-SC_OLD-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.zip
opensim-SC_OLD-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.tar.gz
opensim-SC_OLD-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.tar.bz2
opensim-SC_OLD-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs79
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGUuidGatherer.cs57
-rw-r--r--OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs (renamed from OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs)0
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs23
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs172
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs136
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs134
16 files changed, 515 insertions, 181 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 951afd7..5d41c1c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -933,6 +933,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
933 933
934 InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); 934 InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID);
935 item = m_scene.InventoryService.GetItem(item); 935 item = m_scene.InventoryService.GetItem(item);
936 if (item == null)
937 return;
938
936 bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); 939 bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
937 if (changed && m_scene.AvatarFactory != null) 940 if (changed && m_scene.AvatarFactory != null)
938 { 941 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 48f3a23..b7a1169 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
62 public class AttachmentsModuleTests : OpenSimTestCase 62 public class AttachmentsModuleTests : OpenSimTestCase
63 { 63 {
64 private AutoResetEvent m_chatEvent = new AutoResetEvent(false); 64 private AutoResetEvent m_chatEvent = new AutoResetEvent(false);
65 private OSChatMessage m_osChatMessageReceived; 65// private OSChatMessage m_osChatMessageReceived;
66 66
67 [TestFixtureSetUp] 67 [TestFixtureSetUp]
68 public void FixtureInit() 68 public void FixtureInit()
@@ -83,7 +83,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
83 { 83 {
84// Console.WriteLine("Got chat [{0}]", oscm.Message); 84// Console.WriteLine("Got chat [{0}]", oscm.Message);
85 85
86 m_osChatMessageReceived = oscm; 86// m_osChatMessageReceived = oscm;
87 m_chatEvent.Set(); 87 m_chatEvent.Set();
88 } 88 }
89 89
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 4c786ff..a1d8d5a 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -150,6 +150,34 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
150 150
151 if (m_Enabled) 151 if (m_Enabled)
152 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); 152 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
153
154 scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject;
155 }
156
157 void OnIncomingSceneObject(SceneObjectGroup so)
158 {
159 if (!so.IsAttachment)
160 return;
161
162 if (so.Scene.UserManagementModule.IsLocalGridUser(so.AttachedAvatar))
163 return;
164
165 // foreign user
166 AgentCircuitData aCircuit = so.Scene.AuthenticateHandler.GetAgentCircuitData(so.AttachedAvatar);
167 if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
168 {
169 if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
170 {
171 string url = aCircuit.ServiceURLs["AssetServerURI"].ToString();
172 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Incoming attachement {0} for HG user {1} with asset server {2}", so.Name, so.AttachedAvatar, url);
173 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
174 HGUuidGatherer uuidGatherer = new HGUuidGatherer(so.Scene.AssetService, url);
175 uuidGatherer.GatherAssetUuids(so, ids);
176
177 foreach (KeyValuePair<UUID, AssetType> kvp in ids)
178 uuidGatherer.FetchAsset(kvp.Key);
179 }
180 }
153 } 181 }
154 182
155 protected override void OnNewClient(IClientAPI client) 183 protected override void OnNewClient(IClientAPI client)
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index eaadc1b..6f62856 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -71,19 +71,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
71 71
72 #region Internal functions 72 #region Internal functions
73 73
74 public AssetBase FetchAsset(string url, UUID assetID) 74 public AssetMetadata FetchMetadata(string url, UUID assetID)
75 { 75 {
76 if (!url.EndsWith("/") && !url.EndsWith("=")) 76 if (!url.EndsWith("/") && !url.EndsWith("="))
77 url = url + "/"; 77 url = url + "/";
78 78
79 AssetBase asset = m_scene.AssetService.Get(url + assetID.ToString()); 79 AssetMetadata meta = m_scene.AssetService.GetMetadata(url + assetID.ToString());
80 80
81 if (asset != null) 81 if (meta != null)
82 { 82 m_log.DebugFormat("[HG ASSET MAPPER]: Fetched metadata for asset {0} of type {1} from {2} ", assetID, meta.Type, url);
83 m_log.DebugFormat("[HG ASSET MAPPER]: Copied asset {0} from {1} to local asset server. ", asset.ID, url); 83 else
84 return asset; 84 m_log.DebugFormat("[HG ASSET MAPPER]: Unable to fetched metadata for asset {0} from {1} ", assetID, url);
85 } 85
86 return null; 86 return meta;
87 } 87 }
88 88
89 public bool PostAsset(string url, AssetBase asset) 89 public bool PostAsset(string url, AssetBase asset)
@@ -93,6 +93,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
93 if (!url.EndsWith("/") && !url.EndsWith("=")) 93 if (!url.EndsWith("/") && !url.EndsWith("="))
94 url = url + "/"; 94 url = url + "/";
95 95
96 bool success = true;
96 // See long comment in AssetCache.AddAsset 97 // See long comment in AssetCache.AddAsset
97 if (!asset.Temporary || asset.Local) 98 if (!asset.Temporary || asset.Local)
98 { 99 {
@@ -103,14 +104,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
103 // not having a global naming infrastructure 104 // not having a global naming infrastructure
104 AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID); 105 AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID);
105 Copy(asset, asset1); 106 Copy(asset, asset1);
106 try 107 asset1.ID = url + asset.ID;
107 {
108 asset1.ID = url + asset.ID;
109 }
110 catch
111 {
112 m_log.Warn("[HG ASSET MAPPER]: Oops.");
113 }
114 108
115 AdjustIdentifiers(asset1.Metadata); 109 AdjustIdentifiers(asset1.Metadata);
116 if (asset1.Metadata.Type == (sbyte)AssetType.Object) 110 if (asset1.Metadata.Type == (sbyte)AssetType.Object)
@@ -118,11 +112,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
118 else 112 else
119 asset1.Data = asset.Data; 113 asset1.Data = asset.Data;
120 114
121 m_scene.AssetService.Store(asset1); 115 string id = m_scene.AssetService.Store(asset1);
122 m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url); 116 if (id == string.Empty)
117 {
118 m_log.DebugFormat("[HG ASSET MAPPER]: Asset server {0} did not accept {1}", url, asset.ID);
119 success = false;
120 }
121 else
122 m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url);
123 } 123 }
124 return true; 124 return success;
125 } 125 }
126 else 126 else
127 m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache."); 127 m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache.");
128 128
@@ -222,28 +222,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
222 222
223 public void Get(UUID assetID, UUID ownerID, string userAssetURL) 223 public void Get(UUID assetID, UUID ownerID, string userAssetURL)
224 { 224 {
225 // Get the item from the remote asset server onto the local AssetCache 225 // Get the item from the remote asset server onto the local AssetService
226 // and place an entry in m_assetMap
227 226
228 m_log.Debug("[HG ASSET MAPPER]: Fetching object " + assetID + " from asset server " + userAssetURL); 227 AssetMetadata meta = FetchMetadata(userAssetURL, assetID);
229 AssetBase asset = FetchAsset(userAssetURL, assetID); 228 if (meta == null)
229 return;
230 230
231 if (asset != null) 231 // The act of gathering UUIDs downloads the assets from the remote server
232 { 232 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
233 // OK, now fetch the inside. 233 HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, userAssetURL);
234 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); 234 uuidGatherer.GatherAssetUuids(assetID, (AssetType)meta.Type, ids);
235 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
236 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
237 if (ids.ContainsKey(assetID))
238 ids.Remove(assetID);
239 foreach (UUID uuid in ids.Keys)
240 FetchAsset(userAssetURL, uuid);
241 235
242 m_log.DebugFormat("[HG ASSET MAPPER]: Successfully fetched asset {0} from asset server {1}", asset.ID, userAssetURL); 236 m_log.DebugFormat("[HG ASSET MAPPER]: Successfully fetched asset {0} from asset server {1}", assetID, userAssetURL);
243 237
244 }
245 else
246 m_log.Warn("[HG ASSET MAPPER]: Could not fetch asset from remote asset server " + userAssetURL);
247 } 238 }
248 239
249 240
@@ -257,19 +248,23 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
257 if (asset != null) 248 if (asset != null)
258 { 249 {
259 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); 250 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
260 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty); 251 HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, string.Empty);
261 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); 252 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
253 bool success = false;
262 foreach (UUID uuid in ids.Keys) 254 foreach (UUID uuid in ids.Keys)
263 { 255 {
264 asset = m_scene.AssetService.Get(uuid.ToString()); 256 asset = m_scene.AssetService.Get(uuid.ToString());
265 if (asset == null) 257 if (asset == null)
266 m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid); 258 m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid);
267 else 259 else
268 PostAsset(userAssetURL, asset); 260 success = PostAsset(userAssetURL, asset);
269 } 261 }
270 262
271 // maybe all pieces got there... 263 // maybe all pieces got there...
272 m_log.DebugFormat("[HG ASSET MAPPER]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL); 264 if (!success)
265 m_log.DebugFormat("[HG ASSET MAPPER]: Problems posting item {0} to asset server {1}", assetID, userAssetURL);
266 else
267 m_log.DebugFormat("[HG ASSET MAPPER]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL);
273 268
274 } 269 }
275 else 270 else
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index a0cad40..80257bd 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -263,8 +263,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
263 //} 263 //}
264 264
265 // OK, we're done fetching. Pass it up to the default RezObject 265 // OK, we're done fetching. Pass it up to the default RezObject
266 return base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, 266 SceneObjectGroup sog = base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
267 RezSelected, RemoveItem, fromTaskID, attachment); 267 RezSelected, RemoveItem, fromTaskID, attachment);
268
269 if (sog == null)
270 remoteClient.SendAgentAlertMessage("Unable to rez: problem accessing inventory or locating assets", false);
271
272 return sog;
268 273
269 } 274 }
270 275
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGUuidGatherer.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGUuidGatherer.cs
deleted file mode 100644
index fcb544f..0000000
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGUuidGatherer.cs
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Services.Interfaces;
34using OpenMetaverse;
35
36namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
37{
38 public class HGUuidGatherer : UuidGatherer
39 {
40 protected string m_assetServerURL;
41 protected HGAssetMapper m_assetMapper;
42
43 public HGUuidGatherer(HGAssetMapper assMap, IAssetService assetCache, string assetServerURL) : base(assetCache)
44 {
45 m_assetMapper = assMap;
46 m_assetServerURL = assetServerURL;
47 }
48
49 protected override AssetBase GetAsset(UUID uuid)
50 {
51 if (string.Empty == m_assetServerURL)
52 return m_assetCache.Get(uuid.ToString());
53 else
54 return m_assetMapper.FetchAsset(m_assetServerURL, uuid);
55 }
56 }
57}
diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
index 98396ff..98396ff 100644
--- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index 008465f..1e1c7d0 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -56,6 +56,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
56 56
57 private bool m_Enabled = false; 57 private bool m_Enabled = false;
58 58
59 private AssetPermissions m_AssetPerms;
60
59 public Type ReplaceableInterface 61 public Type ReplaceableInterface
60 { 62 {
61 get { return null; } 63 get { return null; }
@@ -128,6 +130,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
128 if (m_LocalAssetServiceURI != string.Empty) 130 if (m_LocalAssetServiceURI != string.Empty)
129 m_LocalAssetServiceURI = m_LocalAssetServiceURI.Trim('/'); 131 m_LocalAssetServiceURI = m_LocalAssetServiceURI.Trim('/');
130 132
133 IConfig hgConfig = source.Configs["HGAssetService"];
134 m_AssetPerms = new AssetPermissions(hgConfig); // it's ok if arg is null
135
131 m_Enabled = true; 136 m_Enabled = true;
132 m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled"); 137 m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled");
133 } 138 }
@@ -206,14 +211,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
206 asset = m_HGService.Get(id); 211 asset = m_HGService.Get(id);
207 if (asset != null) 212 if (asset != null)
208 { 213 {
209 // Now store it locally 214 // Now store it locally, if allowed
210 // For now, let me just do it for textures and scripts 215 if (m_AssetPerms.AllowedImport(asset.Type))
211 if (((AssetType)asset.Type == AssetType.Texture) ||
212 ((AssetType)asset.Type == AssetType.LSLBytecode) ||
213 ((AssetType)asset.Type == AssetType.LSLText))
214 {
215 m_GridService.Store(asset); 216 m_GridService.Store(asset);
216 } 217 else
218 return null;
217 } 219 }
218 } 220 }
219 else 221 else
@@ -328,7 +330,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
328 330
329 string id = string.Empty; 331 string id = string.Empty;
330 if (IsHG(asset.ID)) 332 if (IsHG(asset.ID))
331 id = m_HGService.Store(asset); 333 {
334 if (m_AssetPerms.AllowedExport(asset.Type))
335 id = m_HGService.Store(asset);
336 else
337 return String.Empty;
338 }
332 else 339 else
333 id = m_GridService.Store(asset); 340 id = m_GridService.Store(asset);
334 341
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
index 57ae549..4338133 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
@@ -46,8 +46,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
46 public class GridConnectorsTests : OpenSimTestCase 46 public class GridConnectorsTests : OpenSimTestCase
47 { 47 {
48 LocalGridServicesConnector m_LocalConnector; 48 LocalGridServicesConnector m_LocalConnector;
49 private void SetUp() 49
50 [SetUp]
51 public override void SetUp()
50 { 52 {
53 base.SetUp();
54
51 IConfigSource config = new IniConfigSource(); 55 IConfigSource config = new IniConfigSource();
52 config.AddConfig("Modules"); 56 config.AddConfig("Modules");
53 config.AddConfig("GridService"); 57 config.AddConfig("GridService");
@@ -71,8 +75,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
71 TestHelpers.InMethod(); 75 TestHelpers.InMethod();
72// log4net.Config.XmlConfigurator.Configure(); 76// log4net.Config.XmlConfigurator.Configure();
73 77
74 SetUp();
75
76 // Create 4 regions 78 // Create 4 regions
77 GridRegion r1 = new GridRegion(); 79 GridRegion r1 = new GridRegion();
78 r1.RegionName = "Test Region 1"; 80 r1.RegionName = "Test Region 1";
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 0a30905..82f49b0 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -65,8 +65,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
65 protected TaskInventoryItem m_soundItem; 65 protected TaskInventoryItem m_soundItem;
66 66
67 [SetUp] 67 [SetUp]
68 public void SetUp() 68 public override void SetUp()
69 { 69 {
70 base.SetUp();
71
72 // FIXME: Do something about this - relying on statics in unit tests causes trouble sooner or later
70 new SceneManager(); 73 new SceneManager();
71 74
72 m_archiverModule = new ArchiverModule(); 75 m_archiverModule = new ArchiverModule();
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index e257b57..67d218b 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -188,6 +188,22 @@ namespace OpenSim.Region.Framework.Scenes
188 188
189 public delegate void OnPluginConsoleDelegate(string[] args); 189 public delegate void OnPluginConsoleDelegate(string[] args);
190 190
191 /// <summary>
192 /// Triggered after <see cref="OpenSim.IApplicationPlugin.PostInitialise"/>
193 /// has been called for all <see cref="OpenSim.IApplicationPlugin"/>
194 /// loaded via <see cref="OpenSim.OpenSimBase.LoadPlugins"/>.
195 /// Handlers for this event are typically used to parse the arguments
196 /// from <see cref="OnPluginConsoleDelegate"/> in order to process or
197 /// filter the arguments and pass them onto <see cref="OpenSim.Region.CoreModules.Framework.InterfaceCommander.Commander.ProcessConsoleCommand"/>
198 /// </summary>
199 /// <remarks>
200 /// Triggered by <see cref="TriggerOnPluginConsole"/> in
201 /// <see cref="Scene.SendCommandToPlugins"/> via
202 /// <see cref="SceneManager.SendCommandToPluginModules"/> via
203 /// <see cref="OpenSim.OpenSimBase.HandleCommanderCommand"/> via
204 /// <see cref="OpenSim.OpenSimBase.AddPluginCommands"/> via
205 /// <see cref="OpenSim.OpenSimBase.StartupSpecific"/>
206 /// </remarks>
191 public event OnPluginConsoleDelegate OnPluginConsole; 207 public event OnPluginConsoleDelegate OnPluginConsole;
192 208
193 /// <summary> 209 /// <summary>
@@ -202,6 +218,18 @@ namespace OpenSim.Region.Framework.Scenes
202 218
203 public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene); 219 public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene);
204 220
221 /// <summary>
222 /// Triggered before the grunt work for adding a root agent to a
223 /// scene has been performed (resuming attachment scripts, physics,
224 /// animations etc.)
225 /// </summary>
226 /// <remarks>
227 /// Triggered before <see cref="OnMakeRootAgent"/>
228 /// by <see cref="TriggerSetRootAgentScene"/>
229 /// in <see cref="ScenePresence.MakeRootAgent"/>
230 /// via <see cref="Scene.AgentCrossing"/>
231 /// and <see cref="ScenePresence.CompleteMovement"/>
232 /// </remarks>
205 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; 233 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
206 234
207 /// <summary> 235 /// <summary>
@@ -226,13 +254,45 @@ namespace OpenSim.Region.Framework.Scenes
226 /// <summary> 254 /// <summary>
227 /// Fired when an object is touched/grabbed. 255 /// Fired when an object is touched/grabbed.
228 /// </summary> 256 /// </summary>
257 /// <remarks>
229 /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of 258 /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of
230 /// the root part. 259 /// the root part.
260 /// Triggerd in response to <see cref="OpenSim.Framework.IClientAPI.OnGrabObject"/>
261 /// via <see cref="TriggerObjectGrab"/>
262 /// in <see cref="Scene.ProcessObjectGrab"/>
263 /// </remarks>
231 public event ObjectGrabDelegate OnObjectGrab; 264 public event ObjectGrabDelegate OnObjectGrab;
232 public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); 265 public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
233 266
267 /// <summary>
268 /// Triggered when an object is being touched/grabbed continuously.
269 /// </summary>
270 /// <remarks>
271 /// Triggered in response to <see cref="OpenSim.Framework.IClientAPI.OnGrabUpdate"/>
272 /// via <see cref="TriggerObjectGrabbing"/>
273 /// in <see cref="Scene.ProcessObjectGrabUpdate"/>
274 /// </remarks>
234 public event ObjectGrabDelegate OnObjectGrabbing; 275 public event ObjectGrabDelegate OnObjectGrabbing;
276
277 /// <summary>
278 /// Triggered when an object stops being touched/grabbed.
279 /// </summary>
280 /// <remarks>
281 /// Triggered in response to <see cref="OpenSim.Framework.IClientAPI.OnDeGrabObject"/>
282 /// via <see cref="TriggerObjectDeGrab"/>
283 /// in <see cref="Scene.ProcessObjectDeGrab"/>
284 /// </remarks>
235 public event ObjectDeGrabDelegate OnObjectDeGrab; 285 public event ObjectDeGrabDelegate OnObjectDeGrab;
286
287 /// <summary>
288 /// Triggered when a script resets.
289 /// </summary>
290 /// <remarks>
291 /// Triggered by <see cref="TriggerScriptReset"/>
292 /// in <see cref="Scene.ProcessScriptReset"/>
293 /// via <see cref="OpenSim.Framework.IClientAPI.OnScriptReset"/>
294 /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleScriptReset"/>
295 /// </remarks>
236 public event ScriptResetDelegate OnScriptReset; 296 public event ScriptResetDelegate OnScriptReset;
237 297
238 public event OnPermissionErrorDelegate OnPermissionError; 298 public event OnPermissionErrorDelegate OnPermissionError;
@@ -242,17 +302,50 @@ namespace OpenSim.Region.Framework.Scenes
242 /// </summary> 302 /// </summary>
243 /// <remarks> 303 /// <remarks>
244 /// Occurs after OnNewScript. 304 /// Occurs after OnNewScript.
305 /// Triggered by <see cref="TriggerRezScript"/>
306 /// in <see cref="SceneObjectPartInventory.CreateScriptInstance"/>
245 /// </remarks> 307 /// </remarks>
246 public event NewRezScript OnRezScript; 308 public event NewRezScript OnRezScript;
247 public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); 309 public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
248 310
249 public delegate void RemoveScript(uint localID, UUID itemID); 311 public delegate void RemoveScript(uint localID, UUID itemID);
312
313 /// <summary>
314 /// Triggered when a script is removed from an object.
315 /// </summary>
316 /// <remarks>
317 /// Triggered by <see cref="TriggerRemoveScript"/>
318 /// in <see cref="Scene.RemoveTaskInventory"/>,
319 /// <see cref="Scene.CreateAgentInventoryItemFromTask"/>,
320 /// <see cref="SceneObjectPartInventory.RemoveScriptInstance"/>,
321 /// <see cref="SceneObjectPartInventory.RemoveInventoryItem"/>
322 /// </remarks>
250 public event RemoveScript OnRemoveScript; 323 public event RemoveScript OnRemoveScript;
251 324
252 public delegate void StartScript(uint localID, UUID itemID); 325 public delegate void StartScript(uint localID, UUID itemID);
326
327 /// <summary>
328 /// Triggered when a script starts.
329 /// </summary>
330 /// <remarks>
331 /// Triggered by <see cref="TriggerStartScript"/>
332 /// in <see cref="Scene.SetScriptRunning"/>
333 /// via <see cref="OpenSim.Framework.IClientAPI.OnSetScriptRunning"/>,
334 /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.HandleSetScriptRunning"/>
335 /// </remarks>
253 public event StartScript OnStartScript; 336 public event StartScript OnStartScript;
254 337
255 public delegate void StopScript(uint localID, UUID itemID); 338 public delegate void StopScript(uint localID, UUID itemID);
339
340 /// <summary>
341 /// Triggered when a script stops.
342 /// </summary>
343 /// <remarks>
344 /// Triggered by <see cref="TriggerStopScript"/>,
345 /// in <see cref="SceneObjectPartInventory.CreateScriptInstance"/>,
346 /// <see cref="SceneObjectPartInventory.StopScriptInstance"/>,
347 /// <see cref="Scene.SetScriptRunning"/>
348 /// </remarks>
256 public event StopScript OnStopScript; 349 public event StopScript OnStopScript;
257 350
258 public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta); 351 public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta);
@@ -303,6 +396,9 @@ namespace OpenSim.Region.Framework.Scenes
303 /// </summary> 396 /// </summary>
304 /// <remarks> 397 /// <remarks>
305 /// Occurs before OnRezScript 398 /// Occurs before OnRezScript
399 /// Triggered by <see cref="TriggerNewScript"/>
400 /// in <see cref="Scene.RezScriptFromAgentInventory"/>,
401 /// <see cref="Scene.RezNewScript"/>
306 /// </remarks> 402 /// </remarks>
307 public event NewScript OnNewScript; 403 public event NewScript OnNewScript;
308 404
@@ -337,6 +433,12 @@ namespace OpenSim.Region.Framework.Scenes
337 /// </summary> 433 /// </summary>
338 /// <remarks> 434 /// <remarks>
339 /// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset. 435 /// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset.
436 /// Triggered by <see cref="TriggerUpdateScript"/>
437 /// in <see cref="Scene.CapsUpdateTaskInventoryScriptAsset"/>
438 /// via <see cref="Scene.CapsUpdateTaskInventoryScriptAsset"/>
439 /// via <see cref="OpenSim.Region.ClientStack.Linden.BunchOfCaps.TaskScriptUpdated"/>
440 /// via <see cref="OpenSim.Region.ClientStack.Linden.TaskInventoryScriptUpdater.OnUpLoad"/>
441 /// via <see cref="OpenSim.Region.ClientStack.Linden.TaskInventoryScriptUpdater.uploaderCaps"/>
340 /// </remarks> 442 /// </remarks>
341 public event UpdateScript OnUpdateScript; 443 public event UpdateScript OnUpdateScript;
342 444
@@ -395,15 +497,36 @@ namespace OpenSim.Region.Framework.Scenes
395 public event ScriptColliding OnScriptLandColliderEnd; 497 public event ScriptColliding OnScriptLandColliderEnd;
396 498
397 public delegate void OnMakeChildAgentDelegate(ScenePresence presence); 499 public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
500
501 /// <summary>
502 /// Triggered when an agent has been made a child agent of a scene.
503 /// </summary>
504 /// <remarks>
505 /// Triggered by <see cref="TriggerOnMakeChildAgent"/>
506 /// in <see cref="ScenePresence.MakeChildAgent"/>
507 /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.CrossAgentToNewRegionAsync"/>,
508 /// <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>,
509 /// <see cref="OpenSim.Region.CoreModules.InterGrid.KillAUser.ShutdownNoLogout"/>
510 /// </remarks>
398 public event OnMakeChildAgentDelegate OnMakeChildAgent; 511 public event OnMakeChildAgentDelegate OnMakeChildAgent;
399 512
400 public delegate void OnSaveNewWindlightProfileDelegate(); 513 public delegate void OnSaveNewWindlightProfileDelegate();
401 public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user); 514 public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user);
402 515
403 /// <summary> 516 /// <summary>
517 /// Triggered after the grunt work for adding a root agent to a
518 /// scene has been performed (resuming attachment scripts, physics,
519 /// animations etc.)
520 /// </summary>
521 /// <remarks>
404 /// This event is on the critical path for transferring an avatar from one region to another. Try and do 522 /// This event is on the critical path for transferring an avatar from one region to another. Try and do
405 /// as little work on this event as possible, or do work asynchronously. 523 /// as little work on this event as possible, or do work asynchronously.
406 /// </summary> 524 /// Triggered after <see cref="OnSetRootAgentScene"/>
525 /// by <see cref="TriggerOnMakeRootAgent"/>
526 /// in <see cref="ScenePresence.MakeRootAgent"/>
527 /// via <see cref="Scene.AgentCrossing"/>
528 /// and <see cref="ScenePresence.CompleteMovement"/>
529 /// </remarks>
407 public event Action<ScenePresence> OnMakeRootAgent; 530 public event Action<ScenePresence> OnMakeRootAgent;
408 531
409 public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted; 532 public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted;
@@ -429,9 +552,10 @@ namespace OpenSim.Region.Framework.Scenes
429 public event AvatarKillData OnAvatarKilled; 552 public event AvatarKillData OnAvatarKilled;
430 public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar); 553 public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar);
431 554
432// public delegate void ScriptTimerEvent(uint localID, double timerinterval); 555 /*
433 556 public delegate void ScriptTimerEvent(uint localID, double timerinterval);
434// public event ScriptTimerEvent OnScriptTimerEvent; 557 public event ScriptTimerEvent OnScriptTimerEvent;
558 */
435 559
436 public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); 560 public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour);
437 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); 561 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
@@ -441,12 +565,27 @@ namespace OpenSim.Region.Framework.Scenes
441 /// <summary> 565 /// <summary>
442 /// Triggered when an object is added to the scene. 566 /// Triggered when an object is added to the scene.
443 /// </summary> 567 /// </summary>
568 /// <remarks>
569 /// Triggered by <see cref="TriggerObjectAddedToScene"/>
570 /// in <see cref="Scene.AddNewSceneObject"/>,
571 /// <see cref="Scene.DuplicateObject"/>,
572 /// <see cref="Scene.doObjectDuplicateOnRay"/>
573 /// </remarks>
444 public event Action<SceneObjectGroup> OnObjectAddedToScene; 574 public event Action<SceneObjectGroup> OnObjectAddedToScene;
445 575
446 /// <summary> 576 /// <summary>
447 /// Triggered when an object is removed from the scene. 577 /// Delegate for <see cref="OnObjectBeingRemovedFromScene"/>
448 /// </summary> 578 /// </summary>
579 /// <param name="obj">The object being removed from the scene</param>
449 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); 580 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
581
582 /// <summary>
583 /// Triggered when an object is removed from the scene.
584 /// </summary>
585 /// <remarks>
586 /// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/>
587 /// in <see cref="Scene.DeleteSceneObject"/>
588 /// </remarks>
450 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; 589 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
451 590
452 public delegate void NoticeNoLandDataFromStorage(); 591 public delegate void NoticeNoLandDataFromStorage();
@@ -632,9 +771,28 @@ namespace OpenSim.Region.Framework.Scenes
632 public event PrimsLoaded OnPrimsLoaded; 771 public event PrimsLoaded OnPrimsLoaded;
633 772
634 public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout); 773 public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout);
774
775 /// <summary>
776 /// Triggered when a teleport starts
777 /// </summary>
778 /// <remarks>
779 /// Triggered by <see cref="TriggerTeleportStart"/>
780 /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.CreateAgent"/>
781 /// and <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.HGEntityTransferModule.CreateAgent"/>
782 /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>
783 /// </remarks>
635 public event TeleportStart OnTeleportStart; 784 public event TeleportStart OnTeleportStart;
636 785
637 public delegate void TeleportFail(IClientAPI client, bool gridLogout); 786 public delegate void TeleportFail(IClientAPI client, bool gridLogout);
787
788 /// <summary>
789 /// Trigered when a teleport fails.
790 /// </summary>
791 /// <remarks>
792 /// Triggered by <see cref="TriggerTeleportFail"/>
793 /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.Fail"/>
794 /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>
795 /// </remarks>
638 public event TeleportFail OnTeleportFail; 796 public event TeleportFail OnTeleportFail;
639 797
640 public class MoneyTransferArgs : EventArgs 798 public class MoneyTransferArgs : EventArgs
@@ -642,7 +800,9 @@ namespace OpenSim.Region.Framework.Scenes
642 public UUID sender; 800 public UUID sender;
643 public UUID receiver; 801 public UUID receiver;
644 802
645 // Always false. The SL protocol sucks. 803 /// <summary>
804 /// Always false. The SL protocol sucks.
805 /// </summary>
646 public bool authenticated = false; 806 public bool authenticated = false;
647 807
648 public int amount; 808 public int amount;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ee5f6df..129bf09 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -106,7 +106,7 @@ namespace OpenSim.Region.Framework.Scenes
106 /// <summary> 106 /// <summary>
107 /// Minimum value of the size of a non-physical prim in each axis 107 /// Minimum value of the size of a non-physical prim in each axis
108 /// </summary> 108 /// </summary>
109 public float m_minNonphys = 0.01f; 109 public float m_minNonphys = 0.001f;
110 110
111 /// <summary> 111 /// <summary>
112 /// Maximum value of the size of a non-physical prim in each axis 112 /// Maximum value of the size of a non-physical prim in each axis
@@ -769,13 +769,13 @@ namespace OpenSim.Region.Framework.Scenes
769 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 769 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
770 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 770 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
771 771
772 m_minNonphys = startupConfig.GetFloat("NonphysicalPrimMin", m_minNonphys); 772 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys);
773 if (RegionInfo.NonphysPrimMin > 0) 773 if (RegionInfo.NonphysPrimMin > 0)
774 { 774 {
775 m_minNonphys = RegionInfo.NonphysPrimMin; 775 m_minNonphys = RegionInfo.NonphysPrimMin;
776 } 776 }
777 777
778 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); 778 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
779 if (RegionInfo.NonphysPrimMax > 0) 779 if (RegionInfo.NonphysPrimMax > 0)
780 { 780 {
781 m_maxNonphys = RegionInfo.NonphysPrimMax; 781 m_maxNonphys = RegionInfo.NonphysPrimMax;
@@ -895,6 +895,8 @@ namespace OpenSim.Region.Framework.Scenes
895 } 895 }
896 896
897 // FIXME: Ultimately this should be in a module. 897 // FIXME: Ultimately this should be in a module.
898 SendPeriodicAppearanceUpdates = true;
899
898 IConfig appearanceConfig = m_config.Configs["Appearance"]; 900 IConfig appearanceConfig = m_config.Configs["Appearance"];
899 if (appearanceConfig != null) 901 if (appearanceConfig != null)
900 { 902 {
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 411e421..b5ef7b0 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -52,26 +52,23 @@ namespace OpenSim.Region.Framework.Scenes
52 public class UuidGatherer 52 public class UuidGatherer
53 { 53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55
56 /// <summary>
57 /// Asset cache used for gathering assets
58 /// </summary>
59 protected IAssetService m_assetCache;
60
61 /// <summary>
62 /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
63 /// asset was found by the asset service.
64 /// </summary>
65 private AssetBase m_requestedObjectAsset;
66 55
67 /// <summary> 56 protected IAssetService m_assetService;
68 /// Signal whether we are currently waiting for the asset service to deliver an asset. 57
69 /// </summary> 58// /// <summary>
70 private bool m_waitingForObjectAsset; 59// /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
60// /// asset was found by the asset service.
61// /// </summary>
62// private AssetBase m_requestedObjectAsset;
63//
64// /// <summary>
65// /// Signal whether we are currently waiting for the asset service to deliver an asset.
66// /// </summary>
67// private bool m_waitingForObjectAsset;
71 68
72 public UuidGatherer(IAssetService assetCache) 69 public UuidGatherer(IAssetService assetCache)
73 { 70 {
74 m_assetCache = assetCache; 71 m_assetService = assetCache;
75 } 72 }
76 73
77 /// <summary> 74 /// <summary>
@@ -191,18 +188,18 @@ namespace OpenSim.Region.Framework.Scenes
191 } 188 }
192 } 189 }
193 190
194 /// <summary> 191// /// <summary>
195 /// The callback made when we request the asset for an object from the asset service. 192// /// The callback made when we request the asset for an object from the asset service.
196 /// </summary> 193// /// </summary>
197 private void AssetReceived(string id, Object sender, AssetBase asset) 194// private void AssetReceived(string id, Object sender, AssetBase asset)
198 { 195// {
199 lock (this) 196// lock (this)
200 { 197// {
201 m_requestedObjectAsset = asset; 198// m_requestedObjectAsset = asset;
202 m_waitingForObjectAsset = false; 199// m_waitingForObjectAsset = false;
203 Monitor.Pulse(this); 200// Monitor.Pulse(this);
204 } 201// }
205 } 202// }
206 203
207 /// <summary> 204 /// <summary>
208 /// Get an asset synchronously, potentially using an asynchronous callback. If the 205 /// Get an asset synchronously, potentially using an asynchronous callback. If the
@@ -212,25 +209,29 @@ namespace OpenSim.Region.Framework.Scenes
212 /// <returns></returns> 209 /// <returns></returns>
213 protected virtual AssetBase GetAsset(UUID uuid) 210 protected virtual AssetBase GetAsset(UUID uuid)
214 { 211 {
215 m_waitingForObjectAsset = true; 212 return m_assetService.Get(uuid.ToString());
216 m_assetCache.Get(uuid.ToString(), this, AssetReceived);
217
218 // The asset cache callback can either
219 //
220 // 1. Complete on the same thread (if the asset is already in the cache) or
221 // 2. Come in via a different thread (if we need to go fetch it).
222 //
223 // The code below handles both these alternatives.
224 lock (this)
225 {
226 if (m_waitingForObjectAsset)
227 {
228 Monitor.Wait(this);
229 m_waitingForObjectAsset = false;
230 }
231 }
232 213
233 return m_requestedObjectAsset; 214 // XXX: Switching to do this synchronously where the call was async before but we always waited for it
215 // to complete anyway!
216// m_waitingForObjectAsset = true;
217// m_assetCache.Get(uuid.ToString(), this, AssetReceived);
218//
219// // The asset cache callback can either
220// //
221// // 1. Complete on the same thread (if the asset is already in the cache) or
222// // 2. Come in via a different thread (if we need to go fetch it).
223// //
224// // The code below handles both these alternatives.
225// lock (this)
226// {
227// if (m_waitingForObjectAsset)
228// {
229// Monitor.Wait(this);
230// m_waitingForObjectAsset = false;
231// }
232// }
233//
234// return m_requestedObjectAsset;
234 } 235 }
235 236
236 /// <summary> 237 /// <summary>
@@ -361,4 +362,47 @@ namespace OpenSim.Region.Framework.Scenes
361 } 362 }
362 } 363 }
363 } 364 }
365
366 public class HGUuidGatherer : UuidGatherer
367 {
368 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
369
370 protected string m_assetServerURL;
371
372 public HGUuidGatherer(IAssetService assetService, string assetServerURL)
373 : base(assetService)
374 {
375 m_assetServerURL = assetServerURL;
376 if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("="))
377 m_assetServerURL = m_assetServerURL + "/";
378 }
379
380 protected override AssetBase GetAsset(UUID uuid)
381 {
382 if (string.Empty == m_assetServerURL)
383 return base.GetAsset(uuid);
384 else
385 return FetchAsset(uuid);
386 }
387
388 public AssetBase FetchAsset(UUID assetID)
389 {
390
391 // Test if it's already here
392 AssetBase asset = m_assetService.Get(assetID.ToString());
393 if (asset == null)
394 {
395 // It's not, so fetch it from abroad
396 asset = m_assetService.Get(m_assetServerURL + assetID.ToString());
397 if (asset != null)
398 m_log.DebugFormat("[HGUUIDGatherer]: Copied asset {0} from {1} to local asset server", assetID, m_assetServerURL);
399 else
400 m_log.DebugFormat("[HGUUIDGatherer]: Failed to fetch asset {0} from {1}", assetID, m_assetServerURL);
401 }
402 //else
403 // m_log.DebugFormat("[HGUUIDGatherer]: Asset {0} from {1} was already here", assetID, m_assetServerURL);
404
405 return asset;
406 }
407 }
364} 408}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
index ca956fb..a014798 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
@@ -231,12 +231,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
231 if (m_server == null || m_baseNick == null || m_ircChannel == null || m_user == null) 231 if (m_server == null || m_baseNick == null || m_ircChannel == null || m_user == null)
232 throw new Exception("Invalid connector configuration"); 232 throw new Exception("Invalid connector configuration");
233 233
234 // Generate an initial nickname if randomizing is enabled 234 // Generate an initial nickname
235 235
236 if (m_randomizeNick) 236 if (m_randomizeNick)
237 {
238 m_nick = m_baseNick + Util.RandomClass.Next(1, 99); 237 m_nick = m_baseNick + Util.RandomClass.Next(1, 99);
239 } 238 else
239 m_nick = m_baseNick;
240 240
241 m_log.InfoFormat("[IRC-Connector-{0}]: Initialization complete", idn); 241 m_log.InfoFormat("[IRC-Connector-{0}]: Initialization complete", idn);
242 242
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 9570669..8d06d83 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5871,27 +5871,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5871 /// Returns the index of the first occurrence of test 5871 /// Returns the index of the first occurrence of test
5872 /// in src. 5872 /// in src.
5873 /// </summary> 5873 /// </summary>
5874 5874 /// <param name="src">Source list</param>
5875 /// <param name="test">List to search for</param>
5876 /// <returns>
5877 /// The index number of the point in src where test was found if it was found.
5878 /// Otherwise returns -1
5879 /// </returns>
5875 public LSL_Integer llListFindList(LSL_List src, LSL_List test) 5880 public LSL_Integer llListFindList(LSL_List src, LSL_List test)
5876 { 5881 {
5877
5878 int index = -1; 5882 int index = -1;
5879 int length = src.Length - test.Length + 1; 5883 int length = src.Length - test.Length + 1;
5880 5884
5881 m_host.AddScriptLPS(1); 5885 m_host.AddScriptLPS(1);
5882 5886
5883 // If either list is empty, do not match 5887 // If either list is empty, do not match
5884
5885 if (src.Length != 0 && test.Length != 0) 5888 if (src.Length != 0 && test.Length != 0)
5886 { 5889 {
5887 for (int i = 0; i < length; i++) 5890 for (int i = 0; i < length; i++)
5888 { 5891 {
5889 if (src.Data[i].Equals(test.Data[0])) 5892 // Why this piece of insanity? This is because most script constants are C# value types (e.g. int)
5893 // rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code
5894 // and so the comparison fails even if the LSL_Integer conceptually has the same value.
5895 // Therefore, here we test Equals on both the source and destination objects.
5896 // However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)).
5897 if (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i]))
5890 { 5898 {
5891 int j; 5899 int j;
5892 for (j = 1; j < test.Length; j++) 5900 for (j = 1; j < test.Length; j++)
5893 if (!src.Data[i+j].Equals(test.Data[j])) 5901 if (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j])))
5894 break; 5902 break;
5903
5895 if (j == test.Length) 5904 if (j == test.Length)
5896 { 5905 {
5897 index = i; 5906 index = i;
@@ -5902,19 +5911,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5902 } 5911 }
5903 5912
5904 return index; 5913 return index;
5905
5906 } 5914 }
5907 5915
5908 public LSL_String llGetObjectName() 5916 public LSL_String llGetObjectName()
5909 { 5917 {
5910 m_host.AddScriptLPS(1); 5918 m_host.AddScriptLPS(1);
5911 return m_host.Name!=null?m_host.Name:String.Empty; 5919 return m_host.Name !=null ? m_host.Name : String.Empty;
5912 } 5920 }
5913 5921
5914 public void llSetObjectName(string name) 5922 public void llSetObjectName(string name)
5915 { 5923 {
5916 m_host.AddScriptLPS(1); 5924 m_host.AddScriptLPS(1);
5917 m_host.Name = name!=null?name:String.Empty; 5925 m_host.Name = name != null ? name : String.Empty;
5918 } 5926 }
5919 5927
5920 public LSL_String llGetDate() 5928 public LSL_String llGetDate()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
new file mode 100644
index 0000000..dd23be8
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
@@ -0,0 +1,134 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using NUnit.Framework;
31using OpenSim.Framework;
32using OpenSim.Tests.Common;
33using OpenSim.Region.ScriptEngine.Shared;
34using OpenSim.Region.Framework.Scenes;
35using Nini.Config;
36using OpenSim.Region.ScriptEngine.Shared.Api;
37using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
38using OpenMetaverse;
39using OpenSim.Tests.Common.Mock;
40
41using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
42using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
43using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
44using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
45
46namespace OpenSim.Region.ScriptEngine.Shared.Tests
47{
48 [TestFixture]
49 public class LSL_ApiListTests
50 {
51 private LSL_Api m_lslApi;
52
53 [SetUp]
54 public void SetUp()
55 {
56 IConfigSource initConfigSource = new IniConfigSource();
57 IConfig config = initConfigSource.AddConfig("XEngine");
58 config.Set("Enabled", "true");
59
60 Scene scene = new SceneHelpers().SetupScene();
61 SceneObjectPart part = SceneHelpers.AddSceneObject(scene).RootPart;
62
63 XEngine.XEngine engine = new XEngine.XEngine();
64 engine.Initialise(initConfigSource);
65 engine.AddRegion(scene);
66
67 m_lslApi = new LSL_Api();
68 m_lslApi.Initialize(engine, part, null);
69 }
70
71 [Test]
72 public void TestllListFindList()
73 {
74 TestHelpers.InMethod();
75
76 LSL_List src = new LSL_List(new LSL_Integer(1), new LSL_Integer(2), new LSL_Integer(3));
77
78 {
79 // Test for a single item that should be found
80 int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_Integer(4)));
81 Assert.That(result, Is.EqualTo(-1));
82 }
83
84 {
85 // Test for a single item that should be found
86 int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_Integer(2)));
87 Assert.That(result, Is.EqualTo(1));
88 }
89
90 {
91 // Test for a constant that should be found
92 int result = m_lslApi.llListFindList(src, new LSL_List(ScriptBaseClass.AGENT));
93 Assert.That(result, Is.EqualTo(0));
94 }
95
96 {
97 // Test for a list that should be found
98 int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_Integer(2), new LSL_Integer(3)));
99 Assert.That(result, Is.EqualTo(1));
100 }
101
102 {
103 // Test for a single item not in the list
104 int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_Integer(4)));
105 Assert.That(result, Is.EqualTo(-1));
106 }
107
108 {
109 // Test for something that should not be cast
110 int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_String("4")));
111 Assert.That(result, Is.EqualTo(-1));
112 }
113
114 {
115 // Test for a list not in the list
116 int result
117 = m_lslApi.llListFindList(
118 src, new LSL_List(new LSL_Integer(2), new LSL_Integer(3), new LSL_Integer(4)));
119 Assert.That(result, Is.EqualTo(-1));
120 }
121
122 {
123 LSL_List srcWithConstants
124 = new LSL_List(new LSL_Integer(3), ScriptBaseClass.AGENT, ScriptBaseClass.OS_NPC_LAND_AT_TARGET);
125
126 // Test for constants that appears in the source list that should be found
127 int result
128 = m_lslApi.llListFindList(srcWithConstants, new LSL_List(new LSL_Integer(1), new LSL_Integer(2)));
129
130 Assert.That(result, Is.EqualTo(1));
131 }
132 }
133 }
134 } \ No newline at end of file