aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar
diff options
context:
space:
mode:
authorubit2012-08-02 18:21:08 +0200
committerubit2012-08-02 18:21:08 +0200
commit254d3e1ad31f99770074abb49fec03c90d99b246 (patch)
treefe2d2337f0fffec0f44a9f35442d73c8fe78fda3 /OpenSim/Region/CoreModules/Avatar
parenti local libs commit (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC-254d3e1ad31f99770074abb49fec03c90d99b246.zip
opensim-SC-254d3e1ad31f99770074abb49fec03c90d99b246.tar.gz
opensim-SC-254d3e1ad31f99770074abb49fec03c90d99b246.tar.bz2
opensim-SC-254d3e1ad31f99770074abb49fec03c90d99b246.tar.xz
merge crap gerge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Conflicts: bin/Regions/Regions.ini.example bin/lib32/BulletSim.dll bin/lib32/libBulletSim.so bin/lib64/BulletSim.dll bin/lib64/libBulletSim.so
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs51
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Commands/UserCommandsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs20
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs19
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs5
6 files changed, 72 insertions, 29 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 31e8a2e..b588704 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -626,10 +626,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
626 626
627 m_scene.InventoryService.UpdateItem(item); 627 m_scene.InventoryService.UpdateItem(item);
628 628
629 // this gets called when the agent logs off! 629 // If the name of the object has been changed whilst attached then we want to update the inventory
630 // item in the viewer.
630 if (sp.ControllingClient != null) 631 if (sp.ControllingClient != null)
631 sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0); 632 sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
632 } 633 }
634
633 grp.HasGroupChanged = false; // Prevent it being saved over and over 635 grp.HasGroupChanged = false; // Prevent it being saved over and over
634 } 636 }
635// else 637// else
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index cd1e1c1..273e290 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -47,6 +47,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
47using OpenSim.Region.CoreModules.World.Serialiser; 47using OpenSim.Region.CoreModules.World.Serialiser;
48using OpenSim.Region.Framework.Scenes; 48using OpenSim.Region.Framework.Scenes;
49using OpenSim.Region.Framework.Interfaces; 49using OpenSim.Region.Framework.Interfaces;
50using OpenSim.Region.ScriptEngine.Interfaces;
50using OpenSim.Region.ScriptEngine.XEngine; 51using OpenSim.Region.ScriptEngine.XEngine;
51using OpenSim.Services.Interfaces; 52using OpenSim.Services.Interfaces;
52using OpenSim.Tests.Common; 53using OpenSim.Tests.Common;
@@ -289,21 +290,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
289 { 290 {
290 TestHelpers.InMethod(); 291 TestHelpers.InMethod();
291 292
292 Scene scene = CreateTestScene(); 293 Scene scene = CreateScriptingEnabledTestScene();
293 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); 294 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
294 ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); 295 ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1);
295 296
296 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); 297 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
297 TaskInventoryHelpers.AddScript(scene, so.RootPart); 298 TaskInventoryItem scriptItem
299 = TaskInventoryHelpers.AddScript(
300 scene,
301 so.RootPart,
302 "scriptItem",
303 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }");
304
298 InventoryItemBase userItem = UserInventoryHelpers.AddInventoryItem(scene, so, 0x100, 0x1000); 305 InventoryItemBase userItem = UserInventoryHelpers.AddInventoryItem(scene, so, 0x100, 0x1000);
299 306
307 // FIXME: Right now, we have to do a tricksy chat listen to make sure we know when the script is running.
308 // In the future, we need to be able to do this programatically more predicably.
309 scene.EventManager.OnChatFromWorld += OnChatFromWorld;
310
300 scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest); 311 scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest);
301 312
313 m_chatEvent.WaitOne(60000);
314
302 // TODO: Need to have a test that checks the script is actually started but this involves a lot more 315 // TODO: Need to have a test that checks the script is actually started but this involves a lot more
303 // plumbing of the script engine and either pausing for events or more infrastructure to turn off various 316 // plumbing of the script engine and either pausing for events or more infrastructure to turn off various
304 // script engine delays/asychronicity that isn't helpful in an automated regression testing context. 317 // script engine delays/asychronicity that isn't helpful in an automated regression testing context.
305 SceneObjectGroup attSo = scene.GetSceneObjectGroup(so.Name); 318 SceneObjectGroup attSo = scene.GetSceneObjectGroup(so.Name);
306 Assert.That(attSo.ContainsScripts(), Is.True); 319 Assert.That(attSo.ContainsScripts(), Is.True);
320
321 TaskInventoryItem reRezzedScriptItem = attSo.RootPart.Inventory.GetInventoryItem(scriptItem.Name);
322 IScriptModule xengine = scene.RequestModuleInterface<IScriptModule>();
323 Assert.That(xengine.GetScriptState(reRezzedScriptItem.ItemID), Is.True);
307 } 324 }
308 325
309 [Test] 326 [Test]
@@ -379,29 +396,49 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
379 ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); 396 ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1);
380 397
381 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); 398 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
382 TaskInventoryHelpers.AddScript(scene, so.RootPart); 399 TaskInventoryItem scriptTaskItem
400 = TaskInventoryHelpers.AddScript(
401 scene,
402 so.RootPart,
403 "scriptItem",
404 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }");
405
383 InventoryItemBase userItem = UserInventoryHelpers.AddInventoryItem(scene, so, 0x100, 0x1000); 406 InventoryItemBase userItem = UserInventoryHelpers.AddInventoryItem(scene, so, 0x100, 0x1000);
384 407
385 // FIXME: Right now, we have to do a tricksy chat listen to make sure we know when the script is running. 408 // FIXME: Right now, we have to do a tricksy chat listen to make sure we know when the script is running.
386 // In the future, we need to be able to do this programatically more predicably. 409 // In the future, we need to be able to do this programatically more predicably.
387 scene.EventManager.OnChatFromWorld += OnChatFromWorld; 410 scene.EventManager.OnChatFromWorld += OnChatFromWorld;
388 411
389 SceneObjectGroup soRezzed 412 SceneObjectGroup rezzedSo
390 = (SceneObjectGroup)scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest); 413 = (SceneObjectGroup)(scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest));
391 414
392 // Wait for chat to signal rezzed script has been started. 415 // Wait for chat to signal rezzed script has been started.
393 m_chatEvent.WaitOne(60000); 416 m_chatEvent.WaitOne(60000);
394 417
395 scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, soRezzed); 418 scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, rezzedSo);
396 419
397 InventoryItemBase userItemUpdated = scene.InventoryService.GetItem(userItem); 420 InventoryItemBase userItemUpdated = scene.InventoryService.GetItem(userItem);
398 AssetBase asset = scene.AssetService.Get(userItemUpdated.AssetID.ToString()); 421 AssetBase asset = scene.AssetService.Get(userItemUpdated.AssetID.ToString());
399 422
423 // TODO: It would probably be better here to check script state via the saving and retrieval of state
424 // information at a higher level, rather than having to inspect the serialization.
400 XmlDocument soXml = new XmlDocument(); 425 XmlDocument soXml = new XmlDocument();
401 soXml.LoadXml(Encoding.UTF8.GetString(asset.Data)); 426 soXml.LoadXml(Encoding.UTF8.GetString(asset.Data));
402 427
403 XmlNodeList scriptStateNodes = soXml.GetElementsByTagName("ScriptState"); 428 XmlNodeList scriptStateNodes = soXml.GetElementsByTagName("ScriptState");
404 Assert.That(scriptStateNodes.Count, Is.EqualTo(1)); 429 Assert.That(scriptStateNodes.Count, Is.EqualTo(1));
430
431 // Re-rez the attachment to check script running state
432 SceneObjectGroup reRezzedSo = (SceneObjectGroup)(scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest));
433
434 // Wait for chat to signal rezzed script has been started.
435 m_chatEvent.WaitOne(60000);
436
437 TaskInventoryItem reRezzedScriptItem = reRezzedSo.RootPart.Inventory.GetInventoryItem(scriptTaskItem.Name);
438 IScriptModule xengine = scene.RequestModuleInterface<IScriptModule>();
439 Assert.That(xengine.GetScriptState(reRezzedScriptItem.ItemID), Is.True);
440
441// Console.WriteLine(soXml.OuterXml);
405 } 442 }
406 443
407 /// <summary> 444 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Commands/UserCommandsModule.cs b/OpenSim/Region/CoreModules/Avatar/Commands/UserCommandsModule.cs
index 4bcd2ac..764adf9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Commands/UserCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Commands/UserCommandsModule.cs
@@ -37,7 +37,7 @@ using Nini.Config;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
40using OpenSim.Framework.Statistics; 40using OpenSim.Framework.Monitoring;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43 43
diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
index 31363e5..b258e13 100644
--- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
@@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
96 96
97 scene.EventManager.OnNewClient += OnNewClient; 97 scene.EventManager.OnNewClient += OnNewClient;
98 scene.EventManager.OnClientClosed += OnClientClosed; 98 scene.EventManager.OnClientClosed += OnClientClosed;
99 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 99// scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
100 } 100 }
101 101
102 public void PostInitialise() 102 public void PostInitialise()
@@ -133,7 +133,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
133 private void OnNewClient(IClientAPI client) 133 private void OnNewClient(IClientAPI client)
134 { 134 {
135 // Subscribe to instant messages 135 // Subscribe to instant messages
136 client.OnInstantMessage += OnInstantMessage; 136// client.OnInstantMessage += OnInstantMessage;
137 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; 137 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
138 client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; 138 client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
139 lock (m_ClientMap) 139 lock (m_ClientMap)
@@ -171,15 +171,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
171 ActiveGroupTitle); 171 ActiveGroupTitle);
172 } 172 }
173 173
174 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 174// private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
175 { 175// {
176 } 176// }
177 177
178 private void OnGridInstantMessage(GridInstantMessage msg) 178// private void OnGridInstantMessage(GridInstantMessage msg)
179 { 179// {
180 // Trigger the above event handler 180// // Trigger the above event handler
181 OnInstantMessage(null, msg); 181// OnInstantMessage(null, msg);
182 } 182// }
183 183
184 private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client) 184 private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client)
185 { 185 {
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 6064ddc..1406aae 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -141,13 +141,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
141 foreach (Scene scene in m_Scenes) 141 foreach (Scene scene in m_Scenes)
142 { 142 {
143// m_log.DebugFormat( 143// m_log.DebugFormat(
144// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", 144// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
145// toAgentID.ToString(), scene.RegionInfo.RegionName); 145// toAgentID.ToString(), scene.RegionInfo.RegionName);
146
146 ScenePresence sp = scene.GetScenePresence(toAgentID); 147 ScenePresence sp = scene.GetScenePresence(toAgentID);
147 if (sp != null && !sp.IsChildAgent) 148 if (sp != null && !sp.IsChildAgent)
148 { 149 {
149 // Local message 150 // Local message
150// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); 151 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", sp.Name, toAgentID);
152
151 sp.ControllingClient.SendInstantMessage(im); 153 sp.ControllingClient.SendInstantMessage(im);
152 154
153 // Message sent 155 // Message sent
@@ -159,13 +161,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
159 // try child avatar second 161 // try child avatar second
160 foreach (Scene scene in m_Scenes) 162 foreach (Scene scene in m_Scenes)
161 { 163 {
162// m_log.DebugFormat( 164 m_log.DebugFormat(
163// "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); 165 "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName);
166
164 ScenePresence sp = scene.GetScenePresence(toAgentID); 167 ScenePresence sp = scene.GetScenePresence(toAgentID);
165 if (sp != null) 168 if (sp != null)
166 { 169 {
167 // Local message 170 // Local message
168// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); 171 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", sp.Name, toAgentID);
172
169 sp.ControllingClient.SendInstantMessage(im); 173 sp.ControllingClient.SendInstantMessage(im);
170 174
171 // Message sent 175 // Message sent
@@ -174,10 +178,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
174 } 178 }
175 } 179 }
176 180
177// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); 181 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
178 SendGridInstantMessageViaXMLRPC(im, result);
179 182
180 return; 183 SendGridInstantMessageViaXMLRPC(im, result);
181 } 184 }
182 185
183 private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) 186 private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result)
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 80554fb..81de29c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -313,8 +313,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
313 m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); 313 m_TransferModule.SendInstantMessage(im, delegate(bool success) {});
314 } 314 }
315 } 315 }
316 else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined || 316 else if (
317 im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined) 317 im.dialog == (byte)InstantMessageDialog.InventoryDeclined
318 || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined)
318 { 319 {
319 // Here, the recipient is local and we can assume that the 320 // Here, the recipient is local and we can assume that the
320 // inventory is loaded. Courtesy of the above bulk update, 321 // inventory is loaded. Courtesy of the above bulk update,