aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-03-21 21:37:06 +0000
committerJustin Clark-Casey (justincc)2011-03-21 21:37:06 +0000
commitd3a20a1e9257ecec417e219ebaf079370015f06d (patch)
tree98a737503fde948d8e827527c03ea443aff46c9e /OpenSim
parentUpgrade SQLite: (diff)
downloadopensim-SC_OLD-d3a20a1e9257ecec417e219ebaf079370015f06d.zip
opensim-SC_OLD-d3a20a1e9257ecec417e219ebaf079370015f06d.tar.gz
opensim-SC_OLD-d3a20a1e9257ecec417e219ebaf079370015f06d.tar.bz2
opensim-SC_OLD-d3a20a1e9257ecec417e219ebaf079370015f06d.tar.xz
On initial region registration, if the user chooses the option to make the region part of an existing estate, then list the existing region names.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLEstateData.cs17
-rw-r--r--OpenSim/Data/MySQL/MySQLEstateData.cs40
-rw-r--r--OpenSim/Data/SQLite/SQLiteEstateData.cs32
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs33
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs13
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateDataService.cs14
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs14
-rw-r--r--OpenSim/Services/Connectors/Simulation/EstateDataService.cs10
8 files changed, 172 insertions, 1 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
index e9a0935..92a8d80 100644
--- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
@@ -350,26 +350,43 @@ namespace OpenSim.Data.MSSQL
350 350
351 public EstateSettings LoadEstateSettings(int estateID) 351 public EstateSettings LoadEstateSettings(int estateID)
352 { 352 {
353 // TODO: Implementation!
353 return new EstateSettings(); 354 return new EstateSettings();
354 } 355 }
356
357 public List<EstateSettings> LoadEstateSettingsAll()
358 {
359 // TODO: Implementation!
360 return new List<EstateSettings>();
361 }
355 362
356 public List<int> GetEstates(string search) 363 public List<int> GetEstates(string search)
357 { 364 {
365 // TODO: Implementation!
366 return new List<int>();
367 }
368
369 public List<int> GetEstatesAll()
370 {
371 // TODO: Implementation!
358 return new List<int>(); 372 return new List<int>();
359 } 373 }
360 374
361 public bool LinkRegion(UUID regionID, int estateID) 375 public bool LinkRegion(UUID regionID, int estateID)
362 { 376 {
377 // TODO: Implementation!
363 return false; 378 return false;
364 } 379 }
365 380
366 public List<UUID> GetRegions(int estateID) 381 public List<UUID> GetRegions(int estateID)
367 { 382 {
383 // TODO: Implementation!
368 return new List<UUID>(); 384 return new List<UUID>();
369 } 385 }
370 386
371 public bool DeleteEstate(int estateID) 387 public bool DeleteEstate(int estateID)
372 { 388 {
389 // TODO: Implementation!
373 return false; 390 return false;
374 } 391 }
375 #endregion 392 #endregion
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index de72a6a..6d72e82 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -413,6 +413,46 @@ namespace OpenSim.Data.MySQL
413 return DoLoad(cmd, UUID.Zero, false); 413 return DoLoad(cmd, UUID.Zero, false);
414 } 414 }
415 } 415 }
416
417 public List<EstateSettings> LoadEstateSettingsAll()
418 {
419 List<EstateSettings> allEstateSettings = new List<EstateSettings>();
420
421 List<int> allEstateIds = GetEstatesAll();
422
423 foreach (int estateId in allEstateIds)
424 allEstateSettings.Add(LoadEstateSettings(estateId));
425
426 return allEstateSettings;
427 }
428
429 public List<int> GetEstatesAll()
430 {
431 List<int> result = new List<int>();
432
433 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
434 {
435 dbcon.Open();
436
437 using (MySqlCommand cmd = dbcon.CreateCommand())
438 {
439 cmd.CommandText = "select estateID from estate_settings";
440
441 using (IDataReader reader = cmd.ExecuteReader())
442 {
443 while (reader.Read())
444 {
445 result.Add(Convert.ToInt32(reader["EstateID"]));
446 }
447 reader.Close();
448 }
449 }
450
451 dbcon.Close();
452 }
453
454 return result;
455 }
416 456
417 public List<int> GetEstates(string search) 457 public List<int> GetEstates(string search)
418 { 458 {
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs
index 63252aa..6afc540 100644
--- a/OpenSim/Data/SQLite/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs
@@ -357,6 +357,17 @@ namespace OpenSim.Data.SQLite
357 357
358 return DoLoad(cmd, UUID.Zero, false); 358 return DoLoad(cmd, UUID.Zero, false);
359 } 359 }
360
361 public List<EstateSettings> LoadEstateSettingsAll()
362 {
363 List<EstateSettings> estateSettings = new List<EstateSettings>();
364
365 List<int> estateIds = GetEstatesAll();
366 foreach (int estateId in estateIds)
367 estateSettings.Add(LoadEstateSettings(estateId));
368
369 return estateSettings;
370 }
360 371
361 public List<int> GetEstates(string search) 372 public List<int> GetEstates(string search)
362 { 373 {
@@ -379,6 +390,27 @@ namespace OpenSim.Data.SQLite
379 390
380 return result; 391 return result;
381 } 392 }
393
394 public List<int> GetEstatesAll()
395 {
396 List<int> result = new List<int>();
397
398 string sql = "select EstateID from estate_settings";
399
400 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
401
402 cmd.CommandText = sql;
403
404 IDataReader r = cmd.ExecuteReader();
405
406 while (r.Read())
407 {
408 result.Add(Convert.ToInt32(r["EstateID"]));
409 }
410 r.Close();
411
412 return result;
413 }
382 414
383 public bool LinkRegion(UUID regionID, int estateID) 415 public bool LinkRegion(UUID regionID, int estateID)
384 { 416 {
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
index 547ea6b..ad28c00 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
@@ -100,6 +100,17 @@ namespace OpenSim.Data.SQLiteLegacy
100 100
101 return DoLoad(cmd, regionID, create); 101 return DoLoad(cmd, regionID, create);
102 } 102 }
103
104 public List<EstateSettings> LoadEstateSettingsAll()
105 {
106 List<EstateSettings> estateSettings = new List<EstateSettings>();
107
108 List<int> estateIds = GetEstatesAll();
109 foreach (int estateId in estateIds)
110 estateSettings.Add(LoadEstateSettings(estateId));
111
112 return estateSettings;
113 }
103 114
104 private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create) 115 private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create)
105 { 116 {
@@ -369,6 +380,28 @@ namespace OpenSim.Data.SQLiteLegacy
369 return result; 380 return result;
370 } 381 }
371 382
383
384 public List<int> GetEstatesAll()
385 {
386 List<int> result = new List<int>();
387
388 string sql = "select EstateID from estate_settings";
389
390 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
391
392 cmd.CommandText = sql;
393
394 IDataReader r = cmd.ExecuteReader();
395
396 while (r.Read())
397 {
398 result.Add(Convert.ToInt32(r["EstateID"]));
399 }
400 r.Close();
401
402 return result;
403 }
404
372 public bool LinkRegion(UUID regionID, int estateID) 405 public bool LinkRegion(UUID regionID, int estateID)
373 { 406 {
374 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 407 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index e950613..f804cb7 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -828,7 +828,18 @@ namespace OpenSim
828 } 828 }
829 else 829 else
830 { 830 {
831 response = MainConsole.Instance.CmdPrompt("Estate name to join", "None"); 831 List<EstateSettings> estates = estateDataService.LoadEstateSettingsAll();
832
833 List<string> estateNames = new List<string>();
834 foreach (EstateSettings estate in estates)
835 estateNames.Add(estate.EstateName);
836
837 response
838 = MainConsole.Instance.CmdPrompt(
839 string.Format(
840 "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())),
841 "None");
842
832 if (response == "None") 843 if (response == "None")
833 continue; 844 continue;
834 845
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
index 95c9659..12ed9e3 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
@@ -36,8 +36,22 @@ namespace OpenSim.Region.Framework.Interfaces
36 { 36 {
37 EstateSettings LoadEstateSettings(UUID regionID, bool create); 37 EstateSettings LoadEstateSettings(UUID regionID, bool create);
38 EstateSettings LoadEstateSettings(int estateID); 38 EstateSettings LoadEstateSettings(int estateID);
39
40 /// <summary>
41 /// Load/Get all estate settings.
42 /// </summary>
43 /// <returns>An empty list if no estates were found.</returns>
44 List<EstateSettings> LoadEstateSettingsAll();
45
39 void StoreEstateSettings(EstateSettings es); 46 void StoreEstateSettings(EstateSettings es);
40 List<int> GetEstates(string search); 47 List<int> GetEstates(string search);
48
49 /// <summary>
50 /// Get the IDs of all estates.
51 /// </summary>
52 /// <returns>An empty list if no estates were found.</returns>
53 List<int> GetEstatesAll();
54
41 bool LinkRegion(UUID regionID, int estateID); 55 bool LinkRegion(UUID regionID, int estateID);
42 List<UUID> GetRegions(int estateID); 56 List<UUID> GetRegions(int estateID);
43 bool DeleteEstate(int estateID); 57 bool DeleteEstate(int estateID);
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
index 87c7a05..d78ad78 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
@@ -37,8 +37,22 @@ namespace OpenSim.Region.Framework.Interfaces
37 37
38 EstateSettings LoadEstateSettings(UUID regionID, bool create); 38 EstateSettings LoadEstateSettings(UUID regionID, bool create);
39 EstateSettings LoadEstateSettings(int estateID); 39 EstateSettings LoadEstateSettings(int estateID);
40
41 /// <summary>
42 /// Load/Get all estate settings.
43 /// </summary>
44 /// <returns>An empty list if no estates were found.</returns>
45 List<EstateSettings> LoadEstateSettingsAll();
46
40 void StoreEstateSettings(EstateSettings es); 47 void StoreEstateSettings(EstateSettings es);
41 List<int> GetEstates(string search); 48 List<int> GetEstates(string search);
49
50 /// <summary>
51 /// Get the IDs of all estates.
52 /// </summary>
53 /// <returns>An empty list if no estates were found.</returns>
54 List<int> GetEstatesAll();
55
42 bool LinkRegion(UUID regionID, int estateID); 56 bool LinkRegion(UUID regionID, int estateID);
43 List<UUID> GetRegions(int estateID); 57 List<UUID> GetRegions(int estateID);
44 bool DeleteEstate(int estateID); 58 bool DeleteEstate(int estateID);
diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
index b6df5a2..d0588bf 100644
--- a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
+++ b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
@@ -90,6 +90,11 @@ namespace OpenSim.Services.Connectors
90 { 90 {
91 return m_database.LoadEstateSettings(estateID); 91 return m_database.LoadEstateSettings(estateID);
92 } 92 }
93
94 public List<EstateSettings> LoadEstateSettingsAll()
95 {
96 return m_database.LoadEstateSettingsAll();
97 }
93 98
94 public void StoreEstateSettings(EstateSettings es) 99 public void StoreEstateSettings(EstateSettings es)
95 { 100 {
@@ -100,6 +105,11 @@ namespace OpenSim.Services.Connectors
100 { 105 {
101 return m_database.GetEstates(search); 106 return m_database.GetEstates(search);
102 } 107 }
108
109 public List<int> GetEstatesAll()
110 {
111 return m_database.GetEstatesAll();
112 }
103 113
104 public bool LinkRegion(UUID regionID, int estateID) 114 public bool LinkRegion(UUID regionID, int estateID)
105 { 115 {