aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-04-17 19:42:54 +0000
committerTeravus Ovares2008-04-17 19:42:54 +0000
commitdd4deebbcbe07cccf8ce700c29c9884f1f414c85 (patch)
treee5df5e61c84e800d5d38db3b72209d1bc2764959 /OpenSim/Region
parent* Acks the first UseCircuitCode packet (diff)
downloadopensim-SC_OLD-dd4deebbcbe07cccf8ce700c29c9884f1f414c85.zip
opensim-SC_OLD-dd4deebbcbe07cccf8ce700c29c9884f1f414c85.tar.gz
opensim-SC_OLD-dd4deebbcbe07cccf8ce700c29c9884f1f414c85.tar.bz2
opensim-SC_OLD-dd4deebbcbe07cccf8ce700c29c9884f1f414c85.tar.xz
* Re-Fixed caps
* This fixes chi11ken's/OpenViewer's libsl cap issue.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs381
-rw-r--r--OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs17
-rw-r--r--OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs23
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs16
7 files changed, 186 insertions, 269 deletions
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
143 { 143 {
144 // Centralized grid structure using OpenSimWi Redux revision 9+ 144 // Centralized grid structure using OpenSimWi Redux revision 9+
145 // https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux 145 // https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux
146 scene.AddXmlRPCHandler("dynamic_balance_update_request", GridMoneyUpdate); 146 scene.AddXmlRPCHandler("balanceUpdateRequest", GridMoneyUpdate);
147 scene.AddXmlRPCHandler("user_alert", UserAlert); 147 scene.AddXmlRPCHandler("userAlert", UserAlert);
148 } 148 }
149 else 149 else
150 { 150 {
@@ -171,12 +171,11 @@ namespace OpenSim.Region.Environment.Modules
171 scene.EventManager.OnNewClient += OnNewClient; 171 scene.EventManager.OnNewClient += OnNewClient;
172 scene.EventManager.OnMoneyTransfer += MoneyTransferAction; 172 scene.EventManager.OnMoneyTransfer += MoneyTransferAction;
173 scene.EventManager.OnClientClosed += ClientClosed; 173 scene.EventManager.OnClientClosed += ClientClosed;
174 scene.EventManager.OnNewInventoryItemUploadComplete += NewInventoryItemEconomyHandler;
175 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 174 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
176 scene.EventManager.OnMakeChildAgent += MakeChildAgent; 175 scene.EventManager.OnMakeChildAgent += MakeChildAgent;
177 scene.EventManager.OnClientClosed += ClientLoggedOut; 176 scene.EventManager.OnClientClosed += ClientLoggedOut;
178 scene.EventManager.OnLandBuy += ValidateLandBuy; 177 scene.EventManager.OnValidateLandBuy += ValidateLandBuy;
179 scene.EventManager.OnValidatedLandBuy += processLandBuy; 178 scene.EventManager.OnLandBuy += processLandBuy;
180 179
181 } 180 }
182 } 181 }
@@ -214,6 +213,7 @@ namespace OpenSim.Region.Environment.Modules
214 PriceGroupCreate = startupConfig.GetInt("PriceGroupCreate", -1); 213 PriceGroupCreate = startupConfig.GetInt("PriceGroupCreate", -1);
215 string EBA = startupConfig.GetString("EconomyBaseAccount", LLUUID.Zero.ToString()); 214 string EBA = startupConfig.GetString("EconomyBaseAccount", LLUUID.Zero.ToString());
216 Helpers.TryParse(EBA,out EconomyBaseAccount); 215 Helpers.TryParse(EBA,out EconomyBaseAccount);
216
217 UserLevelPaysFees = startupConfig.GetInt("UserLevelPaysFees", -1); 217 UserLevelPaysFees = startupConfig.GetInt("UserLevelPaysFees", -1);
218 m_stipend = startupConfig.GetInt("UserStipend", 500); 218 m_stipend = startupConfig.GetInt("UserStipend", 500);
219 m_minFundsBeforeRefresh = startupConfig.GetInt("IssueStipendWhenClientIsBelowAmount", 10); 219 m_minFundsBeforeRefresh = startupConfig.GetInt("IssueStipendWhenClientIsBelowAmount", 10);
@@ -343,99 +343,54 @@ namespace OpenSim.Region.Environment.Modules
343 343
344 private void ValidateLandBuy (Object osender, LandBuyArgs e) 344 private void ValidateLandBuy (Object osender, LandBuyArgs e)
345 { 345 {
346 LLUUID agentId = e.agentId; 346 if (m_MoneyAddress.Length == 0)
347 int price = e.parcelPrice; 347 {
348 bool final = e.final; 348 lock (m_KnownClientFunds)
349 349 {
350 int funds = 0; 350 if (m_KnownClientFunds.ContainsKey(e.agentId))
351 351 {
352 if (m_MoneyAddress.Length > 0) 352 // Does the sender have enough funds to give?
353 { 353 if (m_KnownClientFunds[e.agentId] >= e.parcelPrice)
354 IClientAPI aClient = LocateClientObject(agentId); 354 {
355 if (aClient != null) 355 lock(e)
356 { 356 {
357 Scene s = LocateSceneClientIn(agentId); 357 e.economyValidated=true;
358 if (s != null) 358 }
359 { 359 }
360 Hashtable hbinfo = GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), s.RegionInfo.regionSecret); 360 }
361 if ((bool)hbinfo["success"] == true) 361 }
362 { 362 }
363 363 else
364 Helpers.TryParse((string)hbinfo["agentId"], out agentId); 364 {
365 try 365 if(GetRemoteBalance(e.agentId) >= e.parcelPrice)
366 { 366 {
367 funds = (Int32)hbinfo["funds"]; 367 lock(e)
368 } 368 {
369 catch (ArgumentException) 369 e.economyValidated=true;
370 { 370 }
371 } 371 }
372 catch (FormatException) 372 }
373 {
374 }
375 catch (OverflowException)
376 {
377 m_log.ErrorFormat("[MONEY]: While getting the Currency for user {0}, the return funds overflowed.", agentId);
378 aClient.SendAlertMessage("Unable to get your money balance, money operations will be unavailable");
379 }
380 catch (InvalidCastException)
381 {
382 funds = 0;
383 }
384
385 SetLocalFundsForAgentID(agentId, funds);
386
387 }
388 else
389 {
390 m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, (string)hbinfo["errorMessage"]);
391 aClient.SendAlertMessage((string)hbinfo["errorMessage"]);
392 }
393 }
394 }
395 }
396 else
397 {
398 funds = GetFundsForAgentID(agentId);
399 }
400 if (funds >= e.parcelPrice)
401 {
402 lock (e)
403 {
404 e.economyValidated = true;
405 }
406 XMLRPCHandler.EventManager.TriggerValidatedLandBuy(this, e);
407 }
408 } 373 }
409 374
410 private void processLandBuy(Object osender, LandBuyArgs e) 375 private void processLandBuy(Object osender, LandBuyArgs e)
411 { 376 {
412 LLUUID agentId = e.agentId; 377 lock(e)
413 int price = e.parcelPrice; 378 {
414 bool final = e.final; 379 if(e.economyValidated == true && e.transactionID == 0)
415 380 {
416 int funds = 0; 381 e.transactionID=Util.UnixTimeSinceEpoch();
417 382
418 // Only do this if we have not already transacted against this. 383 if(doMoneyTransfer(e.agentId, e.parcelOwnerID, e.parcelPrice, 0, "Land purchase"))
419 if (e.transactionID == 0) 384 {
420 { 385 lock (e)
421 funds = GetFundsForAgentID(e.agentId); 386 {
422 if (e.landValidated) 387 e.amountDebited = e.parcelPrice;
423 { 388 }
424 if (e.parcelPrice >= 0) 389 }
425 { 390 }
426 doMoneyTransfer(agentId, e.parcelOwnerID, e.parcelPrice); 391 }
427 lock (e)
428 {
429 e.transactionID = Util.UnixTimeSinceEpoch();
430 e.amountDebited = e.parcelPrice;
431 }
432 }
433 // This tells the land module that we've transacted.
434 XMLRPCHandler.EventManager.TriggerValidatedLandBuy(this, e);
435 }
436 }
437
438 } 392 }
393
439 /// <summary> 394 /// <summary>
440 /// THis method gets called when someone pays someone else as a gift. 395 /// THis method gets called when someone pays someone else as a gift.
441 /// </summary> 396 /// </summary>
@@ -445,14 +400,13 @@ namespace OpenSim.Region.Environment.Modules
445 { 400 {
446 IClientAPI sender = null; 401 IClientAPI sender = null;
447 IClientAPI receiver = null; 402 IClientAPI receiver = null;
448
449 //m_log.WarnFormat("[MONEY] Explicit transfer of {0} from {1} to {2}", e.amount, e.sender.ToString(), e.receiver.ToString());
450 403
451 sender = LocateClientObject(e.sender); 404 sender = LocateClientObject(e.sender);
452 if (sender != null) 405 if (sender != null)
453 { 406 {
454 receiver = LocateClientObject(e.receiver); 407 receiver = LocateClientObject(e.receiver);
455 bool transactionresult = doMoneyTransfer(e.sender, e.receiver, e.amount); 408
409 bool transactionresult = doMoneyTransfer(e.sender, e.receiver, e.amount, e.transactiontype, e.description);
456 410
457 if (e.sender != e.receiver) 411 if (e.sender != e.receiver)
458 { 412 {
@@ -466,36 +420,11 @@ namespace OpenSim.Region.Environment.Modules
466 { 420 {
467 receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(e.receiver)); 421 receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(e.description), GetFundsForAgentID(e.receiver));
468 } 422 }
469
470
471 } 423 }
472 else 424 else
473 { 425 {
474 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()); 426 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());
475 }
476 }
477
478 /// <summary>
479 /// A new inventory item came in, so we must charge if we're configured to do so!
480 /// </summary>
481 /// <param name="Uploader"></param>
482 /// <param name="AssetID"></param>
483 /// <param name="AssetName"></param>
484 /// <param name="userlevel"></param>
485 private void NewInventoryItemEconomyHandler(LLUUID Uploader, LLUUID AssetID, String AssetName, int userlevel)
486 {
487 // Presumably a normal grid would actually send this information to a server somewhere.
488 // We're going to apply the UploadCost here.
489 if (m_enabled)
490 {
491 // Only make users that are below the UserLevelPaysFees value pay.
492 // Use this to exclude Region Owners (2), Estate Managers(1), Users (0), Disabled(-1)
493 if (PriceUpload > 0 && userlevel <= UserLevelPaysFees)
494 {
495 doMoneyTransfer(Uploader, EconomyBaseAccount, PriceUpload);
496 }
497 } 427 }
498
499 } 428 }
500 429
501 /// <summary> 430 /// <summary>
@@ -504,7 +433,6 @@ namespace OpenSim.Region.Environment.Modules
504 /// <param name="avatar"></param> 433 /// <param name="avatar"></param>
505 private void MakeChildAgent(ScenePresence avatar) 434 private void MakeChildAgent(ScenePresence avatar)
506 { 435 {
507
508 lock (m_rootAgents) 436 lock (m_rootAgents)
509 { 437 {
510 if (m_rootAgents.ContainsKey(avatar.UUID)) 438 if (m_rootAgents.ContainsKey(avatar.UUID))
@@ -630,16 +558,14 @@ namespace OpenSim.Region.Environment.Modules
630 #endregion 558 #endregion
631 559
632 /// <summary> 560 /// <summary>
633 /// Transfer money This currently does Gifts only. 561 /// Transfer money
634 /// </summary> 562 /// </summary>
635 /// <param name="Sender"></param> 563 /// <param name="Sender"></param>
636 /// <param name="Receiver"></param> 564 /// <param name="Receiver"></param>
637 /// <param name="amount"></param> 565 /// <param name="amount"></param>
638 /// <returns></returns> 566 /// <returns></returns>
639 private bool doMoneyTransfer(LLUUID Sender, LLUUID Receiver, int amount) 567 private bool doMoneyTransfer(LLUUID Sender, LLUUID Receiver, int amount, int transactiontype, string description)
640 { 568 {
641 //m_log.WarnFormat("[MONEY] Transfer {0} from {1} to {2}", amount, Sender.ToString(), Receiver.ToString());
642
643 bool result = false; 569 bool result = false;
644 if (amount >= 0) 570 if (amount >= 0)
645 { 571 {
@@ -647,49 +573,49 @@ namespace OpenSim.Region.Environment.Modules
647 { 573 {
648 // If we don't know about the sender, then the sender can't 574 // If we don't know about the sender, then the sender can't
649 // actually be here and therefore this is likely fraud or outdated. 575 // actually be here and therefore this is likely fraud or outdated.
650 if (m_KnownClientFunds.ContainsKey(Sender)) 576 if (m_MoneyAddress.Length == 0)
651 { 577 {
652 // Does the sender have enough funds to give? 578 if (m_KnownClientFunds.ContainsKey(Sender))
653 if (m_KnownClientFunds[Sender] >= amount) 579 {
654 { 580 // Does the sender have enough funds to give?
655 // Subtract the funds from the senders account 581 if (m_KnownClientFunds[Sender] >= amount)
656 m_KnownClientFunds[Sender] -= amount; 582 {
657 583 // Subtract the funds from the senders account
658 // do we know about the receiver? 584 m_KnownClientFunds[Sender] -= amount;
659 if (!m_KnownClientFunds.ContainsKey(Receiver)) 585
660 { 586 // do we know about the receiver?
661 // Make a record for them so they get the updated balance when they login 587 if (!m_KnownClientFunds.ContainsKey(Receiver))
662 CheckExistAndRefreshFunds(Receiver); 588 {
663 } 589 // Make a record for them so they get the updated balance when they login
664 if (m_enabled) 590 CheckExistAndRefreshFunds(Receiver);
665 { 591 }
666 if (m_MoneyAddress.Length == 0) 592 if (m_enabled)
667 { 593 {
668 //Add the amount to the Receiver's funds 594 //Add the amount to the Receiver's funds
669 m_KnownClientFunds[Receiver] += amount; 595 m_KnownClientFunds[Receiver] += amount;
670 result = true; 596 result = true;
671 } 597 }
672 else 598 }
673 { 599 else
674 600 {
675 result = TransferMoneyonMoneyServer(Sender, Receiver, amount); 601 // These below are redundant to make this clearer to read
676 } 602 result = false;
677 } 603 }
678 } 604 }
679 else 605 else
680 { 606 {
681 // These below are redundant to make this clearer to read 607 result = false;
682 result = false; 608 }
683 } 609 }
684 } 610 else
685 else 611 {
686 { 612 result = TransferMoneyonMoneyServer(Sender, Receiver, amount, transactiontype, description);
687 result = false; 613 }
688 } 614 }
689 }
690 } 615 }
691 return result; 616 return result;
692 } 617 }
618
693 #region Utility Helpers 619 #region Utility Helpers
694 /// <summary> 620 /// <summary>
695 /// Locates a IClientAPI for the client specified 621 /// Locates a IClientAPI for the client specified
@@ -890,7 +816,7 @@ namespace OpenSim.Region.Environment.Modules
890 MoneyBalanceRequestParams["secret"] = regionSecret; 816 MoneyBalanceRequestParams["secret"] = regionSecret;
891 MoneyBalanceRequestParams["currencySecret"] = ""; // per - region/user currency secret gotten from the money system 817 MoneyBalanceRequestParams["currencySecret"] = ""; // per - region/user currency secret gotten from the money system
892 818
893 Hashtable MoneyRespData = genericCurrencyXMLRPCRequest(MoneyBalanceRequestParams, "simulator_user_balance_request"); 819 Hashtable MoneyRespData = genericCurrencyXMLRPCRequest(MoneyBalanceRequestParams, "simulatorUserBalanceRequest");
894 820
895 return MoneyRespData; 821 return MoneyRespData;
896 } 822 }
@@ -989,7 +915,7 @@ namespace OpenSim.Region.Environment.Modules
989 MoneyBalanceRequestParams["regionId"] = regionId.ToString(); 915 MoneyBalanceRequestParams["regionId"] = regionId.ToString();
990 MoneyBalanceRequestParams["secret"] = regionSecret; 916 MoneyBalanceRequestParams["secret"] = regionSecret;
991 917
992 Hashtable MoneyRespData = genericCurrencyXMLRPCRequest(MoneyBalanceRequestParams, "simulator_claim_user_request"); 918 Hashtable MoneyRespData = genericCurrencyXMLRPCRequest(MoneyBalanceRequestParams, "simulatorClaimUserRequest");
993 IClientAPI sendMoneyBal = LocateClientObject(agentId); 919 IClientAPI sendMoneyBal = LocateClientObject(agentId);
994 if (sendMoneyBal != null) 920 if (sendMoneyBal != null)
995 { 921 {
@@ -1005,13 +931,11 @@ namespace OpenSim.Region.Environment.Modules
1005 /// <param name="destId"></param> 931 /// <param name="destId"></param>
1006 /// <param name="amount"></param> 932 /// <param name="amount"></param>
1007 /// <returns></returns> 933 /// <returns></returns>
1008 public bool TransferMoneyonMoneyServer(LLUUID sourceId, LLUUID destId, int amount) 934 public bool TransferMoneyonMoneyServer(LLUUID sourceId, LLUUID destId, int amount, int transactiontype, string description)
1009 { 935 {
1010 string description = "Gift";
1011 int aggregatePermInventory = 0; 936 int aggregatePermInventory = 0;
1012 int aggregatePermNextOwner = 0; 937 int aggregatePermNextOwner = 0;
1013 int flags = 0; 938 int flags = 0;
1014 int transactiontype = 0;
1015 bool rvalue = false; 939 bool rvalue = false;
1016 940
1017 IClientAPI cli = LocateClientObject(sourceId); 941 IClientAPI cli = LocateClientObject(sourceId);
@@ -1039,7 +963,7 @@ namespace OpenSim.Region.Environment.Modules
1039 ht["transactionType"] = transactiontype; 963 ht["transactionType"] = transactiontype;
1040 ht["description"] = description; 964 ht["description"] = description;
1041 965
1042 Hashtable hresult = genericCurrencyXMLRPCRequest(ht, "region_move_money"); 966 Hashtable hresult = genericCurrencyXMLRPCRequest(ht, "regionMoveMoney");
1043 967
1044 if ((bool)hresult["success"] == true) 968 if ((bool)hresult["success"] == true)
1045 { 969 {
@@ -1086,6 +1010,63 @@ namespace OpenSim.Region.Environment.Modules
1086 1010
1087 } 1011 }
1088 1012
1013 public int GetRemoteBalance(LLUUID agentId)
1014 {
1015 int funds = 0;
1016
1017 IClientAPI aClient = LocateClientObject(agentId);
1018 if (aClient != null)
1019 {
1020 Scene s = LocateSceneClientIn(agentId);
1021 if (s != null)
1022 {
1023 if (m_MoneyAddress.Length > 0)
1024 {
1025 Hashtable hbinfo = GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), s.RegionInfo.regionSecret);
1026 if ((bool)hbinfo["success"] == true)
1027 {
1028 try
1029 {
1030 funds = (Int32)hbinfo["funds"];
1031 }
1032 catch (ArgumentException)
1033 {
1034 }
1035 catch (FormatException)
1036 {
1037 }
1038 catch (OverflowException)
1039 {
1040 m_log.ErrorFormat("[MONEY]: While getting the Currency for user {0}, the return funds overflowed.", agentId);
1041 aClient.SendAlertMessage("Unable to get your money balance, money operations will be unavailable");
1042 }
1043 catch (InvalidCastException)
1044 {
1045 funds = 0;
1046 }
1047
1048 }
1049 else
1050 {
1051 m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, (string)hbinfo["errorMessage"]);
1052 aClient.SendAlertMessage((string)hbinfo["errorMessage"]);
1053 }
1054 }
1055
1056 SetLocalFundsForAgentID(agentId, funds);
1057 SendMoneyBalance(aClient, agentId, aClient.SessionId, LLUUID.Zero);
1058 }
1059 else
1060 {
1061 m_log.Debug("[MONEY]: Got balance request update for agent that is here, but couldn't find which scene.");
1062 }
1063 }
1064 else
1065 {
1066 m_log.Debug("[MONEY]: Got balance request update for agent that isn't here.");
1067 }
1068 return funds;
1069 }
1089 1070
1090 public XmlRpcResponse GridMoneyUpdate(XmlRpcRequest request) 1071 public XmlRpcResponse GridMoneyUpdate(XmlRpcRequest request)
1091 { 1072 {
@@ -1099,58 +1080,7 @@ namespace OpenSim.Region.Environment.Modules
1099 Helpers.TryParse((string)requestData["agentId"], out agentId); 1080 Helpers.TryParse((string)requestData["agentId"], out agentId);
1100 if (agentId != LLUUID.Zero) 1081 if (agentId != LLUUID.Zero)
1101 { 1082 {
1102 IClientAPI aClient = LocateClientObject(agentId); 1083 GetRemoteBalance(agentId);
1103 if (aClient != null)
1104 {
1105 Scene s = LocateSceneClientIn(agentId);
1106 if (s != null)
1107 {
1108 if (m_MoneyAddress.Length > 0)
1109 {
1110 Hashtable hbinfo = GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), s.RegionInfo.regionSecret);
1111 if ((bool)hbinfo["success"] == true)
1112 {
1113 int funds = 0;
1114 Helpers.TryParse((string)hbinfo["agentId"], out agentId);
1115 try
1116 {
1117 funds = (Int32)hbinfo["funds"];
1118 }
1119 catch (ArgumentException)
1120 {
1121 }
1122 catch (FormatException)
1123 {
1124 }
1125 catch (OverflowException)
1126 {
1127 m_log.ErrorFormat("[MONEY]: While getting the Currency for user {0}, the return funds overflowed.", agentId);
1128 aClient.SendAlertMessage("Unable to get your money balance, money operations will be unavailable");
1129 }
1130 catch (InvalidCastException)
1131 {
1132 funds = 0;
1133 }
1134
1135 SetLocalFundsForAgentID(agentId, funds);
1136 }
1137 else
1138 {
1139 m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, (string)hbinfo["errorMessage"]);
1140 aClient.SendAlertMessage((string)hbinfo["errorMessage"]);
1141 }
1142 }
1143 SendMoneyBalance(aClient, agentId, aClient.SessionId, LLUUID.Zero);
1144 }
1145 else
1146 {
1147 m_log.Debug("[MONEY]: Got balance request update for agent that is here, but couldn't find which scene.");
1148 }
1149 }
1150 else
1151 {
1152 m_log.Debug("[MONEY]: Got balance request update for agent that isn't here.");
1153 }
1154 1084
1155 } 1085 }
1156 else 1086 else
@@ -1169,6 +1099,7 @@ namespace OpenSim.Region.Environment.Modules
1169 r.Value = rparms; 1099 r.Value = rparms;
1170 return r; 1100 return r;
1171 } 1101 }
1102
1172 /// <summary> 1103 /// <summary>
1173 /// XMLRPC handler to send alert message and sound to client 1104 /// XMLRPC handler to send alert message and sound to client
1174 /// </summary> 1105 /// </summary>
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
953 } 953 }
954 } 954 }
955 955
956 // If the economy has been validated by the economy module,
957 // and land has been validated as well, this method transfers
958 // the land ownership
959
956 public void handleLandBuyRequest(Object o, LandBuyArgs e) 960 public void handleLandBuyRequest(Object o, LandBuyArgs e)
957 { 961 {
958 if (e.economyValidated && e.landValidated) 962 if (e.economyValidated && e.landValidated)
959 { 963 {
960 lock (landList) 964 lock (landList)
@@ -966,7 +970,15 @@ namespace OpenSim.Region.Environment.Modules.LandManagement
966 } 970 }
967 } 971 }
968 } 972 }
969 else if (e.landValidated == false) 973 }
974
975 // After receiving a land buy packet, first the data needs to
976 // be validated. This method validates the right to buy the
977 // parcel
978
979 public void handleLandValidationRequest(Object o, LandBuyArgs e)
980 {
981 if (e.landValidated == false)
970 { 982 {
971 ILandObject lob = null; 983 ILandObject lob = null;
972 lock (landList) 984 lock (landList)
@@ -994,7 +1006,6 @@ namespace OpenSim.Region.Environment.Modules.LandManagement
994 1006
995 } 1007 }
996 } 1008 }
997 m_scene.EventManager.TriggerValidatedLandBuy(this, e);
998 } 1009 }
999 } 1010 }
1000 } 1011 }
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
55 m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts; 55 m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts;
56 m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel); 56 m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel);
57 m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement); 57 m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement);
58 m_scene.EventManager.OnValidateLandBuy += landChannel.handleLandValidationRequest;
58 m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest; 59 m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest;
59 m_scene.EventManager.OnValidatedLandBuy += landChannel.handleLandBuyRequest;
60 60
61 lock (m_scene) 61 lock (m_scene)
62 { 62 {
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
136 EventManager.LandBuyArgs args = new EventManager.LandBuyArgs( 136 EventManager.LandBuyArgs args = new EventManager.LandBuyArgs(
137 agentId, groupId, final, groupOwned, removeContribution, parcelLocalID, parcelArea, parcelPrice, authenticated); 137 agentId, groupId, final, groupOwned, removeContribution, parcelLocalID, parcelArea, parcelPrice, authenticated);
138 138
139 // First, allow all validators a stab at it
140 m_eventManager.TriggerValidateLandBuy(this, args);
141
142 // Then, check validation and transfer
139 m_eventManager.TriggerLandBuy(this, args); 143 m_eventManager.TriggerLandBuy(this, args);
140 } 144 }
141 145
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
1916 /// <param name="agentId"></param> 1916 /// <param name="agentId"></param>
1917 /// <param name="capsObjectPath"></param> 1917 /// <param name="capsObjectPath"></param>
1918 public void AddCapsHandler(LLUUID agentId) 1918 public void AddCapsHandler(LLUUID agentId)
1919 { 1919 {
1920 // Here we clear out old Caps handlers for the agent 1920 String capsObjectPath = GetCapsPath(agentId);
1921 // this is required because we potentially have multiple simulators in an instance nearby.
1922 Caps oldcap = null;
1923 lock (m_capsHandlers)
1924 {
1925 if (m_capsHandlers.ContainsKey(agentId))
1926 oldcap = m_capsHandlers[agentId];
1927 }
1928 if (oldcap != null)
1929 {
1930 oldcap.DeregisterHandlers();
1931 }
1932
1933 // Generate a new base caps path LLUUID.Random().ToString() instead of agentId.ToString()
1934 // If the caps paths are not different for each region, the client and sim will do weird
1935 // things like send the request to a region the agent is no longer in.
1936
1937 String capsObjectPath = GetNewCapsPath(agentId);
1938 1921
1939 m_log.DebugFormat( 1922 m_log.DebugFormat(
1940 "[CAPS]: Setting up CAPS handler for root agent {0} in {1}", 1923 "[CAPS]: Setting up CAPS handler for root agent {0} in {1}",
@@ -1942,7 +1925,7 @@ namespace OpenSim.Region.Environment.Scenes
1942 1925
1943 Caps cap = 1926 Caps cap =
1944 new Caps(AssetCache, m_httpListener, m_regInfo.ExternalHostName, m_httpListener.Port, 1927 new Caps(AssetCache, m_httpListener, m_regInfo.ExternalHostName, m_httpListener.Port,
1945 capsObjectPath, agentId, m_dumpAssetsToFile); 1928 capsObjectPath, agentId, m_dumpAssetsToFile, RegionInfo.RegionName);
1946 cap.RegisterHandlers(); 1929 cap.RegisterHandlers();
1947 1930
1948 EventManager.TriggerOnRegisterCaps(agentId, cap); 1931 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
214 214
215 return null; 215 return null;
216 } 216 }
217 public string GetNewCapsPath(LLUUID agentID)
218 {
219 if (capsPaths.ContainsKey(agentID))
220 {
221 capsPaths[agentID] = LLUUID.Random().ToString();
222 }
223 else
224 {
225 capsPaths.Add(agentID, LLUUID.Random().ToString());
226 }
227 return GetCapsPath(agentID);
228 }
229 } 217 }
230} 218}
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
167 public int transactiontype; 167 public int transactiontype;
168 public string description; 168 public string description;
169 169
170 public MoneyTransferArgs(LLUUID asender, LLUUID areciever, int aamount, int atransactiontype, string adescription) { 170 public MoneyTransferArgs(LLUUID asender, LLUUID areceiver, int aamount, int atransactiontype, string adescription) {
171 sender = asender; 171 sender = asender;
172 receiver = areciever; 172 receiver = areceiver;
173 amount = aamount; 173 amount = aamount;
174 transactiontype = atransactiontype; 174 transactiontype = atransactiontype;
175 description = adescription; 175 description = adescription;
@@ -219,7 +219,7 @@ namespace OpenSim.Region.Environment.Scenes
219 219
220 public event MoneyTransferEvent OnMoneyTransfer; 220 public event MoneyTransferEvent OnMoneyTransfer;
221 public event LandBuy OnLandBuy; 221 public event LandBuy OnLandBuy;
222 public event LandBuy OnValidatedLandBuy; 222 public event LandBuy OnValidateLandBuy;
223 223
224 /* Designated Event Deletage Instances */ 224 /* Designated Event Deletage Instances */
225 225
@@ -253,7 +253,7 @@ namespace OpenSim.Region.Environment.Scenes
253 private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; 253 private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps;
254 private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; 254 private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null;
255 private LandBuy handlerLandBuy = null; 255 private LandBuy handlerLandBuy = null;
256 private LandBuy handlerValidatedLandBuy = null; 256 private LandBuy handlerValidateLandBuy = null;
257 257
258 public void TriggerOnScriptChangedEvent(uint localID, uint change) 258 public void TriggerOnScriptChangedEvent(uint localID, uint change)
259 { 259 {
@@ -526,12 +526,12 @@ namespace OpenSim.Region.Environment.Scenes
526 handlerLandBuy(sender, e); 526 handlerLandBuy(sender, e);
527 } 527 }
528 } 528 }
529 public void TriggerValidatedLandBuy(Object sender, LandBuyArgs e) 529 public void TriggerValidateLandBuy(Object sender, LandBuyArgs e)
530 { 530 {
531 handlerValidatedLandBuy = OnValidatedLandBuy; 531 handlerValidateLandBuy = OnValidateLandBuy;
532 if (handlerValidatedLandBuy != null) 532 if (handlerValidateLandBuy != null)
533 { 533 {
534 handlerValidatedLandBuy(sender, e); 534 handlerValidateLandBuy(sender, e);
535 } 535 }
536 } 536 }
537 } 537 }