aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs216
-rwxr-xr-xbin/OpenSim.ini.example22
2 files changed, 171 insertions, 67 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index d3c1102..c6956fc 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Linq;
31using System.Net; 32using System.Net;
32using System.Reflection; 33using System.Reflection;
33using System.Text; 34using System.Text;
@@ -67,6 +68,9 @@ namespace OpenSim
67 private const string PLUGIN_ASSET_CACHE = "/OpenSim/AssetCache"; 68 private const string PLUGIN_ASSET_CACHE = "/OpenSim/AssetCache";
68 private const string PLUGIN_ASSET_SERVER_CLIENT = "/OpenSim/AssetClient"; 69 private const string PLUGIN_ASSET_SERVER_CLIENT = "/OpenSim/AssetClient";
69 70
71 // OpenSim.ini Section name for ESTATES Settings
72 public const string ESTATE_SECTION_NAME = "Estates";
73
70 protected string proxyUrl; 74 protected string proxyUrl;
71 protected int proxyOffset = 0; 75 protected int proxyOffset = 0;
72 76
@@ -445,12 +449,42 @@ namespace OpenSim
445 { 449 {
446 RegionInfo regionInfo = scene.RegionInfo; 450 RegionInfo regionInfo = scene.RegionInfo;
447 451
452 string estateOwnerFirstName = null;
453 string estateOwnerLastName = null;
454 string estateOwnerEMail = null;
455 string estateOwnerPassword = null;
456 string rawEstateOwnerUuid = null;
457
458 if (m_config.Source.Configs[ESTATE_SECTION_NAME] != null)
459 {
460 string defaultEstateOwnerName
461 = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerName", "").Trim();
462 string[] ownerNames = defaultEstateOwnerName.Split(' ');
463
464 if (ownerNames.Length >= 2)
465 {
466 estateOwnerFirstName = ownerNames[0];
467 estateOwnerLastName = ownerNames[1];
468 }
469
470 // Info to be used only on Standalone Mode
471 rawEstateOwnerUuid = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerUUID", null);
472 estateOwnerEMail = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerEMail", null);
473 estateOwnerPassword = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerPassword", null);
474 }
475
448 MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName); 476 MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName);
449 List<char> excluded = new List<char>(new char[1]{' '}); 477 List<char> excluded = new List<char>(new char[1]{' '});
450 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
451 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
452 478
453 UserAccount account = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, first, last); 479
480 if (estateOwnerFirstName == null || estateOwnerLastName == null)
481 {
482 estateOwnerFirstName = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
483 estateOwnerLastName = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
484 }
485
486 UserAccount account
487 = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, estateOwnerFirstName, estateOwnerLastName);
454 488
455 if (account == null) 489 if (account == null)
456 { 490 {
@@ -469,23 +503,35 @@ namespace OpenSim
469 503
470 if (scene.UserAccountService is UserAccountService) 504 if (scene.UserAccountService is UserAccountService)
471 { 505 {
472 string password = MainConsole.Instance.PasswdPrompt("Password"); 506 if (estateOwnerPassword == null)
473 string email = MainConsole.Instance.CmdPrompt("Email", ""); 507 estateOwnerPassword = MainConsole.Instance.PasswdPrompt("Password");
508
509 if (estateOwnerEMail == null)
510 estateOwnerEMail = MainConsole.Instance.CmdPrompt("Email");
474 511
475 string rawPrincipalId = MainConsole.Instance.CmdPrompt("User ID", UUID.Random().ToString()); 512 if (rawEstateOwnerUuid == null)
513 rawEstateOwnerUuid = MainConsole.Instance.CmdPrompt("User ID", UUID.Random().ToString());
476 514
477 UUID principalId = UUID.Zero; 515 UUID estateOwnerUuid = UUID.Zero;
478 if (!UUID.TryParse(rawPrincipalId, out principalId)) 516 if (!UUID.TryParse(rawEstateOwnerUuid, out estateOwnerUuid))
479 { 517 {
480 m_log.ErrorFormat("[OPENSIM]: ID {0} is not a valid UUID", rawPrincipalId); 518 m_log.ErrorFormat("[OPENSIM]: ID {0} is not a valid UUID", rawEstateOwnerUuid);
481 return; 519 return;
482 } 520 }
483 521
522 // If we've been given a zero uuid then this signals that we should use a random user id
523 if (estateOwnerUuid == UUID.Zero)
524 estateOwnerUuid = UUID.Random();
525
484 account 526 account
485 = ((UserAccountService)scene.UserAccountService).CreateUser( 527 = ((UserAccountService)scene.UserAccountService).CreateUser(
486 regionInfo.ScopeID, principalId, first, last, password, email); 528 regionInfo.ScopeID,
529 estateOwnerUuid,
530 estateOwnerFirstName,
531 estateOwnerLastName,
532 estateOwnerPassword,
533 estateOwnerEMail);
487 } 534 }
488// }
489 } 535 }
490 536
491 if (account == null) 537 if (account == null)
@@ -885,15 +931,21 @@ namespace OpenSim
885 /// This method doesn't allow an estate to be created with the same name as existing estates. 931 /// This method doesn't allow an estate to be created with the same name as existing estates.
886 /// </remarks> 932 /// </remarks>
887 /// <param name="regInfo"></param> 933 /// <param name="regInfo"></param>
888 /// <param name="existingName">A list of estate names that already exist.</param> 934 /// <param name="estatesByName">A list of estate names that already exist.</param>
935 /// <param name="estateName">Estate name to create if already known</param>
889 /// <returns>true if the estate was created, false otherwise</returns> 936 /// <returns>true if the estate was created, false otherwise</returns>
890 public bool CreateEstate(RegionInfo regInfo, List<string> existingNames) 937 public bool CreateEstate(RegionInfo regInfo, Dictionary<string, EstateSettings> estatesByName, string estateName)
891 { 938 {
892 // Create a new estate 939 // Create a new estate
893 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); 940 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true);
894 string newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
895 941
896 if (existingNames.Contains(newName)) 942 string newName;
943 if (estateName != null && estateName != "")
944 newName = estateName;
945 else
946 newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
947
948 if (estatesByName.ContainsKey(newName))
897 { 949 {
898 MainConsole.Instance.OutputFormat("An estate named {0} already exists. Please try again.", newName); 950 MainConsole.Instance.OutputFormat("An estate named {0} already exists. Please try again.", newName);
899 return false; 951 return false;
@@ -920,66 +972,102 @@ namespace OpenSim
920 if (EstateDataService != null) 972 if (EstateDataService != null)
921 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, false); 973 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, false);
922 974
923 if (regInfo.EstateSettings.EstateID == 0) // No record at all 975 if (regInfo.EstateSettings.EstateID != 0)
976 return;
977
978 m_log.WarnFormat("[ESTATE] Region {0} is not part of an estate.", regInfo.RegionName);
979
980 List<EstateSettings> estates = EstateDataService.LoadEstateSettingsAll();
981 Dictionary<string, EstateSettings> estatesByName = new Dictionary<string, EstateSettings>();
982
983 foreach (EstateSettings estate in estates)
984 estatesByName[estate.EstateName] = estate;
985
986 string defaultEstateName = null;
987
988 if (m_config.Source.Configs[ESTATE_SECTION_NAME] != null)
924 { 989 {
925 m_log.WarnFormat("[ESTATE] Region {0} is not part of an estate.", regInfo.RegionName); 990 defaultEstateName = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateName", null);
926 991
927 List<EstateSettings> estates = EstateDataService.LoadEstateSettingsAll(); 992 if (defaultEstateName != null)
928 List<string> estateNames = new List<string>();
929 foreach (EstateSettings estate in estates)
930 estateNames.Add(estate.EstateName);
931
932 while (true)
933 { 993 {
934 if (estates.Count == 0) 994 EstateSettings defaultEstate;
935 { 995 bool defaultEstateJoined = false;
936 m_log.Info("[ESTATE] No existing estates found. You must create a new one."); 996
937 997 if (estatesByName.ContainsKey(defaultEstateName))
938 if (CreateEstate(regInfo, estateNames)) 998 {
939 break; 999 defaultEstate = estatesByName[defaultEstateName];
1000
1001 if (EstateDataService.LinkRegion(regInfo.RegionID, (int)defaultEstate.EstateID))
1002 defaultEstateJoined = true;
1003 }
1004 else
1005 {
1006 if (CreateEstate(regInfo, estatesByName, defaultEstateName))
1007 defaultEstateJoined = true;
1008 }
1009
1010 if (defaultEstateJoined)
1011 return;
1012 else
1013 m_log.ErrorFormat(
1014 "[OPENSIM BASE]: Joining default estate {0} failed", defaultEstateName);
1015 }
1016 }
1017
1018 // If we have no default estate or creation of the default estate failed then ask the user.
1019 while (true)
1020 {
1021 if (estates.Count == 0)
1022 {
1023 m_log.Info("[ESTATE]: No existing estates found. You must create a new one.");
1024
1025 if (CreateEstate(regInfo, estatesByName, null))
1026 break;
1027 else
1028 continue;
1029 }
1030 else
1031 {
1032 string response
1033 = MainConsole.Instance.CmdPrompt(
1034 string.Format(
1035 "Do you wish to join region {0} to an existing estate (yes/no)?", regInfo.RegionName),
1036 "yes",
1037 new List<string>() { "yes", "no" });
1038
1039 if (response == "no")
1040 {
1041 if (CreateEstate(regInfo, estatesByName, null))
1042 break;
940 else 1043 else
941 continue; 1044 continue;
942 } 1045 }
943 else 1046 else
944 { 1047 {
945 string response 1048 string[] estateNames = estatesByName.Keys.ToArray();
1049 response
946 = MainConsole.Instance.CmdPrompt( 1050 = MainConsole.Instance.CmdPrompt(
947 string.Format( 1051 string.Format(
948 "Do you wish to join region {0} to an existing estate (yes/no)?", regInfo.RegionName), 1052 "Name of estate to join. Existing estate names are ({0})",
949 "yes", 1053 string.Join(", ", estateNames)),
950 new List<string>() { "yes", "no" }); 1054 estateNames[0]);
951 1055
952 if (response == "no") 1056 List<int> estateIDs = EstateDataService.GetEstates(response);
1057 if (estateIDs.Count < 1)
953 { 1058 {
954 if (CreateEstate(regInfo, estateNames)) 1059 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again.");
955 break; 1060 continue;
956 else
957 continue;
958 }
959 else
960 {
961 response
962 = MainConsole.Instance.CmdPrompt(
963 string.Format(
964 "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())),
965 estateNames[0]);
966
967 List<int> estateIDs = EstateDataService.GetEstates(response);
968 if (estateIDs.Count < 1)
969 {
970 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again.");
971 continue;
972 }
973
974 int estateID = estateIDs[0];
975
976 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID);
977
978 if (EstateDataService.LinkRegion(regInfo.RegionID, estateID))
979 break;
980
981 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
982 } 1061 }
1062
1063 int estateID = estateIDs[0];
1064
1065 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID);
1066
1067 if (EstateDataService.LinkRegion(regInfo.RegionID, estateID))
1068 break;
1069
1070 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
983 } 1071 }
984 } 1072 }
985 } 1073 }
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index a820ddf..08a6194 100755
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -36,7 +36,6 @@
36 36
37 37
38[Startup] 38[Startup]
39
40 ;# {ConsolePrompt} {} {ConsolePrompt} {} "Region (\R) " 39 ;# {ConsolePrompt} {} {ConsolePrompt} {} "Region (\R) "
41 ;; Console prompt 40 ;; Console prompt
42 ;; Certain special characters can be used to customize the prompt 41 ;; Certain special characters can be used to customize the prompt
@@ -232,6 +231,24 @@
232 ;; server to send mail through. 231 ;; server to send mail through.
233 ; emailmodule = DefaultEmailModule 232 ; emailmodule = DefaultEmailModule
234 233
234[Estates]
235 ; If these values are commented out then the user will be asked for estate details when required (this is the normal case).
236 ; If these values are uncommented then they will be used to create a default estate as necessary.
237 ; New regions will be automatically assigned to that default estate.
238
239 ; DefaultEstateName = My Estate
240 ; DefaultEstateOwnerName = FirstName LastName
241
242 ; The following parameters will only be used on a standalone system to create an estate owner that does not already exist
243
244 ; If DefaultEstateOwnerUUID is left at UUID.Zero (as below) then a random UUID will be assigned.
245 ; This is normally what you want
246 ; DefaultEstateOwnerUUID = 00000000-0000-0000-0000-000000000000
247
248 ; DefaultEstateOwnerEMail = owner@domain.com
249 ; DefaultEstateOwnerPassword = password
250
251
235[SMTP] 252[SMTP]
236 ;; The SMTP server enabled the email module to send email to external 253 ;; The SMTP server enabled the email module to send email to external
237 ;; destinations. 254 ;; destinations.
@@ -753,8 +770,7 @@
753 ;; groups service if the service is using these keys 770 ;; groups service if the service is using these keys
754 ; XmlRpcServiceReadKey = 1234 771 ; XmlRpcServiceReadKey = 1234
755 ; XmlRpcServiceWriteKey = 1234 772 ; XmlRpcServiceWriteKey = 1234
756 773
757
758[InterestManagement] 774[InterestManagement]
759 ;# {UpdatePrioritizationScheme} {} {Update prioritization scheme?} {BestAvatarResponsiveness Time Distance SimpleAngularDistance FrontBack} BestAvatarResponsiveness 775 ;# {UpdatePrioritizationScheme} {} {Update prioritization scheme?} {BestAvatarResponsiveness Time Distance SimpleAngularDistance FrontBack} BestAvatarResponsiveness
760 ;; This section controls how state updates are prioritized for each client 776 ;; This section controls how state updates are prioritized for each client