aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMelanie2010-03-23 02:05:56 +0000
committerMelanie2010-03-23 02:05:56 +0000
commitdcf18689b9ab29d4ceb2348bb56fc1f77a7a8912 (patch)
treeef72d57634075b044c65428f31c8f04c4c53a7bb /OpenSim/Region/Framework/Scenes
parentSomehow the starting estate number in MySQL was lost. This adds a migration (diff)
downloadopensim-SC_OLD-dcf18689b9ab29d4ceb2348bb56fc1f77a7a8912.zip
opensim-SC_OLD-dcf18689b9ab29d4ceb2348bb56fc1f77a7a8912.tar.gz
opensim-SC_OLD-dcf18689b9ab29d4ceb2348bb56fc1f77a7a8912.tar.bz2
opensim-SC_OLD-dcf18689b9ab29d4ceb2348bb56fc1f77a7a8912.tar.xz
First stage of the new interactive region creation. This will allow creation
of a region and joining it to an existing estate or creating a new estate, as well as creating an estate owner if in standalone, and assigning estate owners. In Grid mode, existing users must be used. MySQL ONLY!!!! so far, as I can't develop or test for either SQLite or MSSQL.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs115
1 files changed, 114 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 078cf03..da81c03 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -604,7 +604,44 @@ namespace OpenSim.Region.Framework.Scenes
604 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); 604 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
605 if (m_storageManager.EstateDataStore != null) 605 if (m_storageManager.EstateDataStore != null)
606 { 606 {
607 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, true); 607 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
608 if (m_regInfo.EstateSettings.EstateID == 0) // No record at all
609 {
610 MainConsole.Instance.Output("Your region is not part of an estate.");
611 while (true)
612 {
613 string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() {"yes", "no"});
614 if (response == "no")
615 {
616 // Create a new estate
617 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, true);
618
619 m_regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", m_regInfo.EstateSettings.EstateName);
620 m_regInfo.EstateSettings.Save();
621 break;
622 }
623 else
624 {
625 response = MainConsole.Instance.CmdPrompt("Estate name to join", "None");
626 if (response == "None")
627 continue;
628
629 List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response);
630 if (estateIDs.Count < 1)
631 {
632 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
633 continue;
634 }
635
636 int estateID = estateIDs[0];
637
638 if (m_storageManager.EstateDataStore.LinkRegion(m_regInfo.RegionID, estateID))
639 break;
640
641 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
642 }
643 }
644 }
608 } 645 }
609 646
610 //Bind Storage Manager functions to some land manager functions for this scene 647 //Bind Storage Manager functions to some land manager functions for this scene
@@ -1215,6 +1252,82 @@ namespace OpenSim.Region.Framework.Scenes
1215 m_dialogModule = RequestModuleInterface<IDialogModule>(); 1252 m_dialogModule = RequestModuleInterface<IDialogModule>();
1216 m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); 1253 m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
1217 m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); 1254 m_teleportModule = RequestModuleInterface<IEntityTransferModule>();
1255
1256 // Shoving this in here for now, because we have the needed
1257 // interfaces at this point
1258 //
1259 // TODO: Find a better place for this
1260 //
1261 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero)
1262 {
1263 MainConsole.Instance.Output("The current estate has no owner set.");
1264 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test");
1265 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User");
1266
1267 UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
1268
1269 if (account == null)
1270 {
1271 account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty);
1272 if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0))
1273 {
1274 account.ServiceURLs = new Dictionary<string, object>();
1275 account.ServiceURLs["HomeURI"] = string.Empty;
1276 account.ServiceURLs["GatekeeperURI"] = string.Empty;
1277 account.ServiceURLs["InventoryServerURI"] = string.Empty;
1278 account.ServiceURLs["AssetServerURI"] = string.Empty;
1279 }
1280
1281 if (UserAccountService.StoreUserAccount(account))
1282 {
1283 string password = MainConsole.Instance.PasswdPrompt("Password");
1284 string email = MainConsole.Instance.CmdPrompt("Email", "");
1285
1286 account.Email = email;
1287 UserAccountService.StoreUserAccount(account);
1288
1289 bool success = false;
1290 success = AuthenticationService.SetPassword(account.PrincipalID, password);
1291 if (!success)
1292 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.",
1293 first, last);
1294
1295 GridRegion home = null;
1296 if (GridService != null)
1297 {
1298 List<GridRegion> defaultRegions = GridService.GetDefaultRegions(UUID.Zero);
1299 if (defaultRegions != null && defaultRegions.Count >= 1)
1300 home = defaultRegions[0];
1301
1302 if (PresenceService != null && home != null)
1303 PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
1304 else
1305 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
1306 first, last);
1307
1308 }
1309 else
1310 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
1311 first, last);
1312
1313 if (InventoryService != null)
1314 success = InventoryService.CreateUserInventory(account.PrincipalID);
1315 if (!success)
1316 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
1317 first, last);
1318
1319
1320 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last);
1321
1322 m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
1323 m_regInfo.EstateSettings.Save();
1324 }
1325 }
1326 else
1327 {
1328 MainConsole.Instance.Output("You appear to be connected to a grid and can't create users from here. Please enter the name of an existing user");
1329 }
1330 }
1218 } 1331 }
1219 1332
1220 #endregion 1333 #endregion