From b512ecd1dc538f029e6772f526db78eb6687d938 Mon Sep 17 00:00:00 2001 From: Marck Date: Fri, 10 Dec 2010 22:13:05 +0100 Subject: Normalization of OSSL function names. Added the following replacement functions for compliance to the OSSL standards stated on the wiki: osGetTerrainHeight osSetTerrainHeight osGetSunParam osSetSunParam osSetPenColor The functions that do not comply to the standard give a warning when used but work normally otherwise. The graphics primitive drawing command "PenColor" has also been added as well as dynamic texture parameter "bgcolor" as an alternative to "bgcolour". The following two functions have been renamed because they are not enabled yet aynway: osWindParamSet => osSetWindParam osWindParamGet => osGetWindParam --- .../Scripting/VectorRender/VectorRenderModule.cs | 23 +++---- .../Shared/Api/Implementation/OSSL_Api.cs | 71 +++++++++++++++++++--- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 19 +++--- .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 33 ++++++++-- 4 files changed, 115 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 3291be4..7316e5b 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -165,7 +165,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender int width = 256; int height = 256; int alpha = 255; // 0 is transparent - Color bgColour = Color.White; // Default background color + Color bgColor = Color.White; // Default background color char altDataDelim = ';'; char[] paramDelimiter = { ',' }; @@ -253,15 +253,16 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender alpha = 256; } break; + case "bgcolor": case "bgcolour": - int hex = 0; + int hex = 0; if (Int32.TryParse(value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) { - bgColour = Color.FromArgb(hex); + bgColor = Color.FromArgb(hex); } else { - bgColour = Color.FromName(value); + bgColor = Color.FromName(value); } break; case "altdatadelim": @@ -315,7 +316,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender // background color in their scripts, only do when fully opaque if (alpha >= 255) { - graph.FillRectangle(new SolidBrush(bgColour), 0, 0, width, height); + graph.FillRectangle(new SolidBrush(bgColor), 0, 0, width, height); } for (int w = 0; w < bitmap.Width; w++) @@ -616,25 +617,25 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender } } } - else if (nextLine.StartsWith("PenColour")) + else if (nextLine.StartsWith("PenColour") || nextLine.StartsWith("PenColor")) { nextLine = nextLine.Remove(0, 9); nextLine = nextLine.Trim(); int hex = 0; - Color newColour; + Color newColor; if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) { - newColour = Color.FromArgb(hex); + newColor = Color.FromArgb(hex); } else { // this doesn't fail, it just returns black if nothing is found - newColour = Color.FromName(nextLine); + newColor = Color.FromName(nextLine); } - myBrush.Color = newColour; - drawPen.Color = newColour; + myBrush.Color = newColor; + drawPen.Color = newColor; } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 827626f..691b67f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -336,6 +336,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + internal void OSSLDeprecated(string function, string replacement) + { + OSSLShoutError(string.Format("Use of function {0} is deprecated. Use {1} instead.", function, replacement)); + } + protected void ScriptSleep(int delay) { delay = (int)((float)delay * m_ScriptDelayFactor); @@ -347,13 +352,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // // OpenSim functions // + public LSL_Integer osSetTerrainHeight(int x, int y, double val) + { + CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight"); + return SetTerrainHeight(x, y, val); + } public LSL_Integer osTerrainSetHeight(int x, int y, double val) { CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); - + OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight"); + return SetTerrainHeight(x, y, val); + } + private LSL_Integer SetTerrainHeight(int x, int y, double val) + { m_host.AddScriptLPS(1); if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) - OSSLError("osTerrainSetHeight: Coordinate out of bounds"); + OSSLError("osSetTerrainHeight: Coordinate out of bounds"); if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0))) { @@ -366,13 +380,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public LSL_Float osGetTerrainHeight(int x, int y) + { + CheckThreatLevel(ThreatLevel.None, "osGetTerrainHeight"); + return GetTerrainHeight(x, y); + } public LSL_Float osTerrainGetHeight(int x, int y) { CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); - + OSSLDeprecated("osTerrainGetHeight", "osGetTerrainHeight"); + return GetTerrainHeight(x, y); + } + private LSL_Float GetTerrainHeight(int x, int y) + { m_host.AddScriptLPS(1); if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) - OSSLError("osTerrainGetHeight: Coordinate out of bounds"); + OSSLError("osGetTerrainHeight: Coordinate out of bounds"); return World.Heightmap[x, y]; } @@ -1001,9 +1024,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return drawList; } + public string osSetPenColor(string drawList, string color) + { + CheckThreatLevel(ThreatLevel.None, "osSetPenColor"); + + m_host.AddScriptLPS(1); + drawList += "PenColor " + color + "; "; + return drawList; + } + // Deprecated public string osSetPenColour(string drawList, string colour) { CheckThreatLevel(ThreatLevel.None, "osSetPenColour"); + OSSLDeprecated("osSetPenColour", "osSetPenColor"); m_host.AddScriptLPS(1); drawList += "PenColour " + colour + "; "; @@ -1012,7 +1045,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public string osSetPenCap(string drawList, string direction, string type) { - CheckThreatLevel(ThreatLevel.None, "osSetPenColour"); + CheckThreatLevel(ThreatLevel.None, "osSetPenCap"); m_host.AddScriptLPS(1); drawList += "PenCap " + direction + "," + type + "; "; @@ -1157,6 +1190,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public double osSunGetParam(string param) { CheckThreatLevel(ThreatLevel.None, "osSunGetParam"); + OSSLDeprecated("osSunGetParam", "osGetSunParam"); + return GetSunParam(param); + } + public double osGetSunParam(string param) + { + CheckThreatLevel(ThreatLevel.None, "osGetSunParam"); + return GetSunParam(param); + } + private double GetSunParam(string param) + { m_host.AddScriptLPS(1); double value = 0.0; @@ -1173,6 +1216,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void osSunSetParam(string param, double value) { CheckThreatLevel(ThreatLevel.None, "osSunSetParam"); + OSSLDeprecated("osSunSetParam", "osSetSunParam"); + SetSunParam(param, value); + } + public void osSetSunParam(string param, double value) + { + CheckThreatLevel(ThreatLevel.None, "osSetSunParam"); + SetSunParam(param, value); + } + private void SetSunParam(string param, double value) + { m_host.AddScriptLPS(1); ISunModule module = World.RequestModuleInterface(); @@ -1198,9 +1251,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return String.Empty; } - public void osWindParamSet(string plugin, string param, float value) + public void osSetWindParam(string plugin, string param, float value) { - CheckThreatLevel(ThreatLevel.VeryLow, "osWindParamSet"); + CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam"); m_host.AddScriptLPS(1); IWindModule module = World.RequestModuleInterface(); @@ -1214,9 +1267,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public float osWindParamGet(string plugin, string param) + public float osGetWindParam(string plugin, string param) { - CheckThreatLevel(ThreatLevel.VeryLow, "osWindParamGet"); + CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam"); m_host.AddScriptLPS(1); IWindModule module = World.RequestModuleInterface(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 10d61ca..da81a51 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -67,8 +67,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, bool blend, int disp, int timer, int alpha, int face); - LSL_Float osTerrainGetHeight(int x, int y); - LSL_Integer osTerrainSetHeight(int x, int y, double val); + LSL_Float osGetTerrainHeight(int x, int y); + LSL_Float osTerrainGetHeight(int x, int y); // Deprecated + LSL_Integer osSetTerrainHeight(int x, int y, double val); + LSL_Integer osTerrainSetHeight(int x, int y, double val); //Deprecated void osTerrainFlush(); int osRegionRestart(double seconds); @@ -107,7 +109,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces string osSetFontName(string drawList, string fontName); string osSetFontSize(string drawList, int fontSize); string osSetPenSize(string drawList, int penSize); - string osSetPenColour(string drawList, string colour); + string osSetPenColor(string drawList, string color); + string osSetPenColour(string drawList, string colour); // Deprecated string osSetPenCap(string drawList, string direction, string type); string osDrawImage(string drawList, int width, int height, string imageUrl); vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize); @@ -119,13 +122,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour); void osSetEstateSunSettings(bool sunFixed, double sunHour); double osGetCurrentSunHour(); - double osSunGetParam(string param); - void osSunSetParam(string param, double value); + double osGetSunParam(string param); + double osSunGetParam(string param); // Deprecated + void osSetSunParam(string param, double value); + void osSunSetParam(string param, double value); // Deprecated // Wind Module Functions string osWindActiveModelPluginName(); - void osWindParamSet(string plugin, string param, float value); - float osWindParamGet(string plugin, string param); + void osSetWindParam(string plugin, string param, float value); + float osGetWindParam(string plugin, string param); // Parcel commands void osParcelJoin(vector pos1, vector pos2); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index f3142e6..70d489e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -81,11 +81,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osGetCurrentSunHour(); } + public double osGetSunParam(string param) + { + return m_OSSL_Functions.osGetSunParam(param); + } + // Deprecated public double osSunGetParam(string param) { return m_OSSL_Functions.osSunGetParam(param); } + public void osSetSunParam(string param, double value) + { + m_OSSL_Functions.osSetSunParam(param, value); + } + // Deprecated public void osSunSetParam(string param, double value) { m_OSSL_Functions.osSunSetParam(param, value); @@ -97,14 +107,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase } // Not yet plugged in as available OSSL functions, so commented out -// void osWindParamSet(string plugin, string param, float value) +// void osSetWindParam(string plugin, string param, float value) // { -// m_OSSL_Functions.osWindParamSet(plugin, param, value); +// m_OSSL_Functions.osSetWindParam(plugin, param, value); // } // -// float osWindParamGet(string plugin, string param) +// float osGetWindParam(string plugin, string param) // { -// return m_OSSL_Functions.osWindParamGet(plugin, param); +// return m_OSSL_Functions.osGetWindParam(plugin, param); // } public void osParcelJoin(vector pos1, vector pos2) @@ -165,11 +175,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase blend, disp, timer, alpha, face); } + public LSL_Float osGetTerrainHeight(int x, int y) + { + return m_OSSL_Functions.osGetTerrainHeight(x, y); + } + // Deprecated public LSL_Float osTerrainGetHeight(int x, int y) { return m_OSSL_Functions.osTerrainGetHeight(x, y); } + public LSL_Integer osSetTerrainHeight(int x, int y, double val) + { + return m_OSSL_Functions.osSetTerrainHeight(x, y, val); + } + // Deprecated public LSL_Integer osTerrainSetHeight(int x, int y, double val) { return m_OSSL_Functions.osTerrainSetHeight(x, y, val); @@ -333,6 +353,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osSetPenCap(drawList, direction, type); } + public string osSetPenColor(string drawList, string color) + { + return m_OSSL_Functions.osSetPenColor(drawList, color); + } + // Deprecated public string osSetPenColour(string drawList, string colour) { return m_OSSL_Functions.osSetPenColour(drawList, colour); -- cgit v1.1 From 373ef594baeb7213f1f97c6bf444b7d348f25104 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 11 Dec 2010 01:57:32 +0000 Subject: Drop current OAR version back to 0.5 since these are currently now compatible with older OpenSim versions again. Removed ability to choose 0.4 to avoid having to write code that polices this properly. Please shout on the ml if you really need this. --- OpenSim/Region/Application/OpenSim.cs | 7 ++- .../World/Archiver/ArchiveWriteRequestExecution.cs | 3 +- .../Archiver/ArchiveWriteRequestPreparation.cs | 64 +++++++++++----------- .../CoreModules/World/Archiver/ArchiverModule.cs | 2 +- 4 files changed, 38 insertions(+), 38 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index ae2d836..c2dd84c 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -265,10 +265,11 @@ namespace OpenSim LoadOar); m_console.Commands.AddCommand("region", false, "save oar", - "save oar [-v|--version=] [-p|--profile=] []", + //"save oar [-v|--version=] [-p|--profile=] []", + "save oar [-p|--profile=] []", "Save a region's data to an OAR archive.", - "-v|--version= generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine - + "-p|--profile= adds the url of the profile service to the saved user information" + Environment.NewLine +// "-v|--version= generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine + "-p|--profile= adds the url of the profile service to the saved user information" + Environment.NewLine + "The OAR path must be a filesystem path." + " If this is not given then the oar is saved to region.oar in the current directory.", SaveOar); diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index f8a599a..9ec4ebe 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs @@ -136,14 +136,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver ms.Close(); m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); - // Write out scene object metadata foreach (SceneObjectGroup sceneObject in m_sceneObjects) { //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); - string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); + string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 0699407..f2d487e 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// /// The maximum major version of OAR that we can write. /// - public static int MAX_MAJOR_VERSION = 1; + public static int MAX_MAJOR_VERSION = 0; protected Scene m_scene; protected Stream m_saveStream; @@ -206,37 +206,37 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// public static string CreateControlFile(Dictionary options) { - int majorVersion = MAX_MAJOR_VERSION, minorVersion = 0; - - if (options.ContainsKey("version")) - { - string[] parts = options["version"].ToString().Split('.'); - if (parts.Length >= 1) - { - majorVersion = Int32.Parse(parts[0]); - - if (parts.Length >= 2) - minorVersion = Int32.Parse(parts[1]); - } - } - - if (majorVersion < MIN_MAJOR_VERSION || majorVersion > MAX_MAJOR_VERSION) - { - throw new Exception( - string.Format( - "OAR version number for save must be between {0} and {1}", - MIN_MAJOR_VERSION, MAX_MAJOR_VERSION)); - } - else if (majorVersion == MAX_MAJOR_VERSION) - { - // Force 1.0 - minorVersion = 0; - } - else if (majorVersion == MIN_MAJOR_VERSION) - { - // Force 0.4 - minorVersion = 4; - } + int majorVersion = MAX_MAJOR_VERSION, minorVersion = 5; +// +// if (options.ContainsKey("version")) +// { +// string[] parts = options["version"].ToString().Split('.'); +// if (parts.Length >= 1) +// { +// majorVersion = Int32.Parse(parts[0]); +// +// if (parts.Length >= 2) +// minorVersion = Int32.Parse(parts[1]); +// } +// } +// +// if (majorVersion < MIN_MAJOR_VERSION || majorVersion > MAX_MAJOR_VERSION) +// { +// throw new Exception( +// string.Format( +// "OAR version number for save must be between {0} and {1}", +// MIN_MAJOR_VERSION, MAX_MAJOR_VERSION)); +// } +// else if (majorVersion == MAX_MAJOR_VERSION) +// { +// // Force 1.0 +// minorVersion = 0; +// } +// else if (majorVersion == MIN_MAJOR_VERSION) +// { +// // Force 0.4 +// minorVersion = 4; +// } m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); //if (majorVersion == 1) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 2d7244e..9277c59 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver Dictionary options = new Dictionary(); OptionSet ops = new OptionSet(); - ops.Add("v|version=", delegate(string v) { options["version"] = v; }); +// ops.Add("v|version=", delegate(string v) { options["version"] = v; }); ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); List mainParams = ops.Parse(cmdparams); -- cgit v1.1 From 387f743993456bb7dbc6ea639bfa98db4567789c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 11 Dec 2010 02:18:16 +0000 Subject: If we're saving an IAR with --profile information, then label this a version 1.0 IAR since it isn't compatible with older OpenSim releases. --- .../Archiver/InventoryArchiveWriteRequest.cs | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index cab341d..5e5f6c0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -156,7 +156,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// The inventory folder to save /// The path to which the folder should be saved /// If true, save this folder itself. If false, only saves contents - protected void SaveInvFolder(InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, Dictionary options, IUserAccountService userAccountService) + /// + /// + protected void SaveInvFolder( + InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, + Dictionary options, IUserAccountService userAccountService) { if (saveThisFolderItself) { @@ -249,7 +253,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver // Write out control file. This has to be done first so that subsequent loaders will see this file first // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this - m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); + // not sure how to fix this though, short of going with a completely different file format. + m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile(options)); m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); if (inventoryFolder != null) @@ -372,12 +377,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } /// - /// Create the control file for a 0.1 version archive + /// Create the control file for the archive /// + /// /// - public static string Create0p1ControlFile() + public static string CreateControlFile(Dictionary options) { - int majorVersion = 0, minorVersion = 1; + int majorVersion, minorVersion; + + if (options.ContainsKey("profile")) + { + majorVersion = 1; + minorVersion = 0; + } + else + { + majorVersion = 0; + minorVersion = 1; + } m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); -- cgit v1.1 From b46de6e025f1179f13841e1a8ccb1031b598895b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 11 Dec 2010 03:09:00 +0000 Subject: Remove the restriction that you have to be logged in when loading/saving iars This is pointless as we're supplying the password on the command line --- .../Inventory/Archiver/InventoryArchiverModule.cs | 128 ++++++++++----------- .../Archiver/Tests/InventoryArchiverTests.cs | 14 +-- 2 files changed, 70 insertions(+), 72 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index b33c2b1..1e18095 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// /// Enable or disable checking whether the iar user is actually logged in /// - public bool DisablePresenceChecks { get; set; } +// public bool DisablePresenceChecks { get; set; } public event InventoryArchiveSaved OnInventoryArchiveSaved; @@ -95,10 +95,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver public InventoryArchiverModule() {} - public InventoryArchiverModule(bool disablePresenceChecks) - { - DisablePresenceChecks = disablePresenceChecks; - } +// public InventoryArchiverModule(bool disablePresenceChecks) +// { +// DisablePresenceChecks = disablePresenceChecks; +// } public void Initialise(Scene scene, IConfigSource source) { @@ -172,8 +172,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (userInfo != null) { - if (CheckPresence(userInfo.PrincipalID)) - { +// if (CheckPresence(userInfo.PrincipalID)) +// { try { new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService); @@ -189,13 +189,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } return true; - } - else - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", - userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); - } +// } +// else +// { +// m_log.ErrorFormat( +// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", +// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); +// } } } @@ -212,8 +212,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (userInfo != null) { - if (CheckPresence(userInfo.PrincipalID)) - { +// if (CheckPresence(userInfo.PrincipalID)) +// { try { new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService); @@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } return true; - } - else - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", - userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); - } +// } +// else +// { +// m_log.ErrorFormat( +// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", +// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); +// } } } @@ -257,9 +257,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (userInfo != null) { - if (CheckPresence(userInfo.PrincipalID)) - { - +// if (CheckPresence(userInfo.PrincipalID)) +// { InventoryArchiveReadRequest request; bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); @@ -280,13 +279,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver UpdateClientWithLoadedNodes(userInfo, request.Execute()); return true; - } - else - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", - userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); - } +// } +// else +// { +// m_log.ErrorFormat( +// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", +// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); +// } } else m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found", @@ -306,8 +305,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (userInfo != null) { - if (CheckPresence(userInfo.PrincipalID)) - { +// if (CheckPresence(userInfo.PrincipalID)) +// { InventoryArchiveReadRequest request; bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); @@ -328,13 +327,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver UpdateClientWithLoadedNodes(userInfo, request.Execute()); return true; - } - else - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", - userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); - } +// } +// else +// { +// m_log.ErrorFormat( +// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", +// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); +// } } } @@ -529,28 +528,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } } - /// - /// Check if the given user is present in any of the scenes. - /// - /// The user to check - /// true if the user is in any of the scenes, false otherwise - protected bool CheckPresence(UUID userId) - { - if (DisablePresenceChecks) - return true; - - foreach (Scene scene in m_scenes.Values) - { - ScenePresence p; - if ((p = scene.GetScenePresence(userId)) != null) - { - p.ControllingClient.SendAgentAlertMessage("Inventory operation has been started", false); - return true; - } - } - - return false; - } - +// /// +// /// Check if the given user is present in any of the scenes. +// /// +// /// The user to check +// /// true if the user is in any of the scenes, false otherwise +// protected bool CheckPresence(UUID userId) +// { +// if (DisablePresenceChecks) +// return true; +// +// foreach (Scene scene in m_scenes.Values) +// { +// ScenePresence p; +// if ((p = scene.GetScenePresence(userId)) != null) +// { +// p.ControllingClient.SendAgentAlertMessage("Inventory operation has been started", false); +// return true; +// } +// } +// +// return false; +// } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 2747e15..76d0b85 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -120,7 +120,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); Scene scene = SceneSetupHelpers.SetupScene("Inventory"); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); @@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); Scene scene = SceneSetupHelpers.SetupScene("Inventory"); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); @@ -355,7 +355,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); Scene scene = SceneSetupHelpers.SetupScene("inventory"); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); @@ -382,7 +382,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests //log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene Scene scene = SceneSetupHelpers.SetupScene("inventory"); @@ -443,7 +443,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string humanEscapedItemName = @"You & you are a mean\/man\/"; string userPassword = "meowfood"; - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); Scene scene = SceneSetupHelpers.SetupScene("Inventory"); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); @@ -558,7 +558,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); SerialiserModule serialiserModule = new SerialiserModule(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene Scene scene = SceneSetupHelpers.SetupScene("inventory"); @@ -619,7 +619,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); // SerialiserModule serialiserModule = new SerialiserModule(); - // InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + // InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene // Scene scene = SceneSetupHelpers.SetupScene(); -- cgit v1.1