diff options
author | BlueWall | 2011-04-13 09:53:44 -0400 |
---|---|---|
committer | BlueWall | 2011-04-13 09:53:44 -0400 |
commit | d3457eae7a33f01a8fa906c4040792cdc4a67857 (patch) | |
tree | f92e60733b8397576b86c486e05aa5219f27d034 | |
parent | Merge branch 'master' of /home/opensim/src/OpenSim/Core (diff) | |
parent | Move example HttpProxy setting to OpenSim.ini.example and tidy (diff) | |
download | opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.zip opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.gz opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.bz2 opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.xz |
Merge branch 'master' of /home/git/repo/OpenSim
154 files changed, 3275 insertions, 7522 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index a0af1ca..ef00c19 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt | |||
@@ -117,6 +117,7 @@ what it is today. | |||
117 | * SachaMagne | 117 | * SachaMagne |
118 | * Salahzar Stenvaag | 118 | * Salahzar Stenvaag |
119 | * sempuki | 119 | * sempuki |
120 | * SignpostMarv | ||
120 | * Snoopy | 121 | * Snoopy |
121 | * Strawberry Fride | 122 | * Strawberry Fride |
122 | * tglion | 123 | * tglion |
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index f37c399..e26c1d2 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
68 | 68 | ||
69 | public void Initialise() | 69 | public void Initialise() |
70 | { | 70 | { |
71 | m_log.Error("[LOADREGIONS]: " + Name + " cannot be default-initialized!"); | 71 | m_log.Error("[LOAD REGIONS PLUGIN]: " + Name + " cannot be default-initialized!"); |
72 | throw new PluginNotInitialisedException(Name); | 72 | throw new PluginNotInitialisedException(Name); |
73 | } | 73 | } |
74 | 74 | ||
@@ -85,41 +85,39 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
85 | IRegionLoader regionLoader; | 85 | IRegionLoader regionLoader; |
86 | if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") | 86 | if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") |
87 | { | 87 | { |
88 | m_log.Info("[LOADREGIONS]: Loading region configurations from filesystem"); | 88 | m_log.Info("[LOAD REGIONS PLUGIN]: Loading region configurations from filesystem"); |
89 | regionLoader = new RegionLoaderFileSystem(); | 89 | regionLoader = new RegionLoaderFileSystem(); |
90 | } | 90 | } |
91 | else | 91 | else |
92 | { | 92 | { |
93 | m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations from web"); | 93 | m_log.Info("[LOAD REGIONS PLUGIN]: Loading region configurations from web"); |
94 | regionLoader = new RegionLoaderWebServer(); | 94 | regionLoader = new RegionLoaderWebServer(); |
95 | } | 95 | } |
96 | 96 | ||
97 | m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations..."); | ||
98 | |||
99 | regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source); | 97 | regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source); |
100 | RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); | 98 | RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); |
101 | 99 | ||
102 | m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules..."); | 100 | m_log.Info("[LOAD REGIONS PLUGIN]: Loading specific shared modules..."); |
103 | m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule..."); | 101 | m_log.Info("[LOAD REGIONS PLUGIN]: DynamicTextureModule..."); |
104 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); | 102 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); |
105 | m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule..."); | 103 | m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule..."); |
106 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); | 104 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); |
107 | m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule..."); | 105 | m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule..."); |
108 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); | 106 | m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); |
109 | // m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule..."); | 107 | // m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule..."); |
110 | // m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); | 108 | // m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); |
111 | m_log.Info("[LOADREGIONSPLUGIN]: Done."); | 109 | m_log.Info("[LOAD REGIONS PLUGIN]: Done."); |
112 | 110 | ||
113 | if (!CheckRegionsForSanity(regionsToLoad)) | 111 | if (!CheckRegionsForSanity(regionsToLoad)) |
114 | { | 112 | { |
115 | m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); | 113 | m_log.Error("[LOAD REGIONS PLUGIN]: Halting startup due to conflicts in region configurations"); |
116 | Environment.Exit(1); | 114 | Environment.Exit(1); |
117 | } | 115 | } |
118 | 116 | ||
119 | for (int i = 0; i < regionsToLoad.Length; i++) | 117 | for (int i = 0; i < regionsToLoad.Length; i++) |
120 | { | 118 | { |
121 | IScene scene; | 119 | IScene scene; |
122 | m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + | 120 | m_log.Debug("[LOAD REGIONS PLUGIN]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + |
123 | Thread.CurrentThread.ManagedThreadId.ToString() + | 121 | Thread.CurrentThread.ManagedThreadId.ToString() + |
124 | ")"); | 122 | ")"); |
125 | 123 | ||
@@ -164,7 +162,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
164 | if (regions[i].RegionID == regions[j].RegionID) | 162 | if (regions[i].RegionID == regions[j].RegionID) |
165 | { | 163 | { |
166 | m_log.ErrorFormat( | 164 | m_log.ErrorFormat( |
167 | "[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}", | 165 | "[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same UUID {2}", |
168 | regions[i].RegionName, regions[j].RegionName, regions[i].RegionID); | 166 | regions[i].RegionName, regions[j].RegionName, regions[i].RegionID); |
169 | return false; | 167 | return false; |
170 | } | 168 | } |
@@ -172,14 +170,14 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
172 | regions[i].RegionLocX == regions[j].RegionLocX && regions[i].RegionLocY == regions[j].RegionLocY) | 170 | regions[i].RegionLocX == regions[j].RegionLocX && regions[i].RegionLocY == regions[j].RegionLocY) |
173 | { | 171 | { |
174 | m_log.ErrorFormat( | 172 | m_log.ErrorFormat( |
175 | "[LOADREGIONS]: Regions {0} and {1} have the same grid location ({2}, {3})", | 173 | "[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same grid location ({2}, {3})", |
176 | regions[i].RegionName, regions[j].RegionName, regions[i].RegionLocX, regions[i].RegionLocY); | 174 | regions[i].RegionName, regions[j].RegionName, regions[i].RegionLocX, regions[i].RegionLocY); |
177 | return false; | 175 | return false; |
178 | } | 176 | } |
179 | else if (regions[i].InternalEndPoint.Port == regions[j].InternalEndPoint.Port) | 177 | else if (regions[i].InternalEndPoint.Port == regions[j].InternalEndPoint.Port) |
180 | { | 178 | { |
181 | m_log.ErrorFormat( | 179 | m_log.ErrorFormat( |
182 | "[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}", | 180 | "[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same internal IP port {2}", |
183 | regions[i].RegionName, regions[j].RegionName, regions[i].InternalEndPoint.Port); | 181 | regions[i].RegionName, regions[j].RegionName, regions[i].InternalEndPoint.Port); |
184 | return false; | 182 | return false; |
185 | } | 183 | } |
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 1d93382..d1a0440 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs | |||
@@ -66,8 +66,8 @@ namespace OpenSim.Client.MXP.ClientStack | |||
66 | private readonly IScene m_scene; | 66 | private readonly IScene m_scene; |
67 | private readonly string m_firstName; | 67 | private readonly string m_firstName; |
68 | private readonly string m_lastName; | 68 | private readonly string m_lastName; |
69 | private int m_objectsToSynchronize = 0; | 69 | // private int m_objectsToSynchronize = 0; |
70 | private int m_objectsSynchronized = -1; | 70 | // private int m_objectsSynchronized = -1; |
71 | 71 | ||
72 | private Vector3 m_startPosition=new Vector3(128f, 128f, 128f); | 72 | private Vector3 m_startPosition=new Vector3(128f, 128f, 128f); |
73 | #endregion | 73 | #endregion |
@@ -462,8 +462,8 @@ namespace OpenSim.Client.MXP.ClientStack | |||
462 | 462 | ||
463 | public void MXPSendSynchronizationBegin(int objectCount) | 463 | public void MXPSendSynchronizationBegin(int objectCount) |
464 | { | 464 | { |
465 | m_objectsToSynchronize = objectCount; | 465 | // m_objectsToSynchronize = objectCount; |
466 | m_objectsSynchronized = 0; | 466 | // m_objectsSynchronized = 0; |
467 | SynchronizationBeginEventMessage synchronizationBeginEventMessage = new SynchronizationBeginEventMessage(); | 467 | SynchronizationBeginEventMessage synchronizationBeginEventMessage = new SynchronizationBeginEventMessage(); |
468 | synchronizationBeginEventMessage.ObjectCount = (uint)objectCount; | 468 | synchronizationBeginEventMessage.ObjectCount = (uint)objectCount; |
469 | Session.Send(synchronizationBeginEventMessage); | 469 | Session.Send(synchronizationBeginEventMessage); |
@@ -1252,7 +1252,7 @@ namespace OpenSim.Client.MXP.ClientStack | |||
1252 | // Need to translate to MXP somehow | 1252 | // Need to translate to MXP somehow |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 1255 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) |
1256 | { | 1256 | { |
1257 | // Need to translate to MXP somehow | 1257 | // Need to translate to MXP somehow |
1258 | } | 1258 | } |
diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index f2b58d3..fc27f01 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs | |||
@@ -799,7 +799,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack | |||
799 | throw new System.NotImplementedException(); | 799 | throw new System.NotImplementedException(); |
800 | } | 800 | } |
801 | 801 | ||
802 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 802 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) |
803 | { | 803 | { |
804 | throw new System.NotImplementedException(); | 804 | throw new System.NotImplementedException(); |
805 | } | 805 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLAvatarData.cs b/OpenSim/Data/MSSQL/MSSQLAvatarData.cs index 49a6b09..301b424 100644 --- a/OpenSim/Data/MSSQL/MSSQLAvatarData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAvatarData.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL | |||
43 | public class MSSQLAvatarData : MSSQLGenericTableHandler<AvatarBaseData>, | 43 | public class MSSQLAvatarData : MSSQLGenericTableHandler<AvatarBaseData>, |
44 | IAvatarData | 44 | IAvatarData |
45 | { | 45 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | public MSSQLAvatarData(string connectionString, string realm) : | 48 | public MSSQLAvatarData(string connectionString, string realm) : |
49 | base(connectionString, realm, "Avatar") | 49 | base(connectionString, realm, "Avatar") |
diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs index e9a0935..d10ebe4 100644 --- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs +++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs | |||
@@ -350,26 +350,48 @@ 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! | ||
372 | return new List<int>(); | ||
373 | } | ||
374 | |||
375 | public List<int> GetEstatesByOwner(UUID ownerID) | ||
376 | { | ||
358 | return new List<int>(); | 377 | return new List<int>(); |
359 | } | 378 | } |
360 | 379 | ||
361 | public bool LinkRegion(UUID regionID, int estateID) | 380 | public bool LinkRegion(UUID regionID, int estateID) |
362 | { | 381 | { |
382 | // TODO: Implementation! | ||
363 | return false; | 383 | return false; |
364 | } | 384 | } |
365 | 385 | ||
366 | public List<UUID> GetRegions(int estateID) | 386 | public List<UUID> GetRegions(int estateID) |
367 | { | 387 | { |
388 | // TODO: Implementation! | ||
368 | return new List<UUID>(); | 389 | return new List<UUID>(); |
369 | } | 390 | } |
370 | 391 | ||
371 | public bool DeleteEstate(int estateID) | 392 | public bool DeleteEstate(int estateID) |
372 | { | 393 | { |
394 | // TODO: Implementation! | ||
373 | return false; | 395 | return false; |
374 | } | 396 | } |
375 | #endregion | 397 | #endregion |
diff --git a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs index 904366e..6a5d6eb 100644 --- a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs +++ b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs | |||
@@ -40,8 +40,8 @@ namespace OpenSim.Data.MSSQL | |||
40 | { | 40 | { |
41 | public class MSSQLGenericTableHandler<T> where T : class, new() | 41 | public class MSSQLGenericTableHandler<T> where T : class, new() |
42 | { | 42 | { |
43 | private static readonly ILog m_log = | 43 | // private static readonly ILog m_log = |
44 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | protected string m_ConnectionString; | 46 | protected string m_ConnectionString; |
47 | protected MSSQLManager m_database; //used for parameter type translation | 47 | protected MSSQLManager m_database; //used for parameter type translation |
diff --git a/OpenSim/Data/MSSQL/MSSQLGridUserData.cs b/OpenSim/Data/MSSQL/MSSQLGridUserData.cs index 1870273..9e215f9 100644 --- a/OpenSim/Data/MSSQL/MSSQLGridUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLGridUserData.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL | |||
43 | public class MSSQLGridUserData : MSSQLGenericTableHandler<GridUserData>, | 43 | public class MSSQLGridUserData : MSSQLGenericTableHandler<GridUserData>, |
44 | IGridUserData | 44 | IGridUserData |
45 | { | 45 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | public MSSQLGridUserData(string connectionString, string realm) : | 48 | public MSSQLGridUserData(string connectionString, string realm) : |
49 | base(connectionString, realm, "GridUserStore") | 49 | base(connectionString, realm, "GridUserStore") |
diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs index 575fd21..cf963e3 100644 --- a/OpenSim/Data/MSSQL/MSSQLManager.cs +++ b/OpenSim/Data/MSSQL/MSSQLManager.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.Data.MSSQL | |||
41 | /// </summary> | 41 | /// </summary> |
42 | public class MSSQLManager | 42 | public class MSSQLManager |
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | /// <summary> | 46 | /// <summary> |
47 | /// Connection string for ADO.net | 47 | /// Connection string for ADO.net |
@@ -180,8 +180,6 @@ namespace OpenSim.Data.MSSQL | |||
180 | return parameter; | 180 | return parameter; |
181 | } | 181 | } |
182 | 182 | ||
183 | private static readonly Dictionary<string, string> emptyDictionary = new Dictionary<string, string>(); | ||
184 | |||
185 | /// <summary> | 183 | /// <summary> |
186 | /// Checks if we need to do some migrations to the database | 184 | /// Checks if we need to do some migrations to the database |
187 | /// </summary> | 185 | /// </summary> |
diff --git a/OpenSim/Data/MSSQL/MSSQLPresenceData.cs b/OpenSim/Data/MSSQL/MSSQLPresenceData.cs index e7b3d9c..8068d23 100644 --- a/OpenSim/Data/MSSQL/MSSQLPresenceData.cs +++ b/OpenSim/Data/MSSQL/MSSQLPresenceData.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL | |||
43 | public class MSSQLPresenceData : MSSQLGenericTableHandler<PresenceData>, | 43 | public class MSSQLPresenceData : MSSQLGenericTableHandler<PresenceData>, |
44 | IPresenceData | 44 | IPresenceData |
45 | { | 45 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | public MSSQLPresenceData(string connectionString, string realm) : | 48 | public MSSQLPresenceData(string connectionString, string realm) : |
49 | base(connectionString, realm, "Presence") | 49 | base(connectionString, realm, "Presence") |
diff --git a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs index 739eb55..5bc4fe4 100644 --- a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs | |||
@@ -40,8 +40,8 @@ namespace OpenSim.Data.MSSQL | |||
40 | { | 40 | { |
41 | public class MSSQLXInventoryData : IXInventoryData | 41 | public class MSSQLXInventoryData : IXInventoryData |
42 | { | 42 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger( | 43 | // private static readonly ILog m_log = LogManager.GetLogger( |
44 | MethodBase.GetCurrentMethod().DeclaringType); | 44 | // MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | private MSSQLGenericTableHandler<XInventoryFolder> m_Folders; | 46 | private MSSQLGenericTableHandler<XInventoryFolder> m_Folders; |
47 | private MSSQLItemHandler m_Items; | 47 | private MSSQLItemHandler m_Items; |
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index de72a6a..86416d1 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 | { |
@@ -444,6 +484,36 @@ namespace OpenSim.Data.MySQL | |||
444 | return result; | 484 | return result; |
445 | } | 485 | } |
446 | 486 | ||
487 | public List<int> GetEstatesByOwner(UUID ownerID) | ||
488 | { | ||
489 | List<int> result = new List<int>(); | ||
490 | |||
491 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
492 | { | ||
493 | dbcon.Open(); | ||
494 | |||
495 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
496 | { | ||
497 | cmd.CommandText = "select estateID from estate_settings where EstateOwner = ?EstateOwner"; | ||
498 | cmd.Parameters.AddWithValue("?EstateOwner", ownerID); | ||
499 | |||
500 | using (IDataReader reader = cmd.ExecuteReader()) | ||
501 | { | ||
502 | while (reader.Read()) | ||
503 | { | ||
504 | result.Add(Convert.ToInt32(reader["EstateID"])); | ||
505 | } | ||
506 | reader.Close(); | ||
507 | } | ||
508 | } | ||
509 | |||
510 | |||
511 | dbcon.Close(); | ||
512 | } | ||
513 | |||
514 | return result; | ||
515 | } | ||
516 | |||
447 | public bool LinkRegion(UUID regionID, int estateID) | 517 | public bool LinkRegion(UUID regionID, int estateID) |
448 | { | 518 | { |
449 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 519 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 8efe4e9..50b6dbe 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -39,6 +39,8 @@ namespace OpenSim.Data.MySQL | |||
39 | { | 39 | { |
40 | public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new() | 40 | public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new() |
41 | { | 41 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
42 | protected Dictionary<string, FieldInfo> m_Fields = | 44 | protected Dictionary<string, FieldInfo> m_Fields = |
43 | new Dictionary<string, FieldInfo>(); | 45 | new Dictionary<string, FieldInfo>(); |
44 | 46 | ||
@@ -217,7 +219,6 @@ namespace OpenSim.Data.MySQL | |||
217 | { | 219 | { |
218 | using (MySqlCommand cmd = new MySqlCommand()) | 220 | using (MySqlCommand cmd = new MySqlCommand()) |
219 | { | 221 | { |
220 | |||
221 | string query = ""; | 222 | string query = ""; |
222 | List<String> names = new List<String>(); | 223 | List<String> names = new List<String>(); |
223 | List<String> values = new List<String>(); | 224 | List<String> values = new List<String>(); |
@@ -226,6 +227,16 @@ namespace OpenSim.Data.MySQL | |||
226 | { | 227 | { |
227 | names.Add(fi.Name); | 228 | names.Add(fi.Name); |
228 | values.Add("?" + fi.Name); | 229 | values.Add("?" + fi.Name); |
230 | |||
231 | // Temporarily return more information about what field is unexpectedly null for | ||
232 | // http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the | ||
233 | // InventoryTransferModule or we may be required to substitute a DBNull here. | ||
234 | if (fi.GetValue(row) == null) | ||
235 | throw new NullReferenceException( | ||
236 | string.Format( | ||
237 | "[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null", | ||
238 | fi.Name, row)); | ||
239 | |||
229 | cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString()); | 240 | cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString()); |
230 | } | 241 | } |
231 | 242 | ||
@@ -268,4 +279,4 @@ namespace OpenSim.Data.MySQL | |||
268 | } | 279 | } |
269 | } | 280 | } |
270 | } | 281 | } |
271 | } | 282 | } \ No newline at end of file |
diff --git a/OpenSim/Data/Null/NullEstateData.cs b/OpenSim/Data/Null/NullEstateData.cs new file mode 100755 index 0000000..8db8064 --- /dev/null +++ b/OpenSim/Data/Null/NullEstateData.cs | |||
@@ -0,0 +1,133 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.Framework; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | |||
37 | namespace OpenSim.Data.Null | ||
38 | { | ||
39 | public class NullEstateStore : IEstateDataStore | ||
40 | { | ||
41 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | |||
43 | // private string m_connectionString; | ||
44 | |||
45 | protected virtual Assembly Assembly | ||
46 | { | ||
47 | get { return GetType().Assembly; } | ||
48 | } | ||
49 | |||
50 | public NullEstateStore() | ||
51 | { | ||
52 | } | ||
53 | |||
54 | public NullEstateStore(string connectionString) | ||
55 | { | ||
56 | Initialise(connectionString); | ||
57 | } | ||
58 | |||
59 | public void Initialise(string connectionString) | ||
60 | { | ||
61 | // m_connectionString = connectionString; | ||
62 | } | ||
63 | |||
64 | private string[] FieldList | ||
65 | { | ||
66 | get { return new string[0]; } | ||
67 | } | ||
68 | |||
69 | public EstateSettings LoadEstateSettings(UUID regionID, bool create) | ||
70 | { | ||
71 | // This fools the initialization caller into thinking an estate was fetched (a check in OpenSimBase). | ||
72 | // The estate info is pretty empty so don't try banning anyone. | ||
73 | EstateSettings oneEstate = new EstateSettings(); | ||
74 | oneEstate.EstateID = 1; | ||
75 | return oneEstate; | ||
76 | } | ||
77 | |||
78 | public void StoreEstateSettings(EstateSettings es) | ||
79 | { | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | public EstateSettings LoadEstateSettings(int estateID) | ||
84 | { | ||
85 | return new EstateSettings(); | ||
86 | } | ||
87 | |||
88 | public List<EstateSettings> LoadEstateSettingsAll() | ||
89 | { | ||
90 | List<EstateSettings> allEstateSettings = new List<EstateSettings>(); | ||
91 | allEstateSettings.Add(new EstateSettings()); | ||
92 | return allEstateSettings; | ||
93 | } | ||
94 | |||
95 | public List<int> GetEstatesAll() | ||
96 | { | ||
97 | List<int> result = new List<int>(); | ||
98 | return result; | ||
99 | } | ||
100 | |||
101 | public List<int> GetEstates(string search) | ||
102 | { | ||
103 | List<int> result = new List<int>(); | ||
104 | return result; | ||
105 | } | ||
106 | |||
107 | public bool LinkRegion(UUID regionID, int estateID) | ||
108 | { | ||
109 | return false; | ||
110 | } | ||
111 | |||
112 | public List<UUID> GetRegions(int estateID) | ||
113 | { | ||
114 | List<UUID> result = new List<UUID>(); | ||
115 | return result; | ||
116 | } | ||
117 | |||
118 | public bool DeleteEstate(int estateID) | ||
119 | { | ||
120 | return false; | ||
121 | } | ||
122 | |||
123 | #region IEstateDataStore Members | ||
124 | |||
125 | |||
126 | public List<int> GetEstatesByOwner(UUID ownerID) | ||
127 | { | ||
128 | return new List<int>(); | ||
129 | } | ||
130 | |||
131 | #endregion | ||
132 | } | ||
133 | } | ||
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index eb4e313..e8d733b 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs | |||
@@ -38,6 +38,15 @@ namespace OpenSim.Data.Null | |||
38 | /// </summary> | 38 | /// </summary> |
39 | public class NullSimulationData : ISimulationDataStore | 39 | public class NullSimulationData : ISimulationDataStore |
40 | { | 40 | { |
41 | public NullSimulationData() | ||
42 | { | ||
43 | } | ||
44 | |||
45 | public NullSimulationData(string connectionString) | ||
46 | { | ||
47 | Initialise(connectionString); | ||
48 | } | ||
49 | |||
41 | public void Initialise(string dbfile) | 50 | public void Initialise(string dbfile) |
42 | { | 51 | { |
43 | return; | 52 | return; |
@@ -85,12 +94,20 @@ namespace OpenSim.Data.Null | |||
85 | return new List<SceneObjectGroup>(); | 94 | return new List<SceneObjectGroup>(); |
86 | } | 95 | } |
87 | 96 | ||
97 | Dictionary<UUID, double[,]> m_terrains = new Dictionary<UUID, double[,]>(); | ||
88 | public void StoreTerrain(double[,] ter, UUID regionID) | 98 | public void StoreTerrain(double[,] ter, UUID regionID) |
89 | { | 99 | { |
100 | if (m_terrains.ContainsKey(regionID)) | ||
101 | m_terrains.Remove(regionID); | ||
102 | m_terrains.Add(regionID, ter); | ||
90 | } | 103 | } |
91 | 104 | ||
92 | public double[,] LoadTerrain(UUID regionID) | 105 | public double[,] LoadTerrain(UUID regionID) |
93 | { | 106 | { |
107 | if (m_terrains.ContainsKey(regionID)) | ||
108 | { | ||
109 | return m_terrains[regionID]; | ||
110 | } | ||
94 | return null; | 111 | return null; |
95 | } | 112 | } |
96 | 113 | ||
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 63252aa..2f05a6e 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,49 @@ 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 | } | ||
414 | |||
415 | public List<int> GetEstatesByOwner(UUID ownerID) | ||
416 | { | ||
417 | List<int> result = new List<int>(); | ||
418 | |||
419 | string sql = "select EstateID from estate_settings where estate_settings.EstateOwner = :EstateOwner"; | ||
420 | |||
421 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
422 | |||
423 | cmd.CommandText = sql; | ||
424 | cmd.Parameters.AddWithValue(":EstateOwner", ownerID); | ||
425 | |||
426 | IDataReader r = cmd.ExecuteReader(); | ||
427 | |||
428 | while (r.Read()) | ||
429 | { | ||
430 | result.Add(Convert.ToInt32(r["EstateID"])); | ||
431 | } | ||
432 | r.Close(); | ||
433 | |||
434 | return result; | ||
435 | } | ||
382 | 436 | ||
383 | public bool LinkRegion(UUID regionID, int estateID) | 437 | public bool LinkRegion(UUID regionID, int estateID) |
384 | { | 438 | { |
diff --git a/OpenSim/Data/SQLiteLegacy/Properties/AssemblyInfo.cs b/OpenSim/Data/SQLiteLegacy/Properties/AssemblyInfo.cs deleted file mode 100644 index 609a024..0000000 --- a/OpenSim/Data/SQLiteLegacy/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Reflection; | ||
29 | using System.Runtime.InteropServices; | ||
30 | |||
31 | // General information about an assembly is controlled through the following | ||
32 | // set of attributes. Change these attribute values to modify the information | ||
33 | // associated with an assembly. | ||
34 | |||
35 | [assembly : AssemblyTitle("OpenSim.Data.SQLiteLegacy")] | ||
36 | [assembly : AssemblyDescription("")] | ||
37 | [assembly : AssemblyConfiguration("")] | ||
38 | [assembly : AssemblyCompany("http://opensimulator.org")] | ||
39 | [assembly : AssemblyProduct("OpenSim.Data.SQLiteLegacy")] | ||
40 | [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] | ||
41 | [assembly : AssemblyTrademark("")] | ||
42 | [assembly : AssemblyCulture("")] | ||
43 | |||
44 | // Setting ComVisible to false makes the types in this assembly not visible | ||
45 | // to COM components. If you need to access a type in this assembly from | ||
46 | // COM, set the ComVisible attribute to true on that type. | ||
47 | |||
48 | [assembly : ComVisible(false)] | ||
49 | |||
50 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
51 | |||
52 | [assembly : Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")] | ||
53 | |||
54 | // Version information for an assembly consists of the following four values: | ||
55 | // | ||
56 | // Major Version | ||
57 | // Minor Version | ||
58 | // Build Number | ||
59 | // Revision | ||
60 | // | ||
61 | // You can specify all the values or you can default the Revision and Build Numbers | ||
62 | // by using the '*' as shown below: | ||
63 | |||
64 | [assembly : AssemblyVersion("0.6.5.*")] | ||
65 | [assembly : AssemblyFileVersion("0.6.5.0")] | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/001_AssetStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_AssetStore.sql deleted file mode 100644 index 2e026ca..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/001_AssetStore.sql +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | CREATE TABLE assets( | ||
3 | UUID varchar(255) primary key, | ||
4 | Name varchar(255), | ||
5 | Description varchar(255), | ||
6 | Type integer, | ||
7 | InvType integer, | ||
8 | Local integer, | ||
9 | Temporary integer, | ||
10 | Data blob); | ||
11 | |||
12 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/001_AuthStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_AuthStore.sql deleted file mode 100644 index 468567d..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/001_AuthStore.sql +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE auth ( | ||
4 | UUID char(36) NOT NULL, | ||
5 | passwordHash char(32) NOT NULL default '', | ||
6 | passwordSalt char(32) NOT NULL default '', | ||
7 | webLoginKey varchar(255) NOT NULL default '', | ||
8 | accountType VARCHAR(32) NOT NULL DEFAULT 'UserAccount', | ||
9 | PRIMARY KEY (`UUID`) | ||
10 | ); | ||
11 | |||
12 | CREATE TABLE tokens ( | ||
13 | UUID char(36) NOT NULL, | ||
14 | token varchar(255) NOT NULL, | ||
15 | validity datetime NOT NULL | ||
16 | ); | ||
17 | |||
18 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/001_Avatar.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_Avatar.sql deleted file mode 100644 index 7ec906b..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/001_Avatar.sql +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE Avatars ( | ||
4 | PrincipalID CHAR(36) NOT NULL, | ||
5 | Name VARCHAR(32) NOT NULL, | ||
6 | Value VARCHAR(255) NOT NULL DEFAULT '', | ||
7 | PRIMARY KEY(PrincipalID, Name)); | ||
8 | |||
9 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/001_FriendsStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_FriendsStore.sql deleted file mode 100644 index f1b9ab9..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/001_FriendsStore.sql +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE `Friends` ( | ||
4 | `PrincipalID` CHAR(36) NOT NULL, | ||
5 | `Friend` VARCHAR(255) NOT NULL, | ||
6 | `Flags` VARCHAR(16) NOT NULL DEFAULT 0, | ||
7 | `Offered` VARCHAR(32) NOT NULL DEFAULT 0, | ||
8 | PRIMARY KEY(`PrincipalID`, `Friend`)); | ||
9 | |||
10 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/001_InventoryStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_InventoryStore.sql deleted file mode 100644 index 554d5c2..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/001_InventoryStore.sql +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE inventoryfolders( | ||
4 | UUID varchar(255) primary key, | ||
5 | name varchar(255), | ||
6 | agentID varchar(255), | ||
7 | parentID varchar(255), | ||
8 | type integer, | ||
9 | version integer); | ||
10 | |||
11 | CREATE TABLE inventoryitems( | ||
12 | UUID varchar(255) primary key, | ||
13 | assetID varchar(255), | ||
14 | assetType integer, | ||
15 | invType integer, | ||
16 | parentFolderID varchar(255), | ||
17 | avatarID varchar(255), | ||
18 | creatorsID varchar(255), | ||
19 | inventoryName varchar(255), | ||
20 | inventoryDescription varchar(255), | ||
21 | inventoryNextPermissions integer, | ||
22 | inventoryCurrentPermissions integer, | ||
23 | inventoryBasePermissions integer, | ||
24 | inventoryEveryOnePermissions integer, | ||
25 | salePrice integer default 99, | ||
26 | saleType integer default 0, | ||
27 | creationDate integer default 2000, | ||
28 | groupID varchar(255) default '00000000-0000-0000-0000-000000000000', | ||
29 | groupOwned integer default 0, | ||
30 | flags integer default 0); | ||
31 | |||
32 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/001_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_RegionStore.sql deleted file mode 100644 index 39e8180..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/001_RegionStore.sql +++ /dev/null | |||
@@ -1,144 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE prims( | ||
4 | UUID varchar(255) primary key, | ||
5 | RegionUUID varchar(255), | ||
6 | ParentID integer, | ||
7 | CreationDate integer, | ||
8 | Name varchar(255), | ||
9 | SceneGroupID varchar(255), | ||
10 | Text varchar(255), | ||
11 | Description varchar(255), | ||
12 | SitName varchar(255), | ||
13 | TouchName varchar(255), | ||
14 | CreatorID varchar(255), | ||
15 | OwnerID varchar(255), | ||
16 | GroupID varchar(255), | ||
17 | LastOwnerID varchar(255), | ||
18 | OwnerMask integer, | ||
19 | NextOwnerMask integer, | ||
20 | GroupMask integer, | ||
21 | EveryoneMask integer, | ||
22 | BaseMask integer, | ||
23 | PositionX float, | ||
24 | PositionY float, | ||
25 | PositionZ float, | ||
26 | GroupPositionX float, | ||
27 | GroupPositionY float, | ||
28 | GroupPositionZ float, | ||
29 | VelocityX float, | ||
30 | VelocityY float, | ||
31 | VelocityZ float, | ||
32 | AngularVelocityX float, | ||
33 | AngularVelocityY float, | ||
34 | AngularVelocityZ float, | ||
35 | AccelerationX float, | ||
36 | AccelerationY float, | ||
37 | AccelerationZ float, | ||
38 | RotationX float, | ||
39 | RotationY float, | ||
40 | RotationZ float, | ||
41 | RotationW float, | ||
42 | ObjectFlags integer, | ||
43 | SitTargetOffsetX float NOT NULL default 0, | ||
44 | SitTargetOffsetY float NOT NULL default 0, | ||
45 | SitTargetOffsetZ float NOT NULL default 0, | ||
46 | SitTargetOrientW float NOT NULL default 0, | ||
47 | SitTargetOrientX float NOT NULL default 0, | ||
48 | SitTargetOrientY float NOT NULL default 0, | ||
49 | SitTargetOrientZ float NOT NULL default 0); | ||
50 | |||
51 | CREATE TABLE primshapes( | ||
52 | UUID varchar(255) primary key, | ||
53 | Shape integer, | ||
54 | ScaleX float, | ||
55 | ScaleY float, | ||
56 | ScaleZ float, | ||
57 | PCode integer, | ||
58 | PathBegin integer, | ||
59 | PathEnd integer, | ||
60 | PathScaleX integer, | ||
61 | PathScaleY integer, | ||
62 | PathShearX integer, | ||
63 | PathShearY integer, | ||
64 | PathSkew integer, | ||
65 | PathCurve integer, | ||
66 | PathRadiusOffset integer, | ||
67 | PathRevolutions integer, | ||
68 | PathTaperX integer, | ||
69 | PathTaperY integer, | ||
70 | PathTwist integer, | ||
71 | PathTwistBegin integer, | ||
72 | ProfileBegin integer, | ||
73 | ProfileEnd integer, | ||
74 | ProfileCurve integer, | ||
75 | ProfileHollow integer, | ||
76 | Texture blob, | ||
77 | ExtraParams blob, | ||
78 | State Integer NOT NULL default 0); | ||
79 | |||
80 | CREATE TABLE primitems( | ||
81 | itemID varchar(255) primary key, | ||
82 | primID varchar(255), | ||
83 | assetID varchar(255), | ||
84 | parentFolderID varchar(255), | ||
85 | invType integer, | ||
86 | assetType integer, | ||
87 | name varchar(255), | ||
88 | description varchar(255), | ||
89 | creationDate integer, | ||
90 | creatorID varchar(255), | ||
91 | ownerID varchar(255), | ||
92 | lastOwnerID varchar(255), | ||
93 | groupID varchar(255), | ||
94 | nextPermissions string, | ||
95 | currentPermissions string, | ||
96 | basePermissions string, | ||
97 | everyonePermissions string, | ||
98 | groupPermissions string); | ||
99 | |||
100 | CREATE TABLE terrain( | ||
101 | RegionUUID varchar(255), | ||
102 | Revision integer, | ||
103 | Heightfield blob); | ||
104 | |||
105 | CREATE TABLE land( | ||
106 | UUID varchar(255) primary key, | ||
107 | RegionUUID varchar(255), | ||
108 | LocalLandID string, | ||
109 | Bitmap blob, | ||
110 | Name varchar(255), | ||
111 | Desc varchar(255), | ||
112 | OwnerUUID varchar(255), | ||
113 | IsGroupOwned string, | ||
114 | Area integer, | ||
115 | AuctionID integer, | ||
116 | Category integer, | ||
117 | ClaimDate integer, | ||
118 | ClaimPrice integer, | ||
119 | GroupUUID varchar(255), | ||
120 | SalePrice integer, | ||
121 | LandStatus integer, | ||
122 | LandFlags string, | ||
123 | LandingType string, | ||
124 | MediaAutoScale string, | ||
125 | MediaTextureUUID varchar(255), | ||
126 | MediaURL varchar(255), | ||
127 | MusicURL varchar(255), | ||
128 | PassHours float, | ||
129 | PassPrice string, | ||
130 | SnapshotUUID varchar(255), | ||
131 | UserLocationX float, | ||
132 | UserLocationY float, | ||
133 | UserLocationZ float, | ||
134 | UserLookAtX float, | ||
135 | UserLookAtY float, | ||
136 | UserLookAtZ float, | ||
137 | AuthbuyerID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000'); | ||
138 | |||
139 | CREATE TABLE landaccesslist( | ||
140 | LandUUID varchar(255), | ||
141 | AccessUUID varchar(255), | ||
142 | Flags string); | ||
143 | |||
144 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/001_UserAccount.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_UserAccount.sql deleted file mode 100644 index c38d9a7..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/001_UserAccount.sql +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | -- useraccounts table | ||
4 | CREATE TABLE UserAccounts ( | ||
5 | PrincipalID CHAR(36) primary key, | ||
6 | ScopeID CHAR(36) NOT NULL, | ||
7 | FirstName VARCHAR(64) NOT NULL, | ||
8 | LastName VARCHAR(64) NOT NULL, | ||
9 | Email VARCHAR(64), | ||
10 | ServiceURLs TEXT, | ||
11 | Created INT(11), | ||
12 | UserLevel integer NOT NULL DEFAULT 0, | ||
13 | UserFlags integer NOT NULL DEFAULT 0, | ||
14 | UserTitle varchar(64) NOT NULL DEFAULT '' | ||
15 | ); | ||
16 | |||
17 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/001_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_UserStore.sql deleted file mode 100644 index b584594..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/001_UserStore.sql +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | -- users table | ||
4 | CREATE TABLE users( | ||
5 | UUID varchar(255) primary key, | ||
6 | username varchar(255), | ||
7 | surname varchar(255), | ||
8 | passwordHash varchar(255), | ||
9 | passwordSalt varchar(255), | ||
10 | homeRegionX integer, | ||
11 | homeRegionY integer, | ||
12 | homeLocationX float, | ||
13 | homeLocationY float, | ||
14 | homeLocationZ float, | ||
15 | homeLookAtX float, | ||
16 | homeLookAtY float, | ||
17 | homeLookAtZ float, | ||
18 | created integer, | ||
19 | lastLogin integer, | ||
20 | rootInventoryFolderID varchar(255), | ||
21 | userInventoryURI varchar(255), | ||
22 | userAssetURI varchar(255), | ||
23 | profileCanDoMask integer, | ||
24 | profileWantDoMask integer, | ||
25 | profileAboutText varchar(255), | ||
26 | profileFirstText varchar(255), | ||
27 | profileImage varchar(255), | ||
28 | profileFirstImage varchar(255), | ||
29 | webLoginKey text default '00000000-0000-0000-0000-000000000000'); | ||
30 | -- friends table | ||
31 | CREATE TABLE userfriends( | ||
32 | ownerID varchar(255), | ||
33 | friendID varchar(255), | ||
34 | friendPerms integer, | ||
35 | ownerPerms integer, | ||
36 | datetimestamp integer); | ||
37 | |||
38 | COMMIT; | ||
39 | |||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/002_AssetStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_AssetStore.sql deleted file mode 100644 index 5339b84..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/002_AssetStore.sql +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TEMPORARY TABLE assets_backup(UUID,Name,Description,Type,Local,Temporary,Data); | ||
4 | INSERT INTO assets_backup SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets; | ||
5 | DROP TABLE assets; | ||
6 | CREATE TABLE assets(UUID,Name,Description,Type,Local,Temporary,Data); | ||
7 | INSERT INTO assets SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets_backup; | ||
8 | DROP TABLE assets_backup; | ||
9 | |||
10 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/002_AuthStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_AuthStore.sql deleted file mode 100644 index 3237b68..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/002_AuthStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | INSERT INTO auth (UUID, passwordHash, passwordSalt, webLoginKey) SELECT `UUID` AS UUID, `passwordHash` AS passwordHash, `passwordSalt` AS passwordSalt, `webLoginKey` AS webLoginKey FROM users; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/002_FriendsStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_FriendsStore.sql deleted file mode 100644 index 6733502..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/002_FriendsStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | INSERT INTO `Friends` SELECT `ownerID`, `friendID`, `friendPerms`, 0 FROM `userfriends`; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/002_InventoryStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_InventoryStore.sql deleted file mode 100644 index 01951d6..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/002_InventoryStore.sql +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | create index inventoryfolders_agentid on inventoryfolders(agentid); | ||
4 | create index inventoryfolders_parentid on inventoryfolders(parentid); | ||
5 | create index inventoryitems_parentfolderid on inventoryitems(parentfolderid); | ||
6 | create index inventoryitems_avatarid on inventoryitems(avatarid); | ||
7 | |||
8 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/002_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_RegionStore.sql deleted file mode 100644 index c5c7c99..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/002_RegionStore.sql +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE regionban( | ||
4 | regionUUID varchar (255), | ||
5 | bannedUUID varchar (255), | ||
6 | bannedIp varchar (255), | ||
7 | bannedIpHostMask varchar (255) | ||
8 | ); | ||
9 | |||
10 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/002_UserAccount.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_UserAccount.sql deleted file mode 100644 index c7a6293..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/002_UserAccount.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT `UUID` AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, username AS FirstName, surname AS LastName, '' as Email, '' AS ServiceURLs, created as Created FROM users; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/002_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_UserStore.sql deleted file mode 100644 index 48fc680..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/002_UserStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE users add homeRegionID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000'; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/003_AssetStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/003_AssetStore.sql deleted file mode 100644 index f54f8d9..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/003_AssetStore.sql +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | DELETE FROM assets WHERE UUID = 'dc4b9f0bd00845c696a401dd947ac621' | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/003_InventoryStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/003_InventoryStore.sql deleted file mode 100644 index 4c6da91..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/003_InventoryStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | alter table inventoryitems add column inventoryGroupPermissions integer unsigned not null default 0; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/003_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/003_RegionStore.sql deleted file mode 100644 index 4db2f75..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/003_RegionStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE primitems add flags integer not null default 0; | ||
4 | |||
5 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/003_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/003_UserStore.sql deleted file mode 100644 index 6f890ee..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/003_UserStore.sql +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE users add userFlags integer NOT NULL default 0; | ||
4 | ALTER TABLE users add godLevel integer NOT NULL default 0; | ||
5 | |||
6 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/004_AssetStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/004_AssetStore.sql deleted file mode 100644 index 39421c4..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/004_AssetStore.sql +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | update assets | ||
4 | set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12) | ||
5 | where UUID not like '%-%'; | ||
6 | |||
7 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/004_InventoryStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/004_InventoryStore.sql deleted file mode 100644 index e8f4d46..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/004_InventoryStore.sql +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | update inventoryitems | ||
4 | set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12) | ||
5 | where UUID not like '%-%'; | ||
6 | |||
7 | update inventoryitems | ||
8 | set assetID = substr(assetID, 1, 8) || "-" || substr(assetID, 9, 4) || "-" || substr(assetID, 13, 4) || "-" || substr(assetID, 17, 4) || "-" || substr(assetID, 21, 12) | ||
9 | where assetID not like '%-%'; | ||
10 | |||
11 | update inventoryitems | ||
12 | set parentFolderID = substr(parentFolderID, 1, 8) || "-" || substr(parentFolderID, 9, 4) || "-" || substr(parentFolderID, 13, 4) || "-" || substr(parentFolderID, 17, 4) || "-" || substr(parentFolderID, 21, 12) | ||
13 | where parentFolderID not like '%-%'; | ||
14 | |||
15 | update inventoryitems | ||
16 | set avatarID = substr(avatarID, 1, 8) || "-" || substr(avatarID, 9, 4) || "-" || substr(avatarID, 13, 4) || "-" || substr(avatarID, 17, 4) || "-" || substr(avatarID, 21, 12) | ||
17 | where avatarID not like '%-%'; | ||
18 | |||
19 | update inventoryitems | ||
20 | set creatorsID = substr(creatorsID, 1, 8) || "-" || substr(creatorsID, 9, 4) || "-" || substr(creatorsID, 13, 4) || "-" || substr(creatorsID, 17, 4) || "-" || substr(creatorsID, 21, 12) | ||
21 | where creatorsID not like '%-%'; | ||
22 | |||
23 | |||
24 | update inventoryfolders | ||
25 | set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12) | ||
26 | where UUID not like '%-%'; | ||
27 | |||
28 | update inventoryfolders | ||
29 | set agentID = substr(agentID, 1, 8) || "-" || substr(agentID, 9, 4) || "-" || substr(agentID, 13, 4) || "-" || substr(agentID, 17, 4) || "-" || substr(agentID, 21, 12) | ||
30 | where agentID not like '%-%'; | ||
31 | |||
32 | update inventoryfolders | ||
33 | set parentID = substr(parentID, 1, 8) || "-" || substr(parentID, 9, 4) || "-" || substr(parentID, 13, 4) || "-" || substr(parentID, 17, 4) || "-" || substr(parentID, 21, 12) | ||
34 | where parentID not like '%-%'; | ||
35 | |||
36 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/004_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/004_RegionStore.sql deleted file mode 100644 index de328cb..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/004_RegionStore.sql +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | create table regionsettings ( | ||
4 | regionUUID char(36) not null, | ||
5 | block_terraform integer not null, | ||
6 | block_fly integer not null, | ||
7 | allow_damage integer not null, | ||
8 | restrict_pushing integer not null, | ||
9 | allow_land_resell integer not null, | ||
10 | allow_land_join_divide integer not null, | ||
11 | block_show_in_search integer not null, | ||
12 | agent_limit integer not null, | ||
13 | object_bonus float not null, | ||
14 | maturity integer not null, | ||
15 | disable_scripts integer not null, | ||
16 | disable_collisions integer not null, | ||
17 | disable_physics integer not null, | ||
18 | terrain_texture_1 char(36) not null, | ||
19 | terrain_texture_2 char(36) not null, | ||
20 | terrain_texture_3 char(36) not null, | ||
21 | terrain_texture_4 char(36) not null, | ||
22 | elevation_1_nw float not null, | ||
23 | elevation_2_nw float not null, | ||
24 | elevation_1_ne float not null, | ||
25 | elevation_2_ne float not null, | ||
26 | elevation_1_se float not null, | ||
27 | elevation_2_se float not null, | ||
28 | elevation_1_sw float not null, | ||
29 | elevation_2_sw float not null, | ||
30 | water_height float not null, | ||
31 | terrain_raise_limit float not null, | ||
32 | terrain_lower_limit float not null, | ||
33 | use_estate_sun integer not null, | ||
34 | fixed_sun integer not null, | ||
35 | sun_position float not null, | ||
36 | covenant char(36)); | ||
37 | |||
38 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/004_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/004_UserStore.sql deleted file mode 100644 index 03142af..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/004_UserStore.sql +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE users add customType varchar(32) not null default ''; | ||
4 | ALTER TABLE users add partner char(36) not null default '00000000-0000-0000-0000-000000000000'; | ||
5 | |||
6 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/005_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/005_RegionStore.sql deleted file mode 100644 index 1f6d1bd..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/005_RegionStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | delete from regionsettings; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/005_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/005_UserStore.sql deleted file mode 100644 index e45c09a..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/005_UserStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | CREATE TABLE `avatarattachments` (`UUID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', `attachpoint` int(11) NOT NULL DEFAULT 0, `item` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', `asset` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'); | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/006_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/006_RegionStore.sql deleted file mode 100644 index 94ed818..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/006_RegionStore.sql +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE estate_groups ( | ||
4 | EstateID int(10) NOT NULL, | ||
5 | uuid char(36) NOT NULL | ||
6 | ); | ||
7 | |||
8 | CREATE TABLE estate_managers ( | ||
9 | EstateID int(10) NOT NULL, | ||
10 | uuid char(36) NOT NULL | ||
11 | ); | ||
12 | |||
13 | CREATE TABLE estate_map ( | ||
14 | RegionID char(36) NOT NULL default '00000000-0000-0000-0000-000000000000', | ||
15 | EstateID int(11) NOT NULL | ||
16 | ); | ||
17 | |||
18 | CREATE TABLE estate_settings ( | ||
19 | EstateID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
20 | EstateName varchar(64) default NULL, | ||
21 | AbuseEmailToEstateOwner tinyint(4) NOT NULL, | ||
22 | DenyAnonymous tinyint(4) NOT NULL, | ||
23 | ResetHomeOnTeleport tinyint(4) NOT NULL, | ||
24 | FixedSun tinyint(4) NOT NULL, | ||
25 | DenyTransacted tinyint(4) NOT NULL, | ||
26 | BlockDwell tinyint(4) NOT NULL, | ||
27 | DenyIdentified tinyint(4) NOT NULL, | ||
28 | AllowVoice tinyint(4) NOT NULL, | ||
29 | UseGlobalTime tinyint(4) NOT NULL, | ||
30 | PricePerMeter int(11) NOT NULL, | ||
31 | TaxFree tinyint(4) NOT NULL, | ||
32 | AllowDirectTeleport tinyint(4) NOT NULL, | ||
33 | RedirectGridX int(11) NOT NULL, | ||
34 | RedirectGridY int(11) NOT NULL, | ||
35 | ParentEstateID int(10) NOT NULL, | ||
36 | SunPosition double NOT NULL, | ||
37 | EstateSkipScripts tinyint(4) NOT NULL, | ||
38 | BillableFactor float NOT NULL, | ||
39 | PublicAccess tinyint(4) NOT NULL | ||
40 | ); | ||
41 | insert into estate_settings (EstateID,EstateName,AbuseEmailToEstateOwner,DenyAnonymous,ResetHomeOnTeleport,FixedSun,DenyTransacted,BlockDwell,DenyIdentified,AllowVoice,UseGlobalTime,PricePerMeter,TaxFree,AllowDirectTeleport,RedirectGridX,RedirectGridY,ParentEstateID,SunPosition,PublicAccess,EstateSkipScripts,BillableFactor) values ( 99, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); | ||
42 | delete from estate_settings; | ||
43 | CREATE TABLE estate_users ( | ||
44 | EstateID int(10) NOT NULL, | ||
45 | uuid char(36) NOT NULL | ||
46 | ); | ||
47 | |||
48 | CREATE TABLE estateban ( | ||
49 | EstateID int(10) NOT NULL, | ||
50 | bannedUUID varchar(36) NOT NULL, | ||
51 | bannedIp varchar(16) NOT NULL, | ||
52 | bannedIpHostMask varchar(16) NOT NULL, | ||
53 | bannedNameMask varchar(64) default NULL | ||
54 | ); | ||
55 | |||
56 | drop table regionsettings; | ||
57 | CREATE TABLE regionsettings ( | ||
58 | regionUUID char(36) NOT NULL, | ||
59 | block_terraform int(11) NOT NULL, | ||
60 | block_fly int(11) NOT NULL, | ||
61 | allow_damage int(11) NOT NULL, | ||
62 | restrict_pushing int(11) NOT NULL, | ||
63 | allow_land_resell int(11) NOT NULL, | ||
64 | allow_land_join_divide int(11) NOT NULL, | ||
65 | block_show_in_search int(11) NOT NULL, | ||
66 | agent_limit int(11) NOT NULL, | ||
67 | object_bonus float NOT NULL, | ||
68 | maturity int(11) NOT NULL, | ||
69 | disable_scripts int(11) NOT NULL, | ||
70 | disable_collisions int(11) NOT NULL, | ||
71 | disable_physics int(11) NOT NULL, | ||
72 | terrain_texture_1 char(36) NOT NULL, | ||
73 | terrain_texture_2 char(36) NOT NULL, | ||
74 | terrain_texture_3 char(36) NOT NULL, | ||
75 | terrain_texture_4 char(36) NOT NULL, | ||
76 | elevation_1_nw float NOT NULL, | ||
77 | elevation_2_nw float NOT NULL, | ||
78 | elevation_1_ne float NOT NULL, | ||
79 | elevation_2_ne float NOT NULL, | ||
80 | elevation_1_se float NOT NULL, | ||
81 | elevation_2_se float NOT NULL, | ||
82 | elevation_1_sw float NOT NULL, | ||
83 | elevation_2_sw float NOT NULL, | ||
84 | water_height float NOT NULL, | ||
85 | terrain_raise_limit float NOT NULL, | ||
86 | terrain_lower_limit float NOT NULL, | ||
87 | use_estate_sun int(11) NOT NULL, | ||
88 | fixed_sun int(11) NOT NULL, | ||
89 | sun_position float NOT NULL, | ||
90 | covenant char(36) default NULL, | ||
91 | Sandbox tinyint(4) NOT NULL, | ||
92 | PRIMARY KEY (regionUUID) | ||
93 | ); | ||
94 | |||
95 | CREATE INDEX estate_ban_estate_id on estateban(EstateID); | ||
96 | CREATE INDEX estate_groups_estate_id on estate_groups(EstateID); | ||
97 | CREATE INDEX estate_managers_estate_id on estate_managers(EstateID); | ||
98 | CREATE INDEX estate_map_estate_id on estate_map(EstateID); | ||
99 | CREATE UNIQUE INDEX estate_map_region_id on estate_map(RegionID); | ||
100 | CREATE INDEX estate_users_estate_id on estate_users(EstateID); | ||
101 | |||
102 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/006_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/006_UserStore.sql deleted file mode 100644 index f9454c5..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/006_UserStore.sql +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | -- usersagents table | ||
4 | CREATE TABLE IF NOT EXISTS useragents( | ||
5 | UUID varchar(255) primary key, | ||
6 | agentIP varchar(255), | ||
7 | agentPort integer, | ||
8 | agentOnline boolean, | ||
9 | sessionID varchar(255), | ||
10 | secureSessionID varchar(255), | ||
11 | regionID varchar(255), | ||
12 | loginTime integer, | ||
13 | logoutTime integer, | ||
14 | currentRegion varchar(255), | ||
15 | currentHandle varchar(255), | ||
16 | currentPosX float, | ||
17 | currentPosY float, | ||
18 | currentPosZ float); | ||
19 | |||
20 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/007_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/007_RegionStore.sql deleted file mode 100644 index 1c813a0..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/007_RegionStore.sql +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | begin; | ||
2 | |||
3 | alter table estate_settings add column AbuseEmail varchar(255) not null default ''; | ||
4 | |||
5 | alter table estate_settings add column EstateOwner varchar(36) not null default ''; | ||
6 | |||
7 | commit; | ||
8 | |||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/007_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/007_UserStore.sql deleted file mode 100644 index 8b0cd28..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/007_UserStore.sql +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | ALTER TABLE useragents add currentLookAtX float not null default 128; | ||
4 | ALTER TABLE useragents add currentLookAtY float not null default 128; | ||
5 | ALTER TABLE useragents add currentLookAtZ float not null default 70; | ||
6 | |||
7 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/008_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/008_RegionStore.sql deleted file mode 100644 index 28bfbf5..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/008_RegionStore.sql +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | begin; | ||
2 | |||
3 | alter table estate_settings add column DenyMinors tinyint not null default 0; | ||
4 | |||
5 | commit; | ||
6 | |||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/008_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/008_UserStore.sql deleted file mode 100644 index 97da818..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/008_UserStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | ALTER TABLE users add email varchar(250); | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/009_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/009_RegionStore.sql deleted file mode 100644 index 1f40548..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/009_RegionStore.sql +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE prims ADD COLUMN ColorR integer not null default 0; | ||
4 | ALTER TABLE prims ADD COLUMN ColorG integer not null default 0; | ||
5 | ALTER TABLE prims ADD COLUMN ColorB integer not null default 0; | ||
6 | ALTER TABLE prims ADD COLUMN ColorA integer not null default 0; | ||
7 | |||
8 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/009_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/009_UserStore.sql deleted file mode 100644 index 8ab03ef..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/009_UserStore.sql +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | update users | ||
4 | set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12) | ||
5 | where UUID not like '%-%'; | ||
6 | |||
7 | update useragents | ||
8 | set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12) | ||
9 | where UUID not like '%-%'; | ||
10 | |||
11 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/010_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/010_RegionStore.sql deleted file mode 100644 index b91ccf0..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/010_RegionStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE prims ADD COLUMN ClickAction INTEGER NOT NULL default 0; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/010_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/010_UserStore.sql deleted file mode 100644 index 5f956da..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/010_UserStore.sql +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE IF NOT EXISTS avatarappearance( | ||
4 | Owner varchar(36) NOT NULL primary key, | ||
5 | BodyItem varchar(36) DEFAULT NULL, | ||
6 | BodyAsset varchar(36) DEFAULT NULL, | ||
7 | SkinItem varchar(36) DEFAULT NULL, | ||
8 | SkinAsset varchar(36) DEFAULT NULL, | ||
9 | HairItem varchar(36) DEFAULT NULL, | ||
10 | HairAsset varchar(36) DEFAULT NULL, | ||
11 | EyesItem varchar(36) DEFAULT NULL, | ||
12 | EyesAsset varchar(36) DEFAULT NULL, | ||
13 | ShirtItem varchar(36) DEFAULT NULL, | ||
14 | ShirtAsset varchar(36) DEFAULT NULL, | ||
15 | PantsItem varchar(36) DEFAULT NULL, | ||
16 | PantsAsset varchar(36) DEFAULT NULL, | ||
17 | ShoesItem varchar(36) DEFAULT NULL, | ||
18 | ShoesAsset varchar(36) DEFAULT NULL, | ||
19 | SocksItem varchar(36) DEFAULT NULL, | ||
20 | SocksAsset varchar(36) DEFAULT NULL, | ||
21 | JacketItem varchar(36) DEFAULT NULL, | ||
22 | JacketAsset varchar(36) DEFAULT NULL, | ||
23 | GlovesItem varchar(36) DEFAULT NULL, | ||
24 | GlovesAsset varchar(36) DEFAULT NULL, | ||
25 | UnderShirtItem varchar(36) DEFAULT NULL, | ||
26 | UnderShirtAsset varchar(36) DEFAULT NULL, | ||
27 | UnderPantsItem varchar(36) DEFAULT NULL, | ||
28 | UnderPantsAsset varchar(36) DEFAULT NULL, | ||
29 | SkirtItem varchar(36) DEFAULT NULL, | ||
30 | SkirtAsset varchar(36) DEFAULT NULL, | ||
31 | Texture blob, | ||
32 | VisualParams blob, | ||
33 | Serial int DEFAULT NULL, | ||
34 | AvatarHeight float DEFAULT NULL | ||
35 | ); | ||
36 | |||
37 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/011_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/011_RegionStore.sql deleted file mode 100644 index 42bef89..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/011_RegionStore.sql +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE prims ADD COLUMN PayPrice INTEGER NOT NULL default 0; | ||
4 | ALTER TABLE prims ADD COLUMN PayButton1 INTEGER NOT NULL default 0; | ||
5 | ALTER TABLE prims ADD COLUMN PayButton2 INTEGER NOT NULL default 0; | ||
6 | ALTER TABLE prims ADD COLUMN PayButton3 INTEGER NOT NULL default 0; | ||
7 | ALTER TABLE prims ADD COLUMN PayButton4 INTEGER NOT NULL default 0; | ||
8 | ALTER TABLE prims ADD COLUMN LoopedSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000'; | ||
9 | ALTER TABLE prims ADD COLUMN LoopedSoundGain float NOT NULL default 0; | ||
10 | ALTER TABLE prims ADD COLUMN TextureAnimation string; | ||
11 | ALTER TABLE prims ADD COLUMN ParticleSystem string; | ||
12 | ALTER TABLE prims ADD COLUMN OmegaX float NOT NULL default 0; | ||
13 | ALTER TABLE prims ADD COLUMN OmegaY float NOT NULL default 0; | ||
14 | ALTER TABLE prims ADD COLUMN OmegaZ float NOT NULL default 0; | ||
15 | ALTER TABLE prims ADD COLUMN CameraEyeOffsetX float NOT NULL default 0; | ||
16 | ALTER TABLE prims ADD COLUMN CameraEyeOffsetY float NOT NULL default 0; | ||
17 | ALTER TABLE prims ADD COLUMN CameraEyeOffsetZ float NOT NULL default 0; | ||
18 | ALTER TABLE prims ADD COLUMN CameraAtOffsetX float NOT NULL default 0; | ||
19 | ALTER TABLE prims ADD COLUMN CameraAtOffsetY float NOT NULL default 0; | ||
20 | ALTER TABLE prims ADD COLUMN CameraAtOffsetZ float NOT NULL default 0; | ||
21 | ALTER TABLE prims ADD COLUMN ForceMouselook string NOT NULL default 0; | ||
22 | ALTER TABLE prims ADD COLUMN ScriptAccessPin INTEGER NOT NULL default 0; | ||
23 | ALTER TABLE prims ADD COLUMN AllowedDrop INTEGER NOT NULL default 0; | ||
24 | ALTER TABLE prims ADD COLUMN DieAtEdge string NOT NULL default 0; | ||
25 | ALTER TABLE prims ADD COLUMN SalePrice INTEGER NOT NULL default 0; | ||
26 | ALTER TABLE prims ADD COLUMN SaleType string NOT NULL default 0; | ||
27 | |||
28 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/012_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/012_RegionStore.sql deleted file mode 100644 index d952b78..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/012_RegionStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE prims ADD COLUMN Material INTEGER NOT NULL default 3; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/013_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/013_RegionStore.sql deleted file mode 100644 index 11529cd..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/013_RegionStore.sql +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE land ADD COLUMN OtherCleanTime INTEGER NOT NULL default 0; | ||
4 | ALTER TABLE land ADD COLUMN Dwell INTEGER NOT NULL default 0; | ||
5 | |||
6 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/014_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/014_RegionStore.sql deleted file mode 100644 index c59b27e..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/014_RegionStore.sql +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | begin; | ||
2 | |||
3 | ALTER TABLE regionsettings ADD COLUMN sunvectorx double NOT NULL default 0; | ||
4 | ALTER TABLE regionsettings ADD COLUMN sunvectory double NOT NULL default 0; | ||
5 | ALTER TABLE regionsettings ADD COLUMN sunvectorz double NOT NULL default 0; | ||
6 | |||
7 | commit; | ||
8 | |||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/015_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/015_RegionStore.sql deleted file mode 100644 index c43f356..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/015_RegionStore.sql +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE prims ADD COLUMN CollisionSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000'; | ||
4 | ALTER TABLE prims ADD COLUMN CollisionSoundVolume float NOT NULL default 0; | ||
5 | |||
6 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/016_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/016_RegionStore.sql deleted file mode 100644 index 52f160c..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/016_RegionStore.sql +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0; | ||
4 | |||
5 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/017_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/017_RegionStore.sql deleted file mode 100644 index 6c6b7b5..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/017_RegionStore.sql +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | BEGIN; | ||
2 | CREATE TEMPORARY TABLE prims_backup(UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect); | ||
3 | INSERT INTO prims_backup SELECT UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect FROM prims; | ||
4 | DROP TABLE prims; | ||
5 | CREATE TABLE prims(UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect); | ||
6 | INSERT INTO prims SELECT UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect FROM prims_backup; | ||
7 | DROP TABLE prims_backup; | ||
8 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/018_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/018_RegionStore.sql deleted file mode 100644 index 6a390c2..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/018_RegionStore.sql +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | update terrain | ||
4 | set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12) | ||
5 | where RegionUUID not like '%-%'; | ||
6 | |||
7 | |||
8 | update landaccesslist | ||
9 | set LandUUID = substr(LandUUID, 1, 8) || "-" || substr(LandUUID, 9, 4) || "-" || substr(LandUUID, 13, 4) || "-" || substr(LandUUID, 17, 4) || "-" || substr(LandUUID, 21, 12) | ||
10 | where LandUUID not like '%-%'; | ||
11 | |||
12 | update landaccesslist | ||
13 | set AccessUUID = substr(AccessUUID, 1, 8) || "-" || substr(AccessUUID, 9, 4) || "-" || substr(AccessUUID, 13, 4) || "-" || substr(AccessUUID, 17, 4) || "-" || substr(AccessUUID, 21, 12) | ||
14 | where AccessUUID not like '%-%'; | ||
15 | |||
16 | |||
17 | update prims | ||
18 | set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12) | ||
19 | where UUID not like '%-%'; | ||
20 | |||
21 | update prims | ||
22 | set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12) | ||
23 | where RegionUUID not like '%-%'; | ||
24 | |||
25 | update prims | ||
26 | set SceneGroupID = substr(SceneGroupID, 1, 8) || "-" || substr(SceneGroupID, 9, 4) || "-" || substr(SceneGroupID, 13, 4) || "-" || substr(SceneGroupID, 17, 4) || "-" || substr(SceneGroupID, 21, 12) | ||
27 | where SceneGroupID not like '%-%'; | ||
28 | |||
29 | update prims | ||
30 | set CreatorID = substr(CreatorID, 1, 8) || "-" || substr(CreatorID, 9, 4) || "-" || substr(CreatorID, 13, 4) || "-" || substr(CreatorID, 17, 4) || "-" || substr(CreatorID, 21, 12) | ||
31 | where CreatorID not like '%-%'; | ||
32 | |||
33 | update prims | ||
34 | set OwnerID = substr(OwnerID, 1, 8) || "-" || substr(OwnerID, 9, 4) || "-" || substr(OwnerID, 13, 4) || "-" || substr(OwnerID, 17, 4) || "-" || substr(OwnerID, 21, 12) | ||
35 | where OwnerID not like '%-%'; | ||
36 | |||
37 | update prims | ||
38 | set GroupID = substr(GroupID, 1, 8) || "-" || substr(GroupID, 9, 4) || "-" || substr(GroupID, 13, 4) || "-" || substr(GroupID, 17, 4) || "-" || substr(GroupID, 21, 12) | ||
39 | where GroupID not like '%-%'; | ||
40 | |||
41 | update prims | ||
42 | set LastOwnerID = substr(LastOwnerID, 1, 8) || "-" || substr(LastOwnerID, 9, 4) || "-" || substr(LastOwnerID, 13, 4) || "-" || substr(LastOwnerID, 17, 4) || "-" || substr(LastOwnerID, 21, 12) | ||
43 | where LastOwnerID not like '%-%'; | ||
44 | |||
45 | |||
46 | update primshapes | ||
47 | set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12) | ||
48 | where UUID not like '%-%'; | ||
49 | |||
50 | |||
51 | update land | ||
52 | set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12) | ||
53 | where UUID not like '%-%'; | ||
54 | |||
55 | update land | ||
56 | set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12) | ||
57 | where RegionUUID not like '%-%'; | ||
58 | |||
59 | update land | ||
60 | set OwnerUUID = substr(OwnerUUID, 1, 8) || "-" || substr(OwnerUUID, 9, 4) || "-" || substr(OwnerUUID, 13, 4) || "-" || substr(OwnerUUID, 17, 4) || "-" || substr(OwnerUUID, 21, 12) | ||
61 | where OwnerUUID not like '%-%'; | ||
62 | |||
63 | update land | ||
64 | set GroupUUID = substr(GroupUUID, 1, 8) || "-" || substr(GroupUUID, 9, 4) || "-" || substr(GroupUUID, 13, 4) || "-" || substr(GroupUUID, 17, 4) || "-" || substr(GroupUUID, 21, 12) | ||
65 | where GroupUUID not like '%-%'; | ||
66 | |||
67 | update land | ||
68 | set MediaTextureUUID = substr(MediaTextureUUID, 1, 8) || "-" || substr(MediaTextureUUID, 9, 4) || "-" || substr(MediaTextureUUID, 13, 4) || "-" || substr(MediaTextureUUID, 17, 4) || "-" || substr(MediaTextureUUID, 21, 12) | ||
69 | where MediaTextureUUID not like '%-%'; | ||
70 | |||
71 | update land | ||
72 | set SnapshotUUID = substr(SnapshotUUID, 1, 8) || "-" || substr(SnapshotUUID, 9, 4) || "-" || substr(SnapshotUUID, 13, 4) || "-" || substr(SnapshotUUID, 17, 4) || "-" || substr(SnapshotUUID, 21, 12) | ||
73 | where SnapshotUUID not like '%-%'; | ||
74 | |||
75 | update land | ||
76 | set AuthbuyerID = substr(AuthbuyerID, 1, 8) || "-" || substr(AuthbuyerID, 9, 4) || "-" || substr(AuthbuyerID, 13, 4) || "-" || substr(AuthbuyerID, 17, 4) || "-" || substr(AuthbuyerID, 21, 12) | ||
77 | where AuthbuyerID not like '%-%'; | ||
78 | |||
79 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/SQLiteLegacy/Resources/OpenSim.Data.SQLite.addin.xml b/OpenSim/Data/SQLiteLegacy/Resources/OpenSim.Data.SQLite.addin.xml deleted file mode 100644 index e6764fa..0000000 --- a/OpenSim/Data/SQLiteLegacy/Resources/OpenSim.Data.SQLite.addin.xml +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | <Addin id="OpenSim.Data.SQLite" version="0.1"> | ||
2 | <Runtime> | ||
3 | <Import assembly="OpenSim.Data.SQLite.dll"/> | ||
4 | </Runtime> | ||
5 | <Dependencies> | ||
6 | <Addin id="OpenSim.Data" version="0.5" /> | ||
7 | </Dependencies> | ||
8 | <Extension path = "/OpenSim/GridData"> | ||
9 | <Plugin id="SQLiteGridData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteGridData" /> | ||
10 | </Extension> | ||
11 | <Extension path = "/OpenSim/AssetData"> | ||
12 | <Plugin id="SQLiteAssetData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteAssetData" /> | ||
13 | </Extension> | ||
14 | <Extension path = "/OpenSim/InventoryData"> | ||
15 | <Plugin id="SQLiteInventoryData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteInventoryStore" /> | ||
16 | </Extension> | ||
17 | <Extension path = "/OpenSim/UserData"> | ||
18 | <Plugin id="SQLiteUserData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteUserData" /> | ||
19 | </Extension> | ||
20 | </Addin> | ||
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs deleted file mode 100644 index df50902..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs +++ /dev/null | |||
@@ -1,347 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Data; | ||
30 | using System.Reflection; | ||
31 | using System.Collections.Generic; | ||
32 | using log4net; | ||
33 | using Mono.Data.SqliteClient; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | |||
37 | namespace OpenSim.Data.SQLiteLegacy | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// An asset storage interface for the SQLite database system | ||
41 | /// </summary> | ||
42 | public class SQLiteAssetData : AssetDataBase | ||
43 | { | ||
44 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; | ||
47 | private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, UUID from assets limit :start, :count"; | ||
48 | private const string DeleteAssetSQL = "delete from assets where UUID=:UUID"; | ||
49 | private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Data)"; | ||
50 | private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID"; | ||
51 | private const string assetSelect = "select * from assets"; | ||
52 | |||
53 | private SqliteConnection m_conn; | ||
54 | |||
55 | override public void Dispose() | ||
56 | { | ||
57 | if (m_conn != null) | ||
58 | { | ||
59 | m_conn.Close(); | ||
60 | m_conn = null; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /// <summary> | ||
65 | /// <list type="bullet"> | ||
66 | /// <item>Initialises AssetData interface</item> | ||
67 | /// <item>Loads and initialises a new SQLite connection and maintains it.</item> | ||
68 | /// <item>use default URI if connect string is empty.</item> | ||
69 | /// </list> | ||
70 | /// </summary> | ||
71 | /// <param name="dbconnect">connect string</param> | ||
72 | override public void Initialise(string dbconnect) | ||
73 | { | ||
74 | if (dbconnect == string.Empty) | ||
75 | { | ||
76 | dbconnect = "URI=file:Asset.db,version=3"; | ||
77 | } | ||
78 | m_conn = new SqliteConnection(dbconnect); | ||
79 | m_conn.Open(); | ||
80 | |||
81 | Assembly assem = GetType().Assembly; | ||
82 | Migration m = new Migration(m_conn, assem, "AssetStore"); | ||
83 | m.Update(); | ||
84 | |||
85 | return; | ||
86 | } | ||
87 | |||
88 | /// <summary> | ||
89 | /// Fetch Asset | ||
90 | /// </summary> | ||
91 | /// <param name="uuid">UUID of ... ?</param> | ||
92 | /// <returns>Asset base</returns> | ||
93 | override public AssetBase GetAsset(UUID uuid) | ||
94 | { | ||
95 | lock (this) | ||
96 | { | ||
97 | using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) | ||
98 | { | ||
99 | cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString())); | ||
100 | using (IDataReader reader = cmd.ExecuteReader()) | ||
101 | { | ||
102 | if (reader.Read()) | ||
103 | { | ||
104 | AssetBase asset = buildAsset(reader); | ||
105 | reader.Close(); | ||
106 | return asset; | ||
107 | } | ||
108 | else | ||
109 | { | ||
110 | reader.Close(); | ||
111 | return null; | ||
112 | } | ||
113 | } | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | |||
118 | /// <summary> | ||
119 | /// Create an asset | ||
120 | /// </summary> | ||
121 | /// <param name="asset">Asset Base</param> | ||
122 | override public void StoreAsset(AssetBase asset) | ||
123 | { | ||
124 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); | ||
125 | if (ExistsAsset(asset.FullID)) | ||
126 | { | ||
127 | //LogAssetLoad(asset); | ||
128 | |||
129 | lock (this) | ||
130 | { | ||
131 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) | ||
132 | { | ||
133 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | ||
134 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | ||
135 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | ||
136 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | ||
137 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | ||
138 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | ||
139 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); | ||
140 | |||
141 | cmd.ExecuteNonQuery(); | ||
142 | } | ||
143 | } | ||
144 | } | ||
145 | else | ||
146 | { | ||
147 | lock (this) | ||
148 | { | ||
149 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) | ||
150 | { | ||
151 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | ||
152 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | ||
153 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | ||
154 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | ||
155 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | ||
156 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | ||
157 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); | ||
158 | |||
159 | cmd.ExecuteNonQuery(); | ||
160 | } | ||
161 | } | ||
162 | } | ||
163 | } | ||
164 | |||
165 | // /// <summary> | ||
166 | // /// Some... logging functionnality | ||
167 | // /// </summary> | ||
168 | // /// <param name="asset"></param> | ||
169 | // private static void LogAssetLoad(AssetBase asset) | ||
170 | // { | ||
171 | // string temporary = asset.Temporary ? "Temporary" : "Stored"; | ||
172 | // string local = asset.Local ? "Local" : "Remote"; | ||
173 | // | ||
174 | // int assetLength = (asset.Data != null) ? asset.Data.Length : 0; | ||
175 | // | ||
176 | // m_log.Debug("[ASSET DB]: " + | ||
177 | // string.Format("Loaded {5} {4} Asset: [{0}][{3}] \"{1}\":{2} ({6} bytes)", | ||
178 | // asset.FullID, asset.Name, asset.Description, asset.Type, | ||
179 | // temporary, local, assetLength)); | ||
180 | // } | ||
181 | |||
182 | /// <summary> | ||
183 | /// Check if an asset exist in database | ||
184 | /// </summary> | ||
185 | /// <param name="uuid">The asset UUID</param> | ||
186 | /// <returns>True if exist, or false.</returns> | ||
187 | override public bool ExistsAsset(UUID uuid) | ||
188 | { | ||
189 | lock (this) { | ||
190 | using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) | ||
191 | { | ||
192 | cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString())); | ||
193 | using (IDataReader reader = cmd.ExecuteReader()) | ||
194 | { | ||
195 | if (reader.Read()) | ||
196 | { | ||
197 | reader.Close(); | ||
198 | return true; | ||
199 | } | ||
200 | else | ||
201 | { | ||
202 | reader.Close(); | ||
203 | return false; | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | } | ||
208 | } | ||
209 | |||
210 | /// <summary> | ||
211 | /// Delete an asset from database | ||
212 | /// </summary> | ||
213 | /// <param name="uuid"></param> | ||
214 | public void DeleteAsset(UUID uuid) | ||
215 | { | ||
216 | using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn)) | ||
217 | { | ||
218 | cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString())); | ||
219 | |||
220 | cmd.ExecuteNonQuery(); | ||
221 | } | ||
222 | } | ||
223 | |||
224 | /// <summary> | ||
225 | /// | ||
226 | /// </summary> | ||
227 | /// <param name="row"></param> | ||
228 | /// <returns></returns> | ||
229 | private static AssetBase buildAsset(IDataReader row) | ||
230 | { | ||
231 | // TODO: this doesn't work yet because something more | ||
232 | // interesting has to be done to actually get these values | ||
233 | // back out. Not enough time to figure it out yet. | ||
234 | AssetBase asset = new AssetBase( | ||
235 | new UUID((String)row["UUID"]), | ||
236 | (String)row["Name"], | ||
237 | Convert.ToSByte(row["Type"]), | ||
238 | UUID.Zero.ToString() | ||
239 | ); | ||
240 | |||
241 | asset.Description = (String) row["Description"]; | ||
242 | asset.Local = Convert.ToBoolean(row["Local"]); | ||
243 | asset.Temporary = Convert.ToBoolean(row["Temporary"]); | ||
244 | asset.Data = (byte[]) row["Data"]; | ||
245 | return asset; | ||
246 | } | ||
247 | |||
248 | private static AssetMetadata buildAssetMetadata(IDataReader row) | ||
249 | { | ||
250 | AssetMetadata metadata = new AssetMetadata(); | ||
251 | |||
252 | metadata.FullID = new UUID((string) row["UUID"]); | ||
253 | metadata.Name = (string) row["Name"]; | ||
254 | metadata.Description = (string) row["Description"]; | ||
255 | metadata.Type = Convert.ToSByte(row["Type"]); | ||
256 | metadata.Temporary = Convert.ToBoolean(row["Temporary"]); // Not sure if this is correct. | ||
257 | |||
258 | // Current SHA1s are not stored/computed. | ||
259 | metadata.SHA1 = new byte[] {}; | ||
260 | |||
261 | return metadata; | ||
262 | } | ||
263 | |||
264 | /// <summary> | ||
265 | /// Returns a list of AssetMetadata objects. The list is a subset of | ||
266 | /// the entire data set offset by <paramref name="start" /> containing | ||
267 | /// <paramref name="count" /> elements. | ||
268 | /// </summary> | ||
269 | /// <param name="start">The number of results to discard from the total data set.</param> | ||
270 | /// <param name="count">The number of rows the returned list should contain.</param> | ||
271 | /// <returns>A list of AssetMetadata objects.</returns> | ||
272 | public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count) | ||
273 | { | ||
274 | List<AssetMetadata> retList = new List<AssetMetadata>(count); | ||
275 | |||
276 | lock (this) | ||
277 | { | ||
278 | using (SqliteCommand cmd = new SqliteCommand(SelectAssetMetadataSQL, m_conn)) | ||
279 | { | ||
280 | cmd.Parameters.Add(new SqliteParameter(":start", start)); | ||
281 | cmd.Parameters.Add(new SqliteParameter(":count", count)); | ||
282 | |||
283 | using (IDataReader reader = cmd.ExecuteReader()) | ||
284 | { | ||
285 | while (reader.Read()) | ||
286 | { | ||
287 | AssetMetadata metadata = buildAssetMetadata(reader); | ||
288 | retList.Add(metadata); | ||
289 | } | ||
290 | } | ||
291 | } | ||
292 | } | ||
293 | |||
294 | return retList; | ||
295 | } | ||
296 | |||
297 | /*********************************************************************** | ||
298 | * | ||
299 | * Database Binding functions | ||
300 | * | ||
301 | * These will be db specific due to typing, and minor differences | ||
302 | * in databases. | ||
303 | * | ||
304 | **********************************************************************/ | ||
305 | |||
306 | #region IPlugin interface | ||
307 | |||
308 | /// <summary> | ||
309 | /// | ||
310 | /// </summary> | ||
311 | override public string Version | ||
312 | { | ||
313 | get | ||
314 | { | ||
315 | Module module = GetType().Module; | ||
316 | // string dllName = module.Assembly.ManifestModule.Name; | ||
317 | Version dllVersion = module.Assembly.GetName().Version; | ||
318 | |||
319 | return | ||
320 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, | ||
321 | dllVersion.Revision); | ||
322 | } | ||
323 | } | ||
324 | |||
325 | /// <summary> | ||
326 | /// Initialise the AssetData interface using default URI | ||
327 | /// </summary> | ||
328 | override public void Initialise() | ||
329 | { | ||
330 | Initialise("URI=file:Asset.db,version=3"); | ||
331 | } | ||
332 | |||
333 | /// <summary> | ||
334 | /// Name of this DB provider | ||
335 | /// </summary> | ||
336 | override public string Name | ||
337 | { | ||
338 | get { return "SQLite Asset storage engine"; } | ||
339 | } | ||
340 | |||
341 | public override bool Delete(string id) | ||
342 | { | ||
343 | return false; | ||
344 | } | ||
345 | #endregion | ||
346 | } | ||
347 | } | ||
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs deleted file mode 100644 index 760221d..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs +++ /dev/null | |||
@@ -1,266 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using System.Reflection; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using Mono.Data.SqliteClient; | ||
37 | |||
38 | namespace OpenSim.Data.SQLiteLegacy | ||
39 | { | ||
40 | public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData | ||
41 | { | ||
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
44 | private string m_Realm; | ||
45 | private List<string> m_ColumnNames; | ||
46 | private int m_LastExpire; | ||
47 | private string m_connectionString; | ||
48 | |||
49 | protected static SqliteConnection m_Connection; | ||
50 | private static bool m_initialized = false; | ||
51 | |||
52 | public SQLiteAuthenticationData(string connectionString, string realm) | ||
53 | : base(connectionString) | ||
54 | { | ||
55 | m_Realm = realm; | ||
56 | m_connectionString = connectionString; | ||
57 | |||
58 | if (!m_initialized) | ||
59 | { | ||
60 | m_Connection = new SqliteConnection(connectionString); | ||
61 | m_Connection.Open(); | ||
62 | |||
63 | using (SqliteConnection dbcon = (SqliteConnection)((ICloneable)m_Connection).Clone()) | ||
64 | { | ||
65 | dbcon.Open(); | ||
66 | Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore"); | ||
67 | m.Update(); | ||
68 | dbcon.Close(); | ||
69 | } | ||
70 | |||
71 | m_initialized = true; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | public AuthenticationData Get(UUID principalID) | ||
76 | { | ||
77 | AuthenticationData ret = new AuthenticationData(); | ||
78 | ret.Data = new Dictionary<string, object>(); | ||
79 | |||
80 | SqliteCommand cmd = new SqliteCommand("select * from `" + m_Realm + "` where UUID = :PrincipalID"); | ||
81 | cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString())); | ||
82 | |||
83 | IDataReader result = ExecuteReader(cmd, m_Connection); | ||
84 | |||
85 | try | ||
86 | { | ||
87 | if (result.Read()) | ||
88 | { | ||
89 | ret.PrincipalID = principalID; | ||
90 | |||
91 | if (m_ColumnNames == null) | ||
92 | { | ||
93 | m_ColumnNames = new List<string>(); | ||
94 | |||
95 | DataTable schemaTable = result.GetSchemaTable(); | ||
96 | foreach (DataRow row in schemaTable.Rows) | ||
97 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
98 | } | ||
99 | |||
100 | foreach (string s in m_ColumnNames) | ||
101 | { | ||
102 | if (s == "UUID") | ||
103 | continue; | ||
104 | |||
105 | ret.Data[s] = result[s].ToString(); | ||
106 | } | ||
107 | |||
108 | return ret; | ||
109 | } | ||
110 | else | ||
111 | { | ||
112 | return null; | ||
113 | } | ||
114 | } | ||
115 | catch | ||
116 | { | ||
117 | } | ||
118 | finally | ||
119 | { | ||
120 | CloseCommand(cmd); | ||
121 | } | ||
122 | |||
123 | return null; | ||
124 | } | ||
125 | |||
126 | public bool Store(AuthenticationData data) | ||
127 | { | ||
128 | if (data.Data.ContainsKey("UUID")) | ||
129 | data.Data.Remove("UUID"); | ||
130 | |||
131 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | ||
132 | string[] values = new string[data.Data.Count]; | ||
133 | int i = 0; | ||
134 | foreach (object o in data.Data.Values) | ||
135 | values[i++] = o.ToString(); | ||
136 | |||
137 | SqliteCommand cmd = new SqliteCommand(); | ||
138 | |||
139 | if (Get(data.PrincipalID) != null) | ||
140 | { | ||
141 | |||
142 | |||
143 | string update = "update `" + m_Realm + "` set "; | ||
144 | bool first = true; | ||
145 | foreach (string field in fields) | ||
146 | { | ||
147 | if (!first) | ||
148 | update += ", "; | ||
149 | update += "`" + field + "` = :" + field; | ||
150 | cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field])); | ||
151 | |||
152 | first = false; | ||
153 | } | ||
154 | |||
155 | update += " where UUID = :UUID"; | ||
156 | cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString())); | ||
157 | |||
158 | cmd.CommandText = update; | ||
159 | try | ||
160 | { | ||
161 | if (ExecuteNonQuery(cmd, m_Connection) < 1) | ||
162 | { | ||
163 | CloseCommand(cmd); | ||
164 | return false; | ||
165 | } | ||
166 | } | ||
167 | catch (Exception e) | ||
168 | { | ||
169 | m_log.Error("[SQLITE]: Exception storing authentication data", e); | ||
170 | CloseCommand(cmd); | ||
171 | return false; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | else | ||
176 | { | ||
177 | string insert = "insert into `" + m_Realm + "` (`UUID`, `" + | ||
178 | String.Join("`, `", fields) + | ||
179 | "`) values (:UUID, :" + String.Join(", :", fields) + ")"; | ||
180 | |||
181 | cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString())); | ||
182 | foreach (string field in fields) | ||
183 | cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field])); | ||
184 | |||
185 | cmd.CommandText = insert; | ||
186 | |||
187 | try | ||
188 | { | ||
189 | if (ExecuteNonQuery(cmd, m_Connection) < 1) | ||
190 | { | ||
191 | CloseCommand(cmd); | ||
192 | return false; | ||
193 | } | ||
194 | } | ||
195 | catch (Exception e) | ||
196 | { | ||
197 | Console.WriteLine(e.ToString()); | ||
198 | CloseCommand(cmd); | ||
199 | return false; | ||
200 | } | ||
201 | } | ||
202 | |||
203 | CloseCommand(cmd); | ||
204 | |||
205 | return true; | ||
206 | } | ||
207 | |||
208 | public bool SetDataItem(UUID principalID, string item, string value) | ||
209 | { | ||
210 | SqliteCommand cmd = new SqliteCommand("update `" + m_Realm + | ||
211 | "` set `" + item + "` = " + value + " where UUID = '" + principalID.ToString() + "'"); | ||
212 | |||
213 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | ||
214 | return true; | ||
215 | |||
216 | return false; | ||
217 | } | ||
218 | |||
219 | public bool SetToken(UUID principalID, string token, int lifetime) | ||
220 | { | ||
221 | if (System.Environment.TickCount - m_LastExpire > 30000) | ||
222 | DoExpire(); | ||
223 | |||
224 | SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() + | ||
225 | "', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))"); | ||
226 | |||
227 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | ||
228 | { | ||
229 | cmd.Dispose(); | ||
230 | return true; | ||
231 | } | ||
232 | |||
233 | cmd.Dispose(); | ||
234 | return false; | ||
235 | } | ||
236 | |||
237 | public bool CheckToken(UUID principalID, string token, int lifetime) | ||
238 | { | ||
239 | if (System.Environment.TickCount - m_LastExpire > 30000) | ||
240 | DoExpire(); | ||
241 | |||
242 | SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() + | ||
243 | " minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')"); | ||
244 | |||
245 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | ||
246 | { | ||
247 | cmd.Dispose(); | ||
248 | return true; | ||
249 | } | ||
250 | |||
251 | cmd.Dispose(); | ||
252 | |||
253 | return false; | ||
254 | } | ||
255 | |||
256 | private void DoExpire() | ||
257 | { | ||
258 | SqliteCommand cmd = new SqliteCommand("delete from tokens where validity < datetime('now', 'localtime')"); | ||
259 | ExecuteNonQuery(cmd, m_Connection); | ||
260 | |||
261 | cmd.Dispose(); | ||
262 | |||
263 | m_LastExpire = System.Environment.TickCount; | ||
264 | } | ||
265 | } | ||
266 | } | ||
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs deleted file mode 100644 index 547ea6b..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs +++ /dev/null | |||
@@ -1,396 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using Mono.Data.SqliteClient; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | |||
38 | namespace OpenSim.Data.SQLiteLegacy | ||
39 | { | ||
40 | public class SQLiteEstateStore : IEstateDataStore | ||
41 | { | ||
42 | private static readonly ILog m_log = | ||
43 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
45 | private SqliteConnection m_connection; | ||
46 | private string m_connectionString; | ||
47 | |||
48 | private FieldInfo[] m_Fields; | ||
49 | private Dictionary<string, FieldInfo> m_FieldMap = | ||
50 | new Dictionary<string, FieldInfo>(); | ||
51 | |||
52 | public SQLiteEstateStore() | ||
53 | { | ||
54 | } | ||
55 | |||
56 | public SQLiteEstateStore(string connectionString) | ||
57 | { | ||
58 | Initialise(connectionString); | ||
59 | } | ||
60 | |||
61 | public void Initialise(string connectionString) | ||
62 | { | ||
63 | m_connectionString = connectionString; | ||
64 | |||
65 | m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString); | ||
66 | |||
67 | m_connection = new SqliteConnection(m_connectionString); | ||
68 | m_connection.Open(); | ||
69 | |||
70 | Assembly assem = GetType().Assembly; | ||
71 | Migration m = new Migration(m_connection, assem, "EstateStore"); | ||
72 | m.Update(); | ||
73 | |||
74 | m_connection.Close(); | ||
75 | m_connection.Open(); | ||
76 | |||
77 | Type t = typeof(EstateSettings); | ||
78 | m_Fields = t.GetFields(BindingFlags.NonPublic | | ||
79 | BindingFlags.Instance | | ||
80 | BindingFlags.DeclaredOnly); | ||
81 | |||
82 | foreach (FieldInfo f in m_Fields) | ||
83 | if (f.Name.Substring(0, 2) == "m_") | ||
84 | m_FieldMap[f.Name.Substring(2)] = f; | ||
85 | } | ||
86 | |||
87 | private string[] FieldList | ||
88 | { | ||
89 | get { return new List<string>(m_FieldMap.Keys).ToArray(); } | ||
90 | } | ||
91 | |||
92 | public EstateSettings LoadEstateSettings(UUID regionID, bool create) | ||
93 | { | ||
94 | string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = :RegionID"; | ||
95 | |||
96 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
97 | |||
98 | cmd.CommandText = sql; | ||
99 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | ||
100 | |||
101 | return DoLoad(cmd, regionID, create); | ||
102 | } | ||
103 | |||
104 | private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create) | ||
105 | { | ||
106 | EstateSettings es = new EstateSettings(); | ||
107 | es.OnSave += StoreEstateSettings; | ||
108 | |||
109 | IDataReader r = cmd.ExecuteReader(); | ||
110 | |||
111 | if (r.Read()) | ||
112 | { | ||
113 | foreach (string name in FieldList) | ||
114 | { | ||
115 | if (m_FieldMap[name].GetValue(es) is bool) | ||
116 | { | ||
117 | int v = Convert.ToInt32(r[name]); | ||
118 | if (v != 0) | ||
119 | m_FieldMap[name].SetValue(es, true); | ||
120 | else | ||
121 | m_FieldMap[name].SetValue(es, false); | ||
122 | } | ||
123 | else if (m_FieldMap[name].GetValue(es) is UUID) | ||
124 | { | ||
125 | UUID uuid = UUID.Zero; | ||
126 | |||
127 | UUID.TryParse(r[name].ToString(), out uuid); | ||
128 | m_FieldMap[name].SetValue(es, uuid); | ||
129 | } | ||
130 | else | ||
131 | { | ||
132 | m_FieldMap[name].SetValue(es, Convert.ChangeType(r[name], m_FieldMap[name].FieldType)); | ||
133 | } | ||
134 | } | ||
135 | r.Close(); | ||
136 | } | ||
137 | else if (create) | ||
138 | { | ||
139 | r.Close(); | ||
140 | |||
141 | List<string> names = new List<string>(FieldList); | ||
142 | |||
143 | names.Remove("EstateID"); | ||
144 | |||
145 | string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")"; | ||
146 | |||
147 | cmd.CommandText = sql; | ||
148 | cmd.Parameters.Clear(); | ||
149 | |||
150 | foreach (string name in FieldList) | ||
151 | { | ||
152 | if (m_FieldMap[name].GetValue(es) is bool) | ||
153 | { | ||
154 | if ((bool)m_FieldMap[name].GetValue(es)) | ||
155 | cmd.Parameters.Add(":"+name, "1"); | ||
156 | else | ||
157 | cmd.Parameters.Add(":"+name, "0"); | ||
158 | } | ||
159 | else | ||
160 | { | ||
161 | cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | cmd.ExecuteNonQuery(); | ||
166 | |||
167 | cmd.CommandText = "select LAST_INSERT_ROWID() as id"; | ||
168 | cmd.Parameters.Clear(); | ||
169 | |||
170 | r = cmd.ExecuteReader(); | ||
171 | |||
172 | r.Read(); | ||
173 | |||
174 | es.EstateID = Convert.ToUInt32(r["id"]); | ||
175 | |||
176 | r.Close(); | ||
177 | |||
178 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; | ||
179 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | ||
180 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | ||
181 | |||
182 | // This will throw on dupe key | ||
183 | try | ||
184 | { | ||
185 | cmd.ExecuteNonQuery(); | ||
186 | } | ||
187 | catch (Exception) | ||
188 | { | ||
189 | } | ||
190 | |||
191 | es.Save(); | ||
192 | } | ||
193 | |||
194 | LoadBanList(es); | ||
195 | |||
196 | es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers"); | ||
197 | es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users"); | ||
198 | es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups"); | ||
199 | return es; | ||
200 | } | ||
201 | |||
202 | public void StoreEstateSettings(EstateSettings es) | ||
203 | { | ||
204 | List<string> fields = new List<string>(FieldList); | ||
205 | fields.Remove("EstateID"); | ||
206 | |||
207 | List<string> terms = new List<string>(); | ||
208 | |||
209 | foreach (string f in fields) | ||
210 | terms.Add(f+" = :"+f); | ||
211 | |||
212 | string sql = "update estate_settings set "+String.Join(", ", terms.ToArray())+" where EstateID = :EstateID"; | ||
213 | |||
214 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
215 | |||
216 | cmd.CommandText = sql; | ||
217 | |||
218 | foreach (string name in FieldList) | ||
219 | { | ||
220 | if (m_FieldMap[name].GetValue(es) is bool) | ||
221 | { | ||
222 | if ((bool)m_FieldMap[name].GetValue(es)) | ||
223 | cmd.Parameters.Add(":"+name, "1"); | ||
224 | else | ||
225 | cmd.Parameters.Add(":"+name, "0"); | ||
226 | } | ||
227 | else | ||
228 | { | ||
229 | cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); | ||
230 | } | ||
231 | } | ||
232 | |||
233 | cmd.ExecuteNonQuery(); | ||
234 | |||
235 | SaveBanList(es); | ||
236 | SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers); | ||
237 | SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess); | ||
238 | SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups); | ||
239 | } | ||
240 | |||
241 | private void LoadBanList(EstateSettings es) | ||
242 | { | ||
243 | es.ClearBans(); | ||
244 | |||
245 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
246 | |||
247 | cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; | ||
248 | cmd.Parameters.Add(":EstateID", es.EstateID); | ||
249 | |||
250 | IDataReader r = cmd.ExecuteReader(); | ||
251 | |||
252 | while (r.Read()) | ||
253 | { | ||
254 | EstateBan eb = new EstateBan(); | ||
255 | |||
256 | UUID uuid = new UUID(); | ||
257 | UUID.TryParse(r["bannedUUID"].ToString(), out uuid); | ||
258 | |||
259 | eb.BannedUserID = uuid; | ||
260 | eb.BannedHostAddress = "0.0.0.0"; | ||
261 | eb.BannedHostIPMask = "0.0.0.0"; | ||
262 | es.AddBan(eb); | ||
263 | } | ||
264 | r.Close(); | ||
265 | } | ||
266 | |||
267 | private void SaveBanList(EstateSettings es) | ||
268 | { | ||
269 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
270 | |||
271 | cmd.CommandText = "delete from estateban where EstateID = :EstateID"; | ||
272 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | ||
273 | |||
274 | cmd.ExecuteNonQuery(); | ||
275 | |||
276 | cmd.Parameters.Clear(); | ||
277 | |||
278 | cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( :EstateID, :bannedUUID, '', '', '' )"; | ||
279 | |||
280 | foreach (EstateBan b in es.EstateBans) | ||
281 | { | ||
282 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | ||
283 | cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString()); | ||
284 | |||
285 | cmd.ExecuteNonQuery(); | ||
286 | cmd.Parameters.Clear(); | ||
287 | } | ||
288 | } | ||
289 | |||
290 | void SaveUUIDList(uint EstateID, string table, UUID[] data) | ||
291 | { | ||
292 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
293 | |||
294 | cmd.CommandText = "delete from "+table+" where EstateID = :EstateID"; | ||
295 | cmd.Parameters.Add(":EstateID", EstateID.ToString()); | ||
296 | |||
297 | cmd.ExecuteNonQuery(); | ||
298 | |||
299 | cmd.Parameters.Clear(); | ||
300 | |||
301 | cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( :EstateID, :uuid )"; | ||
302 | |||
303 | foreach (UUID uuid in data) | ||
304 | { | ||
305 | cmd.Parameters.Add(":EstateID", EstateID.ToString()); | ||
306 | cmd.Parameters.Add(":uuid", uuid.ToString()); | ||
307 | |||
308 | cmd.ExecuteNonQuery(); | ||
309 | cmd.Parameters.Clear(); | ||
310 | } | ||
311 | } | ||
312 | |||
313 | UUID[] LoadUUIDList(uint EstateID, string table) | ||
314 | { | ||
315 | List<UUID> uuids = new List<UUID>(); | ||
316 | |||
317 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
318 | |||
319 | cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID"; | ||
320 | cmd.Parameters.Add(":EstateID", EstateID); | ||
321 | |||
322 | IDataReader r = cmd.ExecuteReader(); | ||
323 | |||
324 | while (r.Read()) | ||
325 | { | ||
326 | // EstateBan eb = new EstateBan(); | ||
327 | |||
328 | UUID uuid = new UUID(); | ||
329 | UUID.TryParse(r["uuid"].ToString(), out uuid); | ||
330 | |||
331 | uuids.Add(uuid); | ||
332 | } | ||
333 | r.Close(); | ||
334 | |||
335 | return uuids.ToArray(); | ||
336 | } | ||
337 | |||
338 | public EstateSettings LoadEstateSettings(int estateID) | ||
339 | { | ||
340 | string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID"; | ||
341 | |||
342 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
343 | |||
344 | cmd.CommandText = sql; | ||
345 | cmd.Parameters.Add(":EstateID", estateID.ToString()); | ||
346 | |||
347 | return DoLoad(cmd, UUID.Zero, false); | ||
348 | } | ||
349 | |||
350 | public List<int> GetEstates(string search) | ||
351 | { | ||
352 | List<int> result = new List<int>(); | ||
353 | |||
354 | string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName"; | ||
355 | |||
356 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
357 | |||
358 | cmd.CommandText = sql; | ||
359 | cmd.Parameters.Add(":EstateName", search); | ||
360 | |||
361 | IDataReader r = cmd.ExecuteReader(); | ||
362 | |||
363 | while (r.Read()) | ||
364 | { | ||
365 | result.Add(Convert.ToInt32(r["EstateID"])); | ||
366 | } | ||
367 | r.Close(); | ||
368 | |||
369 | return result; | ||
370 | } | ||
371 | |||
372 | public bool LinkRegion(UUID regionID, int estateID) | ||
373 | { | ||
374 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
375 | |||
376 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; | ||
377 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | ||
378 | cmd.Parameters.Add(":EstateID", estateID.ToString()); | ||
379 | |||
380 | if (cmd.ExecuteNonQuery() == 0) | ||
381 | return false; | ||
382 | |||
383 | return true; | ||
384 | } | ||
385 | |||
386 | public List<UUID> GetRegions(int estateID) | ||
387 | { | ||
388 | return new List<UUID>(); | ||
389 | } | ||
390 | |||
391 | public bool DeleteEstate(int estateID) | ||
392 | { | ||
393 | return false; | ||
394 | } | ||
395 | } | ||
396 | } | ||
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteFramework.cs b/OpenSim/Data/SQLiteLegacy/SQLiteFramework.cs deleted file mode 100644 index 606478e..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteFramework.cs +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using Mono.Data.SqliteClient; | ||
35 | |||
36 | namespace OpenSim.Data.SQLiteLegacy | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// A database interface class to a user profile storage system | ||
40 | /// </summary> | ||
41 | public class SQLiteFramework | ||
42 | { | ||
43 | protected Object m_lockObject = new Object(); | ||
44 | |||
45 | protected SQLiteFramework(string connectionString) | ||
46 | { | ||
47 | } | ||
48 | |||
49 | ////////////////////////////////////////////////////////////// | ||
50 | // | ||
51 | // All non queries are funneled through one connection | ||
52 | // to increase performance a little | ||
53 | // | ||
54 | protected int ExecuteNonQuery(SqliteCommand cmd, SqliteConnection connection) | ||
55 | { | ||
56 | lock (connection) | ||
57 | { | ||
58 | SqliteConnection newConnection = | ||
59 | (SqliteConnection)((ICloneable)connection).Clone(); | ||
60 | newConnection.Open(); | ||
61 | |||
62 | cmd.Connection = newConnection; | ||
63 | //Console.WriteLine("XXX " + cmd.CommandText); | ||
64 | |||
65 | return cmd.ExecuteNonQuery(); | ||
66 | } | ||
67 | } | ||
68 | |||
69 | protected IDataReader ExecuteReader(SqliteCommand cmd, SqliteConnection connection) | ||
70 | { | ||
71 | lock (connection) | ||
72 | { | ||
73 | SqliteConnection newConnection = | ||
74 | (SqliteConnection)((ICloneable)connection).Clone(); | ||
75 | newConnection.Open(); | ||
76 | |||
77 | cmd.Connection = newConnection; | ||
78 | //Console.WriteLine("XXX " + cmd.CommandText); | ||
79 | |||
80 | return cmd.ExecuteReader(); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | protected void CloseCommand(SqliteCommand cmd) | ||
85 | { | ||
86 | cmd.Connection.Close(); | ||
87 | cmd.Connection.Dispose(); | ||
88 | cmd.Dispose(); | ||
89 | } | ||
90 | } | ||
91 | } | ||
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs deleted file mode 100644 index d529d4d..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using Mono.Data.SqliteClient; | ||
35 | |||
36 | namespace OpenSim.Data.SQLiteLegacy | ||
37 | { | ||
38 | public class SQLiteFriendsData : SQLiteGenericTableHandler<FriendsData>, IFriendsData | ||
39 | { | ||
40 | public SQLiteFriendsData(string connectionString, string realm) | ||
41 | : base(connectionString, realm, "FriendsStore") | ||
42 | { | ||
43 | } | ||
44 | |||
45 | public FriendsData[] GetFriends(UUID userID) | ||
46 | { | ||
47 | SqliteCommand cmd = new SqliteCommand(); | ||
48 | |||
49 | cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = :PrincipalID", m_Realm); | ||
50 | cmd.Parameters.Add(":PrincipalID", userID.ToString()); | ||
51 | |||
52 | return DoQuery(cmd); | ||
53 | |||
54 | } | ||
55 | |||
56 | public bool Delete(UUID principalID, string friend) | ||
57 | { | ||
58 | SqliteCommand cmd = new SqliteCommand(); | ||
59 | |||
60 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm); | ||
61 | cmd.Parameters.Add(":PrincipalID", principalID.ToString()); | ||
62 | cmd.Parameters.Add(":Friend", friend); | ||
63 | |||
64 | ExecuteNonQuery(cmd, cmd.Connection); | ||
65 | |||
66 | return true; | ||
67 | } | ||
68 | |||
69 | } | ||
70 | } | ||
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLiteLegacy/SQLiteGenericTableHandler.cs deleted file mode 100644 index 1c1fe8c..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteGenericTableHandler.cs +++ /dev/null | |||
@@ -1,268 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using Mono.Data.SqliteClient; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | |||
38 | namespace OpenSim.Data.SQLiteLegacy | ||
39 | { | ||
40 | public class SQLiteGenericTableHandler<T> : SQLiteFramework where T: class, new() | ||
41 | { | ||
42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
44 | protected Dictionary<string, FieldInfo> m_Fields = | ||
45 | new Dictionary<string, FieldInfo>(); | ||
46 | |||
47 | protected List<string> m_ColumnNames = null; | ||
48 | protected string m_Realm; | ||
49 | protected FieldInfo m_DataField = null; | ||
50 | |||
51 | protected static SqliteConnection m_Connection; | ||
52 | private static bool m_initialized; | ||
53 | |||
54 | public SQLiteGenericTableHandler(string connectionString, | ||
55 | string realm, string storeName) : base(connectionString) | ||
56 | { | ||
57 | m_Realm = realm; | ||
58 | |||
59 | if (!m_initialized) | ||
60 | { | ||
61 | m_Connection = new SqliteConnection(connectionString); | ||
62 | m_Connection.Open(); | ||
63 | |||
64 | if (storeName != String.Empty) | ||
65 | { | ||
66 | Assembly assem = GetType().Assembly; | ||
67 | SqliteConnection newConnection = | ||
68 | (SqliteConnection)((ICloneable)m_Connection).Clone(); | ||
69 | newConnection.Open(); | ||
70 | |||
71 | Migration m = new Migration(newConnection, assem, storeName); | ||
72 | m.Update(); | ||
73 | newConnection.Close(); | ||
74 | newConnection.Dispose(); | ||
75 | } | ||
76 | |||
77 | m_initialized = true; | ||
78 | } | ||
79 | |||
80 | Type t = typeof(T); | ||
81 | FieldInfo[] fields = t.GetFields(BindingFlags.Public | | ||
82 | BindingFlags.Instance | | ||
83 | BindingFlags.DeclaredOnly); | ||
84 | |||
85 | if (fields.Length == 0) | ||
86 | return; | ||
87 | |||
88 | foreach (FieldInfo f in fields) | ||
89 | { | ||
90 | if (f.Name != "Data") | ||
91 | m_Fields[f.Name] = f; | ||
92 | else | ||
93 | m_DataField = f; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | private void CheckColumnNames(IDataReader reader) | ||
98 | { | ||
99 | if (m_ColumnNames != null) | ||
100 | return; | ||
101 | |||
102 | m_ColumnNames = new List<string>(); | ||
103 | |||
104 | DataTable schemaTable = reader.GetSchemaTable(); | ||
105 | foreach (DataRow row in schemaTable.Rows) | ||
106 | { | ||
107 | if (row["ColumnName"] != null && | ||
108 | (!m_Fields.ContainsKey(row["ColumnName"].ToString()))) | ||
109 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | public T[] Get(string field, string key) | ||
114 | { | ||
115 | return Get(new string[] { field }, new string[] { key }); | ||
116 | } | ||
117 | |||
118 | public T[] Get(string[] fields, string[] keys) | ||
119 | { | ||
120 | if (fields.Length != keys.Length) | ||
121 | return new T[0]; | ||
122 | |||
123 | List<string> terms = new List<string>(); | ||
124 | |||
125 | SqliteCommand cmd = new SqliteCommand(); | ||
126 | |||
127 | for (int i = 0 ; i < fields.Length ; i++) | ||
128 | { | ||
129 | cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i])); | ||
130 | terms.Add("`" + fields[i] + "` = :" + fields[i]); | ||
131 | } | ||
132 | |||
133 | string where = String.Join(" and ", terms.ToArray()); | ||
134 | |||
135 | string query = String.Format("select * from {0} where {1}", | ||
136 | m_Realm, where); | ||
137 | |||
138 | cmd.CommandText = query; | ||
139 | |||
140 | return DoQuery(cmd); | ||
141 | } | ||
142 | |||
143 | protected T[] DoQuery(SqliteCommand cmd) | ||
144 | { | ||
145 | IDataReader reader = ExecuteReader(cmd, m_Connection); | ||
146 | if (reader == null) | ||
147 | return new T[0]; | ||
148 | |||
149 | CheckColumnNames(reader); | ||
150 | |||
151 | List<T> result = new List<T>(); | ||
152 | |||
153 | while (reader.Read()) | ||
154 | { | ||
155 | T row = new T(); | ||
156 | |||
157 | foreach (string name in m_Fields.Keys) | ||
158 | { | ||
159 | if (m_Fields[name].GetValue(row) is bool) | ||
160 | { | ||
161 | int v = Convert.ToInt32(reader[name]); | ||
162 | m_Fields[name].SetValue(row, v != 0 ? true : false); | ||
163 | } | ||
164 | else if (m_Fields[name].GetValue(row) is UUID) | ||
165 | { | ||
166 | UUID uuid = UUID.Zero; | ||
167 | |||
168 | UUID.TryParse(reader[name].ToString(), out uuid); | ||
169 | m_Fields[name].SetValue(row, uuid); | ||
170 | } | ||
171 | else if (m_Fields[name].GetValue(row) is int) | ||
172 | { | ||
173 | int v = Convert.ToInt32(reader[name]); | ||
174 | m_Fields[name].SetValue(row, v); | ||
175 | } | ||
176 | else | ||
177 | { | ||
178 | m_Fields[name].SetValue(row, reader[name]); | ||
179 | } | ||
180 | } | ||
181 | |||
182 | if (m_DataField != null) | ||
183 | { | ||
184 | Dictionary<string, string> data = | ||
185 | new Dictionary<string, string>(); | ||
186 | |||
187 | foreach (string col in m_ColumnNames) | ||
188 | { | ||
189 | data[col] = reader[col].ToString(); | ||
190 | if (data[col] == null) | ||
191 | data[col] = String.Empty; | ||
192 | } | ||
193 | |||
194 | m_DataField.SetValue(row, data); | ||
195 | } | ||
196 | |||
197 | result.Add(row); | ||
198 | } | ||
199 | |||
200 | CloseCommand(cmd); | ||
201 | |||
202 | return result.ToArray(); | ||
203 | } | ||
204 | |||
205 | public T[] Get(string where) | ||
206 | { | ||
207 | SqliteCommand cmd = new SqliteCommand(); | ||
208 | |||
209 | string query = String.Format("select * from {0} where {1}", | ||
210 | m_Realm, where); | ||
211 | |||
212 | cmd.CommandText = query; | ||
213 | |||
214 | return DoQuery(cmd); | ||
215 | } | ||
216 | |||
217 | public bool Store(T row) | ||
218 | { | ||
219 | SqliteCommand cmd = new SqliteCommand(); | ||
220 | |||
221 | string query = ""; | ||
222 | List<String> names = new List<String>(); | ||
223 | List<String> values = new List<String>(); | ||
224 | |||
225 | foreach (FieldInfo fi in m_Fields.Values) | ||
226 | { | ||
227 | names.Add(fi.Name); | ||
228 | values.Add(":" + fi.Name); | ||
229 | cmd.Parameters.Add(new SqliteParameter(":" + fi.Name, fi.GetValue(row).ToString())); | ||
230 | } | ||
231 | |||
232 | if (m_DataField != null) | ||
233 | { | ||
234 | Dictionary<string, string> data = | ||
235 | (Dictionary<string, string>)m_DataField.GetValue(row); | ||
236 | |||
237 | foreach (KeyValuePair<string, string> kvp in data) | ||
238 | { | ||
239 | names.Add(kvp.Key); | ||
240 | values.Add(":" + kvp.Key); | ||
241 | cmd.Parameters.Add(new SqliteParameter(":" + kvp.Key, kvp.Value)); | ||
242 | } | ||
243 | } | ||
244 | |||
245 | query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")"; | ||
246 | |||
247 | cmd.CommandText = query; | ||
248 | |||
249 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | ||
250 | return true; | ||
251 | |||
252 | return false; | ||
253 | } | ||
254 | |||
255 | public bool Delete(string field, string val) | ||
256 | { | ||
257 | SqliteCommand cmd = new SqliteCommand(); | ||
258 | |||
259 | cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field); | ||
260 | cmd.Parameters.Add(new SqliteParameter(field, val)); | ||
261 | |||
262 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | ||
263 | return true; | ||
264 | |||
265 | return false; | ||
266 | } | ||
267 | } | ||
268 | } | ||
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs b/OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs deleted file mode 100644 index 8ca48f9..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs +++ /dev/null | |||
@@ -1,898 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using Mono.Data.SqliteClient; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | |||
37 | namespace OpenSim.Data.SQLiteLegacy | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// An Inventory Interface to the SQLite database | ||
41 | /// </summary> | ||
42 | public class SQLiteInventoryStore : SQLiteUtil, IInventoryDataPlugin | ||
43 | { | ||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | private const string invItemsSelect = "select * from inventoryitems"; | ||
47 | private const string invFoldersSelect = "select * from inventoryfolders"; | ||
48 | |||
49 | private static SqliteConnection conn; | ||
50 | private static DataSet ds; | ||
51 | private static SqliteDataAdapter invItemsDa; | ||
52 | private static SqliteDataAdapter invFoldersDa; | ||
53 | |||
54 | private static bool m_Initialized = false; | ||
55 | |||
56 | public void Initialise() | ||
57 | { | ||
58 | m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!"); | ||
59 | throw new PluginNotInitialisedException(Name); | ||
60 | } | ||
61 | |||
62 | /// <summary> | ||
63 | /// <list type="bullet"> | ||
64 | /// <item>Initialises Inventory interface</item> | ||
65 | /// <item>Loads and initialises a new SQLite connection and maintains it.</item> | ||
66 | /// <item>use default URI if connect string string is empty.</item> | ||
67 | /// </list> | ||
68 | /// </summary> | ||
69 | /// <param name="dbconnect">connect string</param> | ||
70 | public void Initialise(string dbconnect) | ||
71 | { | ||
72 | if (!m_Initialized) | ||
73 | { | ||
74 | m_Initialized = true; | ||
75 | |||
76 | if (dbconnect == string.Empty) | ||
77 | { | ||
78 | dbconnect = "URI=file:inventoryStore.db,version=3"; | ||
79 | } | ||
80 | m_log.Info("[INVENTORY DB]: Sqlite - connecting: " + dbconnect); | ||
81 | conn = new SqliteConnection(dbconnect); | ||
82 | |||
83 | conn.Open(); | ||
84 | |||
85 | Assembly assem = GetType().Assembly; | ||
86 | Migration m = new Migration(conn, assem, "InventoryStore"); | ||
87 | m.Update(); | ||
88 | |||
89 | SqliteCommand itemsSelectCmd = new SqliteCommand(invItemsSelect, conn); | ||
90 | invItemsDa = new SqliteDataAdapter(itemsSelectCmd); | ||
91 | // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa); | ||
92 | |||
93 | SqliteCommand foldersSelectCmd = new SqliteCommand(invFoldersSelect, conn); | ||
94 | invFoldersDa = new SqliteDataAdapter(foldersSelectCmd); | ||
95 | |||
96 | ds = new DataSet(); | ||
97 | |||
98 | ds.Tables.Add(createInventoryFoldersTable()); | ||
99 | invFoldersDa.Fill(ds.Tables["inventoryfolders"]); | ||
100 | setupFoldersCommands(invFoldersDa, conn); | ||
101 | m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions"); | ||
102 | |||
103 | ds.Tables.Add(createInventoryItemsTable()); | ||
104 | invItemsDa.Fill(ds.Tables["inventoryitems"]); | ||
105 | setupItemsCommands(invItemsDa, conn); | ||
106 | m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions"); | ||
107 | |||
108 | ds.AcceptChanges(); | ||
109 | } | ||
110 | } | ||
111 | |||
112 | /// <summary> | ||
113 | /// Closes the inventory interface | ||
114 | /// </summary> | ||
115 | public void Dispose() | ||
116 | { | ||
117 | if (conn != null) | ||
118 | { | ||
119 | conn.Close(); | ||
120 | conn = null; | ||
121 | } | ||
122 | if (invItemsDa != null) | ||
123 | { | ||
124 | invItemsDa.Dispose(); | ||
125 | invItemsDa = null; | ||
126 | } | ||
127 | if (invFoldersDa != null) | ||
128 | { | ||
129 | invFoldersDa.Dispose(); | ||
130 | invFoldersDa = null; | ||
131 | } | ||
132 | if (ds != null) | ||
133 | { | ||
134 | ds.Dispose(); | ||
135 | ds = null; | ||
136 | } | ||
137 | } | ||
138 | |||
139 | /// <summary> | ||
140 | /// | ||
141 | /// </summary> | ||
142 | /// <param name="row"></param> | ||
143 | /// <returns></returns> | ||
144 | public InventoryItemBase buildItem(DataRow row) | ||
145 | { | ||
146 | InventoryItemBase item = new InventoryItemBase(); | ||
147 | item.ID = new UUID((string) row["UUID"]); | ||
148 | item.AssetID = new UUID((string) row["assetID"]); | ||
149 | item.AssetType = Convert.ToInt32(row["assetType"]); | ||
150 | item.InvType = Convert.ToInt32(row["invType"]); | ||
151 | item.Folder = new UUID((string) row["parentFolderID"]); | ||
152 | item.Owner = new UUID((string) row["avatarID"]); | ||
153 | item.CreatorIdentification = (string)row["creatorsID"]; | ||
154 | item.Name = (string) row["inventoryName"]; | ||
155 | item.Description = (string) row["inventoryDescription"]; | ||
156 | |||
157 | item.NextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]); | ||
158 | item.CurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]); | ||
159 | item.BasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]); | ||
160 | item.EveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]); | ||
161 | item.GroupPermissions = Convert.ToUInt32(row["inventoryGroupPermissions"]); | ||
162 | |||
163 | // new fields | ||
164 | if (!Convert.IsDBNull(row["salePrice"])) | ||
165 | item.SalePrice = Convert.ToInt32(row["salePrice"]); | ||
166 | |||
167 | if (!Convert.IsDBNull(row["saleType"])) | ||
168 | item.SaleType = Convert.ToByte(row["saleType"]); | ||
169 | |||
170 | if (!Convert.IsDBNull(row["creationDate"])) | ||
171 | item.CreationDate = Convert.ToInt32(row["creationDate"]); | ||
172 | |||
173 | if (!Convert.IsDBNull(row["groupID"])) | ||
174 | item.GroupID = new UUID((string)row["groupID"]); | ||
175 | |||
176 | if (!Convert.IsDBNull(row["groupOwned"])) | ||
177 | item.GroupOwned = Convert.ToBoolean(row["groupOwned"]); | ||
178 | |||
179 | if (!Convert.IsDBNull(row["Flags"])) | ||
180 | item.Flags = Convert.ToUInt32(row["Flags"]); | ||
181 | |||
182 | return item; | ||
183 | } | ||
184 | |||
185 | /// <summary> | ||
186 | /// Fill a database row with item data | ||
187 | /// </summary> | ||
188 | /// <param name="row"></param> | ||
189 | /// <param name="item"></param> | ||
190 | private static void fillItemRow(DataRow row, InventoryItemBase item) | ||
191 | { | ||
192 | row["UUID"] = item.ID.ToString(); | ||
193 | row["assetID"] = item.AssetID.ToString(); | ||
194 | row["assetType"] = item.AssetType; | ||
195 | row["invType"] = item.InvType; | ||
196 | row["parentFolderID"] = item.Folder.ToString(); | ||
197 | row["avatarID"] = item.Owner.ToString(); | ||
198 | row["creatorsID"] = item.CreatorIdentification.ToString(); | ||
199 | row["inventoryName"] = item.Name; | ||
200 | row["inventoryDescription"] = item.Description; | ||
201 | |||
202 | row["inventoryNextPermissions"] = item.NextPermissions; | ||
203 | row["inventoryCurrentPermissions"] = item.CurrentPermissions; | ||
204 | row["inventoryBasePermissions"] = item.BasePermissions; | ||
205 | row["inventoryEveryOnePermissions"] = item.EveryOnePermissions; | ||
206 | row["inventoryGroupPermissions"] = item.GroupPermissions; | ||
207 | |||
208 | // new fields | ||
209 | row["salePrice"] = item.SalePrice; | ||
210 | row["saleType"] = item.SaleType; | ||
211 | row["creationDate"] = item.CreationDate; | ||
212 | row["groupID"] = item.GroupID.ToString(); | ||
213 | row["groupOwned"] = item.GroupOwned; | ||
214 | row["flags"] = item.Flags; | ||
215 | } | ||
216 | |||
217 | /// <summary> | ||
218 | /// Add inventory folder | ||
219 | /// </summary> | ||
220 | /// <param name="folder">Folder base</param> | ||
221 | /// <param name="add">true=create folder. false=update existing folder</param> | ||
222 | /// <remarks>nasty</remarks> | ||
223 | private void addFolder(InventoryFolderBase folder, bool add) | ||
224 | { | ||
225 | lock (ds) | ||
226 | { | ||
227 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; | ||
228 | |||
229 | DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString()); | ||
230 | if (inventoryRow == null) | ||
231 | { | ||
232 | if (! add) | ||
233 | m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory folder: {0}", folder.ID); | ||
234 | |||
235 | inventoryRow = inventoryFolderTable.NewRow(); | ||
236 | fillFolderRow(inventoryRow, folder); | ||
237 | inventoryFolderTable.Rows.Add(inventoryRow); | ||
238 | } | ||
239 | else | ||
240 | { | ||
241 | if (add) | ||
242 | m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory folder that already exists: {0}", folder.ID); | ||
243 | |||
244 | fillFolderRow(inventoryRow, folder); | ||
245 | } | ||
246 | |||
247 | invFoldersDa.Update(ds, "inventoryfolders"); | ||
248 | } | ||
249 | } | ||
250 | |||
251 | /// <summary> | ||
252 | /// Move an inventory folder | ||
253 | /// </summary> | ||
254 | /// <param name="folder">folder base</param> | ||
255 | private void moveFolder(InventoryFolderBase folder) | ||
256 | { | ||
257 | lock (ds) | ||
258 | { | ||
259 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; | ||
260 | |||
261 | DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString()); | ||
262 | if (inventoryRow == null) | ||
263 | { | ||
264 | inventoryRow = inventoryFolderTable.NewRow(); | ||
265 | fillFolderRow(inventoryRow, folder); | ||
266 | inventoryFolderTable.Rows.Add(inventoryRow); | ||
267 | } | ||
268 | else | ||
269 | { | ||
270 | moveFolderRow(inventoryRow, folder); | ||
271 | } | ||
272 | |||
273 | invFoldersDa.Update(ds, "inventoryfolders"); | ||
274 | } | ||
275 | } | ||
276 | |||
277 | /// <summary> | ||
278 | /// add an item in inventory | ||
279 | /// </summary> | ||
280 | /// <param name="item">the item</param> | ||
281 | /// <param name="add">true=add item ; false=update existing item</param> | ||
282 | private void addItem(InventoryItemBase item, bool add) | ||
283 | { | ||
284 | lock (ds) | ||
285 | { | ||
286 | DataTable inventoryItemTable = ds.Tables["inventoryitems"]; | ||
287 | |||
288 | DataRow inventoryRow = inventoryItemTable.Rows.Find(item.ID.ToString()); | ||
289 | if (inventoryRow == null) | ||
290 | { | ||
291 | if (!add) | ||
292 | m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Update non-existant inventory item: {0}", item.ID); | ||
293 | |||
294 | inventoryRow = inventoryItemTable.NewRow(); | ||
295 | fillItemRow(inventoryRow, item); | ||
296 | inventoryItemTable.Rows.Add(inventoryRow); | ||
297 | } | ||
298 | else | ||
299 | { | ||
300 | if (add) | ||
301 | m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.ID); | ||
302 | |||
303 | fillItemRow(inventoryRow, item); | ||
304 | } | ||
305 | |||
306 | invItemsDa.Update(ds, "inventoryitems"); | ||
307 | |||
308 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; | ||
309 | |||
310 | inventoryRow = inventoryFolderTable.Rows.Find(item.Folder.ToString()); | ||
311 | if (inventoryRow != null) //MySQL doesn't throw an exception here, so sqlite shouldn't either. | ||
312 | inventoryRow["version"] = (int)inventoryRow["version"] + 1; | ||
313 | |||
314 | invFoldersDa.Update(ds, "inventoryfolders"); | ||
315 | } | ||
316 | } | ||
317 | |||
318 | /// <summary> | ||
319 | /// TODO : DataSet commit | ||
320 | /// </summary> | ||
321 | public void Shutdown() | ||
322 | { | ||
323 | // TODO: DataSet commit | ||
324 | } | ||
325 | |||
326 | /// <summary> | ||
327 | /// The name of this DB provider | ||
328 | /// </summary> | ||
329 | /// <returns>Name of DB provider</returns> | ||
330 | public string Name | ||
331 | { | ||
332 | get { return "SQLite Inventory Data Interface"; } | ||
333 | } | ||
334 | |||
335 | /// <summary> | ||
336 | /// Returns the version of this DB provider | ||
337 | /// </summary> | ||
338 | /// <returns>A string containing the DB provider version</returns> | ||
339 | public string Version | ||
340 | { | ||
341 | get | ||
342 | { | ||
343 | Module module = GetType().Module; | ||
344 | // string dllName = module.Assembly.ManifestModule.Name; | ||
345 | Version dllVersion = module.Assembly.GetName().Version; | ||
346 | |||
347 | |||
348 | return | ||
349 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, | ||
350 | dllVersion.Revision); | ||
351 | } | ||
352 | } | ||
353 | |||
354 | /// <summary> | ||
355 | /// Returns a list of inventory items contained within the specified folder | ||
356 | /// </summary> | ||
357 | /// <param name="folderID">The UUID of the target folder</param> | ||
358 | /// <returns>A List of InventoryItemBase items</returns> | ||
359 | public List<InventoryItemBase> getInventoryInFolder(UUID folderID) | ||
360 | { | ||
361 | lock (ds) | ||
362 | { | ||
363 | List<InventoryItemBase> retval = new List<InventoryItemBase>(); | ||
364 | DataTable inventoryItemTable = ds.Tables["inventoryitems"]; | ||
365 | string selectExp = "parentFolderID = '" + folderID + "'"; | ||
366 | DataRow[] rows = inventoryItemTable.Select(selectExp); | ||
367 | foreach (DataRow row in rows) | ||
368 | { | ||
369 | retval.Add(buildItem(row)); | ||
370 | } | ||
371 | |||
372 | return retval; | ||
373 | } | ||
374 | } | ||
375 | |||
376 | /// <summary> | ||
377 | /// Returns a list of the root folders within a users inventory | ||
378 | /// </summary> | ||
379 | /// <param name="user">The user whos inventory is to be searched</param> | ||
380 | /// <returns>A list of folder objects</returns> | ||
381 | public List<InventoryFolderBase> getUserRootFolders(UUID user) | ||
382 | { | ||
383 | return new List<InventoryFolderBase>(); | ||
384 | } | ||
385 | |||
386 | // see InventoryItemBase.getUserRootFolder | ||
387 | public InventoryFolderBase getUserRootFolder(UUID user) | ||
388 | { | ||
389 | lock (ds) | ||
390 | { | ||
391 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
392 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; | ||
393 | string selectExp = "agentID = '" + user + "' AND parentID = '" + UUID.Zero + "'"; | ||
394 | DataRow[] rows = inventoryFolderTable.Select(selectExp); | ||
395 | foreach (DataRow row in rows) | ||
396 | { | ||
397 | folders.Add(buildFolder(row)); | ||
398 | } | ||
399 | |||
400 | // There should only ever be one root folder for a user. However, if there's more | ||
401 | // than one we'll simply use the first one rather than failing. It would be even | ||
402 | // nicer to print some message to this effect, but this feels like it's too low a | ||
403 | // to put such a message out, and it's too minor right now to spare the time to | ||
404 | // suitably refactor. | ||
405 | if (folders.Count > 0) | ||
406 | { | ||
407 | return folders[0]; | ||
408 | } | ||
409 | |||
410 | return null; | ||
411 | } | ||
412 | } | ||
413 | |||
414 | /// <summary> | ||
415 | /// Append a list of all the child folders of a parent folder | ||
416 | /// </summary> | ||
417 | /// <param name="folders">list where folders will be appended</param> | ||
418 | /// <param name="parentID">ID of parent</param> | ||
419 | protected void getInventoryFolders(ref List<InventoryFolderBase> folders, UUID parentID) | ||
420 | { | ||
421 | lock (ds) | ||
422 | { | ||
423 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; | ||
424 | string selectExp = "parentID = '" + parentID + "'"; | ||
425 | DataRow[] rows = inventoryFolderTable.Select(selectExp); | ||
426 | foreach (DataRow row in rows) | ||
427 | { | ||
428 | folders.Add(buildFolder(row)); | ||
429 | } | ||
430 | |||
431 | } | ||
432 | } | ||
433 | |||
434 | /// <summary> | ||
435 | /// Returns a list of inventory folders contained in the folder 'parentID' | ||
436 | /// </summary> | ||
437 | /// <param name="parentID">The folder to get subfolders for</param> | ||
438 | /// <returns>A list of inventory folders</returns> | ||
439 | public List<InventoryFolderBase> getInventoryFolders(UUID parentID) | ||
440 | { | ||
441 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
442 | getInventoryFolders(ref folders, parentID); | ||
443 | return folders; | ||
444 | } | ||
445 | |||
446 | /// <summary> | ||
447 | /// See IInventoryDataPlugin | ||
448 | /// </summary> | ||
449 | /// <param name="parentID"></param> | ||
450 | /// <returns></returns> | ||
451 | public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) | ||
452 | { | ||
453 | /* Note: There are subtle changes between this implementation of getFolderHierarchy and the previous one | ||
454 | * - We will only need to hit the database twice instead of n times. | ||
455 | * - We assume the database is well-formed - no stranded/dangling folders, all folders in heirarchy owned | ||
456 | * by the same person, each user only has 1 inventory heirarchy | ||
457 | * - The returned list is not ordered, instead of breadth-first ordered | ||
458 | There are basically 2 usage cases for getFolderHeirarchy: | ||
459 | 1) Getting the user's entire inventory heirarchy when they log in | ||
460 | 2) Finding a subfolder heirarchy to delete when emptying the trash. | ||
461 | This implementation will pull all inventory folders from the database, and then prune away any folder that | ||
462 | is not part of the requested sub-heirarchy. The theory is that it is cheaper to make 1 request from the | ||
463 | database than to make n requests. This pays off only if requested heirarchy is large. | ||
464 | By making this choice, we are making the worst case better at the cost of making the best case worse | ||
465 | - Francis | ||
466 | */ | ||
467 | |||
468 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
469 | DataRow[] folderRows = null, parentRow; | ||
470 | InventoryFolderBase parentFolder = null; | ||
471 | lock (ds) | ||
472 | { | ||
473 | /* Fetch the parent folder from the database to determine the agent ID. | ||
474 | * Then fetch all inventory folders for that agent from the agent ID. | ||
475 | */ | ||
476 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; | ||
477 | string selectExp = "UUID = '" + parentID + "'"; | ||
478 | parentRow = inventoryFolderTable.Select(selectExp); // Assume at most 1 result | ||
479 | if (parentRow.GetLength(0) >= 1) // No result means parent folder does not exist | ||
480 | { | ||
481 | parentFolder = buildFolder(parentRow[0]); | ||
482 | UUID agentID = parentFolder.Owner; | ||
483 | selectExp = "agentID = '" + agentID + "'"; | ||
484 | folderRows = inventoryFolderTable.Select(selectExp); | ||
485 | } | ||
486 | |||
487 | if (folderRows != null && folderRows.GetLength(0) >= 1) // No result means parent folder does not exist | ||
488 | { // or has no children | ||
489 | /* if we're querying the root folder, just return an unordered list of all folders in the user's | ||
490 | * inventory | ||
491 | */ | ||
492 | if (parentFolder.ParentID == UUID.Zero) | ||
493 | { | ||
494 | foreach (DataRow row in folderRows) | ||
495 | { | ||
496 | InventoryFolderBase curFolder = buildFolder(row); | ||
497 | if (curFolder.ID != parentID) // Return all folders except the parent folder of heirarchy | ||
498 | folders.Add(buildFolder(row)); | ||
499 | } | ||
500 | } // If requesting root folder | ||
501 | /* else we are querying a non-root folder. We currently have a list of all of the user's folders, | ||
502 | * we must construct a list of all folders in the heirarchy below parentID. | ||
503 | * Our first step will be to construct a hash table of all folders, indexed by parent ID. | ||
504 | * Once we have constructed the hash table, we will do a breadth-first traversal on the tree using the | ||
505 | * hash table to find child folders. | ||
506 | */ | ||
507 | else | ||
508 | { // Querying a non-root folder | ||
509 | |||
510 | // Build a hash table of all user's inventory folders, indexed by each folder's parent ID | ||
511 | Dictionary<UUID, List<InventoryFolderBase>> hashtable = | ||
512 | new Dictionary<UUID, List<InventoryFolderBase>>(folderRows.GetLength(0)); | ||
513 | |||
514 | foreach (DataRow row in folderRows) | ||
515 | { | ||
516 | InventoryFolderBase curFolder = buildFolder(row); | ||
517 | if (curFolder.ParentID != UUID.Zero) // Discard root of tree - not needed | ||
518 | { | ||
519 | if (hashtable.ContainsKey(curFolder.ParentID)) | ||
520 | { | ||
521 | // Current folder already has a sibling - append to sibling list | ||
522 | hashtable[curFolder.ParentID].Add(curFolder); | ||
523 | } | ||
524 | else | ||
525 | { | ||
526 | List<InventoryFolderBase> siblingList = new List<InventoryFolderBase>(); | ||
527 | siblingList.Add(curFolder); | ||
528 | // Current folder has no known (yet) siblings | ||
529 | hashtable.Add(curFolder.ParentID, siblingList); | ||
530 | } | ||
531 | } | ||
532 | } // For all inventory folders | ||
533 | |||
534 | // Note: Could release the ds lock here - we don't access folderRows or the database anymore. | ||
535 | // This is somewhat of a moot point as the callers of this function usually lock db anyways. | ||
536 | |||
537 | if (hashtable.ContainsKey(parentID)) // if requested folder does have children | ||
538 | folders.AddRange(hashtable[parentID]); | ||
539 | |||
540 | // BreadthFirstSearch build inventory tree **Note: folders.Count is *not* static | ||
541 | for (int i = 0; i < folders.Count; i++) | ||
542 | if (hashtable.ContainsKey(folders[i].ID)) | ||
543 | folders.AddRange(hashtable[folders[i].ID]); | ||
544 | |||
545 | } // if requesting a subfolder heirarchy | ||
546 | } // if folder parentID exists and has children | ||
547 | } // lock ds | ||
548 | return folders; | ||
549 | } | ||
550 | |||
551 | /// <summary> | ||
552 | /// Returns an inventory item by its UUID | ||
553 | /// </summary> | ||
554 | /// <param name="item">The UUID of the item to be returned</param> | ||
555 | /// <returns>A class containing item information</returns> | ||
556 | public InventoryItemBase getInventoryItem(UUID item) | ||
557 | { | ||
558 | lock (ds) | ||
559 | { | ||
560 | DataRow row = ds.Tables["inventoryitems"].Rows.Find(item.ToString()); | ||
561 | if (row != null) | ||
562 | { | ||
563 | return buildItem(row); | ||
564 | } | ||
565 | else | ||
566 | { | ||
567 | return null; | ||
568 | } | ||
569 | } | ||
570 | } | ||
571 | |||
572 | /// <summary> | ||
573 | /// Returns a specified inventory folder by its UUID | ||
574 | /// </summary> | ||
575 | /// <param name="folder">The UUID of the folder to be returned</param> | ||
576 | /// <returns>A class containing folder information</returns> | ||
577 | public InventoryFolderBase getInventoryFolder(UUID folder) | ||
578 | { | ||
579 | // TODO: Deep voodoo here. If you enable this code then | ||
580 | // multi region breaks. No idea why, but I figured it was | ||
581 | // better to leave multi region at this point. It does mean | ||
582 | // that you don't get to see system textures why creating | ||
583 | // clothes and the like. :( | ||
584 | lock (ds) | ||
585 | { | ||
586 | DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder.ToString()); | ||
587 | if (row != null) | ||
588 | { | ||
589 | return buildFolder(row); | ||
590 | } | ||
591 | else | ||
592 | { | ||
593 | return null; | ||
594 | } | ||
595 | } | ||
596 | } | ||
597 | |||
598 | /// <summary> | ||
599 | /// Creates a new inventory item based on item | ||
600 | /// </summary> | ||
601 | /// <param name="item">The item to be created</param> | ||
602 | public void addInventoryItem(InventoryItemBase item) | ||
603 | { | ||
604 | addItem(item, true); | ||
605 | } | ||
606 | |||
607 | /// <summary> | ||
608 | /// Updates an inventory item with item (updates based on ID) | ||
609 | /// </summary> | ||
610 | /// <param name="item">The updated item</param> | ||
611 | public void updateInventoryItem(InventoryItemBase item) | ||
612 | { | ||
613 | addItem(item, false); | ||
614 | } | ||
615 | |||
616 | /// <summary> | ||
617 | /// Delete an inventory item | ||
618 | /// </summary> | ||
619 | /// <param name="item">The item UUID</param> | ||
620 | public void deleteInventoryItem(UUID itemID) | ||
621 | { | ||
622 | lock (ds) | ||
623 | { | ||
624 | DataTable inventoryItemTable = ds.Tables["inventoryitems"]; | ||
625 | |||
626 | DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID.ToString()); | ||
627 | if (inventoryRow != null) | ||
628 | { | ||
629 | inventoryRow.Delete(); | ||
630 | } | ||
631 | |||
632 | invItemsDa.Update(ds, "inventoryitems"); | ||
633 | } | ||
634 | } | ||
635 | |||
636 | public InventoryItemBase queryInventoryItem(UUID itemID) | ||
637 | { | ||
638 | return getInventoryItem(itemID); | ||
639 | } | ||
640 | |||
641 | public InventoryFolderBase queryInventoryFolder(UUID folderID) | ||
642 | { | ||
643 | return getInventoryFolder(folderID); | ||
644 | } | ||
645 | |||
646 | /// <summary> | ||
647 | /// Delete all items in the specified folder | ||
648 | /// </summary> | ||
649 | /// <param name="folderId">id of the folder, whose item content should be deleted</param> | ||
650 | /// <todo>this is horribly inefficient, but I don't want to ruin the overall structure of this implementation</todo> | ||
651 | private void deleteItemsInFolder(UUID folderId) | ||
652 | { | ||
653 | List<InventoryItemBase> items = getInventoryInFolder(folderId); | ||
654 | |||
655 | foreach (InventoryItemBase i in items) | ||
656 | deleteInventoryItem(i.ID); | ||
657 | } | ||
658 | |||
659 | /// <summary> | ||
660 | /// Adds a new folder specified by folder | ||
661 | /// </summary> | ||
662 | /// <param name="folder">The inventory folder</param> | ||
663 | public void addInventoryFolder(InventoryFolderBase folder) | ||
664 | { | ||
665 | addFolder(folder, true); | ||
666 | } | ||
667 | |||
668 | /// <summary> | ||
669 | /// Updates a folder based on its ID with folder | ||
670 | /// </summary> | ||
671 | /// <param name="folder">The inventory folder</param> | ||
672 | public void updateInventoryFolder(InventoryFolderBase folder) | ||
673 | { | ||
674 | addFolder(folder, false); | ||
675 | } | ||
676 | |||
677 | /// <summary> | ||
678 | /// Moves a folder based on its ID with folder | ||
679 | /// </summary> | ||
680 | /// <param name="folder">The inventory folder</param> | ||
681 | public void moveInventoryFolder(InventoryFolderBase folder) | ||
682 | { | ||
683 | moveFolder(folder); | ||
684 | } | ||
685 | |||
686 | /// <summary> | ||
687 | /// Delete a folder | ||
688 | /// </summary> | ||
689 | /// <remarks> | ||
690 | /// This will clean-up any child folders and child items as well | ||
691 | /// </remarks> | ||
692 | /// <param name="folderID">the folder UUID</param> | ||
693 | public void deleteInventoryFolder(UUID folderID) | ||
694 | { | ||
695 | lock (ds) | ||
696 | { | ||
697 | List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID); | ||
698 | |||
699 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; | ||
700 | DataRow inventoryRow; | ||
701 | |||
702 | //Delete all sub-folders | ||
703 | foreach (InventoryFolderBase f in subFolders) | ||
704 | { | ||
705 | inventoryRow = inventoryFolderTable.Rows.Find(f.ID.ToString()); | ||
706 | if (inventoryRow != null) | ||
707 | { | ||
708 | deleteItemsInFolder(f.ID); | ||
709 | inventoryRow.Delete(); | ||
710 | } | ||
711 | } | ||
712 | |||
713 | //Delete the actual row | ||
714 | inventoryRow = inventoryFolderTable.Rows.Find(folderID.ToString()); | ||
715 | if (inventoryRow != null) | ||
716 | { | ||
717 | deleteItemsInFolder(folderID); | ||
718 | inventoryRow.Delete(); | ||
719 | } | ||
720 | |||
721 | invFoldersDa.Update(ds, "inventoryfolders"); | ||
722 | } | ||
723 | } | ||
724 | |||
725 | /*********************************************************************** | ||
726 | * | ||
727 | * Data Table definitions | ||
728 | * | ||
729 | **********************************************************************/ | ||
730 | |||
731 | /// <summary> | ||
732 | /// Create the "inventoryitems" table | ||
733 | /// </summary> | ||
734 | private static DataTable createInventoryItemsTable() | ||
735 | { | ||
736 | DataTable inv = new DataTable("inventoryitems"); | ||
737 | |||
738 | createCol(inv, "UUID", typeof (String)); //inventoryID | ||
739 | createCol(inv, "assetID", typeof (String)); | ||
740 | createCol(inv, "assetType", typeof (Int32)); | ||
741 | createCol(inv, "invType", typeof (Int32)); | ||
742 | createCol(inv, "parentFolderID", typeof (String)); | ||
743 | createCol(inv, "avatarID", typeof (String)); | ||
744 | createCol(inv, "creatorsID", typeof (String)); | ||
745 | |||
746 | createCol(inv, "inventoryName", typeof (String)); | ||
747 | createCol(inv, "inventoryDescription", typeof (String)); | ||
748 | // permissions | ||
749 | createCol(inv, "inventoryNextPermissions", typeof (Int32)); | ||
750 | createCol(inv, "inventoryCurrentPermissions", typeof (Int32)); | ||
751 | createCol(inv, "inventoryBasePermissions", typeof (Int32)); | ||
752 | createCol(inv, "inventoryEveryOnePermissions", typeof (Int32)); | ||
753 | createCol(inv, "inventoryGroupPermissions", typeof (Int32)); | ||
754 | |||
755 | // sale info | ||
756 | createCol(inv, "salePrice", typeof(Int32)); | ||
757 | createCol(inv, "saleType", typeof(Byte)); | ||
758 | |||
759 | // creation date | ||
760 | createCol(inv, "creationDate", typeof(Int32)); | ||
761 | |||
762 | // group info | ||
763 | createCol(inv, "groupID", typeof(String)); | ||
764 | createCol(inv, "groupOwned", typeof(Boolean)); | ||
765 | |||
766 | // Flags | ||
767 | createCol(inv, "flags", typeof(UInt32)); | ||
768 | |||
769 | inv.PrimaryKey = new DataColumn[] { inv.Columns["UUID"] }; | ||
770 | return inv; | ||
771 | } | ||
772 | |||
773 | /// <summary> | ||
774 | /// Creates the "inventoryfolders" table | ||
775 | /// </summary> | ||
776 | /// <returns></returns> | ||
777 | private static DataTable createInventoryFoldersTable() | ||
778 | { | ||
779 | DataTable fol = new DataTable("inventoryfolders"); | ||
780 | |||
781 | createCol(fol, "UUID", typeof (String)); //folderID | ||
782 | createCol(fol, "name", typeof (String)); | ||
783 | createCol(fol, "agentID", typeof (String)); | ||
784 | createCol(fol, "parentID", typeof (String)); | ||
785 | createCol(fol, "type", typeof (Int32)); | ||
786 | createCol(fol, "version", typeof (Int32)); | ||
787 | |||
788 | fol.PrimaryKey = new DataColumn[] {fol.Columns["UUID"]}; | ||
789 | return fol; | ||
790 | } | ||
791 | |||
792 | /// <summary> | ||
793 | /// | ||
794 | /// </summary> | ||
795 | /// <param name="da"></param> | ||
796 | /// <param name="conn"></param> | ||
797 | private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
798 | { | ||
799 | lock (ds) | ||
800 | { | ||
801 | da.InsertCommand = createInsertCommand("inventoryitems", ds.Tables["inventoryitems"]); | ||
802 | da.InsertCommand.Connection = conn; | ||
803 | |||
804 | da.UpdateCommand = createUpdateCommand("inventoryitems", "UUID=:UUID", ds.Tables["inventoryitems"]); | ||
805 | da.UpdateCommand.Connection = conn; | ||
806 | |||
807 | SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID"); | ||
808 | delete.Parameters.Add(createSqliteParameter("UUID", typeof(String))); | ||
809 | delete.Connection = conn; | ||
810 | da.DeleteCommand = delete; | ||
811 | } | ||
812 | } | ||
813 | |||
814 | /// <summary> | ||
815 | /// | ||
816 | /// </summary> | ||
817 | /// <param name="da"></param> | ||
818 | /// <param name="conn"></param> | ||
819 | private void setupFoldersCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
820 | { | ||
821 | lock (ds) | ||
822 | { | ||
823 | da.InsertCommand = createInsertCommand("inventoryfolders", ds.Tables["inventoryfolders"]); | ||
824 | da.InsertCommand.Connection = conn; | ||
825 | |||
826 | da.UpdateCommand = createUpdateCommand("inventoryfolders", "UUID=:UUID", ds.Tables["inventoryfolders"]); | ||
827 | da.UpdateCommand.Connection = conn; | ||
828 | |||
829 | SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID"); | ||
830 | delete.Parameters.Add(createSqliteParameter("UUID", typeof(String))); | ||
831 | delete.Connection = conn; | ||
832 | da.DeleteCommand = delete; | ||
833 | } | ||
834 | } | ||
835 | |||
836 | /// <summary> | ||
837 | /// | ||
838 | /// </summary> | ||
839 | /// <param name="row"></param> | ||
840 | /// <returns></returns> | ||
841 | private static InventoryFolderBase buildFolder(DataRow row) | ||
842 | { | ||
843 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
844 | folder.ID = new UUID((string) row["UUID"]); | ||
845 | folder.Name = (string) row["name"]; | ||
846 | folder.Owner = new UUID((string) row["agentID"]); | ||
847 | folder.ParentID = new UUID((string) row["parentID"]); | ||
848 | folder.Type = Convert.ToInt16(row["type"]); | ||
849 | folder.Version = Convert.ToUInt16(row["version"]); | ||
850 | return folder; | ||
851 | } | ||
852 | |||
853 | /// <summary> | ||
854 | /// | ||
855 | /// </summary> | ||
856 | /// <param name="row"></param> | ||
857 | /// <param name="folder"></param> | ||
858 | private static void fillFolderRow(DataRow row, InventoryFolderBase folder) | ||
859 | { | ||
860 | row["UUID"] = folder.ID.ToString(); | ||
861 | row["name"] = folder.Name; | ||
862 | row["agentID"] = folder.Owner.ToString(); | ||
863 | row["parentID"] = folder.ParentID.ToString(); | ||
864 | row["type"] = folder.Type; | ||
865 | row["version"] = folder.Version; | ||
866 | } | ||
867 | |||
868 | /// <summary> | ||
869 | /// | ||
870 | /// </summary> | ||
871 | /// <param name="row"></param> | ||
872 | /// <param name="folder"></param> | ||
873 | private static void moveFolderRow(DataRow row, InventoryFolderBase folder) | ||
874 | { | ||
875 | row["UUID"] = folder.ID.ToString(); | ||
876 | row["parentID"] = folder.ParentID.ToString(); | ||
877 | } | ||
878 | |||
879 | public List<InventoryItemBase> fetchActiveGestures (UUID avatarID) | ||
880 | { | ||
881 | lock (ds) | ||
882 | { | ||
883 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
884 | |||
885 | DataTable inventoryItemTable = ds.Tables["inventoryitems"]; | ||
886 | string selectExp | ||
887 | = "avatarID = '" + avatarID + "' AND assetType = " + (int)AssetType.Gesture + " AND flags = 1"; | ||
888 | //m_log.DebugFormat("[SQL]: sql = " + selectExp); | ||
889 | DataRow[] rows = inventoryItemTable.Select(selectExp); | ||
890 | foreach (DataRow row in rows) | ||
891 | { | ||
892 | items.Add(buildItem(row)); | ||
893 | } | ||
894 | return items; | ||
895 | } | ||
896 | } | ||
897 | } | ||
898 | } | ||
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs deleted file mode 100644 index 644864a..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs +++ /dev/null | |||
@@ -1,2274 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Drawing; | ||
32 | using System.IO; | ||
33 | using System.Reflection; | ||
34 | using log4net; | ||
35 | using Mono.Data.SqliteClient; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | |||
41 | namespace OpenSim.Data.SQLiteLegacy | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// A RegionData Interface to the SQLite database | ||
45 | /// </summary> | ||
46 | public class SQLiteSimulationData : ISimulationDataStore | ||
47 | { | ||
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private const string primSelect = "select * from prims"; | ||
51 | private const string shapeSelect = "select * from primshapes"; | ||
52 | private const string itemsSelect = "select * from primitems"; | ||
53 | private const string terrainSelect = "select * from terrain limit 1"; | ||
54 | private const string landSelect = "select * from land"; | ||
55 | private const string landAccessListSelect = "select distinct * from landaccesslist"; | ||
56 | private const string regionbanListSelect = "select * from regionban"; | ||
57 | private const string regionSettingsSelect = "select * from regionsettings"; | ||
58 | |||
59 | private DataSet ds; | ||
60 | private SqliteDataAdapter primDa; | ||
61 | private SqliteDataAdapter shapeDa; | ||
62 | private SqliteDataAdapter itemsDa; | ||
63 | private SqliteDataAdapter terrainDa; | ||
64 | private SqliteDataAdapter landDa; | ||
65 | private SqliteDataAdapter landAccessListDa; | ||
66 | private SqliteDataAdapter regionSettingsDa; | ||
67 | |||
68 | private SqliteConnection m_conn; | ||
69 | |||
70 | private String m_connectionString; | ||
71 | |||
72 | public SQLiteSimulationData() | ||
73 | { | ||
74 | } | ||
75 | |||
76 | public SQLiteSimulationData(string connectionString) | ||
77 | { | ||
78 | Initialise(connectionString); | ||
79 | } | ||
80 | |||
81 | // Temporary attribute while this is experimental | ||
82 | |||
83 | /*********************************************************************** | ||
84 | * | ||
85 | * Public Interface Functions | ||
86 | * | ||
87 | **********************************************************************/ | ||
88 | |||
89 | /// <summary> | ||
90 | /// <list type="bullet"> | ||
91 | /// <item>Initialises RegionData Interface</item> | ||
92 | /// <item>Loads and initialises a new SQLite connection and maintains it.</item> | ||
93 | /// </list> | ||
94 | /// </summary> | ||
95 | /// <param name="connectionString">the connection string</param> | ||
96 | public void Initialise(string connectionString) | ||
97 | { | ||
98 | m_connectionString = connectionString; | ||
99 | |||
100 | ds = new DataSet(); | ||
101 | |||
102 | m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString); | ||
103 | m_conn = new SqliteConnection(m_connectionString); | ||
104 | m_conn.Open(); | ||
105 | |||
106 | |||
107 | |||
108 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn); | ||
109 | primDa = new SqliteDataAdapter(primSelectCmd); | ||
110 | // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa); | ||
111 | |||
112 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); | ||
113 | shapeDa = new SqliteDataAdapter(shapeSelectCmd); | ||
114 | // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); | ||
115 | |||
116 | SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); | ||
117 | itemsDa = new SqliteDataAdapter(itemsSelectCmd); | ||
118 | |||
119 | SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); | ||
120 | terrainDa = new SqliteDataAdapter(terrainSelectCmd); | ||
121 | |||
122 | SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); | ||
123 | landDa = new SqliteDataAdapter(landSelectCmd); | ||
124 | |||
125 | SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); | ||
126 | landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); | ||
127 | |||
128 | SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); | ||
129 | regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); | ||
130 | // This actually does the roll forward assembly stuff | ||
131 | Assembly assem = GetType().Assembly; | ||
132 | Migration m = new Migration(m_conn, assem, "RegionStore"); | ||
133 | m.Update(); | ||
134 | |||
135 | lock (ds) | ||
136 | { | ||
137 | ds.Tables.Add(createPrimTable()); | ||
138 | setupPrimCommands(primDa, m_conn); | ||
139 | primDa.Fill(ds.Tables["prims"]); | ||
140 | |||
141 | ds.Tables.Add(createShapeTable()); | ||
142 | setupShapeCommands(shapeDa, m_conn); | ||
143 | |||
144 | ds.Tables.Add(createItemsTable()); | ||
145 | setupItemsCommands(itemsDa, m_conn); | ||
146 | itemsDa.Fill(ds.Tables["primitems"]); | ||
147 | |||
148 | ds.Tables.Add(createTerrainTable()); | ||
149 | setupTerrainCommands(terrainDa, m_conn); | ||
150 | |||
151 | ds.Tables.Add(createLandTable()); | ||
152 | setupLandCommands(landDa, m_conn); | ||
153 | |||
154 | ds.Tables.Add(createLandAccessListTable()); | ||
155 | setupLandAccessCommands(landAccessListDa, m_conn); | ||
156 | |||
157 | ds.Tables.Add(createRegionSettingsTable()); | ||
158 | |||
159 | setupRegionSettingsCommands(regionSettingsDa, m_conn); | ||
160 | |||
161 | // WORKAROUND: This is a work around for sqlite on | ||
162 | // windows, which gets really unhappy with blob columns | ||
163 | // that have no sample data in them. At some point we | ||
164 | // need to actually find a proper way to handle this. | ||
165 | try | ||
166 | { | ||
167 | shapeDa.Fill(ds.Tables["primshapes"]); | ||
168 | } | ||
169 | catch (Exception) | ||
170 | { | ||
171 | m_log.Info("[REGION DB]: Caught fill error on primshapes table"); | ||
172 | } | ||
173 | |||
174 | try | ||
175 | { | ||
176 | terrainDa.Fill(ds.Tables["terrain"]); | ||
177 | } | ||
178 | catch (Exception) | ||
179 | { | ||
180 | m_log.Info("[REGION DB]: Caught fill error on terrain table"); | ||
181 | } | ||
182 | |||
183 | try | ||
184 | { | ||
185 | landDa.Fill(ds.Tables["land"]); | ||
186 | } | ||
187 | catch (Exception) | ||
188 | { | ||
189 | m_log.Info("[REGION DB]: Caught fill error on land table"); | ||
190 | } | ||
191 | |||
192 | try | ||
193 | { | ||
194 | landAccessListDa.Fill(ds.Tables["landaccesslist"]); | ||
195 | } | ||
196 | catch (Exception) | ||
197 | { | ||
198 | m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); | ||
199 | } | ||
200 | |||
201 | try | ||
202 | { | ||
203 | regionSettingsDa.Fill(ds.Tables["regionsettings"]); | ||
204 | } | ||
205 | catch (Exception) | ||
206 | { | ||
207 | m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); | ||
208 | } | ||
209 | return; | ||
210 | } | ||
211 | } | ||
212 | |||
213 | public void Dispose() | ||
214 | { | ||
215 | if (m_conn != null) | ||
216 | { | ||
217 | m_conn.Close(); | ||
218 | m_conn = null; | ||
219 | } | ||
220 | if (ds != null) | ||
221 | { | ||
222 | ds.Dispose(); | ||
223 | ds = null; | ||
224 | } | ||
225 | if (primDa != null) | ||
226 | { | ||
227 | primDa.Dispose(); | ||
228 | primDa = null; | ||
229 | } | ||
230 | if (shapeDa != null) | ||
231 | { | ||
232 | shapeDa.Dispose(); | ||
233 | shapeDa = null; | ||
234 | } | ||
235 | if (itemsDa != null) | ||
236 | { | ||
237 | itemsDa.Dispose(); | ||
238 | itemsDa = null; | ||
239 | } | ||
240 | if (terrainDa != null) | ||
241 | { | ||
242 | terrainDa.Dispose(); | ||
243 | terrainDa = null; | ||
244 | } | ||
245 | if (landDa != null) | ||
246 | { | ||
247 | landDa.Dispose(); | ||
248 | landDa = null; | ||
249 | } | ||
250 | if (landAccessListDa != null) | ||
251 | { | ||
252 | landAccessListDa.Dispose(); | ||
253 | landAccessListDa = null; | ||
254 | } | ||
255 | if (regionSettingsDa != null) | ||
256 | { | ||
257 | regionSettingsDa.Dispose(); | ||
258 | regionSettingsDa = null; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | public void StoreRegionSettings(RegionSettings rs) | ||
263 | { | ||
264 | lock (ds) | ||
265 | { | ||
266 | DataTable regionsettings = ds.Tables["regionsettings"]; | ||
267 | |||
268 | DataRow settingsRow = regionsettings.Rows.Find(rs.RegionUUID.ToString()); | ||
269 | if (settingsRow == null) | ||
270 | { | ||
271 | settingsRow = regionsettings.NewRow(); | ||
272 | fillRegionSettingsRow(settingsRow, rs); | ||
273 | regionsettings.Rows.Add(settingsRow); | ||
274 | } | ||
275 | else | ||
276 | { | ||
277 | fillRegionSettingsRow(settingsRow, rs); | ||
278 | } | ||
279 | |||
280 | Commit(); | ||
281 | } | ||
282 | } | ||
283 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | ||
284 | { | ||
285 | //This connector doesn't support the windlight module yet | ||
286 | //Return default LL windlight settings | ||
287 | return new RegionLightShareData(); | ||
288 | } | ||
289 | public void RemoveRegionWindlightSettings(UUID regionID) | ||
290 | { | ||
291 | } | ||
292 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | ||
293 | { | ||
294 | //This connector doesn't support the windlight module yet | ||
295 | } | ||
296 | public RegionSettings LoadRegionSettings(UUID regionUUID) | ||
297 | { | ||
298 | lock (ds) | ||
299 | { | ||
300 | DataTable regionsettings = ds.Tables["regionsettings"]; | ||
301 | |||
302 | string searchExp = "regionUUID = '" + regionUUID.ToString() + "'"; | ||
303 | DataRow[] rawsettings = regionsettings.Select(searchExp); | ||
304 | if (rawsettings.Length == 0) | ||
305 | { | ||
306 | RegionSettings rs = new RegionSettings(); | ||
307 | rs.RegionUUID = regionUUID; | ||
308 | rs.OnSave += StoreRegionSettings; | ||
309 | |||
310 | StoreRegionSettings(rs); | ||
311 | |||
312 | return rs; | ||
313 | } | ||
314 | DataRow row = rawsettings[0]; | ||
315 | |||
316 | RegionSettings newSettings = buildRegionSettings(row); | ||
317 | newSettings.OnSave += StoreRegionSettings; | ||
318 | |||
319 | return newSettings; | ||
320 | } | ||
321 | } | ||
322 | |||
323 | /// <summary> | ||
324 | /// Adds an object into region storage | ||
325 | /// </summary> | ||
326 | /// <param name="obj">the object</param> | ||
327 | /// <param name="regionUUID">the region UUID</param> | ||
328 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | ||
329 | { | ||
330 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); | ||
331 | |||
332 | // Eligibility check | ||
333 | // | ||
334 | if ((flags & (uint)PrimFlags.Temporary) != 0) | ||
335 | return; | ||
336 | if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) | ||
337 | return; | ||
338 | |||
339 | lock (ds) | ||
340 | { | ||
341 | foreach (SceneObjectPart prim in obj.Parts) | ||
342 | { | ||
343 | // m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); | ||
344 | addPrim(prim, obj.UUID, regionUUID); | ||
345 | } | ||
346 | } | ||
347 | |||
348 | Commit(); | ||
349 | // m_log.Info("[Dump of prims]: " + ds.GetXml()); | ||
350 | } | ||
351 | |||
352 | /// <summary> | ||
353 | /// Removes an object from region storage | ||
354 | /// </summary> | ||
355 | /// <param name="obj">the object</param> | ||
356 | /// <param name="regionUUID">the region UUID</param> | ||
357 | public void RemoveObject(UUID obj, UUID regionUUID) | ||
358 | { | ||
359 | // m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID); | ||
360 | |||
361 | DataTable prims = ds.Tables["prims"]; | ||
362 | DataTable shapes = ds.Tables["primshapes"]; | ||
363 | |||
364 | string selectExp = "SceneGroupID = '" + obj + "' and RegionUUID = '" + regionUUID + "'"; | ||
365 | lock (ds) | ||
366 | { | ||
367 | DataRow[] primRows = prims.Select(selectExp); | ||
368 | foreach (DataRow row in primRows) | ||
369 | { | ||
370 | // Remove shape rows | ||
371 | UUID uuid = new UUID((string) row["UUID"]); | ||
372 | DataRow shapeRow = shapes.Rows.Find(uuid.ToString()); | ||
373 | if (shapeRow != null) | ||
374 | { | ||
375 | shapeRow.Delete(); | ||
376 | } | ||
377 | |||
378 | RemoveItems(uuid); | ||
379 | |||
380 | // Remove prim row | ||
381 | row.Delete(); | ||
382 | } | ||
383 | } | ||
384 | |||
385 | Commit(); | ||
386 | } | ||
387 | |||
388 | /// <summary> | ||
389 | /// Remove all persisted items of the given prim. | ||
390 | /// The caller must acquire the necessrary synchronization locks and commit or rollback changes. | ||
391 | /// </summary> | ||
392 | /// <param name="uuid">The item UUID</param> | ||
393 | private void RemoveItems(UUID uuid) | ||
394 | { | ||
395 | DataTable items = ds.Tables["primitems"]; | ||
396 | |||
397 | String sql = String.Format("primID = '{0}'", uuid); | ||
398 | DataRow[] itemRows = items.Select(sql); | ||
399 | |||
400 | foreach (DataRow itemRow in itemRows) | ||
401 | { | ||
402 | itemRow.Delete(); | ||
403 | } | ||
404 | } | ||
405 | |||
406 | /// <summary> | ||
407 | /// Load persisted objects from region storage. | ||
408 | /// </summary> | ||
409 | /// <param name="regionUUID">The region UUID</param> | ||
410 | /// <returns>List of loaded groups</returns> | ||
411 | public List<SceneObjectGroup> LoadObjects(UUID regionUUID) | ||
412 | { | ||
413 | Dictionary<UUID, SceneObjectGroup> createdObjects = new Dictionary<UUID, SceneObjectGroup>(); | ||
414 | |||
415 | List<SceneObjectGroup> retvals = new List<SceneObjectGroup>(); | ||
416 | |||
417 | DataTable prims = ds.Tables["prims"]; | ||
418 | DataTable shapes = ds.Tables["primshapes"]; | ||
419 | |||
420 | string byRegion = "RegionUUID = '" + regionUUID + "'"; | ||
421 | |||
422 | lock (ds) | ||
423 | { | ||
424 | DataRow[] primsForRegion = prims.Select(byRegion); | ||
425 | m_log.Info("[REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); | ||
426 | |||
427 | // First, create all groups | ||
428 | foreach (DataRow primRow in primsForRegion) | ||
429 | { | ||
430 | try | ||
431 | { | ||
432 | SceneObjectPart prim = null; | ||
433 | |||
434 | string uuid = (string) primRow["UUID"]; | ||
435 | string objID = (string) primRow["SceneGroupID"]; | ||
436 | |||
437 | if (uuid == objID) //is new SceneObjectGroup ? | ||
438 | { | ||
439 | prim = buildPrim(primRow); | ||
440 | DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); | ||
441 | if (shapeRow != null) | ||
442 | { | ||
443 | prim.Shape = buildShape(shapeRow); | ||
444 | } | ||
445 | else | ||
446 | { | ||
447 | m_log.Info( | ||
448 | "[REGION DB]: No shape found for prim in storage, so setting default box shape"); | ||
449 | prim.Shape = PrimitiveBaseShape.Default; | ||
450 | } | ||
451 | |||
452 | SceneObjectGroup group = new SceneObjectGroup(prim); | ||
453 | createdObjects.Add(group.UUID, group); | ||
454 | retvals.Add(group); | ||
455 | LoadItems(prim); | ||
456 | } | ||
457 | } | ||
458 | catch (Exception e) | ||
459 | { | ||
460 | m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows"); | ||
461 | m_log.Info("[REGION DB]: " + e.ToString()); | ||
462 | foreach (DataColumn col in prims.Columns) | ||
463 | { | ||
464 | m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); | ||
465 | } | ||
466 | } | ||
467 | } | ||
468 | |||
469 | // Now fill the groups with part data | ||
470 | foreach (DataRow primRow in primsForRegion) | ||
471 | { | ||
472 | try | ||
473 | { | ||
474 | SceneObjectPart prim = null; | ||
475 | |||
476 | string uuid = (string) primRow["UUID"]; | ||
477 | string objID = (string) primRow["SceneGroupID"]; | ||
478 | if (uuid != objID) //is new SceneObjectGroup ? | ||
479 | { | ||
480 | prim = buildPrim(primRow); | ||
481 | DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); | ||
482 | if (shapeRow != null) | ||
483 | { | ||
484 | prim.Shape = buildShape(shapeRow); | ||
485 | } | ||
486 | else | ||
487 | { | ||
488 | m_log.Warn( | ||
489 | "[REGION DB]: No shape found for prim in storage, so setting default box shape"); | ||
490 | prim.Shape = PrimitiveBaseShape.Default; | ||
491 | } | ||
492 | |||
493 | createdObjects[new UUID(objID)].AddPart(prim); | ||
494 | LoadItems(prim); | ||
495 | } | ||
496 | } | ||
497 | catch (Exception e) | ||
498 | { | ||
499 | m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows"); | ||
500 | m_log.Info("[REGION DB]: " + e.ToString()); | ||
501 | foreach (DataColumn col in prims.Columns) | ||
502 | { | ||
503 | m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); | ||
504 | } | ||
505 | } | ||
506 | } | ||
507 | } | ||
508 | return retvals; | ||
509 | } | ||
510 | |||
511 | /// <summary> | ||
512 | /// Load in a prim's persisted inventory. | ||
513 | /// </summary> | ||
514 | /// <param name="prim">the prim</param> | ||
515 | private void LoadItems(SceneObjectPart prim) | ||
516 | { | ||
517 | //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); | ||
518 | |||
519 | DataTable dbItems = ds.Tables["primitems"]; | ||
520 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); | ||
521 | DataRow[] dbItemRows = dbItems.Select(sql); | ||
522 | IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); | ||
523 | |||
524 | foreach (DataRow row in dbItemRows) | ||
525 | { | ||
526 | TaskInventoryItem item = buildItem(row); | ||
527 | inventory.Add(item); | ||
528 | |||
529 | //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); | ||
530 | } | ||
531 | |||
532 | prim.Inventory.RestoreInventoryItems(inventory); | ||
533 | } | ||
534 | |||
535 | /// <summary> | ||
536 | /// Store a terrain revision in region storage | ||
537 | /// </summary> | ||
538 | /// <param name="ter">terrain heightfield</param> | ||
539 | /// <param name="regionID">region UUID</param> | ||
540 | public void StoreTerrain(double[,] ter, UUID regionID) | ||
541 | { | ||
542 | lock (ds) | ||
543 | { | ||
544 | int revision = Util.UnixTimeSinceEpoch(); | ||
545 | |||
546 | // This is added to get rid of the infinitely growing | ||
547 | // terrain databases which negatively impact on SQLite | ||
548 | // over time. Before reenabling this feature there | ||
549 | // needs to be a limitter put on the number of | ||
550 | // revisions in the database, as this old | ||
551 | // implementation is a DOS attack waiting to happen. | ||
552 | |||
553 | using ( | ||
554 | SqliteCommand cmd = | ||
555 | new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision <= :Revision", | ||
556 | m_conn)) | ||
557 | { | ||
558 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); | ||
559 | cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); | ||
560 | cmd.ExecuteNonQuery(); | ||
561 | } | ||
562 | |||
563 | // the following is an work around for .NET. The perf | ||
564 | // issues associated with it aren't as bad as you think. | ||
565 | m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString()); | ||
566 | String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + | ||
567 | " values(:RegionUUID, :Revision, :Heightfield)"; | ||
568 | |||
569 | using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) | ||
570 | { | ||
571 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); | ||
572 | cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); | ||
573 | cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter))); | ||
574 | cmd.ExecuteNonQuery(); | ||
575 | } | ||
576 | } | ||
577 | } | ||
578 | |||
579 | /// <summary> | ||
580 | /// Load the latest terrain revision from region storage | ||
581 | /// </summary> | ||
582 | /// <param name="regionID">the region UUID</param> | ||
583 | /// <returns>Heightfield data</returns> | ||
584 | public double[,] LoadTerrain(UUID regionID) | ||
585 | { | ||
586 | lock (ds) | ||
587 | { | ||
588 | double[,] terret = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; | ||
589 | terret.Initialize(); | ||
590 | |||
591 | String sql = "select RegionUUID, Revision, Heightfield from terrain" + | ||
592 | " where RegionUUID=:RegionUUID order by Revision desc"; | ||
593 | |||
594 | using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) | ||
595 | { | ||
596 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); | ||
597 | |||
598 | using (IDataReader row = cmd.ExecuteReader()) | ||
599 | { | ||
600 | int rev = 0; | ||
601 | if (row.Read()) | ||
602 | { | ||
603 | // TODO: put this into a function | ||
604 | using (MemoryStream str = new MemoryStream((byte[])row["Heightfield"])) | ||
605 | { | ||
606 | using (BinaryReader br = new BinaryReader(str)) | ||
607 | { | ||
608 | for (int x = 0; x < (int)Constants.RegionSize; x++) | ||
609 | { | ||
610 | for (int y = 0; y < (int)Constants.RegionSize; y++) | ||
611 | { | ||
612 | terret[x, y] = br.ReadDouble(); | ||
613 | } | ||
614 | } | ||
615 | } | ||
616 | } | ||
617 | rev = (int) row["Revision"]; | ||
618 | } | ||
619 | else | ||
620 | { | ||
621 | m_log.Info("[REGION DB]: No terrain found for region"); | ||
622 | return null; | ||
623 | } | ||
624 | |||
625 | m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString()); | ||
626 | } | ||
627 | } | ||
628 | return terret; | ||
629 | } | ||
630 | } | ||
631 | |||
632 | /// <summary> | ||
633 | /// | ||
634 | /// </summary> | ||
635 | /// <param name="globalID"></param> | ||
636 | public void RemoveLandObject(UUID globalID) | ||
637 | { | ||
638 | lock (ds) | ||
639 | { | ||
640 | // Can't use blanket SQL statements when using SqlAdapters unless you re-read the data into the adapter | ||
641 | // after you're done. | ||
642 | // replaced below code with the SqliteAdapter version. | ||
643 | //using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", m_conn)) | ||
644 | //{ | ||
645 | // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); | ||
646 | // cmd.ExecuteNonQuery(); | ||
647 | //} | ||
648 | |||
649 | //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", m_conn)) | ||
650 | //{ | ||
651 | // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); | ||
652 | // cmd.ExecuteNonQuery(); | ||
653 | //} | ||
654 | |||
655 | DataTable land = ds.Tables["land"]; | ||
656 | DataTable landaccesslist = ds.Tables["landaccesslist"]; | ||
657 | DataRow landRow = land.Rows.Find(globalID.ToString()); | ||
658 | if (landRow != null) | ||
659 | { | ||
660 | landRow.Delete(); | ||
661 | land.Rows.Remove(landRow); | ||
662 | } | ||
663 | List<DataRow> rowsToDelete = new List<DataRow>(); | ||
664 | foreach (DataRow rowToCheck in landaccesslist.Rows) | ||
665 | { | ||
666 | if (rowToCheck["LandUUID"].ToString() == globalID.ToString()) | ||
667 | rowsToDelete.Add(rowToCheck); | ||
668 | } | ||
669 | for (int iter = 0; iter < rowsToDelete.Count; iter++) | ||
670 | { | ||
671 | rowsToDelete[iter].Delete(); | ||
672 | landaccesslist.Rows.Remove(rowsToDelete[iter]); | ||
673 | } | ||
674 | |||
675 | |||
676 | } | ||
677 | Commit(); | ||
678 | } | ||
679 | |||
680 | /// <summary> | ||
681 | /// | ||
682 | /// </summary> | ||
683 | /// <param name="parcel"></param> | ||
684 | public void StoreLandObject(ILandObject parcel) | ||
685 | { | ||
686 | lock (ds) | ||
687 | { | ||
688 | DataTable land = ds.Tables["land"]; | ||
689 | DataTable landaccesslist = ds.Tables["landaccesslist"]; | ||
690 | |||
691 | DataRow landRow = land.Rows.Find(parcel.LandData.GlobalID.ToString()); | ||
692 | if (landRow == null) | ||
693 | { | ||
694 | landRow = land.NewRow(); | ||
695 | fillLandRow(landRow, parcel.LandData, parcel.RegionUUID); | ||
696 | land.Rows.Add(landRow); | ||
697 | } | ||
698 | else | ||
699 | { | ||
700 | fillLandRow(landRow, parcel.LandData, parcel.RegionUUID); | ||
701 | } | ||
702 | |||
703 | // I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around | ||
704 | //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", m_conn)) | ||
705 | //{ | ||
706 | // cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString())); | ||
707 | // cmd.ExecuteNonQuery(); | ||
708 | |||
709 | // } | ||
710 | |||
711 | // This is the slower.. but more appropriate thing to do | ||
712 | |||
713 | // We can't modify the table with direct queries before calling Commit() and re-filling them. | ||
714 | List<DataRow> rowsToDelete = new List<DataRow>(); | ||
715 | foreach (DataRow rowToCheck in landaccesslist.Rows) | ||
716 | { | ||
717 | if (rowToCheck["LandUUID"].ToString() == parcel.LandData.GlobalID.ToString()) | ||
718 | rowsToDelete.Add(rowToCheck); | ||
719 | } | ||
720 | for (int iter = 0; iter < rowsToDelete.Count; iter++) | ||
721 | { | ||
722 | rowsToDelete[iter].Delete(); | ||
723 | landaccesslist.Rows.Remove(rowsToDelete[iter]); | ||
724 | } | ||
725 | rowsToDelete.Clear(); | ||
726 | foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList) | ||
727 | { | ||
728 | DataRow newAccessRow = landaccesslist.NewRow(); | ||
729 | fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID); | ||
730 | landaccesslist.Rows.Add(newAccessRow); | ||
731 | } | ||
732 | } | ||
733 | |||
734 | Commit(); | ||
735 | } | ||
736 | |||
737 | /// <summary> | ||
738 | /// | ||
739 | /// </summary> | ||
740 | /// <param name="regionUUID"></param> | ||
741 | /// <returns></returns> | ||
742 | public List<LandData> LoadLandObjects(UUID regionUUID) | ||
743 | { | ||
744 | List<LandData> landDataForRegion = new List<LandData>(); | ||
745 | lock (ds) | ||
746 | { | ||
747 | DataTable land = ds.Tables["land"]; | ||
748 | DataTable landaccesslist = ds.Tables["landaccesslist"]; | ||
749 | string searchExp = "RegionUUID = '" + regionUUID + "'"; | ||
750 | DataRow[] rawDataForRegion = land.Select(searchExp); | ||
751 | foreach (DataRow rawDataLand in rawDataForRegion) | ||
752 | { | ||
753 | LandData newLand = buildLandData(rawDataLand); | ||
754 | string accessListSearchExp = "LandUUID = '" + newLand.GlobalID + "'"; | ||
755 | DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp); | ||
756 | foreach (DataRow rawDataLandAccess in rawDataForLandAccessList) | ||
757 | { | ||
758 | newLand.ParcelAccessList.Add(buildLandAccessData(rawDataLandAccess)); | ||
759 | } | ||
760 | |||
761 | landDataForRegion.Add(newLand); | ||
762 | } | ||
763 | } | ||
764 | return landDataForRegion; | ||
765 | } | ||
766 | |||
767 | /// <summary> | ||
768 | /// | ||
769 | /// </summary> | ||
770 | public void Commit() | ||
771 | { | ||
772 | lock (ds) | ||
773 | { | ||
774 | primDa.Update(ds, "prims"); | ||
775 | shapeDa.Update(ds, "primshapes"); | ||
776 | |||
777 | itemsDa.Update(ds, "primitems"); | ||
778 | |||
779 | terrainDa.Update(ds, "terrain"); | ||
780 | landDa.Update(ds, "land"); | ||
781 | landAccessListDa.Update(ds, "landaccesslist"); | ||
782 | try | ||
783 | { | ||
784 | regionSettingsDa.Update(ds, "regionsettings"); | ||
785 | } | ||
786 | catch (SqliteExecutionException SqlEx) | ||
787 | { | ||
788 | if (SqlEx.Message.Contains("logic error")) | ||
789 | { | ||
790 | throw new Exception( | ||
791 | "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!", | ||
792 | SqlEx); | ||
793 | } | ||
794 | else | ||
795 | { | ||
796 | throw SqlEx; | ||
797 | } | ||
798 | } | ||
799 | ds.AcceptChanges(); | ||
800 | } | ||
801 | } | ||
802 | |||
803 | /// <summary> | ||
804 | /// See <see cref="Commit"/> | ||
805 | /// </summary> | ||
806 | public void Shutdown() | ||
807 | { | ||
808 | Commit(); | ||
809 | } | ||
810 | |||
811 | /*********************************************************************** | ||
812 | * | ||
813 | * Database Definition Functions | ||
814 | * | ||
815 | * This should be db agnostic as we define them in ADO.NET terms | ||
816 | * | ||
817 | **********************************************************************/ | ||
818 | |||
819 | /// <summary> | ||
820 | /// | ||
821 | /// </summary> | ||
822 | /// <param name="dt"></param> | ||
823 | /// <param name="name"></param> | ||
824 | /// <param name="type"></param> | ||
825 | private static void createCol(DataTable dt, string name, Type type) | ||
826 | { | ||
827 | DataColumn col = new DataColumn(name, type); | ||
828 | dt.Columns.Add(col); | ||
829 | } | ||
830 | |||
831 | /// <summary> | ||
832 | /// Creates the "terrain" table | ||
833 | /// </summary> | ||
834 | /// <returns>terrain table DataTable</returns> | ||
835 | private static DataTable createTerrainTable() | ||
836 | { | ||
837 | DataTable terrain = new DataTable("terrain"); | ||
838 | |||
839 | createCol(terrain, "RegionUUID", typeof (String)); | ||
840 | createCol(terrain, "Revision", typeof (Int32)); | ||
841 | createCol(terrain, "Heightfield", typeof (Byte[])); | ||
842 | |||
843 | return terrain; | ||
844 | } | ||
845 | |||
846 | /// <summary> | ||
847 | /// Creates the "prims" table | ||
848 | /// </summary> | ||
849 | /// <returns>prim table DataTable</returns> | ||
850 | private static DataTable createPrimTable() | ||
851 | { | ||
852 | DataTable prims = new DataTable("prims"); | ||
853 | |||
854 | createCol(prims, "UUID", typeof (String)); | ||
855 | createCol(prims, "RegionUUID", typeof (String)); | ||
856 | createCol(prims, "CreationDate", typeof (Int32)); | ||
857 | createCol(prims, "Name", typeof (String)); | ||
858 | createCol(prims, "SceneGroupID", typeof (String)); | ||
859 | // various text fields | ||
860 | createCol(prims, "Text", typeof (String)); | ||
861 | createCol(prims, "ColorR", typeof (Int32)); | ||
862 | createCol(prims, "ColorG", typeof (Int32)); | ||
863 | createCol(prims, "ColorB", typeof (Int32)); | ||
864 | createCol(prims, "ColorA", typeof (Int32)); | ||
865 | createCol(prims, "Description", typeof (String)); | ||
866 | createCol(prims, "SitName", typeof (String)); | ||
867 | createCol(prims, "TouchName", typeof (String)); | ||
868 | // permissions | ||
869 | createCol(prims, "ObjectFlags", typeof (Int32)); | ||
870 | createCol(prims, "CreatorID", typeof (String)); | ||
871 | createCol(prims, "OwnerID", typeof (String)); | ||
872 | createCol(prims, "GroupID", typeof (String)); | ||
873 | createCol(prims, "LastOwnerID", typeof (String)); | ||
874 | createCol(prims, "OwnerMask", typeof (Int32)); | ||
875 | createCol(prims, "NextOwnerMask", typeof (Int32)); | ||
876 | createCol(prims, "GroupMask", typeof (Int32)); | ||
877 | createCol(prims, "EveryoneMask", typeof (Int32)); | ||
878 | createCol(prims, "BaseMask", typeof (Int32)); | ||
879 | // vectors | ||
880 | createCol(prims, "PositionX", typeof (Double)); | ||
881 | createCol(prims, "PositionY", typeof (Double)); | ||
882 | createCol(prims, "PositionZ", typeof (Double)); | ||
883 | createCol(prims, "GroupPositionX", typeof (Double)); | ||
884 | createCol(prims, "GroupPositionY", typeof (Double)); | ||
885 | createCol(prims, "GroupPositionZ", typeof (Double)); | ||
886 | createCol(prims, "VelocityX", typeof (Double)); | ||
887 | createCol(prims, "VelocityY", typeof (Double)); | ||
888 | createCol(prims, "VelocityZ", typeof (Double)); | ||
889 | createCol(prims, "AngularVelocityX", typeof (Double)); | ||
890 | createCol(prims, "AngularVelocityY", typeof (Double)); | ||
891 | createCol(prims, "AngularVelocityZ", typeof (Double)); | ||
892 | createCol(prims, "AccelerationX", typeof (Double)); | ||
893 | createCol(prims, "AccelerationY", typeof (Double)); | ||
894 | createCol(prims, "AccelerationZ", typeof (Double)); | ||
895 | // quaternions | ||
896 | createCol(prims, "RotationX", typeof (Double)); | ||
897 | createCol(prims, "RotationY", typeof (Double)); | ||
898 | createCol(prims, "RotationZ", typeof (Double)); | ||
899 | createCol(prims, "RotationW", typeof (Double)); | ||
900 | |||
901 | // sit target | ||
902 | createCol(prims, "SitTargetOffsetX", typeof (Double)); | ||
903 | createCol(prims, "SitTargetOffsetY", typeof (Double)); | ||
904 | createCol(prims, "SitTargetOffsetZ", typeof (Double)); | ||
905 | |||
906 | createCol(prims, "SitTargetOrientW", typeof (Double)); | ||
907 | createCol(prims, "SitTargetOrientX", typeof (Double)); | ||
908 | createCol(prims, "SitTargetOrientY", typeof (Double)); | ||
909 | createCol(prims, "SitTargetOrientZ", typeof (Double)); | ||
910 | |||
911 | createCol(prims, "PayPrice", typeof(Int32)); | ||
912 | createCol(prims, "PayButton1", typeof(Int32)); | ||
913 | createCol(prims, "PayButton2", typeof(Int32)); | ||
914 | createCol(prims, "PayButton3", typeof(Int32)); | ||
915 | createCol(prims, "PayButton4", typeof(Int32)); | ||
916 | |||
917 | createCol(prims, "LoopedSound", typeof(String)); | ||
918 | createCol(prims, "LoopedSoundGain", typeof(Double)); | ||
919 | createCol(prims, "TextureAnimation", typeof(String)); | ||
920 | createCol(prims, "ParticleSystem", typeof(String)); | ||
921 | |||
922 | createCol(prims, "OmegaX", typeof(Double)); | ||
923 | createCol(prims, "OmegaY", typeof(Double)); | ||
924 | createCol(prims, "OmegaZ", typeof(Double)); | ||
925 | |||
926 | createCol(prims, "CameraEyeOffsetX", typeof(Double)); | ||
927 | createCol(prims, "CameraEyeOffsetY", typeof(Double)); | ||
928 | createCol(prims, "CameraEyeOffsetZ", typeof(Double)); | ||
929 | |||
930 | createCol(prims, "CameraAtOffsetX", typeof(Double)); | ||
931 | createCol(prims, "CameraAtOffsetY", typeof(Double)); | ||
932 | createCol(prims, "CameraAtOffsetZ", typeof(Double)); | ||
933 | |||
934 | createCol(prims, "ForceMouselook", typeof(Int16)); | ||
935 | |||
936 | createCol(prims, "ScriptAccessPin", typeof(Int32)); | ||
937 | |||
938 | createCol(prims, "AllowedDrop", typeof(Int16)); | ||
939 | createCol(prims, "DieAtEdge", typeof(Int16)); | ||
940 | |||
941 | createCol(prims, "SalePrice", typeof(Int32)); | ||
942 | createCol(prims, "SaleType", typeof(Int16)); | ||
943 | |||
944 | // click action | ||
945 | createCol(prims, "ClickAction", typeof (Byte)); | ||
946 | |||
947 | createCol(prims, "Material", typeof(Byte)); | ||
948 | |||
949 | createCol(prims, "CollisionSound", typeof(String)); | ||
950 | createCol(prims, "CollisionSoundVolume", typeof(Double)); | ||
951 | |||
952 | createCol(prims, "VolumeDetect", typeof(Int16)); | ||
953 | |||
954 | // Add in contraints | ||
955 | prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; | ||
956 | |||
957 | return prims; | ||
958 | } | ||
959 | |||
960 | /// <summary> | ||
961 | /// Creates "primshapes" table | ||
962 | /// </summary> | ||
963 | /// <returns>shape table DataTable</returns> | ||
964 | private static DataTable createShapeTable() | ||
965 | { | ||
966 | DataTable shapes = new DataTable("primshapes"); | ||
967 | createCol(shapes, "UUID", typeof (String)); | ||
968 | // shape is an enum | ||
969 | createCol(shapes, "Shape", typeof (Int32)); | ||
970 | // vectors | ||
971 | createCol(shapes, "ScaleX", typeof (Double)); | ||
972 | createCol(shapes, "ScaleY", typeof (Double)); | ||
973 | createCol(shapes, "ScaleZ", typeof (Double)); | ||
974 | // paths | ||
975 | createCol(shapes, "PCode", typeof (Int32)); | ||
976 | createCol(shapes, "PathBegin", typeof (Int32)); | ||
977 | createCol(shapes, "PathEnd", typeof (Int32)); | ||
978 | createCol(shapes, "PathScaleX", typeof (Int32)); | ||
979 | createCol(shapes, "PathScaleY", typeof (Int32)); | ||
980 | createCol(shapes, "PathShearX", typeof (Int32)); | ||
981 | createCol(shapes, "PathShearY", typeof (Int32)); | ||
982 | createCol(shapes, "PathSkew", typeof (Int32)); | ||
983 | createCol(shapes, "PathCurve", typeof (Int32)); | ||
984 | createCol(shapes, "PathRadiusOffset", typeof (Int32)); | ||
985 | createCol(shapes, "PathRevolutions", typeof (Int32)); | ||
986 | createCol(shapes, "PathTaperX", typeof (Int32)); | ||
987 | createCol(shapes, "PathTaperY", typeof (Int32)); | ||
988 | createCol(shapes, "PathTwist", typeof (Int32)); | ||
989 | createCol(shapes, "PathTwistBegin", typeof (Int32)); | ||
990 | // profile | ||
991 | createCol(shapes, "ProfileBegin", typeof (Int32)); | ||
992 | createCol(shapes, "ProfileEnd", typeof (Int32)); | ||
993 | createCol(shapes, "ProfileCurve", typeof (Int32)); | ||
994 | createCol(shapes, "ProfileHollow", typeof (Int32)); | ||
995 | createCol(shapes, "State", typeof(Int32)); | ||
996 | // text TODO: this isn't right, but I'm not sure the right | ||
997 | // way to specify this as a blob atm | ||
998 | createCol(shapes, "Texture", typeof (Byte[])); | ||
999 | createCol(shapes, "ExtraParams", typeof (Byte[])); | ||
1000 | |||
1001 | shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; | ||
1002 | |||
1003 | return shapes; | ||
1004 | } | ||
1005 | |||
1006 | /// <summary> | ||
1007 | /// creates "primitems" table | ||
1008 | /// </summary> | ||
1009 | /// <returns>item table DataTable</returns> | ||
1010 | private static DataTable createItemsTable() | ||
1011 | { | ||
1012 | DataTable items = new DataTable("primitems"); | ||
1013 | |||
1014 | createCol(items, "itemID", typeof (String)); | ||
1015 | createCol(items, "primID", typeof (String)); | ||
1016 | createCol(items, "assetID", typeof (String)); | ||
1017 | createCol(items, "parentFolderID", typeof (String)); | ||
1018 | |||
1019 | createCol(items, "invType", typeof (Int32)); | ||
1020 | createCol(items, "assetType", typeof (Int32)); | ||
1021 | |||
1022 | createCol(items, "name", typeof (String)); | ||
1023 | createCol(items, "description", typeof (String)); | ||
1024 | |||
1025 | createCol(items, "creationDate", typeof (Int64)); | ||
1026 | createCol(items, "creatorID", typeof (String)); | ||
1027 | createCol(items, "ownerID", typeof (String)); | ||
1028 | createCol(items, "lastOwnerID", typeof (String)); | ||
1029 | createCol(items, "groupID", typeof (String)); | ||
1030 | |||
1031 | createCol(items, "nextPermissions", typeof (UInt32)); | ||
1032 | createCol(items, "currentPermissions", typeof (UInt32)); | ||
1033 | createCol(items, "basePermissions", typeof (UInt32)); | ||
1034 | createCol(items, "everyonePermissions", typeof (UInt32)); | ||
1035 | createCol(items, "groupPermissions", typeof (UInt32)); | ||
1036 | createCol(items, "flags", typeof (UInt32)); | ||
1037 | |||
1038 | items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] }; | ||
1039 | |||
1040 | return items; | ||
1041 | } | ||
1042 | |||
1043 | /// <summary> | ||
1044 | /// Creates "land" table | ||
1045 | /// </summary> | ||
1046 | /// <returns>land table DataTable</returns> | ||
1047 | private static DataTable createLandTable() | ||
1048 | { | ||
1049 | DataTable land = new DataTable("land"); | ||
1050 | createCol(land, "UUID", typeof (String)); | ||
1051 | createCol(land, "RegionUUID", typeof (String)); | ||
1052 | createCol(land, "LocalLandID", typeof (UInt32)); | ||
1053 | |||
1054 | // Bitmap is a byte[512] | ||
1055 | createCol(land, "Bitmap", typeof (Byte[])); | ||
1056 | |||
1057 | createCol(land, "Name", typeof (String)); | ||
1058 | createCol(land, "Desc", typeof (String)); | ||
1059 | createCol(land, "OwnerUUID", typeof (String)); | ||
1060 | createCol(land, "IsGroupOwned", typeof (Boolean)); | ||
1061 | createCol(land, "Area", typeof (Int32)); | ||
1062 | createCol(land, "AuctionID", typeof (Int32)); //Unemplemented | ||
1063 | createCol(land, "Category", typeof (Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory | ||
1064 | createCol(land, "ClaimDate", typeof (Int32)); | ||
1065 | createCol(land, "ClaimPrice", typeof (Int32)); | ||
1066 | createCol(land, "GroupUUID", typeof (string)); | ||
1067 | createCol(land, "SalePrice", typeof (Int32)); | ||
1068 | createCol(land, "LandStatus", typeof (Int32)); //Enum. OpenMetaverse.Parcel.ParcelStatus | ||
1069 | createCol(land, "LandFlags", typeof (UInt32)); | ||
1070 | createCol(land, "LandingType", typeof (Byte)); | ||
1071 | createCol(land, "MediaAutoScale", typeof (Byte)); | ||
1072 | createCol(land, "MediaTextureUUID", typeof (String)); | ||
1073 | createCol(land, "MediaURL", typeof (String)); | ||
1074 | createCol(land, "MusicURL", typeof (String)); | ||
1075 | createCol(land, "PassHours", typeof (Double)); | ||
1076 | createCol(land, "PassPrice", typeof (UInt32)); | ||
1077 | createCol(land, "SnapshotUUID", typeof (String)); | ||
1078 | createCol(land, "UserLocationX", typeof (Double)); | ||
1079 | createCol(land, "UserLocationY", typeof (Double)); | ||
1080 | createCol(land, "UserLocationZ", typeof (Double)); | ||
1081 | createCol(land, "UserLookAtX", typeof (Double)); | ||
1082 | createCol(land, "UserLookAtY", typeof (Double)); | ||
1083 | createCol(land, "UserLookAtZ", typeof (Double)); | ||
1084 | createCol(land, "AuthbuyerID", typeof(String)); | ||
1085 | createCol(land, "OtherCleanTime", typeof(Int32)); | ||
1086 | |||
1087 | land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; | ||
1088 | |||
1089 | return land; | ||
1090 | } | ||
1091 | |||
1092 | /// <summary> | ||
1093 | /// create "landaccesslist" table | ||
1094 | /// </summary> | ||
1095 | /// <returns>Landacceslist DataTable</returns> | ||
1096 | private static DataTable createLandAccessListTable() | ||
1097 | { | ||
1098 | DataTable landaccess = new DataTable("landaccesslist"); | ||
1099 | createCol(landaccess, "LandUUID", typeof (String)); | ||
1100 | createCol(landaccess, "AccessUUID", typeof (String)); | ||
1101 | createCol(landaccess, "Flags", typeof (UInt32)); | ||
1102 | |||
1103 | return landaccess; | ||
1104 | } | ||
1105 | |||
1106 | private static DataTable createRegionSettingsTable() | ||
1107 | { | ||
1108 | DataTable regionsettings = new DataTable("regionsettings"); | ||
1109 | createCol(regionsettings, "regionUUID", typeof(String)); | ||
1110 | createCol(regionsettings, "block_terraform", typeof (Int32)); | ||
1111 | createCol(regionsettings, "block_fly", typeof (Int32)); | ||
1112 | createCol(regionsettings, "allow_damage", typeof (Int32)); | ||
1113 | createCol(regionsettings, "restrict_pushing", typeof (Int32)); | ||
1114 | createCol(regionsettings, "allow_land_resell", typeof (Int32)); | ||
1115 | createCol(regionsettings, "allow_land_join_divide", typeof (Int32)); | ||
1116 | createCol(regionsettings, "block_show_in_search", typeof (Int32)); | ||
1117 | createCol(regionsettings, "agent_limit", typeof (Int32)); | ||
1118 | createCol(regionsettings, "object_bonus", typeof (Double)); | ||
1119 | createCol(regionsettings, "maturity", typeof (Int32)); | ||
1120 | createCol(regionsettings, "disable_scripts", typeof (Int32)); | ||
1121 | createCol(regionsettings, "disable_collisions", typeof (Int32)); | ||
1122 | createCol(regionsettings, "disable_physics", typeof (Int32)); | ||
1123 | createCol(regionsettings, "terrain_texture_1", typeof(String)); | ||
1124 | createCol(regionsettings, "terrain_texture_2", typeof(String)); | ||
1125 | createCol(regionsettings, "terrain_texture_3", typeof(String)); | ||
1126 | createCol(regionsettings, "terrain_texture_4", typeof(String)); | ||
1127 | createCol(regionsettings, "elevation_1_nw", typeof (Double)); | ||
1128 | createCol(regionsettings, "elevation_2_nw", typeof (Double)); | ||
1129 | createCol(regionsettings, "elevation_1_ne", typeof (Double)); | ||
1130 | createCol(regionsettings, "elevation_2_ne", typeof (Double)); | ||
1131 | createCol(regionsettings, "elevation_1_se", typeof (Double)); | ||
1132 | createCol(regionsettings, "elevation_2_se", typeof (Double)); | ||
1133 | createCol(regionsettings, "elevation_1_sw", typeof (Double)); | ||
1134 | createCol(regionsettings, "elevation_2_sw", typeof (Double)); | ||
1135 | createCol(regionsettings, "water_height", typeof (Double)); | ||
1136 | createCol(regionsettings, "terrain_raise_limit", typeof (Double)); | ||
1137 | createCol(regionsettings, "terrain_lower_limit", typeof (Double)); | ||
1138 | createCol(regionsettings, "use_estate_sun", typeof (Int32)); | ||
1139 | createCol(regionsettings, "sandbox", typeof (Int32)); | ||
1140 | createCol(regionsettings, "sunvectorx",typeof (Double)); | ||
1141 | createCol(regionsettings, "sunvectory",typeof (Double)); | ||
1142 | createCol(regionsettings, "sunvectorz",typeof (Double)); | ||
1143 | createCol(regionsettings, "fixed_sun", typeof (Int32)); | ||
1144 | createCol(regionsettings, "sun_position", typeof (Double)); | ||
1145 | createCol(regionsettings, "covenant", typeof(String)); | ||
1146 | regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] }; | ||
1147 | return regionsettings; | ||
1148 | } | ||
1149 | |||
1150 | /*********************************************************************** | ||
1151 | * | ||
1152 | * Convert between ADO.NET <=> OpenSim Objects | ||
1153 | * | ||
1154 | * These should be database independant | ||
1155 | * | ||
1156 | **********************************************************************/ | ||
1157 | |||
1158 | /// <summary> | ||
1159 | /// | ||
1160 | /// </summary> | ||
1161 | /// <param name="row"></param> | ||
1162 | /// <returns></returns> | ||
1163 | private SceneObjectPart buildPrim(DataRow row) | ||
1164 | { | ||
1165 | // Code commented. Uncomment to test the unit test inline. | ||
1166 | |||
1167 | // The unit test mentions this commented code for the purposes | ||
1168 | // of debugging a unit test failure | ||
1169 | |||
1170 | // SceneObjectGroup sog = new SceneObjectGroup(); | ||
1171 | // SceneObjectPart sop = new SceneObjectPart(); | ||
1172 | // sop.LocalId = 1; | ||
1173 | // sop.Name = "object1"; | ||
1174 | // sop.Description = "object1"; | ||
1175 | // sop.Text = ""; | ||
1176 | // sop.SitName = ""; | ||
1177 | // sop.TouchName = ""; | ||
1178 | // sop.UUID = UUID.Random(); | ||
1179 | // sop.Shape = PrimitiveBaseShape.Default; | ||
1180 | // sog.SetRootPart(sop); | ||
1181 | // Add breakpoint in above line. Check sop fields. | ||
1182 | |||
1183 | // TODO: this doesn't work yet because something more | ||
1184 | // interesting has to be done to actually get these values | ||
1185 | // back out. Not enough time to figure it out yet. | ||
1186 | |||
1187 | SceneObjectPart prim = new SceneObjectPart(); | ||
1188 | prim.UUID = new UUID((String) row["UUID"]); | ||
1189 | // explicit conversion of integers is required, which sort | ||
1190 | // of sucks. No idea if there is a shortcut here or not. | ||
1191 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); | ||
1192 | prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"]; | ||
1193 | // various text fields | ||
1194 | prim.Text = (String) row["Text"]; | ||
1195 | prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), | ||
1196 | Convert.ToInt32(row["ColorR"]), | ||
1197 | Convert.ToInt32(row["ColorG"]), | ||
1198 | Convert.ToInt32(row["ColorB"])); | ||
1199 | prim.Description = (String) row["Description"]; | ||
1200 | prim.SitName = (String) row["SitName"]; | ||
1201 | prim.TouchName = (String) row["TouchName"]; | ||
1202 | // permissions | ||
1203 | prim.Flags = (PrimFlags)Convert.ToUInt32(row["ObjectFlags"]); | ||
1204 | prim.CreatorIdentification = (String) row["CreatorID"]; | ||
1205 | prim.OwnerID = new UUID((String) row["OwnerID"]); | ||
1206 | prim.GroupID = new UUID((String) row["GroupID"]); | ||
1207 | prim.LastOwnerID = new UUID((String) row["LastOwnerID"]); | ||
1208 | prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); | ||
1209 | prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); | ||
1210 | prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); | ||
1211 | prim.EveryoneMask = Convert.ToUInt32(row["EveryoneMask"]); | ||
1212 | prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); | ||
1213 | // vectors | ||
1214 | prim.OffsetPosition = new Vector3( | ||
1215 | Convert.ToSingle(row["PositionX"]), | ||
1216 | Convert.ToSingle(row["PositionY"]), | ||
1217 | Convert.ToSingle(row["PositionZ"]) | ||
1218 | ); | ||
1219 | prim.GroupPosition = new Vector3( | ||
1220 | Convert.ToSingle(row["GroupPositionX"]), | ||
1221 | Convert.ToSingle(row["GroupPositionY"]), | ||
1222 | Convert.ToSingle(row["GroupPositionZ"]) | ||
1223 | ); | ||
1224 | prim.Velocity = new Vector3( | ||
1225 | Convert.ToSingle(row["VelocityX"]), | ||
1226 | Convert.ToSingle(row["VelocityY"]), | ||
1227 | Convert.ToSingle(row["VelocityZ"]) | ||
1228 | ); | ||
1229 | prim.AngularVelocity = new Vector3( | ||
1230 | Convert.ToSingle(row["AngularVelocityX"]), | ||
1231 | Convert.ToSingle(row["AngularVelocityY"]), | ||
1232 | Convert.ToSingle(row["AngularVelocityZ"]) | ||
1233 | ); | ||
1234 | prim.Acceleration = new Vector3( | ||
1235 | Convert.ToSingle(row["AccelerationX"]), | ||
1236 | Convert.ToSingle(row["AccelerationY"]), | ||
1237 | Convert.ToSingle(row["AccelerationZ"]) | ||
1238 | ); | ||
1239 | // quaternions | ||
1240 | prim.RotationOffset = new Quaternion( | ||
1241 | Convert.ToSingle(row["RotationX"]), | ||
1242 | Convert.ToSingle(row["RotationY"]), | ||
1243 | Convert.ToSingle(row["RotationZ"]), | ||
1244 | Convert.ToSingle(row["RotationW"]) | ||
1245 | ); | ||
1246 | |||
1247 | prim.SitTargetPositionLL = new Vector3( | ||
1248 | Convert.ToSingle(row["SitTargetOffsetX"]), | ||
1249 | Convert.ToSingle(row["SitTargetOffsetY"]), | ||
1250 | Convert.ToSingle(row["SitTargetOffsetZ"])); | ||
1251 | prim.SitTargetOrientationLL = new Quaternion( | ||
1252 | Convert.ToSingle( | ||
1253 | row["SitTargetOrientX"]), | ||
1254 | Convert.ToSingle( | ||
1255 | row["SitTargetOrientY"]), | ||
1256 | Convert.ToSingle( | ||
1257 | row["SitTargetOrientZ"]), | ||
1258 | Convert.ToSingle( | ||
1259 | row["SitTargetOrientW"])); | ||
1260 | |||
1261 | prim.ClickAction = Convert.ToByte(row["ClickAction"]); | ||
1262 | prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]); | ||
1263 | prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]); | ||
1264 | prim.PayPrice[2] = Convert.ToInt32(row["PayButton2"]); | ||
1265 | prim.PayPrice[3] = Convert.ToInt32(row["PayButton3"]); | ||
1266 | prim.PayPrice[4] = Convert.ToInt32(row["PayButton4"]); | ||
1267 | |||
1268 | prim.Sound = new UUID(row["LoopedSound"].ToString()); | ||
1269 | prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]); | ||
1270 | prim.SoundFlags = 1; // If it's persisted at all, it's looped | ||
1271 | |||
1272 | if (!row.IsNull("TextureAnimation")) | ||
1273 | prim.TextureAnimation = Convert.FromBase64String(row["TextureAnimation"].ToString()); | ||
1274 | if (!row.IsNull("ParticleSystem")) | ||
1275 | prim.ParticleSystem = Convert.FromBase64String(row["ParticleSystem"].ToString()); | ||
1276 | |||
1277 | prim.AngularVelocity = new Vector3( | ||
1278 | Convert.ToSingle(row["OmegaX"]), | ||
1279 | Convert.ToSingle(row["OmegaY"]), | ||
1280 | Convert.ToSingle(row["OmegaZ"]) | ||
1281 | ); | ||
1282 | |||
1283 | prim.SetCameraEyeOffset(new Vector3( | ||
1284 | Convert.ToSingle(row["CameraEyeOffsetX"]), | ||
1285 | Convert.ToSingle(row["CameraEyeOffsetY"]), | ||
1286 | Convert.ToSingle(row["CameraEyeOffsetZ"]) | ||
1287 | )); | ||
1288 | |||
1289 | prim.SetCameraAtOffset(new Vector3( | ||
1290 | Convert.ToSingle(row["CameraAtOffsetX"]), | ||
1291 | Convert.ToSingle(row["CameraAtOffsetY"]), | ||
1292 | Convert.ToSingle(row["CameraAtOffsetZ"]) | ||
1293 | )); | ||
1294 | |||
1295 | if (Convert.ToInt16(row["ForceMouselook"]) != 0) | ||
1296 | prim.SetForceMouselook(true); | ||
1297 | |||
1298 | prim.ScriptAccessPin = Convert.ToInt32(row["ScriptAccessPin"]); | ||
1299 | |||
1300 | if (Convert.ToInt16(row["AllowedDrop"]) != 0) | ||
1301 | prim.AllowedDrop = true; | ||
1302 | |||
1303 | if (Convert.ToInt16(row["DieAtEdge"]) != 0) | ||
1304 | prim.DIE_AT_EDGE = true; | ||
1305 | |||
1306 | prim.SalePrice = Convert.ToInt32(row["SalePrice"]); | ||
1307 | prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); | ||
1308 | |||
1309 | prim.Material = Convert.ToByte(row["Material"]); | ||
1310 | |||
1311 | prim.CollisionSound = new UUID(row["CollisionSound"].ToString()); | ||
1312 | prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]); | ||
1313 | |||
1314 | if (Convert.ToInt16(row["VolumeDetect"]) != 0) | ||
1315 | prim.VolumeDetectActive = true; | ||
1316 | |||
1317 | return prim; | ||
1318 | } | ||
1319 | |||
1320 | /// <summary> | ||
1321 | /// Build a prim inventory item from the persisted data. | ||
1322 | /// </summary> | ||
1323 | /// <param name="row"></param> | ||
1324 | /// <returns></returns> | ||
1325 | private static TaskInventoryItem buildItem(DataRow row) | ||
1326 | { | ||
1327 | TaskInventoryItem taskItem = new TaskInventoryItem(); | ||
1328 | |||
1329 | taskItem.ItemID = new UUID((String)row["itemID"]); | ||
1330 | taskItem.ParentPartID = new UUID((String)row["primID"]); | ||
1331 | taskItem.AssetID = new UUID((String)row["assetID"]); | ||
1332 | taskItem.ParentID = new UUID((String)row["parentFolderID"]); | ||
1333 | |||
1334 | taskItem.InvType = Convert.ToInt32(row["invType"]); | ||
1335 | taskItem.Type = Convert.ToInt32(row["assetType"]); | ||
1336 | |||
1337 | taskItem.Name = (String)row["name"]; | ||
1338 | taskItem.Description = (String)row["description"]; | ||
1339 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); | ||
1340 | taskItem.CreatorIdentification = (String)row["creatorID"]; | ||
1341 | taskItem.OwnerID = new UUID((String)row["ownerID"]); | ||
1342 | taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]); | ||
1343 | taskItem.GroupID = new UUID((String)row["groupID"]); | ||
1344 | |||
1345 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); | ||
1346 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); | ||
1347 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); | ||
1348 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); | ||
1349 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | ||
1350 | taskItem.Flags = Convert.ToUInt32(row["flags"]); | ||
1351 | |||
1352 | return taskItem; | ||
1353 | } | ||
1354 | |||
1355 | /// <summary> | ||
1356 | /// Build a Land Data from the persisted data. | ||
1357 | /// </summary> | ||
1358 | /// <param name="row"></param> | ||
1359 | /// <returns></returns> | ||
1360 | private LandData buildLandData(DataRow row) | ||
1361 | { | ||
1362 | LandData newData = new LandData(); | ||
1363 | |||
1364 | newData.GlobalID = new UUID((String) row["UUID"]); | ||
1365 | newData.LocalID = Convert.ToInt32(row["LocalLandID"]); | ||
1366 | |||
1367 | // Bitmap is a byte[512] | ||
1368 | newData.Bitmap = (Byte[]) row["Bitmap"]; | ||
1369 | |||
1370 | newData.Name = (String) row["Name"]; | ||
1371 | newData.Description = (String) row["Desc"]; | ||
1372 | newData.OwnerID = (UUID)(String) row["OwnerUUID"]; | ||
1373 | newData.IsGroupOwned = (Boolean) row["IsGroupOwned"]; | ||
1374 | newData.Area = Convert.ToInt32(row["Area"]); | ||
1375 | newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented | ||
1376 | newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]); | ||
1377 | //Enum OpenMetaverse.Parcel.ParcelCategory | ||
1378 | newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); | ||
1379 | newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); | ||
1380 | newData.GroupID = new UUID((String) row["GroupUUID"]); | ||
1381 | newData.SalePrice = Convert.ToInt32(row["SalePrice"]); | ||
1382 | newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]); | ||
1383 | //Enum. OpenMetaverse.Parcel.ParcelStatus | ||
1384 | newData.Flags = Convert.ToUInt32(row["LandFlags"]); | ||
1385 | newData.LandingType = (Byte) row["LandingType"]; | ||
1386 | newData.MediaAutoScale = (Byte) row["MediaAutoScale"]; | ||
1387 | newData.MediaID = new UUID((String) row["MediaTextureUUID"]); | ||
1388 | newData.MediaURL = (String) row["MediaURL"]; | ||
1389 | newData.MusicURL = (String) row["MusicURL"]; | ||
1390 | newData.PassHours = Convert.ToSingle(row["PassHours"]); | ||
1391 | newData.PassPrice = Convert.ToInt32(row["PassPrice"]); | ||
1392 | newData.SnapshotID = (UUID)(String) row["SnapshotUUID"]; | ||
1393 | try | ||
1394 | { | ||
1395 | |||
1396 | newData.UserLocation = | ||
1397 | new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), | ||
1398 | Convert.ToSingle(row["UserLocationZ"])); | ||
1399 | newData.UserLookAt = | ||
1400 | new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), | ||
1401 | Convert.ToSingle(row["UserLookAtZ"])); | ||
1402 | |||
1403 | } | ||
1404 | catch (InvalidCastException) | ||
1405 | { | ||
1406 | m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); | ||
1407 | newData.UserLocation = Vector3.Zero; | ||
1408 | newData.UserLookAt = Vector3.Zero; | ||
1409 | } | ||
1410 | newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); | ||
1411 | UUID authBuyerID = UUID.Zero; | ||
1412 | |||
1413 | UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); | ||
1414 | |||
1415 | newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); | ||
1416 | |||
1417 | return newData; | ||
1418 | } | ||
1419 | |||
1420 | private RegionSettings buildRegionSettings(DataRow row) | ||
1421 | { | ||
1422 | RegionSettings newSettings = new RegionSettings(); | ||
1423 | |||
1424 | newSettings.RegionUUID = new UUID((string) row["regionUUID"]); | ||
1425 | newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); | ||
1426 | newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); | ||
1427 | newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); | ||
1428 | newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]); | ||
1429 | newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]); | ||
1430 | newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]); | ||
1431 | newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]); | ||
1432 | newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]); | ||
1433 | newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]); | ||
1434 | newSettings.Maturity = Convert.ToInt32(row["maturity"]); | ||
1435 | newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); | ||
1436 | newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); | ||
1437 | newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); | ||
1438 | newSettings.TerrainTexture1 = new UUID((String) row["terrain_texture_1"]); | ||
1439 | newSettings.TerrainTexture2 = new UUID((String) row["terrain_texture_2"]); | ||
1440 | newSettings.TerrainTexture3 = new UUID((String) row["terrain_texture_3"]); | ||
1441 | newSettings.TerrainTexture4 = new UUID((String) row["terrain_texture_4"]); | ||
1442 | newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); | ||
1443 | newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); | ||
1444 | newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); | ||
1445 | newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]); | ||
1446 | newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]); | ||
1447 | newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]); | ||
1448 | newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]); | ||
1449 | newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]); | ||
1450 | newSettings.WaterHeight = Convert.ToDouble(row["water_height"]); | ||
1451 | newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); | ||
1452 | newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); | ||
1453 | newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); | ||
1454 | newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); | ||
1455 | newSettings.SunVector = new Vector3 ( | ||
1456 | Convert.ToSingle(row["sunvectorx"]), | ||
1457 | Convert.ToSingle(row["sunvectory"]), | ||
1458 | Convert.ToSingle(row["sunvectorz"]) | ||
1459 | ); | ||
1460 | newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); | ||
1461 | newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); | ||
1462 | newSettings.Covenant = new UUID((String) row["covenant"]); | ||
1463 | |||
1464 | return newSettings; | ||
1465 | } | ||
1466 | |||
1467 | /// <summary> | ||
1468 | /// Build a land access entry from the persisted data. | ||
1469 | /// </summary> | ||
1470 | /// <param name="row"></param> | ||
1471 | /// <returns></returns> | ||
1472 | private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) | ||
1473 | { | ||
1474 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1475 | entry.AgentID = new UUID((string) row["AccessUUID"]); | ||
1476 | entry.Flags = (AccessList) row["Flags"]; | ||
1477 | entry.Time = new DateTime(); | ||
1478 | return entry; | ||
1479 | } | ||
1480 | |||
1481 | /// <summary> | ||
1482 | /// | ||
1483 | /// </summary> | ||
1484 | /// <param name="val"></param> | ||
1485 | /// <returns></returns> | ||
1486 | private static Array serializeTerrain(double[,] val) | ||
1487 | { | ||
1488 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); | ||
1489 | BinaryWriter bw = new BinaryWriter(str); | ||
1490 | |||
1491 | // TODO: COMPATIBILITY - Add byte-order conversions | ||
1492 | for (int x = 0; x < (int)Constants.RegionSize; x++) | ||
1493 | for (int y = 0; y < (int)Constants.RegionSize; y++) | ||
1494 | bw.Write(val[x, y]); | ||
1495 | |||
1496 | return str.ToArray(); | ||
1497 | } | ||
1498 | |||
1499 | // private void fillTerrainRow(DataRow row, UUID regionUUID, int rev, double[,] val) | ||
1500 | // { | ||
1501 | // row["RegionUUID"] = regionUUID; | ||
1502 | // row["Revision"] = rev; | ||
1503 | |||
1504 | // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize)*sizeof (double)); | ||
1505 | // BinaryWriter bw = new BinaryWriter(str); | ||
1506 | |||
1507 | // // TODO: COMPATIBILITY - Add byte-order conversions | ||
1508 | // for (int x = 0; x < (int)Constants.RegionSize; x++) | ||
1509 | // for (int y = 0; y < (int)Constants.RegionSize; y++) | ||
1510 | // bw.Write(val[x, y]); | ||
1511 | |||
1512 | // row["Heightfield"] = str.ToArray(); | ||
1513 | // } | ||
1514 | |||
1515 | /// <summary> | ||
1516 | /// | ||
1517 | /// </summary> | ||
1518 | /// <param name="row"></param> | ||
1519 | /// <param name="prim"></param> | ||
1520 | /// <param name="sceneGroupID"></param> | ||
1521 | /// <param name="regionUUID"></param> | ||
1522 | private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) | ||
1523 | { | ||
1524 | row["UUID"] = prim.UUID.ToString(); | ||
1525 | row["RegionUUID"] = regionUUID.ToString(); | ||
1526 | row["CreationDate"] = prim.CreationDate; | ||
1527 | row["Name"] = prim.Name; | ||
1528 | row["SceneGroupID"] = sceneGroupID.ToString(); | ||
1529 | // the UUID of the root part for this SceneObjectGroup | ||
1530 | // various text fields | ||
1531 | row["Text"] = prim.Text; | ||
1532 | row["Description"] = prim.Description; | ||
1533 | row["SitName"] = prim.SitName; | ||
1534 | row["TouchName"] = prim.TouchName; | ||
1535 | // permissions | ||
1536 | row["ObjectFlags"] = (uint)prim.Flags; | ||
1537 | row["CreatorID"] = prim.CreatorIdentification.ToString(); | ||
1538 | row["OwnerID"] = prim.OwnerID.ToString(); | ||
1539 | row["GroupID"] = prim.GroupID.ToString(); | ||
1540 | row["LastOwnerID"] = prim.LastOwnerID.ToString(); | ||
1541 | row["OwnerMask"] = prim.OwnerMask; | ||
1542 | row["NextOwnerMask"] = prim.NextOwnerMask; | ||
1543 | row["GroupMask"] = prim.GroupMask; | ||
1544 | row["EveryoneMask"] = prim.EveryoneMask; | ||
1545 | row["BaseMask"] = prim.BaseMask; | ||
1546 | // vectors | ||
1547 | row["PositionX"] = prim.OffsetPosition.X; | ||
1548 | row["PositionY"] = prim.OffsetPosition.Y; | ||
1549 | row["PositionZ"] = prim.OffsetPosition.Z; | ||
1550 | row["GroupPositionX"] = prim.GroupPosition.X; | ||
1551 | row["GroupPositionY"] = prim.GroupPosition.Y; | ||
1552 | row["GroupPositionZ"] = prim.GroupPosition.Z; | ||
1553 | row["VelocityX"] = prim.Velocity.X; | ||
1554 | row["VelocityY"] = prim.Velocity.Y; | ||
1555 | row["VelocityZ"] = prim.Velocity.Z; | ||
1556 | row["AngularVelocityX"] = prim.AngularVelocity.X; | ||
1557 | row["AngularVelocityY"] = prim.AngularVelocity.Y; | ||
1558 | row["AngularVelocityZ"] = prim.AngularVelocity.Z; | ||
1559 | row["AccelerationX"] = prim.Acceleration.X; | ||
1560 | row["AccelerationY"] = prim.Acceleration.Y; | ||
1561 | row["AccelerationZ"] = prim.Acceleration.Z; | ||
1562 | // quaternions | ||
1563 | row["RotationX"] = prim.RotationOffset.X; | ||
1564 | row["RotationY"] = prim.RotationOffset.Y; | ||
1565 | row["RotationZ"] = prim.RotationOffset.Z; | ||
1566 | row["RotationW"] = prim.RotationOffset.W; | ||
1567 | |||
1568 | // Sit target | ||
1569 | Vector3 sitTargetPos = prim.SitTargetPositionLL; | ||
1570 | row["SitTargetOffsetX"] = sitTargetPos.X; | ||
1571 | row["SitTargetOffsetY"] = sitTargetPos.Y; | ||
1572 | row["SitTargetOffsetZ"] = sitTargetPos.Z; | ||
1573 | |||
1574 | Quaternion sitTargetOrient = prim.SitTargetOrientationLL; | ||
1575 | row["SitTargetOrientW"] = sitTargetOrient.W; | ||
1576 | row["SitTargetOrientX"] = sitTargetOrient.X; | ||
1577 | row["SitTargetOrientY"] = sitTargetOrient.Y; | ||
1578 | row["SitTargetOrientZ"] = sitTargetOrient.Z; | ||
1579 | row["ColorR"] = Convert.ToInt32(prim.Color.R); | ||
1580 | row["ColorG"] = Convert.ToInt32(prim.Color.G); | ||
1581 | row["ColorB"] = Convert.ToInt32(prim.Color.B); | ||
1582 | row["ColorA"] = Convert.ToInt32(prim.Color.A); | ||
1583 | row["PayPrice"] = prim.PayPrice[0]; | ||
1584 | row["PayButton1"] = prim.PayPrice[1]; | ||
1585 | row["PayButton2"] = prim.PayPrice[2]; | ||
1586 | row["PayButton3"] = prim.PayPrice[3]; | ||
1587 | row["PayButton4"] = prim.PayPrice[4]; | ||
1588 | |||
1589 | |||
1590 | row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation); | ||
1591 | row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem); | ||
1592 | |||
1593 | row["OmegaX"] = prim.AngularVelocity.X; | ||
1594 | row["OmegaY"] = prim.AngularVelocity.Y; | ||
1595 | row["OmegaZ"] = prim.AngularVelocity.Z; | ||
1596 | |||
1597 | row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X; | ||
1598 | row["CameraEyeOffsetY"] = prim.GetCameraEyeOffset().Y; | ||
1599 | row["CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z; | ||
1600 | |||
1601 | row["CameraAtOffsetX"] = prim.GetCameraAtOffset().X; | ||
1602 | row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y; | ||
1603 | row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z; | ||
1604 | |||
1605 | |||
1606 | if ((prim.SoundFlags & 1) != 0) // Looped | ||
1607 | { | ||
1608 | row["LoopedSound"] = prim.Sound.ToString(); | ||
1609 | row["LoopedSoundGain"] = prim.SoundGain; | ||
1610 | } | ||
1611 | else | ||
1612 | { | ||
1613 | row["LoopedSound"] = UUID.Zero.ToString(); | ||
1614 | row["LoopedSoundGain"] = 0.0f; | ||
1615 | } | ||
1616 | |||
1617 | if (prim.GetForceMouselook()) | ||
1618 | row["ForceMouselook"] = 1; | ||
1619 | else | ||
1620 | row["ForceMouselook"] = 0; | ||
1621 | |||
1622 | row["ScriptAccessPin"] = prim.ScriptAccessPin; | ||
1623 | |||
1624 | if (prim.AllowedDrop) | ||
1625 | row["AllowedDrop"] = 1; | ||
1626 | else | ||
1627 | row["AllowedDrop"] = 0; | ||
1628 | |||
1629 | if (prim.DIE_AT_EDGE) | ||
1630 | row["DieAtEdge"] = 1; | ||
1631 | else | ||
1632 | row["DieAtEdge"] = 0; | ||
1633 | |||
1634 | row["SalePrice"] = prim.SalePrice; | ||
1635 | row["SaleType"] = Convert.ToInt16(prim.ObjectSaleType); | ||
1636 | |||
1637 | // click action | ||
1638 | row["ClickAction"] = prim.ClickAction; | ||
1639 | |||
1640 | row["SalePrice"] = prim.SalePrice; | ||
1641 | row["Material"] = prim.Material; | ||
1642 | |||
1643 | row["CollisionSound"] = prim.CollisionSound.ToString(); | ||
1644 | row["CollisionSoundVolume"] = prim.CollisionSoundVolume; | ||
1645 | if (prim.VolumeDetectActive) | ||
1646 | row["VolumeDetect"] = 1; | ||
1647 | else | ||
1648 | row["VolumeDetect"] = 0; | ||
1649 | |||
1650 | } | ||
1651 | |||
1652 | /// <summary> | ||
1653 | /// | ||
1654 | /// </summary> | ||
1655 | /// <param name="row"></param> | ||
1656 | /// <param name="taskItem"></param> | ||
1657 | private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) | ||
1658 | { | ||
1659 | row["itemID"] = taskItem.ItemID.ToString(); | ||
1660 | row["primID"] = taskItem.ParentPartID.ToString(); | ||
1661 | row["assetID"] = taskItem.AssetID.ToString(); | ||
1662 | row["parentFolderID"] = taskItem.ParentID.ToString(); | ||
1663 | |||
1664 | row["invType"] = taskItem.InvType; | ||
1665 | row["assetType"] = taskItem.Type; | ||
1666 | |||
1667 | row["name"] = taskItem.Name; | ||
1668 | row["description"] = taskItem.Description; | ||
1669 | row["creationDate"] = taskItem.CreationDate; | ||
1670 | row["creatorID"] = taskItem.CreatorIdentification.ToString(); | ||
1671 | row["ownerID"] = taskItem.OwnerID.ToString(); | ||
1672 | row["lastOwnerID"] = taskItem.LastOwnerID.ToString(); | ||
1673 | row["groupID"] = taskItem.GroupID.ToString(); | ||
1674 | row["nextPermissions"] = taskItem.NextPermissions; | ||
1675 | row["currentPermissions"] = taskItem.CurrentPermissions; | ||
1676 | row["basePermissions"] = taskItem.BasePermissions; | ||
1677 | row["everyonePermissions"] = taskItem.EveryonePermissions; | ||
1678 | row["groupPermissions"] = taskItem.GroupPermissions; | ||
1679 | row["flags"] = taskItem.Flags; | ||
1680 | } | ||
1681 | |||
1682 | /// <summary> | ||
1683 | /// | ||
1684 | /// </summary> | ||
1685 | /// <param name="row"></param> | ||
1686 | /// <param name="land"></param> | ||
1687 | /// <param name="regionUUID"></param> | ||
1688 | private static void fillLandRow(DataRow row, LandData land, UUID regionUUID) | ||
1689 | { | ||
1690 | row["UUID"] = land.GlobalID.ToString(); | ||
1691 | row["RegionUUID"] = regionUUID.ToString(); | ||
1692 | row["LocalLandID"] = land.LocalID; | ||
1693 | |||
1694 | // Bitmap is a byte[512] | ||
1695 | row["Bitmap"] = land.Bitmap; | ||
1696 | |||
1697 | row["Name"] = land.Name; | ||
1698 | row["Desc"] = land.Description; | ||
1699 | row["OwnerUUID"] = land.OwnerID.ToString(); | ||
1700 | row["IsGroupOwned"] = land.IsGroupOwned; | ||
1701 | row["Area"] = land.Area; | ||
1702 | row["AuctionID"] = land.AuctionID; //Unemplemented | ||
1703 | row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory | ||
1704 | row["ClaimDate"] = land.ClaimDate; | ||
1705 | row["ClaimPrice"] = land.ClaimPrice; | ||
1706 | row["GroupUUID"] = land.GroupID.ToString(); | ||
1707 | row["SalePrice"] = land.SalePrice; | ||
1708 | row["LandStatus"] = land.Status; //Enum. OpenMetaverse.Parcel.ParcelStatus | ||
1709 | row["LandFlags"] = land.Flags; | ||
1710 | row["LandingType"] = land.LandingType; | ||
1711 | row["MediaAutoScale"] = land.MediaAutoScale; | ||
1712 | row["MediaTextureUUID"] = land.MediaID.ToString(); | ||
1713 | row["MediaURL"] = land.MediaURL; | ||
1714 | row["MusicURL"] = land.MusicURL; | ||
1715 | row["PassHours"] = land.PassHours; | ||
1716 | row["PassPrice"] = land.PassPrice; | ||
1717 | row["SnapshotUUID"] = land.SnapshotID.ToString(); | ||
1718 | row["UserLocationX"] = land.UserLocation.X; | ||
1719 | row["UserLocationY"] = land.UserLocation.Y; | ||
1720 | row["UserLocationZ"] = land.UserLocation.Z; | ||
1721 | row["UserLookAtX"] = land.UserLookAt.X; | ||
1722 | row["UserLookAtY"] = land.UserLookAt.Y; | ||
1723 | row["UserLookAtZ"] = land.UserLookAt.Z; | ||
1724 | row["AuthbuyerID"] = land.AuthBuyerID.ToString(); | ||
1725 | row["OtherCleanTime"] = land.OtherCleanTime; | ||
1726 | } | ||
1727 | |||
1728 | /// <summary> | ||
1729 | /// | ||
1730 | /// </summary> | ||
1731 | /// <param name="row"></param> | ||
1732 | /// <param name="entry"></param> | ||
1733 | /// <param name="parcelID"></param> | ||
1734 | private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID) | ||
1735 | { | ||
1736 | row["LandUUID"] = parcelID.ToString(); | ||
1737 | row["AccessUUID"] = entry.AgentID.ToString(); | ||
1738 | row["Flags"] = entry.Flags; | ||
1739 | } | ||
1740 | |||
1741 | private static void fillRegionSettingsRow(DataRow row, RegionSettings settings) | ||
1742 | { | ||
1743 | row["regionUUID"] = settings.RegionUUID.ToString(); | ||
1744 | row["block_terraform"] = settings.BlockTerraform; | ||
1745 | row["block_fly"] = settings.BlockFly; | ||
1746 | row["allow_damage"] = settings.AllowDamage; | ||
1747 | row["restrict_pushing"] = settings.RestrictPushing; | ||
1748 | row["allow_land_resell"] = settings.AllowLandResell; | ||
1749 | row["allow_land_join_divide"] = settings.AllowLandJoinDivide; | ||
1750 | row["block_show_in_search"] = settings.BlockShowInSearch; | ||
1751 | row["agent_limit"] = settings.AgentLimit; | ||
1752 | row["object_bonus"] = settings.ObjectBonus; | ||
1753 | row["maturity"] = settings.Maturity; | ||
1754 | row["disable_scripts"] = settings.DisableScripts; | ||
1755 | row["disable_collisions"] = settings.DisableCollisions; | ||
1756 | row["disable_physics"] = settings.DisablePhysics; | ||
1757 | row["terrain_texture_1"] = settings.TerrainTexture1.ToString(); | ||
1758 | row["terrain_texture_2"] = settings.TerrainTexture2.ToString(); | ||
1759 | row["terrain_texture_3"] = settings.TerrainTexture3.ToString(); | ||
1760 | row["terrain_texture_4"] = settings.TerrainTexture4.ToString(); | ||
1761 | row["elevation_1_nw"] = settings.Elevation1NW; | ||
1762 | row["elevation_2_nw"] = settings.Elevation2NW; | ||
1763 | row["elevation_1_ne"] = settings.Elevation1NE; | ||
1764 | row["elevation_2_ne"] = settings.Elevation2NE; | ||
1765 | row["elevation_1_se"] = settings.Elevation1SE; | ||
1766 | row["elevation_2_se"] = settings.Elevation2SE; | ||
1767 | row["elevation_1_sw"] = settings.Elevation1SW; | ||
1768 | row["elevation_2_sw"] = settings.Elevation2SW; | ||
1769 | row["water_height"] = settings.WaterHeight; | ||
1770 | row["terrain_raise_limit"] = settings.TerrainRaiseLimit; | ||
1771 | row["terrain_lower_limit"] = settings.TerrainLowerLimit; | ||
1772 | row["use_estate_sun"] = settings.UseEstateSun; | ||
1773 | row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox | ||
1774 | row["sunvectorx"] = settings.SunVector.X; | ||
1775 | row["sunvectory"] = settings.SunVector.Y; | ||
1776 | row["sunvectorz"] = settings.SunVector.Z; | ||
1777 | row["fixed_sun"] = settings.FixedSun; | ||
1778 | row["sun_position"] = settings.SunPosition; | ||
1779 | row["covenant"] = settings.Covenant.ToString(); | ||
1780 | } | ||
1781 | |||
1782 | /// <summary> | ||
1783 | /// | ||
1784 | /// </summary> | ||
1785 | /// <param name="row"></param> | ||
1786 | /// <returns></returns> | ||
1787 | private PrimitiveBaseShape buildShape(DataRow row) | ||
1788 | { | ||
1789 | PrimitiveBaseShape s = new PrimitiveBaseShape(); | ||
1790 | s.Scale = new Vector3( | ||
1791 | Convert.ToSingle(row["ScaleX"]), | ||
1792 | Convert.ToSingle(row["ScaleY"]), | ||
1793 | Convert.ToSingle(row["ScaleZ"]) | ||
1794 | ); | ||
1795 | // paths | ||
1796 | s.PCode = Convert.ToByte(row["PCode"]); | ||
1797 | s.PathBegin = Convert.ToUInt16(row["PathBegin"]); | ||
1798 | s.PathEnd = Convert.ToUInt16(row["PathEnd"]); | ||
1799 | s.PathScaleX = Convert.ToByte(row["PathScaleX"]); | ||
1800 | s.PathScaleY = Convert.ToByte(row["PathScaleY"]); | ||
1801 | s.PathShearX = Convert.ToByte(row["PathShearX"]); | ||
1802 | s.PathShearY = Convert.ToByte(row["PathShearY"]); | ||
1803 | s.PathSkew = Convert.ToSByte(row["PathSkew"]); | ||
1804 | s.PathCurve = Convert.ToByte(row["PathCurve"]); | ||
1805 | s.PathRadiusOffset = Convert.ToSByte(row["PathRadiusOffset"]); | ||
1806 | s.PathRevolutions = Convert.ToByte(row["PathRevolutions"]); | ||
1807 | s.PathTaperX = Convert.ToSByte(row["PathTaperX"]); | ||
1808 | s.PathTaperY = Convert.ToSByte(row["PathTaperY"]); | ||
1809 | s.PathTwist = Convert.ToSByte(row["PathTwist"]); | ||
1810 | s.PathTwistBegin = Convert.ToSByte(row["PathTwistBegin"]); | ||
1811 | // profile | ||
1812 | s.ProfileBegin = Convert.ToUInt16(row["ProfileBegin"]); | ||
1813 | s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); | ||
1814 | s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); | ||
1815 | s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); | ||
1816 | s.State = Convert.ToByte(row["State"]); | ||
1817 | |||
1818 | byte[] textureEntry = (byte[])row["Texture"]; | ||
1819 | s.TextureEntry = textureEntry; | ||
1820 | |||
1821 | s.ExtraParams = (byte[]) row["ExtraParams"]; | ||
1822 | return s; | ||
1823 | } | ||
1824 | |||
1825 | /// <summary> | ||
1826 | /// | ||
1827 | /// </summary> | ||
1828 | /// <param name="row"></param> | ||
1829 | /// <param name="prim"></param> | ||
1830 | private static void fillShapeRow(DataRow row, SceneObjectPart prim) | ||
1831 | { | ||
1832 | PrimitiveBaseShape s = prim.Shape; | ||
1833 | row["UUID"] = prim.UUID.ToString(); | ||
1834 | // shape is an enum | ||
1835 | row["Shape"] = 0; | ||
1836 | // vectors | ||
1837 | row["ScaleX"] = s.Scale.X; | ||
1838 | row["ScaleY"] = s.Scale.Y; | ||
1839 | row["ScaleZ"] = s.Scale.Z; | ||
1840 | // paths | ||
1841 | row["PCode"] = s.PCode; | ||
1842 | row["PathBegin"] = s.PathBegin; | ||
1843 | row["PathEnd"] = s.PathEnd; | ||
1844 | row["PathScaleX"] = s.PathScaleX; | ||
1845 | row["PathScaleY"] = s.PathScaleY; | ||
1846 | row["PathShearX"] = s.PathShearX; | ||
1847 | row["PathShearY"] = s.PathShearY; | ||
1848 | row["PathSkew"] = s.PathSkew; | ||
1849 | row["PathCurve"] = s.PathCurve; | ||
1850 | row["PathRadiusOffset"] = s.PathRadiusOffset; | ||
1851 | row["PathRevolutions"] = s.PathRevolutions; | ||
1852 | row["PathTaperX"] = s.PathTaperX; | ||
1853 | row["PathTaperY"] = s.PathTaperY; | ||
1854 | row["PathTwist"] = s.PathTwist; | ||
1855 | row["PathTwistBegin"] = s.PathTwistBegin; | ||
1856 | // profile | ||
1857 | row["ProfileBegin"] = s.ProfileBegin; | ||
1858 | row["ProfileEnd"] = s.ProfileEnd; | ||
1859 | row["ProfileCurve"] = s.ProfileCurve; | ||
1860 | row["ProfileHollow"] = s.ProfileHollow; | ||
1861 | row["State"] = s.State; | ||
1862 | |||
1863 | row["Texture"] = s.TextureEntry; | ||
1864 | row["ExtraParams"] = s.ExtraParams; | ||
1865 | } | ||
1866 | |||
1867 | /// <summary> | ||
1868 | /// | ||
1869 | /// </summary> | ||
1870 | /// <param name="prim"></param> | ||
1871 | /// <param name="sceneGroupID"></param> | ||
1872 | /// <param name="regionUUID"></param> | ||
1873 | private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) | ||
1874 | { | ||
1875 | |||
1876 | DataTable prims = ds.Tables["prims"]; | ||
1877 | DataTable shapes = ds.Tables["primshapes"]; | ||
1878 | |||
1879 | DataRow primRow = prims.Rows.Find(prim.UUID.ToString()); | ||
1880 | if (primRow == null) | ||
1881 | { | ||
1882 | primRow = prims.NewRow(); | ||
1883 | fillPrimRow(primRow, prim, sceneGroupID, regionUUID); | ||
1884 | prims.Rows.Add(primRow); | ||
1885 | } | ||
1886 | else | ||
1887 | { | ||
1888 | fillPrimRow(primRow, prim, sceneGroupID, regionUUID); | ||
1889 | } | ||
1890 | |||
1891 | DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); | ||
1892 | if (shapeRow == null) | ||
1893 | { | ||
1894 | shapeRow = shapes.NewRow(); | ||
1895 | fillShapeRow(shapeRow, prim); | ||
1896 | shapes.Rows.Add(shapeRow); | ||
1897 | } | ||
1898 | else | ||
1899 | { | ||
1900 | fillShapeRow(shapeRow, prim); | ||
1901 | } | ||
1902 | } | ||
1903 | |||
1904 | /// <summary> | ||
1905 | /// </summary> | ||
1906 | /// <param name="primID"></param> | ||
1907 | /// <param name="items"></param> | ||
1908 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | ||
1909 | { | ||
1910 | m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); | ||
1911 | |||
1912 | DataTable dbItems = ds.Tables["primitems"]; | ||
1913 | |||
1914 | // For now, we're just going to crudely remove all the previous inventory items | ||
1915 | // no matter whether they have changed or not, and replace them with the current set. | ||
1916 | lock (ds) | ||
1917 | { | ||
1918 | RemoveItems(primID); | ||
1919 | |||
1920 | // repalce with current inventory details | ||
1921 | foreach (TaskInventoryItem newItem in items) | ||
1922 | { | ||
1923 | // m_log.InfoFormat( | ||
1924 | // "[DATASTORE]: ", | ||
1925 | // "Adding item {0}, {1} to prim ID {2}", | ||
1926 | // newItem.Name, newItem.ItemID, newItem.ParentPartID); | ||
1927 | |||
1928 | DataRow newItemRow = dbItems.NewRow(); | ||
1929 | fillItemRow(newItemRow, newItem); | ||
1930 | dbItems.Rows.Add(newItemRow); | ||
1931 | } | ||
1932 | } | ||
1933 | |||
1934 | Commit(); | ||
1935 | } | ||
1936 | |||
1937 | /*********************************************************************** | ||
1938 | * | ||
1939 | * SQL Statement Creation Functions | ||
1940 | * | ||
1941 | * These functions create SQL statements for update, insert, and create. | ||
1942 | * They can probably be factored later to have a db independant | ||
1943 | * portion and a db specific portion | ||
1944 | * | ||
1945 | **********************************************************************/ | ||
1946 | |||
1947 | /// <summary> | ||
1948 | /// Create an insert command | ||
1949 | /// </summary> | ||
1950 | /// <param name="table">table name</param> | ||
1951 | /// <param name="dt">data table</param> | ||
1952 | /// <returns>the created command</returns> | ||
1953 | /// <remarks> | ||
1954 | /// This is subtle enough to deserve some commentary. | ||
1955 | /// Instead of doing *lots* and *lots of hardcoded strings | ||
1956 | /// for database definitions we'll use the fact that | ||
1957 | /// realistically all insert statements look like "insert | ||
1958 | /// into A(b, c) values(:b, :c) on the parameterized query | ||
1959 | /// front. If we just have a list of b, c, etc... we can | ||
1960 | /// generate these strings instead of typing them out. | ||
1961 | /// </remarks> | ||
1962 | private static SqliteCommand createInsertCommand(string table, DataTable dt) | ||
1963 | { | ||
1964 | string[] cols = new string[dt.Columns.Count]; | ||
1965 | for (int i = 0; i < dt.Columns.Count; i++) | ||
1966 | { | ||
1967 | DataColumn col = dt.Columns[i]; | ||
1968 | cols[i] = col.ColumnName; | ||
1969 | } | ||
1970 | |||
1971 | string sql = "insert into " + table + "("; | ||
1972 | sql += String.Join(", ", cols); | ||
1973 | // important, the first ':' needs to be here, the rest get added in the join | ||
1974 | sql += ") values (:"; | ||
1975 | sql += String.Join(", :", cols); | ||
1976 | sql += ")"; | ||
1977 | SqliteCommand cmd = new SqliteCommand(sql); | ||
1978 | |||
1979 | // this provides the binding for all our parameters, so | ||
1980 | // much less code than it used to be | ||
1981 | foreach (DataColumn col in dt.Columns) | ||
1982 | { | ||
1983 | cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); | ||
1984 | } | ||
1985 | return cmd; | ||
1986 | } | ||
1987 | |||
1988 | |||
1989 | /// <summary> | ||
1990 | /// create an update command | ||
1991 | /// </summary> | ||
1992 | /// <param name="table">table name</param> | ||
1993 | /// <param name="pk"></param> | ||
1994 | /// <param name="dt"></param> | ||
1995 | /// <returns>the created command</returns> | ||
1996 | private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt) | ||
1997 | { | ||
1998 | string sql = "update " + table + " set "; | ||
1999 | string subsql = String.Empty; | ||
2000 | foreach (DataColumn col in dt.Columns) | ||
2001 | { | ||
2002 | if (subsql.Length > 0) | ||
2003 | { | ||
2004 | // a map function would rock so much here | ||
2005 | subsql += ", "; | ||
2006 | } | ||
2007 | subsql += col.ColumnName + "= :" + col.ColumnName; | ||
2008 | } | ||
2009 | sql += subsql; | ||
2010 | sql += " where " + pk; | ||
2011 | SqliteCommand cmd = new SqliteCommand(sql); | ||
2012 | |||
2013 | // this provides the binding for all our parameters, so | ||
2014 | // much less code than it used to be | ||
2015 | |||
2016 | foreach (DataColumn col in dt.Columns) | ||
2017 | { | ||
2018 | cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); | ||
2019 | } | ||
2020 | return cmd; | ||
2021 | } | ||
2022 | |||
2023 | /// <summary> | ||
2024 | /// create an update command | ||
2025 | /// </summary> | ||
2026 | /// <param name="table">table name</param> | ||
2027 | /// <param name="pk"></param> | ||
2028 | /// <param name="dt"></param> | ||
2029 | /// <returns>the created command</returns> | ||
2030 | private static SqliteCommand createUpdateCommand(string table, string pk1, string pk2, DataTable dt) | ||
2031 | { | ||
2032 | string sql = "update " + table + " set "; | ||
2033 | string subsql = String.Empty; | ||
2034 | foreach (DataColumn col in dt.Columns) | ||
2035 | { | ||
2036 | if (subsql.Length > 0) | ||
2037 | { | ||
2038 | // a map function would rock so much here | ||
2039 | subsql += ", "; | ||
2040 | } | ||
2041 | subsql += col.ColumnName + "= :" + col.ColumnName; | ||
2042 | } | ||
2043 | sql += subsql; | ||
2044 | sql += " where " + pk1 + " and " + pk2; | ||
2045 | SqliteCommand cmd = new SqliteCommand(sql); | ||
2046 | |||
2047 | // this provides the binding for all our parameters, so | ||
2048 | // much less code than it used to be | ||
2049 | |||
2050 | foreach (DataColumn col in dt.Columns) | ||
2051 | { | ||
2052 | cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); | ||
2053 | } | ||
2054 | return cmd; | ||
2055 | } | ||
2056 | |||
2057 | /// <summary> | ||
2058 | /// | ||
2059 | /// </summary> | ||
2060 | /// <param name="dt">Data Table</param> | ||
2061 | /// <returns></returns> | ||
2062 | // private static string defineTable(DataTable dt) | ||
2063 | // { | ||
2064 | // string sql = "create table " + dt.TableName + "("; | ||
2065 | // string subsql = String.Empty; | ||
2066 | // foreach (DataColumn col in dt.Columns) | ||
2067 | // { | ||
2068 | // if (subsql.Length > 0) | ||
2069 | // { | ||
2070 | // // a map function would rock so much here | ||
2071 | // subsql += ",\n"; | ||
2072 | // } | ||
2073 | // subsql += col.ColumnName + " " + sqliteType(col.DataType); | ||
2074 | // if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0]) | ||
2075 | // { | ||
2076 | // subsql += " primary key"; | ||
2077 | // } | ||
2078 | // } | ||
2079 | // sql += subsql; | ||
2080 | // sql += ")"; | ||
2081 | // return sql; | ||
2082 | // } | ||
2083 | |||
2084 | /*********************************************************************** | ||
2085 | * | ||
2086 | * Database Binding functions | ||
2087 | * | ||
2088 | * These will be db specific due to typing, and minor differences | ||
2089 | * in databases. | ||
2090 | * | ||
2091 | **********************************************************************/ | ||
2092 | |||
2093 | ///<summary> | ||
2094 | /// This is a convenience function that collapses 5 repetitive | ||
2095 | /// lines for defining SqliteParameters to 2 parameters: | ||
2096 | /// column name and database type. | ||
2097 | /// | ||
2098 | /// It assumes certain conventions like :param as the param | ||
2099 | /// name to replace in parametrized queries, and that source | ||
2100 | /// version is always current version, both of which are fine | ||
2101 | /// for us. | ||
2102 | ///</summary> | ||
2103 | ///<returns>a built sqlite parameter</returns> | ||
2104 | private static SqliteParameter createSqliteParameter(string name, Type type) | ||
2105 | { | ||
2106 | SqliteParameter param = new SqliteParameter(); | ||
2107 | param.ParameterName = ":" + name; | ||
2108 | param.DbType = dbtypeFromType(type); | ||
2109 | param.SourceColumn = name; | ||
2110 | param.SourceVersion = DataRowVersion.Current; | ||
2111 | return param; | ||
2112 | } | ||
2113 | |||
2114 | /// <summary> | ||
2115 | /// | ||
2116 | /// </summary> | ||
2117 | /// <param name="da"></param> | ||
2118 | /// <param name="conn"></param> | ||
2119 | private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
2120 | { | ||
2121 | da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]); | ||
2122 | da.InsertCommand.Connection = conn; | ||
2123 | |||
2124 | da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", ds.Tables["prims"]); | ||
2125 | da.UpdateCommand.Connection = conn; | ||
2126 | |||
2127 | SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); | ||
2128 | delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); | ||
2129 | delete.Connection = conn; | ||
2130 | da.DeleteCommand = delete; | ||
2131 | } | ||
2132 | |||
2133 | /// <summary> | ||
2134 | /// | ||
2135 | /// </summary> | ||
2136 | /// <param name="da"></param> | ||
2137 | /// <param name="conn"></param> | ||
2138 | private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
2139 | { | ||
2140 | da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]); | ||
2141 | da.InsertCommand.Connection = conn; | ||
2142 | |||
2143 | da.UpdateCommand = createUpdateCommand("primitems", "itemID = :itemID", ds.Tables["primitems"]); | ||
2144 | da.UpdateCommand.Connection = conn; | ||
2145 | |||
2146 | SqliteCommand delete = new SqliteCommand("delete from primitems where itemID = :itemID"); | ||
2147 | delete.Parameters.Add(createSqliteParameter("itemID", typeof (String))); | ||
2148 | delete.Connection = conn; | ||
2149 | da.DeleteCommand = delete; | ||
2150 | } | ||
2151 | |||
2152 | /// <summary> | ||
2153 | /// | ||
2154 | /// </summary> | ||
2155 | /// <param name="da"></param> | ||
2156 | /// <param name="conn"></param> | ||
2157 | private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
2158 | { | ||
2159 | da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]); | ||
2160 | da.InsertCommand.Connection = conn; | ||
2161 | } | ||
2162 | |||
2163 | /// <summary> | ||
2164 | /// | ||
2165 | /// </summary> | ||
2166 | /// <param name="da"></param> | ||
2167 | /// <param name="conn"></param> | ||
2168 | private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
2169 | { | ||
2170 | da.InsertCommand = createInsertCommand("land", ds.Tables["land"]); | ||
2171 | da.InsertCommand.Connection = conn; | ||
2172 | |||
2173 | da.UpdateCommand = createUpdateCommand("land", "UUID=:UUID", ds.Tables["land"]); | ||
2174 | da.UpdateCommand.Connection = conn; | ||
2175 | |||
2176 | SqliteCommand delete = new SqliteCommand("delete from land where UUID=:UUID"); | ||
2177 | delete.Parameters.Add(createSqliteParameter("UUID", typeof(String))); | ||
2178 | da.DeleteCommand = delete; | ||
2179 | da.DeleteCommand.Connection = conn; | ||
2180 | } | ||
2181 | |||
2182 | /// <summary> | ||
2183 | /// | ||
2184 | /// </summary> | ||
2185 | /// <param name="da"></param> | ||
2186 | /// <param name="conn"></param> | ||
2187 | private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
2188 | { | ||
2189 | da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]); | ||
2190 | da.InsertCommand.Connection = conn; | ||
2191 | |||
2192 | da.UpdateCommand = createUpdateCommand("landaccesslist", "LandUUID=:landUUID", "AccessUUID=:AccessUUID", ds.Tables["landaccesslist"]); | ||
2193 | da.UpdateCommand.Connection = conn; | ||
2194 | |||
2195 | SqliteCommand delete = new SqliteCommand("delete from landaccesslist where LandUUID= :LandUUID and AccessUUID= :AccessUUID"); | ||
2196 | delete.Parameters.Add(createSqliteParameter("LandUUID", typeof(String))); | ||
2197 | delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); | ||
2198 | da.DeleteCommand = delete; | ||
2199 | da.DeleteCommand.Connection = conn; | ||
2200 | |||
2201 | } | ||
2202 | |||
2203 | private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
2204 | { | ||
2205 | da.InsertCommand = createInsertCommand("regionsettings", ds.Tables["regionsettings"]); | ||
2206 | da.InsertCommand.Connection = conn; | ||
2207 | da.UpdateCommand = createUpdateCommand("regionsettings", "regionUUID=:regionUUID", ds.Tables["regionsettings"]); | ||
2208 | da.UpdateCommand.Connection = conn; | ||
2209 | } | ||
2210 | |||
2211 | /// <summary> | ||
2212 | /// | ||
2213 | /// </summary> | ||
2214 | /// <param name="da"></param> | ||
2215 | /// <param name="conn"></param> | ||
2216 | private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
2217 | { | ||
2218 | da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); | ||
2219 | da.InsertCommand.Connection = conn; | ||
2220 | |||
2221 | da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", ds.Tables["primshapes"]); | ||
2222 | da.UpdateCommand.Connection = conn; | ||
2223 | |||
2224 | SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); | ||
2225 | delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); | ||
2226 | delete.Connection = conn; | ||
2227 | da.DeleteCommand = delete; | ||
2228 | } | ||
2229 | |||
2230 | /*********************************************************************** | ||
2231 | * | ||
2232 | * Type conversion functions | ||
2233 | * | ||
2234 | **********************************************************************/ | ||
2235 | |||
2236 | /// <summary> | ||
2237 | /// Type conversion function | ||
2238 | /// </summary> | ||
2239 | /// <param name="type"></param> | ||
2240 | /// <returns></returns> | ||
2241 | private static DbType dbtypeFromType(Type type) | ||
2242 | { | ||
2243 | if (type == typeof (String)) | ||
2244 | { | ||
2245 | return DbType.String; | ||
2246 | } | ||
2247 | else if (type == typeof (Int32)) | ||
2248 | { | ||
2249 | return DbType.Int32; | ||
2250 | } | ||
2251 | else if (type == typeof (Double)) | ||
2252 | { | ||
2253 | return DbType.Double; | ||
2254 | } | ||
2255 | else if (type == typeof (Byte)) | ||
2256 | { | ||
2257 | return DbType.Byte; | ||
2258 | } | ||
2259 | else if (type == typeof (Double)) | ||
2260 | { | ||
2261 | return DbType.Double; | ||
2262 | } | ||
2263 | else if (type == typeof (Byte[])) | ||
2264 | { | ||
2265 | return DbType.Binary; | ||
2266 | } | ||
2267 | else | ||
2268 | { | ||
2269 | return DbType.String; | ||
2270 | } | ||
2271 | } | ||
2272 | |||
2273 | } | ||
2274 | } | ||
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs deleted file mode 100644 index 27553c6..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using Mono.Data.SqliteClient; | ||
35 | |||
36 | namespace OpenSim.Data.SQLiteLegacy | ||
37 | { | ||
38 | public class SQLiteUserAccountData : SQLiteGenericTableHandler<UserAccountData>, IUserAccountData | ||
39 | { | ||
40 | public SQLiteUserAccountData(string connectionString, string realm) | ||
41 | : base(connectionString, realm, "UserAccount") | ||
42 | { | ||
43 | } | ||
44 | |||
45 | public UserAccountData[] GetUsers(UUID scopeID, string query) | ||
46 | { | ||
47 | string[] words = query.Split(new char[] {' '}); | ||
48 | |||
49 | for (int i = 0 ; i < words.Length ; i++) | ||
50 | { | ||
51 | if (words[i].Length < 3) | ||
52 | { | ||
53 | if (i != words.Length - 1) | ||
54 | Array.Copy(words, i + 1, words, i, words.Length - i - 1); | ||
55 | Array.Resize(ref words, words.Length - 1); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | if (words.Length == 0) | ||
60 | return new UserAccountData[0]; | ||
61 | |||
62 | if (words.Length > 2) | ||
63 | return new UserAccountData[0]; | ||
64 | |||
65 | SqliteCommand cmd = new SqliteCommand(); | ||
66 | |||
67 | if (words.Length == 1) | ||
68 | { | ||
69 | cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')", | ||
70 | m_Realm, scopeID.ToString(), words[0]); | ||
71 | } | ||
72 | else | ||
73 | { | ||
74 | cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%')", | ||
75 | m_Realm, scopeID.ToString(), words[0], words[1]); | ||
76 | } | ||
77 | |||
78 | return DoQuery(cmd); | ||
79 | } | ||
80 | } | ||
81 | } | ||
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteUtils.cs b/OpenSim/Data/SQLiteLegacy/SQLiteUtils.cs deleted file mode 100644 index 095a262..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteUtils.cs +++ /dev/null | |||
@@ -1,307 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Data; | ||
30 | using Mono.Data.SqliteClient; | ||
31 | |||
32 | namespace OpenSim.Data.SQLiteLegacy | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// A base class for methods needed by all SQLite database classes | ||
36 | /// </summary> | ||
37 | public class SQLiteUtil | ||
38 | { | ||
39 | /*********************************************************************** | ||
40 | * | ||
41 | * Database Definition Helper Functions | ||
42 | * | ||
43 | * This should be db agnostic as we define them in ADO.NET terms | ||
44 | * | ||
45 | **********************************************************************/ | ||
46 | |||
47 | /// <summary> | ||
48 | /// | ||
49 | /// </summary> | ||
50 | /// <param name="dt"></param> | ||
51 | /// <param name="name"></param> | ||
52 | /// <param name="type"></param> | ||
53 | public static void createCol(DataTable dt, string name, Type type) | ||
54 | { | ||
55 | DataColumn col = new DataColumn(name, type); | ||
56 | dt.Columns.Add(col); | ||
57 | } | ||
58 | |||
59 | /*********************************************************************** | ||
60 | * | ||
61 | * SQL Statement Creation Functions | ||
62 | * | ||
63 | * These functions create SQL statements for update, insert, and create. | ||
64 | * They can probably be factored later to have a db independant | ||
65 | * portion and a db specific portion | ||
66 | * | ||
67 | **********************************************************************/ | ||
68 | |||
69 | /// <summary> | ||
70 | /// Create an insert command | ||
71 | /// </summary> | ||
72 | /// <param name="table">table name</param> | ||
73 | /// <param name="dt">data table</param> | ||
74 | /// <returns>the created command</returns> | ||
75 | /// <remarks> | ||
76 | /// This is subtle enough to deserve some commentary. | ||
77 | /// Instead of doing *lots* and *lots of hardcoded strings | ||
78 | /// for database definitions we'll use the fact that | ||
79 | /// realistically all insert statements look like "insert | ||
80 | /// into A(b, c) values(:b, :c) on the parameterized query | ||
81 | /// front. If we just have a list of b, c, etc... we can | ||
82 | /// generate these strings instead of typing them out. | ||
83 | /// </remarks> | ||
84 | public static SqliteCommand createInsertCommand(string table, DataTable dt) | ||
85 | { | ||
86 | |||
87 | string[] cols = new string[dt.Columns.Count]; | ||
88 | for (int i = 0; i < dt.Columns.Count; i++) | ||
89 | { | ||
90 | DataColumn col = dt.Columns[i]; | ||
91 | cols[i] = col.ColumnName; | ||
92 | } | ||
93 | |||
94 | string sql = "insert into " + table + "("; | ||
95 | sql += String.Join(", ", cols); | ||
96 | // important, the first ':' needs to be here, the rest get added in the join | ||
97 | sql += ") values (:"; | ||
98 | sql += String.Join(", :", cols); | ||
99 | sql += ")"; | ||
100 | SqliteCommand cmd = new SqliteCommand(sql); | ||
101 | |||
102 | // this provides the binding for all our parameters, so | ||
103 | // much less code than it used to be | ||
104 | foreach (DataColumn col in dt.Columns) | ||
105 | { | ||
106 | cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); | ||
107 | } | ||
108 | return cmd; | ||
109 | } | ||
110 | |||
111 | /// <summary> | ||
112 | /// create an update command | ||
113 | /// </summary> | ||
114 | /// <param name="table">table name</param> | ||
115 | /// <param name="pk"></param> | ||
116 | /// <param name="dt"></param> | ||
117 | /// <returns>the created command</returns> | ||
118 | public static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt) | ||
119 | { | ||
120 | string sql = "update " + table + " set "; | ||
121 | string subsql = String.Empty; | ||
122 | foreach (DataColumn col in dt.Columns) | ||
123 | { | ||
124 | if (subsql.Length > 0) | ||
125 | { | ||
126 | // a map function would rock so much here | ||
127 | subsql += ", "; | ||
128 | } | ||
129 | subsql += col.ColumnName + "= :" + col.ColumnName; | ||
130 | } | ||
131 | sql += subsql; | ||
132 | sql += " where " + pk; | ||
133 | SqliteCommand cmd = new SqliteCommand(sql); | ||
134 | |||
135 | // this provides the binding for all our parameters, so | ||
136 | // much less code than it used to be | ||
137 | |||
138 | foreach (DataColumn col in dt.Columns) | ||
139 | { | ||
140 | cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); | ||
141 | } | ||
142 | return cmd; | ||
143 | } | ||
144 | |||
145 | /// <summary> | ||
146 | /// | ||
147 | /// </summary> | ||
148 | /// <param name="dt">Data Table</param> | ||
149 | /// <returns></returns> | ||
150 | public static string defineTable(DataTable dt) | ||
151 | { | ||
152 | string sql = "create table " + dt.TableName + "("; | ||
153 | string subsql = String.Empty; | ||
154 | foreach (DataColumn col in dt.Columns) | ||
155 | { | ||
156 | if (subsql.Length > 0) | ||
157 | { | ||
158 | // a map function would rock so much here | ||
159 | subsql += ",\n"; | ||
160 | } | ||
161 | subsql += col.ColumnName + " " + sqliteType(col.DataType); | ||
162 | if (dt.PrimaryKey.Length > 0) | ||
163 | { | ||
164 | if (col == dt.PrimaryKey[0]) | ||
165 | { | ||
166 | subsql += " primary key"; | ||
167 | } | ||
168 | } | ||
169 | } | ||
170 | sql += subsql; | ||
171 | sql += ")"; | ||
172 | return sql; | ||
173 | } | ||
174 | |||
175 | /*********************************************************************** | ||
176 | * | ||
177 | * Database Binding functions | ||
178 | * | ||
179 | * These will be db specific due to typing, and minor differences | ||
180 | * in databases. | ||
181 | * | ||
182 | **********************************************************************/ | ||
183 | |||
184 | ///<summary> | ||
185 | /// <para> | ||
186 | /// This is a convenience function that collapses 5 repetitive | ||
187 | /// lines for defining SqliteParameters to 2 parameters: | ||
188 | /// column name and database type. | ||
189 | /// </para> | ||
190 | /// | ||
191 | /// <para> | ||
192 | /// It assumes certain conventions like :param as the param | ||
193 | /// name to replace in parametrized queries, and that source | ||
194 | /// version is always current version, both of which are fine | ||
195 | /// for us. | ||
196 | /// </para> | ||
197 | ///</summary> | ||
198 | /// <param name="name"></param> | ||
199 | /// <param name="type"></param> | ||
200 | ///<returns>a built sqlite parameter</returns> | ||
201 | public static SqliteParameter createSqliteParameter(string name, Type type) | ||
202 | { | ||
203 | SqliteParameter param = new SqliteParameter(); | ||
204 | param.ParameterName = ":" + name; | ||
205 | param.DbType = dbtypeFromType(type); | ||
206 | param.SourceColumn = name; | ||
207 | param.SourceVersion = DataRowVersion.Current; | ||
208 | return param; | ||
209 | } | ||
210 | |||
211 | /*********************************************************************** | ||
212 | * | ||
213 | * Type conversion functions | ||
214 | * | ||
215 | **********************************************************************/ | ||
216 | |||
217 | /// <summary> | ||
218 | /// Type conversion function | ||
219 | /// </summary> | ||
220 | /// <param name="type">a type</param> | ||
221 | /// <returns>a DbType</returns> | ||
222 | public static DbType dbtypeFromType(Type type) | ||
223 | { | ||
224 | if (type == typeof (String)) | ||
225 | { | ||
226 | return DbType.String; | ||
227 | } | ||
228 | else if (type == typeof (Int32)) | ||
229 | { | ||
230 | return DbType.Int32; | ||
231 | } | ||
232 | else if (type == typeof (UInt32)) | ||
233 | { | ||
234 | return DbType.UInt32; | ||
235 | } | ||
236 | else if (type == typeof (Int64)) | ||
237 | { | ||
238 | return DbType.Int64; | ||
239 | } | ||
240 | else if (type == typeof (UInt64)) | ||
241 | { | ||
242 | return DbType.UInt64; | ||
243 | } | ||
244 | else if (type == typeof (Double)) | ||
245 | { | ||
246 | return DbType.Double; | ||
247 | } | ||
248 | else if (type == typeof (Boolean)) | ||
249 | { | ||
250 | return DbType.Boolean; | ||
251 | } | ||
252 | else if (type == typeof (Byte[])) | ||
253 | { | ||
254 | return DbType.Binary; | ||
255 | } | ||
256 | else | ||
257 | { | ||
258 | return DbType.String; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | /// <summary> | ||
263 | /// </summary> | ||
264 | /// <param name="type">a Type</param> | ||
265 | /// <returns>a string</returns> | ||
266 | /// <remarks>this is something we'll need to implement for each db slightly differently.</remarks> | ||
267 | public static string sqliteType(Type type) | ||
268 | { | ||
269 | if (type == typeof (String)) | ||
270 | { | ||
271 | return "varchar(255)"; | ||
272 | } | ||
273 | else if (type == typeof (Int32)) | ||
274 | { | ||
275 | return "integer"; | ||
276 | } | ||
277 | else if (type == typeof (UInt32)) | ||
278 | { | ||
279 | return "integer"; | ||
280 | } | ||
281 | else if (type == typeof (Int64)) | ||
282 | { | ||
283 | return "varchar(255)"; | ||
284 | } | ||
285 | else if (type == typeof (UInt64)) | ||
286 | { | ||
287 | return "varchar(255)"; | ||
288 | } | ||
289 | else if (type == typeof (Double)) | ||
290 | { | ||
291 | return "float"; | ||
292 | } | ||
293 | else if (type == typeof (Boolean)) | ||
294 | { | ||
295 | return "integer"; | ||
296 | } | ||
297 | else if (type == typeof (Byte[])) | ||
298 | { | ||
299 | return "blob"; | ||
300 | } | ||
301 | else | ||
302 | { | ||
303 | return "string"; | ||
304 | } | ||
305 | } | ||
306 | } | ||
307 | } | ||
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteXInventoryData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteXInventoryData.cs deleted file mode 100644 index 5422cbf..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteXInventoryData.cs +++ /dev/null | |||
@@ -1,155 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Data; | ||
30 | using System.Reflection; | ||
31 | using System.Collections.Generic; | ||
32 | using Mono.Data.SqliteClient; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | |||
37 | namespace OpenSim.Data.SQLiteLegacy | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// A MySQL Interface for the Asset Server | ||
41 | /// </summary> | ||
42 | public class SQLiteXInventoryData : IXInventoryData | ||
43 | { | ||
44 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | private SQLiteGenericTableHandler<XInventoryFolder> m_Folders; | ||
47 | private SqliteItemHandler m_Items; | ||
48 | |||
49 | public SQLiteXInventoryData(string conn, string realm) | ||
50 | { | ||
51 | m_Folders = new SQLiteGenericTableHandler<XInventoryFolder>( | ||
52 | conn, "inventoryfolders", "InventoryStore"); | ||
53 | m_Items = new SqliteItemHandler( | ||
54 | conn, "inventoryitems", String.Empty); | ||
55 | } | ||
56 | |||
57 | public XInventoryFolder[] GetFolders(string[] fields, string[] vals) | ||
58 | { | ||
59 | return m_Folders.Get(fields, vals); | ||
60 | } | ||
61 | |||
62 | public XInventoryItem[] GetItems(string[] fields, string[] vals) | ||
63 | { | ||
64 | return m_Items.Get(fields, vals); | ||
65 | } | ||
66 | |||
67 | public bool StoreFolder(XInventoryFolder folder) | ||
68 | { | ||
69 | return m_Folders.Store(folder); | ||
70 | } | ||
71 | |||
72 | public bool StoreItem(XInventoryItem item) | ||
73 | { | ||
74 | return m_Items.Store(item); | ||
75 | } | ||
76 | |||
77 | public bool DeleteFolders(string field, string val) | ||
78 | { | ||
79 | return m_Folders.Delete(field, val); | ||
80 | } | ||
81 | |||
82 | public bool DeleteItems(string field, string val) | ||
83 | { | ||
84 | return m_Items.Delete(field, val); | ||
85 | } | ||
86 | |||
87 | public bool MoveItem(string id, string newParent) | ||
88 | { | ||
89 | return m_Items.MoveItem(id, newParent); | ||
90 | } | ||
91 | |||
92 | public XInventoryItem[] GetActiveGestures(UUID principalID) | ||
93 | { | ||
94 | return m_Items.GetActiveGestures(principalID); | ||
95 | } | ||
96 | |||
97 | public int GetAssetPermissions(UUID principalID, UUID assetID) | ||
98 | { | ||
99 | return m_Items.GetAssetPermissions(principalID, assetID); | ||
100 | } | ||
101 | } | ||
102 | |||
103 | public class SqliteItemHandler : SQLiteGenericTableHandler<XInventoryItem> | ||
104 | { | ||
105 | public SqliteItemHandler(string c, string t, string m) : | ||
106 | base(c, t, m) | ||
107 | { | ||
108 | } | ||
109 | |||
110 | public bool MoveItem(string id, string newParent) | ||
111 | { | ||
112 | SqliteCommand cmd = new SqliteCommand(); | ||
113 | |||
114 | cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where inventoryID = :InventoryID", m_Realm); | ||
115 | cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent)); | ||
116 | cmd.Parameters.Add(new SqliteParameter(":InventoryID", id)); | ||
117 | |||
118 | return ExecuteNonQuery(cmd, m_Connection) == 0 ? false : true; | ||
119 | } | ||
120 | |||
121 | public XInventoryItem[] GetActiveGestures(UUID principalID) | ||
122 | { | ||
123 | SqliteCommand cmd = new SqliteCommand(); | ||
124 | cmd.CommandText = String.Format("select * from inventoryitems where avatarId = :uuid and assetType = :type and flags = 1", m_Realm); | ||
125 | |||
126 | cmd.Parameters.Add(new SqliteParameter(":uuid", principalID.ToString())); | ||
127 | cmd.Parameters.Add(new SqliteParameter(":type", (int)AssetType.Gesture)); | ||
128 | |||
129 | return DoQuery(cmd); | ||
130 | } | ||
131 | |||
132 | public int GetAssetPermissions(UUID principalID, UUID assetID) | ||
133 | { | ||
134 | SqliteCommand cmd = new SqliteCommand(); | ||
135 | |||
136 | cmd.CommandText = String.Format("select inventoryCurrentPermissions from inventoryitems where avatarID = :PrincipalID and assetID = :AssetID", m_Realm); | ||
137 | cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString())); | ||
138 | cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString())); | ||
139 | |||
140 | IDataReader reader = ExecuteReader(cmd, m_Connection); | ||
141 | |||
142 | int perms = 0; | ||
143 | |||
144 | while (reader.Read()) | ||
145 | { | ||
146 | perms |= Convert.ToInt32(reader["inventoryCurrentPermissions"]); | ||
147 | } | ||
148 | |||
149 | reader.Close(); | ||
150 | CloseCommand(cmd); | ||
151 | |||
152 | return perms; | ||
153 | } | ||
154 | } | ||
155 | } | ||
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index a6be157..5bf0b7b 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -1143,7 +1143,17 @@ namespace OpenSim.Framework | |||
1143 | void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, | 1143 | void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, |
1144 | uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner); | 1144 | uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner); |
1145 | 1145 | ||
1146 | void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, | 1146 | /// <summary> |
1147 | /// Send land properties to the client. | ||
1148 | /// </summary> | ||
1149 | /// <param name="sequence_id"></param> | ||
1150 | /// <param name="snap_selection"></param> | ||
1151 | /// <param name="request_result"></param> | ||
1152 | /// <param name="lo"></param></param> | ||
1153 | /// <param name="parcelObjectCapacity">/param> | ||
1154 | /// <param name="simObjectCapacity"></param> | ||
1155 | /// <param name="regionFlags"></param> | ||
1156 | void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, | ||
1147 | float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, | 1157 | float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, |
1148 | uint regionFlags); | 1158 | uint regionFlags); |
1149 | 1159 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index 30bae16..869d4c8 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs | |||
@@ -77,7 +77,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
77 | /// </param> | 77 | /// </param> |
78 | void Clear(bool setupDefaultParcel); | 78 | void Clear(bool setupDefaultParcel); |
79 | 79 | ||
80 | bool IsLandPrimCountTainted(); | ||
81 | bool IsForcefulBansAllowed(); | 80 | bool IsForcefulBansAllowed(); |
82 | void UpdateLandObject(int localID, LandData data); | 81 | void UpdateLandObject(int localID, LandData data); |
83 | void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient); | 82 | void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient); |
diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index eeb9d3a..5a55b02 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs | |||
@@ -27,10 +27,8 @@ | |||
27 | 27 | ||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using OpenMetaverse; | 29 | using OpenMetaverse; |
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Framework.Scenes; | ||
32 | 30 | ||
33 | namespace OpenSim.Region.Framework.Interfaces | 31 | namespace OpenSim.Framework |
34 | { | 32 | { |
35 | public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj); | 33 | public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj); |
36 | public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj); | 34 | public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj); |
@@ -46,6 +44,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
46 | UUID RegionUUID { get; } | 44 | UUID RegionUUID { get; } |
47 | 45 | ||
48 | /// <summary> | 46 | /// <summary> |
47 | /// Prim counts for this land object. | ||
48 | /// </summary> | ||
49 | IPrimCounts PrimCounts { get; set; } | ||
50 | |||
51 | /// <summary> | ||
49 | /// The start point for the land object. This is the western-most point as one scans land working from | 52 | /// The start point for the land object. This is the western-most point as one scans land working from |
50 | /// north to south. | 53 | /// north to south. |
51 | /// </summary> | 54 | /// </summary> |
@@ -79,17 +82,36 @@ namespace OpenSim.Region.Framework.Interfaces | |||
79 | void ForceUpdateLandInfo(); | 82 | void ForceUpdateLandInfo(); |
80 | void SetLandBitmap(bool[,] bitmap); | 83 | void SetLandBitmap(bool[,] bitmap); |
81 | 84 | ||
85 | /// <summary> | ||
86 | /// Get a land bitmap that would cover an entire region. | ||
87 | /// </summary> | ||
88 | /// <returns>The bitmap created.</returns> | ||
82 | bool[,] BasicFullRegionLandBitmap(); | 89 | bool[,] BasicFullRegionLandBitmap(); |
90 | |||
91 | /// <summary> | ||
92 | /// Create a square land bitmap. | ||
93 | /// </summary> | ||
94 | /// <remarks> | ||
95 | /// Land co-ordinates are zero indexed. The inputs are treated as points. So if you want to create a bitmap | ||
96 | /// that covers an entire 256 x 256m region apart from a strip of land on the east, then you would need to | ||
97 | /// specify start_x = 0, start_y = 0, end_x = 252 (or anything up to 255), end_y = 256. | ||
98 | /// | ||
99 | /// At the moment, the smallest parcel of land is 4m x 4m, so if the | ||
100 | /// region is 256 x 256m (the SL size), the bitmap returned will start at (0,0) and end at (63,63). | ||
101 | /// </remarks> | ||
102 | /// <param name="start_x"></param> | ||
103 | /// <param name="start_y"></param> | ||
104 | /// <param name="end_x"></param> | ||
105 | /// <param name="end_y"></param> | ||
106 | /// <returns>The bitmap created.</returns> | ||
83 | bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y); | 107 | bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y); |
108 | |||
84 | bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value); | 109 | bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value); |
85 | bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add); | 110 | bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add); |
86 | void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client); | 111 | void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client); |
87 | void SendLandObjectOwners(IClientAPI remote_client); | 112 | void SendLandObjectOwners(IClientAPI remote_client); |
88 | void ReturnObject(SceneObjectGroup obj); | ||
89 | void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client); | 113 | void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client); |
90 | void ResetLandPrimCounts(); | 114 | void ResetOverMeRecord(); |
91 | void AddPrimToCount(SceneObjectGroup obj); | ||
92 | void RemovePrimFromCount(SceneObjectGroup obj); | ||
93 | void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area); | 115 | void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area); |
94 | 116 | ||
95 | void DeedToGroup(UUID groupID); | 117 | void DeedToGroup(UUID groupID); |
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteAvatarData.cs b/OpenSim/Framework/IPrimCounts.cs index 660632c..3e12348 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteAvatarData.cs +++ b/OpenSim/Framework/IPrimCounts.cs | |||
@@ -25,50 +25,50 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | 28 | using OpenMetaverse; |
35 | using OpenSim.Framework; | ||
36 | using Mono.Data.SqliteClient; | ||
37 | 29 | ||
38 | namespace OpenSim.Data.SQLiteLegacy | 30 | namespace OpenSim.Framework |
39 | { | 31 | { |
40 | /// <summary> | 32 | public interface IPrimCounts |
41 | /// A SQLite Interface for Avatar Data | ||
42 | /// </summary> | ||
43 | public class SQLiteAvatarData : SQLiteGenericTableHandler<AvatarBaseData>, | ||
44 | IAvatarData | ||
45 | { | 33 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 34 | /// <summary> |
35 | /// Parcel owner owned prims | ||
36 | /// </summary> | ||
37 | int Owner { get; } | ||
38 | |||
39 | /// <summary> | ||
40 | /// Parcel group owned prims | ||
41 | /// </summary> | ||
42 | int Group { get; } | ||
43 | |||
44 | /// <summary> | ||
45 | /// Prims owned by others (not parcel owner or parcel group). | ||
46 | /// </summary> | ||
47 | int Others { get; } | ||
47 | 48 | ||
48 | public SQLiteAvatarData(string connectionString, string realm) : | 49 | /// <summary> |
49 | base(connectionString, realm, "Avatar") | 50 | /// Selected prims |
50 | { | 51 | /// </summary> |
51 | } | 52 | int Selected { get; } |
52 | 53 | ||
53 | public bool Delete(UUID principalID, string name) | 54 | /// <summary> |
54 | { | 55 | /// Total prims on the parcel. |
55 | SqliteCommand cmd = new SqliteCommand(); | 56 | /// </summary> |
56 | 57 | int Total { get; } | |
57 | cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm); | 58 | |
58 | cmd.Parameters.Add(":PrincipalID", principalID.ToString()); | 59 | /// <summary> |
59 | cmd.Parameters.Add(":Name", name); | 60 | /// Prims on the simulator that are owned by the parcel owner, even if they are in other parcels. |
60 | 61 | /// </summary> | |
61 | try | 62 | int Simulator { get; } |
62 | { | 63 | |
63 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | 64 | /// <summary> |
64 | return true; | 65 | /// Prims per individual users. |
66 | /// </summary> | ||
67 | IUserPrimCounts Users { get; } | ||
68 | } | ||
65 | 69 | ||
66 | return false; | 70 | public interface IUserPrimCounts |
67 | } | 71 | { |
68 | finally | 72 | int this[UUID agentID] { get; } |
69 | { | ||
70 | CloseCommand(cmd); | ||
71 | } | ||
72 | } | ||
73 | } | 73 | } |
74 | } | 74 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index a9a493d..c107143 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs | |||
@@ -54,12 +54,10 @@ namespace OpenSim.Framework | |||
54 | private int _claimPrice = 0; //Unemplemented | 54 | private int _claimPrice = 0; //Unemplemented |
55 | private UUID _globalID = UUID.Zero; | 55 | private UUID _globalID = UUID.Zero; |
56 | private UUID _groupID = UUID.Zero; | 56 | private UUID _groupID = UUID.Zero; |
57 | private int _groupPrims = 0; | ||
58 | private bool _isGroupOwned = false; | 57 | private bool _isGroupOwned = false; |
59 | private byte[] _bitmap = new byte[512]; | 58 | private byte[] _bitmap = new byte[512]; |
60 | private string _description = String.Empty; | 59 | private string _description = String.Empty; |
61 | 60 | ||
62 | |||
63 | private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark | | 61 | private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark | |
64 | (uint) ParcelFlags.AllowAPrimitiveEntry | | 62 | (uint) ParcelFlags.AllowAPrimitiveEntry | |
65 | (uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform | | 63 | (uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform | |
@@ -72,17 +70,13 @@ namespace OpenSim.Framework | |||
72 | private int _localID = 0; | 70 | private int _localID = 0; |
73 | private byte _mediaAutoScale = 0; | 71 | private byte _mediaAutoScale = 0; |
74 | private UUID _mediaID = UUID.Zero; | 72 | private UUID _mediaID = UUID.Zero; |
75 | |||
76 | private string _mediaURL = String.Empty; | 73 | private string _mediaURL = String.Empty; |
77 | private string _musicURL = String.Empty; | 74 | private string _musicURL = String.Empty; |
78 | private int _otherPrims = 0; | ||
79 | private UUID _ownerID = UUID.Zero; | 75 | private UUID _ownerID = UUID.Zero; |
80 | private int _ownerPrims = 0; | ||
81 | private List<ParcelManager.ParcelAccessEntry> _parcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); | 76 | private List<ParcelManager.ParcelAccessEntry> _parcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); |
82 | private float _passHours = 0; | 77 | private float _passHours = 0; |
83 | private int _passPrice = 0; | 78 | private int _passPrice = 0; |
84 | private int _salePrice = 0; //Unemeplemented. Parcels price. | 79 | private int _salePrice = 0; //Unemeplemented. Parcels price. |
85 | private int _selectedPrims = 0; | ||
86 | private int _simwideArea = 0; | 80 | private int _simwideArea = 0; |
87 | private int _simwidePrims = 0; | 81 | private int _simwidePrims = 0; |
88 | private UUID _snapshotID = UUID.Zero; | 82 | private UUID _snapshotID = UUID.Zero; |
@@ -284,19 +278,6 @@ namespace OpenSim.Framework | |||
284 | } | 278 | } |
285 | 279 | ||
286 | /// <summary> | 280 | /// <summary> |
287 | /// Number of SceneObjectPart that are owned by a Group | ||
288 | /// </summary> | ||
289 | [XmlIgnore] | ||
290 | public int GroupPrims { | ||
291 | get { | ||
292 | return _groupPrims; | ||
293 | } | ||
294 | set { | ||
295 | _groupPrims = value; | ||
296 | } | ||
297 | } | ||
298 | |||
299 | /// <summary> | ||
300 | /// Returns true if the Land Parcel is owned by a group | 281 | /// Returns true if the Land Parcel is owned by a group |
301 | /// </summary> | 282 | /// </summary> |
302 | public bool IsGroupOwned { | 283 | public bool IsGroupOwned { |
@@ -454,20 +435,6 @@ namespace OpenSim.Framework | |||
454 | } | 435 | } |
455 | 436 | ||
456 | /// <summary> | 437 | /// <summary> |
457 | /// Number of SceneObjectPart that are owned by users who do not own the parcel | ||
458 | /// and don't have the 'group. These are elegable for AutoReturn collection | ||
459 | /// </summary> | ||
460 | [XmlIgnore] | ||
461 | public int OtherPrims { | ||
462 | get { | ||
463 | return _otherPrims; | ||
464 | } | ||
465 | set { | ||
466 | _otherPrims = value; | ||
467 | } | ||
468 | } | ||
469 | |||
470 | /// <summary> | ||
471 | /// Owner Avatar or Group of the parcel. Naturally, all land masses must be | 438 | /// Owner Avatar or Group of the parcel. Naturally, all land masses must be |
472 | /// owned by someone | 439 | /// owned by someone |
473 | /// </summary> | 440 | /// </summary> |
@@ -481,19 +448,6 @@ namespace OpenSim.Framework | |||
481 | } | 448 | } |
482 | 449 | ||
483 | /// <summary> | 450 | /// <summary> |
484 | /// Number of SceneObjectPart that are owned by the owner of the parcel | ||
485 | /// </summary> | ||
486 | [XmlIgnore] | ||
487 | public int OwnerPrims { | ||
488 | get { | ||
489 | return _ownerPrims; | ||
490 | } | ||
491 | set { | ||
492 | _ownerPrims = value; | ||
493 | } | ||
494 | } | ||
495 | |||
496 | /// <summary> | ||
497 | /// List of access data for the parcel. User data, some bitflags, and a time | 451 | /// List of access data for the parcel. User data, some bitflags, and a time |
498 | /// </summary> | 452 | /// </summary> |
499 | public List<ParcelManager.ParcelAccessEntry> ParcelAccessList { | 453 | public List<ParcelManager.ParcelAccessEntry> ParcelAccessList { |
@@ -542,19 +496,6 @@ namespace OpenSim.Framework | |||
542 | } | 496 | } |
543 | 497 | ||
544 | /// <summary> | 498 | /// <summary> |
545 | /// Number of SceneObjectPart that are currently selected by avatar | ||
546 | /// </summary> | ||
547 | [XmlIgnore] | ||
548 | public int SelectedPrims { | ||
549 | get { | ||
550 | return _selectedPrims; | ||
551 | } | ||
552 | set { | ||
553 | _selectedPrims = value; | ||
554 | } | ||
555 | } | ||
556 | |||
557 | /// <summary> | ||
558 | /// Number of meters^2 in the Simulator | 499 | /// Number of meters^2 in the Simulator |
559 | /// </summary> | 500 | /// </summary> |
560 | [XmlIgnore] | 501 | [XmlIgnore] |
@@ -619,7 +560,7 @@ namespace OpenSim.Framework | |||
619 | } | 560 | } |
620 | 561 | ||
621 | /// <summary> | 562 | /// <summary> |
622 | /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own | 563 | /// Autoreturn number of minutes to return SceneObjectGroup that are owned by someone who doesn't own |
623 | /// the parcel and isn't set to the same 'group' as the parcel. | 564 | /// the parcel and isn't set to the same 'group' as the parcel. |
624 | /// </summary> | 565 | /// </summary> |
625 | public int OtherCleanTime { | 566 | public int OtherCleanTime { |
@@ -666,10 +607,6 @@ namespace OpenSim.Framework | |||
666 | landData._claimPrice = _claimPrice; | 607 | landData._claimPrice = _claimPrice; |
667 | landData._globalID = _globalID; | 608 | landData._globalID = _globalID; |
668 | landData._groupID = _groupID; | 609 | landData._groupID = _groupID; |
669 | landData._groupPrims = _groupPrims; | ||
670 | landData._otherPrims = _otherPrims; | ||
671 | landData._ownerPrims = _ownerPrims; | ||
672 | landData._selectedPrims = _selectedPrims; | ||
673 | landData._isGroupOwned = _isGroupOwned; | 610 | landData._isGroupOwned = _isGroupOwned; |
674 | landData._localID = _localID; | 611 | landData._localID = _localID; |
675 | landData._landingType = _landingType; | 612 | landData._landingType = _landingType; |
@@ -731,4 +668,4 @@ namespace OpenSim.Framework | |||
731 | return land; | 668 | return land; |
732 | } | 669 | } |
733 | } | 670 | } |
734 | } | 671 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 680e702..daf0a25 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -347,7 +347,6 @@ namespace OpenSim.Framework | |||
347 | 347 | ||
348 | public bool commFailTF = false; | 348 | public bool commFailTF = false; |
349 | public ConfigurationMember configMember; | 349 | public ConfigurationMember configMember; |
350 | public string DataStore = String.Empty; | ||
351 | public string RegionFile = String.Empty; | 350 | public string RegionFile = String.Empty; |
352 | public bool isSandbox = false; | 351 | public bool isSandbox = false; |
353 | public bool Persistent = true; | 352 | public bool Persistent = true; |
@@ -746,10 +745,6 @@ namespace OpenSim.Framework | |||
746 | m_regionLocX = Convert.ToUInt32(locationElements[0]); | 745 | m_regionLocX = Convert.ToUInt32(locationElements[0]); |
747 | m_regionLocY = Convert.ToUInt32(locationElements[1]); | 746 | m_regionLocY = Convert.ToUInt32(locationElements[1]); |
748 | 747 | ||
749 | |||
750 | // Datastore (is this implemented? Omitted from example!) | ||
751 | DataStore = config.GetString("Datastore", String.Empty); | ||
752 | |||
753 | // Internal IP | 748 | // Internal IP |
754 | IPAddress address; | 749 | IPAddress address; |
755 | 750 | ||
@@ -846,9 +841,6 @@ namespace OpenSim.Framework | |||
846 | string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); | 841 | string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); |
847 | config.Set("Location", location); | 842 | config.Set("Location", location); |
848 | 843 | ||
849 | if (DataStore != String.Empty) | ||
850 | config.Set("Datastore", DataStore); | ||
851 | |||
852 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); | 844 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); |
853 | config.Set("InternalPort", m_internalEndPoint.Port); | 845 | config.Set("InternalPort", m_internalEndPoint.Port); |
854 | 846 | ||
@@ -1025,9 +1017,6 @@ namespace OpenSim.Framework | |||
1025 | case "sim_location_y": | 1017 | case "sim_location_y": |
1026 | m_regionLocY = (uint) configuration_result; | 1018 | m_regionLocY = (uint) configuration_result; |
1027 | break; | 1019 | break; |
1028 | case "datastore": | ||
1029 | DataStore = (string) configuration_result; | ||
1030 | break; | ||
1031 | case "internal_ip_address": | 1020 | case "internal_ip_address": |
1032 | IPAddress address = (IPAddress) configuration_result; | 1021 | IPAddress address = (IPAddress) configuration_result; |
1033 | m_internalEndPoint = new IPEndPoint(address, 0); | 1022 | m_internalEndPoint = new IPEndPoint(address, 0); |
@@ -1175,11 +1164,6 @@ namespace OpenSim.Framework | |||
1175 | return regionInfo; | 1164 | return regionInfo; |
1176 | } | 1165 | } |
1177 | 1166 | ||
1178 | public int getInternalEndPointPort() | ||
1179 | { | ||
1180 | return m_internalEndPoint.Port; | ||
1181 | } | ||
1182 | |||
1183 | public Dictionary<string, object> ToKeyValuePairs() | 1167 | public Dictionary<string, object> ToKeyValuePairs() |
1184 | { | 1168 | { |
1185 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | 1169 | Dictionary<string, object> kvp = new Dictionary<string, object>(); |
@@ -1198,4 +1182,4 @@ namespace OpenSim.Framework | |||
1198 | return kvp; | 1182 | return kvp; |
1199 | } | 1183 | } |
1200 | } | 1184 | } |
1201 | } | 1185 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs index 63e09ae..0aae4ff 100644 --- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs +++ b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs | |||
@@ -25,15 +25,19 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | ||
28 | using System; | 29 | using System; |
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.IO; | 31 | using System.IO; |
32 | using System.Reflection; | ||
31 | using Nini.Config; | 33 | using Nini.Config; |
32 | 34 | ||
33 | namespace OpenSim.Framework.RegionLoader.Filesystem | 35 | namespace OpenSim.Framework.RegionLoader.Filesystem |
34 | { | 36 | { |
35 | public class RegionLoaderFileSystem : IRegionLoader | 37 | public class RegionLoaderFileSystem : IRegionLoader |
36 | { | 38 | { |
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | |||
37 | private IConfigSource m_configSource; | 41 | private IConfigSource m_configSource; |
38 | 42 | ||
39 | public void SetIniConfigSource(IConfigSource configSource) | 43 | public void SetIniConfigSource(IConfigSource configSource) |
@@ -63,36 +67,48 @@ namespace OpenSim.Framework.RegionLoader.Filesystem | |||
63 | string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); | 67 | string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); |
64 | string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); | 68 | string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); |
65 | 69 | ||
70 | // Create an empty Regions.ini if there are no existing config files. | ||
66 | if (configFiles.Length == 0 && iniFiles.Length == 0) | 71 | if (configFiles.Length == 0 && iniFiles.Length == 0) |
67 | { | 72 | { |
68 | new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource); | 73 | new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource); |
69 | iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); | 74 | iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); |
70 | } | 75 | } |
76 | |||
77 | m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config files from {0}", regionConfigPath); | ||
71 | 78 | ||
72 | List<RegionInfo> regionInfos = new List<RegionInfo>(); | 79 | List<RegionInfo> regionInfos = new List<RegionInfo>(); |
73 | 80 | ||
74 | int i = 0; | 81 | int i = 0; |
75 | foreach (string file in iniFiles) | 82 | foreach (string file in iniFiles) |
76 | { | 83 | { |
84 | m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file); | ||
85 | |||
77 | IConfigSource source = new IniConfigSource(file); | 86 | IConfigSource source = new IniConfigSource(file); |
78 | 87 | ||
79 | foreach (IConfig config in source.Configs) | 88 | foreach (IConfig config in source.Configs) |
80 | { | 89 | { |
81 | //m_log.Info("[REGIONLOADERFILESYSTEM]: Creating RegionInfo for " + config.Name); | ||
82 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name); | 90 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name); |
83 | regionInfos.Add(regionInfo); | 91 | regionInfos.Add(regionInfo); |
92 | |||
93 | m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName); | ||
94 | |||
84 | i++; | 95 | i++; |
85 | } | 96 | } |
86 | } | 97 | } |
87 | 98 | ||
88 | foreach (string file in configFiles) | 99 | foreach (string file in configFiles) |
89 | { | 100 | { |
101 | m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file); | ||
102 | |||
90 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource); | 103 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource); |
91 | regionInfos.Add(regionInfo); | 104 | regionInfos.Add(regionInfo); |
105 | |||
106 | m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName); | ||
107 | |||
92 | i++; | 108 | i++; |
93 | } | 109 | } |
94 | 110 | ||
95 | return regionInfos.ToArray(); | 111 | return regionInfos.ToArray(); |
96 | } | 112 | } |
97 | } | 113 | } |
98 | } | 114 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index 0ec4af5..de4898a 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | |||
@@ -66,9 +66,9 @@ namespace OpenSim.Framework.RegionLoader.Web | |||
66 | { | 66 | { |
67 | HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); | 67 | HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); |
68 | webRequest.Timeout = 30000; //30 Second Timeout | 68 | webRequest.Timeout = 30000; //30 Second Timeout |
69 | m_log.Debug("[WEBLOADER]: Sending Download Request..."); | 69 | m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); |
70 | HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); | 70 | HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); |
71 | m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server..."); | 71 | m_log.Debug("[WEBLOADER]: Downloading region information..."); |
72 | StreamReader reader = new StreamReader(webResponse.GetResponseStream()); | 72 | StreamReader reader = new StreamReader(webResponse.GetResponseStream()); |
73 | string xmlSource = String.Empty; | 73 | string xmlSource = String.Empty; |
74 | string tempStr = reader.ReadLine(); | 74 | string tempStr = reader.ReadLine(); |
diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs index 70e87b3..c69c89d 100644 --- a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs +++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs | |||
@@ -42,10 +42,7 @@ namespace OpenSim.Framework.Serialization.Tests | |||
42 | private LandData landWithParcelAccessList; | 42 | private LandData landWithParcelAccessList; |
43 | 43 | ||
44 | private static string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>"; | 44 | private static string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>"; |
45 | private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>2009-10-01T00:00:00</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>2010-10-20T00:00:00</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>"; | 45 | private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>2009-10-01T00:00:00</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>2010-10-20T00:00:00</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>"; |
46 | |||
47 | |||
48 | |||
49 | 46 | ||
50 | [SetUp] | 47 | [SetUp] |
51 | public void setup() | 48 | public void setup() |
@@ -62,7 +59,6 @@ namespace OpenSim.Framework.Serialization.Tests | |||
62 | this.land.ClaimPrice = 0; | 59 | this.land.ClaimPrice = 0; |
63 | this.land.GlobalID = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50"); | 60 | this.land.GlobalID = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50"); |
64 | this.land.GroupID = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5"); | 61 | this.land.GroupID = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5"); |
65 | this.land.GroupPrims = 0; | ||
66 | this.land.Description = "land data to test LandDataSerializer"; | 62 | this.land.Description = "land data to test LandDataSerializer"; |
67 | this.land.Flags = (uint)(ParcelFlags.AllowDamage | ParcelFlags.AllowVoiceChat); | 63 | this.land.Flags = (uint)(ParcelFlags.AllowDamage | ParcelFlags.AllowVoiceChat); |
68 | this.land.LandingType = (byte)LandingType.Direct; | 64 | this.land.LandingType = (byte)LandingType.Direct; |
@@ -132,4 +128,4 @@ namespace OpenSim.Framework.Serialization.Tests | |||
132 | "Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)"); | 128 | "Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)"); |
133 | } | 129 | } |
134 | } | 130 | } |
135 | } | 131 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index d120f03..7e320e6 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -250,9 +250,7 @@ namespace OpenSim | |||
250 | m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false); | 250 | m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false); |
251 | 251 | ||
252 | // load Crash directory config | 252 | // load Crash directory config |
253 | m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); | 253 | m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); |
254 | |||
255 | |||
256 | 254 | ||
257 | if (background) | 255 | if (background) |
258 | { | 256 | { |
@@ -260,15 +258,9 @@ namespace OpenSim | |||
260 | m_sim.Startup(); | 258 | m_sim.Startup(); |
261 | } | 259 | } |
262 | else | 260 | else |
263 | { | 261 | { |
264 | |||
265 | |||
266 | |||
267 | |||
268 | m_sim = new OpenSim(configSource); | 262 | m_sim = new OpenSim(configSource); |
269 | 263 | ||
270 | |||
271 | |||
272 | m_sim.Startup(); | 264 | m_sim.Startup(); |
273 | 265 | ||
274 | while (true) | 266 | while (true) |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 4081888..39004d4 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -123,7 +123,7 @@ namespace OpenSim | |||
123 | m_log.Info("===================================================================="); | 123 | m_log.Info("===================================================================="); |
124 | m_log.Info("========================= STARTING OPENSIM ========================="); | 124 | m_log.Info("========================= STARTING OPENSIM ========================="); |
125 | m_log.Info("===================================================================="); | 125 | m_log.Info("===================================================================="); |
126 | m_log.InfoFormat("[OPENSIM MAIN]: Running "); | 126 | |
127 | //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString()); | 127 | //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString()); |
128 | // http://msdn.microsoft.com/en-us/library/bb384202.aspx | 128 | // http://msdn.microsoft.com/en-us/library/bb384202.aspx |
129 | //GCSettings.LatencyMode = GCLatencyMode.Batch; | 129 | //GCSettings.LatencyMode = GCLatencyMode.Batch; |
@@ -341,10 +341,15 @@ namespace OpenSim | |||
341 | 341 | ||
342 | m_console.Commands.AddCommand("region", false, "config get", | 342 | m_console.Commands.AddCommand("region", false, "config get", |
343 | "config get [<section>] [<key>]", | 343 | "config get [<section>] [<key>]", |
344 | "Show a config option", | 344 | "Synonym for config show", |
345 | HandleConfig); | ||
346 | |||
347 | m_console.Commands.AddCommand("region", false, "config show", | ||
348 | "config show [<section>] [<key>]", | ||
349 | "Show config information", | ||
345 | "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine | 350 | "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine |
346 | + "If a section is given but not a field, then all fields in that section are printed.", | 351 | + "If a section is given but not a field, then all fields in that section are printed.", |
347 | HandleConfig); | 352 | HandleConfig); |
348 | 353 | ||
349 | m_console.Commands.AddCommand("region", false, "config save", | 354 | m_console.Commands.AddCommand("region", false, "config save", |
350 | "config save <path>", | 355 | "config save <path>", |
@@ -593,7 +598,9 @@ namespace OpenSim | |||
593 | 598 | ||
594 | if (cmdparams.Length > 0) | 599 | if (cmdparams.Length > 0) |
595 | { | 600 | { |
596 | switch (cmdparams[0].ToLower()) | 601 | string firstParam = cmdparams[0].ToLower(); |
602 | |||
603 | switch (firstParam) | ||
597 | { | 604 | { |
598 | case "set": | 605 | case "set": |
599 | if (cmdparams.Length < 4) | 606 | if (cmdparams.Length < 4) |
@@ -618,6 +625,7 @@ namespace OpenSim | |||
618 | break; | 625 | break; |
619 | 626 | ||
620 | case "get": | 627 | case "get": |
628 | case "show": | ||
621 | if (cmdparams.Length == 1) | 629 | if (cmdparams.Length == 1) |
622 | { | 630 | { |
623 | foreach (IConfig config in m_config.Source.Configs) | 631 | foreach (IConfig config in m_config.Source.Configs) |
@@ -654,8 +662,8 @@ namespace OpenSim | |||
654 | } | 662 | } |
655 | else | 663 | else |
656 | { | 664 | { |
657 | Notice("Syntax: config get [<section>] [<key>]"); | 665 | Notice("Syntax: config {0} [<section>] [<key>]", firstParam); |
658 | Notice("Example: config get ScriptEngine.DotNetEngine NumberOfScriptThreads"); | 666 | Notice("Example: config {0} ScriptEngine.DotNetEngine NumberOfScriptThreads", firstParam); |
659 | } | 667 | } |
660 | 668 | ||
661 | break; | 669 | break; |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index e950613..ea9edf6 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -793,66 +793,112 @@ namespace OpenSim | |||
793 | } | 793 | } |
794 | 794 | ||
795 | /// <summary> | 795 | /// <summary> |
796 | /// Load the estate information for the provided RegionInfo object. | 796 | /// Create an estate with an initial region. |
797 | /// </summary> | 797 | /// </summary> |
798 | /// <remarks> | ||
799 | /// This method doesn't allow an estate to be created with the same name as existing estates. | ||
800 | /// </remarks> | ||
798 | /// <param name="regInfo"></param> | 801 | /// <param name="regInfo"></param> |
799 | public void PopulateRegionEstateInfo(RegionInfo regInfo) | 802 | /// <param name="existingName">A list of estate names that already exist.</param> |
803 | /// <returns>true if the estate was created, false otherwise</returns> | ||
804 | public bool CreateEstate(RegionInfo regInfo, List<string> existingNames) | ||
800 | { | 805 | { |
801 | IEstateDataService estateDataService = EstateDataService; | 806 | // Create a new estate |
807 | regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); | ||
808 | string newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); | ||
802 | 809 | ||
803 | if (estateDataService != null) | 810 | if (existingNames.Contains(newName)) |
804 | { | 811 | { |
805 | regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false); | 812 | MainConsole.Instance.OutputFormat("An estate named {0} already exists. Please try again.", newName); |
813 | return false; | ||
806 | } | 814 | } |
815 | |||
816 | regInfo.EstateSettings.EstateName = newName; | ||
817 | |||
818 | // FIXME: Later on, the scene constructor will reload the estate settings no matter what. | ||
819 | // Therefore, we need to do an initial save here otherwise the new estate name will be reset | ||
820 | // back to the default. The reloading of estate settings by scene could be eliminated if it | ||
821 | // knows that the passed in settings in RegionInfo are already valid. Also, it might be | ||
822 | // possible to eliminate some additional later saves made by callers of this method. | ||
823 | regInfo.EstateSettings.Save(); | ||
824 | |||
825 | return true; | ||
826 | } | ||
827 | |||
828 | /// <summary> | ||
829 | /// Load the estate information for the provided RegionInfo object. | ||
830 | /// </summary> | ||
831 | /// <param name="regInfo"></param> | ||
832 | public void PopulateRegionEstateInfo(RegionInfo regInfo) | ||
833 | { | ||
834 | if (EstateDataService != null) | ||
835 | regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, false); | ||
807 | 836 | ||
808 | if (regInfo.EstateSettings.EstateID == 0) // No record at all | 837 | if (regInfo.EstateSettings.EstateID == 0) // No record at all |
809 | { | 838 | { |
810 | MainConsole.Instance.Output("Your region is not part of an estate."); | 839 | MainConsole.Instance.OutputFormat("Region {0} is not part of an estate.", regInfo.RegionName); |
840 | |||
841 | List<EstateSettings> estates = EstateDataService.LoadEstateSettingsAll(); | ||
842 | List<string> estateNames = new List<string>(); | ||
843 | foreach (EstateSettings estate in estates) | ||
844 | estateNames.Add(estate.EstateName); | ||
845 | |||
811 | while (true) | 846 | while (true) |
812 | { | 847 | { |
813 | string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() { "yes", "no" }); | 848 | if (estates.Count == 0) |
814 | if (response == "no") | 849 | { |
815 | { | 850 | MainConsole.Instance.Output("No existing estates found. You must create a new one."); |
816 | // Create a new estate | ||
817 | regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true); | ||
818 | |||
819 | regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); | ||
820 | 851 | ||
821 | // FIXME: Later on, the scene constructor will reload the estate settings no matter what. | 852 | if (CreateEstate(regInfo, estateNames)) |
822 | // Therefore, we need to do an initial save here otherwise the new estate name will be reset | 853 | break; |
823 | // back to the default. The reloading of estate settings by scene could be eliminated if it | 854 | else |
824 | // knows that the passed in settings in RegionInfo are already valid. Also, it might be | 855 | continue; |
825 | // possible to eliminate some additional later saves made by callers of this method. | ||
826 | regInfo.EstateSettings.Save(); | ||
827 | break; | ||
828 | } | 856 | } |
829 | else | 857 | else |
830 | { | 858 | { |
831 | response = MainConsole.Instance.CmdPrompt("Estate name to join", "None"); | 859 | string response |
832 | if (response == "None") | 860 | = MainConsole.Instance.CmdPrompt( |
833 | continue; | 861 | string.Format( |
834 | 862 | "Do you wish to join region {0} to an existing estate (yes/no)?", regInfo.RegionName), | |
835 | List<int> estateIDs = estateDataService.GetEstates(response); | 863 | "yes", |
836 | if (estateIDs.Count < 1) | 864 | new List<string>() { "yes", "no" }); |
865 | |||
866 | if (response == "no") | ||
837 | { | 867 | { |
838 | MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); | 868 | if (CreateEstate(regInfo, estateNames)) |
839 | continue; | 869 | break; |
870 | else | ||
871 | continue; | ||
872 | } | ||
873 | else | ||
874 | { | ||
875 | response | ||
876 | = MainConsole.Instance.CmdPrompt( | ||
877 | string.Format( | ||
878 | "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())), | ||
879 | estateNames[0]); | ||
880 | |||
881 | List<int> estateIDs = EstateDataService.GetEstates(response); | ||
882 | if (estateIDs.Count < 1) | ||
883 | { | ||
884 | MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again."); | ||
885 | continue; | ||
886 | } | ||
887 | |||
888 | int estateID = estateIDs[0]; | ||
889 | |||
890 | regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID); | ||
891 | |||
892 | if (EstateDataService.LinkRegion(regInfo.RegionID, estateID)) | ||
893 | break; | ||
894 | |||
895 | MainConsole.Instance.Output("Joining the estate failed. Please try again."); | ||
840 | } | 896 | } |
841 | |||
842 | int estateID = estateIDs[0]; | ||
843 | |||
844 | regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID); | ||
845 | |||
846 | if (estateDataService.LinkRegion(regInfo.RegionID, estateID)) | ||
847 | break; | ||
848 | |||
849 | MainConsole.Instance.Output("Joining the estate failed. Please try again."); | ||
850 | } | 897 | } |
851 | } | 898 | } |
852 | } | 899 | } |
853 | } | 900 | } |
854 | } | 901 | } |
855 | |||
856 | 902 | ||
857 | public class OpenSimConfigSource | 903 | public class OpenSimConfigSource |
858 | { | 904 | { |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2c6795f..8de31d7 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -49,6 +49,8 @@ using Timer = System.Timers.Timer; | |||
49 | using AssetLandmark = OpenSim.Framework.AssetLandmark; | 49 | using AssetLandmark = OpenSim.Framework.AssetLandmark; |
50 | using Nini.Config; | 50 | using Nini.Config; |
51 | 51 | ||
52 | using System.IO; | ||
53 | |||
52 | namespace OpenSim.Region.ClientStack.LindenUDP | 54 | namespace OpenSim.Region.ClientStack.LindenUDP |
53 | { | 55 | { |
54 | public delegate bool PacketMethod(IClientAPI simClient, Packet packet); | 56 | public delegate bool PacketMethod(IClientAPI simClient, Packet packet); |
@@ -298,6 +300,77 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
298 | /// <summary>Used to adjust Sun Orbit values so Linden based viewers properly position sun</summary> | 300 | /// <summary>Used to adjust Sun Orbit values so Linden based viewers properly position sun</summary> |
299 | private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f; | 301 | private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f; |
300 | 302 | ||
303 | // First log file or time has expired, start writing to a new log file | ||
304 | //<MIC> | ||
305 | // ----------------------------------------------------------------- | ||
306 | // ----------------------------------------------------------------- | ||
307 | // THIS IS DEBUGGING CODE & SHOULD BE REMOVED | ||
308 | // ----------------------------------------------------------------- | ||
309 | // ----------------------------------------------------------------- | ||
310 | public class QueueLogger | ||
311 | { | ||
312 | public Int32 start = 0; | ||
313 | public StreamWriter Log = null; | ||
314 | private Dictionary<UUID,int> m_idMap = new Dictionary<UUID,int>(); | ||
315 | |||
316 | public QueueLogger() | ||
317 | { | ||
318 | DateTime now = DateTime.Now; | ||
319 | String fname = String.Format("queue-{0}.log", now.ToString("yyyyMMddHHmmss")); | ||
320 | Log = new StreamWriter(fname); | ||
321 | |||
322 | start = Util.EnvironmentTickCount(); | ||
323 | } | ||
324 | |||
325 | public int LookupID(UUID uuid) | ||
326 | { | ||
327 | int localid; | ||
328 | if (! m_idMap.TryGetValue(uuid,out localid)) | ||
329 | { | ||
330 | localid = m_idMap.Count + 1; | ||
331 | m_idMap[uuid] = localid; | ||
332 | } | ||
333 | |||
334 | return localid; | ||
335 | } | ||
336 | } | ||
337 | |||
338 | public static QueueLogger QueueLog = null; | ||
339 | |||
340 | // ----------------------------------------------------------------- | ||
341 | public void LogAvatarUpdateEvent(UUID client, UUID avatar, Int32 timeinqueue) | ||
342 | { | ||
343 | if (QueueLog == null) | ||
344 | QueueLog = new QueueLogger(); | ||
345 | |||
346 | Int32 ticks = Util.EnvironmentTickCountSubtract(QueueLog.start); | ||
347 | lock(QueueLog) | ||
348 | { | ||
349 | int cid = QueueLog.LookupID(client); | ||
350 | int aid = QueueLog.LookupID(avatar); | ||
351 | QueueLog.Log.WriteLine("{0},AU,AV{1:D4},AV{2:D4},{3}",ticks,cid,aid,timeinqueue); | ||
352 | } | ||
353 | } | ||
354 | |||
355 | // ----------------------------------------------------------------- | ||
356 | public void LogQueueProcessEvent(UUID client, PriorityQueue queue, uint maxup) | ||
357 | { | ||
358 | if (QueueLog == null) | ||
359 | QueueLog = new QueueLogger(); | ||
360 | |||
361 | Int32 ticks = Util.EnvironmentTickCountSubtract(QueueLog.start); | ||
362 | lock(QueueLog) | ||
363 | { | ||
364 | int cid = QueueLog.LookupID(client); | ||
365 | QueueLog.Log.WriteLine("{0},PQ,AV{1:D4},{2},{3}",ticks,cid,maxup,queue.ToString()); | ||
366 | } | ||
367 | } | ||
368 | // ----------------------------------------------------------------- | ||
369 | // ----------------------------------------------------------------- | ||
370 | // ----------------------------------------------------------------- | ||
371 | // ----------------------------------------------------------------- | ||
372 | //</MIC> | ||
373 | |||
301 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 374 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
302 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients | 375 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients |
303 | 376 | ||
@@ -3547,18 +3620,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3547 | 3620 | ||
3548 | #region Primitive Packet/Data Sending Methods | 3621 | #region Primitive Packet/Data Sending Methods |
3549 | 3622 | ||
3623 | |||
3550 | /// <summary> | 3624 | /// <summary> |
3551 | /// Generate one of the object update packets based on PrimUpdateFlags | 3625 | /// Generate one of the object update packets based on PrimUpdateFlags |
3552 | /// and broadcast the packet to clients | 3626 | /// and broadcast the packet to clients |
3553 | /// </summary> | 3627 | /// </summary> |
3554 | public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) | 3628 | public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) |
3555 | { | 3629 | { |
3556 | double priority = m_prioritizer.GetUpdatePriority(this, entity); | 3630 | //double priority = m_prioritizer.GetUpdatePriority(this, entity); |
3631 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); | ||
3557 | 3632 | ||
3558 | lock (m_entityUpdates.SyncRoot) | 3633 | lock (m_entityUpdates.SyncRoot) |
3559 | m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation), entity.LocalId); | 3634 | m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); |
3560 | } | 3635 | } |
3561 | 3636 | ||
3637 | private Int32 m_LastQueueFill = 0; | ||
3638 | private uint m_maxUpdates = 0; | ||
3639 | |||
3562 | private void ProcessEntityUpdates(int maxUpdates) | 3640 | private void ProcessEntityUpdates(int maxUpdates) |
3563 | { | 3641 | { |
3564 | OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); | 3642 | OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); |
@@ -3566,19 +3644,45 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3566 | OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); | 3644 | OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); |
3567 | OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); | 3645 | OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); |
3568 | 3646 | ||
3569 | if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; | 3647 | if (maxUpdates <= 0) |
3648 | { | ||
3649 | m_maxUpdates = Int32.MaxValue; | ||
3650 | } | ||
3651 | else | ||
3652 | { | ||
3653 | if (m_maxUpdates == 0 || m_LastQueueFill == 0) | ||
3654 | { | ||
3655 | m_maxUpdates = (uint)maxUpdates; | ||
3656 | } | ||
3657 | else | ||
3658 | { | ||
3659 | if (Util.EnvironmentTickCountSubtract(m_LastQueueFill) < 200) | ||
3660 | m_maxUpdates += 5; | ||
3661 | else | ||
3662 | m_maxUpdates = m_maxUpdates >> 1; | ||
3663 | } | ||
3664 | m_maxUpdates = Util.Clamp<uint>(m_maxUpdates,10,500); | ||
3665 | } | ||
3666 | m_LastQueueFill = Util.EnvironmentTickCount(); | ||
3667 | |||
3570 | int updatesThisCall = 0; | 3668 | int updatesThisCall = 0; |
3571 | 3669 | ||
3670 | //<MIC> | ||
3671 | // DEBUGGING CODE... REMOVE | ||
3672 | // LogQueueProcessEvent(this.m_agentId,m_entityUpdates,m_maxUpdates); | ||
3673 | //</MIC> | ||
3572 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race | 3674 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race |
3573 | // condition where a kill can be processed before an out-of-date update for the same object. | 3675 | // condition where a kill can be processed before an out-of-date update for the same object. |
3574 | lock (m_killRecord) | 3676 | lock (m_killRecord) |
3575 | { | 3677 | { |
3576 | float avgTimeDilation = 1.0f; | 3678 | float avgTimeDilation = 1.0f; |
3577 | EntityUpdate update; | 3679 | EntityUpdate update; |
3578 | while (updatesThisCall < maxUpdates) | 3680 | Int32 timeinqueue; // this is just debugging code & can be dropped later |
3681 | |||
3682 | while (updatesThisCall < m_maxUpdates) | ||
3579 | { | 3683 | { |
3580 | lock (m_entityUpdates.SyncRoot) | 3684 | lock (m_entityUpdates.SyncRoot) |
3581 | if (!m_entityUpdates.TryDequeue(out update)) | 3685 | if (!m_entityUpdates.TryDequeue(out update, out timeinqueue)) |
3582 | break; | 3686 | break; |
3583 | avgTimeDilation += update.TimeDilation; | 3687 | avgTimeDilation += update.TimeDilation; |
3584 | avgTimeDilation *= 0.5f; | 3688 | avgTimeDilation *= 0.5f; |
@@ -3679,36 +3783,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3679 | } | 3783 | } |
3680 | else | 3784 | else |
3681 | { | 3785 | { |
3682 | // if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment) | 3786 | objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); |
3683 | // { | ||
3684 | // SceneObjectPart sop = (SceneObjectPart)update.Entity; | ||
3685 | // string text = sop.Text; | ||
3686 | // if (text.IndexOf("\n") >= 0) | ||
3687 | // text = text.Remove(text.IndexOf("\n")); | ||
3688 | // | ||
3689 | // if (m_attachmentsSent.Contains(sop.ParentID)) | ||
3690 | // { | ||
3691 | //// m_log.DebugFormat( | ||
3692 | //// "[CLIENT]: Sending full info about attached prim {0} text {1}", | ||
3693 | //// sop.LocalId, text); | ||
3694 | // | ||
3695 | // objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId)); | ||
3696 | // | ||
3697 | // m_attachmentsSent.Add(sop.LocalId); | ||
3698 | // } | ||
3699 | // else | ||
3700 | // { | ||
3701 | // m_log.DebugFormat( | ||
3702 | // "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", | ||
3703 | // sop.LocalId, text, sop.ParentID); | ||
3704 | // | ||
3705 | // m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); | ||
3706 | // } | ||
3707 | // } | ||
3708 | // else | ||
3709 | // { | ||
3710 | objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); | ||
3711 | // } | ||
3712 | } | 3787 | } |
3713 | } | 3788 | } |
3714 | else if (!canUseImproved) | 3789 | else if (!canUseImproved) |
@@ -3802,26 +3877,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3802 | 3877 | ||
3803 | public void ReprioritizeUpdates() | 3878 | public void ReprioritizeUpdates() |
3804 | { | 3879 | { |
3805 | //m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName); | ||
3806 | |||
3807 | lock (m_entityUpdates.SyncRoot) | 3880 | lock (m_entityUpdates.SyncRoot) |
3808 | m_entityUpdates.Reprioritize(UpdatePriorityHandler); | 3881 | m_entityUpdates.Reprioritize(UpdatePriorityHandler); |
3809 | } | 3882 | } |
3810 | 3883 | ||
3811 | private bool UpdatePriorityHandler(ref double priority, uint localID) | 3884 | private bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity) |
3812 | { | 3885 | { |
3813 | EntityBase entity; | 3886 | if (entity != null) |
3814 | if (m_scene.Entities.TryGetValue(localID, out entity)) | ||
3815 | { | 3887 | { |
3816 | priority = m_prioritizer.GetUpdatePriority(this, entity); | 3888 | priority = m_prioritizer.GetUpdatePriority(this, entity); |
3889 | return true; | ||
3817 | } | 3890 | } |
3818 | 3891 | ||
3819 | return priority != double.NaN; | 3892 | return false; |
3820 | } | 3893 | } |
3821 | 3894 | ||
3822 | public void FlushPrimUpdates() | 3895 | public void FlushPrimUpdates() |
3823 | { | 3896 | { |
3824 | m_log.Debug("[CLIENT]: Flushing prim updates to " + m_firstName + " " + m_lastName); | 3897 | m_log.WarnFormat("[CLIENT]: Flushing prim updates to " + m_firstName + " " + m_lastName); |
3825 | 3898 | ||
3826 | while (m_entityUpdates.Count > 0) | 3899 | while (m_entityUpdates.Count > 0) |
3827 | ProcessEntityUpdates(-1); | 3900 | ProcessEntityUpdates(-1); |
@@ -4272,8 +4345,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4272 | OutPacket(packet, ThrottleOutPacketType.Task); | 4345 | OutPacket(packet, ThrottleOutPacketType.Task); |
4273 | } | 4346 | } |
4274 | 4347 | ||
4275 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 4348 | public void SendLandProperties( |
4349 | int sequence_id, bool snap_selection, int request_result, ILandObject lo, | ||
4350 | float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | ||
4276 | { | 4351 | { |
4352 | // m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); | ||
4353 | |||
4354 | LandData landData = lo.LandData; | ||
4355 | |||
4277 | ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); | 4356 | ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); |
4278 | 4357 | ||
4279 | updateMessage.AABBMax = landData.AABBMax; | 4358 | updateMessage.AABBMax = landData.AABBMax; |
@@ -4281,15 +4360,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4281 | updateMessage.Area = landData.Area; | 4360 | updateMessage.Area = landData.Area; |
4282 | updateMessage.AuctionID = landData.AuctionID; | 4361 | updateMessage.AuctionID = landData.AuctionID; |
4283 | updateMessage.AuthBuyerID = landData.AuthBuyerID; | 4362 | updateMessage.AuthBuyerID = landData.AuthBuyerID; |
4284 | |||
4285 | updateMessage.Bitmap = landData.Bitmap; | 4363 | updateMessage.Bitmap = landData.Bitmap; |
4286 | |||
4287 | updateMessage.Desc = landData.Description; | 4364 | updateMessage.Desc = landData.Description; |
4288 | updateMessage.Category = landData.Category; | 4365 | updateMessage.Category = landData.Category; |
4289 | updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate); | 4366 | updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate); |
4290 | updateMessage.ClaimPrice = landData.ClaimPrice; | 4367 | updateMessage.ClaimPrice = landData.ClaimPrice; |
4291 | updateMessage.GroupID = landData.GroupID; | 4368 | updateMessage.GroupID = landData.GroupID; |
4292 | updateMessage.GroupPrims = landData.GroupPrims; | ||
4293 | updateMessage.IsGroupOwned = landData.IsGroupOwned; | 4369 | updateMessage.IsGroupOwned = landData.IsGroupOwned; |
4294 | updateMessage.LandingType = (LandingType) landData.LandingType; | 4370 | updateMessage.LandingType = (LandingType) landData.LandingType; |
4295 | updateMessage.LocalID = landData.LocalID; | 4371 | updateMessage.LocalID = landData.LocalID; |
@@ -4310,9 +4386,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4310 | updateMessage.Name = landData.Name; | 4386 | updateMessage.Name = landData.Name; |
4311 | updateMessage.OtherCleanTime = landData.OtherCleanTime; | 4387 | updateMessage.OtherCleanTime = landData.OtherCleanTime; |
4312 | updateMessage.OtherCount = 0; //TODO: Unimplemented | 4388 | updateMessage.OtherCount = 0; //TODO: Unimplemented |
4313 | updateMessage.OtherPrims = landData.OtherPrims; | 4389 | updateMessage.OwnerID = landData.OwnerID; |
4314 | updateMessage.OwnerID = landData.OwnerID; | ||
4315 | updateMessage.OwnerPrims = landData.OwnerPrims; | ||
4316 | updateMessage.ParcelFlags = (ParcelFlags) landData.Flags; | 4390 | updateMessage.ParcelFlags = (ParcelFlags) landData.Flags; |
4317 | updateMessage.ParcelPrimBonus = simObjectBonusFactor; | 4391 | updateMessage.ParcelPrimBonus = simObjectBonusFactor; |
4318 | updateMessage.PassHours = landData.PassHours; | 4392 | updateMessage.PassHours = landData.PassHours; |
@@ -4327,10 +4401,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4327 | 4401 | ||
4328 | updateMessage.RentPrice = 0; | 4402 | updateMessage.RentPrice = 0; |
4329 | updateMessage.RequestResult = (ParcelResult) request_result; | 4403 | updateMessage.RequestResult = (ParcelResult) request_result; |
4330 | updateMessage.SalePrice = landData.SalePrice; | 4404 | updateMessage.SalePrice = landData.SalePrice; |
4331 | updateMessage.SelectedPrims = landData.SelectedPrims; | ||
4332 | updateMessage.SelfCount = 0; //TODO: Unimplemented | 4405 | updateMessage.SelfCount = 0; //TODO: Unimplemented |
4333 | updateMessage.SequenceID = sequence_id; | 4406 | updateMessage.SequenceID = sequence_id; |
4407 | |||
4334 | if (landData.SimwideArea > 0) | 4408 | if (landData.SimwideArea > 0) |
4335 | { | 4409 | { |
4336 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 4410 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); |
@@ -4340,22 +4414,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4340 | { | 4414 | { |
4341 | updateMessage.SimWideMaxPrims = 0; | 4415 | updateMessage.SimWideMaxPrims = 0; |
4342 | } | 4416 | } |
4343 | updateMessage.SimWideTotalPrims = landData.SimwidePrims; | 4417 | |
4344 | updateMessage.SnapSelection = snap_selection; | 4418 | updateMessage.SnapSelection = snap_selection; |
4345 | updateMessage.SnapshotID = landData.SnapshotID; | 4419 | updateMessage.SnapshotID = landData.SnapshotID; |
4346 | updateMessage.Status = (ParcelStatus) landData.Status; | 4420 | updateMessage.Status = (ParcelStatus) landData.Status; |
4347 | updateMessage.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims + | 4421 | updateMessage.UserLocation = landData.UserLocation; |
4348 | landData.SelectedPrims; | 4422 | updateMessage.UserLookAt = landData.UserLookAt; |
4349 | updateMessage.UserLocation = landData.UserLocation; | 4423 | |
4350 | updateMessage.UserLookAt = landData.UserLookAt; | 4424 | updateMessage.MediaType = landData.MediaType; |
4351 | 4425 | updateMessage.MediaDesc = landData.MediaDescription; | |
4352 | updateMessage.MediaType = landData.MediaType; | 4426 | updateMessage.MediaWidth = landData.MediaWidth; |
4353 | updateMessage.MediaDesc = landData.MediaDescription; | 4427 | updateMessage.MediaHeight = landData.MediaHeight; |
4354 | updateMessage.MediaWidth = landData.MediaWidth; | 4428 | updateMessage.MediaLoop = landData.MediaLoop; |
4355 | updateMessage.MediaHeight = landData.MediaHeight; | 4429 | updateMessage.ObscureMusic = landData.ObscureMusic; |
4356 | updateMessage.MediaLoop = landData.MediaLoop; | 4430 | updateMessage.ObscureMedia = landData.ObscureMedia; |
4357 | updateMessage.ObscureMusic = landData.ObscureMusic; | 4431 | |
4358 | updateMessage.ObscureMedia = landData.ObscureMedia; | 4432 | IPrimCounts pc = lo.PrimCounts; |
4433 | updateMessage.OwnerPrims = pc.Owner; | ||
4434 | updateMessage.GroupPrims = pc.Group; | ||
4435 | updateMessage.OtherPrims = pc.Others; | ||
4436 | updateMessage.SelectedPrims = pc.Selected; | ||
4437 | updateMessage.TotalPrims = pc.Total; | ||
4438 | updateMessage.SimWideTotalPrims = pc.Simulator; | ||
4359 | 4439 | ||
4360 | try | 4440 | try |
4361 | { | 4441 | { |
@@ -4363,13 +4443,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4363 | if (eq != null) | 4443 | if (eq != null) |
4364 | { | 4444 | { |
4365 | eq.ParcelProperties(updateMessage, this.AgentId); | 4445 | eq.ParcelProperties(updateMessage, this.AgentId); |
4366 | } else { | 4446 | } |
4367 | m_log.Warn("No EQ Interface when sending parcel data."); | 4447 | else |
4448 | { | ||
4449 | m_log.Warn("[LLCLIENTVIEW]: No EQ Interface when sending parcel data."); | ||
4368 | } | 4450 | } |
4369 | } | 4451 | } |
4370 | catch (Exception ex) | 4452 | catch (Exception ex) |
4371 | { | 4453 | { |
4372 | m_log.Error("Unable to send parcel data via eventqueue - exception: " + ex.ToString()); | 4454 | m_log.Error("[LLCLIENTVIEW]: Unable to send parcel data via eventqueue - exception: " + ex.ToString()); |
4373 | } | 4455 | } |
4374 | } | 4456 | } |
4375 | 4457 | ||
@@ -4929,7 +5011,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4929 | AddLocalPacketHandler(PacketType.TeleportLocationRequest, HandleTeleportLocationRequest); | 5011 | AddLocalPacketHandler(PacketType.TeleportLocationRequest, HandleTeleportLocationRequest); |
4930 | AddLocalPacketHandler(PacketType.UUIDNameRequest, HandleUUIDNameRequest, false); | 5012 | AddLocalPacketHandler(PacketType.UUIDNameRequest, HandleUUIDNameRequest, false); |
4931 | AddLocalPacketHandler(PacketType.RegionHandleRequest, HandleRegionHandleRequest); | 5013 | AddLocalPacketHandler(PacketType.RegionHandleRequest, HandleRegionHandleRequest); |
4932 | AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest, false); | 5014 | AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest); |
4933 | AddLocalPacketHandler(PacketType.ParcelAccessListRequest, HandleParcelAccessListRequest, false); | 5015 | AddLocalPacketHandler(PacketType.ParcelAccessListRequest, HandleParcelAccessListRequest, false); |
4934 | AddLocalPacketHandler(PacketType.ParcelAccessListUpdate, HandleParcelAccessListUpdate, false); | 5016 | AddLocalPacketHandler(PacketType.ParcelAccessListUpdate, HandleParcelAccessListUpdate, false); |
4935 | AddLocalPacketHandler(PacketType.ParcelPropertiesRequest, HandleParcelPropertiesRequest, false); | 5017 | AddLocalPacketHandler(PacketType.ParcelPropertiesRequest, HandleParcelPropertiesRequest, false); |
@@ -8800,13 +8882,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8800 | case "instantmessage": | 8882 | case "instantmessage": |
8801 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | 8883 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) |
8802 | { | 8884 | { |
8803 | if (messagePacket.ParamList.Length < 5) | 8885 | if (messagePacket.ParamList.Length < 2) |
8804 | return true; | 8886 | return true; |
8887 | |||
8805 | UUID invoice = messagePacket.MethodData.Invoice; | 8888 | UUID invoice = messagePacket.MethodData.Invoice; |
8806 | UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); | ||
8807 | string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter); | ||
8808 | string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter); | ||
8809 | UUID sessionID = messagePacket.AgentData.SessionID; | 8889 | UUID sessionID = messagePacket.AgentData.SessionID; |
8890 | |||
8891 | UUID SenderID; | ||
8892 | string SenderName; | ||
8893 | string Message; | ||
8894 | |||
8895 | if (messagePacket.ParamList.Length < 5) | ||
8896 | { | ||
8897 | SenderID = AgentId; | ||
8898 | SenderName = Utils.BytesToString(messagePacket.ParamList[0].Parameter); | ||
8899 | Message = Utils.BytesToString(messagePacket.ParamList[1].Parameter); | ||
8900 | } | ||
8901 | else | ||
8902 | { | ||
8903 | SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); | ||
8904 | SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter); | ||
8905 | Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter); | ||
8906 | } | ||
8907 | |||
8810 | OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message); | 8908 | OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message); |
8811 | } | 8909 | } |
8812 | return true; | 8910 | return true; |
@@ -11701,171 +11799,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11701 | OutPacket(pack, ThrottleOutPacketType.Task); | 11799 | OutPacket(pack, ThrottleOutPacketType.Task); |
11702 | } | 11800 | } |
11703 | 11801 | ||
11704 | #region PriorityQueue | ||
11705 | public class PriorityQueue | ||
11706 | { | ||
11707 | internal delegate bool UpdatePriorityHandler(ref double priority, uint local_id); | ||
11708 | |||
11709 | private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[1]; | ||
11710 | private Dictionary<uint, LookupItem> m_lookupTable; | ||
11711 | private Comparison<double> m_comparison; | ||
11712 | private object m_syncRoot = new object(); | ||
11713 | |||
11714 | internal PriorityQueue() : | ||
11715 | this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, Comparer<double>.Default) { } | ||
11716 | internal PriorityQueue(int capacity) : | ||
11717 | this(capacity, Comparer<double>.Default) { } | ||
11718 | internal PriorityQueue(IComparer<double> comparer) : | ||
11719 | this(new Comparison<double>(comparer.Compare)) { } | ||
11720 | internal PriorityQueue(Comparison<double> comparison) : | ||
11721 | this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, comparison) { } | ||
11722 | internal PriorityQueue(int capacity, IComparer<double> comparer) : | ||
11723 | this(capacity, new Comparison<double>(comparer.Compare)) { } | ||
11724 | internal PriorityQueue(int capacity, Comparison<double> comparison) | ||
11725 | { | ||
11726 | m_lookupTable = new Dictionary<uint, LookupItem>(capacity); | ||
11727 | |||
11728 | for (int i = 0; i < m_heaps.Length; ++i) | ||
11729 | m_heaps[i] = new MinHeap<MinHeapItem>(capacity); | ||
11730 | this.m_comparison = comparison; | ||
11731 | } | ||
11732 | |||
11733 | public object SyncRoot { get { return this.m_syncRoot; } } | ||
11734 | internal int Count | ||
11735 | { | ||
11736 | get | ||
11737 | { | ||
11738 | int count = 0; | ||
11739 | for (int i = 0; i < m_heaps.Length; ++i) | ||
11740 | count = m_heaps[i].Count; | ||
11741 | return count; | ||
11742 | } | ||
11743 | } | ||
11744 | |||
11745 | public bool Enqueue(double priority, EntityUpdate value, uint local_id) | ||
11746 | { | ||
11747 | LookupItem item; | ||
11748 | |||
11749 | if (m_lookupTable.TryGetValue(local_id, out item)) | ||
11750 | { | ||
11751 | // Combine flags | ||
11752 | value.Flags |= item.Heap[item.Handle].Value.Flags; | ||
11753 | |||
11754 | item.Heap[item.Handle] = new MinHeapItem(priority, value, local_id, this.m_comparison); | ||
11755 | return false; | ||
11756 | } | ||
11757 | else | ||
11758 | { | ||
11759 | item.Heap = m_heaps[0]; | ||
11760 | item.Heap.Add(new MinHeapItem(priority, value, local_id, this.m_comparison), ref item.Handle); | ||
11761 | m_lookupTable.Add(local_id, item); | ||
11762 | return true; | ||
11763 | } | ||
11764 | } | ||
11765 | |||
11766 | internal EntityUpdate Peek() | ||
11767 | { | ||
11768 | for (int i = 0; i < m_heaps.Length; ++i) | ||
11769 | if (m_heaps[i].Count > 0) | ||
11770 | return m_heaps[i].Min().Value; | ||
11771 | throw new InvalidOperationException(string.Format("The {0} is empty", this.GetType().ToString())); | ||
11772 | } | ||
11773 | |||
11774 | internal bool TryDequeue(out EntityUpdate value) | ||
11775 | { | ||
11776 | for (int i = 0; i < m_heaps.Length; ++i) | ||
11777 | { | ||
11778 | if (m_heaps[i].Count > 0) | ||
11779 | { | ||
11780 | MinHeapItem item = m_heaps[i].RemoveMin(); | ||
11781 | m_lookupTable.Remove(item.LocalID); | ||
11782 | value = item.Value; | ||
11783 | return true; | ||
11784 | } | ||
11785 | } | ||
11786 | |||
11787 | value = default(EntityUpdate); | ||
11788 | return false; | ||
11789 | } | ||
11790 | |||
11791 | internal void Reprioritize(UpdatePriorityHandler handler) | ||
11792 | { | ||
11793 | MinHeapItem item; | ||
11794 | double priority; | ||
11795 | |||
11796 | foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values)) | ||
11797 | { | ||
11798 | if (lookup.Heap.TryGetValue(lookup.Handle, out item)) | ||
11799 | { | ||
11800 | priority = item.Priority; | ||
11801 | if (handler(ref priority, item.LocalID)) | ||
11802 | { | ||
11803 | if (lookup.Heap.ContainsHandle(lookup.Handle)) | ||
11804 | lookup.Heap[lookup.Handle] = | ||
11805 | new MinHeapItem(priority, item.Value, item.LocalID, this.m_comparison); | ||
11806 | } | ||
11807 | else | ||
11808 | { | ||
11809 | m_log.Warn("[LLCLIENTVIEW]: UpdatePriorityHandler returned false, dropping update"); | ||
11810 | lookup.Heap.Remove(lookup.Handle); | ||
11811 | this.m_lookupTable.Remove(item.LocalID); | ||
11812 | } | ||
11813 | } | ||
11814 | } | ||
11815 | } | ||
11816 | |||
11817 | #region MinHeapItem | ||
11818 | private struct MinHeapItem : IComparable<MinHeapItem> | ||
11819 | { | ||
11820 | private double priority; | ||
11821 | private EntityUpdate value; | ||
11822 | private uint local_id; | ||
11823 | private Comparison<double> comparison; | ||
11824 | |||
11825 | internal MinHeapItem(double priority, EntityUpdate value, uint local_id) : | ||
11826 | this(priority, value, local_id, Comparer<double>.Default) { } | ||
11827 | internal MinHeapItem(double priority, EntityUpdate value, uint local_id, IComparer<double> comparer) : | ||
11828 | this(priority, value, local_id, new Comparison<double>(comparer.Compare)) { } | ||
11829 | internal MinHeapItem(double priority, EntityUpdate value, uint local_id, Comparison<double> comparison) | ||
11830 | { | ||
11831 | this.priority = priority; | ||
11832 | this.value = value; | ||
11833 | this.local_id = local_id; | ||
11834 | this.comparison = comparison; | ||
11835 | } | ||
11836 | |||
11837 | internal double Priority { get { return this.priority; } } | ||
11838 | internal EntityUpdate Value { get { return this.value; } } | ||
11839 | internal uint LocalID { get { return this.local_id; } } | ||
11840 | |||
11841 | public override string ToString() | ||
11842 | { | ||
11843 | StringBuilder sb = new StringBuilder(); | ||
11844 | sb.Append("["); | ||
11845 | sb.Append(this.priority.ToString()); | ||
11846 | sb.Append(","); | ||
11847 | if (this.value != null) | ||
11848 | sb.Append(this.value.ToString()); | ||
11849 | sb.Append("]"); | ||
11850 | return sb.ToString(); | ||
11851 | } | ||
11852 | |||
11853 | public int CompareTo(MinHeapItem other) | ||
11854 | { | ||
11855 | return this.comparison(this.priority, other.priority); | ||
11856 | } | ||
11857 | } | ||
11858 | #endregion | ||
11859 | |||
11860 | #region LookupItem | ||
11861 | private struct LookupItem | ||
11862 | { | ||
11863 | internal MinHeap<MinHeapItem> Heap; | ||
11864 | internal IHandle Handle; | ||
11865 | } | ||
11866 | #endregion | ||
11867 | } | ||
11868 | |||
11869 | public struct PacketProcessor | 11802 | public struct PacketProcessor |
11870 | { | 11803 | { |
11871 | public PacketMethod method; | 11804 | public PacketMethod method; |
@@ -11886,8 +11819,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11886 | } | 11819 | } |
11887 | } | 11820 | } |
11888 | 11821 | ||
11889 | #endregion | ||
11890 | |||
11891 | public static OSD BuildEvent(string eventName, OSD eventBody) | 11822 | public static OSD BuildEvent(string eventName, OSD eventBody) |
11892 | { | 11823 | { |
11893 | OSDMap osdEvent = new OSDMap(2); | 11824 | OSDMap osdEvent = new OSDMap(2); |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 65a8fe3..9a8bfd3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | |||
@@ -149,7 +149,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
149 | /// <summary>Caches packed throttle information</summary> | 149 | /// <summary>Caches packed throttle information</summary> |
150 | private byte[] m_packedThrottles; | 150 | private byte[] m_packedThrottles; |
151 | 151 | ||
152 | private int m_defaultRTO = 3000; | 152 | private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC |
153 | private int m_maxRTO = 60000; | 153 | private int m_maxRTO = 60000; |
154 | 154 | ||
155 | /// <summary> | 155 | /// <summary> |
@@ -557,7 +557,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
557 | int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR)); | 557 | int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR)); |
558 | 558 | ||
559 | // Clamp the retransmission timeout to manageable values | 559 | // Clamp the retransmission timeout to manageable values |
560 | rto = Utils.Clamp(RTO, m_defaultRTO, m_maxRTO); | 560 | rto = Utils.Clamp(rto, m_defaultRTO, m_maxRTO); |
561 | 561 | ||
562 | RTO = rto; | 562 | RTO = rto; |
563 | 563 | ||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs index d2779ba..6eebd9d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs | |||
@@ -100,6 +100,10 @@ namespace OpenMetaverse | |||
100 | const int SIO_UDP_CONNRESET = -1744830452; | 100 | const int SIO_UDP_CONNRESET = -1744830452; |
101 | 101 | ||
102 | IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort); | 102 | IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort); |
103 | |||
104 | m_log.DebugFormat( | ||
105 | "[UDPBASE]: Binding UDP listener using internal IP address config {0}:{1}", | ||
106 | ipep.Address, ipep.Port); | ||
103 | 107 | ||
104 | m_udpSocket = new Socket( | 108 | m_udpSocket = new Socket( |
105 | AddressFamily.InterNetwork, | 109 | AddressFamily.InterNetwork, |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs new file mode 100644 index 0000000..364ce4b --- /dev/null +++ b/OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs | |||
@@ -0,0 +1,245 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Client; | ||
35 | using log4net; | ||
36 | |||
37 | namespace OpenSim.Region.ClientStack.LindenUDP | ||
38 | { | ||
39 | public class PriorityQueue | ||
40 | { | ||
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | |||
43 | internal delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity); | ||
44 | |||
45 | // Heap[0] for self updates | ||
46 | // Heap[1..12] for entity updates | ||
47 | |||
48 | internal const uint m_numberOfQueues = 12; | ||
49 | |||
50 | private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[m_numberOfQueues]; | ||
51 | private Dictionary<uint, LookupItem> m_lookupTable; | ||
52 | private uint m_nextQueue = 0; | ||
53 | private UInt64 m_nextRequest = 0; | ||
54 | |||
55 | private object m_syncRoot = new object(); | ||
56 | public object SyncRoot { | ||
57 | get { return this.m_syncRoot; } | ||
58 | } | ||
59 | |||
60 | internal PriorityQueue() : this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY) { } | ||
61 | |||
62 | internal PriorityQueue(int capacity) | ||
63 | { | ||
64 | m_lookupTable = new Dictionary<uint, LookupItem>(capacity); | ||
65 | |||
66 | for (int i = 0; i < m_heaps.Length; ++i) | ||
67 | m_heaps[i] = new MinHeap<MinHeapItem>(capacity); | ||
68 | } | ||
69 | |||
70 | internal int Count | ||
71 | { | ||
72 | get | ||
73 | { | ||
74 | int count = 0; | ||
75 | for (int i = 0; i < m_heaps.Length; ++i) | ||
76 | count += m_heaps[i].Count; | ||
77 | return count; | ||
78 | } | ||
79 | } | ||
80 | |||
81 | public bool Enqueue(uint pqueue, EntityUpdate value) | ||
82 | { | ||
83 | LookupItem lookup; | ||
84 | |||
85 | uint localid = value.Entity.LocalId; | ||
86 | UInt64 entry = m_nextRequest++; | ||
87 | if (m_lookupTable.TryGetValue(localid, out lookup)) | ||
88 | { | ||
89 | entry = lookup.Heap[lookup.Handle].EntryOrder; | ||
90 | value.Flags |= lookup.Heap[lookup.Handle].Value.Flags; | ||
91 | lookup.Heap.Remove(lookup.Handle); | ||
92 | } | ||
93 | |||
94 | pqueue = Util.Clamp<uint>(pqueue, 0, m_numberOfQueues - 1); | ||
95 | lookup.Heap = m_heaps[pqueue]; | ||
96 | lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle); | ||
97 | m_lookupTable[localid] = lookup; | ||
98 | |||
99 | return true; | ||
100 | } | ||
101 | |||
102 | internal bool TryDequeue(out EntityUpdate value, out Int32 timeinqueue) | ||
103 | { | ||
104 | for (int i = 0; i < m_numberOfQueues; ++i) | ||
105 | { | ||
106 | // To get the fair queing, we cycle through each of the | ||
107 | // queues when finding an element to dequeue, this code | ||
108 | // assumes that the distribution of updates in the queues | ||
109 | // is polynomial, probably quadractic (eg distance of PI * R^2) | ||
110 | uint h = (uint)((m_nextQueue + i) % m_numberOfQueues); | ||
111 | if (m_heaps[h].Count > 0) | ||
112 | { | ||
113 | m_nextQueue = (uint)((h + 1) % m_numberOfQueues); | ||
114 | |||
115 | MinHeapItem item = m_heaps[h].RemoveMin(); | ||
116 | m_lookupTable.Remove(item.Value.Entity.LocalId); | ||
117 | timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); | ||
118 | value = item.Value; | ||
119 | |||
120 | return true; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | timeinqueue = 0; | ||
125 | value = default(EntityUpdate); | ||
126 | return false; | ||
127 | } | ||
128 | |||
129 | internal void Reprioritize(UpdatePriorityHandler handler) | ||
130 | { | ||
131 | MinHeapItem item; | ||
132 | foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values)) | ||
133 | { | ||
134 | if (lookup.Heap.TryGetValue(lookup.Handle, out item)) | ||
135 | { | ||
136 | uint pqueue = item.PriorityQueue; | ||
137 | uint localid = item.Value.Entity.LocalId; | ||
138 | |||
139 | if (handler(ref pqueue, item.Value.Entity)) | ||
140 | { | ||
141 | // unless the priority queue has changed, there is no need to modify | ||
142 | // the entry | ||
143 | pqueue = Util.Clamp<uint>(pqueue, 0, m_numberOfQueues - 1); | ||
144 | if (pqueue != item.PriorityQueue) | ||
145 | { | ||
146 | lookup.Heap.Remove(lookup.Handle); | ||
147 | |||
148 | LookupItem litem = lookup; | ||
149 | litem.Heap = m_heaps[pqueue]; | ||
150 | litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle); | ||
151 | m_lookupTable[localid] = litem; | ||
152 | } | ||
153 | } | ||
154 | else | ||
155 | { | ||
156 | // m_log.WarnFormat("[PQUEUE]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID); | ||
157 | lookup.Heap.Remove(lookup.Handle); | ||
158 | this.m_lookupTable.Remove(localid); | ||
159 | } | ||
160 | } | ||
161 | } | ||
162 | } | ||
163 | |||
164 | public override string ToString() | ||
165 | { | ||
166 | string s = ""; | ||
167 | for (int i = 0; i < m_numberOfQueues; i++) | ||
168 | { | ||
169 | if (s != "") s += ","; | ||
170 | s += m_heaps[i].Count.ToString(); | ||
171 | } | ||
172 | return s; | ||
173 | } | ||
174 | |||
175 | #region MinHeapItem | ||
176 | private struct MinHeapItem : IComparable<MinHeapItem> | ||
177 | { | ||
178 | private EntityUpdate value; | ||
179 | internal EntityUpdate Value { | ||
180 | get { | ||
181 | return this.value; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | private uint pqueue; | ||
186 | internal uint PriorityQueue { | ||
187 | get { | ||
188 | return this.pqueue; | ||
189 | } | ||
190 | } | ||
191 | |||
192 | private Int32 entrytime; | ||
193 | internal Int32 EntryTime { | ||
194 | get { | ||
195 | return this.entrytime; | ||
196 | } | ||
197 | } | ||
198 | |||
199 | private UInt64 entryorder; | ||
200 | internal UInt64 EntryOrder | ||
201 | { | ||
202 | get { | ||
203 | return this.entryorder; | ||
204 | } | ||
205 | } | ||
206 | |||
207 | internal MinHeapItem(uint pqueue, MinHeapItem other) | ||
208 | { | ||
209 | this.entrytime = other.entrytime; | ||
210 | this.entryorder = other.entryorder; | ||
211 | this.value = other.value; | ||
212 | this.pqueue = pqueue; | ||
213 | } | ||
214 | |||
215 | internal MinHeapItem(uint pqueue, UInt64 entryorder, EntityUpdate value) | ||
216 | { | ||
217 | this.entrytime = Util.EnvironmentTickCount(); | ||
218 | this.entryorder = entryorder; | ||
219 | this.value = value; | ||
220 | this.pqueue = pqueue; | ||
221 | } | ||
222 | |||
223 | public override string ToString() | ||
224 | { | ||
225 | return String.Format("[{0},{1},{2}]",pqueue,entryorder,value.Entity.LocalId); | ||
226 | } | ||
227 | |||
228 | public int CompareTo(MinHeapItem other) | ||
229 | { | ||
230 | // I'm assuming that the root part of an SOG is added to the update queue | ||
231 | // before the component parts | ||
232 | return Comparer<UInt64>.Default.Compare(this.EntryOrder, other.EntryOrder); | ||
233 | } | ||
234 | } | ||
235 | #endregion | ||
236 | |||
237 | #region LookupItem | ||
238 | private struct LookupItem | ||
239 | { | ||
240 | internal MinHeap<MinHeapItem> Heap; | ||
241 | internal IHandle Handle; | ||
242 | } | ||
243 | #endregion | ||
244 | } | ||
245 | } | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index a5fcb49..0babeb5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Framework.Interfaces; | 32 | using OpenSim.Region.Framework.Interfaces; |
32 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 9b98de3..01170aa 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -77,7 +77,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
77 | /// </value> | 77 | /// </value> |
78 | private Stream m_loadStream; | 78 | private Stream m_loadStream; |
79 | 79 | ||
80 | protected bool m_controlFileLoaded; | 80 | /// <summary> |
81 | /// FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things | ||
82 | /// (I thought they weren't). We will need to bump the version number and perform this check on all | ||
83 | /// subsequent IAR versions only | ||
84 | /// </summary> | ||
85 | protected bool m_controlFileLoaded = true; | ||
81 | protected bool m_assetsLoaded; | 86 | protected bool m_assetsLoaded; |
82 | protected bool m_inventoryNodesLoaded; | 87 | protected bool m_inventoryNodesLoaded; |
83 | 88 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 798547a..73b0a35 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Xml; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.Threading; | 33 | using System.Threading; |
33 | 34 | ||
@@ -205,11 +206,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
205 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, | 206 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, |
206 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) | 207 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) |
207 | { | 208 | { |
208 | // HACK: This is only working for lists containing a single item! | ||
209 | // It's just a hack to make this WIP compile and run. Nothing | ||
210 | // currently calls this with multiple items. | ||
211 | UUID ret = UUID.Zero; | 209 | UUID ret = UUID.Zero; |
212 | 210 | ||
211 | // The following code groups the SOG's by owner. No objects | ||
212 | // belonging to different people can be coalesced, for obvious | ||
213 | // reasons. | ||
213 | Dictionary<UUID, List<SceneObjectGroup>> deletes = | 214 | Dictionary<UUID, List<SceneObjectGroup>> deletes = |
214 | new Dictionary<UUID, List<SceneObjectGroup>>(); | 215 | new Dictionary<UUID, List<SceneObjectGroup>>(); |
215 | 216 | ||
@@ -221,262 +222,329 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
221 | deletes[g.OwnerID].Add(g); | 222 | deletes[g.OwnerID].Add(g); |
222 | } | 223 | } |
223 | 224 | ||
225 | // This is pethod scoped and will be returned. It will be the | ||
226 | // last created asset id | ||
227 | UUID assetID = UUID.Zero; | ||
228 | |||
229 | // Each iteration is really a separate asset being created, | ||
230 | // with distinct destinations as well. | ||
224 | foreach (List<SceneObjectGroup> objlist in deletes.Values) | 231 | foreach (List<SceneObjectGroup> objlist in deletes.Values) |
225 | { | 232 | { |
226 | foreach (SceneObjectGroup g in objlist) | 233 | Dictionary<UUID, string> xmlStrings = |
227 | ret = DeleteToInventory(action, folderID, g, remoteClient); | 234 | new Dictionary<UUID, string>(); |
228 | } | ||
229 | 235 | ||
230 | return ret; | 236 | foreach (SceneObjectGroup objectGroup in objlist) |
231 | } | 237 | { |
238 | Vector3 inventoryStoredPosition = new Vector3 | ||
239 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
240 | ? 250 | ||
241 | : objectGroup.AbsolutePosition.X) | ||
242 | , | ||
243 | (objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
244 | ? 250 | ||
245 | : objectGroup.AbsolutePosition.X, | ||
246 | objectGroup.AbsolutePosition.Z); | ||
232 | 247 | ||
233 | private UUID DeleteToInventory(DeRezAction action, UUID folderID, | 248 | Vector3 originalPosition = objectGroup.AbsolutePosition; |
234 | SceneObjectGroup objectGroup, IClientAPI remoteClient) | ||
235 | { | ||
236 | UUID assetID = UUID.Zero; | ||
237 | 249 | ||
238 | Vector3 inventoryStoredPosition = new Vector3 | 250 | objectGroup.AbsolutePosition = inventoryStoredPosition; |
239 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
240 | ? 250 | ||
241 | : objectGroup.AbsolutePosition.X) | ||
242 | , | ||
243 | (objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
244 | ? 250 | ||
245 | : objectGroup.AbsolutePosition.X, | ||
246 | objectGroup.AbsolutePosition.Z); | ||
247 | 251 | ||
248 | Vector3 originalPosition = objectGroup.AbsolutePosition; | 252 | // Make sure all bits but the ones we want are clear |
253 | // on take. | ||
254 | // This will be applied to the current perms, so | ||
255 | // it will do what we want. | ||
256 | objectGroup.RootPart.NextOwnerMask &= | ||
257 | ((uint)PermissionMask.Copy | | ||
258 | (uint)PermissionMask.Transfer | | ||
259 | (uint)PermissionMask.Modify); | ||
260 | objectGroup.RootPart.NextOwnerMask |= | ||
261 | (uint)PermissionMask.Move; | ||
249 | 262 | ||
250 | objectGroup.AbsolutePosition = inventoryStoredPosition; | 263 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); |
251 | 264 | ||
252 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); | 265 | objectGroup.AbsolutePosition = originalPosition; |
253 | 266 | ||
254 | objectGroup.AbsolutePosition = originalPosition; | 267 | xmlStrings[objectGroup.UUID] = sceneObjectXml; |
268 | } | ||
255 | 269 | ||
256 | // Get the user info of the item destination | 270 | string itemXml; |
257 | // | ||
258 | UUID userID = UUID.Zero; | ||
259 | 271 | ||
260 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | 272 | if (objlist.Count > 1) |
261 | action == DeRezAction.SaveToExistingUserInventoryItem) | 273 | { |
262 | { | 274 | float minX, minY, minZ; |
263 | // Take or take copy require a taker | 275 | float maxX, maxY, maxZ; |
264 | // Saving changes requires a local user | ||
265 | // | ||
266 | if (remoteClient == null) | ||
267 | return UUID.Zero; | ||
268 | 276 | ||
269 | userID = remoteClient.AgentId; | 277 | Vector3[] offsets = m_Scene.GetCombinedBoundingBox(objlist, |
270 | } | 278 | out minX, out maxX, out minY, out maxY, |
271 | else | 279 | out minZ, out maxZ); |
272 | { | ||
273 | // All returns / deletes go to the object owner | ||
274 | // | ||
275 | 280 | ||
276 | userID = objectGroup.RootPart.OwnerID; | 281 | // CreateWrapper |
277 | } | 282 | XmlDocument itemDoc = new XmlDocument(); |
283 | XmlElement root = itemDoc.CreateElement("", "CoalescedObject", ""); | ||
284 | itemDoc.AppendChild(root); | ||
278 | 285 | ||
279 | if (userID == UUID.Zero) // Can't proceed | 286 | // Embed the offsets into the group XML |
280 | { | 287 | for ( int i = 0 ; i < objlist.Count ; i++ ) |
281 | return UUID.Zero; | 288 | { |
282 | } | 289 | XmlDocument doc = new XmlDocument(); |
290 | SceneObjectGroup g = objlist[i]; | ||
291 | doc.LoadXml(xmlStrings[g.UUID]); | ||
292 | XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup"); | ||
293 | e.SetAttribute("offsetx", offsets[i].X.ToString()); | ||
294 | e.SetAttribute("offsety", offsets[i].Y.ToString()); | ||
295 | e.SetAttribute("offsetz", offsets[i].Z.ToString()); | ||
296 | |||
297 | XmlNode objectNode = itemDoc.ImportNode(e, true); | ||
298 | root.AppendChild(objectNode); | ||
299 | } | ||
283 | 300 | ||
284 | // If we're returning someone's item, it goes back to the | 301 | float sizeX = maxX - minX; |
285 | // owner's Lost And Found folder. | 302 | float sizeY = maxY - minY; |
286 | // Delete is treated like return in this case | 303 | float sizeZ = maxZ - minZ; |
287 | // Deleting your own items makes them go to trash | ||
288 | // | ||
289 | 304 | ||
290 | InventoryFolderBase folder = null; | 305 | root.SetAttribute("x", sizeX.ToString()); |
291 | InventoryItemBase item = null; | 306 | root.SetAttribute("y", sizeY.ToString()); |
307 | root.SetAttribute("z", sizeZ.ToString()); | ||
292 | 308 | ||
293 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 309 | itemXml = itemDoc.InnerXml; |
294 | { | 310 | } |
295 | item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID, userID); | 311 | else |
296 | item = m_Scene.InventoryService.GetItem(item); | 312 | { |
313 | itemXml = xmlStrings[objlist[0].UUID]; | ||
314 | } | ||
315 | |||
316 | // Get the user info of the item destination | ||
317 | // | ||
318 | UUID userID = UUID.Zero; | ||
319 | |||
320 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | ||
321 | action == DeRezAction.SaveToExistingUserInventoryItem) | ||
322 | { | ||
323 | // Take or take copy require a taker | ||
324 | // Saving changes requires a local user | ||
325 | // | ||
326 | if (remoteClient == null) | ||
327 | return UUID.Zero; | ||
328 | |||
329 | userID = remoteClient.AgentId; | ||
330 | } | ||
331 | else | ||
332 | { | ||
333 | // All returns / deletes go to the object owner | ||
334 | // | ||
297 | 335 | ||
298 | //item = userInfo.RootFolder.FindItem( | 336 | userID = objlist[0].RootPart.OwnerID; |
299 | // objectGroup.RootPart.FromUserInventoryItemID); | 337 | } |
300 | 338 | ||
301 | if (null == item) | 339 | if (userID == UUID.Zero) // Can't proceed |
302 | { | 340 | { |
303 | m_log.DebugFormat( | ||
304 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
305 | objectGroup.Name, objectGroup.UUID); | ||
306 | return UUID.Zero; | 341 | return UUID.Zero; |
307 | } | 342 | } |
308 | } | 343 | |
309 | else | 344 | // If we're returning someone's item, it goes back to the |
310 | { | 345 | // owner's Lost And Found folder. |
311 | // Folder magic | 346 | // Delete is treated like return in this case |
347 | // Deleting your own items makes them go to trash | ||
312 | // | 348 | // |
313 | if (action == DeRezAction.Delete) | 349 | |
350 | InventoryFolderBase folder = null; | ||
351 | InventoryItemBase item = null; | ||
352 | |||
353 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
314 | { | 354 | { |
315 | // Deleting someone else's item | 355 | item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID); |
316 | // | 356 | item = m_Scene.InventoryService.GetItem(item); |
317 | if (remoteClient == null || | ||
318 | objectGroup.OwnerID != remoteClient.AgentId) | ||
319 | { | ||
320 | 357 | ||
321 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 358 | //item = userInfo.RootFolder.FindItem( |
322 | } | 359 | // objectGroup.RootPart.FromUserInventoryItemID); |
323 | else | 360 | |
361 | if (null == item) | ||
324 | { | 362 | { |
325 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | 363 | m_log.DebugFormat( |
364 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
365 | objlist[0].Name, objlist[0].UUID); | ||
366 | return UUID.Zero; | ||
326 | } | 367 | } |
327 | } | 368 | } |
328 | else if (action == DeRezAction.Return) | 369 | else |
329 | { | 370 | { |
330 | 371 | // Folder magic | |
331 | // Dump to lost + found unconditionally | ||
332 | // | 372 | // |
333 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
334 | } | ||
335 | |||
336 | if (folderID == UUID.Zero && folder == null) | ||
337 | { | ||
338 | if (action == DeRezAction.Delete) | 373 | if (action == DeRezAction.Delete) |
339 | { | 374 | { |
340 | // Deletes go to trash by default | 375 | // Deleting someone else's item |
341 | // | 376 | // |
342 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
343 | } | ||
344 | else | ||
345 | { | ||
346 | if (remoteClient == null || | 377 | if (remoteClient == null || |
347 | objectGroup.OwnerID != remoteClient.AgentId) | 378 | objlist[0].OwnerID != remoteClient.AgentId) |
348 | { | 379 | { |
349 | // Taking copy of another person's item. Take to | 380 | |
350 | // Objects folder. | 381 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
351 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); | ||
352 | } | 382 | } |
353 | else | 383 | else |
354 | { | 384 | { |
355 | // Catch all. Use lost & found | 385 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); |
386 | } | ||
387 | } | ||
388 | else if (action == DeRezAction.Return) | ||
389 | { | ||
390 | |||
391 | // Dump to lost + found unconditionally | ||
392 | // | ||
393 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
394 | } | ||
395 | |||
396 | if (folderID == UUID.Zero && folder == null) | ||
397 | { | ||
398 | if (action == DeRezAction.Delete) | ||
399 | { | ||
400 | // Deletes go to trash by default | ||
356 | // | 401 | // |
402 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
403 | } | ||
404 | else | ||
405 | { | ||
406 | if (remoteClient == null || | ||
407 | objlist[0].OwnerID != remoteClient.AgentId) | ||
408 | { | ||
409 | // Taking copy of another person's item. Take to | ||
410 | // Objects folder. | ||
411 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); | ||
412 | } | ||
413 | else | ||
414 | { | ||
415 | // Catch all. Use lost & found | ||
416 | // | ||
357 | 417 | ||
358 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 418 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
419 | } | ||
359 | } | 420 | } |
360 | } | 421 | } |
361 | } | ||
362 | 422 | ||
363 | // Override and put into where it came from, if it came | 423 | // Override and put into where it came from, if it came |
364 | // from anywhere in inventory | 424 | // from anywhere in inventory |
365 | // | 425 | // |
366 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) | 426 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) |
367 | { | ||
368 | if (objectGroup.RootPart.FromFolderID != UUID.Zero) | ||
369 | { | 427 | { |
370 | InventoryFolderBase f = new InventoryFolderBase(objectGroup.RootPart.FromFolderID, userID); | 428 | if (objlist[0].RootPart.FromFolderID != UUID.Zero) |
371 | folder = m_Scene.InventoryService.GetFolder(f); | 429 | { |
430 | InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); | ||
431 | folder = m_Scene.InventoryService.GetFolder(f); | ||
432 | } | ||
372 | } | 433 | } |
373 | } | ||
374 | 434 | ||
375 | if (folder == null) // None of the above | 435 | if (folder == null) // None of the above |
376 | { | 436 | { |
377 | folder = new InventoryFolderBase(folderID); | 437 | folder = new InventoryFolderBase(folderID); |
378 | 438 | ||
379 | if (folder == null) // Nowhere to put it | 439 | if (folder == null) // Nowhere to put it |
440 | { | ||
441 | return UUID.Zero; | ||
442 | } | ||
443 | } | ||
444 | |||
445 | item = new InventoryItemBase(); | ||
446 | // Can't know creator is the same, so null it in inventory | ||
447 | if (objlist.Count > 1) | ||
448 | item.CreatorId = UUID.Zero.ToString(); | ||
449 | else | ||
450 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
451 | item.ID = UUID.Random(); | ||
452 | item.InvType = (int)InventoryType.Object; | ||
453 | item.Folder = folder.ID; | ||
454 | item.Owner = userID; | ||
455 | if (objlist.Count > 1) | ||
380 | { | 456 | { |
381 | return UUID.Zero; | 457 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; |
458 | } | ||
459 | else | ||
460 | { | ||
461 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | ||
462 | item.SalePrice = objlist[0].RootPart.SalePrice; | ||
382 | } | 463 | } |
383 | } | 464 | } |
384 | 465 | ||
385 | item = new InventoryItemBase(); | 466 | AssetBase asset = CreateAsset( |
386 | item.CreatorId = objectGroup.RootPart.CreatorID.ToString(); | 467 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), |
387 | item.CreatorData = objectGroup.RootPart.CreatorData; | 468 | objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), |
388 | item.ID = UUID.Random(); | 469 | (sbyte)AssetType.Object, |
389 | item.InvType = (int)InventoryType.Object; | 470 | Utils.StringToBytes(itemXml), |
390 | item.Folder = folder.ID; | 471 | objlist[0].OwnerID.ToString()); |
391 | item.Owner = userID; | 472 | m_Scene.AssetService.Store(asset); |
392 | } | 473 | assetID = asset.FullID; |
393 | |||
394 | AssetBase asset = CreateAsset( | ||
395 | objectGroup.GetPartName(objectGroup.RootPart.LocalId), | ||
396 | objectGroup.GetPartDescription(objectGroup.RootPart.LocalId), | ||
397 | (sbyte)AssetType.Object, | ||
398 | Utils.StringToBytes(sceneObjectXml), | ||
399 | objectGroup.OwnerID.ToString()); | ||
400 | m_Scene.AssetService.Store(asset); | ||
401 | assetID = asset.FullID; | ||
402 | |||
403 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
404 | { | ||
405 | item.AssetID = asset.FullID; | ||
406 | m_Scene.InventoryService.UpdateItem(item); | ||
407 | } | ||
408 | else | ||
409 | { | ||
410 | item.AssetID = asset.FullID; | ||
411 | 474 | ||
412 | if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 475 | if (DeRezAction.SaveToExistingUserInventoryItem == action) |
413 | { | 476 | { |
414 | uint perms = objectGroup.GetEffectivePermissions(); | 477 | item.AssetID = asset.FullID; |
415 | uint nextPerms = (perms & 7) << 13; | 478 | m_Scene.InventoryService.UpdateItem(item); |
416 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
417 | perms &= ~(uint)PermissionMask.Copy; | ||
418 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
419 | perms &= ~(uint)PermissionMask.Transfer; | ||
420 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
421 | perms &= ~(uint)PermissionMask.Modify; | ||
422 | |||
423 | // Make sure all bits but the ones we want are clear | ||
424 | // on take. | ||
425 | // This will be applied to the current perms, so | ||
426 | // it will do what we want. | ||
427 | objectGroup.RootPart.NextOwnerMask &= | ||
428 | ((uint)PermissionMask.Copy | | ||
429 | (uint)PermissionMask.Transfer | | ||
430 | (uint)PermissionMask.Modify); | ||
431 | objectGroup.RootPart.NextOwnerMask |= | ||
432 | (uint)PermissionMask.Move; | ||
433 | |||
434 | item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; | ||
435 | item.CurrentPermissions = item.BasePermissions; | ||
436 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
437 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; | ||
438 | item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; | ||
439 | |||
440 | item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | ||
441 | } | 479 | } |
442 | else | 480 | else |
443 | { | 481 | { |
444 | item.BasePermissions = objectGroup.GetEffectivePermissions(); | 482 | item.AssetID = asset.FullID; |
445 | item.CurrentPermissions = objectGroup.GetEffectivePermissions(); | ||
446 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
447 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; | ||
448 | item.GroupPermissions = objectGroup.RootPart.GroupMask; | ||
449 | 483 | ||
450 | item.CurrentPermissions &= | 484 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; |
451 | ((uint)PermissionMask.Copy | | 485 | foreach (SceneObjectGroup grp in objlist) |
452 | (uint)PermissionMask.Transfer | | 486 | effectivePerms &= grp.GetEffectivePermissions(); |
453 | (uint)PermissionMask.Modify | | 487 | effectivePerms |= (uint)PermissionMask.Move; |
454 | (uint)PermissionMask.Move | | ||
455 | 7); // Preserve folded permissions | ||
456 | } | ||
457 | 488 | ||
458 | // TODO: add the new fields (Flags, Sale info, etc) | 489 | if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
459 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 490 | { |
460 | item.Description = asset.Description; | 491 | uint perms = effectivePerms; |
461 | item.Name = asset.Name; | 492 | uint nextPerms = (perms & 7) << 13; |
462 | item.AssetType = asset.Type; | 493 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) |
494 | perms &= ~(uint)PermissionMask.Copy; | ||
495 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
496 | perms &= ~(uint)PermissionMask.Transfer; | ||
497 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
498 | perms &= ~(uint)PermissionMask.Modify; | ||
499 | |||
500 | item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
501 | item.CurrentPermissions = item.BasePermissions; | ||
502 | item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
503 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask; | ||
504 | item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask; | ||
505 | |||
506 | // Magic number badness. Maybe this deserves an enum. | ||
507 | // bit 4 (16) is the "Slam" bit, it means treat as passed | ||
508 | // and apply next owner perms on rez | ||
509 | item.CurrentPermissions |= 16; // Slam! | ||
510 | } | ||
511 | else | ||
512 | { | ||
513 | item.BasePermissions = effectivePerms; | ||
514 | item.CurrentPermissions = effectivePerms; | ||
515 | item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms; | ||
516 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms; | ||
517 | item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms; | ||
518 | |||
519 | item.CurrentPermissions &= | ||
520 | ((uint)PermissionMask.Copy | | ||
521 | (uint)PermissionMask.Transfer | | ||
522 | (uint)PermissionMask.Modify | | ||
523 | (uint)PermissionMask.Move | | ||
524 | 7); // Preserve folded permissions | ||
525 | } | ||
463 | 526 | ||
464 | m_Scene.AddInventoryItem(item); | 527 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
528 | item.Description = asset.Description; | ||
529 | item.Name = asset.Name; | ||
530 | item.AssetType = asset.Type; | ||
465 | 531 | ||
466 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 532 | m_Scene.AddInventoryItem(item); |
467 | { | 533 | |
468 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | 534 | if (remoteClient != null && item.Owner == remoteClient.AgentId) |
469 | } | ||
470 | else | ||
471 | { | ||
472 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | ||
473 | if (notifyUser != null) | ||
474 | { | 535 | { |
475 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | 536 | remoteClient.SendInventoryItemCreateUpdate(item, 0); |
537 | } | ||
538 | else | ||
539 | { | ||
540 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | ||
541 | if (notifyUser != null) | ||
542 | { | ||
543 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | ||
544 | } | ||
476 | } | 545 | } |
477 | } | 546 | } |
478 | } | 547 | } |
479 | |||
480 | return assetID; | 548 | return assetID; |
481 | } | 549 | } |
482 | 550 | ||
@@ -484,8 +552,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
484 | /// <summary> | 552 | /// <summary> |
485 | /// Rez an object into the scene from the user's inventory | 553 | /// Rez an object into the scene from the user's inventory |
486 | /// </summary> | 554 | /// </summary> |
555 | /// <remarks> | ||
487 | /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing | 556 | /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing |
488 | /// things to the scene. The caller should be doing that, I think. | 557 | /// things to the scene. The caller should be doing that, I think. |
558 | /// </remarks> | ||
489 | /// <param name="remoteClient"></param> | 559 | /// <param name="remoteClient"></param> |
490 | /// <param name="itemID"></param> | 560 | /// <param name="itemID"></param> |
491 | /// <param name="RayEnd"></param> | 561 | /// <param name="RayEnd"></param> |
@@ -502,21 +572,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
502 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 572 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
503 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 573 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
504 | { | 574 | { |
505 | // Work out position details | 575 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); |
506 | byte bRayEndIsIntersection = (byte)0; | 576 | |
507 | 577 | byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); | |
508 | if (RayEndIsIntersection) | ||
509 | { | ||
510 | bRayEndIsIntersection = (byte)1; | ||
511 | } | ||
512 | else | ||
513 | { | ||
514 | bRayEndIsIntersection = (byte)0; | ||
515 | } | ||
516 | |||
517 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); | 578 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); |
518 | |||
519 | |||
520 | Vector3 pos = m_Scene.GetNewRezLocation( | 579 | Vector3 pos = m_Scene.GetNewRezLocation( |
521 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | 580 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, |
522 | BypassRayCast, bRayEndIsIntersection, true, scale, false); | 581 | BypassRayCast, bRayEndIsIntersection, true, scale, false); |
@@ -531,6 +590,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
531 | 590 | ||
532 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); | 591 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); |
533 | 592 | ||
593 | SceneObjectGroup group = null; | ||
594 | |||
534 | if (rezAsset != null) | 595 | if (rezAsset != null) |
535 | { | 596 | { |
536 | UUID itemId = UUID.Zero; | 597 | UUID itemId = UUID.Zero; |
@@ -539,34 +600,78 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
539 | // item that it came from. This allows us to enable 'save object to inventory' | 600 | // item that it came from. This allows us to enable 'save object to inventory' |
540 | if (!m_Scene.Permissions.BypassPermissions()) | 601 | if (!m_Scene.Permissions.BypassPermissions()) |
541 | { | 602 | { |
542 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy) | 603 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy && (item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
543 | { | 604 | { |
544 | itemId = item.ID; | 605 | itemId = item.ID; |
545 | } | 606 | } |
546 | } | 607 | } |
547 | else | 608 | else |
548 | { | 609 | { |
549 | // Brave new fullperm world | 610 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
550 | // | 611 | { |
551 | itemId = item.ID; | 612 | // Brave new fullperm world |
613 | itemId = item.ID; | ||
614 | } | ||
552 | } | 615 | } |
553 | 616 | ||
554 | string xmlData = Utils.BytesToString(rezAsset.Data); | 617 | string xmlData = Utils.BytesToString(rezAsset.Data); |
555 | SceneObjectGroup group | 618 | List<SceneObjectGroup> objlist = |
556 | = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); | 619 | new List<SceneObjectGroup>(); |
620 | List<Vector3> veclist = new List<Vector3>(); | ||
621 | |||
622 | XmlDocument doc = new XmlDocument(); | ||
623 | doc.LoadXml(xmlData); | ||
624 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); | ||
625 | if (e == null || attachment) // Single | ||
626 | { | ||
627 | SceneObjectGroup g = | ||
628 | SceneObjectSerializer.FromOriginalXmlFormat( | ||
629 | itemId, xmlData); | ||
630 | objlist.Add(g); | ||
631 | veclist.Add(new Vector3(0, 0, 0)); | ||
557 | 632 | ||
558 | Util.FireAndForget(delegate { AddUserData(group); }); | 633 | float offsetHeight = 0; |
559 | 634 | pos = m_Scene.GetNewRezLocation( | |
560 | group.RootPart.FromFolderID = item.Folder; | 635 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, |
636 | BypassRayCast, bRayEndIsIntersection, true, g.GetAxisAlignedBoundingBox(out offsetHeight), false); | ||
637 | pos.Z += offsetHeight; | ||
638 | } | ||
639 | else | ||
640 | { | ||
641 | XmlElement coll = (XmlElement)e; | ||
642 | float bx = Convert.ToSingle(coll.GetAttribute("x")); | ||
643 | float by = Convert.ToSingle(coll.GetAttribute("y")); | ||
644 | float bz = Convert.ToSingle(coll.GetAttribute("z")); | ||
645 | Vector3 bbox = new Vector3(bx, by, bz); | ||
561 | 646 | ||
562 | // If it's rezzed in world, select it. Much easier to | 647 | pos = m_Scene.GetNewRezLocation(RayStart, RayEnd, |
563 | // find small items. | 648 | RayTargetID, Quaternion.Identity, |
564 | // | 649 | BypassRayCast, bRayEndIsIntersection, true, |
565 | if (!attachment) | 650 | bbox, false); |
566 | group.RootPart.CreateSelected = true; | 651 | |
652 | pos -= bbox / 2; | ||
653 | |||
654 | XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); | ||
655 | foreach (XmlNode n in groups) | ||
656 | { | ||
657 | SceneObjectGroup g = | ||
658 | SceneObjectSerializer.FromOriginalXmlFormat( | ||
659 | itemId, n.OuterXml); | ||
660 | objlist.Add(g); | ||
661 | XmlElement el = (XmlElement)n; | ||
662 | float x = Convert.ToSingle(el.GetAttribute("offsetx")); | ||
663 | float y = Convert.ToSingle(el.GetAttribute("offsety")); | ||
664 | float z = Convert.ToSingle(el.GetAttribute("offsetz")); | ||
665 | veclist.Add(new Vector3(x, y, z)); | ||
666 | } | ||
667 | } | ||
668 | |||
669 | int primcount = 0; | ||
670 | foreach (SceneObjectGroup g in objlist) | ||
671 | primcount += g.PrimCount; | ||
567 | 672 | ||
568 | if (!m_Scene.Permissions.CanRezObject( | 673 | if (!m_Scene.Permissions.CanRezObject( |
569 | group.PrimCount, remoteClient.AgentId, pos) | 674 | primcount, remoteClient.AgentId, pos) |
570 | && !attachment) | 675 | && !attachment) |
571 | { | 676 | { |
572 | // The client operates in no fail mode. It will | 677 | // The client operates in no fail mode. It will |
@@ -579,131 +684,131 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
579 | return null; | 684 | return null; |
580 | } | 685 | } |
581 | 686 | ||
582 | group.ResetIDs(); | 687 | for (int i = 0 ; i < objlist.Count ; i++ ) |
583 | |||
584 | if (attachment) | ||
585 | { | 688 | { |
586 | group.RootPart.Flags |= PrimFlags.Phantom; | 689 | group = objlist[i]; |
587 | group.RootPart.IsAttachment = true; | 690 | |
691 | Vector3 storedPosition = group.AbsolutePosition; | ||
692 | if (group.UUID == UUID.Zero) | ||
693 | { | ||
694 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 3"); | ||
695 | } | ||
696 | group.RootPart.FromFolderID = item.Folder; | ||
697 | |||
698 | // If it's rezzed in world, select it. Much easier to | ||
699 | // find small items. | ||
700 | // | ||
701 | if (!attachment) | ||
702 | { | ||
703 | group.RootPart.CreateSelected = true; | ||
704 | foreach (SceneObjectPart child in group.Parts) | ||
705 | child.CreateSelected = true; | ||
706 | } | ||
707 | group.ResetIDs(); | ||
708 | |||
709 | if (attachment) | ||
710 | { | ||
711 | group.RootPart.Flags |= PrimFlags.Phantom; | ||
712 | group.RootPart.IsAttachment = true; | ||
713 | } | ||
588 | 714 | ||
589 | // If we're rezzing an attachment then don't ask | 715 | // If we're rezzing an attachment then don't ask |
590 | // AddNewSceneObject() to update the client since | 716 | // AddNewSceneObject() to update the client since |
591 | // we'll be doing that later on. Scheduling more | 717 | // we'll be doing that later on. Scheduling more than |
592 | // than one full update during the attachment | 718 | // one full update during the attachment |
593 | // process causes some clients to fail to display | 719 | // process causes some clients to fail to display the |
594 | // the attachment properly. | 720 | // attachment properly. |
595 | // Also, don't persist attachments. | ||
596 | m_Scene.AddNewSceneObject(group, false, false); | ||
597 | } | ||
598 | else | ||
599 | { | ||
600 | m_Scene.AddNewSceneObject(group, true, false); | 721 | m_Scene.AddNewSceneObject(group, true, false); |
601 | } | ||
602 | 722 | ||
603 | // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); | 723 | // if attachment we set it's asset id so object updates |
604 | // if attachment we set it's asset id so object updates can reflect that | 724 | // can reflect that, if not, we set it's position in world. |
605 | // if not, we set it's position in world. | 725 | if (!attachment) |
606 | if (!attachment) | 726 | { |
607 | { | 727 | group.ScheduleGroupForFullUpdate(); |
608 | group.ScheduleGroupForFullUpdate(); | 728 | |
609 | 729 | group.AbsolutePosition = pos + veclist[i]; | |
610 | float offsetHeight = 0; | 730 | } |
611 | pos = m_Scene.GetNewRezLocation( | 731 | else |
612 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | 732 | { |
613 | BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(out offsetHeight), false); | 733 | group.SetFromItemID(itemID); |
614 | pos.Z += offsetHeight; | 734 | } |
615 | group.AbsolutePosition = pos; | ||
616 | // m_log.InfoFormat("rezx point for inventory rezz is {0} {1} {2} and offsetheight was {3}", pos.X, pos.Y, pos.Z, offsetHeight); | ||
617 | |||
618 | } | ||
619 | else | ||
620 | { | ||
621 | group.SetFromItemID(itemID); | ||
622 | } | ||
623 | 735 | ||
624 | SceneObjectPart rootPart = null; | 736 | SceneObjectPart rootPart = null; |
625 | try | ||
626 | { | ||
627 | rootPart = group.GetChildPart(group.UUID); | ||
628 | } | ||
629 | catch (NullReferenceException) | ||
630 | { | ||
631 | string isAttachment = ""; | ||
632 | 737 | ||
633 | if (attachment) | 738 | try |
634 | isAttachment = " Object was an attachment"; | 739 | { |
740 | rootPart = group.GetChildPart(group.UUID); | ||
741 | } | ||
742 | catch (NullReferenceException) | ||
743 | { | ||
744 | string isAttachment = ""; | ||
635 | 745 | ||
636 | m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); | 746 | if (attachment) |
637 | } | 747 | isAttachment = " Object was an attachment"; |
638 | 748 | ||
639 | // Since renaming the item in the inventory does not affect the name stored | 749 | m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); |
640 | // in the serialization, transfer the correct name from the inventory to the | 750 | } |
641 | // object itself before we rez. | ||
642 | rootPart.Name = item.Name; | ||
643 | rootPart.Description = item.Description; | ||
644 | 751 | ||
645 | if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0) | 752 | // Since renaming the item in the inventory does not |
646 | { | 753 | // affect the name stored in the serialization, transfer |
754 | // the correct name from the inventory to the | ||
755 | // object itself before we rez. | ||
756 | rootPart.Name = item.Name; | ||
757 | rootPart.Description = item.Description; | ||
647 | rootPart.ObjectSaleType = item.SaleType; | 758 | rootPart.ObjectSaleType = item.SaleType; |
648 | rootPart.SalePrice = item.SalePrice; | 759 | rootPart.SalePrice = item.SalePrice; |
649 | } | ||
650 | |||
651 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | ||
652 | if ((rootPart.OwnerID != item.Owner) || | ||
653 | (item.CurrentPermissions & 16) != 0 || // Magic number | ||
654 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
655 | { | ||
656 | //Need to kill the for sale here | ||
657 | rootPart.ObjectSaleType = 0; | ||
658 | rootPart.SalePrice = 10; | ||
659 | 760 | ||
660 | if (m_Scene.Permissions.PropagatePermissions()) | 761 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); |
762 | if ((rootPart.OwnerID != item.Owner) || | ||
763 | (item.CurrentPermissions & 16) != 0) | ||
661 | { | 764 | { |
662 | foreach (SceneObjectPart part in group.Parts) | 765 | //Need to kill the for sale here |
766 | rootPart.ObjectSaleType = 0; | ||
767 | rootPart.SalePrice = 10; | ||
768 | |||
769 | if (m_Scene.Permissions.PropagatePermissions()) | ||
663 | { | 770 | { |
664 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 771 | foreach (SceneObjectPart part in group.Parts) |
665 | part.EveryoneMask = item.EveryOnePermissions; | 772 | { |
666 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | 773 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
667 | part.NextOwnerMask = item.NextPermissions; | 774 | { |
668 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | 775 | part.EveryoneMask = item.EveryOnePermissions; |
669 | part.GroupMask = item.GroupPermissions; | 776 | part.NextOwnerMask = item.NextPermissions; |
777 | } | ||
778 | part.GroupMask = 0; // DO NOT propagate here | ||
779 | } | ||
780 | |||
781 | group.ApplyNextOwnerPermissions(); | ||
670 | } | 782 | } |
671 | |||
672 | group.ApplyNextOwnerPermissions(); | ||
673 | } | 783 | } |
674 | } | ||
675 | 784 | ||
676 | foreach (SceneObjectPart part in group.Parts) | 785 | foreach (SceneObjectPart part in group.Parts) |
677 | { | ||
678 | if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) | ||
679 | { | 786 | { |
680 | part.LastOwnerID = part.OwnerID; | 787 | if ((part.OwnerID != item.Owner) || |
681 | part.OwnerID = item.Owner; | 788 | (item.CurrentPermissions & 16) != 0) |
682 | part.Inventory.ChangeInventoryOwner(item.Owner); | 789 | { |
683 | part.GroupMask = 0; // DO NOT propagate here | 790 | part.LastOwnerID = part.OwnerID; |
684 | } | 791 | part.OwnerID = item.Owner; |
685 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 792 | part.Inventory.ChangeInventoryOwner(item.Owner); |
793 | part.GroupMask = 0; // DO NOT propagate here | ||
794 | } | ||
686 | part.EveryoneMask = item.EveryOnePermissions; | 795 | part.EveryoneMask = item.EveryOnePermissions; |
687 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
688 | part.NextOwnerMask = item.NextPermissions; | 796 | part.NextOwnerMask = item.NextPermissions; |
689 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | 797 | } |
690 | part.GroupMask = item.GroupPermissions; | ||
691 | } | ||
692 | 798 | ||
693 | rootPart.TrimPermissions(); | 799 | rootPart.TrimPermissions(); |
694 | 800 | ||
695 | if (!attachment) | 801 | if (!attachment) |
696 | { | ||
697 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | ||
698 | { | 802 | { |
699 | group.ClearPartAttachmentData(); | 803 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) |
700 | } | 804 | group.ClearPartAttachmentData(); |
701 | 805 | ||
702 | // Fire on_rez | 806 | // Fire on_rez |
703 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); | 807 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); |
704 | rootPart.ParentGroup.ResumeScripts(); | 808 | rootPart.ParentGroup.ResumeScripts(); |
705 | 809 | ||
706 | rootPart.ScheduleFullUpdate(); | 810 | rootPart.ScheduleFullUpdate(); |
811 | } | ||
707 | } | 812 | } |
708 | 813 | ||
709 | if (!m_Scene.Permissions.BypassPermissions()) | 814 | if (!m_Scene.Permissions.BypassPermissions()) |
@@ -721,9 +826,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
721 | } | 826 | } |
722 | } | 827 | } |
723 | } | 828 | } |
724 | |||
725 | return rootPart.ParentGroup; | ||
726 | } | 829 | } |
830 | return group; | ||
727 | } | 831 | } |
728 | 832 | ||
729 | return null; | 833 | return null; |
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index 00b0aa9..2de8d7a 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs | |||
@@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
148 | public void SendProfileToClient(ScenePresence presence) | 148 | public void SendProfileToClient(ScenePresence presence) |
149 | { | 149 | { |
150 | IClientAPI client = presence.ControllingClient; | 150 | IClientAPI client = presence.ControllingClient; |
151 | if (m_enableWindlight) | 151 | if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) |
152 | { | 152 | { |
153 | if (presence.IsChildAgent == false) | 153 | if (presence.IsChildAgent == false) |
154 | { | 154 | { |
@@ -165,7 +165,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
165 | public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl) | 165 | public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl) |
166 | { | 166 | { |
167 | IClientAPI client = presence.ControllingClient; | 167 | IClientAPI client = presence.ControllingClient; |
168 | if (m_enableWindlight) | 168 | if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) |
169 | { | 169 | { |
170 | if (presence.IsChildAgent == false) | 170 | if (presence.IsChildAgent == false) |
171 | { | 171 | { |
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs index c0975ea..9255791 100644 --- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs | |||
@@ -111,14 +111,12 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
111 | { | 111 | { |
112 | if ((SMTPConfig = m_Config.Configs["SMTP"]) == null) | 112 | if ((SMTPConfig = m_Config.Configs["SMTP"]) == null) |
113 | { | 113 | { |
114 | m_log.InfoFormat("[SMTP] SMTP server not configured"); | ||
115 | m_Enabled = false; | 114 | m_Enabled = false; |
116 | return; | 115 | return; |
117 | } | 116 | } |
118 | 117 | ||
119 | if (!SMTPConfig.GetBoolean("enabled", false)) | 118 | if (!SMTPConfig.GetBoolean("enabled", false)) |
120 | { | 119 | { |
121 | m_log.InfoFormat("[SMTP] module disabled in configuration"); | ||
122 | m_Enabled = false; | 120 | m_Enabled = false; |
123 | return; | 121 | return; |
124 | } | 122 | } |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index d78931a..4c8424d 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -29,8 +29,10 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Net.Security; | ||
32 | using System.Text; | 33 | using System.Text; |
33 | using System.Threading; | 34 | using System.Threading; |
35 | using System.Security.Cryptography.X509Certificates; | ||
34 | using Nini.Config; | 36 | using Nini.Config; |
35 | using OpenMetaverse; | 37 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
@@ -100,8 +102,24 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
100 | 102 | ||
101 | public HttpRequestModule() | 103 | public HttpRequestModule() |
102 | { | 104 | { |
105 | ServicePointManager.ServerCertificateValidationCallback +=ValidateServerCertificate; | ||
103 | } | 106 | } |
104 | 107 | ||
108 | public static bool ValidateServerCertificate( | ||
109 | object sender, | ||
110 | X509Certificate certificate, | ||
111 | X509Chain chain, | ||
112 | SslPolicyErrors sslPolicyErrors) | ||
113 | { | ||
114 | HttpWebRequest Request = (HttpWebRequest)sender; | ||
115 | |||
116 | if (Request.Headers.Get("NoVerifyCert") != null) | ||
117 | { | ||
118 | return true; | ||
119 | } | ||
120 | |||
121 | return chain.Build(new X509Certificate2(certificate)); | ||
122 | } | ||
105 | #region IHttpRequestModule Members | 123 | #region IHttpRequestModule Members |
106 | 124 | ||
107 | public UUID MakeHttpRequest(string url, string parameters, string body) | 125 | public UUID MakeHttpRequest(string url, string parameters, string body) |
@@ -141,8 +159,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
141 | break; | 159 | break; |
142 | 160 | ||
143 | case (int)HttpRequestConstants.HTTP_VERIFY_CERT: | 161 | case (int)HttpRequestConstants.HTTP_VERIFY_CERT: |
144 | 162 | htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0); | |
145 | // TODO implement me | ||
146 | break; | 163 | break; |
147 | } | 164 | } |
148 | } | 165 | } |
@@ -189,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
189 | * Not sure how important ordering is is here - the next first | 206 | * Not sure how important ordering is is here - the next first |
190 | * one completed in the list is returned, based soley on its list | 207 | * one completed in the list is returned, based soley on its list |
191 | * position, not the order in which the request was started or | 208 | * position, not the order in which the request was started or |
192 | * finsihed. I thought about setting up a queue for this, but | 209 | * finished. I thought about setting up a queue for this, but |
193 | * it will need some refactoring and this works 'enough' right now | 210 | * it will need some refactoring and this works 'enough' right now |
194 | */ | 211 | */ |
195 | 212 | ||
@@ -237,8 +254,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
237 | 254 | ||
238 | m_scene.RegisterModuleInterface<IHttpRequestModule>(this); | 255 | m_scene.RegisterModuleInterface<IHttpRequestModule>(this); |
239 | 256 | ||
240 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); | 257 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); |
241 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); | 258 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); |
242 | 259 | ||
243 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); | 260 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); |
244 | } | 261 | } |
@@ -282,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
282 | public string HttpMethod = "GET"; | 299 | public string HttpMethod = "GET"; |
283 | public string HttpMIMEType = "text/plain;charset=utf-8"; | 300 | public string HttpMIMEType = "text/plain;charset=utf-8"; |
284 | public int HttpTimeout; | 301 | public int HttpTimeout; |
285 | // public bool HttpVerifyCert = true; // not implemented | 302 | public bool HttpVerifyCert = true; |
286 | private Thread httpThread; | 303 | private Thread httpThread; |
287 | 304 | ||
288 | // Request info | 305 | // Request info |
@@ -344,6 +361,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
344 | Request.Method = HttpMethod; | 361 | Request.Method = HttpMethod; |
345 | Request.ContentType = HttpMIMEType; | 362 | Request.ContentType = HttpMIMEType; |
346 | 363 | ||
364 | if(!HttpVerifyCert) | ||
365 | { | ||
366 | // We could hijack Connection Group Name to identify | ||
367 | // a desired security exception. But at the moment we'll use a dummy header instead. | ||
368 | // Request.ConnectionGroupName = "NoVerify"; | ||
369 | Request.Headers.Add("NoVerifyCert", "true"); | ||
370 | } | ||
371 | // else | ||
372 | // { | ||
373 | // Request.ConnectionGroupName="Verify"; | ||
374 | // } | ||
347 | if (proxyurl != null && proxyurl.Length > 0) | 375 | if (proxyurl != null && proxyurl.Length > 0) |
348 | { | 376 | { |
349 | if (proxyexcepts != null && proxyexcepts.Length > 0) | 377 | if (proxyexcepts != null && proxyexcepts.Length > 0) |
@@ -436,4 +464,4 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
436 | } | 464 | } |
437 | } | 465 | } |
438 | } | 466 | } |
439 | } | 467 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 57ab135..b6d64ac 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -200,12 +200,13 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
200 | } | 200 | } |
201 | Scene.RegionInfo.RegionSettings.Save(); | 201 | Scene.RegionInfo.RegionSettings.Save(); |
202 | TriggerRegionInfoChange(); | 202 | TriggerRegionInfoChange(); |
203 | sendRegionHandshakeToAll(); | ||
203 | sendRegionInfoPacketToAll(); | 204 | sendRegionInfoPacketToAll(); |
204 | } | 205 | } |
205 | 206 | ||
206 | private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) | 207 | private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) |
207 | { | 208 | { |
208 | sendRegionHandshakeToAll(); | 209 | // sendRegionHandshakeToAll(); |
209 | } | 210 | } |
210 | 211 | ||
211 | public void setRegionTerrainSettings(float WaterHeight, | 212 | public void setRegionTerrainSettings(float WaterHeight, |
@@ -274,8 +275,25 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
274 | { | 275 | { |
275 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 276 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) |
276 | { | 277 | { |
278 | if ((estateAccessType & 1) != 0) // All estates | ||
279 | { | ||
280 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
281 | EstateSettings estateSettings; | ||
282 | |||
283 | foreach (int estateID in estateIDs) | ||
284 | { | ||
285 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
286 | { | ||
287 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
288 | estateSettings.AddEstateUser(user); | ||
289 | estateSettings.Save(); | ||
290 | } | ||
291 | } | ||
292 | } | ||
293 | |||
277 | Scene.RegionInfo.EstateSettings.AddEstateUser(user); | 294 | Scene.RegionInfo.EstateSettings.AddEstateUser(user); |
278 | Scene.RegionInfo.EstateSettings.Save(); | 295 | Scene.RegionInfo.EstateSettings.Save(); |
296 | |||
279 | TriggerEstateInfoChange(); | 297 | TriggerEstateInfoChange(); |
280 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); | 298 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); |
281 | } | 299 | } |
@@ -289,10 +307,26 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
289 | { | 307 | { |
290 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 308 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) |
291 | { | 309 | { |
310 | if ((estateAccessType & 1) != 0) // All estates | ||
311 | { | ||
312 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
313 | EstateSettings estateSettings; | ||
314 | |||
315 | foreach (int estateID in estateIDs) | ||
316 | { | ||
317 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
318 | { | ||
319 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
320 | estateSettings.RemoveEstateUser(user); | ||
321 | estateSettings.Save(); | ||
322 | } | ||
323 | } | ||
324 | } | ||
325 | |||
292 | Scene.RegionInfo.EstateSettings.RemoveEstateUser(user); | 326 | Scene.RegionInfo.EstateSettings.RemoveEstateUser(user); |
293 | Scene.RegionInfo.EstateSettings.Save(); | 327 | Scene.RegionInfo.EstateSettings.Save(); |
294 | TriggerEstateInfoChange(); | ||
295 | 328 | ||
329 | TriggerEstateInfoChange(); | ||
296 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); | 330 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); |
297 | } | 331 | } |
298 | else | 332 | else |
@@ -304,8 +338,25 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
304 | { | 338 | { |
305 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 339 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) |
306 | { | 340 | { |
341 | if ((estateAccessType & 1) != 0) // All estates | ||
342 | { | ||
343 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
344 | EstateSettings estateSettings; | ||
345 | |||
346 | foreach (int estateID in estateIDs) | ||
347 | { | ||
348 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
349 | { | ||
350 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
351 | estateSettings.AddEstateGroup(user); | ||
352 | estateSettings.Save(); | ||
353 | } | ||
354 | } | ||
355 | } | ||
356 | |||
307 | Scene.RegionInfo.EstateSettings.AddEstateGroup(user); | 357 | Scene.RegionInfo.EstateSettings.AddEstateGroup(user); |
308 | Scene.RegionInfo.EstateSettings.Save(); | 358 | Scene.RegionInfo.EstateSettings.Save(); |
359 | |||
309 | TriggerEstateInfoChange(); | 360 | TriggerEstateInfoChange(); |
310 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); | 361 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); |
311 | } | 362 | } |
@@ -318,10 +369,26 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
318 | { | 369 | { |
319 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 370 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) |
320 | { | 371 | { |
372 | if ((estateAccessType & 1) != 0) // All estates | ||
373 | { | ||
374 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
375 | EstateSettings estateSettings; | ||
376 | |||
377 | foreach (int estateID in estateIDs) | ||
378 | { | ||
379 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
380 | { | ||
381 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
382 | estateSettings.RemoveEstateGroup(user); | ||
383 | estateSettings.Save(); | ||
384 | } | ||
385 | } | ||
386 | } | ||
387 | |||
321 | Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); | 388 | Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); |
322 | Scene.RegionInfo.EstateSettings.Save(); | 389 | Scene.RegionInfo.EstateSettings.Save(); |
323 | TriggerEstateInfoChange(); | ||
324 | 390 | ||
391 | TriggerEstateInfoChange(); | ||
325 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); | 392 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); |
326 | } | 393 | } |
327 | else | 394 | else |
@@ -349,6 +416,29 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
349 | if (!alreadyInList) | 416 | if (!alreadyInList) |
350 | { | 417 | { |
351 | 418 | ||
419 | if ((estateAccessType & 1) != 0) // All estates | ||
420 | { | ||
421 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
422 | EstateSettings estateSettings; | ||
423 | |||
424 | foreach (int estateID in estateIDs) | ||
425 | { | ||
426 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
427 | { | ||
428 | EstateBan bitem = new EstateBan(); | ||
429 | |||
430 | bitem.BannedUserID = user; | ||
431 | bitem.EstateID = (uint)estateID; | ||
432 | bitem.BannedHostAddress = "0.0.0.0"; | ||
433 | bitem.BannedHostIPMask = "0.0.0.0"; | ||
434 | |||
435 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
436 | estateSettings.AddBan(bitem); | ||
437 | estateSettings.Save(); | ||
438 | } | ||
439 | } | ||
440 | } | ||
441 | |||
352 | EstateBan item = new EstateBan(); | 442 | EstateBan item = new EstateBan(); |
353 | 443 | ||
354 | item.BannedUserID = user; | 444 | item.BannedUserID = user; |
@@ -358,6 +448,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
358 | 448 | ||
359 | Scene.RegionInfo.EstateSettings.AddBan(item); | 449 | Scene.RegionInfo.EstateSettings.AddBan(item); |
360 | Scene.RegionInfo.EstateSettings.Save(); | 450 | Scene.RegionInfo.EstateSettings.Save(); |
451 | |||
361 | TriggerEstateInfoChange(); | 452 | TriggerEstateInfoChange(); |
362 | 453 | ||
363 | ScenePresence s = Scene.GetScenePresence(user); | 454 | ScenePresence s = Scene.GetScenePresence(user); |
@@ -403,8 +494,25 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
403 | 494 | ||
404 | if (alreadyInList && listitem != null) | 495 | if (alreadyInList && listitem != null) |
405 | { | 496 | { |
497 | if ((estateAccessType & 1) != 0) // All estates | ||
498 | { | ||
499 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
500 | EstateSettings estateSettings; | ||
501 | |||
502 | foreach (int estateID in estateIDs) | ||
503 | { | ||
504 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
505 | { | ||
506 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
507 | estateSettings.RemoveBan(user); | ||
508 | estateSettings.Save(); | ||
509 | } | ||
510 | } | ||
511 | } | ||
512 | |||
406 | Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); | 513 | Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); |
407 | Scene.RegionInfo.EstateSettings.Save(); | 514 | Scene.RegionInfo.EstateSettings.Save(); |
515 | |||
408 | TriggerEstateInfoChange(); | 516 | TriggerEstateInfoChange(); |
409 | } | 517 | } |
410 | else | 518 | else |
@@ -424,8 +532,25 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
424 | { | 532 | { |
425 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 533 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) |
426 | { | 534 | { |
535 | if ((estateAccessType & 1) != 0) // All estates | ||
536 | { | ||
537 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
538 | EstateSettings estateSettings; | ||
539 | |||
540 | foreach (int estateID in estateIDs) | ||
541 | { | ||
542 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
543 | { | ||
544 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
545 | estateSettings.AddEstateManager(user); | ||
546 | estateSettings.Save(); | ||
547 | } | ||
548 | } | ||
549 | } | ||
550 | |||
427 | Scene.RegionInfo.EstateSettings.AddEstateManager(user); | 551 | Scene.RegionInfo.EstateSettings.AddEstateManager(user); |
428 | Scene.RegionInfo.EstateSettings.Save(); | 552 | Scene.RegionInfo.EstateSettings.Save(); |
553 | |||
429 | TriggerEstateInfoChange(); | 554 | TriggerEstateInfoChange(); |
430 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); | 555 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); |
431 | } | 556 | } |
@@ -438,10 +563,26 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
438 | { | 563 | { |
439 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 564 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) |
440 | { | 565 | { |
566 | if ((estateAccessType & 1) != 0) // All estates | ||
567 | { | ||
568 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
569 | EstateSettings estateSettings; | ||
570 | |||
571 | foreach (int estateID in estateIDs) | ||
572 | { | ||
573 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
574 | { | ||
575 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
576 | estateSettings.RemoveEstateManager(user); | ||
577 | estateSettings.Save(); | ||
578 | } | ||
579 | } | ||
580 | } | ||
581 | |||
441 | Scene.RegionInfo.EstateSettings.RemoveEstateManager(user); | 582 | Scene.RegionInfo.EstateSettings.RemoveEstateManager(user); |
442 | Scene.RegionInfo.EstateSettings.Save(); | 583 | Scene.RegionInfo.EstateSettings.Save(); |
443 | TriggerEstateInfoChange(); | ||
444 | 584 | ||
585 | TriggerEstateInfoChange(); | ||
445 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); | 586 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); |
446 | } | 587 | } |
447 | else | 588 | else |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 7d990c2..7fc358d 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs | |||
@@ -133,16 +133,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
133 | return new List<ILandObject>(); | 133 | return new List<ILandObject>(); |
134 | } | 134 | } |
135 | 135 | ||
136 | public bool IsLandPrimCountTainted() | ||
137 | { | ||
138 | if (m_landManagementModule != null) | ||
139 | { | ||
140 | return m_landManagementModule.IsLandPrimCountTainted(); | ||
141 | } | ||
142 | |||
143 | return false; | ||
144 | } | ||
145 | |||
146 | public bool IsForcefulBansAllowed() | 136 | public bool IsForcefulBansAllowed() |
147 | { | 137 | { |
148 | if (m_landManagementModule != null) | 138 | if (m_landManagementModule != null) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 98ba8c3..bfab7b8 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -62,8 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
62 | 62 | ||
63 | public class LandManagementModule : INonSharedRegionModule | 63 | public class LandManagementModule : INonSharedRegionModule |
64 | { | 64 | { |
65 | private static readonly ILog m_log = | 65 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
66 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
67 | 66 | ||
68 | private static readonly string remoteParcelRequestPath = "0009/"; | 67 | private static readonly string remoteParcelRequestPath = "0009/"; |
69 | 68 | ||
@@ -72,6 +71,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
72 | protected Commander m_commander = new Commander("land"); | 71 | protected Commander m_commander = new Commander("land"); |
73 | 72 | ||
74 | protected IUserManagement m_userManager; | 73 | protected IUserManagement m_userManager; |
74 | protected IPrimCountModule m_primCountModule; | ||
75 | 75 | ||
76 | // Minimum for parcels to work is 64m even if we don't actually use them. | 76 | // Minimum for parcels to work is 64m even if we don't actually use them. |
77 | #pragma warning disable 0429 | 77 | #pragma warning disable 0429 |
@@ -88,7 +88,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
88 | /// </value> | 88 | /// </value> |
89 | private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); | 89 | private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); |
90 | 90 | ||
91 | private bool m_landPrimCountTainted; | ||
92 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 91 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
93 | 92 | ||
94 | private bool m_allowedForcefulBans = true; | 93 | private bool m_allowedForcefulBans = true; |
@@ -121,18 +120,18 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
121 | 120 | ||
122 | m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd; | 121 | m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd; |
123 | m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate; | 122 | m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate; |
123 | m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene; | ||
124 | m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; | ||
125 | |||
124 | m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel; | 126 | m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel; |
125 | m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement; | 127 | m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement; |
126 | m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy; | 128 | m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy; |
127 | m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy; | 129 | m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy; |
128 | m_scene.EventManager.OnNewClient += EventManagerOnNewClient; | 130 | m_scene.EventManager.OnNewClient += EventManagerOnNewClient; |
129 | m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement; | 131 | m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement; |
130 | m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene; | ||
131 | m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage; | 132 | m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage; |
132 | m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; | 133 | m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; |
133 | m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; | 134 | m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; |
134 | m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; | ||
135 | m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted; | ||
136 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; | 135 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; |
137 | m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; | 136 | m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; |
138 | 137 | ||
@@ -147,6 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
147 | public void RegionLoaded(Scene scene) | 146 | public void RegionLoaded(Scene scene) |
148 | { | 147 | { |
149 | m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); | 148 | m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); |
149 | m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>(); | ||
150 | } | 150 | } |
151 | 151 | ||
152 | public void RemoveRegion(Scene scene) | 152 | public void RemoveRegion(Scene scene) |
@@ -306,10 +306,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
306 | /// <returns>The parcel created.</returns> | 306 | /// <returns>The parcel created.</returns> |
307 | protected ILandObject CreateDefaultParcel() | 307 | protected ILandObject CreateDefaultParcel() |
308 | { | 308 | { |
309 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); | 309 | m_log.DebugFormat( |
310 | "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); | ||
311 | |||
312 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); | ||
310 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | 313 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); |
311 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 314 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
312 | fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); | 315 | fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); |
316 | |||
313 | return AddLandObject(fullSimParcel); | 317 | return AddLandObject(fullSimParcel); |
314 | } | 318 | } |
315 | 319 | ||
@@ -579,7 +583,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
579 | } | 583 | } |
580 | else | 584 | else |
581 | { | 585 | { |
582 | m_log.WarnFormat("[LAND]: Invalid local land ID {0}", landLocalID); | 586 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid local land ID {0}", landLocalID); |
583 | } | 587 | } |
584 | } | 588 | } |
585 | 589 | ||
@@ -590,6 +594,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
590 | public ILandObject AddLandObject(ILandObject land) | 594 | public ILandObject AddLandObject(ILandObject land) |
591 | { | 595 | { |
592 | ILandObject new_land = land.Copy(); | 596 | ILandObject new_land = land.Copy(); |
597 | |||
598 | // Only now can we add the prim counts to the land object - we rely on the global ID which is generated | ||
599 | // as a random UUID inside LandData initialization | ||
600 | if (m_primCountModule != null) | ||
601 | new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID); | ||
593 | 602 | ||
594 | lock (m_landList) | 603 | lock (m_landList) |
595 | { | 604 | { |
@@ -603,6 +612,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
603 | { | 612 | { |
604 | if (landBitmap[x, y]) | 613 | if (landBitmap[x, y]) |
605 | { | 614 | { |
615 | // m_log.DebugFormat( | ||
616 | // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", | ||
617 | // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); | ||
618 | |||
606 | m_landIDList[x, y] = newLandLocalID; | 619 | m_landIDList[x, y] = newLandLocalID; |
607 | } | 620 | } |
608 | } | 621 | } |
@@ -630,7 +643,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
630 | { | 643 | { |
631 | if (m_landIDList[x, y] == local_id) | 644 | if (m_landIDList[x, y] == local_id) |
632 | { | 645 | { |
633 | m_log.WarnFormat("[LAND]: Not removing land object {0}; still being used at {1}, {2}", | 646 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Not removing land object {0}; still being used at {1}, {2}", |
634 | local_id, x, y); | 647 | local_id, x, y); |
635 | return; | 648 | return; |
636 | //throw new Exception("Could not remove land object. Still being used at " + x + ", " + y); | 649 | //throw new Exception("Could not remove land object. Still being used at " + x + ", " + y); |
@@ -732,8 +745,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
732 | // Corner case. If an autoreturn happens during sim startup | 745 | // Corner case. If an autoreturn happens during sim startup |
733 | // we will come here with the list uninitialized | 746 | // we will come here with the list uninitialized |
734 | // | 747 | // |
748 | int landId = m_landIDList[x, y]; | ||
749 | |||
750 | // if (landId == 0) | ||
751 | // m_log.DebugFormat( | ||
752 | // "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}", | ||
753 | // x, y, m_scene.RegionInfo.RegionName); | ||
754 | |||
735 | if (m_landList.ContainsKey(m_landIDList[x, y])) | 755 | if (m_landList.ContainsKey(m_landIDList[x, y])) |
736 | return m_landList[m_landIDList[x, y]]; | 756 | return m_landList[m_landIDList[x, y]]; |
757 | |||
737 | return null; | 758 | return null; |
738 | } | 759 | } |
739 | } | 760 | } |
@@ -751,13 +772,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
751 | { | 772 | { |
752 | try | 773 | try |
753 | { | 774 | { |
754 | //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) | 775 | return m_landList[m_landIDList[x / 4, y / 4]]; |
755 | return m_landList[m_landIDList[x / 4, y / 4]]; | ||
756 | //else | ||
757 | // return null; | ||
758 | } | 776 | } |
759 | catch (IndexOutOfRangeException) | 777 | catch (IndexOutOfRangeException) |
760 | { | 778 | { |
779 | // m_log.WarnFormat( | ||
780 | // "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", | ||
781 | // x, y, m_scene.RegionInfo.RegionName); | ||
782 | |||
761 | return null; | 783 | return null; |
762 | } | 784 | } |
763 | } | 785 | } |
@@ -767,34 +789,24 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
767 | 789 | ||
768 | #region Parcel Modification | 790 | #region Parcel Modification |
769 | 791 | ||
770 | public void ResetAllLandPrimCounts() | 792 | public void ResetOverMeRecords() |
771 | { | 793 | { |
772 | lock (m_landList) | 794 | lock (m_landList) |
773 | { | 795 | { |
774 | foreach (LandObject p in m_landList.Values) | 796 | foreach (LandObject p in m_landList.Values) |
775 | { | 797 | { |
776 | p.ResetLandPrimCounts(); | 798 | p.ResetOverMeRecord(); |
777 | } | 799 | } |
778 | } | 800 | } |
779 | } | 801 | } |
780 | 802 | ||
781 | public void EventManagerOnParcelPrimCountTainted() | ||
782 | { | ||
783 | m_landPrimCountTainted = true; | ||
784 | } | ||
785 | |||
786 | public bool IsLandPrimCountTainted() | ||
787 | { | ||
788 | return m_landPrimCountTainted; | ||
789 | } | ||
790 | |||
791 | public void EventManagerOnParcelPrimCountAdd(SceneObjectGroup obj) | 803 | public void EventManagerOnParcelPrimCountAdd(SceneObjectGroup obj) |
792 | { | 804 | { |
793 | Vector3 position = obj.AbsolutePosition; | 805 | Vector3 position = obj.AbsolutePosition; |
794 | ILandObject landUnderPrim = GetLandObject(position.X, position.Y); | 806 | ILandObject landUnderPrim = GetLandObject(position.X, position.Y); |
795 | if (landUnderPrim != null) | 807 | if (landUnderPrim != null) |
796 | { | 808 | { |
797 | landUnderPrim.AddPrimToCount(obj); | 809 | ((LandObject)landUnderPrim).AddPrimOverMe(obj); |
798 | } | 810 | } |
799 | } | 811 | } |
800 | 812 | ||
@@ -804,7 +816,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
804 | { | 816 | { |
805 | foreach (LandObject p in m_landList.Values) | 817 | foreach (LandObject p in m_landList.Values) |
806 | { | 818 | { |
807 | p.RemovePrimFromCount(obj); | 819 | p.RemovePrimFromOverMe(obj); |
808 | } | 820 | } |
809 | } | 821 | } |
810 | } | 822 | } |
@@ -837,8 +849,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
837 | foreach (LandObject p in landOwnersAndParcels[owner]) | 849 | foreach (LandObject p in landOwnersAndParcels[owner]) |
838 | { | 850 | { |
839 | simArea += p.LandData.Area; | 851 | simArea += p.LandData.Area; |
840 | simPrims += p.LandData.OwnerPrims + p.LandData.OtherPrims + p.LandData.GroupPrims + | 852 | simPrims += p.PrimCounts.Total; |
841 | p.LandData.SelectedPrims; | ||
842 | } | 853 | } |
843 | 854 | ||
844 | foreach (LandObject p in landOwnersAndParcels[owner]) | 855 | foreach (LandObject p in landOwnersAndParcels[owner]) |
@@ -851,7 +862,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
851 | 862 | ||
852 | public void EventManagerOnParcelPrimCountUpdate() | 863 | public void EventManagerOnParcelPrimCountUpdate() |
853 | { | 864 | { |
854 | ResetAllLandPrimCounts(); | 865 | // m_log.DebugFormat( |
866 | // "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}", | ||
867 | // m_scene.RegionInfo.RegionName); | ||
868 | |||
869 | ResetOverMeRecords(); | ||
855 | EntityBase[] entities = m_scene.Entities.GetEntities(); | 870 | EntityBase[] entities = m_scene.Entities.GetEntities(); |
856 | foreach (EntityBase obj in entities) | 871 | foreach (EntityBase obj in entities) |
857 | { | 872 | { |
@@ -864,15 +879,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
864 | } | 879 | } |
865 | } | 880 | } |
866 | FinalizeLandPrimCountUpdate(); | 881 | FinalizeLandPrimCountUpdate(); |
867 | m_landPrimCountTainted = false; | ||
868 | } | 882 | } |
869 | 883 | ||
870 | public void EventManagerOnRequestParcelPrimCountUpdate() | 884 | public void EventManagerOnRequestParcelPrimCountUpdate() |
871 | { | 885 | { |
872 | ResetAllLandPrimCounts(); | 886 | ResetOverMeRecords(); |
873 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 887 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
874 | FinalizeLandPrimCountUpdate(); | 888 | FinalizeLandPrimCountUpdate(); |
875 | m_landPrimCountTainted = false; | ||
876 | } | 889 | } |
877 | 890 | ||
878 | /// <summary> | 891 | /// <summary> |
@@ -936,8 +949,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
936 | m_landList[startLandObjectIndex].ForceUpdateLandInfo(); | 949 | m_landList[startLandObjectIndex].ForceUpdateLandInfo(); |
937 | } | 950 | } |
938 | 951 | ||
939 | EventManagerOnParcelPrimCountTainted(); | ||
940 | |||
941 | //Now add the new land object | 952 | //Now add the new land object |
942 | ILandObject result = AddLandObject(newLand); | 953 | ILandObject result = AddLandObject(newLand); |
943 | UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); | 954 | UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); |
@@ -1004,7 +1015,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1004 | performFinalLandJoin(masterLandObject, slaveLandObject); | 1015 | performFinalLandJoin(masterLandObject, slaveLandObject); |
1005 | } | 1016 | } |
1006 | } | 1017 | } |
1007 | EventManagerOnParcelPrimCountTainted(); | ||
1008 | 1018 | ||
1009 | masterLandObject.SendLandUpdateToAvatarsOverMe(); | 1019 | masterLandObject.SendLandUpdateToAvatarsOverMe(); |
1010 | } | 1020 | } |
@@ -1194,11 +1204,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1194 | 1204 | ||
1195 | if (land != null) | 1205 | if (land != null) |
1196 | { | 1206 | { |
1207 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | ||
1197 | m_landList[local_id].SendLandObjectOwners(remote_client); | 1208 | m_landList[local_id].SendLandObjectOwners(remote_client); |
1198 | } | 1209 | } |
1199 | else | 1210 | else |
1200 | { | 1211 | { |
1201 | m_log.WarnFormat("[PARCEL]: Invalid land object {0} passed for parcel object owner request", local_id); | 1212 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid land object {0} passed for parcel object owner request", local_id); |
1202 | } | 1213 | } |
1203 | } | 1214 | } |
1204 | 1215 | ||
@@ -1361,7 +1372,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1361 | { | 1372 | { |
1362 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | 1373 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); |
1363 | new_land.LandData = data.Copy(); | 1374 | new_land.LandData = data.Copy(); |
1364 | new_land.SetLandBitmapFromByteArray(); | 1375 | new_land.SetLandBitmapFromByteArray(); |
1365 | AddLandObject(new_land); | 1376 | AddLandObject(new_land); |
1366 | } | 1377 | } |
1367 | 1378 | ||
@@ -1425,8 +1436,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1425 | private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) | 1436 | private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) |
1426 | { | 1437 | { |
1427 | IClientAPI client; | 1438 | IClientAPI client; |
1428 | if (! m_scene.TryGetClient(agentID, out client)) { | 1439 | if (!m_scene.TryGetClient(agentID, out client)) |
1429 | m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString()); | 1440 | { |
1441 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to retrieve IClientAPI for {0}", agentID); | ||
1430 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); | 1442 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); |
1431 | } | 1443 | } |
1432 | 1444 | ||
@@ -1475,7 +1487,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1475 | } | 1487 | } |
1476 | else | 1488 | else |
1477 | { | 1489 | { |
1478 | m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); | 1490 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID); |
1479 | } | 1491 | } |
1480 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); | 1492 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); |
1481 | } | 1493 | } |
@@ -1533,17 +1545,17 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1533 | } | 1545 | } |
1534 | catch (LLSD.LLSDParseException e) | 1546 | catch (LLSD.LLSDParseException e) |
1535 | { | 1547 | { |
1536 | m_log.ErrorFormat("[LAND] Fetch error: {0}", e.Message); | 1548 | m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Fetch error: {0}", e.Message); |
1537 | m_log.ErrorFormat("[LAND] ... in request {0}", request); | 1549 | m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: ... in request {0}", request); |
1538 | } | 1550 | } |
1539 | catch(InvalidCastException) | 1551 | catch (InvalidCastException) |
1540 | { | 1552 | { |
1541 | m_log.ErrorFormat("[LAND] Wrong type in request {0}", request); | 1553 | m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Wrong type in request {0}", request); |
1542 | } | 1554 | } |
1543 | 1555 | ||
1544 | LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse(); | 1556 | LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse(); |
1545 | response.parcel_id = parcelID; | 1557 | response.parcel_id = parcelID; |
1546 | m_log.DebugFormat("[LAND] got parcelID {0}", parcelID); | 1558 | m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelID {0}", parcelID); |
1547 | 1559 | ||
1548 | return LLSDHelpers.SerialiseLLSDReply(response); | 1560 | return LLSDHelpers.SerialiseLLSDReply(response); |
1549 | } | 1561 | } |
@@ -1564,7 +1576,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1564 | ExtendedLandData extLandData = new ExtendedLandData(); | 1576 | ExtendedLandData extLandData = new ExtendedLandData(); |
1565 | Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, | 1577 | Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, |
1566 | out extLandData.X, out extLandData.Y); | 1578 | out extLandData.X, out extLandData.Y); |
1567 | m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", | 1579 | m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelinfo request for regionHandle {0}, x/y {1}/{2}", |
1568 | extLandData.RegionHandle, extLandData.X, extLandData.Y); | 1580 | extLandData.RegionHandle, extLandData.X, extLandData.Y); |
1569 | 1581 | ||
1570 | // for this region or for somewhere else? | 1582 | // for this region or for somewhere else? |
@@ -1605,7 +1617,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1605 | info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); | 1617 | info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); |
1606 | } | 1618 | } |
1607 | // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. | 1619 | // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. |
1608 | m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...", | 1620 | m_log.DebugFormat("[LAND MANAGEMENT MODULE]: got parcelinfo for parcel {0} in region {1}; sending...", |
1609 | data.LandData.Name, data.RegionHandle); | 1621 | data.LandData.Name, data.RegionHandle); |
1610 | // HACK for now | 1622 | // HACK for now |
1611 | RegionInfo r = new RegionInfo(); | 1623 | RegionInfo r = new RegionInfo(); |
@@ -1616,7 +1628,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1616 | remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y); | 1628 | remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y); |
1617 | } | 1629 | } |
1618 | else | 1630 | else |
1619 | m_log.Debug("[LAND] got no parcelinfo; not sending"); | 1631 | m_log.Debug("[LAND MANAGEMENT MODULE]: got no parcelinfo; not sending"); |
1620 | } | 1632 | } |
1621 | 1633 | ||
1622 | public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) | 1634 | public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 46c15ed..c2f104e 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
51 | 51 | ||
52 | private int m_lastSeqId = 0; | 52 | private int m_lastSeqId = 0; |
53 | 53 | ||
54 | protected LandData m_landData = new LandData(); | 54 | protected LandData m_landData = new LandData(); |
55 | protected Scene m_scene; | 55 | protected Scene m_scene; |
56 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | 56 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); |
57 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); | 57 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); |
@@ -64,8 +64,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
64 | 64 | ||
65 | #endregion | 65 | #endregion |
66 | 66 | ||
67 | #region ILandObject Members | ||
68 | |||
69 | public int GetPrimsFree() | 67 | public int GetPrimsFree() |
70 | { | 68 | { |
71 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 69 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
@@ -79,6 +77,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
79 | 77 | ||
80 | set { m_landData = value; } | 78 | set { m_landData = value; } |
81 | } | 79 | } |
80 | |||
81 | public IPrimCounts PrimCounts { get; set; } | ||
82 | 82 | ||
83 | public UUID RegionUUID | 83 | public UUID RegionUUID |
84 | { | 84 | { |
@@ -211,6 +211,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
211 | return simMax; | 211 | return simMax; |
212 | } | 212 | } |
213 | } | 213 | } |
214 | |||
214 | #endregion | 215 | #endregion |
215 | 216 | ||
216 | #region Packet Request Handling | 217 | #region Packet Request Handling |
@@ -241,7 +242,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
241 | } | 242 | } |
242 | 243 | ||
243 | remote_client.SendLandProperties(seq_id, | 244 | remote_client.SendLandProperties(seq_id, |
244 | snap_selection, request_result, LandData, | 245 | snap_selection, request_result, this, |
245 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, | 246 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, |
246 | GetParcelMaxPrimCount(this), | 247 | GetParcelMaxPrimCount(this), |
247 | GetSimulatorMaxPrimCount(this), regionFlags); | 248 | GetSimulatorMaxPrimCount(this), regionFlags); |
@@ -700,23 +701,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
700 | return LandBitmap; | 701 | return LandBitmap; |
701 | } | 702 | } |
702 | 703 | ||
703 | /// <summary> | ||
704 | /// Full sim land object creation | ||
705 | /// </summary> | ||
706 | /// <returns></returns> | ||
707 | public bool[,] BasicFullRegionLandBitmap() | 704 | public bool[,] BasicFullRegionLandBitmap() |
708 | { | 705 | { |
709 | return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); | 706 | return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); |
710 | } | 707 | } |
711 | 708 | ||
712 | /// <summary> | ||
713 | /// Used to modify the bitmap between the x and y points. Points use 64 scale | ||
714 | /// </summary> | ||
715 | /// <param name="start_x"></param> | ||
716 | /// <param name="start_y"></param> | ||
717 | /// <param name="end_x"></param> | ||
718 | /// <param name="end_y"></param> | ||
719 | /// <returns></returns> | ||
720 | public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) | 709 | public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) |
721 | { | 710 | { |
722 | bool[,] tempBitmap = new bool[64,64]; | 711 | bool[,] tempBitmap = new bool[64,64]; |
@@ -907,9 +896,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
907 | 896 | ||
908 | lock (primsOverMe) | 897 | lock (primsOverMe) |
909 | { | 898 | { |
899 | // m_log.DebugFormat( | ||
900 | // "[LAND OBJECT]: Request for SendLandObjectOwners() from {0} with {1} known prims on region", | ||
901 | // remote_client.Name, primsOverMe.Count); | ||
902 | |||
910 | try | 903 | try |
911 | { | 904 | { |
912 | |||
913 | foreach (SceneObjectGroup obj in primsOverMe) | 905 | foreach (SceneObjectGroup obj in primsOverMe) |
914 | { | 906 | { |
915 | try | 907 | try |
@@ -921,7 +913,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
921 | } | 913 | } |
922 | catch (NullReferenceException) | 914 | catch (NullReferenceException) |
923 | { | 915 | { |
924 | m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); | 916 | m_log.Error("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); |
925 | } | 917 | } |
926 | try | 918 | try |
927 | { | 919 | { |
@@ -948,6 +940,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
948 | public Dictionary<UUID, int> GetLandObjectOwners() | 940 | public Dictionary<UUID, int> GetLandObjectOwners() |
949 | { | 941 | { |
950 | Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>(); | 942 | Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>(); |
943 | |||
951 | lock (primsOverMe) | 944 | lock (primsOverMe) |
952 | { | 945 | { |
953 | try | 946 | try |
@@ -984,8 +977,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
984 | 977 | ||
985 | public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) | 978 | public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) |
986 | { | 979 | { |
987 | Dictionary<UUID,List<SceneObjectGroup>> returns = | 980 | // m_log.DebugFormat( |
988 | new Dictionary<UUID,List<SceneObjectGroup>>(); | 981 | // "[LAND OBJECT]: Request to return objects in {0} from {1}", LandData.Name, remote_client.Name); |
982 | |||
983 | Dictionary<UUID,List<SceneObjectGroup>> returns = new Dictionary<UUID,List<SceneObjectGroup>>(); | ||
989 | 984 | ||
990 | lock (primsOverMe) | 985 | lock (primsOverMe) |
991 | { | 986 | { |
@@ -1058,83 +1053,29 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1058 | 1053 | ||
1059 | #region Object Adding/Removing from Parcel | 1054 | #region Object Adding/Removing from Parcel |
1060 | 1055 | ||
1061 | public void ResetLandPrimCounts() | 1056 | public void ResetOverMeRecord() |
1062 | { | 1057 | { |
1063 | LandData.GroupPrims = 0; | ||
1064 | LandData.OwnerPrims = 0; | ||
1065 | LandData.OtherPrims = 0; | ||
1066 | LandData.SelectedPrims = 0; | ||
1067 | |||
1068 | |||
1069 | lock (primsOverMe) | 1058 | lock (primsOverMe) |
1070 | primsOverMe.Clear(); | 1059 | primsOverMe.Clear(); |
1071 | } | 1060 | } |
1072 | 1061 | ||
1073 | public void AddPrimToCount(SceneObjectGroup obj) | 1062 | public void AddPrimOverMe(SceneObjectGroup obj) |
1074 | { | 1063 | { |
1075 | 1064 | // m_log.DebugFormat("[LAND OBJECT]: Adding scene object {0} {1} over {2}", obj.Name, obj.LocalId, LandData.Name); | |
1076 | UUID prim_owner = obj.OwnerID; | 1065 | |
1077 | int prim_count = obj.PrimCount; | ||
1078 | |||
1079 | if (obj.IsSelected) | ||
1080 | { | ||
1081 | LandData.SelectedPrims += prim_count; | ||
1082 | } | ||
1083 | else | ||
1084 | { | ||
1085 | if (prim_owner == LandData.OwnerID) | ||
1086 | { | ||
1087 | LandData.OwnerPrims += prim_count; | ||
1088 | } | ||
1089 | else if ((obj.GroupID == LandData.GroupID || | ||
1090 | prim_owner == LandData.GroupID) && | ||
1091 | LandData.GroupID != UUID.Zero) | ||
1092 | { | ||
1093 | LandData.GroupPrims += prim_count; | ||
1094 | } | ||
1095 | else | ||
1096 | { | ||
1097 | LandData.OtherPrims += prim_count; | ||
1098 | } | ||
1099 | } | ||
1100 | |||
1101 | lock (primsOverMe) | 1066 | lock (primsOverMe) |
1102 | primsOverMe.Add(obj); | 1067 | primsOverMe.Add(obj); |
1103 | } | 1068 | } |
1104 | 1069 | ||
1105 | public void RemovePrimFromCount(SceneObjectGroup obj) | 1070 | public void RemovePrimFromOverMe(SceneObjectGroup obj) |
1106 | { | 1071 | { |
1072 | // m_log.DebugFormat("[LAND OBJECT]: Removing scene object {0} {1} from over {2}", obj.Name, obj.LocalId, LandData.Name); | ||
1073 | |||
1107 | lock (primsOverMe) | 1074 | lock (primsOverMe) |
1108 | { | 1075 | primsOverMe.Remove(obj); |
1109 | if (primsOverMe.Contains(obj)) | ||
1110 | { | ||
1111 | UUID prim_owner = obj.OwnerID; | ||
1112 | int prim_count = obj.PrimCount; | ||
1113 | |||
1114 | if (prim_owner == LandData.OwnerID) | ||
1115 | { | ||
1116 | LandData.OwnerPrims -= prim_count; | ||
1117 | } | ||
1118 | else if (obj.GroupID == LandData.GroupID || | ||
1119 | prim_owner == LandData.GroupID) | ||
1120 | { | ||
1121 | LandData.GroupPrims -= prim_count; | ||
1122 | } | ||
1123 | else | ||
1124 | { | ||
1125 | LandData.OtherPrims -= prim_count; | ||
1126 | } | ||
1127 | |||
1128 | primsOverMe.Remove(obj); | ||
1129 | } | ||
1130 | } | ||
1131 | } | 1076 | } |
1132 | 1077 | ||
1133 | #endregion | 1078 | #endregion |
1134 | |||
1135 | #endregion | ||
1136 | |||
1137 | #endregion | ||
1138 | 1079 | ||
1139 | /// <summary> | 1080 | /// <summary> |
1140 | /// Set the media url for this land parcel | 1081 | /// Set the media url for this land parcel |
@@ -1155,5 +1096,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1155 | LandData.MusicURL = url; | 1096 | LandData.MusicURL = url; |
1156 | SendLandUpdateToAvatarsOverMe(); | 1097 | SendLandUpdateToAvatarsOverMe(); |
1157 | } | 1098 | } |
1099 | |||
1100 | #endregion | ||
1158 | } | 1101 | } |
1159 | } | 1102 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 34ef67f..dca842a 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -45,14 +45,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
45 | public int Owner = 0; | 45 | public int Owner = 0; |
46 | public int Group = 0; | 46 | public int Group = 0; |
47 | public int Others = 0; | 47 | public int Others = 0; |
48 | public Dictionary <UUID, int> Users = | 48 | public int Selected = 0; |
49 | new Dictionary <UUID, int>(); | 49 | public Dictionary <UUID, int> Users = new Dictionary <UUID, int>(); |
50 | } | 50 | } |
51 | 51 | ||
52 | public class PrimCountModule : IPrimCountModule, INonSharedRegionModule | 52 | public class PrimCountModule : IPrimCountModule, INonSharedRegionModule |
53 | { | 53 | { |
54 | private static readonly ILog m_log = | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
56 | 55 | ||
57 | private Scene m_Scene; | 56 | private Scene m_Scene; |
58 | private Dictionary<UUID, PrimCounts> m_PrimCounts = | 57 | private Dictionary<UUID, PrimCounts> m_PrimCounts = |
@@ -64,10 +63,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
64 | private Dictionary<UUID, ParcelCounts> m_ParcelCounts = | 63 | private Dictionary<UUID, ParcelCounts> m_ParcelCounts = |
65 | new Dictionary<UUID, ParcelCounts>(); | 64 | new Dictionary<UUID, ParcelCounts>(); |
66 | 65 | ||
67 | // For now, a simple simwide taint to get this up. Later parcel based | 66 | /// <value> |
68 | // taint to allow recounting a parcel if only ownership has changed | 67 | /// For now, a simple simwide taint to get this up. Later parcel based |
69 | // without recounting the whole sim. | 68 | /// taint to allow recounting a parcel if only ownership has changed |
69 | /// without recounting the whole sim. | ||
70 | /// | ||
71 | /// We start out tainted so that the first get call resets the various prim counts. | ||
72 | /// <value> | ||
70 | private bool m_Tainted = true; | 73 | private bool m_Tainted = true; |
74 | |||
71 | private Object m_TaintLock = new Object(); | 75 | private Object m_TaintLock = new Object(); |
72 | 76 | ||
73 | public Type ReplaceableInterface | 77 | public Type ReplaceableInterface |
@@ -82,13 +86,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
82 | public void AddRegion(Scene scene) | 86 | public void AddRegion(Scene scene) |
83 | { | 87 | { |
84 | m_Scene = scene; | 88 | m_Scene = scene; |
89 | |||
90 | m_Scene.RegisterModuleInterface<IPrimCountModule>(this); | ||
85 | 91 | ||
86 | m_Scene.EventManager.OnParcelPrimCountAdd += | 92 | m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd; |
87 | OnParcelPrimCountAdd; | ||
88 | m_Scene.EventManager.OnObjectBeingRemovedFromScene += | 93 | m_Scene.EventManager.OnObjectBeingRemovedFromScene += |
89 | OnObjectBeingRemovedFromScene; | 94 | OnObjectBeingRemovedFromScene; |
90 | m_Scene.EventManager.OnParcelPrimCountTainted += | 95 | m_Scene.EventManager.OnParcelPrimCountTainted += |
91 | OnParcelPrimCountTainted; | 96 | OnParcelPrimCountTainted; |
97 | m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); }; | ||
92 | } | 98 | } |
93 | 99 | ||
94 | public void RegionLoaded(Scene scene) | 100 | public void RegionLoaded(Scene scene) |
@@ -116,6 +122,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
116 | { | 122 | { |
117 | if (!m_Tainted) | 123 | if (!m_Tainted) |
118 | AddObject(obj); | 124 | AddObject(obj); |
125 | // else | ||
126 | // m_log.DebugFormat( | ||
127 | // "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", | ||
128 | // obj.Name, m_Scene.RegionInfo.RegionName); | ||
129 | |||
119 | } | 130 | } |
120 | } | 131 | } |
121 | 132 | ||
@@ -126,11 +137,18 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
126 | { | 137 | { |
127 | if (!m_Tainted) | 138 | if (!m_Tainted) |
128 | RemoveObject(obj); | 139 | RemoveObject(obj); |
140 | // else | ||
141 | // m_log.DebugFormat( | ||
142 | // "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted", | ||
143 | // obj.Name, m_Scene.RegionInfo.RegionName); | ||
129 | } | 144 | } |
130 | } | 145 | } |
131 | 146 | ||
132 | private void OnParcelPrimCountTainted() | 147 | private void OnParcelPrimCountTainted() |
133 | { | 148 | { |
149 | // m_log.DebugFormat( | ||
150 | // "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName); | ||
151 | |||
134 | lock (m_TaintLock) | 152 | lock (m_TaintLock) |
135 | m_Tainted = true; | 153 | m_Tainted = true; |
136 | } | 154 | } |
@@ -155,15 +173,34 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
155 | 173 | ||
156 | // NOTE: Call under Taint Lock | 174 | // NOTE: Call under Taint Lock |
157 | private void AddObject(SceneObjectGroup obj) | 175 | private void AddObject(SceneObjectGroup obj) |
158 | { | 176 | { |
159 | if (obj.IsAttachment) | 177 | if (obj.IsAttachment) |
160 | return; | 178 | return; |
161 | if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)) | 179 | if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)) |
162 | return; | 180 | return; |
163 | 181 | ||
164 | Vector3 pos = obj.AbsolutePosition; | 182 | Vector3 pos = obj.AbsolutePosition; |
165 | ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); | 183 | ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); |
184 | |||
185 | // If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it | ||
186 | if (landObject == null) | ||
187 | { | ||
188 | // m_log.WarnFormat( | ||
189 | // "[PRIM COUNT MODULE]: Found no land object for {0} at position ({1}, {2}) on {3}", | ||
190 | // obj.Name, pos.X, pos.Y, m_Scene.RegionInfo.RegionName); | ||
191 | |||
192 | return; | ||
193 | } | ||
194 | |||
166 | LandData landData = landObject.LandData; | 195 | LandData landData = landObject.LandData; |
196 | |||
197 | // m_log.DebugFormat( | ||
198 | // "[PRIM COUNT MODULE]: Adding object {0} with {1} parts to prim count for parcel {2} on {3}", | ||
199 | // obj.Name, obj.Parts.Length, landData.Name, m_Scene.RegionInfo.RegionName); | ||
200 | |||
201 | // m_log.DebugFormat( | ||
202 | // "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}", | ||
203 | // obj.Name, obj.OwnerID, landData.OwnerID); | ||
167 | 204 | ||
168 | ParcelCounts parcelCounts; | 205 | ParcelCounts parcelCounts; |
169 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) | 206 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) |
@@ -177,23 +214,28 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
177 | else | 214 | else |
178 | parcelCounts.Users[obj.OwnerID] = partCount; | 215 | parcelCounts.Users[obj.OwnerID] = partCount; |
179 | 216 | ||
180 | if (landData.IsGroupOwned) | 217 | if (obj.IsSelected) |
181 | { | 218 | { |
182 | if (obj.OwnerID == landData.GroupID) | 219 | parcelCounts.Selected += partCount; |
183 | parcelCounts.Owner += partCount; | ||
184 | else if (obj.GroupID == landData.GroupID) | ||
185 | parcelCounts.Group += partCount; | ||
186 | else | ||
187 | parcelCounts.Others += partCount; | ||
188 | } | 220 | } |
189 | else | 221 | else |
190 | { | 222 | { |
191 | if (obj.OwnerID == landData.OwnerID) | 223 | if (landData.IsGroupOwned) |
192 | parcelCounts.Owner += partCount; | 224 | { |
193 | else if (obj.GroupID == landData.GroupID) | 225 | if (obj.OwnerID == landData.GroupID) |
194 | parcelCounts.Group += partCount; | 226 | parcelCounts.Owner += partCount; |
227 | else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID) | ||
228 | parcelCounts.Group += partCount; | ||
229 | else | ||
230 | parcelCounts.Others += partCount; | ||
231 | } | ||
195 | else | 232 | else |
196 | parcelCounts.Others += partCount; | 233 | { |
234 | if (obj.OwnerID == landData.OwnerID) | ||
235 | parcelCounts.Owner += partCount; | ||
236 | else | ||
237 | parcelCounts.Others += partCount; | ||
238 | } | ||
197 | } | 239 | } |
198 | } | 240 | } |
199 | } | 241 | } |
@@ -201,10 +243,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
201 | // NOTE: Call under Taint Lock | 243 | // NOTE: Call under Taint Lock |
202 | private void RemoveObject(SceneObjectGroup obj) | 244 | private void RemoveObject(SceneObjectGroup obj) |
203 | { | 245 | { |
246 | // m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID); | ||
247 | |||
248 | // Currently this is being done by tainting the count instead. | ||
204 | } | 249 | } |
205 | 250 | ||
206 | public IPrimCounts GetPrimCounts(UUID parcelID) | 251 | public IPrimCounts GetPrimCounts(UUID parcelID) |
207 | { | 252 | { |
253 | // m_log.DebugFormat( | ||
254 | // "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName); | ||
255 | |||
208 | PrimCounts primCounts; | 256 | PrimCounts primCounts; |
209 | 257 | ||
210 | lock (m_PrimCounts) | 258 | lock (m_PrimCounts) |
@@ -218,8 +266,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
218 | return primCounts; | 266 | return primCounts; |
219 | } | 267 | } |
220 | 268 | ||
269 | |||
270 | /// <summary> | ||
271 | /// Get the number of prims on the parcel that are owned by the parcel owner. | ||
272 | /// </summary> | ||
273 | /// <param name="parcelID"></param> | ||
274 | /// <returns></returns> | ||
221 | public int GetOwnerCount(UUID parcelID) | 275 | public int GetOwnerCount(UUID parcelID) |
222 | { | 276 | { |
277 | int count = 0; | ||
278 | |||
223 | lock (m_TaintLock) | 279 | lock (m_TaintLock) |
224 | { | 280 | { |
225 | if (m_Tainted) | 281 | if (m_Tainted) |
@@ -227,13 +283,25 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
227 | 283 | ||
228 | ParcelCounts counts; | 284 | ParcelCounts counts; |
229 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | 285 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) |
230 | return counts.Owner; | 286 | count = counts.Owner; |
231 | } | 287 | } |
232 | return 0; | 288 | |
289 | // m_log.DebugFormat( | ||
290 | // "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}", | ||
291 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
292 | |||
293 | return count; | ||
233 | } | 294 | } |
234 | 295 | ||
296 | /// <summary> | ||
297 | /// Get the number of prims on the parcel that have been set to the group that owns the parcel. | ||
298 | /// </summary> | ||
299 | /// <param name="parcelID"></param> | ||
300 | /// <returns></returns> | ||
235 | public int GetGroupCount(UUID parcelID) | 301 | public int GetGroupCount(UUID parcelID) |
236 | { | 302 | { |
303 | int count = 0; | ||
304 | |||
237 | lock (m_TaintLock) | 305 | lock (m_TaintLock) |
238 | { | 306 | { |
239 | if (m_Tainted) | 307 | if (m_Tainted) |
@@ -241,13 +309,25 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
241 | 309 | ||
242 | ParcelCounts counts; | 310 | ParcelCounts counts; |
243 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | 311 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) |
244 | return counts.Group; | 312 | count = counts.Group; |
245 | } | 313 | } |
246 | return 0; | 314 | |
315 | // m_log.DebugFormat( | ||
316 | // "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}", | ||
317 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
318 | |||
319 | return count; | ||
247 | } | 320 | } |
248 | 321 | ||
322 | /// <summary> | ||
323 | /// Get the number of prims on the parcel that are not owned by the parcel owner or set to the parcel group. | ||
324 | /// </summary> | ||
325 | /// <param name="parcelID"></param> | ||
326 | /// <returns></returns> | ||
249 | public int GetOthersCount(UUID parcelID) | 327 | public int GetOthersCount(UUID parcelID) |
250 | { | 328 | { |
329 | int count = 0; | ||
330 | |||
251 | lock (m_TaintLock) | 331 | lock (m_TaintLock) |
252 | { | 332 | { |
253 | if (m_Tainted) | 333 | if (m_Tainted) |
@@ -255,13 +335,83 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
255 | 335 | ||
256 | ParcelCounts counts; | 336 | ParcelCounts counts; |
257 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | 337 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) |
258 | return counts.Others; | 338 | count = counts.Others; |
259 | } | 339 | } |
260 | return 0; | 340 | |
341 | // m_log.DebugFormat( | ||
342 | // "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", | ||
343 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
344 | |||
345 | return count; | ||
261 | } | 346 | } |
347 | |||
348 | /// <summary> | ||
349 | /// Get the number of selected prims. | ||
350 | /// </summary> | ||
351 | /// <param name="parcelID"></param> | ||
352 | /// <returns></returns> | ||
353 | public int GetSelectedCount(UUID parcelID) | ||
354 | { | ||
355 | int count = 0; | ||
356 | |||
357 | lock (m_TaintLock) | ||
358 | { | ||
359 | if (m_Tainted) | ||
360 | Recount(); | ||
262 | 361 | ||
362 | ParcelCounts counts; | ||
363 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | ||
364 | count = counts.Selected; | ||
365 | } | ||
366 | |||
367 | // m_log.DebugFormat( | ||
368 | // "[PRIM COUNT MODULE]: GetSelectedCount for parcel {0} in {1} returning {2}", | ||
369 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
370 | |||
371 | return count; | ||
372 | } | ||
373 | |||
374 | /// <summary> | ||
375 | /// Get the total count of owner, group and others prims on the parcel. | ||
376 | /// FIXME: Need to do selected prims once this is reimplemented. | ||
377 | /// </summary> | ||
378 | /// <param name="parcelID"></param> | ||
379 | /// <returns></returns> | ||
380 | public int GetTotalCount(UUID parcelID) | ||
381 | { | ||
382 | int count = 0; | ||
383 | |||
384 | lock (m_TaintLock) | ||
385 | { | ||
386 | if (m_Tainted) | ||
387 | Recount(); | ||
388 | |||
389 | ParcelCounts counts; | ||
390 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | ||
391 | { | ||
392 | count = counts.Owner; | ||
393 | count += counts.Group; | ||
394 | count += counts.Others; | ||
395 | count += counts.Selected; | ||
396 | } | ||
397 | } | ||
398 | |||
399 | // m_log.DebugFormat( | ||
400 | // "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}", | ||
401 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
402 | |||
403 | return count; | ||
404 | } | ||
405 | |||
406 | /// <summary> | ||
407 | /// Get the number of prims that are in the entire simulator for the owner of this parcel. | ||
408 | /// </summary> | ||
409 | /// <param name="parcelID"></param> | ||
410 | /// <returns></returns> | ||
263 | public int GetSimulatorCount(UUID parcelID) | 411 | public int GetSimulatorCount(UUID parcelID) |
264 | { | 412 | { |
413 | int count = 0; | ||
414 | |||
265 | lock (m_TaintLock) | 415 | lock (m_TaintLock) |
266 | { | 416 | { |
267 | if (m_Tainted) | 417 | if (m_Tainted) |
@@ -272,14 +422,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
272 | { | 422 | { |
273 | int val; | 423 | int val; |
274 | if (m_SimwideCounts.TryGetValue(owner, out val)) | 424 | if (m_SimwideCounts.TryGetValue(owner, out val)) |
275 | return val; | 425 | count = val; |
276 | } | 426 | } |
277 | } | 427 | } |
278 | return 0; | 428 | |
429 | // m_log.DebugFormat( | ||
430 | // "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", | ||
431 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
432 | |||
433 | return count; | ||
279 | } | 434 | } |
280 | 435 | ||
436 | /// <summary> | ||
437 | /// Get the number of prims that a particular user owns on this parcel. | ||
438 | /// </summary> | ||
439 | /// <param name="parcelID"></param> | ||
440 | /// <param name="userID"></param> | ||
441 | /// <returns></returns> | ||
281 | public int GetUserCount(UUID parcelID, UUID userID) | 442 | public int GetUserCount(UUID parcelID, UUID userID) |
282 | { | 443 | { |
444 | int count = 0; | ||
445 | |||
283 | lock (m_TaintLock) | 446 | lock (m_TaintLock) |
284 | { | 447 | { |
285 | if (m_Tainted) | 448 | if (m_Tainted) |
@@ -290,27 +453,37 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
290 | { | 453 | { |
291 | int val; | 454 | int val; |
292 | if (counts.Users.TryGetValue(userID, out val)) | 455 | if (counts.Users.TryGetValue(userID, out val)) |
293 | return val; | 456 | count = val; |
294 | } | 457 | } |
295 | } | 458 | } |
296 | return 0; | 459 | |
460 | // m_log.DebugFormat( | ||
461 | // "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}", | ||
462 | // userID, parcelID, m_Scene.RegionInfo.RegionName, count); | ||
463 | |||
464 | return count; | ||
297 | } | 465 | } |
298 | 466 | ||
299 | // NOTE: This method MUST be called while holding the taint lock! | 467 | // NOTE: This method MUST be called while holding the taint lock! |
300 | private void Recount() | 468 | private void Recount() |
301 | { | 469 | { |
470 | // m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); | ||
471 | |||
302 | m_OwnerMap.Clear(); | 472 | m_OwnerMap.Clear(); |
303 | m_SimwideCounts.Clear(); | 473 | m_SimwideCounts.Clear(); |
304 | m_ParcelCounts.Clear(); | 474 | m_ParcelCounts.Clear(); |
305 | 475 | ||
306 | List<ILandObject> land = m_Scene.LandChannel.AllParcels(); | 476 | List<ILandObject> land = m_Scene.LandChannel.AllParcels(); |
307 | 477 | ||
308 | foreach (ILandObject l in land) | 478 | foreach (ILandObject l in land) |
309 | { | 479 | { |
310 | LandData landData = l.LandData; | 480 | LandData landData = l.LandData; |
311 | 481 | ||
312 | m_OwnerMap[landData.GlobalID] = landData.OwnerID; | 482 | m_OwnerMap[landData.GlobalID] = landData.OwnerID; |
313 | m_SimwideCounts[landData.OwnerID] = 0; | 483 | m_SimwideCounts[landData.OwnerID] = 0; |
484 | // m_log.DebugFormat( | ||
485 | // "[PRIM COUNT MODULE]: Initializing parcel count for {0} on {1}", | ||
486 | // landData.Name, m_Scene.RegionInfo.RegionName); | ||
314 | m_ParcelCounts[landData.GlobalID] = new ParcelCounts(); | 487 | m_ParcelCounts[landData.GlobalID] = new ParcelCounts(); |
315 | } | 488 | } |
316 | 489 | ||
@@ -322,6 +495,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
322 | if (!m_OwnerMap.ContainsKey(k)) | 495 | if (!m_OwnerMap.ContainsKey(k)) |
323 | m_PrimCounts.Remove(k); | 496 | m_PrimCounts.Remove(k); |
324 | } | 497 | } |
498 | |||
325 | m_Tainted = false; | 499 | m_Tainted = false; |
326 | } | 500 | } |
327 | } | 501 | } |
@@ -363,6 +537,22 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
363 | return m_Parent.GetOthersCount(m_ParcelID); | 537 | return m_Parent.GetOthersCount(m_ParcelID); |
364 | } | 538 | } |
365 | } | 539 | } |
540 | |||
541 | public int Selected | ||
542 | { | ||
543 | get | ||
544 | { | ||
545 | return m_Parent.GetSelectedCount(m_ParcelID); | ||
546 | } | ||
547 | } | ||
548 | |||
549 | public int Total | ||
550 | { | ||
551 | get | ||
552 | { | ||
553 | return m_Parent.GetTotalCount(m_ParcelID); | ||
554 | } | ||
555 | } | ||
366 | 556 | ||
367 | public int Simulator | 557 | public int Simulator |
368 | { | 558 | { |
@@ -403,4 +593,4 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
403 | } | 593 | } |
404 | } | 594 | } |
405 | } | 595 | } |
406 | } | 596 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs new file mode 100644 index 0000000..67b00ac --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | |||
@@ -0,0 +1,382 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net.Config; | ||
32 | using NUnit.Framework; | ||
33 | using OpenMetaverse; | ||
34 | using OpenMetaverse.Assets; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenSim.Tests.Common; | ||
39 | using OpenSim.Tests.Common.Mock; | ||
40 | using OpenSim.Tests.Common.Setup; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.World.Land.Tests | ||
43 | { | ||
44 | [TestFixture] | ||
45 | public class PrimCountModuleTests | ||
46 | { | ||
47 | protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000"); | ||
48 | protected UUID m_groupId = new UUID("00000000-0000-0000-8888-000000000000"); | ||
49 | protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999"); | ||
50 | protected TestScene m_scene; | ||
51 | protected PrimCountModule m_pcm; | ||
52 | |||
53 | /// <summary> | ||
54 | /// A parcel that covers the entire sim except for a 1 unit wide strip on the eastern side. | ||
55 | /// </summary> | ||
56 | protected ILandObject m_lo; | ||
57 | |||
58 | /// <summary> | ||
59 | /// A parcel that covers just the eastern strip of the sim. | ||
60 | /// </summary> | ||
61 | protected ILandObject m_lo2; | ||
62 | |||
63 | [SetUp] | ||
64 | public void SetUp() | ||
65 | { | ||
66 | m_pcm = new PrimCountModule(); | ||
67 | LandManagementModule lmm = new LandManagementModule(); | ||
68 | m_scene = SceneSetupHelpers.SetupScene(); | ||
69 | SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); | ||
70 | |||
71 | int xParcelDivider = (int)Constants.RegionSize - 1; | ||
72 | |||
73 | ILandObject lo = new LandObject(m_userId, false, m_scene); | ||
74 | lo.LandData.Name = "m_lo"; | ||
75 | lo.SetLandBitmap( | ||
76 | lo.GetSquareLandBitmap(0, 0, xParcelDivider, (int)Constants.RegionSize)); | ||
77 | m_lo = lmm.AddLandObject(lo); | ||
78 | |||
79 | ILandObject lo2 = new LandObject(m_userId, false, m_scene); | ||
80 | lo2.SetLandBitmap( | ||
81 | lo2.GetSquareLandBitmap(xParcelDivider, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | ||
82 | lo2.LandData.Name = "m_lo2"; | ||
83 | m_lo2 = lmm.AddLandObject(lo2); | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// Test that counts before we do anything are correct. | ||
88 | /// </summary> | ||
89 | [Test] | ||
90 | public void TestInitialCounts() | ||
91 | { | ||
92 | IPrimCounts pc = m_lo.PrimCounts; | ||
93 | |||
94 | Assert.That(pc.Owner, Is.EqualTo(0)); | ||
95 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
96 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
97 | Assert.That(pc.Total, Is.EqualTo(0)); | ||
98 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
99 | Assert.That(pc.Users[m_userId], Is.EqualTo(0)); | ||
100 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
101 | Assert.That(pc.Simulator, Is.EqualTo(0)); | ||
102 | } | ||
103 | |||
104 | /// <summary> | ||
105 | /// Test count after a parcel owner owned object is added. | ||
106 | /// </summary> | ||
107 | [Test] | ||
108 | public void TestAddOwnerObject() | ||
109 | { | ||
110 | TestHelper.InMethod(); | ||
111 | // log4net.Config.XmlConfigurator.Configure(); | ||
112 | |||
113 | IPrimCounts pc = m_lo.PrimCounts; | ||
114 | |||
115 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); | ||
116 | m_scene.AddNewSceneObject(sog, false); | ||
117 | |||
118 | Assert.That(pc.Owner, Is.EqualTo(3)); | ||
119 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
120 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
121 | Assert.That(pc.Total, Is.EqualTo(3)); | ||
122 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
123 | Assert.That(pc.Users[m_userId], Is.EqualTo(3)); | ||
124 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
125 | Assert.That(pc.Simulator, Is.EqualTo(3)); | ||
126 | |||
127 | // Add a second object and retest | ||
128 | SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); | ||
129 | m_scene.AddNewSceneObject(sog2, false); | ||
130 | |||
131 | Assert.That(pc.Owner, Is.EqualTo(5)); | ||
132 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
133 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
134 | Assert.That(pc.Total, Is.EqualTo(5)); | ||
135 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
136 | Assert.That(pc.Users[m_userId], Is.EqualTo(5)); | ||
137 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
138 | Assert.That(pc.Simulator, Is.EqualTo(5)); | ||
139 | } | ||
140 | |||
141 | /// <summary> | ||
142 | /// Test count after a parcel owner owned copied object is added. | ||
143 | /// </summary> | ||
144 | [Test] | ||
145 | public void TestCopyOwnerObject() | ||
146 | { | ||
147 | TestHelper.InMethod(); | ||
148 | // log4net.Config.XmlConfigurator.Configure(); | ||
149 | |||
150 | IPrimCounts pc = m_lo.PrimCounts; | ||
151 | |||
152 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); | ||
153 | m_scene.AddNewSceneObject(sog, false); | ||
154 | m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); | ||
155 | |||
156 | Assert.That(pc.Owner, Is.EqualTo(6)); | ||
157 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
158 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
159 | Assert.That(pc.Total, Is.EqualTo(6)); | ||
160 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
161 | Assert.That(pc.Users[m_userId], Is.EqualTo(6)); | ||
162 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
163 | Assert.That(pc.Simulator, Is.EqualTo(6)); | ||
164 | } | ||
165 | |||
166 | /// <summary> | ||
167 | /// Test that parcel counts update correctly when an object is moved between parcels, where that movement | ||
168 | /// is not done directly by the user/ | ||
169 | /// </summary> | ||
170 | [Test] | ||
171 | public void TestMoveOwnerObject() | ||
172 | { | ||
173 | TestHelper.InMethod(); | ||
174 | // log4net.Config.XmlConfigurator.Configure(); | ||
175 | |||
176 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); | ||
177 | m_scene.AddNewSceneObject(sog, false); | ||
178 | SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); | ||
179 | m_scene.AddNewSceneObject(sog2, false); | ||
180 | |||
181 | // Move the first scene object to the eastern strip parcel | ||
182 | sog.AbsolutePosition = new Vector3(254, 2, 2); | ||
183 | |||
184 | IPrimCounts pclo1 = m_lo.PrimCounts; | ||
185 | |||
186 | Assert.That(pclo1.Owner, Is.EqualTo(2)); | ||
187 | Assert.That(pclo1.Group, Is.EqualTo(0)); | ||
188 | Assert.That(pclo1.Others, Is.EqualTo(0)); | ||
189 | Assert.That(pclo1.Total, Is.EqualTo(2)); | ||
190 | Assert.That(pclo1.Selected, Is.EqualTo(0)); | ||
191 | Assert.That(pclo1.Users[m_userId], Is.EqualTo(2)); | ||
192 | Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0)); | ||
193 | Assert.That(pclo1.Simulator, Is.EqualTo(5)); | ||
194 | |||
195 | IPrimCounts pclo2 = m_lo2.PrimCounts; | ||
196 | |||
197 | Assert.That(pclo2.Owner, Is.EqualTo(3)); | ||
198 | Assert.That(pclo2.Group, Is.EqualTo(0)); | ||
199 | Assert.That(pclo2.Others, Is.EqualTo(0)); | ||
200 | Assert.That(pclo2.Total, Is.EqualTo(3)); | ||
201 | Assert.That(pclo2.Selected, Is.EqualTo(0)); | ||
202 | Assert.That(pclo2.Users[m_userId], Is.EqualTo(3)); | ||
203 | Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0)); | ||
204 | Assert.That(pclo2.Simulator, Is.EqualTo(5)); | ||
205 | |||
206 | // Now move it back again | ||
207 | sog.AbsolutePosition = new Vector3(2, 2, 2); | ||
208 | |||
209 | Assert.That(pclo1.Owner, Is.EqualTo(5)); | ||
210 | Assert.That(pclo1.Group, Is.EqualTo(0)); | ||
211 | Assert.That(pclo1.Others, Is.EqualTo(0)); | ||
212 | Assert.That(pclo1.Total, Is.EqualTo(5)); | ||
213 | Assert.That(pclo1.Selected, Is.EqualTo(0)); | ||
214 | Assert.That(pclo1.Users[m_userId], Is.EqualTo(5)); | ||
215 | Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0)); | ||
216 | Assert.That(pclo1.Simulator, Is.EqualTo(5)); | ||
217 | |||
218 | Assert.That(pclo2.Owner, Is.EqualTo(0)); | ||
219 | Assert.That(pclo2.Group, Is.EqualTo(0)); | ||
220 | Assert.That(pclo2.Others, Is.EqualTo(0)); | ||
221 | Assert.That(pclo2.Total, Is.EqualTo(0)); | ||
222 | Assert.That(pclo2.Selected, Is.EqualTo(0)); | ||
223 | Assert.That(pclo2.Users[m_userId], Is.EqualTo(0)); | ||
224 | Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0)); | ||
225 | Assert.That(pclo2.Simulator, Is.EqualTo(5)); | ||
226 | } | ||
227 | |||
228 | /// <summary> | ||
229 | /// Test count after a parcel owner owned object is removed. | ||
230 | /// </summary> | ||
231 | [Test] | ||
232 | public void TestRemoveOwnerObject() | ||
233 | { | ||
234 | TestHelper.InMethod(); | ||
235 | // log4net.Config.XmlConfigurator.Configure(); | ||
236 | |||
237 | IPrimCounts pc = m_lo.PrimCounts; | ||
238 | |||
239 | m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false); | ||
240 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); | ||
241 | m_scene.AddNewSceneObject(sogToDelete, false); | ||
242 | m_scene.DeleteSceneObject(sogToDelete, false); | ||
243 | |||
244 | Assert.That(pc.Owner, Is.EqualTo(1)); | ||
245 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
246 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
247 | Assert.That(pc.Total, Is.EqualTo(1)); | ||
248 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
249 | Assert.That(pc.Users[m_userId], Is.EqualTo(1)); | ||
250 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
251 | Assert.That(pc.Simulator, Is.EqualTo(1)); | ||
252 | } | ||
253 | |||
254 | [Test] | ||
255 | public void TestAddGroupObject() | ||
256 | { | ||
257 | TestHelper.InMethod(); | ||
258 | // log4net.Config.XmlConfigurator.Configure(); | ||
259 | |||
260 | m_lo.DeedToGroup(m_groupId); | ||
261 | |||
262 | IPrimCounts pc = m_lo.PrimCounts; | ||
263 | |||
264 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); | ||
265 | sog.GroupID = m_groupId; | ||
266 | m_scene.AddNewSceneObject(sog, false); | ||
267 | |||
268 | Assert.That(pc.Owner, Is.EqualTo(0)); | ||
269 | Assert.That(pc.Group, Is.EqualTo(3)); | ||
270 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
271 | Assert.That(pc.Total, Is.EqualTo(3)); | ||
272 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
273 | |||
274 | // Is this desired behaviour? Not totally sure. | ||
275 | Assert.That(pc.Users[m_userId], Is.EqualTo(0)); | ||
276 | Assert.That(pc.Users[m_groupId], Is.EqualTo(0)); | ||
277 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3)); | ||
278 | |||
279 | Assert.That(pc.Simulator, Is.EqualTo(3)); | ||
280 | } | ||
281 | |||
282 | /// <summary> | ||
283 | /// Test count after a parcel owner owned object is removed. | ||
284 | /// </summary> | ||
285 | [Test] | ||
286 | public void TestRemoveGroupObject() | ||
287 | { | ||
288 | TestHelper.InMethod(); | ||
289 | // log4net.Config.XmlConfigurator.Configure(); | ||
290 | |||
291 | m_lo.DeedToGroup(m_groupId); | ||
292 | |||
293 | IPrimCounts pc = m_lo.PrimCounts; | ||
294 | |||
295 | SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1); | ||
296 | sogToKeep.GroupID = m_groupId; | ||
297 | m_scene.AddNewSceneObject(sogToKeep, false); | ||
298 | |||
299 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); | ||
300 | m_scene.AddNewSceneObject(sogToDelete, false); | ||
301 | m_scene.DeleteSceneObject(sogToDelete, false); | ||
302 | |||
303 | Assert.That(pc.Owner, Is.EqualTo(0)); | ||
304 | Assert.That(pc.Group, Is.EqualTo(1)); | ||
305 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
306 | Assert.That(pc.Total, Is.EqualTo(1)); | ||
307 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
308 | Assert.That(pc.Users[m_userId], Is.EqualTo(1)); | ||
309 | Assert.That(pc.Users[m_groupId], Is.EqualTo(0)); | ||
310 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
311 | Assert.That(pc.Simulator, Is.EqualTo(1)); | ||
312 | } | ||
313 | |||
314 | [Test] | ||
315 | public void TestAddOthersObject() | ||
316 | { | ||
317 | TestHelper.InMethod(); | ||
318 | // log4net.Config.XmlConfigurator.Configure(); | ||
319 | |||
320 | IPrimCounts pc = m_lo.PrimCounts; | ||
321 | |||
322 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); | ||
323 | m_scene.AddNewSceneObject(sog, false); | ||
324 | |||
325 | Assert.That(pc.Owner, Is.EqualTo(0)); | ||
326 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
327 | Assert.That(pc.Others, Is.EqualTo(3)); | ||
328 | Assert.That(pc.Total, Is.EqualTo(3)); | ||
329 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
330 | Assert.That(pc.Users[m_userId], Is.EqualTo(0)); | ||
331 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3)); | ||
332 | Assert.That(pc.Simulator, Is.EqualTo(3)); | ||
333 | } | ||
334 | |||
335 | [Test] | ||
336 | public void TestRemoveOthersObject() | ||
337 | { | ||
338 | TestHelper.InMethod(); | ||
339 | // log4net.Config.XmlConfigurator.Configure(); | ||
340 | |||
341 | IPrimCounts pc = m_lo.PrimCounts; | ||
342 | |||
343 | m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false); | ||
344 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10); | ||
345 | m_scene.AddNewSceneObject(sogToDelete, false); | ||
346 | m_scene.DeleteSceneObject(sogToDelete, false); | ||
347 | |||
348 | Assert.That(pc.Owner, Is.EqualTo(0)); | ||
349 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
350 | Assert.That(pc.Others, Is.EqualTo(1)); | ||
351 | Assert.That(pc.Total, Is.EqualTo(1)); | ||
352 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
353 | Assert.That(pc.Users[m_userId], Is.EqualTo(0)); | ||
354 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(1)); | ||
355 | Assert.That(pc.Simulator, Is.EqualTo(1)); | ||
356 | } | ||
357 | |||
358 | /// <summary> | ||
359 | /// Test the count is correct after is has been tainted. | ||
360 | /// </summary> | ||
361 | [Test] | ||
362 | public void TestTaint() | ||
363 | { | ||
364 | TestHelper.InMethod(); | ||
365 | IPrimCounts pc = m_lo.PrimCounts; | ||
366 | |||
367 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); | ||
368 | m_scene.AddNewSceneObject(sog, false); | ||
369 | |||
370 | m_pcm.TaintPrimCount(); | ||
371 | |||
372 | Assert.That(pc.Owner, Is.EqualTo(3)); | ||
373 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
374 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
375 | Assert.That(pc.Total, Is.EqualTo(3)); | ||
376 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
377 | Assert.That(pc.Users[m_userId], Is.EqualTo(3)); | ||
378 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
379 | Assert.That(pc.Simulator, Is.EqualTo(3)); | ||
380 | } | ||
381 | } | ||
382 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index cea7c78..4e14c73 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs | |||
@@ -469,8 +469,8 @@ namespace OpenSim.Region.CoreModules | |||
469 | m_SunFixedHour = FixedSunHour; | 469 | m_SunFixedHour = FixedSunHour; |
470 | m_SunFixed = FixedSun; | 470 | m_SunFixed = FixedSun; |
471 | 471 | ||
472 | m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString()); | 472 | // m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString()); |
473 | m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString()); | 473 | // m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString()); |
474 | 474 | ||
475 | receivedEstateToolsSunUpdate = true; | 475 | receivedEstateToolsSunUpdate = true; |
476 | 476 | ||
@@ -480,7 +480,7 @@ namespace OpenSim.Region.CoreModules | |||
480 | // When sun settings are updated, we should update all clients with new settings. | 480 | // When sun settings are updated, we should update all clients with new settings. |
481 | SunUpdateToAllClients(); | 481 | SunUpdateToAllClients(); |
482 | 482 | ||
483 | m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); | 483 | // m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); |
484 | } | 484 | } |
485 | } | 485 | } |
486 | 486 | ||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index 6676ec8..d6fa093 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | |||
@@ -62,9 +62,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
62 | return LoadBitmap(new Bitmap(filename)); | 62 | return LoadBitmap(new Bitmap(filename)); |
63 | } | 63 | } |
64 | 64 | ||
65 | public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) | 65 | public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h) |
66 | { | 66 | { |
67 | throw new NotImplementedException(); | 67 | Bitmap bitmap = new Bitmap(filename); |
68 | ITerrainChannel retval = new TerrainChannel(true); | ||
69 | |||
70 | for (int x = 0; x < retval.Width; x++) | ||
71 | { | ||
72 | for (int y = 0; y < retval.Height; y++) | ||
73 | { | ||
74 | retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | return retval; | ||
68 | } | 79 | } |
69 | 80 | ||
70 | public virtual ITerrainChannel LoadStream(Stream stream) | 81 | public virtual ITerrainChannel LoadStream(Stream stream) |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 7bb7544..f9ef286 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -100,8 +100,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
100 | // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region | 100 | // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region |
101 | regionInfos = new List<GridRegion>(); | 101 | regionInfos = new List<GridRegion>(); |
102 | GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName); | 102 | GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName); |
103 | if (info != null) regionInfos.Add(info); | 103 | if (info != null) |
104 | regionInfos.Add(info); | ||
104 | } | 105 | } |
106 | else if (regionInfos.Count == 0 && mapName.StartsWith("http://")) | ||
107 | remoteClient.SendAlertMessage("Hyperlink could not be established."); | ||
108 | |||
105 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); | 109 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); |
106 | List<MapBlockData> blocks = new List<MapBlockData>(); | 110 | List<MapBlockData> blocks = new List<MapBlockData>(); |
107 | 111 | ||
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 41d6628..d939329 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -909,7 +909,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
909 | { | 909 | { |
910 | } | 910 | } |
911 | 911 | ||
912 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 912 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) |
913 | { | 913 | { |
914 | } | 914 | } |
915 | 915 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs index 95c9659..7066cf2 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs | |||
@@ -34,12 +34,74 @@ namespace OpenSim.Region.Framework.Interfaces | |||
34 | { | 34 | { |
35 | public interface IEstateDataService | 35 | public interface IEstateDataService |
36 | { | 36 | { |
37 | /// <summary> | ||
38 | /// Load estate settings for a region. | ||
39 | /// </summary> | ||
40 | /// <param name="regionID"></param> | ||
41 | /// <param name="create">If true, then an estate is created if one is not found.</param> | ||
42 | /// <returns></returns> | ||
37 | EstateSettings LoadEstateSettings(UUID regionID, bool create); | 43 | EstateSettings LoadEstateSettings(UUID regionID, bool create); |
44 | |||
45 | /// <summary> | ||
46 | /// Load estate settings for an estate ID. | ||
47 | /// </summary> | ||
48 | /// <param name="estateID"></param> | ||
49 | /// <returns></returns> | ||
38 | EstateSettings LoadEstateSettings(int estateID); | 50 | EstateSettings LoadEstateSettings(int estateID); |
51 | |||
52 | /// <summary> | ||
53 | /// Load/Get all estate settings. | ||
54 | /// </summary> | ||
55 | /// <returns>An empty list if no estates were found.</returns> | ||
56 | List<EstateSettings> LoadEstateSettingsAll(); | ||
57 | |||
58 | /// <summary> | ||
59 | /// Store estate settings. | ||
60 | /// </summary> | ||
61 | /// <remarks> | ||
62 | /// This is also called by EstateSettings.Save()</remarks> | ||
63 | /// <param name="es"></param> | ||
39 | void StoreEstateSettings(EstateSettings es); | 64 | void StoreEstateSettings(EstateSettings es); |
65 | |||
66 | /// <summary> | ||
67 | /// Get estate IDs. | ||
68 | /// </summary> | ||
69 | /// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param> | ||
70 | /// <returns></returns> | ||
40 | List<int> GetEstates(string search); | 71 | List<int> GetEstates(string search); |
72 | |||
73 | /// <summary> | ||
74 | /// Get the IDs of all estates owned by the given user. | ||
75 | /// </summary> | ||
76 | /// <returns>An empty list if no estates were found.</returns> | ||
77 | List<int> GetEstatesByOwner(UUID ownerID); | ||
78 | |||
79 | /// <summary> | ||
80 | /// Get the IDs of all estates. | ||
81 | /// </summary> | ||
82 | /// <returns>An empty list if no estates were found.</returns> | ||
83 | List<int> GetEstatesAll(); | ||
84 | |||
85 | /// <summary> | ||
86 | /// Link a region to an estate. | ||
87 | /// </summary> | ||
88 | /// <param name="regionID"></param> | ||
89 | /// <param name="estateID"></param> | ||
90 | /// <returns>true if the link succeeded, false otherwise</returns> | ||
41 | bool LinkRegion(UUID regionID, int estateID); | 91 | bool LinkRegion(UUID regionID, int estateID); |
92 | |||
93 | /// <summary> | ||
94 | /// Get the UUIDs of all the regions in an estate. | ||
95 | /// </summary> | ||
96 | /// <param name="estateID"></param> | ||
97 | /// <returns></returns> | ||
42 | List<UUID> GetRegions(int estateID); | 98 | List<UUID> GetRegions(int estateID); |
99 | |||
100 | /// <summary> | ||
101 | /// Delete an estate | ||
102 | /// </summary> | ||
103 | /// <param name="estateID"></param> | ||
104 | /// <returns>true if the delete succeeded, false otherwise</returns> | ||
43 | bool DeleteEstate(int estateID); | 105 | bool DeleteEstate(int estateID); |
44 | } | 106 | } |
45 | } | 107 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs index 87c7a05..d790a30 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs | |||
@@ -33,14 +33,80 @@ namespace OpenSim.Region.Framework.Interfaces | |||
33 | { | 33 | { |
34 | public interface IEstateDataStore | 34 | public interface IEstateDataStore |
35 | { | 35 | { |
36 | /// <summary> | ||
37 | /// Initialise the data store. | ||
38 | /// </summary> | ||
39 | /// <param name="connectstring"></param> | ||
36 | void Initialise(string connectstring); | 40 | void Initialise(string connectstring); |
37 | 41 | ||
42 | /// <summary> | ||
43 | /// Load estate settings for a region. | ||
44 | /// </summary> | ||
45 | /// <param name="regionID"></param> | ||
46 | /// <param name="create">If true, then an estate is created if one is not found.</param> | ||
47 | /// <returns></returns> | ||
38 | EstateSettings LoadEstateSettings(UUID regionID, bool create); | 48 | EstateSettings LoadEstateSettings(UUID regionID, bool create); |
49 | |||
50 | /// <summary> | ||
51 | /// Load estate settings for an estate ID. | ||
52 | /// </summary> | ||
53 | /// <param name="estateID"></param> | ||
54 | /// <returns></returns> | ||
39 | EstateSettings LoadEstateSettings(int estateID); | 55 | EstateSettings LoadEstateSettings(int estateID); |
56 | |||
57 | /// <summary> | ||
58 | /// Load/Get all estate settings. | ||
59 | /// </summary> | ||
60 | /// <returns>An empty list if no estates were found.</returns> | ||
61 | List<EstateSettings> LoadEstateSettingsAll(); | ||
62 | |||
63 | /// <summary> | ||
64 | /// Store estate settings. | ||
65 | /// </summary> | ||
66 | /// <remarks> | ||
67 | /// This is also called by EstateSettings.Save()</remarks> | ||
68 | /// <param name="es"></param> | ||
40 | void StoreEstateSettings(EstateSettings es); | 69 | void StoreEstateSettings(EstateSettings es); |
70 | |||
71 | /// <summary> | ||
72 | /// Get estate IDs. | ||
73 | /// </summary> | ||
74 | /// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param> | ||
75 | /// <returns></returns> | ||
41 | List<int> GetEstates(string search); | 76 | List<int> GetEstates(string search); |
77 | |||
78 | /// <summary> | ||
79 | /// Get the IDs of all estates owned by the given user. | ||
80 | /// </summary> | ||
81 | /// <returns>An empty list if no estates were found.</returns> | ||
82 | List<int> GetEstatesByOwner(UUID ownerID); | ||
83 | |||
84 | /// <summary> | ||
85 | /// Get the IDs of all estates. | ||
86 | /// </summary> | ||
87 | /// <returns>An empty list if no estates were found.</returns> | ||
88 | List<int> GetEstatesAll(); | ||
89 | |||
90 | /// <summary> | ||
91 | /// Link a region to an estate. | ||
92 | /// </summary> | ||
93 | /// <param name="regionID"></param> | ||
94 | /// <param name="estateID"></param> | ||
95 | /// <returns>true if the link succeeded, false otherwise</returns> | ||
42 | bool LinkRegion(UUID regionID, int estateID); | 96 | bool LinkRegion(UUID regionID, int estateID); |
97 | |||
98 | /// <summary> | ||
99 | /// Get the UUIDs of all the regions in an estate. | ||
100 | /// </summary> | ||
101 | /// <param name="estateID"></param> | ||
102 | /// <returns></returns> | ||
43 | List<UUID> GetRegions(int estateID); | 103 | List<UUID> GetRegions(int estateID); |
104 | |||
105 | /// <summary> | ||
106 | /// Delete an estate | ||
107 | /// </summary> | ||
108 | /// <param name="estateID"></param> | ||
109 | /// <returns>true if the delete succeeded, false otherwise</returns> | ||
44 | bool DeleteEstate(int estateID); | 110 | bool DeleteEstate(int estateID); |
45 | } | 111 | } |
46 | } | 112 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs index 65158e1..d63da2e 100644 --- a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs | |||
@@ -38,18 +38,4 @@ namespace OpenSim.Region.Framework.Interfaces | |||
38 | 38 | ||
39 | IPrimCounts GetPrimCounts(UUID parcelID); | 39 | IPrimCounts GetPrimCounts(UUID parcelID); |
40 | } | 40 | } |
41 | 41 | } \ No newline at end of file | |
42 | public interface IPrimCounts | ||
43 | { | ||
44 | int Owner { get; } | ||
45 | int Group { get; } | ||
46 | int Others { get; } | ||
47 | int Simulator { get; } | ||
48 | IUserPrimCounts Users { get; } | ||
49 | } | ||
50 | |||
51 | public interface IUserPrimCounts | ||
52 | { | ||
53 | int this[UUID agentID] { get; } | ||
54 | } | ||
55 | } | ||
diff --git a/OpenSim/Region/Framework/ModuleLoader.cs b/OpenSim/Region/Framework/ModuleLoader.cs index 23be9c2..14ecd44 100644 --- a/OpenSim/Region/Framework/ModuleLoader.cs +++ b/OpenSim/Region/Framework/ModuleLoader.cs | |||
@@ -223,7 +223,8 @@ namespace OpenSim.Region.Framework | |||
223 | catch (Exception e) | 223 | catch (Exception e) |
224 | { | 224 | { |
225 | m_log.ErrorFormat( | 225 | m_log.ErrorFormat( |
226 | "[MODULES]: Could not load types for [{0}]. Exception {1}", pluginAssembly.FullName, e); | 226 | "[MODULES]: Could not load types for plugin DLL {0}. Exception {1} {2}", |
227 | pluginAssembly.FullName, e.Message, e.StackTrace); | ||
227 | 228 | ||
228 | // justincc: Right now this is fatal to really get the user's attention | 229 | // justincc: Right now this is fatal to really get the user's attention |
229 | throw e; | 230 | throw e; |
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 64567db..8feb022 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs | |||
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
137 | x = m_inventoryDeletes.Dequeue(); | 137 | x = m_inventoryDeletes.Dequeue(); |
138 | 138 | ||
139 | m_log.DebugFormat( | 139 | m_log.DebugFormat( |
140 | "[ASYNC DELETER]: Sending object to user's inventory, {0} item(s) remaining.", left); | 140 | "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.", left, x.action, x.objectGroups.Count); |
141 | 141 | ||
142 | try | 142 | try |
143 | { | 143 | { |
@@ -177,4 +177,4 @@ namespace OpenSim.Region.Framework.Scenes | |||
177 | return false; | 177 | return false; |
178 | } | 178 | } |
179 | } | 179 | } |
180 | } \ No newline at end of file | 180 | } |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index c321a15..fd62535 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -242,7 +242,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
242 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); | 242 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); |
243 | 243 | ||
244 | public event EstateToolsSunUpdate OnEstateToolsSunUpdate; | 244 | public event EstateToolsSunUpdate OnEstateToolsSunUpdate; |
245 | |||
246 | /// <summary> | ||
247 | /// Triggered when an object is added to the scene. | ||
248 | /// </summary> | ||
249 | public event Action<SceneObjectGroup> OnObjectAddedToScene; | ||
245 | 250 | ||
251 | /// <summary> | ||
252 | /// Triggered when an object is removed from the scene. | ||
253 | /// </summary> | ||
246 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); | 254 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); |
247 | public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; | 255 | public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; |
248 | 256 | ||
@@ -345,6 +353,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
345 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); | 353 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); |
346 | public event Attach OnAttach; | 354 | public event Attach OnAttach; |
347 | 355 | ||
356 | |||
348 | /// <summary> | 357 | /// <summary> |
349 | /// Called immediately after an object is loaded from storage. | 358 | /// Called immediately after an object is loaded from storage. |
350 | /// </summary> | 359 | /// </summary> |
@@ -800,6 +809,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
800 | } | 809 | } |
801 | } | 810 | } |
802 | 811 | ||
812 | public void TriggerObjectAddedToScene(SceneObjectGroup obj) | ||
813 | { | ||
814 | Action<SceneObjectGroup> handler = OnObjectAddedToScene; | ||
815 | if (handler != null) | ||
816 | { | ||
817 | foreach (Action<SceneObjectGroup> d in handler.GetInvocationList()) | ||
818 | { | ||
819 | try | ||
820 | { | ||
821 | d(obj); | ||
822 | } | ||
823 | catch (Exception e) | ||
824 | { | ||
825 | m_log.ErrorFormat( | ||
826 | "[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}", | ||
827 | e.Message, e.StackTrace); | ||
828 | } | ||
829 | } | ||
830 | } | ||
831 | } | ||
832 | |||
803 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) | 833 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) |
804 | { | 834 | { |
805 | ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; | 835 | ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; |
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index f9599f5..4694e2b 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -58,17 +58,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
58 | 58 | ||
59 | public class Prioritizer | 59 | public class Prioritizer |
60 | { | 60 | { |
61 | // private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 61 | private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
62 | 62 | ||
63 | /// <summary> | ||
64 | /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the | ||
65 | /// viewer before child prim updates. | ||
66 | /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up | ||
67 | /// being double. We do it both ways so that there is a still a priority delta even if the priority is already | ||
68 | /// double.MinValue or double.MaxValue. | ||
69 | /// </summary> | ||
70 | private double m_childPrimAdjustmentFactor = 0.05; | ||
71 | |||
72 | private Scene m_scene; | 63 | private Scene m_scene; |
73 | 64 | ||
74 | public Prioritizer(Scene scene) | 65 | public Prioritizer(Scene scene) |
@@ -76,17 +67,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
76 | m_scene = scene; | 67 | m_scene = scene; |
77 | } | 68 | } |
78 | 69 | ||
79 | public double GetUpdatePriority(IClientAPI client, ISceneEntity entity) | 70 | /// <summary> |
71 | /// Returns the priority queue into which the update should be placed. Updates within a | ||
72 | /// queue will be processed in arrival order. There are currently 12 priority queues | ||
73 | /// implemented in PriorityQueue class in LLClientView. Queue 0 is generally retained | ||
74 | /// for avatar updates. The fair queuing discipline for processing the priority queues | ||
75 | /// assumes that the number of entities in each priority queues increases exponentially. | ||
76 | /// So for example... if queue 1 contains all updates within 10m of the avatar or camera | ||
77 | /// then queue 2 at 20m is about 3X bigger in space & about 3X bigger in total number | ||
78 | /// of updates. | ||
79 | /// </summary> | ||
80 | public uint GetUpdatePriority(IClientAPI client, ISceneEntity entity) | ||
80 | { | 81 | { |
81 | double priority = 0; | 82 | // If entity is null we have a serious problem |
82 | |||
83 | if (entity == null) | 83 | if (entity == null) |
84 | return 100000; | 84 | { |
85 | m_log.WarnFormat("[PRIORITIZER] attempt to prioritize null entity"); | ||
86 | throw new InvalidOperationException("Prioritization entity not defined"); | ||
87 | } | ||
88 | |||
89 | // If this is an update for our own avatar give it the highest priority | ||
90 | if (client.AgentId == entity.UUID) | ||
91 | return 0; | ||
92 | |||
93 | uint priority; | ||
85 | 94 | ||
86 | switch (m_scene.UpdatePrioritizationScheme) | 95 | switch (m_scene.UpdatePrioritizationScheme) |
87 | { | 96 | { |
88 | case UpdatePrioritizationSchemes.Time: | 97 | case UpdatePrioritizationSchemes.Time: |
89 | priority = GetPriorityByTime(); | 98 | priority = GetPriorityByTime(client, entity); |
90 | break; | 99 | break; |
91 | case UpdatePrioritizationSchemes.Distance: | 100 | case UpdatePrioritizationSchemes.Distance: |
92 | priority = GetPriorityByDistance(client, entity); | 101 | priority = GetPriorityByDistance(client, entity); |
@@ -104,180 +113,111 @@ namespace OpenSim.Region.Framework.Scenes | |||
104 | throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); | 113 | throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); |
105 | } | 114 | } |
106 | 115 | ||
107 | // Adjust priority so that root prims are sent to the viewer first. This is especially important for | ||
108 | // attachments acting as huds, since current viewers fail to display hud child prims if their updates | ||
109 | // arrive before the root one. | ||
110 | if (entity is SceneObjectPart) | ||
111 | { | ||
112 | SceneObjectPart sop = ((SceneObjectPart)entity); | ||
113 | |||
114 | if (sop.IsRoot) | ||
115 | { | ||
116 | if (priority >= double.MinValue + m_childPrimAdjustmentFactor) | ||
117 | priority -= m_childPrimAdjustmentFactor; | ||
118 | } | ||
119 | else | ||
120 | { | ||
121 | if (priority <= double.MaxValue - m_childPrimAdjustmentFactor) | ||
122 | priority += m_childPrimAdjustmentFactor; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | return priority; | 116 | return priority; |
127 | } | 117 | } |
128 | 118 | ||
129 | private double GetPriorityByTime() | 119 | |
120 | private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) | ||
130 | { | 121 | { |
131 | return DateTime.UtcNow.ToOADate(); | 122 | return 1; |
132 | } | 123 | } |
133 | 124 | ||
134 | private double GetPriorityByDistance(IClientAPI client, ISceneEntity entity) | 125 | private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity) |
135 | { | 126 | { |
136 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); | 127 | return ComputeDistancePriority(client,entity,false); |
137 | if (presence != null) | 128 | } |
138 | { | 129 | |
139 | // If this is an update for our own avatar give it the highest priority | 130 | private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) |
140 | if (presence == entity) | 131 | { |
141 | return 0.0; | 132 | return ComputeDistancePriority(client,entity,true); |
142 | |||
143 | // Use the camera position for local agents and avatar position for remote agents | ||
144 | Vector3 presencePos = (presence.IsChildAgent) ? | ||
145 | presence.AbsolutePosition : | ||
146 | presence.CameraPosition; | ||
147 | |||
148 | // Use group position for child prims | ||
149 | Vector3 entityPos; | ||
150 | if (entity is SceneObjectPart) | ||
151 | { | ||
152 | // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene | ||
153 | // before its scheduled update was triggered | ||
154 | //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; | ||
155 | entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; | ||
156 | } | ||
157 | else | ||
158 | { | ||
159 | entityPos = entity.AbsolutePosition; | ||
160 | } | ||
161 | |||
162 | return Vector3.DistanceSquared(presencePos, entityPos); | ||
163 | } | ||
164 | |||
165 | return double.NaN; | ||
166 | } | 133 | } |
167 | 134 | ||
168 | private double GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) | 135 | private uint GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity) |
169 | { | 136 | { |
137 | uint pqueue = ComputeDistancePriority(client,entity,true); | ||
138 | |||
170 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); | 139 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); |
171 | if (presence != null) | 140 | if (presence != null) |
172 | { | 141 | { |
173 | // If this is an update for our own avatar give it the highest priority | ||
174 | if (presence == entity) | ||
175 | return 0.0; | ||
176 | |||
177 | // Use group position for child prims | ||
178 | Vector3 entityPos = entity.AbsolutePosition; | ||
179 | if (entity is SceneObjectPart) | ||
180 | { | ||
181 | // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene | ||
182 | // before its scheduled update was triggered | ||
183 | //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; | ||
184 | entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; | ||
185 | } | ||
186 | else | ||
187 | { | ||
188 | entityPos = entity.AbsolutePosition; | ||
189 | } | ||
190 | |||
191 | if (!presence.IsChildAgent) | 142 | if (!presence.IsChildAgent) |
192 | { | 143 | { |
193 | // Root agent. Use distance from camera and a priority decrease for objects behind us | 144 | if (entity is SceneObjectPart) |
194 | Vector3 camPosition = presence.CameraPosition; | 145 | { |
195 | Vector3 camAtAxis = presence.CameraAtAxis; | 146 | // Non physical prims are lower priority than physical prims |
196 | 147 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; | |
197 | // Distance | 148 | if (physActor == null || !physActor.IsPhysical) |
198 | double priority = Vector3.DistanceSquared(camPosition, entityPos); | 149 | pqueue++; |
199 | |||
200 | // Plane equation | ||
201 | float d = -Vector3.Dot(camPosition, camAtAxis); | ||
202 | float p = Vector3.Dot(camAtAxis, entityPos) + d; | ||
203 | if (p < 0.0f) priority *= 2.0; | ||
204 | |||
205 | return priority; | ||
206 | } | ||
207 | else | ||
208 | { | ||
209 | // Child agent. Use the normal distance method | ||
210 | Vector3 presencePos = presence.AbsolutePosition; | ||
211 | 150 | ||
212 | return Vector3.DistanceSquared(presencePos, entityPos); | 151 | // Attachments are high priority, |
152 | // MIC: shouldn't these already be in the highest priority queue already | ||
153 | // since their root position is same as the avatars? | ||
154 | if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) | ||
155 | pqueue = 1; | ||
156 | } | ||
213 | } | 157 | } |
214 | } | 158 | } |
215 | 159 | ||
216 | return double.NaN; | 160 | return pqueue; |
217 | } | 161 | } |
218 | 162 | ||
219 | private double GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity) | 163 | private uint ComputeDistancePriority(IClientAPI client, ISceneEntity entity, bool useFrontBack) |
220 | { | 164 | { |
221 | // If this is an update for our own avatar give it the highest priority | 165 | // Get this agent's position |
222 | if (client.AgentId == entity.UUID) | 166 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); |
223 | return 0.0; | 167 | if (presence == null) |
224 | if (entity == null) | 168 | { |
225 | return double.NaN; | 169 | m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId); |
226 | 170 | // throw new InvalidOperationException("Prioritization agent not defined"); | |
227 | // Use group position for child prims | 171 | return Int32.MaxValue; |
172 | } | ||
173 | |||
174 | // Use group position for child prims, since we are putting child prims in | ||
175 | // the same queue with the root of the group, the root prim (which goes into | ||
176 | // the queue first) should always be sent first, no need to adjust child prim | ||
177 | // priorities | ||
228 | Vector3 entityPos = entity.AbsolutePosition; | 178 | Vector3 entityPos = entity.AbsolutePosition; |
229 | if (entity is SceneObjectPart) | 179 | if (entity is SceneObjectPart) |
230 | { | 180 | { |
231 | SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; | 181 | SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; |
232 | if (group != null) | 182 | if (group != null) |
233 | entityPos = group.AbsolutePosition; | 183 | entityPos = group.AbsolutePosition; |
234 | else | ||
235 | entityPos = entity.AbsolutePosition; | ||
236 | } | 184 | } |
237 | else | ||
238 | entityPos = entity.AbsolutePosition; | ||
239 | 185 | ||
240 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); | 186 | // Use the camera position for local agents and avatar position for remote agents |
241 | if (presence != null) | 187 | Vector3 presencePos = (presence.IsChildAgent) ? |
242 | { | 188 | presence.AbsolutePosition : |
243 | if (!presence.IsChildAgent) | 189 | presence.CameraPosition; |
244 | { | ||
245 | if (entity is ScenePresence) | ||
246 | return 1.0; | ||
247 | |||
248 | // Root agent. Use distance from camera and a priority decrease for objects behind us | ||
249 | Vector3 camPosition = presence.CameraPosition; | ||
250 | Vector3 camAtAxis = presence.CameraAtAxis; | ||
251 | 190 | ||
252 | // Distance | 191 | // Compute the distance... |
253 | double priority = Vector3.DistanceSquared(camPosition, entityPos); | 192 | double distance = Vector3.Distance(presencePos, entityPos); |
254 | 193 | ||
255 | // Plane equation | 194 | // And convert the distance to a priority queue, this computation gives queues |
256 | float d = -Vector3.Dot(camPosition, camAtAxis); | 195 | // at 10, 20, 40, 80, 160, 320, 640, and 1280m |
257 | float p = Vector3.Dot(camAtAxis, entityPos) + d; | 196 | uint pqueue = 1; |
258 | if (p < 0.0f) priority *= 2.0; | 197 | for (int i = 0; i < 8; i++) |
259 | 198 | { | |
260 | if (entity is SceneObjectPart) | 199 | if (distance < 10 * Math.Pow(2.0,i)) |
261 | { | 200 | break; |
262 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; | 201 | pqueue++; |
263 | if (physActor == null || !physActor.IsPhysical) | 202 | } |
264 | priority += 100; | 203 | |
265 | 204 | // If this is a root agent, then determine front & back | |
266 | if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) | 205 | // Bump up the priority queue (drop the priority) for any objects behind the avatar |
267 | priority = 1.0; | 206 | if (useFrontBack && ! presence.IsChildAgent) |
268 | } | 207 | { |
269 | return priority; | 208 | // Root agent, decrease priority for objects behind us |
270 | } | 209 | Vector3 camPosition = presence.CameraPosition; |
271 | else | 210 | Vector3 camAtAxis = presence.CameraAtAxis; |
272 | { | 211 | |
273 | // Child agent. Use the normal distance method | 212 | // Plane equation |
274 | Vector3 presencePos = presence.AbsolutePosition; | 213 | float d = -Vector3.Dot(camPosition, camAtAxis); |
275 | 214 | float p = Vector3.Dot(camAtAxis, entityPos) + d; | |
276 | return Vector3.DistanceSquared(presencePos, entityPos); | 215 | if (p < 0.0f) |
277 | } | 216 | pqueue++; |
278 | } | 217 | } |
279 | 218 | ||
280 | return double.NaN; | 219 | return pqueue; |
281 | } | 220 | } |
221 | |||
282 | } | 222 | } |
283 | } | 223 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index fcbcf59..0f85925 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1955,11 +1955,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
1955 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 1955 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
1956 | bool RezSelected, bool RemoveItem, UUID fromTaskID) | 1956 | bool RezSelected, bool RemoveItem, UUID fromTaskID) |
1957 | { | 1957 | { |
1958 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); | 1958 | // m_log.DebugFormat( |
1959 | if (invAccess != null) | 1959 | // "[PRIM INVENTORY]: RezObject from {0} for item {1} from task id {2}", |
1960 | invAccess.RezObject( | 1960 | // remoteClient.Name, itemID, fromTaskID); |
1961 | remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, | 1961 | |
1962 | RezSelected, RemoveItem, fromTaskID, false); | 1962 | if (fromTaskID == UUID.Zero) |
1963 | { | ||
1964 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); | ||
1965 | if (invAccess != null) | ||
1966 | invAccess.RezObject( | ||
1967 | remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, | ||
1968 | RezSelected, RemoveItem, fromTaskID, false); | ||
1969 | } | ||
1970 | else | ||
1971 | { | ||
1972 | SceneObjectPart part = GetSceneObjectPart(fromTaskID); | ||
1973 | if (part == null) | ||
1974 | { | ||
1975 | m_log.ErrorFormat( | ||
1976 | "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such scene object", | ||
1977 | remoteClient.Name, itemID, fromTaskID); | ||
1978 | |||
1979 | return; | ||
1980 | } | ||
1981 | |||
1982 | TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID); | ||
1983 | if (item == null) | ||
1984 | { | ||
1985 | m_log.ErrorFormat( | ||
1986 | "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such item", | ||
1987 | remoteClient.Name, itemID, fromTaskID); | ||
1988 | |||
1989 | return; | ||
1990 | } | ||
1991 | |||
1992 | byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); | ||
1993 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); | ||
1994 | Vector3 pos | ||
1995 | = GetNewRezLocation( | ||
1996 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | ||
1997 | BypassRayCast, bRayEndIsIntersection, true, scale, false); | ||
1998 | |||
1999 | RezObject(part, item, pos, null, Vector3.Zero, 0); | ||
2000 | } | ||
1963 | } | 2001 | } |
1964 | 2002 | ||
1965 | /// <summary> | 2003 | /// <summary> |
@@ -1967,14 +2005,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1967 | /// </summary> | 2005 | /// </summary> |
1968 | /// <param name="sourcePart"></param> | 2006 | /// <param name="sourcePart"></param> |
1969 | /// <param name="item"></param> | 2007 | /// <param name="item"></param> |
1970 | /// <param name="pos"></param> | 2008 | /// <param name="pos">The position of the rezzed object.</param> |
1971 | /// <param name="rot"></param> | 2009 | /// <param name="rot">The rotation of the rezzed object. If null, then the rotation stored with the object |
1972 | /// <param name="vel"></param> | 2010 | /// will be used if it exists.</param> |
2011 | /// <param name="vel">The velocity of the rezzed object.</param> | ||
1973 | /// <param name="param"></param> | 2012 | /// <param name="param"></param> |
1974 | /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful</returns> | 2013 | /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful</returns> |
1975 | public virtual SceneObjectGroup RezObject( | 2014 | public virtual SceneObjectGroup RezObject( |
1976 | SceneObjectPart sourcePart, TaskInventoryItem item, | 2015 | SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param) |
1977 | Vector3 pos, Quaternion rot, Vector3 vel, int param) | ||
1978 | { | 2016 | { |
1979 | if (null == item) | 2017 | if (null == item) |
1980 | return null; | 2018 | return null; |
@@ -1992,8 +2030,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1992 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 2030 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
1993 | sourcePart.Inventory.RemoveInventoryItem(item.ItemID); | 2031 | sourcePart.Inventory.RemoveInventoryItem(item.ItemID); |
1994 | } | 2032 | } |
1995 | 2033 | ||
1996 | AddNewSceneObject(group, true, pos, rot, vel); | 2034 | AddNewSceneObject(group, true); |
2035 | |||
2036 | group.AbsolutePosition = pos; | ||
2037 | group.Velocity = vel; | ||
2038 | |||
2039 | if (rot != null) | ||
2040 | group.UpdateGroupRotationR((Quaternion)rot); | ||
1997 | 2041 | ||
1998 | // We can only call this after adding the scene object, since the scene object references the scene | 2042 | // We can only call this after adding the scene object, since the scene object references the scene |
1999 | // to find out if scripts should be activated at all. | 2043 | // to find out if scripts should be activated at all. |
@@ -2069,7 +2113,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2069 | SceneObjectPart[] partList = sog.Parts; | 2113 | SceneObjectPart[] partList = sog.Parts; |
2070 | 2114 | ||
2071 | foreach (SceneObjectPart child in partList) | 2115 | foreach (SceneObjectPart child in partList) |
2116 | { | ||
2072 | child.Inventory.ChangeInventoryOwner(ownerID); | 2117 | child.Inventory.ChangeInventoryOwner(ownerID); |
2118 | child.TriggerScriptChangedEvent(Changed.OWNER); | ||
2119 | } | ||
2073 | } | 2120 | } |
2074 | else | 2121 | else |
2075 | { | 2122 | { |
@@ -2085,6 +2132,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2085 | { | 2132 | { |
2086 | child.LastOwnerID = child.OwnerID; | 2133 | child.LastOwnerID = child.OwnerID; |
2087 | child.Inventory.ChangeInventoryOwner(groupID); | 2134 | child.Inventory.ChangeInventoryOwner(groupID); |
2135 | child.TriggerScriptChangedEvent(Changed.OWNER); | ||
2088 | } | 2136 | } |
2089 | 2137 | ||
2090 | sog.SetOwnerId(groupID); | 2138 | sog.SetOwnerId(groupID); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1a6a70b..f0acc38 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -563,7 +563,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
563 | m_regInfo = regInfo; | 563 | m_regInfo = regInfo; |
564 | m_regionHandle = m_regInfo.RegionHandle; | 564 | m_regionHandle = m_regInfo.RegionHandle; |
565 | m_regionName = m_regInfo.RegionName; | 565 | m_regionName = m_regInfo.RegionName; |
566 | m_datastore = m_regInfo.DataStore; | ||
567 | m_lastUpdate = Util.EnvironmentTickCount(); | 566 | m_lastUpdate = Util.EnvironmentTickCount(); |
568 | 567 | ||
569 | m_physicalPrim = physicalPrim; | 568 | m_physicalPrim = physicalPrim; |
@@ -1109,7 +1108,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1109 | // | 1108 | // |
1110 | while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) | 1109 | while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) |
1111 | { | 1110 | { |
1112 | MainConsole.Instance.Output("The current estate has no owner set."); | 1111 | MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName); |
1113 | List<char> excluded = new List<char>(new char[1]{' '}); | 1112 | List<char> excluded = new List<char>(new char[1]{' '}); |
1114 | string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); | 1113 | string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); |
1115 | string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); | 1114 | string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); |
@@ -1429,20 +1428,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1429 | } | 1428 | } |
1430 | 1429 | ||
1431 | /// <summary> | 1430 | /// <summary> |
1432 | /// Recount SceneObjectPart in parcel aabb | ||
1433 | /// </summary> | ||
1434 | private void UpdateLand() | ||
1435 | { | ||
1436 | if (LandChannel != null) | ||
1437 | { | ||
1438 | if (LandChannel.IsLandPrimCountTainted()) | ||
1439 | { | ||
1440 | EventManager.TriggerParcelPrimCountUpdate(); | ||
1441 | } | ||
1442 | } | ||
1443 | } | ||
1444 | |||
1445 | /// <summary> | ||
1446 | /// Update the terrain if it needs to be updated. | 1431 | /// Update the terrain if it needs to be updated. |
1447 | /// </summary> | 1432 | /// </summary> |
1448 | private void UpdateTerrain() | 1433 | private void UpdateTerrain() |
@@ -1536,8 +1521,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1536 | } | 1521 | } |
1537 | 1522 | ||
1538 | /// <summary> | 1523 | /// <summary> |
1539 | /// Return object to avatar Message | 1524 | /// Tell an agent that their object has been returned. |
1540 | /// </summary> | 1525 | /// </summary> |
1526 | /// <remarks> | ||
1527 | /// The actual return is handled by the caller. | ||
1528 | /// </remarks> | ||
1541 | /// <param name="agentID">Avatar Unique Id</param> | 1529 | /// <param name="agentID">Avatar Unique Id</param> |
1542 | /// <param name="objectName">Name of object returned</param> | 1530 | /// <param name="objectName">Name of object returned</param> |
1543 | /// <param name="location">Location of object returned</param> | 1531 | /// <param name="location">Location of object returned</param> |
@@ -1956,8 +1944,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1956 | /// If false, it is left to the caller to schedule the update | 1944 | /// If false, it is left to the caller to schedule the update |
1957 | /// </param> | 1945 | /// </param> |
1958 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 1946 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
1959 | { | 1947 | { |
1960 | return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); | 1948 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) |
1949 | { | ||
1950 | EventManager.TriggerObjectAddedToScene(sceneObject); | ||
1951 | return true; | ||
1952 | } | ||
1953 | |||
1954 | return false; | ||
1961 | } | 1955 | } |
1962 | 1956 | ||
1963 | /// <summary> | 1957 | /// <summary> |
@@ -1974,7 +1968,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1974 | public bool AddNewSceneObject( | 1968 | public bool AddNewSceneObject( |
1975 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) | 1969 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) |
1976 | { | 1970 | { |
1977 | return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); | 1971 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) |
1972 | { | ||
1973 | EventManager.TriggerObjectAddedToScene(sceneObject); | ||
1974 | return true; | ||
1975 | } | ||
1976 | |||
1977 | return false; | ||
1978 | } | 1978 | } |
1979 | 1979 | ||
1980 | /// <summary> | 1980 | /// <summary> |
@@ -4854,8 +4854,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4854 | { | 4854 | { |
4855 | float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; | 4855 | float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; |
4856 | 4856 | ||
4857 | Vector3 vec = g.AbsolutePosition; | ||
4858 | |||
4857 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); | 4859 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); |
4858 | 4860 | ||
4861 | ominX += vec.X; | ||
4862 | omaxX += vec.X; | ||
4863 | ominY += vec.Y; | ||
4864 | omaxY += vec.Y; | ||
4865 | ominZ += vec.Z; | ||
4866 | omaxZ += vec.Z; | ||
4867 | |||
4859 | if (minX > ominX) | 4868 | if (minX > ominX) |
4860 | minX = ominX; | 4869 | minX = ominX; |
4861 | if (minY > ominY) | 4870 | if (minY > ominY) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index f343bc8..c4547f2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -136,8 +136,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
136 | get { return m_permissions; } | 136 | get { return m_permissions; } |
137 | } | 137 | } |
138 | 138 | ||
139 | protected string m_datastore; | ||
140 | |||
141 | /* Used by the loadbalancer plugin on GForge */ | 139 | /* Used by the loadbalancer plugin on GForge */ |
142 | protected RegionStatus m_regStatus; | 140 | protected RegionStatus m_regStatus; |
143 | public RegionStatus RegionStatus | 141 | public RegionStatus RegionStatus |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 734ba22..97af0a0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -88,9 +88,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
88 | protected internal object m_syncRoot = new object(); | 88 | protected internal object m_syncRoot = new object(); |
89 | 89 | ||
90 | protected internal PhysicsScene _PhyScene; | 90 | protected internal PhysicsScene _PhyScene; |
91 | 91 | ||
92 | protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>(); | 92 | /// <summary> |
93 | /// Index the SceneObjectGroup for each part by the root part's UUID. | ||
94 | /// </summary> | ||
93 | protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>(); | 95 | protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>(); |
96 | |||
97 | /// <summary> | ||
98 | /// Index the SceneObjectGroup for each part by that part's UUID. | ||
99 | /// </summary> | ||
100 | protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullPartID = new Dictionary<UUID, SceneObjectGroup>(); | ||
101 | |||
102 | /// <summary> | ||
103 | /// Index the SceneObjectGroup for each part by that part's local ID. | ||
104 | /// </summary> | ||
105 | protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>(); | ||
94 | 106 | ||
95 | private Object m_updateLock = new Object(); | 107 | private Object m_updateLock = new Object(); |
96 | 108 | ||
@@ -133,8 +145,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
133 | 145 | ||
134 | lock (SceneObjectGroupsByFullID) | 146 | lock (SceneObjectGroupsByFullID) |
135 | SceneObjectGroupsByFullID.Clear(); | 147 | SceneObjectGroupsByFullID.Clear(); |
136 | lock (SceneObjectGroupsByLocalID) | 148 | lock (SceneObjectGroupsByFullPartID) |
137 | SceneObjectGroupsByLocalID.Clear(); | 149 | SceneObjectGroupsByFullPartID.Clear(); |
150 | lock (SceneObjectGroupsByLocalPartID) | ||
151 | SceneObjectGroupsByLocalPartID.Clear(); | ||
138 | 152 | ||
139 | Entities.Clear(); | 153 | Entities.Clear(); |
140 | } | 154 | } |
@@ -349,6 +363,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
349 | 363 | ||
350 | if (Entities.ContainsKey(sceneObject.UUID)) | 364 | if (Entities.ContainsKey(sceneObject.UUID)) |
351 | return false; | 365 | return false; |
366 | |||
367 | // m_log.DebugFormat( | ||
368 | // "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", | ||
369 | // sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); | ||
352 | 370 | ||
353 | SceneObjectPart[] children = sceneObject.Parts; | 371 | SceneObjectPart[] children = sceneObject.Parts; |
354 | 372 | ||
@@ -385,17 +403,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
385 | OnObjectCreate(sceneObject); | 403 | OnObjectCreate(sceneObject); |
386 | 404 | ||
387 | lock (SceneObjectGroupsByFullID) | 405 | lock (SceneObjectGroupsByFullID) |
388 | { | ||
389 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | 406 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; |
407 | |||
408 | lock (SceneObjectGroupsByFullPartID) | ||
409 | { | ||
410 | SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject; | ||
390 | foreach (SceneObjectPart part in children) | 411 | foreach (SceneObjectPart part in children) |
391 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; | 412 | SceneObjectGroupsByFullPartID[part.UUID] = sceneObject; |
392 | } | 413 | } |
393 | 414 | ||
394 | lock (SceneObjectGroupsByLocalID) | 415 | lock (SceneObjectGroupsByLocalPartID) |
395 | { | 416 | { |
396 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | 417 | SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject; |
397 | foreach (SceneObjectPart part in children) | 418 | foreach (SceneObjectPart part in children) |
398 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; | 419 | SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject; |
399 | } | 420 | } |
400 | 421 | ||
401 | return true; | 422 | return true; |
@@ -426,21 +447,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
426 | 447 | ||
427 | if (OnObjectRemove != null) | 448 | if (OnObjectRemove != null) |
428 | OnObjectRemove(Entities[uuid]); | 449 | OnObjectRemove(Entities[uuid]); |
429 | 450 | ||
430 | lock (SceneObjectGroupsByFullID) | 451 | lock (SceneObjectGroupsByFullID) |
452 | SceneObjectGroupsByFullID.Remove(grp.UUID); | ||
453 | |||
454 | lock (SceneObjectGroupsByFullPartID) | ||
431 | { | 455 | { |
432 | SceneObjectPart[] parts = grp.Parts; | 456 | SceneObjectPart[] parts = grp.Parts; |
433 | for (int i = 0; i < parts.Length; i++) | 457 | for (int i = 0; i < parts.Length; i++) |
434 | SceneObjectGroupsByFullID.Remove(parts[i].UUID); | 458 | SceneObjectGroupsByFullPartID.Remove(parts[i].UUID); |
435 | SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); | 459 | SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID); |
436 | } | 460 | } |
437 | 461 | ||
438 | lock (SceneObjectGroupsByLocalID) | 462 | lock (SceneObjectGroupsByLocalPartID) |
439 | { | 463 | { |
440 | SceneObjectPart[] parts = grp.Parts; | 464 | SceneObjectPart[] parts = grp.Parts; |
441 | for (int i = 0; i < parts.Length; i++) | 465 | for (int i = 0; i < parts.Length; i++) |
442 | SceneObjectGroupsByLocalID.Remove(parts[i].LocalId); | 466 | SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId); |
443 | SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); | 467 | SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId); |
444 | } | 468 | } |
445 | 469 | ||
446 | return Entities.Remove(uuid); | 470 | return Entities.Remove(uuid); |
@@ -627,7 +651,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
627 | if (!Entities.Remove(agentID)) | 651 | if (!Entities.Remove(agentID)) |
628 | { | 652 | { |
629 | m_log.WarnFormat( | 653 | m_log.WarnFormat( |
630 | "[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", | 654 | "[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", |
631 | agentID); | 655 | agentID); |
632 | } | 656 | } |
633 | 657 | ||
@@ -650,7 +674,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
650 | } | 674 | } |
651 | else | 675 | else |
652 | { | 676 | { |
653 | m_log.WarnFormat("[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); | 677 | m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); |
654 | } | 678 | } |
655 | } | 679 | } |
656 | } | 680 | } |
@@ -854,14 +878,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
854 | 878 | ||
855 | //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); | 879 | //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); |
856 | SceneObjectGroup sog; | 880 | SceneObjectGroup sog; |
857 | lock (SceneObjectGroupsByLocalID) | 881 | lock (SceneObjectGroupsByLocalPartID) |
858 | SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); | 882 | SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog); |
859 | 883 | ||
860 | if (sog != null) | 884 | if (sog != null) |
861 | { | 885 | { |
862 | if (sog.HasChildPrim(localID)) | 886 | if (sog.HasChildPrim(localID)) |
863 | return sog; | 887 | return sog; |
864 | SceneObjectGroupsByLocalID.Remove(localID); | 888 | SceneObjectGroupsByLocalPartID.Remove(localID); |
865 | } | 889 | } |
866 | 890 | ||
867 | EntityBase[] entityList = GetEntities(); | 891 | EntityBase[] entityList = GetEntities(); |
@@ -873,8 +897,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
873 | sog = (SceneObjectGroup)ent; | 897 | sog = (SceneObjectGroup)ent; |
874 | if (sog.HasChildPrim(localID)) | 898 | if (sog.HasChildPrim(localID)) |
875 | { | 899 | { |
876 | lock (SceneObjectGroupsByLocalID) | 900 | lock (SceneObjectGroupsByLocalPartID) |
877 | SceneObjectGroupsByLocalID[localID] = sog; | 901 | SceneObjectGroupsByLocalPartID[localID] = sog; |
878 | return sog; | 902 | return sog; |
879 | } | 903 | } |
880 | } | 904 | } |
@@ -891,16 +915,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
891 | private SceneObjectGroup GetGroupByPrim(UUID fullID) | 915 | private SceneObjectGroup GetGroupByPrim(UUID fullID) |
892 | { | 916 | { |
893 | SceneObjectGroup sog; | 917 | SceneObjectGroup sog; |
894 | lock (SceneObjectGroupsByFullID) | 918 | lock (SceneObjectGroupsByFullPartID) |
895 | SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); | 919 | SceneObjectGroupsByFullPartID.TryGetValue(fullID, out sog); |
896 | 920 | ||
897 | if (sog != null) | 921 | if (sog != null) |
898 | { | 922 | { |
899 | if (sog.ContainsPart(fullID)) | 923 | if (sog.ContainsPart(fullID)) |
900 | return sog; | 924 | return sog; |
901 | 925 | ||
902 | lock (SceneObjectGroupsByFullID) | 926 | lock (SceneObjectGroupsByFullPartID) |
903 | SceneObjectGroupsByFullID.Remove(fullID); | 927 | SceneObjectGroupsByFullPartID.Remove(fullID); |
904 | } | 928 | } |
905 | 929 | ||
906 | EntityBase[] entityList = GetEntities(); | 930 | EntityBase[] entityList = GetEntities(); |
@@ -911,8 +935,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
911 | sog = (SceneObjectGroup)ent; | 935 | sog = (SceneObjectGroup)ent; |
912 | if (sog.HasChildPrim(fullID)) | 936 | if (sog.HasChildPrim(fullID)) |
913 | { | 937 | { |
914 | lock (SceneObjectGroupsByFullID) | 938 | lock (SceneObjectGroupsByFullPartID) |
915 | SceneObjectGroupsByFullID[fullID] = sog; | 939 | SceneObjectGroupsByFullPartID[fullID] = sog; |
916 | return sog; | 940 | return sog; |
917 | } | 941 | } |
918 | } | 942 | } |
@@ -1064,11 +1088,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1064 | } | 1088 | } |
1065 | 1089 | ||
1066 | /// <summary> | 1090 | /// <summary> |
1067 | /// Performs action on all scene object groups. | 1091 | /// Performs action once on all scene object groups. |
1068 | /// </summary> | 1092 | /// </summary> |
1069 | /// <param name="action"></param> | 1093 | /// <param name="action"></param> |
1070 | protected internal void ForEachSOG(Action<SceneObjectGroup> action) | 1094 | protected internal void ForEachSOG(Action<SceneObjectGroup> action) |
1071 | { | 1095 | { |
1096 | // FIXME: Need to lock here, really. | ||
1072 | List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); | 1097 | List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); |
1073 | foreach (SceneObjectGroup obj in objlist) | 1098 | foreach (SceneObjectGroup obj in objlist) |
1074 | { | 1099 | { |
@@ -1079,11 +1104,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1079 | catch (Exception e) | 1104 | catch (Exception e) |
1080 | { | 1105 | { |
1081 | // Catch it and move on. This includes situations where splist has inconsistent info | 1106 | // Catch it and move on. This includes situations where splist has inconsistent info |
1082 | m_log.WarnFormat("[SCENE]: Problem processing action in ForEachSOG: ", e.ToString()); | 1107 | m_log.WarnFormat( |
1108 | "[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace); | ||
1083 | } | 1109 | } |
1084 | } | 1110 | } |
1085 | } | 1111 | } |
1086 | |||
1087 | 1112 | ||
1088 | /// <summary> | 1113 | /// <summary> |
1089 | /// Performs action on all scene presences. This can ultimately run the actions in parallel but | 1114 | /// Performs action on all scene presences. This can ultimately run the actions in parallel but |
@@ -1103,8 +1128,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1103 | } | 1128 | } |
1104 | catch (Exception e) | 1129 | catch (Exception e) |
1105 | { | 1130 | { |
1106 | m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); | 1131 | m_log.Info("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); |
1107 | m_log.Info("[BUG] Stack Trace: " + e.StackTrace); | 1132 | m_log.Info("[SCENEGRAPH]: Stack Trace: " + e.StackTrace); |
1108 | } | 1133 | } |
1109 | }); | 1134 | }); |
1110 | Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction); | 1135 | Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction); |
@@ -1119,7 +1144,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1119 | } | 1144 | } |
1120 | catch (Exception e) | 1145 | catch (Exception e) |
1121 | { | 1146 | { |
1122 | m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); | 1147 | m_log.Error("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); |
1123 | } | 1148 | } |
1124 | } | 1149 | } |
1125 | } | 1150 | } |
@@ -1777,7 +1802,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1777 | /// <param name="rot"></param> | 1802 | /// <param name="rot"></param> |
1778 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) | 1803 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) |
1779 | { | 1804 | { |
1780 | //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); | 1805 | // m_log.DebugFormat( |
1806 | // "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", | ||
1807 | // originalPrimID, offset, AgentID); | ||
1808 | |||
1781 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); | 1809 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); |
1782 | if (original != null) | 1810 | if (original != null) |
1783 | { | 1811 | { |
@@ -1808,7 +1836,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1808 | copy.RootPart.SalePrice = 10; | 1836 | copy.RootPart.SalePrice = 10; |
1809 | } | 1837 | } |
1810 | 1838 | ||
1839 | // FIXME: This section needs to be refactored so that it just calls AddSceneObject() | ||
1811 | Entities.Add(copy); | 1840 | Entities.Add(copy); |
1841 | |||
1842 | lock (SceneObjectGroupsByFullID) | ||
1843 | SceneObjectGroupsByFullID[copy.UUID] = copy; | ||
1844 | |||
1845 | SceneObjectPart[] children = copy.Parts; | ||
1846 | |||
1847 | lock (SceneObjectGroupsByFullPartID) | ||
1848 | { | ||
1849 | SceneObjectGroupsByFullPartID[copy.UUID] = copy; | ||
1850 | foreach (SceneObjectPart part in children) | ||
1851 | SceneObjectGroupsByFullPartID[part.UUID] = copy; | ||
1852 | } | ||
1853 | |||
1854 | lock (SceneObjectGroupsByLocalPartID) | ||
1855 | { | ||
1856 | SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; | ||
1857 | foreach (SceneObjectPart part in children) | ||
1858 | SceneObjectGroupsByLocalPartID[part.LocalId] = copy; | ||
1859 | } | ||
1860 | // PROBABLE END OF FIXME | ||
1812 | 1861 | ||
1813 | // Since we copy from a source group that is in selected | 1862 | // Since we copy from a source group that is in selected |
1814 | // state, but the copy is shown deselected in the viewer, | 1863 | // state, but the copy is shown deselected in the viewer, |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f17fb28..ca7d9d9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -325,6 +325,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
325 | //m_rootPart.GroupPosition.Z); | 325 | //m_rootPart.GroupPosition.Z); |
326 | //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | 326 | //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); |
327 | //} | 327 | //} |
328 | |||
329 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | ||
328 | } | 330 | } |
329 | } | 331 | } |
330 | 332 | ||
@@ -1313,8 +1315,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1313 | parcel.LandData.OtherCleanTime) | 1315 | parcel.LandData.OtherCleanTime) |
1314 | { | 1316 | { |
1315 | DetachFromBackup(); | 1317 | DetachFromBackup(); |
1316 | m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); | 1318 | m_log.DebugFormat( |
1317 | m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return"); | 1319 | "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn", |
1320 | RootPart.UUID); | ||
1321 | m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel autoreturn"); | ||
1318 | m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, | 1322 | m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, |
1319 | DeRezAction.Return, UUID.Zero); | 1323 | DeRezAction.Return, UUID.Zero); |
1320 | 1324 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index fa404c0..3281eab 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -175,12 +175,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
175 | foreach (TaskInventoryItem item in items) | 175 | foreach (TaskInventoryItem item in items) |
176 | { | 176 | { |
177 | if (ownerId != item.OwnerID) | 177 | if (ownerId != item.OwnerID) |
178 | { | ||
179 | item.LastOwnerID = item.OwnerID; | 178 | item.LastOwnerID = item.OwnerID; |
180 | item.OwnerID = ownerId; | 179 | |
181 | item.PermsMask = 0; | 180 | item.OwnerID = ownerId; |
182 | item.PermsGranter = UUID.Zero; | 181 | item.PermsMask = 0; |
183 | } | 182 | item.PermsGranter = UUID.Zero; |
183 | item.OwnerChanged = true; | ||
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 49382f0..821cd4b 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -1247,7 +1247,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
1247 | 1247 | ||
1248 | } | 1248 | } |
1249 | 1249 | ||
1250 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 1250 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) |
1251 | { | 1251 | { |
1252 | 1252 | ||
1253 | } | 1253 | } |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs index 2fcc477..0d6313a 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs | |||
@@ -80,16 +80,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge | |||
80 | m_config = config.Configs["Concierge"]; | 80 | m_config = config.Configs["Concierge"]; |
81 | 81 | ||
82 | if (null == m_config) | 82 | if (null == m_config) |
83 | { | ||
84 | m_log.Info("[Concierge]: no config found, plugin disabled"); | ||
85 | return; | 83 | return; |
86 | } | ||
87 | 84 | ||
88 | if (!m_config.GetBoolean("enabled", false)) | 85 | if (!m_config.GetBoolean("enabled", false)) |
89 | { | ||
90 | m_log.Info("[Concierge]: plugin disabled by configuration"); | ||
91 | return; | 86 | return; |
92 | } | 87 | |
93 | m_enabled = true; | 88 | m_enabled = true; |
94 | 89 | ||
95 | 90 | ||
@@ -113,9 +108,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge | |||
113 | { | 108 | { |
114 | m_replacingChatModule = false; | 109 | m_replacingChatModule = false; |
115 | } | 110 | } |
111 | |||
116 | m_log.InfoFormat("[Concierge] {0} ChatModule", m_replacingChatModule ? "replacing" : "not replacing"); | 112 | m_log.InfoFormat("[Concierge] {0} ChatModule", m_replacingChatModule ? "replacing" : "not replacing"); |
117 | 113 | ||
118 | |||
119 | // take note of concierge channel and of identity | 114 | // take note of concierge channel and of identity |
120 | m_conciergeChannel = config.Configs["Concierge"].GetInt("concierge_channel", m_conciergeChannel); | 115 | m_conciergeChannel = config.Configs["Concierge"].GetInt("concierge_channel", m_conciergeChannel); |
121 | m_whoami = m_config.GetString("whoami", "conferencier"); | 116 | m_whoami = m_config.GetString("whoami", "conferencier"); |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 05a1c3b..7909d8a 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | |||
@@ -106,16 +106,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
106 | m_Config = config.Configs["FreeSwitchVoice"]; | 106 | m_Config = config.Configs["FreeSwitchVoice"]; |
107 | 107 | ||
108 | if (m_Config == null) | 108 | if (m_Config == null) |
109 | { | ||
110 | m_log.Info("[FreeSwitchVoice] no config found, plugin disabled"); | ||
111 | return; | 109 | return; |
112 | } | ||
113 | 110 | ||
114 | if (!m_Config.GetBoolean("Enabled", false)) | 111 | if (!m_Config.GetBoolean("Enabled", false)) |
115 | { | ||
116 | m_log.Info("[FreeSwitchVoice] plugin disabled by configuration"); | ||
117 | return; | 112 | return; |
118 | } | ||
119 | 113 | ||
120 | try | 114 | try |
121 | { | 115 | { |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index 34d0e24..534bf92 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | |||
@@ -121,16 +121,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
121 | m_config = config.Configs["VivoxVoice"]; | 121 | m_config = config.Configs["VivoxVoice"]; |
122 | 122 | ||
123 | if (null == m_config) | 123 | if (null == m_config) |
124 | { | ||
125 | m_log.Info("[VivoxVoice] no config found, plugin disabled"); | ||
126 | return; | 124 | return; |
127 | } | ||
128 | 125 | ||
129 | if (!m_config.GetBoolean("enabled", false)) | 126 | if (!m_config.GetBoolean("enabled", false)) |
130 | { | ||
131 | m_log.Info("[VivoxVoice] plugin disabled by configuration"); | ||
132 | return; | 127 | return; |
133 | } | ||
134 | 128 | ||
135 | try | 129 | try |
136 | { | 130 | { |
@@ -218,7 +212,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
218 | m_pluginEnabled = true; | 212 | m_pluginEnabled = true; |
219 | 213 | ||
220 | m_log.Info("[VivoxVoice] plugin enabled"); | 214 | m_log.Info("[VivoxVoice] plugin enabled"); |
221 | |||
222 | } | 215 | } |
223 | catch (Exception e) | 216 | catch (Exception e) |
224 | { | 217 | { |
@@ -228,7 +221,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
228 | } | 221 | } |
229 | } | 222 | } |
230 | 223 | ||
231 | |||
232 | // Called to indicate that the module has been added to the region | 224 | // Called to indicate that the module has been added to the region |
233 | public void AddRegion(Scene scene) | 225 | public void AddRegion(Scene scene) |
234 | { | 226 | { |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 3d34441..8c01d75 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | |||
@@ -86,13 +86,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
86 | return; | 86 | return; |
87 | } | 87 | } |
88 | 88 | ||
89 | m_log.Info("[GROUPS-MESSAGING]: Initializing GroupsMessagingModule"); | ||
90 | |||
91 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); | 89 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); |
92 | } | 90 | } |
93 | 91 | ||
94 | m_log.Info("[GROUPS-MESSAGING]: GroupsMessagingModule starting up"); | 92 | m_log.Info("[GROUPS-MESSAGING]: GroupsMessagingModule starting up"); |
95 | |||
96 | } | 93 | } |
97 | 94 | ||
98 | public void AddRegion(Scene scene) | 95 | public void AddRegion(Scene scene) |
diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs index 781fe95..dddea3e 100644 --- a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs +++ b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs | |||
@@ -33,6 +33,9 @@ using Nini.Config; | |||
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | 35 | ||
36 | [assembly: Addin("BareBonesSharedModule", "0.1")] | ||
37 | [assembly: AddinDependency("OpenSim", "0.5")] | ||
38 | |||
36 | namespace OpenSim.Region.OptionalModules.Example.BareBonesShared | 39 | namespace OpenSim.Region.OptionalModules.Example.BareBonesShared |
37 | { | 40 | { |
38 | /// <summary> | 41 | /// <summary> |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs index 8df020f..c898da6 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenSim.Framework; | ||
28 | using OpenSim.Region.Framework.Interfaces; | 29 | using OpenSim.Region.Framework.Interfaces; |
29 | using OpenSim.Region.Framework.Scenes; | 30 | using OpenSim.Region.Framework.Scenes; |
30 | 31 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index df60709..74f5208 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | |||
@@ -75,7 +75,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
75 | 75 | ||
76 | if (source.Configs["MRM"].GetBoolean("Enabled", false)) | 76 | if (source.Configs["MRM"].GetBoolean("Enabled", false)) |
77 | { | 77 | { |
78 | m_log.Info("[MRM] Enabling MRM Module"); | 78 | m_log.Info("[MRM]: Enabling MRM Module"); |
79 | m_scene = scene; | 79 | m_scene = scene; |
80 | 80 | ||
81 | // when hidden, we don't listen for client initiated script events | 81 | // when hidden, we don't listen for client initiated script events |
@@ -90,14 +90,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
90 | 90 | ||
91 | scene.RegisterModuleInterface<IMRMModule>(this); | 91 | scene.RegisterModuleInterface<IMRMModule>(this); |
92 | } | 92 | } |
93 | else | ||
94 | { | ||
95 | m_log.Info("[MRM] Disabled MRM Module (Disabled in ini)"); | ||
96 | } | ||
97 | } | ||
98 | else | ||
99 | { | ||
100 | m_log.Info("[MRM] Disabled MRM Module (Default disabled)"); | ||
101 | } | 93 | } |
102 | } | 94 | } |
103 | 95 | ||
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 5d44aa1..96760a2 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -925,7 +925,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
925 | { | 925 | { |
926 | } | 926 | } |
927 | 927 | ||
928 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 928 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) |
929 | { | 929 | { |
930 | } | 930 | } |
931 | public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) | 931 | public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) |
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs index 98e5453..a133e51 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs | |||
@@ -130,11 +130,6 @@ public class RegionCombinerLargeLandChannel : ILandChannel | |||
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | public bool IsLandPrimCountTainted() | ||
134 | { | ||
135 | return RootRegionLandChannel.IsLandPrimCountTainted(); | ||
136 | } | ||
137 | |||
138 | public bool IsForcefulBansAllowed() | 133 | public bool IsForcefulBansAllowed() |
139 | { | 134 | { |
140 | return RootRegionLandChannel.IsForcefulBansAllowed(); | 135 | return RootRegionLandChannel.IsForcefulBansAllowed(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 72ee495..aa28fa0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -81,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
81 | /// </summary> | 81 | /// </summary> |
82 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi | 82 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi |
83 | { | 83 | { |
84 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 84 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
85 | protected IScriptEngine m_ScriptEngine; | 85 | protected IScriptEngine m_ScriptEngine; |
86 | protected SceneObjectPart m_host; | 86 | protected SceneObjectPart m_host; |
87 | protected uint m_localID; | 87 | protected uint m_localID; |
@@ -9835,63 +9835,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9835 | public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) | 9835 | public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) |
9836 | { | 9836 | { |
9837 | m_host.AddScriptLPS(1); | 9837 | m_host.AddScriptLPS(1); |
9838 | |||
9839 | ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); | ||
9838 | 9840 | ||
9839 | LandData land = World.GetLandData((float)pos.x, (float)pos.y); | 9841 | if (lo == null) |
9840 | |||
9841 | if (land == null) | ||
9842 | { | ||
9843 | return 0; | 9842 | return 0; |
9844 | } | 9843 | |
9844 | IPrimCounts pc = lo.PrimCounts; | ||
9845 | 9845 | ||
9846 | else | 9846 | if (sim_wide != ScriptBaseClass.FALSE) |
9847 | { | 9847 | { |
9848 | if (sim_wide != 0) | 9848 | if (category == ScriptBaseClass.PARCEL_COUNT_TOTAL) |
9849 | { | 9849 | { |
9850 | if (category == 0) | 9850 | return pc.Simulator; |
9851 | { | ||
9852 | return land.SimwidePrims; | ||
9853 | } | ||
9854 | |||
9855 | else | ||
9856 | { | ||
9857 | //public int simwideArea = 0; | ||
9858 | return 0; | ||
9859 | } | ||
9860 | } | 9851 | } |
9861 | |||
9862 | else | 9852 | else |
9863 | { | 9853 | { |
9864 | if (category == 0)//Total Prims | 9854 | // counts not implemented yet |
9865 | { | 9855 | return 0; |
9866 | return 0;//land. | ||
9867 | } | ||
9868 | |||
9869 | else if (category == 1)//Owner Prims | ||
9870 | { | ||
9871 | return land.OwnerPrims; | ||
9872 | } | ||
9873 | |||
9874 | else if (category == 2)//Group Prims | ||
9875 | { | ||
9876 | return land.GroupPrims; | ||
9877 | } | ||
9878 | |||
9879 | else if (category == 3)//Other Prims | ||
9880 | { | ||
9881 | return land.OtherPrims; | ||
9882 | } | ||
9883 | |||
9884 | else if (category == 4)//Selected | ||
9885 | { | ||
9886 | return land.SelectedPrims; | ||
9887 | } | ||
9888 | |||
9889 | else if (category == 5)//Temp | ||
9890 | { | ||
9891 | return 0;//land. | ||
9892 | } | ||
9893 | } | 9856 | } |
9894 | } | 9857 | } |
9858 | else | ||
9859 | { | ||
9860 | if (category == ScriptBaseClass.PARCEL_COUNT_TOTAL) | ||
9861 | return pc.Total; | ||
9862 | else if (category == ScriptBaseClass.PARCEL_COUNT_OWNER) | ||
9863 | return pc.Owner; | ||
9864 | else if (category == ScriptBaseClass.PARCEL_COUNT_GROUP) | ||
9865 | return pc.Group; | ||
9866 | else if (category == ScriptBaseClass.PARCEL_COUNT_OTHER) | ||
9867 | return pc.Others; | ||
9868 | else if (category == ScriptBaseClass.PARCEL_COUNT_SELECTED) | ||
9869 | return pc.Selected; | ||
9870 | else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP) | ||
9871 | return 0; // counts not implemented yet | ||
9872 | } | ||
9873 | |||
9895 | return 0; | 9874 | return 0; |
9896 | } | 9875 | } |
9897 | 9876 | ||
@@ -10278,6 +10257,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10278 | 10257 | ||
10279 | return GetLinkPrimitiveParams(obj, rules); | 10258 | return GetLinkPrimitiveParams(obj, rules); |
10280 | } | 10259 | } |
10260 | |||
10261 | public void print(string str) | ||
10262 | { | ||
10263 | // yes, this is a real LSL function. See: http://wiki.secondlife.com/wiki/Print | ||
10264 | IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_itemID, "OSSL"); | ||
10265 | if (ossl != null) | ||
10266 | { | ||
10267 | ossl.CheckThreatLevel(ThreatLevel.High, "print"); | ||
10268 | m_log.Info("LSL print():" + str); | ||
10269 | } | ||
10270 | } | ||
10271 | |||
10272 | private string Name2Username(string name) | ||
10273 | { | ||
10274 | string[] parts = name.Split(new char[] {' '}); | ||
10275 | if (parts.Length < 2) | ||
10276 | return name.ToLower(); | ||
10277 | if (parts[1] == "Resident") | ||
10278 | return parts[0].ToLower(); | ||
10279 | |||
10280 | return name.Replace(" ", ".").ToLower(); | ||
10281 | } | ||
10282 | |||
10283 | public LSL_String llGetUsername(string id) | ||
10284 | { | ||
10285 | return Name2Username(llKey2Name(id)); | ||
10286 | } | ||
10287 | |||
10288 | public LSL_String llRequestUsername(string id) | ||
10289 | { | ||
10290 | UUID rq = UUID.Random(); | ||
10291 | |||
10292 | AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); | ||
10293 | |||
10294 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); | ||
10295 | |||
10296 | return rq.ToString(); | ||
10297 | } | ||
10298 | |||
10299 | public LSL_String llGetDisplayName(string id) | ||
10300 | { | ||
10301 | return llKey2Name(id); | ||
10302 | } | ||
10303 | |||
10304 | public LSL_String llRequestDisplayName(string id) | ||
10305 | { | ||
10306 | UUID rq = UUID.Random(); | ||
10307 | |||
10308 | AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); | ||
10309 | |||
10310 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); | ||
10311 | |||
10312 | return rq.ToString(); | ||
10313 | } | ||
10281 | } | 10314 | } |
10282 | 10315 | ||
10283 | public class NotecardCache | 10316 | public class NotecardCache |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index fefbb35..47c7915 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -50,6 +50,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
50 | private Object SenseLock = new Object(); | 50 | private Object SenseLock = new Object(); |
51 | 51 | ||
52 | private const int AGENT = 1; | 52 | private const int AGENT = 1; |
53 | private const int AGENT_BY_USERNAME = 0x10; | ||
53 | private const int ACTIVE = 2; | 54 | private const int ACTIVE = 2; |
54 | private const int PASSIVE = 4; | 55 | private const int PASSIVE = 4; |
55 | private const int SCRIPTED = 8; | 56 | private const int SCRIPTED = 8; |
@@ -202,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
202 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); | 203 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); |
203 | 204 | ||
204 | // Is the sensor type is AGENT and not SCRIPTED then include agents | 205 | // Is the sensor type is AGENT and not SCRIPTED then include agents |
205 | if ((ts.type & AGENT) != 0 && (ts.type & SCRIPTED) == 0) | 206 | if ((ts.type & (AGENT | AGENT_BY_USERNAME)) != 0 && (ts.type & SCRIPTED) == 0) |
206 | { | 207 | { |
207 | sensedEntities.AddRange(doAgentSensor(ts)); | 208 | sensedEntities.AddRange(doAgentSensor(ts)); |
208 | } | 209 | } |
@@ -493,9 +494,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
493 | { | 494 | { |
494 | ScenePresence sp; | 495 | ScenePresence sp; |
495 | // Try lookup by name will return if/when found | 496 | // Try lookup by name will return if/when found |
496 | if (!m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp)) | 497 | if (((ts.type & AGENT) != 0) && m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp)) |
497 | return sensedEntities; | 498 | senseEntity(sp); |
498 | senseEntity(sp); | 499 | if ((ts.type & AGENT_BY_USERNAME) != 0) |
500 | { | ||
501 | m_CmdManager.m_ScriptEngine.World.ForEachScenePresence( | ||
502 | delegate (ScenePresence ssp) | ||
503 | { | ||
504 | if (ssp.Lastname == "Resident") | ||
505 | { | ||
506 | if (ssp.Firstname.ToLower() == ts.name) | ||
507 | senseEntity(ssp); | ||
508 | return; | ||
509 | } | ||
510 | if (ssp.Name.Replace(" ", ".").ToLower() == ts.name) | ||
511 | senseEntity(ssp); | ||
512 | } | ||
513 | ); | ||
514 | } | ||
515 | |||
516 | return sensedEntities; | ||
499 | } | 517 | } |
500 | else | 518 | else |
501 | { | 519 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 561e3b3..654ea81 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -209,6 +209,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
209 | void llInstantMessage(string user, string message); | 209 | void llInstantMessage(string user, string message); |
210 | LSL_String llIntegerToBase64(int number); | 210 | LSL_String llIntegerToBase64(int number); |
211 | LSL_String llKey2Name(string id); | 211 | LSL_String llKey2Name(string id); |
212 | LSL_String llGetUsername(string id); | ||
213 | LSL_String llRequestUsername(string id); | ||
214 | LSL_String llGetDisplayName(string id); | ||
215 | LSL_String llRequestDisplayName(string id); | ||
212 | void llLinkParticleSystem(int linknum, LSL_List rules); | 216 | void llLinkParticleSystem(int linknum, LSL_List rules); |
213 | LSL_String llList2CSV(LSL_List src); | 217 | LSL_String llList2CSV(LSL_List src); |
214 | LSL_Float llList2Float(LSL_List src, int index); | 218 | LSL_Float llList2Float(LSL_List src, int index); |
@@ -398,6 +402,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
398 | LSL_Vector llWind(LSL_Vector offset); | 402 | LSL_Vector llWind(LSL_Vector offset); |
399 | LSL_String llXorBase64Strings(string str1, string str2); | 403 | LSL_String llXorBase64Strings(string str1, string str2); |
400 | LSL_String llXorBase64StringsCorrect(string str1, string str2); | 404 | LSL_String llXorBase64StringsCorrect(string str1, string str2); |
405 | void print(string str); | ||
401 | 406 | ||
402 | void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); | 407 | void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); |
403 | LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); | 408 | LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index b3c4d95..9377cda 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -50,6 +50,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
50 | public const int STATUS_CAST_SHADOWS = 512; | 50 | public const int STATUS_CAST_SHADOWS = 512; |
51 | 51 | ||
52 | public const int AGENT = 1; | 52 | public const int AGENT = 1; |
53 | public const int AGENT_BY_LEGACY_NAME = 1; | ||
54 | public const int AGENT_BY_USERNAME = 0x10; | ||
53 | public const int ACTIVE = 2; | 55 | public const int ACTIVE = 2; |
54 | public const int PASSIVE = 4; | 56 | public const int PASSIVE = 4; |
55 | public const int SCRIPTED = 8; | 57 | public const int SCRIPTED = 8; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 451163f..303d75e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -894,6 +894,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
894 | return m_LSL_Functions.llKey2Name(id); | 894 | return m_LSL_Functions.llKey2Name(id); |
895 | } | 895 | } |
896 | 896 | ||
897 | public LSL_String llGetUsername(string id) | ||
898 | { | ||
899 | return m_LSL_Functions.llGetUsername(id); | ||
900 | } | ||
901 | |||
902 | public LSL_String llRequestUsername(string id) | ||
903 | { | ||
904 | return m_LSL_Functions.llRequestUsername(id); | ||
905 | } | ||
906 | |||
907 | public LSL_String llGetDisplayName(string id) | ||
908 | { | ||
909 | return m_LSL_Functions.llGetDisplayName(id); | ||
910 | } | ||
911 | |||
912 | public LSL_String llRequestDisplayName(string id) | ||
913 | { | ||
914 | return m_LSL_Functions.llRequestDisplayName(id); | ||
915 | } | ||
916 | |||
897 | public void llLinkParticleSystem(int linknum, LSL_List rules) | 917 | public void llLinkParticleSystem(int linknum, LSL_List rules) |
898 | { | 918 | { |
899 | m_LSL_Functions.llLinkParticleSystem(linknum, rules); | 919 | m_LSL_Functions.llLinkParticleSystem(linknum, rules); |
@@ -1847,5 +1867,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1847 | { | 1867 | { |
1848 | return m_LSL_Functions.llClearPrimMedia(face); | 1868 | return m_LSL_Functions.llClearPrimMedia(face); |
1849 | } | 1869 | } |
1870 | |||
1871 | public void print(string str) | ||
1872 | { | ||
1873 | m_LSL_Functions.print(str); | ||
1874 | } | ||
1850 | } | 1875 | } |
1851 | } | 1876 | } |
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 48f5f99..8048f86 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | |||
@@ -74,12 +74,23 @@ namespace OpenSim.Server.Handlers.Login | |||
74 | if (requestData != null) | 74 | if (requestData != null) |
75 | { | 75 | { |
76 | if (requestData.ContainsKey("first") && requestData["first"] != null && | 76 | if (requestData.ContainsKey("first") && requestData["first"] != null && |
77 | requestData.ContainsKey("last") && requestData["last"] != null && | 77 | requestData.ContainsKey("last") && requestData["last"] != null && ( |
78 | requestData.ContainsKey("passwd") && requestData["passwd"] != null) | 78 | (requestData.ContainsKey("passwd") && requestData["passwd"] != null) || |
79 | (!requestData.ContainsKey("passwd") && requestData.ContainsKey("web_login_key") && requestData["web_login_key"] != null && requestData["web_login_key"].ToString() != UUID.Zero.ToString()) | ||
80 | )) | ||
79 | { | 81 | { |
80 | string first = requestData["first"].ToString(); | 82 | string first = requestData["first"].ToString(); |
81 | string last = requestData["last"].ToString(); | 83 | string last = requestData["last"].ToString(); |
82 | string passwd = requestData["passwd"].ToString(); | 84 | string passwd = null; |
85 | if (requestData.ContainsKey("passwd")) | ||
86 | { | ||
87 | passwd = requestData["passwd"].ToString(); | ||
88 | } | ||
89 | else if (requestData.ContainsKey("web_login_key")) | ||
90 | { | ||
91 | passwd = "$1$" + requestData["web_login_key"].ToString(); | ||
92 | m_log.InfoFormat("[LOGIN]: XMLRPC Login Req key {0}", passwd); | ||
93 | } | ||
83 | string startLocation = string.Empty; | 94 | string startLocation = string.Empty; |
84 | UUID scopeID = UUID.Zero; | 95 | UUID scopeID = UUID.Zero; |
85 | if (requestData["scope_id"] != null) | 96 | if (requestData["scope_id"] != null) |
@@ -103,7 +114,7 @@ namespace OpenSim.Server.Handlers.Login | |||
103 | string id0 = "Unknown"; | 114 | string id0 = "Unknown"; |
104 | if (requestData.Contains("id0") && requestData["id0"] != null) | 115 | if (requestData.Contains("id0") && requestData["id0"] != null) |
105 | id0 = requestData["id0"].ToString(); | 116 | id0 = requestData["id0"].ToString(); |
106 | 117 | ||
107 | //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); | 118 | //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); |
108 | 119 | ||
109 | LoginResponse reply = null; | 120 | LoginResponse reply = null; |
diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index d1a5b0f..2344c0e 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs | |||
@@ -31,6 +31,9 @@ using OpenSim.Services.Interfaces; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using OpenSim.Data; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Console; | ||
34 | 37 | ||
35 | namespace OpenSim.Services.AuthenticationService | 38 | namespace OpenSim.Services.AuthenticationService |
36 | { | 39 | { |
@@ -43,17 +46,45 @@ namespace OpenSim.Services.AuthenticationService | |||
43 | public class WebkeyAuthenticationService : | 46 | public class WebkeyAuthenticationService : |
44 | AuthenticationServiceBase, IAuthenticationService | 47 | AuthenticationServiceBase, IAuthenticationService |
45 | { | 48 | { |
46 | // private static readonly ILog m_log = | 49 | private static readonly ILog m_log = |
47 | // LogManager.GetLogger( | 50 | LogManager.GetLogger( |
48 | // MethodBase.GetCurrentMethod().DeclaringType); | 51 | MethodBase.GetCurrentMethod().DeclaringType); |
49 | 52 | ||
50 | public WebkeyAuthenticationService(IConfigSource config) : | 53 | public WebkeyAuthenticationService(IConfigSource config) : |
51 | base(config) | 54 | base(config) |
52 | { | 55 | { |
53 | } | 56 | } |
54 | 57 | ||
55 | public string Authenticate(UUID principalID, string password, int lifetime) | 58 | public string Authenticate(UUID principalID, string password, int lifetime) |
56 | { | 59 | { |
60 | if (new UUID(password) == UUID.Zero) | ||
61 | { | ||
62 | m_log.DebugFormat("[AUTH SERVICE]: UUID.Zero is not a valid web_login_key on PrincipalID {0}", principalID); | ||
63 | } | ||
64 | else | ||
65 | { | ||
66 | AuthenticationData data = m_Database.Get(principalID); | ||
67 | if (data != null && data.Data != null) | ||
68 | { | ||
69 | if (data.Data.ContainsKey("webLoginKey")) | ||
70 | { | ||
71 | string key = data.Data["webLoginKey"].ToString(); | ||
72 | if (key == password) | ||
73 | { | ||
74 | data.Data["webLoginKey"] = UUID.Zero.ToString(); | ||
75 | m_Database.Store(data); | ||
76 | return GetToken(principalID, lifetime); | ||
77 | } | ||
78 | else | ||
79 | { | ||
80 | m_log.DebugFormat("[AUTH SERVICE]: web login auth failed, got PrincipalID {0} gave {1} instead of {2}", principalID, password, key); | ||
81 | } | ||
82 | }else{ | ||
83 | m_log.DebugFormat("[AUTH SERVICE]: no col webLoginKey in passwd.db"); | ||
84 | } | ||
85 | } | ||
86 | m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); | ||
87 | } | ||
57 | return String.Empty; | 88 | return String.Empty; |
58 | } | 89 | } |
59 | } | 90 | } |
diff --git a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs new file mode 100644 index 0000000..3590e12 --- /dev/null +++ b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Services.Interfaces; | ||
32 | using log4net; | ||
33 | using Nini.Config; | ||
34 | using System.Reflection; | ||
35 | using OpenSim.Data; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Console; | ||
38 | using OpenSim.Server.Base; | ||
39 | |||
40 | namespace OpenSim.Services.AuthenticationService | ||
41 | { | ||
42 | public class WebkeyOrPasswordAuthenticationService : AuthenticationServiceBase, IAuthenticationService | ||
43 | { | ||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | private IConfigSource m_config; | ||
47 | private Dictionary<string, IAuthenticationService> m_svcChecks | ||
48 | = new Dictionary<string, IAuthenticationService>(); | ||
49 | |||
50 | public WebkeyOrPasswordAuthenticationService(IConfigSource config) | ||
51 | : base(config) | ||
52 | { | ||
53 | this.m_config = config; | ||
54 | m_svcChecks["web_login_key"] = new WebkeyAuthenticationService(config); | ||
55 | m_svcChecks["password"] = new PasswordAuthenticationService(config); | ||
56 | } | ||
57 | |||
58 | public string Authenticate(UUID principalID, string password, int lifetime) | ||
59 | { | ||
60 | AuthenticationData data = m_Database.Get(principalID); | ||
61 | string result = String.Empty; | ||
62 | if (data != null && data.Data != null) | ||
63 | { | ||
64 | if (data.Data.ContainsKey("webLoginKey")) | ||
65 | { | ||
66 | m_log.DebugFormat("[AUTH SERVICE]: Attempting web key authentication for PrincipalID {0}", principalID); | ||
67 | result = m_svcChecks["web_login_key"].Authenticate(principalID, password, lifetime); | ||
68 | if (result == String.Empty) | ||
69 | { | ||
70 | m_log.DebugFormat("[AUTH SERVICE]: Web Login failed for PrincipalID {0}", principalID); | ||
71 | } | ||
72 | } | ||
73 | if (result == string.Empty && data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt")) | ||
74 | { | ||
75 | m_log.DebugFormat("[AUTH SERVICE]: Attempting password authentication for PrincipalID {0}", principalID); | ||
76 | result = m_svcChecks["password"].Authenticate(principalID, password, lifetime); | ||
77 | if (result == String.Empty) | ||
78 | { | ||
79 | m_log.DebugFormat("[AUTH SERVICE]: Password login failed for PrincipalID {0}", principalID); | ||
80 | } | ||
81 | } | ||
82 | if (result == string.Empty) | ||
83 | { | ||
84 | m_log.DebugFormat("[AUTH SERVICE]: Both password and webLoginKey-based authentication failed for PrincipalID {0}", principalID); | ||
85 | } | ||
86 | } | ||
87 | else | ||
88 | { | ||
89 | m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); | ||
90 | } | ||
91 | return result; | ||
92 | } | ||
93 | } | ||
94 | } \ No newline at end of file | ||
diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs index b6df5a2..7184ba1 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,16 @@ 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 | } | ||
113 | |||
114 | public List<int> GetEstatesByOwner(UUID ownerID) | ||
115 | { | ||
116 | return m_database.GetEstatesByOwner(ownerID); | ||
117 | } | ||
103 | 118 | ||
104 | public bool LinkRegion(UUID regionID, int estateID) | 119 | public bool LinkRegion(UUID regionID, int estateID) |
105 | { | 120 | { |
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 12ea453..c539047 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -65,6 +65,8 @@ namespace OpenSim.Services.GridService | |||
65 | protected UUID m_ScopeID = UUID.Zero; | 65 | protected UUID m_ScopeID = UUID.Zero; |
66 | protected bool m_Check4096 = true; | 66 | protected bool m_Check4096 = true; |
67 | protected string m_MapTileDirectory = string.Empty; | 67 | protected string m_MapTileDirectory = string.Empty; |
68 | protected string m_ThisGatekeeper = string.Empty; | ||
69 | protected Uri m_ThisGatekeeperURI = null; | ||
68 | 70 | ||
69 | // Hyperlink regions are hyperlinks on the map | 71 | // Hyperlink regions are hyperlinks on the map |
70 | public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); | 72 | public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); |
@@ -123,6 +125,16 @@ namespace OpenSim.Services.GridService | |||
123 | 125 | ||
124 | m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); | 126 | m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); |
125 | 127 | ||
128 | m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty); | ||
129 | try | ||
130 | { | ||
131 | m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper); | ||
132 | } | ||
133 | catch | ||
134 | { | ||
135 | m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); | ||
136 | } | ||
137 | |||
126 | m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); | 138 | m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); |
127 | 139 | ||
128 | m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); | 140 | m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); |
@@ -246,6 +258,8 @@ namespace OpenSim.Services.GridService | |||
246 | remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); | 258 | remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); |
247 | 259 | ||
248 | reason = string.Empty; | 260 | reason = string.Empty; |
261 | Uri uri = null; | ||
262 | |||
249 | regInfo = new GridRegion(); | 263 | regInfo = new GridRegion(); |
250 | if ( externalPort > 0) | 264 | if ( externalPort > 0) |
251 | regInfo.HttpPort = externalPort; | 265 | regInfo.HttpPort = externalPort; |
@@ -256,8 +270,17 @@ namespace OpenSim.Services.GridService | |||
256 | else | 270 | else |
257 | regInfo.ExternalHostName = "0.0.0.0"; | 271 | regInfo.ExternalHostName = "0.0.0.0"; |
258 | if ( serverURI != null) | 272 | if ( serverURI != null) |
273 | { | ||
259 | regInfo.ServerURI = serverURI; | 274 | regInfo.ServerURI = serverURI; |
260 | 275 | try | |
276 | { | ||
277 | uri = new Uri(serverURI); | ||
278 | regInfo.ExternalHostName = uri.Host; | ||
279 | regInfo.HttpPort = (uint)uri.Port; | ||
280 | } | ||
281 | catch {} | ||
282 | } | ||
283 | |||
261 | if ( remoteRegionName != string.Empty ) | 284 | if ( remoteRegionName != string.Empty ) |
262 | regInfo.RegionName = remoteRegionName; | 285 | regInfo.RegionName = remoteRegionName; |
263 | 286 | ||
@@ -266,6 +289,18 @@ namespace OpenSim.Services.GridService | |||
266 | regInfo.ScopeID = scopeID; | 289 | regInfo.ScopeID = scopeID; |
267 | regInfo.EstateOwner = ownerID; | 290 | regInfo.EstateOwner = ownerID; |
268 | 291 | ||
292 | // Make sure we're not hyperlinking to regions on this grid! | ||
293 | if (m_ThisGatekeeperURI != null) | ||
294 | { | ||
295 | if (regInfo.ExternalHostName == m_ThisGatekeeperURI.Host && regInfo.HttpPort == m_ThisGatekeeperURI.Port) | ||
296 | { | ||
297 | reason = "Cannot hyperlink to regions on the same grid"; | ||
298 | return false; | ||
299 | } | ||
300 | } | ||
301 | else | ||
302 | m_log.WarnFormat("[HYPERGRID LINKER]: Please set this grid's Gatekeeper's address in [GridService]!"); | ||
303 | |||
269 | // Check for free coordinates | 304 | // Check for free coordinates |
270 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); | 305 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); |
271 | if (region != null) | 306 | if (region != null) |
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs index d19faed..a8bfe47 100644 --- a/OpenSim/Services/Interfaces/IInventoryService.cs +++ b/OpenSim/Services/Interfaces/IInventoryService.cs | |||
@@ -169,7 +169,7 @@ namespace OpenSim.Services.Interfaces | |||
169 | /// Get an item, given by its UUID | 169 | /// Get an item, given by its UUID |
170 | /// </summary> | 170 | /// </summary> |
171 | /// <param name="item"></param> | 171 | /// <param name="item"></param> |
172 | /// <returns></returns> | 172 | /// <returns>null if no item was found, otherwise the found item</returns> |
173 | InventoryItemBase GetItem(InventoryItemBase item); | 173 | InventoryItemBase GetItem(InventoryItemBase item); |
174 | 174 | ||
175 | /// <summary> | 175 | /// <summary> |
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index ebe0a72..d1dc17f 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -957,7 +957,7 @@ namespace OpenSim.Tests.Common.Mock | |||
957 | { | 957 | { |
958 | } | 958 | } |
959 | 959 | ||
960 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 960 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) |
961 | { | 961 | { |
962 | } | 962 | } |
963 | 963 | ||
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index aa4b285..709dd78 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | |||
@@ -454,9 +454,7 @@ namespace OpenSim.Tests.Common.Setup | |||
454 | /// <returns></returns> | 454 | /// <returns></returns> |
455 | public static SceneObjectPart AddSceneObject(Scene scene, string name) | 455 | public static SceneObjectPart AddSceneObject(Scene scene, string name) |
456 | { | 456 | { |
457 | SceneObjectPart part | 457 | SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), UUID.Zero); |
458 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); | ||
459 | part.Name = name; | ||
460 | 458 | ||
461 | //part.UpdatePrimFlags(false, false, true); | 459 | //part.UpdatePrimFlags(false, false, true); |
462 | //part.ObjectFlags |= (uint)PrimFlags.Phantom; | 460 | //part.ObjectFlags |= (uint)PrimFlags.Phantom; |
@@ -465,5 +463,68 @@ namespace OpenSim.Tests.Common.Setup | |||
465 | 463 | ||
466 | return part; | 464 | return part; |
467 | } | 465 | } |
466 | |||
467 | /// <summary> | ||
468 | /// Create a scene object part. | ||
469 | /// </summary> | ||
470 | /// <param name="name"></param> | ||
471 | /// <param name="id"></param> | ||
472 | /// <param name="ownerId"></param> | ||
473 | /// <returns></returns> | ||
474 | public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId) | ||
475 | { | ||
476 | return new SceneObjectPart( | ||
477 | ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | ||
478 | { Name = name, UUID = id }; | ||
479 | } | ||
480 | |||
481 | /// <summary> | ||
482 | /// Create a scene object but do not add it to the scene. | ||
483 | /// </summary> | ||
484 | /// <remarks> | ||
485 | /// UUID always starts at 00000000-0000-0000-0000-000000000001 | ||
486 | /// </remarks> | ||
487 | /// <param name="parts">The number of parts that should be in the scene object</param> | ||
488 | /// <param name="ownerId"></param> | ||
489 | /// <returns></returns> | ||
490 | public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId) | ||
491 | { | ||
492 | return CreateSceneObject(parts, ownerId, "", 0x1); | ||
493 | } | ||
494 | |||
495 | /// <summary> | ||
496 | /// Create a scene object but do not add it to the scene. | ||
497 | /// </summary> | ||
498 | /// <param name="parts"> | ||
499 | /// The number of parts that should be in the scene object | ||
500 | /// </param> | ||
501 | /// <param name="ownerId"></param> | ||
502 | /// <param name="partNamePrefix"> | ||
503 | /// The prefix to be given to part names. This will be suffixed with "Part<part no>" | ||
504 | /// (e.g. mynamePart0 for the root part) | ||
505 | /// </param> | ||
506 | /// <param name="uuidTail"> | ||
507 | /// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" | ||
508 | /// will be given to the root part, and incremented for each part thereafter. | ||
509 | /// </param> | ||
510 | /// <returns></returns> | ||
511 | public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, string partNamePrefix, int uuidTail) | ||
512 | { | ||
513 | string rawSogId = string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail); | ||
514 | |||
515 | SceneObjectGroup sog | ||
516 | = new SceneObjectGroup( | ||
517 | CreateSceneObjectPart(string.Format("{0}Part0", partNamePrefix), new UUID(rawSogId), ownerId)); | ||
518 | |||
519 | if (parts > 1) | ||
520 | for (int i = 1; i < parts; i++) | ||
521 | sog.AddPart( | ||
522 | CreateSceneObjectPart( | ||
523 | string.Format("{0}Part{1}", partNamePrefix, i), | ||
524 | new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail + i)), | ||
525 | ownerId)); | ||
526 | |||
527 | return sog; | ||
528 | } | ||
468 | } | 529 | } |
469 | } | 530 | } \ No newline at end of file |
diff --git a/bin/Mono.Data.Sqlite.dll.config b/bin/Mono.Data.Sqlite.dll.config new file mode 100644 index 0000000..ccc0cf5 --- /dev/null +++ b/bin/Mono.Data.Sqlite.dll.config | |||
@@ -0,0 +1,5 @@ | |||
1 | <configuration> | ||
2 | <dllmap os="osx" dll="sqlite3" target="./libsqlite3.dylib" /> | ||
3 | <dllmap os="!windows,osx" cpu="x86-64,ia64" wordsize="64" dll="sqlite3" target="./libsqlite3_64.so" /> | ||
4 | <dllmap os="!windows,osx" cpu="x86" wordsize="32" dll="sqlite3" target="./libsqlite3_32.so" /> | ||
5 | </configuration> | ||
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 5bac56e..c05c3de 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -1,4 +1,22 @@ | |||
1 | ;; A note on the format of this file | 1 | ;; This is the main configuration file for OpenSimulator. If it's named OpenSim.ini |
2 | ;; then it will be loaded by OpenSimulator. If it's named OpenSim.ini.example then | ||
3 | ;; you will need to copy it to OpenSim.ini first (if that file does not already exist) | ||
4 | ;; | ||
5 | ;; If you are copying, then once you have copied OpenSim.ini.example to OpenSim.ini you will | ||
6 | ;; need to pick an architecture in the [Architecture] section at the end of this file. | ||
7 | ;; | ||
8 | ;; The settings in this file are in the form "<key> = <value>". For example, save_crashes = false | ||
9 | ;; in the [Startup] section below. | ||
10 | ;; | ||
11 | ;; All settings are initially commented out and the default value used, as found in | ||
12 | ;; OpenSimDefaults.ini. To change a setting, first uncomment it by deleting the initial semicolon (;) | ||
13 | ;; and then change the value. This will override the value in OpenSimDefaults.ini | ||
14 | ;; | ||
15 | ;; If you want to find out what configuration OpenSimulator has finished with once all the configuration | ||
16 | ;; files are loaded then type "config show" on the region console command line. | ||
17 | ;; | ||
18 | ;; | ||
19 | ;; NOTES FOR DEVELOPERS REGARDING THE FORMAT OF THIS FILE | ||
2 | ;; | 20 | ;; |
3 | ;; All leading white space is ignored, but preserved. | 21 | ;; All leading white space is ignored, but preserved. |
4 | ;; | 22 | ;; |
@@ -8,15 +26,14 @@ | |||
8 | ;; formatted as: | 26 | ;; formatted as: |
9 | ;; {option} {depends on} {question to ask} {choices} default value | 27 | ;; {option} {depends on} {question to ask} {choices} default value |
10 | ;; Any text comments following the declaration, up to the next blank line. | 28 | ;; Any text comments following the declaration, up to the next blank line. |
11 | ;; will be copied to the generated file. | 29 | ;; will be copied to the generated file (NOTE: generation is not yet implemented) |
12 | ;; A * in the choices list will allow an empty entry.\ | 30 | ;; A * in the choices list will allow an empty entry. |
13 | ;; An empty question will set the default if the dependencies are | 31 | ;; An empty question will set the default if the dependencies are |
14 | ;; satisfied. | 32 | ;; satisfied. |
15 | ;; | 33 | ;; |
16 | ;; ; denotes a commented out option. Uncomment it to actvate it | 34 | ;; ; denotes a commented out option. |
17 | ;; and change it to the desired value | 35 | ;; Any options added to OpenSim.ini.example should be initially commented out. |
18 | ;; Any options added to OpenSim.ini.exmaple must be commented out, | 36 | |
19 | ;; and their value must represent the default. | ||
20 | 37 | ||
21 | [Startup] | 38 | [Startup] |
22 | ;# {save_crashes} {} {Save crashes to disk?} {true false} false | 39 | ;# {save_crashes} {} {Save crashes to disk?} {true false} false |
@@ -35,7 +52,7 @@ | |||
35 | 52 | ||
36 | ;; Determine where OpenSimulator looks for the files which tell it | 53 | ;; Determine where OpenSimulator looks for the files which tell it |
37 | ;; which regions to server | 54 | ;; which regions to server |
38 | ;; Defaults to "filesystem" if this setting isn't present | 55 | ;; Default is "filesystem" |
39 | ; region_info_source = "filesystem" | 56 | ; region_info_source = "filesystem" |
40 | ; region_info_source = "web" | 57 | ; region_info_source = "web" |
41 | 58 | ||
@@ -131,6 +148,7 @@ | |||
131 | ;; ZeroMesher is faster but leaves the physics engine to model the mesh | 148 | ;; ZeroMesher is faster but leaves the physics engine to model the mesh |
132 | ;; using the basic shapes that it supports. | 149 | ;; using the basic shapes that it supports. |
133 | ;; Usually this is only a box. | 150 | ;; Usually this is only a box. |
151 | ;; Default is Meshmerizer | ||
134 | ; meshing = Meshmerizer | 152 | ; meshing = Meshmerizer |
135 | ; meshing = ZeroMesher | 153 | ; meshing = ZeroMesher |
136 | 154 | ||
@@ -138,6 +156,7 @@ | |||
138 | ;; OpenDynamicsEngine is by some distance the most developed physics engine | 156 | ;; OpenDynamicsEngine is by some distance the most developed physics engine |
139 | ;; basicphysics effectively does not model physics at all, making all | 157 | ;; basicphysics effectively does not model physics at all, making all |
140 | ;; objects phantom | 158 | ;; objects phantom |
159 | ;; Default is OpenDynamicsEngine | ||
141 | ; physics = OpenDynamicsEngine | 160 | ; physics = OpenDynamicsEngine |
142 | ; physics = basicphysics | 161 | ; physics = basicphysics |
143 | ; physics = POS | 162 | ; physics = POS |
@@ -154,7 +173,6 @@ | |||
154 | ;; permission checks (allowing anybody to copy | 173 | ;; permission checks (allowing anybody to copy |
155 | ;; any item, etc. This may not yet be implemented uniformally. | 174 | ;; any item, etc. This may not yet be implemented uniformally. |
156 | ;; If set to true, then all permissions checks are carried out | 175 | ;; If set to true, then all permissions checks are carried out |
157 | ;; Default is false | ||
158 | ; serverside_object_permissions = false | 176 | ; serverside_object_permissions = false |
159 | 177 | ||
160 | ;; This allows users with a UserLevel of 200 or more to assume god | 178 | ;; This allows users with a UserLevel of 200 or more to assume god |
@@ -183,11 +201,20 @@ | |||
183 | ;; If not generating maptiles, use this static texture asset ID | 201 | ;; If not generating maptiles, use this static texture asset ID |
184 | ; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000" | 202 | ; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000" |
185 | 203 | ||
204 | ;; Http proxy setting for llHTTPRequest and dynamic texture loading, if required | ||
205 | ; HttpProxy = "http://proxy.com:8080" | ||
206 | |||
207 | ;; If you're using HttpProxy, then you can set HttpProxyExceptions to a list of regular expressions for URLs that you don't want to go through the proxy | ||
208 | ;; For example, servers inside your firewall. | ||
209 | ;; Separate patterns with a ';' | ||
210 | ; HttpProxyExceptions = ".mydomain.com;localhost" | ||
211 | |||
186 | ;# {emailmodule} {} {Provide llEmail and llGetNextEmail functionality? (requires SMTP server)} {true false} false | 212 | ;# {emailmodule} {} {Provide llEmail and llGetNextEmail functionality? (requires SMTP server)} {true false} false |
187 | ;; The email module requires some configuration. It needs an SMTP | 213 | ;; The email module requires some configuration. It needs an SMTP |
188 | ;; server to send mail through. | 214 | ;; server to send mail through. |
189 | ; emailmodule = DefaultEmailModule | 215 | ; emailmodule = DefaultEmailModule |
190 | 216 | ||
217 | |||
191 | [SMTP] | 218 | [SMTP] |
192 | ;; The SMTP server enabled the email module to send email to external | 219 | ;; The SMTP server enabled the email module to send email to external |
193 | ;; destinations. | 220 | ;; destinations. |
@@ -214,6 +241,7 @@ | |||
214 | ;# {SMTP_SERVER_PASSWORD} {[Startup]emailmodule:DefaultEmailModule enabled:true} {SMTP server password} {} | 241 | ;# {SMTP_SERVER_PASSWORD} {[Startup]emailmodule:DefaultEmailModule enabled:true} {SMTP server password} {} |
215 | ; SMTP_SERVER_PASSWORD = "" | 242 | ; SMTP_SERVER_PASSWORD = "" |
216 | 243 | ||
244 | |||
217 | [Network] | 245 | [Network] |
218 | ;; Configure the remote console user here. This will not actually be used | 246 | ;; Configure the remote console user here. This will not actually be used |
219 | ;; unless you use -console=rest at startup. | 247 | ;; unless you use -console=rest at startup. |
@@ -247,6 +275,7 @@ | |||
247 | ;; " (Mozilla Compatible)" to the text where there are problems with a web server | 275 | ;; " (Mozilla Compatible)" to the text where there are problems with a web server |
248 | ; user_agent = "OpenSim LSL (Mozilla Compatible)" | 276 | ; user_agent = "OpenSim LSL (Mozilla Compatible)" |
249 | 277 | ||
278 | |||
250 | [ClientStack.LindenUDP] | 279 | [ClientStack.LindenUDP] |
251 | ;; See OpensSimDefaults.ini for the throttle options. You can copy the | 280 | ;; See OpensSimDefaults.ini for the throttle options. You can copy the |
252 | ;; relevant sections and override them here. | 281 | ;; relevant sections and override them here. |
@@ -263,17 +292,18 @@ | |||
263 | ;; building's lights to possibly not be rendered. | 292 | ;; building's lights to possibly not be rendered. |
264 | ; DisableFacelights = "false" | 293 | ; DisableFacelights = "false" |
265 | 294 | ||
295 | |||
266 | [Chat] | 296 | [Chat] |
267 | ;# {whisper_distance} {} {Distance at which a whisper is heard, in meters?} {} 10 | 297 | ;# {whisper_distance} {} {Distance at which a whisper is heard, in meters?} {} 10 |
268 | ;; Distance in meters that whispers should travel. Default is 10m | 298 | ;; Distance in meters that whispers should travel. |
269 | ; whisper_distance = 10 | 299 | ; whisper_distance = 10 |
270 | 300 | ||
271 | ;# {say_distance} {} {Distance at which normal chat is heard, in meters? (SL uses 20 here)} {} 30 | 301 | ;# {say_distance} {} {Distance at which normal chat is heard, in meters? (SL uses 20 here)} {} 30 |
272 | ;; Distance in meters that ordinary chat should travel. Default is 30m | 302 | ;; Distance in meters that ordinary chat should travel. |
273 | ; say_distance = 30 | 303 | ; say_distance = 30 |
274 | 304 | ||
275 | ;# {shout_distance} {Distance at which a shout is heard, in meters?} {} 100 | 305 | ;# {shout_distance} {Distance at which a shout is heard, in meters?} {} 100 |
276 | ;; Distance in meters that shouts should travel. Default is 100m | 306 | ;; Distance in meters that shouts should travel. |
277 | ; shout_distance = 100 | 307 | ; shout_distance = 100 |
278 | 308 | ||
279 | 309 | ||
@@ -337,13 +367,13 @@ | |||
337 | ;# {create_region_enable_voice} {enabled:true} {Enable voice for newly created regions?} {true false} false | 367 | ;# {create_region_enable_voice} {enabled:true} {Enable voice for newly created regions?} {true false} false |
338 | ;; set this variable to true if you want the create_region XmlRpc | 368 | ;; set this variable to true if you want the create_region XmlRpc |
339 | ;; call to unconditionally enable voice on all parcels for a newly | 369 | ;; call to unconditionally enable voice on all parcels for a newly |
340 | ;; created region [default: false] | 370 | ;; created region |
341 | ; create_region_enable_voice = false | 371 | ; create_region_enable_voice = false |
342 | 372 | ||
343 | ;# {create_region_public} {enabled:true} {Make newly created regions public?} {true false} false | 373 | ;# {create_region_public} {enabled:true} {Make newly created regions public?} {true false} false |
344 | ;; set this variable to false if you want the create_region XmlRpc | 374 | ;; set this variable to false if you want the create_region XmlRpc |
345 | ;; call to create all regions as private per default (can be | 375 | ;; call to create all regions as private per default (can be |
346 | ;; overridden in the XmlRpc call) [default: true] | 376 | ;; overridden in the XmlRpc call) |
347 | ; create_region_public = false | 377 | ; create_region_public = false |
348 | 378 | ||
349 | ;# {enabled_methods} {enabled:true} {List of methods to allow, separated by |} {} all | 379 | ;# {enabled_methods} {enabled:true} {List of methods to allow, separated by |} {} all |
@@ -372,15 +402,16 @@ | |||
372 | ;; default avatars | 402 | ;; default avatars |
373 | ; default_appearance = default_appearance.xml | 403 | ; default_appearance = default_appearance.xml |
374 | 404 | ||
405 | |||
375 | [Wind] | 406 | [Wind] |
376 | ;# {enabled} {} {Enable wind module?} {true false} true | 407 | ;# {enabled} {} {Enable wind module?} {true false} true |
377 | ;; Enables the wind module. Default is true | 408 | ;; Enables the wind module. |
378 | ;enabled = true | 409 | ; enabled = true |
379 | 410 | ||
380 | ;# {wind_update_rate} {enabled:true} {Wind update rate in frames?} {} 150 | 411 | ;# {wind_update_rate} {enabled:true} {Wind update rate in frames?} {} 150 |
381 | ;; How often should wind be updated, as a function of world frames. | 412 | ;; How often should wind be updated, as a function of world frames. |
382 | ;; Approximately 50 frames a second | 413 | ;; Approximately 50 frames a second |
383 | wind_update_rate = 150 | 414 | ; wind_update_rate = 150 |
384 | 415 | ||
385 | ;; The Default Wind Plugin to load | 416 | ;; The Default Wind Plugin to load |
386 | ; wind_plugin = SimpleRandomWind | 417 | ; wind_plugin = SimpleRandomWind |
@@ -396,9 +427,10 @@ | |||
396 | 427 | ||
397 | ;# {strength} {enabled:true wind_plugin:SimpleRandomWind} {Wind strength?} {} 1.0 | 428 | ;# {strength} {enabled:true wind_plugin:SimpleRandomWind} {Wind strength?} {} 1.0 |
398 | ;; This setting is specific to the SimpleRandomWind plugin | 429 | ;; This setting is specific to the SimpleRandomWind plugin |
399 | ;; Adjusts wind strength. 0.0 = no wind, 1.0 = normal wind. Default is 1.0 | 430 | ;; Adjusts wind strength. 0.0 = no wind, 1.0 = normal wind. |
400 | ; strength = 1.0 | 431 | ; strength = 1.0 |
401 | 432 | ||
433 | |||
402 | [LightShare] | 434 | [LightShare] |
403 | ;# {enable_windlight} {} {Enable LightShare technology?} {true false} false | 435 | ;# {enable_windlight} {} {Enable LightShare technology?} {true false} false |
404 | ;; This enables the transmission of Windlight scenes to supporting clients, | 436 | ;; This enables the transmission of Windlight scenes to supporting clients, |
@@ -406,7 +438,8 @@ | |||
406 | ;; It has no ill effect on viewers which do not support server-side | 438 | ;; It has no ill effect on viewers which do not support server-side |
407 | ;; windlight settings. | 439 | ;; windlight settings. |
408 | ;; Currently we only have support for MySQL databases. | 440 | ;; Currently we only have support for MySQL databases. |
409 | ; enable_windlight = false; | 441 | ; enable_windlight = false |
442 | |||
410 | 443 | ||
411 | [DataSnapshot] | 444 | [DataSnapshot] |
412 | ;# {index_sims} {} {Enable data snapshotting (search)?} {true false} false | 445 | ;# {index_sims} {} {Enable data snapshotting (search)?} {true false} false |
@@ -417,7 +450,6 @@ | |||
417 | ;; and you can ignore the rest of these search-related configs. | 450 | ;; and you can ignore the rest of these search-related configs. |
418 | ; index_sims = false | 451 | ; index_sims = false |
419 | 452 | ||
420 | |||
421 | ;# {data_exposure} {index_sims:true} {How much data should be exposed?} {minimum all} minimum | 453 | ;# {data_exposure} {index_sims:true} {How much data should be exposed?} {minimum all} minimum |
422 | ;; The variable data_exposure controls what the regions expose: | 454 | ;; The variable data_exposure controls what the regions expose: |
423 | ;; minimum: exposes only things explicitly marked for search | 455 | ;; minimum: exposes only things explicitly marked for search |
@@ -462,6 +494,7 @@ | |||
462 | ;; Money Unit fee to create groups | 494 | ;; Money Unit fee to create groups |
463 | ; PriceGroupCreate = 0 | 495 | ; PriceGroupCreate = 0 |
464 | 496 | ||
497 | |||
465 | [XEngine] | 498 | [XEngine] |
466 | ;# {Enabled} {} {Enable the XEngine scripting engine?} {true false} true | 499 | ;# {Enabled} {} {Enable the XEngine scripting engine?} {true false} true |
467 | ;; Enable this engine in this OpenSim instance | 500 | ;; Enable this engine in this OpenSim instance |
@@ -556,9 +589,9 @@ | |||
556 | ;; Default is ./bin/ScriptEngines | 589 | ;; Default is ./bin/ScriptEngines |
557 | ; ScriptEnginesPath = "ScriptEngines" | 590 | ; ScriptEnginesPath = "ScriptEngines" |
558 | 591 | ||
592 | |||
559 | [MRM] | 593 | [MRM] |
560 | ;; Enables the Mini Region Modules Script Engine. | 594 | ;; Enables the Mini Region Modules Script Engine. |
561 | ;; default is false | ||
562 | ; Enabled = false | 595 | ; Enabled = false |
563 | 596 | ||
564 | ;; Runs MRM in a Security Sandbox | 597 | ;; Runs MRM in a Security Sandbox |
@@ -580,6 +613,7 @@ | |||
580 | ;; May represent a security risk if you disable this. | 613 | ;; May represent a security risk if you disable this. |
581 | ; OwnerOnly = true | 614 | ; OwnerOnly = true |
582 | 615 | ||
616 | |||
583 | [FreeSwitchVoice] | 617 | [FreeSwitchVoice] |
584 | ;; In order for this to work you need a functioning FreeSWITCH PBX set up. | 618 | ;; In order for this to work you need a functioning FreeSWITCH PBX set up. |
585 | ;; Configuration details at http://opensimulator.org/wiki/Freeswitch_Module | 619 | ;; Configuration details at http://opensimulator.org/wiki/Freeswitch_Module |
@@ -593,6 +627,7 @@ | |||
593 | ;; If using a remote module, specify the server URL | 627 | ;; If using a remote module, specify the server URL |
594 | ; FreeswitchServiceURL = http://my.grid.server:8003/fsapi | 628 | ; FreeswitchServiceURL = http://my.grid.server:8003/fsapi |
595 | 629 | ||
630 | |||
596 | [FreeswitchService] | 631 | [FreeswitchService] |
597 | ;; !!!!!!!!!!!!!!!!!!!!!!!!!!! | 632 | ;; !!!!!!!!!!!!!!!!!!!!!!!!!!! |
598 | ;; !!!!!!STANDALONE ONLY!!!!!! | 633 | ;; !!!!!!STANDALONE ONLY!!!!!! |
@@ -611,6 +646,7 @@ | |||
611 | ; UserName = "freeswitch" | 646 | ; UserName = "freeswitch" |
612 | ; Password = "password" | 647 | ; Password = "password" |
613 | 648 | ||
649 | |||
614 | [Groups] | 650 | [Groups] |
615 | ;# {Enabled} {} {Enable groups?} {true false} false | 651 | ;# {Enabled} {} {Enable groups?} {true false} false |
616 | ;; Enables the groups module | 652 | ;; Enables the groups module |
@@ -634,7 +670,7 @@ | |||
634 | ;# {ServicesConnectorModule} {Module:GroupsModule} {Service connector to use for groups} {XmlRpcGroupsServicesConnector SimianGroupsServicesConnector} XmlRpcGroupsServicesConnector | 670 | ;# {ServicesConnectorModule} {Module:GroupsModule} {Service connector to use for groups} {XmlRpcGroupsServicesConnector SimianGroupsServicesConnector} XmlRpcGroupsServicesConnector |
635 | ;; Service connectors to the Groups Service as used in the GroupsModule. Select one depending on | 671 | ;; Service connectors to the Groups Service as used in the GroupsModule. Select one depending on |
636 | ;; whether you're using a Flotsam XmlRpc backend or a SimianGrid backend | 672 | ;; whether you're using a Flotsam XmlRpc backend or a SimianGrid backend |
637 | ; ServicesConnectorModule = SimianGroupsServicesConnector | 673 | ; ServicesConnectorModule = XmlRpcGroupsServicesConnector |
638 | 674 | ||
639 | ;# {GroupsServerURI} {Module:GroupsModule} {Groups Server URI} {} | 675 | ;# {GroupsServerURI} {Module:GroupsModule} {Groups Server URI} {} |
640 | ;; URI for the groups services | 676 | ;; URI for the groups services |
@@ -654,6 +690,7 @@ | |||
654 | ; XmlRpcServiceReadKey = 1234 | 690 | ; XmlRpcServiceReadKey = 1234 |
655 | ; XmlRpcServiceWriteKey = 1234 | 691 | ; XmlRpcServiceWriteKey = 1234 |
656 | 692 | ||
693 | |||
657 | [InterestManagement] | 694 | [InterestManagement] |
658 | ;# {UpdatePrioritizationScheme} {} {Update prioritization scheme?} {BestAvatarResponsiveness Time Distance SimpleAngularDistance FrontBack} BestAvatarResponsiveness | 695 | ;# {UpdatePrioritizationScheme} {} {Update prioritization scheme?} {BestAvatarResponsiveness Time Distance SimpleAngularDistance FrontBack} BestAvatarResponsiveness |
659 | ;; This section controls how state updates are prioritized for each client | 696 | ;; This section controls how state updates are prioritized for each client |
@@ -661,24 +698,28 @@ | |||
661 | ;; SimpleAngularDistance, FrontBack | 698 | ;; SimpleAngularDistance, FrontBack |
662 | ; UpdatePrioritizationScheme = BestAvatarResponsiveness | 699 | ; UpdatePrioritizationScheme = BestAvatarResponsiveness |
663 | 700 | ||
701 | |||
664 | [MediaOnAPrim] | 702 | [MediaOnAPrim] |
665 | ;# {Enabled} {} {Enable Media-on-a-Prim (MOAP)} {true false} true | 703 | ;# {Enabled} {} {Enable Media-on-a-Prim (MOAP)} {true false} true |
666 | ;; Enable media on a prim facilities | 704 | ;; Enable media on a prim facilities |
667 | ; Enabled = true; | 705 | ; Enabled = true; |
668 | 706 | ||
707 | |||
669 | [Architecture] | 708 | [Architecture] |
670 | ;# {Include-Architecture} {} {Choose one of the following architectures} {config-include/Standalone.ini config-include/StandaloneHypergrid.ini config-include/Grid.ini config-include/GridHypergrid.ini config-include/SimianGrid.ini config-include/HyperSimianGrid.ini} config-include/Standalone.ini | 709 | ;# {Include-Architecture} {} {Choose one of the following architectures} {config-include/Standalone.ini config-include/StandaloneHypergrid.ini config-include/Grid.ini config-include/GridHypergrid.ini config-include/SimianGrid.ini config-include/HyperSimianGrid.ini} config-include/Standalone.ini |
671 | ;; Choose one of these architecture includes: | 710 | ;; Uncomment one of the following includes as required. For instance, to create a standalone OpenSim, |
672 | ;; Include-Architecture = "config-include/Standalone.ini" | 711 | ;; uncomment Include-Architecture = "config-include/Standalone.ini" |
673 | ;; Include-Architecture = "config-include/StandaloneHypergrid.ini" | 712 | ;; |
674 | ;; Include-Architecture = "config-include/Grid.ini" | 713 | ;; Then you will need to copy and edit the corresponding *Common.example file in config-include/ |
675 | ;; Include-Architecture = "config-include/GridHypergrid.ini" | 714 | ;; that the referenced .ini file goes on to include. |
676 | ;; Include-Architecture = "config-include/SimianGrid.ini" | 715 | ;; |
677 | ;; Include-Architecture = "config-include/HyperSimianGrid.ini" | 716 | ;; For instance, if you chose "config-include/Standalone.ini" then you will need to copy |
717 | ;; "config-include/StandaloneCommon.ini.example" to "config-include/StandaloneCommon.ini" before | ||
718 | ;; editing it to set the database and backend services that OpenSim will use. | ||
719 | ;; | ||
678 | ; Include-Architecture = "config-include/Standalone.ini" | 720 | ; Include-Architecture = "config-include/Standalone.ini" |
679 | 721 | ; Include-Architecture = "config-include/StandaloneHypergrid.ini" | |
680 | ;; Then choose | 722 | ; Include-Architecture = "config-include/Grid.ini" |
681 | ;; config-include/StandaloneCommon.ini.example (if you're in standlone) OR | 723 | ; Include-Architecture = "config-include/GridHypergrid.ini" |
682 | ;; config-include/GridCommon.ini.example (if you're connected to a grid) | 724 | ; Include-Architecture = "config-include/SimianGrid.ini" |
683 | ;; Copy to your own .ini there (without .example extension) and edit it | 725 | ; Include-Architecture = "config-include/HyperSimianGrid.ini" |
684 | ;; to customize your data | ||
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 96ffb7e..f857b8d 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -1,3 +1,7 @@ | |||
1 | ; This file contains defaults for various settings in OpenSimulator. These can be overriden | ||
2 | ; by changing the same setting in OpenSim.ini (once OpenSim.ini.example has been copied to OpenSim.ini). | ||
3 | |||
4 | |||
1 | [Startup] | 5 | [Startup] |
2 | ; Set this to true if you want to log crashes to disk | 6 | ; Set this to true if you want to log crashes to disk |
3 | ; this can be useful when submitting bug reports. | 7 | ; this can be useful when submitting bug reports. |
@@ -10,15 +14,6 @@ | |||
10 | ; Place to create a PID file | 14 | ; Place to create a PID file |
11 | ; PIDFile = "/tmp/my.pid" | 15 | ; PIDFile = "/tmp/my.pid" |
12 | 16 | ||
13 | ; Http proxy support for llHTTPRequest and dynamic texture loading | ||
14 | ; Set HttpProxy to the URL for your proxy server if you would like | ||
15 | ; to proxy llHTTPRequests through a firewall | ||
16 | ; HttpProxy = "http://proxy.com" | ||
17 | ; Set HttpProxyExceptions to a list of regular expressions for | ||
18 | ; URLs that you don't want going through the proxy such as servers | ||
19 | ; inside your firewall, separate patterns with a ';' | ||
20 | ; HttpProxyExceptions = ".mydomain.com;localhost" | ||
21 | |||
22 | startup_console_commands_file = "startup_commands.txt" | 17 | startup_console_commands_file = "startup_commands.txt" |
23 | shutdown_console_commands_file = "shutdown_commands.txt" | 18 | shutdown_console_commands_file = "shutdown_commands.txt" |
24 | 19 | ||
@@ -287,6 +282,7 @@ | |||
287 | ;SMTP_SERVER_LOGIN=foo | 282 | ;SMTP_SERVER_LOGIN=foo |
288 | ;SMTP_SERVER_PASSWORD=bar | 283 | ;SMTP_SERVER_PASSWORD=bar |
289 | 284 | ||
285 | |||
290 | [Network] | 286 | [Network] |
291 | ConsoleUser = "Test" | 287 | ConsoleUser = "Test" |
292 | ConsolePass = "secret" | 288 | ConsolePass = "secret" |
@@ -317,6 +313,7 @@ | |||
317 | ; " (Mozilla Compatible)" to the text where there are problems with a web server | 313 | ; " (Mozilla Compatible)" to the text where there are problems with a web server |
318 | ;user_agent = "OpenSim LSL (Mozilla Compatible)" | 314 | ;user_agent = "OpenSim LSL (Mozilla Compatible)" |
319 | 315 | ||
316 | |||
320 | [XMLRPC] | 317 | [XMLRPC] |
321 | ; ## | 318 | ; ## |
322 | ; ## Scripting XMLRPC mapper | 319 | ; ## Scripting XMLRPC mapper |
@@ -330,6 +327,7 @@ | |||
330 | ;XmlRpcRouterModule = "XmlRpcRouterModule" | 327 | ;XmlRpcRouterModule = "XmlRpcRouterModule" |
331 | ;XmlRpcPort = 20800 | 328 | ;XmlRpcPort = 20800 |
332 | 329 | ||
330 | |||
333 | [ClientStack.LindenUDP] | 331 | [ClientStack.LindenUDP] |
334 | ; Set this to true to process incoming packets asynchronously. Networking is | 332 | ; Set this to true to process incoming packets asynchronously. Networking is |
335 | ; already separated from packet handling with a queue, so this will only | 333 | ; already separated from packet handling with a queue, so this will only |
@@ -422,6 +420,7 @@ | |||
422 | ; | 420 | ; |
423 | ;DisableFacelights = "false" | 421 | ;DisableFacelights = "false" |
424 | 422 | ||
423 | |||
425 | [Chat] | 424 | [Chat] |
426 | ; Controls whether the chat module is enabled. Default is true. | 425 | ; Controls whether the chat module is enabled. Default is true. |
427 | enabled = true; | 426 | enabled = true; |
@@ -680,6 +679,7 @@ | |||
680 | ; path to default appearance XML file that specifies the look of the default avatars | 679 | ; path to default appearance XML file that specifies the look of the default avatars |
681 | ;default_appearance = default_appearance.xml | 680 | ;default_appearance = default_appearance.xml |
682 | 681 | ||
682 | |||
683 | [RestPlugins] | 683 | [RestPlugins] |
684 | ; Change this to true to enable REST Plugins. This must be true if you wish to use | 684 | ; Change this to true to enable REST Plugins. This must be true if you wish to use |
685 | ; REST Region or REST Asset and Inventory Plugins | 685 | ; REST Region or REST Asset and Inventory Plugins |
@@ -706,11 +706,10 @@ | |||
706 | flush-on-error = true | 706 | flush-on-error = true |
707 | 707 | ||
708 | 708 | ||
709 | ; Uncomment the following for IRC bridge | 709 | ; IRC bridge is experimental, so if it breaks... keep both parts... yada yada |
710 | ; experimental, so if it breaks... keep both parts... yada yada | ||
711 | ; also, not good error detection when it fails | 710 | ; also, not good error detection when it fails |
712 | ;[IRC] | 711 | [IRC] |
713 | ;enabled = true ; you need to set this otherwise it won't connect | 712 | enabled = false; you need to set this to true otherwise it won't connect |
714 | ;server = name.of.irc.server.on.the.net | 713 | ;server = name.of.irc.server.on.the.net |
715 | ;; user password - only use this if the server requires one | 714 | ;; user password - only use this if the server requires one |
716 | ;password = mypass | 715 | ;password = mypass |
@@ -767,14 +766,14 @@ | |||
767 | ;exclude_list=User 1,User 2,User 3 | 766 | ;exclude_list=User 1,User 2,User 3 |
768 | 767 | ||
769 | 768 | ||
770 | ;[CMS] | 769 | [CMS] |
771 | ;enabled = true | 770 | enabled = false |
772 | ;channel = 345 | 771 | ;channel = 345 |
773 | 772 | ||
774 | 773 | ||
775 | ; Uncomment the following to control the progression of daytime | 774 | ; The following settings control the progression of daytime |
776 | ; in the Sim. The defaults are what is shown below | 775 | ; in the Sim. The defaults are the same as the commented out settings |
777 | ;[Sun] | 776 | [Sun] |
778 | ; number of wall clock hours for an opensim day. 24.0 would mean realtime | 777 | ; number of wall clock hours for an opensim day. 24.0 would mean realtime |
779 | ;day_length = 4 | 778 | ;day_length = 4 |
780 | ; Year length in days | 779 | ; Year length in days |
@@ -821,12 +820,13 @@ | |||
821 | ; default is 1000 | 820 | ; default is 1000 |
822 | cloud_update_rate = 1000 | 821 | cloud_update_rate = 1000 |
823 | 822 | ||
824 | [LightShare] | ||
825 | 823 | ||
824 | [LightShare] | ||
826 | ; This enables the transmission of Windlight scenes to supporting clients, such as the Meta7 viewer. | 825 | ; This enables the transmission of Windlight scenes to supporting clients, such as the Meta7 viewer. |
827 | ; It has no ill effect on viewers which do not support server-side windlight settings. | 826 | ; It has no ill effect on viewers which do not support server-side windlight settings. |
828 | ; Currently we only have support for MySQL databases. | 827 | ; Currently we only have support for MySQL databases. |
829 | enable_windlight = false; | 828 | enable_windlight = false |
829 | |||
830 | 830 | ||
831 | [Trees] | 831 | [Trees] |
832 | ; Enable this to allow the tree module to manage your sim trees, including growing, reproducing and dying | 832 | ; Enable this to allow the tree module to manage your sim trees, including growing, reproducing and dying |
@@ -838,7 +838,6 @@ | |||
838 | 838 | ||
839 | 839 | ||
840 | [VectorRender] | 840 | [VectorRender] |
841 | |||
842 | ; the font to use for rendering text (default: Arial) | 841 | ; the font to use for rendering text (default: Arial) |
843 | ; font_name = "Arial" | 842 | ; font_name = "Arial" |
844 | 843 | ||
@@ -1032,6 +1031,7 @@ | |||
1032 | ;; Path to script assemblies | 1031 | ;; Path to script assemblies |
1033 | ; ScriptEnginesPath = "ScriptEngines" | 1032 | ; ScriptEnginesPath = "ScriptEngines" |
1034 | 1033 | ||
1034 | |||
1035 | [OpenGridProtocol] | 1035 | [OpenGridProtocol] |
1036 | ;These are the settings for the Open Grid Protocol.. the Agent Domain, Region Domain, you know.. | 1036 | ;These are the settings for the Open Grid Protocol.. the Agent Domain, Region Domain, you know.. |
1037 | ;On/true or Off/false | 1037 | ;On/true or Off/false |
@@ -1240,11 +1240,11 @@ | |||
1240 | ChildReprioritizationDistance = 20.0 | 1240 | ChildReprioritizationDistance = 20.0 |
1241 | 1241 | ||
1242 | 1242 | ||
1243 | [WebStats] | ||
1244 | ; View region statistics via a web page | 1243 | ; View region statistics via a web page |
1245 | ; See http://opensimulator.org/wiki/FAQ#Region_Statistics_on_a_Web_Page | 1244 | ; See http://opensimulator.org/wiki/FAQ#Region_Statistics_on_a_Web_Page |
1246 | ; Use a web browser and type in the "Login URI" + "/SStats/" | 1245 | ; Use a web browser and type in the "Login URI" + "/SStats/" |
1247 | ; For example- http://127.0.0.1:9000/SStats/ | 1246 | ; For example- http://127.0.0.1:9000/SStats/ |
1247 | [WebStats] | ||
1248 | ; enabled=false | 1248 | ; enabled=false |
1249 | 1249 | ||
1250 | 1250 | ||
diff --git a/bin/System.Data.SQLite.dll b/bin/System.Data.SQLite.dll deleted file mode 100644 index 66f38e7..0000000 --- a/bin/System.Data.SQLite.dll +++ /dev/null | |||
Binary files differ | |||
diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index 4dc0e53..bc8bc0f 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example | |||
@@ -6,11 +6,6 @@ | |||
6 | ; SQLite | 6 | ; SQLite |
7 | Include-Storage = "config-include/storage/SQLiteStandalone.ini"; | 7 | Include-Storage = "config-include/storage/SQLiteStandalone.ini"; |
8 | 8 | ||
9 | ; Unfortunately the current SQLite database plugin is not compatible with Mac OSX. You can still use the older | ||
10 | ; legacy sqlite library if you are using Mono 2.4. Please see the notes in OpenSim.ini (search for sqlite) | ||
11 | ; for more details | ||
12 | ;Include-Storage = "config-include/storage/SQLiteLegacyStandalone.ini"; | ||
13 | |||
14 | ; MySql | 9 | ; MySql |
15 | ; Uncomment these lines if you want to use mysql storage | 10 | ; Uncomment these lines if you want to use mysql storage |
16 | ; Change the connection string to your db details | 11 | ; Change the connection string to your db details |
@@ -45,6 +40,12 @@ | |||
45 | ;; Directory for map tile images of linked regions | 40 | ;; Directory for map tile images of linked regions |
46 | ; MapTileDirectory = "./maptiles" | 41 | ; MapTileDirectory = "./maptiles" |
47 | 42 | ||
43 | ; === HG ONLY === | ||
44 | ;; change this to the address of your Gatekeeper service | ||
45 | ;; (usually bundled with the rest of the services in one | ||
46 | ;; Robust server in port 8002, but not always) | ||
47 | Gatekeeper="http://mygridserver.com:8002" | ||
48 | |||
48 | [AvatarService] | 49 | [AvatarService] |
49 | ; | 50 | ; |
50 | ; change this to your grid-wide grid server | 51 | ; change this to your grid-wide grid server |
diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 816e9a6..d6f15bb 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example | |||
@@ -8,11 +8,6 @@ | |||
8 | ; SQLite | 8 | ; SQLite |
9 | Include-Storage = "config-include/storage/SQLiteStandalone.ini"; | 9 | Include-Storage = "config-include/storage/SQLiteStandalone.ini"; |
10 | 10 | ||
11 | ; Unfortunately the current SQLite database plugin is not compatible with Mac OSX. You can still use the older | ||
12 | ; legacy sqlite library if you are using Mono 2.4. Please see the notes in OpenSim.ini (search for sqlite) | ||
13 | ; for more details | ||
14 | ;Include-Storage = "config-include/storage/SQLiteLegacyStandalone.ini"; | ||
15 | |||
16 | ; MySql | 11 | ; MySql |
17 | ; Uncomment these lines if you want to use mysql storage | 12 | ; Uncomment these lines if you want to use mysql storage |
18 | ; Change the connection string to your db details | 13 | ; Change the connection string to your db details |
@@ -78,6 +73,11 @@ | |||
78 | ;; For example: | 73 | ;; For example: |
79 | Region_Welcome_Area = "DefaultRegion, FallbackRegion" | 74 | Region_Welcome_Area = "DefaultRegion, FallbackRegion" |
80 | 75 | ||
76 | ; === HG ONLY === | ||
77 | ;; change this to the address of your simulator | ||
78 | Gatekeeper="http://127.0.0.1:9000" | ||
79 | |||
80 | |||
81 | [LibraryModule] | 81 | [LibraryModule] |
82 | ; Set this if you want to change the name of the OpenSim Library | 82 | ; Set this if you want to change the name of the OpenSim Library |
83 | ;LibraryName = "My World's Library" | 83 | ;LibraryName = "My World's Library" |
diff --git a/bin/config-include/storage/SQLiteLegacyStandalone.ini b/bin/config-include/storage/SQLiteLegacyStandalone.ini deleted file mode 100644 index ffe9a70..0000000 --- a/bin/config-include/storage/SQLiteLegacyStandalone.ini +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | ; These are the initialization settings for running OpenSim Standalone with an SQLite database | ||
2 | |||
3 | [DatabaseService] | ||
4 | StorageProvider = "OpenSim.Data.SQLiteLegacy.dll" | ||
5 | ConnectionString = "URI=file:OpenSim.db,version=3,UseUTF16Encoding=True" | ||
6 | |||
7 | [AssetService] | ||
8 | ConnectionString = "URI=file:Asset.db,version=3" | ||
9 | |||
10 | [AvatarService] | ||
11 | ConnectionString = "URI=file:avatars.db,version=3" | ||
12 | |||
13 | [AuthenticationService] | ||
14 | ConnectionString = "URI=file:auth.db,version=3" | ||
15 | |||
16 | [UserAccountService] | ||
17 | ConnectionString = "URI=file:userprofiles.db,version=3" | ||
18 | |||
19 | [FriendsService] | ||
20 | ConnectionString = "URI=file:friends.db,version=3" | ||
diff --git a/bin/libode.dylib b/bin/libode.dylib index e81f9e4..958d202 100644 --- a/bin/libode.dylib +++ b/bin/libode.dylib | |||
Binary files differ | |||
diff --git a/bin/libsqlite3.dylib b/bin/libsqlite3.dylib new file mode 100755 index 0000000..94dcca8 --- /dev/null +++ b/bin/libsqlite3.dylib | |||
Binary files differ | |||
diff --git a/bin/libsqlite3.txt b/bin/libsqlite3.txt new file mode 100644 index 0000000..8ef66bd --- /dev/null +++ b/bin/libsqlite3.txt | |||
@@ -0,0 +1 @@ | |||
libsqlite version: 3.7.5 | |||
diff --git a/bin/libsqlite3_32.so b/bin/libsqlite3_32.so new file mode 100755 index 0000000..171ffcd --- /dev/null +++ b/bin/libsqlite3_32.so | |||
Binary files differ | |||
diff --git a/bin/libsqlite3_64.so b/bin/libsqlite3_64.so new file mode 100755 index 0000000..2646a9c --- /dev/null +++ b/bin/libsqlite3_64.so | |||
Binary files differ | |||
diff --git a/bin/sqlite-3.6.21.so b/bin/sqlite-3.6.21.so deleted file mode 100644 index 2a8f38b..0000000 --- a/bin/sqlite-3.6.21.so +++ /dev/null | |||
Binary files differ | |||
diff --git a/prebuild.xml b/prebuild.xml index b31812d..870ebf3 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -402,6 +402,7 @@ | |||
402 | <Reference name="System"/> | 402 | <Reference name="System"/> |
403 | <Reference name="System.Xml"/> | 403 | <Reference name="System.Xml"/> |
404 | <Reference name="OpenMetaverseTypes" path="../../../../bin/"/> | 404 | <Reference name="OpenMetaverseTypes" path="../../../../bin/"/> |
405 | <Reference name="log4net" path="../../../../bin/"/> | ||
405 | <Reference name="XMLRPC" path="../../../../bin/"/> | 406 | <Reference name="XMLRPC" path="../../../../bin/"/> |
406 | <Reference name="OpenSim.Framework"/> | 407 | <Reference name="OpenSim.Framework"/> |
407 | <Reference name="OpenSim.Framework.Console"/> | 408 | <Reference name="OpenSim.Framework.Console"/> |
@@ -1058,6 +1059,7 @@ | |||
1058 | <Reference name="OpenSim.Framework"/> | 1059 | <Reference name="OpenSim.Framework"/> |
1059 | <Reference name="OpenSim.Framework.Console"/> | 1060 | <Reference name="OpenSim.Framework.Console"/> |
1060 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> | 1061 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> |
1062 | <Reference name="OpenSim.Server.Base"/> | ||
1061 | <Reference name="OpenSim.Services.Interfaces"/> | 1063 | <Reference name="OpenSim.Services.Interfaces"/> |
1062 | <Reference name="OpenSim.Services.Base"/> | 1064 | <Reference name="OpenSim.Services.Base"/> |
1063 | <Reference name="OpenSim.Services.Connectors"/> | 1065 | <Reference name="OpenSim.Services.Connectors"/> |
@@ -2094,44 +2096,6 @@ | |||
2094 | </Files> | 2096 | </Files> |
2095 | </Project> | 2097 | </Project> |
2096 | 2098 | ||
2097 | <Project frameworkVersion="v3_5" name="OpenSim.Data.SQLiteLegacy" path="OpenSim/Data/SQLiteLegacy" type="Library"> | ||
2098 | <Configuration name="Debug"> | ||
2099 | <Options> | ||
2100 | <OutputPath>../../../bin/</OutputPath> | ||
2101 | </Options> | ||
2102 | </Configuration> | ||
2103 | <Configuration name="Release"> | ||
2104 | <Options> | ||
2105 | <OutputPath>../../../bin/</OutputPath> | ||
2106 | </Options> | ||
2107 | </Configuration> | ||
2108 | |||
2109 | <ReferencePath>../../../bin/</ReferencePath> | ||
2110 | <Reference name="System"/> | ||
2111 | <Reference name="System.Xml"/> | ||
2112 | <Reference name="System.Data"/> | ||
2113 | <Reference name="System.Data.SQLite" path="../../../bin/"/> | ||
2114 | <Reference name="OpenSim.Data"/> | ||
2115 | <Reference name="System.Drawing"/> | ||
2116 | <Reference name="OpenSim.Framework"/> | ||
2117 | <Reference name="OpenSim.Framework.Console"/> | ||
2118 | <Reference name="OpenSim.Region.Framework"/> | ||
2119 | <Reference name="OpenMetaverseTypes" path="../../../bin/"/> | ||
2120 | <Reference name="OpenMetaverse" path="../../../bin/"/> | ||
2121 | <Reference name="Mono.Data.SqliteClient" path="../../../bin/"/> | ||
2122 | <Reference name="Mono.Addins" path="../../../bin/"/> | ||
2123 | <Reference name="log4net" path="../../../bin/"/> | ||
2124 | |||
2125 | <Files> | ||
2126 | <Match pattern="*.cs" recurse="true"> | ||
2127 | <Exclude name="Tests" pattern="Tests"/> | ||
2128 | </Match> | ||
2129 | <Match buildAction="EmbeddedResource" path="Resources" pattern="*.sql"/> | ||
2130 | <Match buildAction="EmbeddedResource" path="Resources" pattern="*.migrations"/> | ||
2131 | <Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/> | ||
2132 | </Files> | ||
2133 | </Project> | ||
2134 | |||
2135 | <Project frameworkVersion="v3_5" name="OpenSim.Data.SQLite" path="OpenSim/Data/SQLite" type="Library"> | 2099 | <Project frameworkVersion="v3_5" name="OpenSim.Data.SQLite" path="OpenSim/Data/SQLite" type="Library"> |
2136 | <Configuration name="Debug"> | 2100 | <Configuration name="Debug"> |
2137 | <Options> | 2101 | <Options> |
@@ -2156,8 +2120,8 @@ | |||
2156 | <Reference name="OpenMetaverseTypes" path="../../../bin/"/> | 2120 | <Reference name="OpenMetaverseTypes" path="../../../bin/"/> |
2157 | <Reference name="OpenMetaverse" path="../../../bin/"/> | 2121 | <Reference name="OpenMetaverse" path="../../../bin/"/> |
2158 | <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> | 2122 | <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> |
2159 | <Reference name="Community.CsharpSqlite"/> | 2123 | <Reference name="Community.CsharpSqlite" path="../../../bin/"/> |
2160 | <Reference name="Community.CsharpSqlite.Sqlite"/> | 2124 | <Reference name="Community.CsharpSqlite.Sqlite" path="../../../bin"/> |
2161 | <Reference name="Mono.Data.Sqlite"/> | 2125 | <Reference name="Mono.Data.Sqlite"/> |
2162 | <Reference name="Mono.Addins" path="../../../bin/"/> | 2126 | <Reference name="Mono.Addins" path="../../../bin/"/> |
2163 | <Reference name="log4net" path="../../../bin/"/> | 2127 | <Reference name="log4net" path="../../../bin/"/> |
@@ -2927,6 +2891,7 @@ | |||
2927 | <Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/> | 2891 | <Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/> |
2928 | <Match path="World/Archiver/Tests" pattern="*.cs" recurse="true"/> | 2892 | <Match path="World/Archiver/Tests" pattern="*.cs" recurse="true"/> |
2929 | <Match buildAction="EmbeddedResource" path="World/Archiver/Tests/Resources" pattern="*"/> | 2893 | <Match buildAction="EmbeddedResource" path="World/Archiver/Tests/Resources" pattern="*"/> |
2894 | <Match path="World/Land/Tests" pattern="*.cs" recurse="true"/> | ||
2930 | <Match path="World/Media/Moap/Tests" pattern="*.cs" recurse="true"/> | 2895 | <Match path="World/Media/Moap/Tests" pattern="*.cs" recurse="true"/> |
2931 | <Match path="World/Serialiser/Tests" pattern="*.cs" recurse="true"/> | 2896 | <Match path="World/Serialiser/Tests" pattern="*.cs" recurse="true"/> |
2932 | <Match path="World/Terrain/Tests" pattern="*.cs" recurse="true"/> | 2897 | <Match path="World/Terrain/Tests" pattern="*.cs" recurse="true"/> |