aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs58
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs13
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs473
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs38
8 files changed, 292 insertions, 304 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 30eb9b8..b255415 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -111,10 +111,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
111 111
112 protected IGridService GridService 112 protected IGridService GridService
113 { 113 {
114 get 114 get { return m_Scenes[0].GridService; }
115 { 115 }
116 return m_Scenes[0].GridService; 116
117 } 117 public IUserAccountService UserAccountService
118 {
119 get { return m_Scenes[0].UserAccountService; }
118 } 120 }
119 121
120 public IScene Scene 122 public IScene Scene
@@ -221,33 +223,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
221 223
222 client.OnLogout += OnLogout; 224 client.OnLogout += OnLogout;
223 225
224 if (m_Friends.ContainsKey(client.AgentId)) 226 lock (m_Friends)
225 { 227 {
226 m_Friends[client.AgentId].Refcount++; 228 if (m_Friends.ContainsKey(client.AgentId))
227 return; 229 {
228 } 230 m_Friends[client.AgentId].Refcount++;
229 231 return;
230 UserFriendData newFriends = new UserFriendData(); 232 }
231 233
232 newFriends.PrincipalID = client.AgentId; 234 UserFriendData newFriends = new UserFriendData();
233 newFriends.Friends = m_FriendsService.GetFriends(client.AgentId);
234 newFriends.Refcount = 1;
235 newFriends.RegionID = UUID.Zero;
236 235
237 m_Friends.Add(client.AgentId, newFriends); 236 newFriends.PrincipalID = client.AgentId;
237 newFriends.Friends = m_FriendsService.GetFriends(client.AgentId);
238 newFriends.Refcount = 1;
239 newFriends.RegionID = UUID.Zero;
238 240
241 m_Friends.Add(client.AgentId, newFriends);
242 }
243
239 //StatusChange(client.AgentId, true); 244 //StatusChange(client.AgentId, true);
240 } 245 }
241 246
242 private void OnClientClosed(UUID agentID, Scene scene) 247 private void OnClientClosed(UUID agentID, Scene scene)
243 { 248 {
244 if (m_Friends.ContainsKey(agentID)) 249 lock (m_Friends)
245 { 250 if (m_Friends.ContainsKey(agentID))
246 if (m_Friends[agentID].Refcount == 1) 251 {
247 m_Friends.Remove(agentID); 252 if (m_Friends[agentID].Refcount == 1)
248 else 253 m_Friends.Remove(agentID);
249 m_Friends[agentID].Refcount--; 254 else
250 } 255 m_Friends[agentID].Refcount--;
256 }
251 } 257 }
252 258
253 private void OnLogout(IClientAPI client) 259 private void OnLogout(IClientAPI client)
@@ -555,12 +561,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
555 561
556 private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) 562 private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
557 { 563 {
564 m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID);
565
558 FriendsService.StoreFriend(agentID, friendID.ToString(), 1); 566 FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
559 FriendsService.StoreFriend(friendID, agentID.ToString(), 1); 567 FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
560 // update the local cache 568 // update the local cache
561 m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); 569 m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
562 570
563 m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID);
564 571
565 // 572 //
566 // Notify the friend 573 // Notify the friend
@@ -609,7 +616,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
609 if (friendSession != null) 616 if (friendSession != null)
610 { 617 {
611 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 618 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
612 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); 619 if (region != null)
620 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
621 else
622 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
613 } 623 }
614 } 624 }
615 } 625 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
index 0883c5b..496f2ab 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Server.Base; 35using OpenSim.Server.Base;
36using OpenSim.Framework.Servers.HttpServer; 36using OpenSim.Framework.Servers.HttpServer;
37using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 37using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
38using OpenSim.Services.Interfaces;
38 39
39using OpenMetaverse; 40using OpenMetaverse;
40using log4net; 41using log4net;
@@ -61,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
61 sr.Close(); 62 sr.Close();
62 body = body.Trim(); 63 body = body.Trim();
63 64
64 m_log.DebugFormat("[XXX]: query String: {0}", body); 65 //m_log.DebugFormat("[XXX]: query String: {0}", body);
65 66
66 try 67 try
67 { 68 {
@@ -115,9 +116,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
115 if (!UUID.TryParse(request["ToID"].ToString(), out toID)) 116 if (!UUID.TryParse(request["ToID"].ToString(), out toID))
116 return FailureResult(); 117 return FailureResult();
117 118
118 GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, "", toID, 119 UserAccount account = m_FriendsModule.UserAccountService.GetUserAccount(m_FriendsModule.Scene.RegionInfo.ScopeID, fromID);
120 string name = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName;
121
122 GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, name, toID,
119 (byte)InstantMessageDialog.FriendshipOffered, message, false, Vector3.Zero); 123 (byte)InstantMessageDialog.FriendshipOffered, message, false, Vector3.Zero);
120 124
125 // !! HACK
126 im.imSessionID = im.fromAgentID;
127
121 if (m_FriendsModule.LocalFriendshipOffered(toID, im)) 128 if (m_FriendsModule.LocalFriendshipOffered(toID, im))
122 return SuccessResult(); 129 return SuccessResult();
123 130
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 307db97..ab5f485 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -390,7 +390,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
390 /// <returns></returns> 390 /// <returns></returns>
391 protected UserAccount GetUserInfo(string firstName, string lastName, string pass) 391 protected UserAccount GetUserInfo(string firstName, string lastName, string pass)
392 { 392 {
393 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName); 393 UserAccount account
394 = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName);
395
394 if (null == account) 396 if (null == account)
395 { 397 {
396 m_log.ErrorFormat( 398 m_log.ErrorFormat(
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index c81f295..507662f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -55,14 +55,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
55 { 55 {
56 protected ManualResetEvent mre = new ManualResetEvent(false); 56 protected ManualResetEvent mre = new ManualResetEvent(false);
57 57
58 private void InventoryReceived(UUID userId)
59 {
60 lock (this)
61 {
62 Monitor.PulseAll(this);
63 }
64 }
65
66 private void SaveCompleted( 58 private void SaveCompleted(
67 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, 59 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
68 Exception reportedException) 60 Exception reportedException)
@@ -76,11 +68,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
76 // Commenting for now! The mock inventory service needs more beef, at least for 68 // Commenting for now! The mock inventory service needs more beef, at least for
77 // GetFolderForType 69 // GetFolderForType
78 // REFACTORING PROBLEM. This needs to be rewritten. 70 // REFACTORING PROBLEM. This needs to be rewritten.
79 //[Test] 71 [Test]
80 public void TestSaveIarV0_1() 72 public void TestSaveIarV0_1()
81 { 73 {
82 TestHelper.InMethod(); 74 TestHelper.InMethod();
83 log4net.Config.XmlConfigurator.Configure(); 75// log4net.Config.XmlConfigurator.Configure();
84 76
85 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 77 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
86 78
@@ -195,189 +187,175 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
195 /// </summary> 187 /// </summary>
196 /// 188 ///
197 /// This test also does some deeper probing of loading into nested inventory structures 189 /// This test also does some deeper probing of loading into nested inventory structures
198 /// REFACTORING PROBLEM. This needs to be rewritten. 190 [Test]
199// [Test] 191 public void TestLoadIarV0_1ExistingUsers()
200// public void TestLoadIarV0_1ExistingUsers() 192 {
201// { 193 TestHelper.InMethod();
202// TestHelper.InMethod(); 194 //log4net.Config.XmlConfigurator.Configure();
203 195
204// //log4net.Config.XmlConfigurator.Configure(); 196 string userFirstName = "Mr";
205 197 string userLastName = "Tiddles";
206// string userFirstName = "Mr"; 198 UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555");
207// string userLastName = "Tiddles"; 199 string userItemCreatorFirstName = "Lord";
208// UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555"); 200 string userItemCreatorLastName = "Lucan";
209// string userItemCreatorFirstName = "Lord"; 201 UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
210// string userItemCreatorLastName = "Lucan"; 202
211// UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); 203 string item1Name = "b.lsl";
212 204 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1Name, UUID.Random());
213// string item1Name = "b.lsl"; 205
214// string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1Name, UUID.Random()); 206 MemoryStream archiveWriteStream = new MemoryStream();
215 207 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
216// MemoryStream archiveWriteStream = new MemoryStream(); 208
217// TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); 209 InventoryItemBase item1 = new InventoryItemBase();
218 210 item1.Name = item1Name;
219// InventoryItemBase item1 = new InventoryItemBase(); 211 item1.AssetID = UUID.Random();
220// item1.Name = item1Name; 212 item1.GroupID = UUID.Random();
221// item1.AssetID = UUID.Random(); 213 item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
222// item1.GroupID = UUID.Random(); 214 //item1.CreatorId = userUuid.ToString();
223// item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName); 215 //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
224// //item1.CreatorId = userUuid.ToString(); 216 item1.Owner = UUID.Zero;
225// //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; 217
226// item1.Owner = UUID.Zero; 218 string item1FileName
227 219 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
228// string item1FileName 220 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
229// = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); 221 tar.Close();
230// tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); 222
231// tar.Close(); 223 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
232 224 SerialiserModule serialiserModule = new SerialiserModule();
233// MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); 225 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
234// SerialiserModule serialiserModule = new SerialiserModule(); 226
235// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 227 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
236 228 Scene scene = SceneSetupHelpers.SetupScene("inventory");
237// // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene 229
238// Scene scene = SceneSetupHelpers.SetupScene("inventory"); 230 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
239// IUserAdminService userAdminService = scene.CommsManager.UserAdminService; 231
240 232 UserProfileTestUtils.CreateUserWithInventory(
241// SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 233 scene, userFirstName, userLastName, userUuid, "meowfood");
242// userAdminService.AddUser( 234 UserProfileTestUtils.CreateUserWithInventory(
243// userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid); 235 scene, userItemCreatorFirstName, userItemCreatorLastName, userItemCreatorUuid, "hampshire");
244// userAdminService.AddUser( 236
245// userItemCreatorFirstName, userItemCreatorLastName, "hampshire", 237 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);
246// String.Empty, 1000, 1000, userItemCreatorUuid); 238
247 239 InventoryItemBase foundItem1
248// archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); 240 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, item1Name);
249 241
250// CachedUserInfo userInfo 242 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
251// = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); 243
252 244// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the
253// InventoryItemBase foundItem1 245// UUID, not the OSPA itself.
254// = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, item1Name);
255
256// Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
257
258//// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the
259//// UUID, not the OSPA itself.
260//// Assert.That(
261//// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
262//// "Loaded item non-uuid creator doesn't match original");
263// Assert.That( 246// Assert.That(
264// foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()), 247// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
265// "Loaded item non-uuid creator doesn't match original"); 248// "Loaded item non-uuid creator doesn't match original");
249 Assert.That(
250 foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()),
251 "Loaded item non-uuid creator doesn't match original");
252
253 Assert.That(
254 foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid),
255 "Loaded item uuid creator doesn't match original");
256 Assert.That(foundItem1.Owner, Is.EqualTo(userUuid),
257 "Loaded item owner doesn't match inventory reciever");
258
259 // Now try loading to a root child folder
260 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xA");
261 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
262 archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream);
263
264 InventoryItemBase foundItem2
265 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xA/" + item1Name);
266 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
267
268 // Now try loading to a more deeply nested folder
269 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xB/xC");
270 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
271 archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream);
272
273 InventoryItemBase foundItem3
274 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xB/xC/" + item1Name);
275 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
276 }
277
278 [Test]
279 public void TestIarV0_1WithEscapedChars()
280 {
281 TestHelper.InMethod();
282// log4net.Config.XmlConfigurator.Configure();
283
284 string itemName = "You & you are a mean/man/";
285 string humanEscapedItemName = @"You & you are a mean\/man\/";
286 string userPassword = "meowfood";
287
288 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
289
290 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
291 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
292
293 // Create user
294 string userFirstName = "Jock";
295 string userLastName = "Stirrup";
296 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
297 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
266 298
267// Assert.That( 299 // Create asset
268// foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), 300 SceneObjectGroup object1;
269// "Loaded item uuid creator doesn't match original"); 301 SceneObjectPart part1;
270// Assert.That(foundItem1.Owner, Is.EqualTo(userUuid), 302 {
271// "Loaded item owner doesn't match inventory reciever"); 303 string partName = "part name";
272 304 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
273// // Now try loading to a root child folder 305 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
274// UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xA"); 306 Vector3 groupPosition = new Vector3(10, 20, 30);
275// archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); 307 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
276// archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream); 308 Vector3 offsetPosition = new Vector3(5, 10, 15);
277
278// InventoryItemBase foundItem2
279// = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xA/" + item1Name);
280// Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
281
282// // Now try loading to a more deeply nested folder
283// UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC");
284// archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
285// archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream);
286
287// InventoryItemBase foundItem3
288// = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC/" + item1Name);
289// Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
290 //}
291 309
292 // REFACTORING PROBLEM. Needs rewrite. 310 part1
293// [Test] 311 = new SceneObjectPart(
294// public void TestIarV0_1WithEscapedChars() 312 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
295// { 313 part1.Name = partName;
296// TestHelper.InMethod(); 314
297//// log4net.Config.XmlConfigurator.Configure(); 315 object1 = new SceneObjectGroup(part1);
298 316 scene.AddNewSceneObject(object1, false);
299// string itemName = "You & you are a mean/man/"; 317 }
300// string humanEscapedItemName = @"You & you are a mean\/man\/"; 318
301// string userPassword = "meowfood"; 319 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
302 320 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
303// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 321 scene.AssetService.Store(asset1);
304 322
305// Scene scene = SceneSetupHelpers.SetupScene("Inventory"); 323 // Create item
306// SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 324 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
307// CommunicationsManager cm = scene.CommsManager; 325 InventoryItemBase item1 = new InventoryItemBase();
308 326 item1.Name = itemName;
309// // Create user 327 item1.AssetID = asset1.FullID;
310// string userFirstName = "Jock"; 328 item1.ID = item1Id;
311// string userLastName = "Stirrup"; 329 InventoryFolderBase objsFolder
312// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); 330 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
313 331 item1.Folder = objsFolder.ID;
314// lock (this) 332 scene.AddInventoryItem(userId, item1);
315// { 333
316// UserProfileTestUtils.CreateUserWithInventory( 334 MemoryStream archiveWriteStream = new MemoryStream();
317// cm, userFirstName, userLastName, userPassword, userId, InventoryReceived); 335 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
318// Monitor.Wait(this, 60000); 336
319// } 337 mre.Reset();
320 338 archiverModule.ArchiveInventory(
321// // Create asset 339 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
322// SceneObjectGroup object1; 340 mre.WaitOne(60000, false);
323// SceneObjectPart part1; 341
324// { 342 // LOAD ITEM
325// string partName = "part name"; 343 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
326// UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); 344
327// PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); 345 archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
328// Vector3 groupPosition = new Vector3(10, 20, 30); 346
329// Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); 347 InventoryItemBase foundItem1
330// Vector3 offsetPosition = new Vector3(5, 10, 15); 348 = InventoryArchiveUtils.FindItemByPath(
331 349 scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
332// part1 350
333// = new SceneObjectPart( 351 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
334// ownerId, shape, groupPosition, rotationOffset, offsetPosition);
335// part1.Name = partName;
336
337// object1 = new SceneObjectGroup(part1);
338// scene.AddNewSceneObject(object1, false);
339// }
340
341// UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
342// AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
343// scene.AssetService.Store(asset1);
344
345// // Create item
346// UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
347// InventoryItemBase item1 = new InventoryItemBase();
348// item1.Name = itemName;
349// item1.AssetID = asset1.FullID;
350// item1.ID = item1Id;
351// InventoryFolderBase objsFolder
352// = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
353// item1.Folder = objsFolder.ID;
354// scene.AddInventoryItem(userId, item1);
355
356// MemoryStream archiveWriteStream = new MemoryStream();
357// archiverModule.OnInventoryArchiveSaved += SaveCompleted;
358
359// mre.Reset();
360// archiverModule.ArchiveInventory(
361// Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
362// mre.WaitOne(60000, false);
363
364// // LOAD ITEM
365// MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
366
367// archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
368
369// InventoryItemBase foundItem1
370// = InventoryArchiveUtils.FindItemByPath(
371// scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
372
373// Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
374//// Assert.That(
375//// foundItem1.CreatorId, Is.EqualTo(userUuid),
376//// "Loaded item non-uuid creator doesn't match that of the loading user");
377// Assert.That( 352// Assert.That(
378// foundItem1.Name, Is.EqualTo(itemName), 353// foundItem1.CreatorId, Is.EqualTo(userUuid),
379// "Loaded item name doesn't match saved name"); 354// "Loaded item non-uuid creator doesn't match that of the loading user");
380// } 355 Assert.That(
356 foundItem1.Name, Is.EqualTo(itemName),
357 "Loaded item name doesn't match saved name");
358 }
381 359
382 /// <summary> 360 /// <summary>
383 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 361 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
@@ -386,76 +364,69 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
386 /// 364 ///
387 /// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature 365 /// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature
388 /// (as tested in the a later commented out test) 366 /// (as tested in the a later commented out test)
389 /// REFACTORING PROBLEM. Needs rewrite. 367 /// This test is currently disabled
390// [Test] 368 [Test]
391// public void TestLoadIarV0_1AbsentUsers() 369 public void TestLoadIarV0_1AbsentUsers()
392// { 370 {
393// TestHelper.InMethod(); 371 TestHelper.InMethod();
394 372 //log4net.Config.XmlConfigurator.Configure();
395// //log4net.Config.XmlConfigurator.Configure(); 373
396 374 string userFirstName = "Charlie";
397// string userFirstName = "Charlie"; 375 string userLastName = "Chan";
398// string userLastName = "Chan"; 376 UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999");
399// UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999"); 377 string userItemCreatorFirstName = "Bat";
400// string userItemCreatorFirstName = "Bat"; 378 string userItemCreatorLastName = "Man";
401// string userItemCreatorLastName = "Man"; 379 //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888");
402// //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888"); 380
403 381 string itemName = "b.lsl";
404// string itemName = "b.lsl"; 382 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
405// string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); 383
406 384 MemoryStream archiveWriteStream = new MemoryStream();
407// MemoryStream archiveWriteStream = new MemoryStream(); 385 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
408// TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); 386
409 387 InventoryItemBase item1 = new InventoryItemBase();
410// InventoryItemBase item1 = new InventoryItemBase(); 388 item1.Name = itemName;
411// item1.Name = itemName; 389 item1.AssetID = UUID.Random();
412// item1.AssetID = UUID.Random(); 390 item1.GroupID = UUID.Random();
413// item1.GroupID = UUID.Random(); 391 item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
414// item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName); 392 //item1.CreatorId = userUuid.ToString();
415// //item1.CreatorId = userUuid.ToString(); 393 //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
416// //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; 394 item1.Owner = UUID.Zero;
417// item1.Owner = UUID.Zero; 395
418 396 string item1FileName
419// string item1FileName 397 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
420// = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); 398 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
421// tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); 399 tar.Close();
422// tar.Close(); 400
423 401 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
424// MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); 402 SerialiserModule serialiserModule = new SerialiserModule();
425// SerialiserModule serialiserModule = new SerialiserModule(); 403 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
426// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 404
427 405 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
428// // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene 406 Scene scene = SceneSetupHelpers.SetupScene("inventory");
429// Scene scene = SceneSetupHelpers.SetupScene("inventory"); 407
430// IUserAdminService userAdminService = scene.CommsManager.UserAdminService; 408 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
431 409 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
432// SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 410
433// userAdminService.AddUser( 411 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);
434// userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid); 412
435 413 InventoryItemBase foundItem1
436// archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); 414 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, itemName);
437 415
438// CachedUserInfo userInfo 416 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
439// = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
440
441// InventoryItemBase foundItem1
442// = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName);
443
444// Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
445//// Assert.That(
446//// foundItem1.CreatorId, Is.EqualTo(userUuid),
447//// "Loaded item non-uuid creator doesn't match that of the loading user");
448// Assert.That( 417// Assert.That(
449// foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid), 418// foundItem1.CreatorId, Is.EqualTo(userUuid),
450// "Loaded item uuid creator doesn't match that of the loading user"); 419// "Loaded item non-uuid creator doesn't match that of the loading user");
451// } 420 Assert.That(
421 foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid),
422 "Loaded item uuid creator doesn't match that of the loading user");
423 }
452 424
453 /// <summary> 425 /// <summary>
454 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 426 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
455 /// no account exists with the creator name 427 /// no account exists with the creator name
456 /// </summary> 428 /// </summary>
457 /// Disabled since temporary profiles have not yet been implemented. 429 /// Disabled since temporary profiles have not yet been implemented.
458 /// REFACTORING PROBLEM. Needs rewrite.
459 /// 430 ///
460 //[Test] 431 //[Test]
461 //public void TestLoadIarV0_1TempProfiles() 432 //public void TestLoadIarV0_1TempProfiles()
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
index a355661..e1bc243 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
@@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
44 44
45 public UserAccountCache() 45 public UserAccountCache()
46 { 46 {
47 // Warning: the size values are a bit fuzzy. What matters
48 // most for this cache is the count value (128 entries).
49 m_UUIDCache = new ExpiringCache<UUID, UserAccount>(); 47 m_UUIDCache = new ExpiringCache<UUID, UserAccount>();
50 m_NameCache = new ExpiringCache<string, UUID>(); // this one is unbound 48 m_NameCache = new ExpiringCache<string, UUID>();
51 } 49 }
52 50
53 public void Cache(UUID userID, UserAccount account) 51 public void Cache(UUID userID, UserAccount account)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 4d04af1..58698ee 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
69 SerialiserModule serialiserModule = new SerialiserModule(); 69 SerialiserModule serialiserModule = new SerialiserModule();
70 TerrainModule terrainModule = new TerrainModule(); 70 TerrainModule terrainModule = new TerrainModule();
71 71
72 m_scene = SceneSetupHelpers.SetupScene("useraccounts"); 72 m_scene = SceneSetupHelpers.SetupScene();
73 SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); 73 SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule);
74 } 74 }
75 75
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index ee17fbf..f8591ba 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -267,7 +267,7 @@ namespace OpenSim.Region.Framework.Scenes
267 } 267 }
268 catch (Exception e) 268 catch (Exception e)
269 { 269 {
270 m_log.Error("[SCENE]: SceneBase.cs: Close() - Failed with exception " + e.ToString()); 270 m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e));
271 } 271 }
272 } 272 }
273 273
@@ -376,7 +376,7 @@ namespace OpenSim.Region.Framework.Scenes
376 /// <param name="mod"></param> 376 /// <param name="mod"></param>
377 public void RegisterModuleInterface<M>(M mod) 377 public void RegisterModuleInterface<M>(M mod)
378 { 378 {
379 m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M)); 379// m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M));
380 380
381 List<Object> l = null; 381 List<Object> l = null;
382 if (!ModuleInterfaces.TryGetValue(typeof(M), out l)) 382 if (!ModuleInterfaces.TryGetValue(typeof(M), out l))
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index f719683..cd8c67e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -32,7 +32,7 @@ using System.Globalization;
32using System.Reflection; 32using System.Reflection;
33using System.IO; 33using System.IO;
34using Microsoft.CSharp; 34using Microsoft.CSharp;
35using Microsoft.JScript; 35//using Microsoft.JScript;
36using Microsoft.VisualBasic; 36using Microsoft.VisualBasic;
37using log4net; 37using log4net;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
@@ -82,7 +82,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
82 82
83 private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); 83 private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
84 private static VBCodeProvider VBcodeProvider = new VBCodeProvider(); 84 private static VBCodeProvider VBcodeProvider = new VBCodeProvider();
85 private static JScriptCodeProvider JScodeProvider = new JScriptCodeProvider(); 85// private static JScriptCodeProvider JScodeProvider = new JScriptCodeProvider();
86 private static CSharpCodeProvider YPcodeProvider = new CSharpCodeProvider(); // YP is translated into CSharp 86 private static CSharpCodeProvider YPcodeProvider = new CSharpCodeProvider(); // YP is translated into CSharp
87 private static YP2CSConverter YP_Converter = new YP2CSConverter(); 87 private static YP2CSConverter YP_Converter = new YP2CSConverter();
88 88
@@ -398,9 +398,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
398 case enumCompileType.vb: 398 case enumCompileType.vb:
399 compileScript = CreateVBCompilerScript(compileScript); 399 compileScript = CreateVBCompilerScript(compileScript);
400 break; 400 break;
401 case enumCompileType.js: 401// case enumCompileType.js:
402 compileScript = CreateJSCompilerScript(compileScript); 402// compileScript = CreateJSCompilerScript(compileScript);
403 break; 403// break;
404 case enumCompileType.yp: 404 case enumCompileType.yp:
405 compileScript = CreateYPCompilerScript(compileScript); 405 compileScript = CreateYPCompilerScript(compileScript);
406 break; 406 break;
@@ -423,16 +423,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
423 } 423 }
424 } 424 }
425 425
426 private static string CreateJSCompilerScript(string compileScript) 426// private static string CreateJSCompilerScript(string compileScript)
427 { 427// {
428 compileScript = String.Empty + 428// compileScript = String.Empty +
429 "import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" + 429// "import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" +
430 "package SecondLife {\r\n" + 430// "package SecondLife {\r\n" +
431 "class Script extends OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" + 431// "class Script extends OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
432 compileScript + 432// compileScript +
433 "} }\r\n"; 433// "} }\r\n";
434 return compileScript; 434// return compileScript;
435 } 435// }
436 436
437 private static string CreateCSCompilerScript(string compileScript) 437 private static string CreateCSCompilerScript(string compileScript)
438 { 438 {
@@ -583,10 +583,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
583 } 583 }
584 } while (!complete); 584 } while (!complete);
585 break; 585 break;
586 case enumCompileType.js: 586// case enumCompileType.js:
587 results = JScodeProvider.CompileAssemblyFromSource( 587// results = JScodeProvider.CompileAssemblyFromSource(
588 parameters, Script); 588// parameters, Script);
589 break; 589// break;
590 case enumCompileType.yp: 590 case enumCompileType.yp:
591 results = YPcodeProvider.CompileAssemblyFromSource( 591 results = YPcodeProvider.CompileAssemblyFromSource(
592 parameters, Script); 592 parameters, Script);