aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-04-29 20:50:49 +0100
committerJustin Clark-Casey (justincc)2013-04-29 20:50:49 +0100
commita7cbb9edc98fabc6d2705d69310f4356e84c7596 (patch)
tree7546e86ce35401ff1a2ef08c3bc1f295a3496a10
parentFix bug where an agent that declined an inventory offer and subsequently empt... (diff)
downloadopensim-SC-a7cbb9edc98fabc6d2705d69310f4356e84c7596.zip
opensim-SC-a7cbb9edc98fabc6d2705d69310f4356e84c7596.tar.gz
opensim-SC-a7cbb9edc98fabc6d2705d69310f4356e84c7596.tar.bz2
opensim-SC-a7cbb9edc98fabc6d2705d69310f4356e84c7596.tar.xz
Add regression test for offer, accept and subsequent receiver delete of an item offered via instant message.
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs83
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs12
-rw-r--r--prebuild.xml1
3 files changed, 16 insertions, 80 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index e1ada97..c292700 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -47,10 +47,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
47 47
48 /// <summary> 48 /// <summary>
49 private List<Scene> m_Scenelist = new List<Scene>(); 49 private List<Scene> m_Scenelist = new List<Scene>();
50// private Dictionary<UUID, Scene> m_AgentRegions =
51// new Dictionary<UUID, Scene>();
52 50
53 private IMessageTransferModule m_TransferModule = null; 51 private IMessageTransferModule m_TransferModule;
54 private bool m_Enabled = true; 52 private bool m_Enabled = true;
55 53
56 #region Region Module interface 54 #region Region Module interface
@@ -81,9 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
81// scene.RegisterModuleInterface<IInventoryTransferModule>(this); 79// scene.RegisterModuleInterface<IInventoryTransferModule>(this);
82 80
83 scene.EventManager.OnNewClient += OnNewClient; 81 scene.EventManager.OnNewClient += OnNewClient;
84// scene.EventManager.OnClientClosed += ClientLoggedOut;
85 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 82 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
86// scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene;
87 } 83 }
88 84
89 public void RegionLoaded(Scene scene) 85 public void RegionLoaded(Scene scene)
@@ -96,11 +92,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
96 m_log.Error("[INVENTORY TRANSFER]: No Message transfer module found, transfers will be local only"); 92 m_log.Error("[INVENTORY TRANSFER]: No Message transfer module found, transfers will be local only");
97 m_Enabled = false; 93 m_Enabled = false;
98 94
99 m_Scenelist.Clear(); 95// m_Scenelist.Clear();
100 scene.EventManager.OnNewClient -= OnNewClient; 96// scene.EventManager.OnNewClient -= OnNewClient;
101// scene.EventManager.OnClientClosed -= ClientLoggedOut;
102 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; 97 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
103// scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene;
104 } 98 }
105 } 99 }
106 } 100 }
@@ -108,9 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
108 public void RemoveRegion(Scene scene) 102 public void RemoveRegion(Scene scene)
109 { 103 {
110 scene.EventManager.OnNewClient -= OnNewClient; 104 scene.EventManager.OnNewClient -= OnNewClient;
111// scene.EventManager.OnClientClosed -= ClientLoggedOut;
112 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; 105 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
113// scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene;
114 m_Scenelist.Remove(scene); 106 m_Scenelist.Remove(scene);
115 } 107 }
116 108
@@ -139,11 +131,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
139 // Inventory giving is conducted via instant message 131 // Inventory giving is conducted via instant message
140 client.OnInstantMessage += OnInstantMessage; 132 client.OnInstantMessage += OnInstantMessage;
141 } 133 }
142
143// protected void OnSetRootAgentScene(UUID id, Scene scene)
144// {
145// m_AgentRegions[id] = scene;
146// }
147 134
148 private Scene FindClientScene(UUID agentId) 135 private Scene FindClientScene(UUID agentId)
149 { 136 {
@@ -460,70 +447,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
460 } 447 }
461 } 448 }
462 449
463// public bool NeedSceneCacheClear(UUID agentID, Scene scene)
464// {
465// if (!m_AgentRegions.ContainsKey(agentID))
466// {
467// // Since we can get here two ways, we need to scan
468// // the scenes here. This is somewhat more expensive
469// // but helps avoid a nasty bug
470// //
471//
472// foreach (Scene s in m_Scenelist)
473// {
474// ScenePresence presence;
475//
476// if (s.TryGetScenePresence(agentID, out presence))
477// {
478// // If the agent is in this scene, then we
479// // are being called twice in a single
480// // teleport. This is wasteful of cycles
481// // but harmless due to this 2nd level check
482// //
483// // If the agent is found in another scene
484// // then the list wasn't current
485// //
486// // If the agent is totally unknown, then what
487// // are we even doing here??
488// //
489// if (s == scene)
490// {
491// //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName);
492// return true;
493// }
494// else
495// {
496// //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName);
497// return false;
498// }
499// }
500// }
501// //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName);
502// return true;
503// }
504//
505// // The agent is left in current Scene, so we must be
506// // going to another instance
507// //
508// if (m_AgentRegions[agentID] == scene)
509// {
510// //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName);
511// m_AgentRegions.Remove(agentID);
512// return true;
513// }
514//
515// // Another region has claimed the agent
516// //
517// //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName);
518// return false;
519// }
520//
521// public void ClientLoggedOut(UUID agentID, Scene scene)
522// {
523// if (m_AgentRegions.ContainsKey(agentID))
524// m_AgentRegions.Remove(agentID);
525// }
526
527 /// <summary> 450 /// <summary>
528 /// 451 ///
529 /// </summary> 452 /// </summary>
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index d26e3f7..b7a7463 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -484,6 +484,18 @@ namespace OpenSim.Tests.Common.Mock
484 OnCompleteMovementToRegion(this, true); 484 OnCompleteMovementToRegion(this, true);
485 } 485 }
486 486
487 /// <summary>
488 /// Emulate sending an IM from the viewer to the simulator.
489 /// </summary>
490 /// <param name='im'></param>
491 public void HandleImprovedInstantMessage(GridInstantMessage im)
492 {
493 ImprovedInstantMessage handlerInstantMessage = OnInstantMessage;
494
495 if (handlerInstantMessage != null)
496 handlerInstantMessage(this, im);
497 }
498
487 public virtual void ActivateGesture(UUID assetId, UUID gestureId) 499 public virtual void ActivateGesture(UUID assetId, UUID gestureId)
488 { 500 {
489 } 501 }
diff --git a/prebuild.xml b/prebuild.xml
index 29d7c90..9fbe08b 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -3055,6 +3055,7 @@
3055 <Match path="Avatar/AvatarFactory/Tests" pattern="*.cs" recurse="true"/> 3055 <Match path="Avatar/AvatarFactory/Tests" pattern="*.cs" recurse="true"/>
3056 <Match path="Avatar/Friends/Tests" pattern="*.cs" recurse="true"/> 3056 <Match path="Avatar/Friends/Tests" pattern="*.cs" recurse="true"/>
3057 <Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/> 3057 <Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/>
3058 <Match path="Avatar/Inventory/Transfer/Tests" pattern="*.cs" recurse="true"/>
3058 <Match path="Framework/InventoryAccess/Tests" pattern="*.cs" recurse="true"/> 3059 <Match path="Framework/InventoryAccess/Tests" pattern="*.cs" recurse="true"/>
3059 <Match path="Scripting/VectorRender/Tests" pattern="*.cs" recurse="true"/> 3060 <Match path="Scripting/VectorRender/Tests" pattern="*.cs" recurse="true"/>
3060 <Match path="World/Archiver/Tests" pattern="*.cs" recurse="true"/> 3061 <Match path="World/Archiver/Tests" pattern="*.cs" recurse="true"/>