From dd4deebbcbe07cccf8ce700c29c9884f1f414c85 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 17 Apr 2008 19:42:54 +0000 Subject: * Re-Fixed caps * This fixes chi11ken's/OpenViewer's libsl cap issue. --- .../Communications/Cache/CachedUserInfo.cs | 13 - .../Framework/Communications/Capabilities/Caps.cs | 9 +- .../Communications/Capabilities/CapsHandlers.cs | 2 + OpenSim/Framework/IScene.cs | 3 +- .../Environment/Modules/BetaGridLikeMoneyModule.cs | 381 +++++++++------------ .../Modules/LandManagement/LandChannel.cs | 17 +- .../Modules/LandManagement/LandManagementModule.cs | 2 +- .../Environment/Scenes/Scene.PacketHandlers.cs | 4 + OpenSim/Region/Environment/Scenes/Scene.cs | 23 +- OpenSim/Region/Environment/Scenes/SceneBase.cs | 12 - OpenSim/Region/Environment/Scenes/SceneEvents.cs | 16 +- 11 files changed, 197 insertions(+), 285 deletions(-) diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 9f202ff..ec5717e 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -251,11 +251,6 @@ namespace OpenSim.Framework.Communications.Cache ItemReceive(userID, itemInfo); m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); } - else - { - m_log.Error("[UNABLE TO UPLOAD]: "); - } - } /// @@ -269,10 +264,6 @@ namespace OpenSim.Framework.Communications.Cache { m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); } - else - { - m_log.Error("[UNABLE TO UPDATE]: "); - } } /// @@ -292,10 +283,6 @@ namespace OpenSim.Framework.Communications.Cache m_commsManager.InventoryService.DeleteInventoryItem(userID, item); } } - else - { - m_log.Error("[UNABLE TO DELETE]: "); - } return result; } diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index a65a3f1..2eff9c2 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -100,6 +100,7 @@ namespace OpenSim.Region.Capabilities private int m_eventQueueCount = 1; private Queue m_capsEventQueue = new Queue(); private bool m_dumpAssetsToFile; + private string m_regionName; // These are callbacks which will be setup by the scene so that we can update scene data when we // receive capability calls @@ -110,7 +111,7 @@ namespace OpenSim.Region.Capabilities public GetClientDelegate GetClient = null; public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, - LLUUID agent, bool dumpAssetsToFile) + LLUUID agent, bool dumpAssetsToFile, string regionName) { m_assetCache = assetCache; m_capsObjectPath = capsPath; @@ -120,6 +121,7 @@ namespace OpenSim.Region.Capabilities m_agentID = agent; m_dumpAssetsToFile = dumpAssetsToFile; m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort); + m_regionName = regionName; } /// @@ -199,6 +201,7 @@ namespace OpenSim.Region.Capabilities /// public string CapsRequest(string request, string path, string param) { + m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); //Console.WriteLine("caps request " + request); string result = LLSDHelpers.SerialiseLLSDReply(m_capsHandlers.CapsDetails); //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); @@ -225,6 +228,7 @@ namespace OpenSim.Region.Capabilities string unmodifiedRequest = request.ToString(); //m_log.DebugFormat("[AGENT INVENTORY]: Received CAPS fetch inventory request {0}", unmodifiedRequest); + m_log.Debug("[CAPS]: Inventory Request in region: " + m_regionName); Hashtable hash = new Hashtable(); try @@ -366,6 +370,7 @@ namespace OpenSim.Region.Capabilities /// public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) { + m_log.Debug("[CAPS]: MapLayer Request in region: " + m_regionName); LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); mapResponse.LayerData.Array.Add(GetLLSDMapLayerResponse()); return mapResponse; @@ -472,6 +477,7 @@ namespace OpenSim.Region.Capabilities { try { + m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName); //m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param); Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request)); @@ -523,6 +529,7 @@ namespace OpenSim.Region.Capabilities /// public string NoteCardAgentInventory(string request, string path, string param) { + m_log.Debug("[CAPS]: NoteCardAgentInventory Request in region: " + m_regionName); //libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)libsecondlife.StructuredData.LLSDParser.DeserializeBinary(Helpers.StringToField(request)); Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request)); LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); diff --git a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs index 3518e20..6992bd1 100644 --- a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs +++ b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs @@ -68,6 +68,8 @@ namespace OpenSim.Region.Capabilities /// handler to be removed public void Remove(string capsName) { + // This line must be here, or caps will break! + m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path); m_capsHandlers.Remove(capsName); } diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index ad3bd91..cdf6257 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -64,7 +64,6 @@ namespace OpenSim.Framework ClientManager ClientManager { get; } - string GetCapsPath(LLUUID agentId); - string GetNewCapsPath(LLUUID agentId); + string GetCapsPath(LLUUID agentId); } } diff --git a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs index 5c1c938..0748719 100644 --- a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs @@ -143,8 +143,8 @@ namespace OpenSim.Region.Environment.Modules { // Centralized grid structure using OpenSimWi Redux revision 9+ // https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux - scene.AddXmlRPCHandler("dynamic_balance_update_request", GridMoneyUpdate); - scene.AddXmlRPCHandler("user_alert", UserAlert); + scene.AddXmlRPCHandler("balanceUpdateRequest", GridMoneyUpdate); + scene.AddXmlRPCHandler("userAlert", UserAlert); } else { @@ -171,12 +171,11 @@ namespace OpenSim.Region.Environment.Modules scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnMoneyTransfer += MoneyTransferAction; scene.EventManager.OnClientClosed += ClientClosed; - scene.EventManager.OnNewInventoryItemUploadComplete += NewInventoryItemEconomyHandler; scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; scene.EventManager.OnMakeChildAgent += MakeChildAgent; scene.EventManager.OnClientClosed += ClientLoggedOut; - scene.EventManager.OnLandBuy += ValidateLandBuy; - scene.EventManager.OnValidatedLandBuy += processLandBuy; + scene.EventManager.OnValidateLandBuy += ValidateLandBuy; + scene.EventManager.OnLandBuy += processLandBuy; } } @@ -214,6 +213,7 @@ namespace OpenSim.Region.Environment.Modules PriceGroupCreate = startupConfig.GetInt("PriceGroupCreate", -1); string EBA = startupConfig.GetString("EconomyBaseAccount", LLUUID.Zero.ToString()); Helpers.TryParse(EBA,out EconomyBaseAccount); + UserLevelPaysFees = startupConfig.GetInt("UserLevelPaysFees", -1); m_stipend = startupConfig.GetInt("UserStipend", 500); m_minFundsBeforeRefresh = startupConfig.GetInt("IssueStipendWhenClientIsBelowAmount", 10); @@ -343,99 +343,54 @@ namespace OpenSim.Region.Environment.Modules private void ValidateLandBuy (Object osender, LandBuyArgs e) { - LLUUID agentId = e.agentId; - int price = e.parcelPrice; - bool final = e.final; - - int funds = 0; - - if (m_MoneyAddress.Length > 0) - { - IClientAPI aClient = LocateClientObject(agentId); - if (aClient != null) - { - Scene s = LocateSceneClientIn(agentId); - if (s != null) - { - Hashtable hbinfo = GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), s.RegionInfo.regionSecret); - if ((bool)hbinfo["success"] == true) - { - - Helpers.TryParse((string)hbinfo["agentId"], out agentId); - try - { - funds = (Int32)hbinfo["funds"]; - } - catch (ArgumentException) - { - } - catch (FormatException) - { - } - catch (OverflowException) - { - m_log.ErrorFormat("[MONEY]: While getting the Currency for user {0}, the return funds overflowed.", agentId); - aClient.SendAlertMessage("Unable to get your money balance, money operations will be unavailable"); - } - catch (InvalidCastException) - { - funds = 0; - } - - SetLocalFundsForAgentID(agentId, funds); - - } - else - { - m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, (string)hbinfo["errorMessage"]); - aClient.SendAlertMessage((string)hbinfo["errorMessage"]); - } - } - } - } - else - { - funds = GetFundsForAgentID(agentId); - } - if (funds >= e.parcelPrice) - { - lock (e) - { - e.economyValidated = true; - } - XMLRPCHandler.EventManager.TriggerValidatedLandBuy(this, e); - } + if (m_MoneyAddress.Length == 0) + { + lock (m_KnownClientFunds) + { + if (m_KnownClientFunds.ContainsKey(e.agentId)) + { + // Does the sender have enough funds to give? + if (m_KnownClientFunds[e.agentId] >= e.parcelPrice) + { + lock(e) + { + e.economyValidated=true; + } + } + } + } + } + else + { + if(GetRemoteBalance(e.agentId) >= e.parcelPrice) + { + lock(e) + { + e.economyValidated=true; + } + } + } } private void processLandBuy(Object osender, LandBuyArgs e) { - LLUUID agentId = e.agentId; - int price = e.parcelPrice; - bool final = e.final; - - int funds = 0; - - // Only do this if we have not already transacted against this. - if (e.transactionID == 0) - { - funds = GetFundsForAgentID(e.agentId); - if (e.landValidated) - { - if (e.parcelPrice >= 0) - { - doMoneyTransfer(agentId, e.parcelOwnerID, e.parcelPrice); - lock (e) - { - e.transactionID = Util.UnixTimeSinceEpoch(); - e.amountDebited = e.parcelPrice; - } - } - // This tells the land module that we've transacted. - XMLRPCHandler.EventManager.TriggerValidatedLandBuy(this, e); - } - } - + lock(e) + { + if(e.economyValidated == true && e.transactionID == 0) + { + e.transactionID=Util.UnixTimeSinceEpoch(); + + if(doMoneyTransfer(e.agentId, e.parcelOwnerID, e.parcelPrice, 0, "Land purchase")) + { + lock (e) + { + e.amountDebited = e.parcelPrice; + } + } + } + } } + /// /// THis method gets called when someone pays someone else as a gift. /// @@ -445,14 +400,13 @@ namespace OpenSim.Region.Environment.Modules { IClientAPI sender = null; IClientAPI receiver = null; - - //m_log.WarnFormat("[MONEY] Explicit transfer of {0} from {1} to {2}", e.amount, e.sender.ToString(), e.receiver.ToString()); sender = LocateClientObject(e.sender); if (sender != null) { receiver = LocateClientObject(e.receiver); - bool transactionresult = doMoneyTransfer(e.sender, e.receiver, e.amount); + + bool transactionresult = doMoneyTransfer(e.sender, e.receiver, e.amount, e.transactiontype, e.description); if (e.sender != e.receiver) { @@ -466,36 +420,11 @@ namespace OpenSim.Region.Environment.Modules { receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(e.receiver)); } - - } else { - m_log.Warn("[MONEY]: Potential Fraud Warning, got money transfer request for avatar that isn't in this simulator - Details; Sender:" + e.sender.ToString() + " Reciver: " + e.receiver.ToString() + " Amount: " + e.amount.ToString()); - } - } - - /// - /// A new inventory item came in, so we must charge if we're configured to do so! - /// - /// - /// - /// - /// - private void NewInventoryItemEconomyHandler(LLUUID Uploader, LLUUID AssetID, String AssetName, int userlevel) - { - // Presumably a normal grid would actually send this information to a server somewhere. - // We're going to apply the UploadCost here. - if (m_enabled) - { - // Only make users that are below the UserLevelPaysFees value pay. - // Use this to exclude Region Owners (2), Estate Managers(1), Users (0), Disabled(-1) - if (PriceUpload > 0 && userlevel <= UserLevelPaysFees) - { - doMoneyTransfer(Uploader, EconomyBaseAccount, PriceUpload); - } + m_log.Warn("[MONEY]: Potential Fraud Warning, got money transfer request for avatar that isn't in this simulator - Details; Sender:" + e.sender.ToString() + " Receiver: " + e.receiver.ToString() + " Amount: " + e.amount.ToString()); } - } /// @@ -504,7 +433,6 @@ namespace OpenSim.Region.Environment.Modules /// private void MakeChildAgent(ScenePresence avatar) { - lock (m_rootAgents) { if (m_rootAgents.ContainsKey(avatar.UUID)) @@ -630,16 +558,14 @@ namespace OpenSim.Region.Environment.Modules #endregion /// - /// Transfer money This currently does Gifts only. + /// Transfer money /// /// /// /// /// - private bool doMoneyTransfer(LLUUID Sender, LLUUID Receiver, int amount) + private bool doMoneyTransfer(LLUUID Sender, LLUUID Receiver, int amount, int transactiontype, string description) { - //m_log.WarnFormat("[MONEY] Transfer {0} from {1} to {2}", amount, Sender.ToString(), Receiver.ToString()); - bool result = false; if (amount >= 0) { @@ -647,49 +573,49 @@ namespace OpenSim.Region.Environment.Modules { // If we don't know about the sender, then the sender can't // actually be here and therefore this is likely fraud or outdated. - if (m_KnownClientFunds.ContainsKey(Sender)) - { - // Does the sender have enough funds to give? - if (m_KnownClientFunds[Sender] >= amount) - { - // Subtract the funds from the senders account - m_KnownClientFunds[Sender] -= amount; - - // do we know about the receiver? - if (!m_KnownClientFunds.ContainsKey(Receiver)) - { - // Make a record for them so they get the updated balance when they login - CheckExistAndRefreshFunds(Receiver); - } - if (m_enabled) - { - if (m_MoneyAddress.Length == 0) - { - //Add the amount to the Receiver's funds - m_KnownClientFunds[Receiver] += amount; - result = true; - } - else - { - - result = TransferMoneyonMoneyServer(Sender, Receiver, amount); - } - } - } - else - { - // These below are redundant to make this clearer to read - result = false; - } - } - else - { - result = false; - } - } + if (m_MoneyAddress.Length == 0) + { + if (m_KnownClientFunds.ContainsKey(Sender)) + { + // Does the sender have enough funds to give? + if (m_KnownClientFunds[Sender] >= amount) + { + // Subtract the funds from the senders account + m_KnownClientFunds[Sender] -= amount; + + // do we know about the receiver? + if (!m_KnownClientFunds.ContainsKey(Receiver)) + { + // Make a record for them so they get the updated balance when they login + CheckExistAndRefreshFunds(Receiver); + } + if (m_enabled) + { + //Add the amount to the Receiver's funds + m_KnownClientFunds[Receiver] += amount; + result = true; + } + } + else + { + // These below are redundant to make this clearer to read + result = false; + } + } + else + { + result = false; + } + } + else + { + result = TransferMoneyonMoneyServer(Sender, Receiver, amount, transactiontype, description); + } + } } return result; } + #region Utility Helpers /// /// Locates a IClientAPI for the client specified @@ -890,7 +816,7 @@ namespace OpenSim.Region.Environment.Modules MoneyBalanceRequestParams["secret"] = regionSecret; MoneyBalanceRequestParams["currencySecret"] = ""; // per - region/user currency secret gotten from the money system - Hashtable MoneyRespData = genericCurrencyXMLRPCRequest(MoneyBalanceRequestParams, "simulator_user_balance_request"); + Hashtable MoneyRespData = genericCurrencyXMLRPCRequest(MoneyBalanceRequestParams, "simulatorUserBalanceRequest"); return MoneyRespData; } @@ -989,7 +915,7 @@ namespace OpenSim.Region.Environment.Modules MoneyBalanceRequestParams["regionId"] = regionId.ToString(); MoneyBalanceRequestParams["secret"] = regionSecret; - Hashtable MoneyRespData = genericCurrencyXMLRPCRequest(MoneyBalanceRequestParams, "simulator_claim_user_request"); + Hashtable MoneyRespData = genericCurrencyXMLRPCRequest(MoneyBalanceRequestParams, "simulatorClaimUserRequest"); IClientAPI sendMoneyBal = LocateClientObject(agentId); if (sendMoneyBal != null) { @@ -1005,13 +931,11 @@ namespace OpenSim.Region.Environment.Modules /// /// /// - public bool TransferMoneyonMoneyServer(LLUUID sourceId, LLUUID destId, int amount) + public bool TransferMoneyonMoneyServer(LLUUID sourceId, LLUUID destId, int amount, int transactiontype, string description) { - string description = "Gift"; int aggregatePermInventory = 0; int aggregatePermNextOwner = 0; int flags = 0; - int transactiontype = 0; bool rvalue = false; IClientAPI cli = LocateClientObject(sourceId); @@ -1039,7 +963,7 @@ namespace OpenSim.Region.Environment.Modules ht["transactionType"] = transactiontype; ht["description"] = description; - Hashtable hresult = genericCurrencyXMLRPCRequest(ht, "region_move_money"); + Hashtable hresult = genericCurrencyXMLRPCRequest(ht, "regionMoveMoney"); if ((bool)hresult["success"] == true) { @@ -1086,6 +1010,63 @@ namespace OpenSim.Region.Environment.Modules } + public int GetRemoteBalance(LLUUID agentId) + { + int funds = 0; + + IClientAPI aClient = LocateClientObject(agentId); + if (aClient != null) + { + Scene s = LocateSceneClientIn(agentId); + if (s != null) + { + if (m_MoneyAddress.Length > 0) + { + Hashtable hbinfo = GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), s.RegionInfo.regionSecret); + if ((bool)hbinfo["success"] == true) + { + try + { + funds = (Int32)hbinfo["funds"]; + } + catch (ArgumentException) + { + } + catch (FormatException) + { + } + catch (OverflowException) + { + m_log.ErrorFormat("[MONEY]: While getting the Currency for user {0}, the return funds overflowed.", agentId); + aClient.SendAlertMessage("Unable to get your money balance, money operations will be unavailable"); + } + catch (InvalidCastException) + { + funds = 0; + } + + } + else + { + m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, (string)hbinfo["errorMessage"]); + aClient.SendAlertMessage((string)hbinfo["errorMessage"]); + } + } + + SetLocalFundsForAgentID(agentId, funds); + SendMoneyBalance(aClient, agentId, aClient.SessionId, LLUUID.Zero); + } + else + { + m_log.Debug("[MONEY]: Got balance request update for agent that is here, but couldn't find which scene."); + } + } + else + { + m_log.Debug("[MONEY]: Got balance request update for agent that isn't here."); + } + return funds; + } public XmlRpcResponse GridMoneyUpdate(XmlRpcRequest request) { @@ -1099,58 +1080,7 @@ namespace OpenSim.Region.Environment.Modules Helpers.TryParse((string)requestData["agentId"], out agentId); if (agentId != LLUUID.Zero) { - IClientAPI aClient = LocateClientObject(agentId); - if (aClient != null) - { - Scene s = LocateSceneClientIn(agentId); - if (s != null) - { - if (m_MoneyAddress.Length > 0) - { - Hashtable hbinfo = GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), s.RegionInfo.regionSecret); - if ((bool)hbinfo["success"] == true) - { - int funds = 0; - Helpers.TryParse((string)hbinfo["agentId"], out agentId); - try - { - funds = (Int32)hbinfo["funds"]; - } - catch (ArgumentException) - { - } - catch (FormatException) - { - } - catch (OverflowException) - { - m_log.ErrorFormat("[MONEY]: While getting the Currency for user {0}, the return funds overflowed.", agentId); - aClient.SendAlertMessage("Unable to get your money balance, money operations will be unavailable"); - } - catch (InvalidCastException) - { - funds = 0; - } - - SetLocalFundsForAgentID(agentId, funds); - } - else - { - m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, (string)hbinfo["errorMessage"]); - aClient.SendAlertMessage((string)hbinfo["errorMessage"]); - } - } - SendMoneyBalance(aClient, agentId, aClient.SessionId, LLUUID.Zero); - } - else - { - m_log.Debug("[MONEY]: Got balance request update for agent that is here, but couldn't find which scene."); - } - } - else - { - m_log.Debug("[MONEY]: Got balance request update for agent that isn't here."); - } + GetRemoteBalance(agentId); } else @@ -1169,6 +1099,7 @@ namespace OpenSim.Region.Environment.Modules r.Value = rparms; return r; } + /// /// XMLRPC handler to send alert message and sound to client /// diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs index a46895e..e3b7cf5 100644 --- a/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs @@ -953,8 +953,12 @@ namespace OpenSim.Region.Environment.Modules.LandManagement } } + // If the economy has been validated by the economy module, + // and land has been validated as well, this method transfers + // the land ownership + public void handleLandBuyRequest(Object o, LandBuyArgs e) - { + { if (e.economyValidated && e.landValidated) { lock (landList) @@ -966,7 +970,15 @@ namespace OpenSim.Region.Environment.Modules.LandManagement } } } - else if (e.landValidated == false) + } + + // After receiving a land buy packet, first the data needs to + // be validated. This method validates the right to buy the + // parcel + + public void handleLandValidationRequest(Object o, LandBuyArgs e) + { + if (e.landValidated == false) { ILandObject lob = null; lock (landList) @@ -994,7 +1006,6 @@ namespace OpenSim.Region.Environment.Modules.LandManagement } } - m_scene.EventManager.TriggerValidatedLandBuy(this, e); } } } diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs index 6b2de47..20f75df 100644 --- a/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs @@ -55,8 +55,8 @@ namespace OpenSim.Region.Environment.Modules.LandManagement m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts; m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel); m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement); + m_scene.EventManager.OnValidateLandBuy += landChannel.handleLandValidationRequest; m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest; - m_scene.EventManager.OnValidatedLandBuy += landChannel.handleLandBuyRequest; lock (m_scene) { diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 1c36853..7e2c9ff 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -136,6 +136,10 @@ namespace OpenSim.Region.Environment.Scenes EventManager.LandBuyArgs args = new EventManager.LandBuyArgs( agentId, groupId, final, groupOwned, removeContribution, parcelLocalID, parcelArea, parcelPrice, authenticated); + // First, allow all validators a stab at it + m_eventManager.TriggerValidateLandBuy(this, args); + + // Then, check validation and transfer m_eventManager.TriggerLandBuy(this, args); } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 20572a9..b81b2d4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1916,25 +1916,8 @@ namespace OpenSim.Region.Environment.Scenes /// /// public void AddCapsHandler(LLUUID agentId) - { - // Here we clear out old Caps handlers for the agent - // this is required because we potentially have multiple simulators in an instance nearby. - Caps oldcap = null; - lock (m_capsHandlers) - { - if (m_capsHandlers.ContainsKey(agentId)) - oldcap = m_capsHandlers[agentId]; - } - if (oldcap != null) - { - oldcap.DeregisterHandlers(); - } - - // Generate a new base caps path LLUUID.Random().ToString() instead of agentId.ToString() - // If the caps paths are not different for each region, the client and sim will do weird - // things like send the request to a region the agent is no longer in. - - String capsObjectPath = GetNewCapsPath(agentId); + { + String capsObjectPath = GetCapsPath(agentId); m_log.DebugFormat( "[CAPS]: Setting up CAPS handler for root agent {0} in {1}", @@ -1942,7 +1925,7 @@ namespace OpenSim.Region.Environment.Scenes Caps cap = new Caps(AssetCache, m_httpListener, m_regInfo.ExternalHostName, m_httpListener.Port, - capsObjectPath, agentId, m_dumpAssetsToFile); + capsObjectPath, agentId, m_dumpAssetsToFile, RegionInfo.RegionName); cap.RegisterHandlers(); EventManager.TriggerOnRegisterCaps(agentId, cap); diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index f863bff..5551173 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -214,17 +214,5 @@ namespace OpenSim.Region.Environment.Scenes return null; } - public string GetNewCapsPath(LLUUID agentID) - { - if (capsPaths.ContainsKey(agentID)) - { - capsPaths[agentID] = LLUUID.Random().ToString(); - } - else - { - capsPaths.Add(agentID, LLUUID.Random().ToString()); - } - return GetCapsPath(agentID); - } } } diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index 89c519e..5cf8ece 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs @@ -167,9 +167,9 @@ namespace OpenSim.Region.Environment.Scenes public int transactiontype; public string description; - public MoneyTransferArgs(LLUUID asender, LLUUID areciever, int aamount, int atransactiontype, string adescription) { + public MoneyTransferArgs(LLUUID asender, LLUUID areceiver, int aamount, int atransactiontype, string adescription) { sender = asender; - receiver = areciever; + receiver = areceiver; amount = aamount; transactiontype = atransactiontype; description = adescription; @@ -219,7 +219,7 @@ namespace OpenSim.Region.Environment.Scenes public event MoneyTransferEvent OnMoneyTransfer; public event LandBuy OnLandBuy; - public event LandBuy OnValidatedLandBuy; + public event LandBuy OnValidateLandBuy; /* Designated Event Deletage Instances */ @@ -253,7 +253,7 @@ namespace OpenSim.Region.Environment.Scenes private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; private LandBuy handlerLandBuy = null; - private LandBuy handlerValidatedLandBuy = null; + private LandBuy handlerValidateLandBuy = null; public void TriggerOnScriptChangedEvent(uint localID, uint change) { @@ -526,12 +526,12 @@ namespace OpenSim.Region.Environment.Scenes handlerLandBuy(sender, e); } } - public void TriggerValidatedLandBuy(Object sender, LandBuyArgs e) + public void TriggerValidateLandBuy(Object sender, LandBuyArgs e) { - handlerValidatedLandBuy = OnValidatedLandBuy; - if (handlerValidatedLandBuy != null) + handlerValidateLandBuy = OnValidateLandBuy; + if (handlerValidateLandBuy != null) { - handlerValidatedLandBuy(sender, e); + handlerValidateLandBuy(sender, e); } } } -- cgit v1.1