From ee4d4d784eb9b51b29fe4bda3fc9ec3594d24f5a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 21 Nov 2008 07:33:13 +0000 Subject: Fully implement object return from the parcel dialog --- OpenSim/Region/Environment/Scenes/Scene.cs | 90 ++++++++++++++++-------------- 1 file changed, 48 insertions(+), 42 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f37ba25..741c47e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -966,54 +966,60 @@ namespace OpenSim.Region.Environment.Scenes /// public void Backup() { - m_returns.Clear(); - - EventManager.TriggerOnBackup(m_storageManager.DataStore); - m_backingup = false; - - foreach (KeyValuePair ret in m_returns) - { - UUID transaction = UUID.Random(); - - GridInstantMessage msg = new GridInstantMessage(); - msg.fromAgentID = new Guid(UUID.Zero.ToString()); // From server - msg.toAgentID = new Guid(ret.Key.ToString()); - msg.imSessionID = new Guid(transaction.ToString()); - msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); - msg.fromAgentName = "Server"; - msg.dialog = (byte)19; // Object msg - msg.fromGroup = false; - msg.offline = (byte)1; - msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; - msg.Position = Vector3.Zero; - msg.RegionID = RegionInfo.RegionID.Guid; - msg.binaryBucket = new byte[0]; - if (ret.Value.count > 1) - msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to parcel auto return", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName); - else - msg.message = string.Format("Your object {0} was returned from {1} in region {2} due to parcel auto return", ret.Value.objectName, ret.Value.location.ToString(), RegionInfo.RegionName); + lock(m_returns) + { + EventManager.TriggerOnBackup(m_storageManager.DataStore); + m_backingup = false; - IMessageTransferModule tr = RequestModuleInterface(); - if (tr != null) - tr.SendInstantMessage(msg, delegate(bool success) {} ); + foreach (KeyValuePair ret in m_returns) + { + UUID transaction = UUID.Random(); + + GridInstantMessage msg = new GridInstantMessage(); + msg.fromAgentID = new Guid(UUID.Zero.ToString()); // From server + msg.toAgentID = new Guid(ret.Key.ToString()); + msg.imSessionID = new Guid(transaction.ToString()); + msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); + msg.fromAgentName = "Server"; + msg.dialog = (byte)19; // Object msg + msg.fromGroup = false; + msg.offline = (byte)1; + msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; + msg.Position = Vector3.Zero; + msg.RegionID = RegionInfo.RegionID.Guid; + msg.binaryBucket = new byte[0]; + if (ret.Value.count > 1) + msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to {3}", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); + else + msg.message = string.Format("Your object {0} was returned from {1} in region {2} due to {3}", ret.Value.objectName, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); + + IMessageTransferModule tr = RequestModuleInterface(); + if (tr != null) + tr.SendInstantMessage(msg, delegate(bool success) {} ); + } + m_returns.Clear(); } } - public void AddReturn(UUID agentID, string objectName, Vector3 location) + public void AddReturn(UUID agentID, string objectName, Vector3 location, string reason) { - if (m_returns.ContainsKey(agentID)) - { - ReturnInfo info = m_returns[agentID]; - info.count++; - m_returns[agentID] = info; - } - else + lock(m_returns) { - ReturnInfo info = new ReturnInfo(); - info.count = 1; - info.objectName = objectName; - info.location = location; - m_returns[agentID] = info; + if (m_returns.ContainsKey(agentID)) + { + ReturnInfo info = m_returns[agentID]; + info.count++; + m_returns[agentID] = info; + } + else + { + ReturnInfo info = new ReturnInfo(); + info.count = 1; + info.objectName = objectName; + info.location = location; + info.reason = reason; + m_returns[agentID] = info; + } } } -- cgit v1.1