From c1d680b6c3a5e3dc11cd1e7cc9b74d3d81317eee Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Tue, 12 May 2009 03:30:37 +0000 Subject: Thank you kindly, Patnad, for a patch that: This is to handle the changes in the v1.23 viewer of LL regarding the adult rating. With this patch a region can be changed to the adult rating from LL viewer v1.23 and above. --- OpenSim/Data/MySQL/MySQLManager.cs | 6 ++++-- OpenSim/Data/MySQL/Resources/002_GridStore.sql | 5 +++++ OpenSim/Data/RegionProfileData.cs | 21 +++++++++++++++++-- OpenSim/Data/RegionProfileServiceProxy.cs | 3 ++- OpenSim/Framework/RegionInfo.cs | 6 ++++++ OpenSim/Framework/Util.cs | 24 ++++++++++++++++++++++ .../Grid/GridServer.Modules/GridXmlRpcModule.cs | 17 +++++++++++++-- .../Communications/Hypergrid/HGGridServices.cs | 2 +- .../Communications/Local/LocalBackEndServices.cs | 2 +- .../Region/Communications/OGS1/OGS1GridServices.cs | 2 ++ .../InterGrid/OpenGridProtocolModule.cs | 14 ++++++++++++- .../World/Estate/EstateManagementModule.cs | 16 +++++---------- .../CoreModules/World/WorldMap/MapSearchModule.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 2 ++ 14 files changed, 100 insertions(+), 22 deletions(-) create mode 100644 OpenSim/Data/MySQL/Resources/002_GridStore.sql (limited to 'OpenSim') diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs index ad022a5..139d57f 100644 --- a/OpenSim/Data/MySQL/MySQLManager.cs +++ b/OpenSim/Data/MySQL/MySQLManager.cs @@ -436,6 +436,7 @@ namespace OpenSim.Data.MySQL // World Map Addition UUID.TryParse((string)reader["regionMapTexture"], out retval.regionMapTextureID); UUID.TryParse((string)reader["owner_uuid"], out retval.owner_uuid); + retval.maturity = Convert.ToUInt32(reader["access"]); } else { @@ -976,13 +977,13 @@ namespace OpenSim.Data.MySQL // server for the UUID of the region's owner (master avatar). It consists of the addition of the column and value to the relevant sql, // as well as the related parameterization sql += - "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort, owner_uuid, originUUID) VALUES "; + "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort, owner_uuid, originUUID, access) VALUES "; sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; sql += - "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort, ?owner_uuid, ?originUUID)"; + "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort, ?owner_uuid, ?originUUID, ?access)"; if (GRID_ONLY_UPDATE_NECESSARY_DATA) { @@ -1023,6 +1024,7 @@ namespace OpenSim.Data.MySQL parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString(); parameters["?owner_uuid"] = regiondata.owner_uuid.ToString(); parameters["?originUUID"] = regiondata.originUUID.ToString(); + parameters["?access"] = regiondata.maturity.ToString(); bool returnval = false; diff --git a/OpenSim/Data/MySQL/Resources/002_GridStore.sql b/OpenSim/Data/MySQL/Resources/002_GridStore.sql new file mode 100644 index 0000000..bda43d0 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/002_GridStore.sql @@ -0,0 +1,5 @@ +BEGIN; + +ALTER TABLE regions add column access integer unsigned default 1; + +COMMIT; diff --git a/OpenSim/Data/RegionProfileData.cs b/OpenSim/Data/RegionProfileData.cs index 8ff2184..ed3ecfc 100644 --- a/OpenSim/Data/RegionProfileData.cs +++ b/OpenSim/Data/RegionProfileData.cs @@ -131,6 +131,11 @@ namespace OpenSim.Data /// public UUID originUUID; + /// + /// The Maturity rating of the region + /// + public uint maturity; + //Data Wrappers public string RegionName @@ -279,6 +284,17 @@ namespace OpenSim.Data get { return originUUID; } set { originUUID = value; } } + public uint Maturity + { + get { return maturity; } + set { maturity = value; } + } + + public byte AccessLevel + { + get { return Util.ConvertMaturityToAccessLevel(maturity); } + } + public RegionInfo ToRegionInfo() { @@ -295,10 +311,10 @@ namespace OpenSim.Data return Create(regionInfo.RegionID, regionInfo.RegionName, regionInfo.RegionLocX, regionInfo.RegionLocY, regionInfo.ExternalHostName, (uint) regionInfo.ExternalEndPoint.Port, regionInfo.HttpPort, regionInfo.RemotingPort, - regionInfo.ServerURI); + regionInfo.ServerURI, regionInfo.AccessLevel); } - public static RegionProfileData Create(UUID regionID, string regionName, uint locX, uint locY, string externalHostName, uint regionPort, uint httpPort, uint remotingPort, string serverUri) + public static RegionProfileData Create(UUID regionID, string regionName, uint locX, uint locY, string externalHostName, uint regionPort, uint httpPort, uint remotingPort, string serverUri, byte access) { RegionProfileData regionProfile; regionProfile = new RegionProfileData(); @@ -315,6 +331,7 @@ namespace OpenSim.Data regionProfile.httpServerURI = "http://" + externalHostName + ":" + httpPort + "/"; regionProfile.UUID = regionID; regionProfile.regionName = regionName; + regionProfile.maturity = access; return regionProfile; } } diff --git a/OpenSim/Data/RegionProfileServiceProxy.cs b/OpenSim/Data/RegionProfileServiceProxy.cs index da71936..e9d0036 100644 --- a/OpenSim/Data/RegionProfileServiceProxy.cs +++ b/OpenSim/Data/RegionProfileServiceProxy.cs @@ -65,8 +65,9 @@ namespace OpenSim.Data string serverUri = (string)responseData["server_uri"]; UUID regionID = new UUID((string)responseData["region_UUID"]); string regionName = (string)responseData["region_name"]; + byte access = Convert.ToByte((string)responseData["access"]); - simData = RegionProfileData.Create(regionID, regionName, locX, locY, externalHostName, simPort, httpPort, remotingPort, serverUri); + simData = RegionProfileData.Create(regionID, regionName, locX, locY, externalHostName, simPort, httpPort, remotingPort, serverUri, access); } return simData; diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 4c107c9..66dee4b 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -334,6 +334,11 @@ namespace OpenSim.Framework get { return m_objectCapacity; } } + public byte AccessLevel + { + get { return (byte)Util.ConvertMaturityToAccessLevel((uint)m_regionSettings.Maturity); } + } + public void SetEndPoint(string ipaddr, int port) { IPAddress tmpIP = IPAddress.Parse(ipaddr); @@ -691,5 +696,6 @@ namespace OpenSim.Framework regionInfo.ServerURI = serverURI; return regionInfo; } + } } diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index cad259d..35efa02 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1045,5 +1045,29 @@ namespace OpenSim.Framework return guid; } + + public static byte ConvertMaturityToAccessLevel(uint maturity) + { + byte retVal = 0; + switch (maturity) + { + case 0: //PG + retVal = 13; + break; + case 1: //Mature + retVal = 21; + break; + case 2: // Adult + retVal = 42; + break; + } + + return retVal; + + } + + + + } } diff --git a/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs b/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs index 87dafa4..14a328f 100644 --- a/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs +++ b/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs @@ -551,6 +551,19 @@ namespace OpenSim.Grid.GridServer.Modules sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/"; sim.regionName = (string)requestData["sim_name"]; + + + try + { + + sim.maturity = Convert.ToUInt32((string)requestData["maturity"]); + } + catch (KeyNotFoundException) + { + //older region not providing this key - so default to Mature + sim.maturity = 1; + } + return sim; } @@ -725,7 +738,7 @@ namespace OpenSim.Grid.GridServer.Modules simProfileBlock["y"] = aSim.regionLocY.ToString(); //m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.regionLocX, aSim.regionLocY); simProfileBlock["name"] = aSim.regionName; - simProfileBlock["access"] = 21; + simProfileBlock["access"] = aSim.AccessLevel; simProfileBlock["region-flags"] = 512; simProfileBlock["water-height"] = 0; simProfileBlock["agents"] = 1; @@ -760,7 +773,7 @@ namespace OpenSim.Grid.GridServer.Modules simProfileBlock["x"] = x; simProfileBlock["y"] = y; simProfileBlock["name"] = simProfile.regionName; - simProfileBlock["access"] = 0; + simProfileBlock["access"] = simProfile.AccessLevel; simProfileBlock["region-flags"] = 0; simProfileBlock["water-height"] = 20; simProfileBlock["agents"] = 1; diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs index 8adc599..3c1be0b 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs @@ -335,7 +335,7 @@ namespace OpenSim.Region.Communications.Hypergrid // m_log.Debug("ImgID: " + map.MapImageId); map.Agents = 1; map.RegionFlags = 72458694; - map.Access = 13; + map.Access = regInfo.AccessLevel; neighbours.Add(map); } } diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 2760b1e..50605e8 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -269,7 +269,7 @@ namespace OpenSim.Region.Communications.Local map.MapImageId = regInfo.RegionSettings.TerrainImageID; map.Agents = 1; map.RegionFlags = 72458694; - map.Access = 13; + map.Access = regInfo.AccessLevel; mapBlocks.Add(map); } } diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 3153435..4ffb36f 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -140,6 +140,8 @@ namespace OpenSim.Region.Communications.OGS1 else GridParams["master_avatar_uuid"] = regionInfo.EstateSettings.EstateOwner.ToString(); + GridParams["maturity"] = regionInfo.RegionSettings.Maturity.ToString(); + // Package into an XMLRPC Request ArrayList SendParams = new ArrayList(); SendParams.Add(GridParams); diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 5278b74..b14e38b 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -458,7 +458,19 @@ namespace OpenSim.Region.CoreModules.InterGrid responseMap["region_x"] = OSD.FromInteger(reg.RegionLocX * (uint)Constants.RegionSize); // LLX responseMap["region_y"] = OSD.FromInteger(reg.RegionLocY * (uint)Constants.RegionSize); // LLY responseMap["region_id"] = OSD.FromUUID(reg.originRegionID); - responseMap["sim_access"] = OSD.FromString((reg.RegionSettings.Maturity == 1) ? "Mature" : "PG"); + + if (reg.RegionSettings.Maturity == 1) + { + responseMap["sim_access"] = OSD.FromString("Mature"); + } + else if (reg.RegionSettings.Maturity == 2) + { + responseMap["sim_access"] = OSD.FromString("Adult"); + } + else + { + responseMap["sim_access"] = OSD.FromString("PG"); + } // Generate a dummy agent for the user so we can get back a CAPS path AgentCircuitData agentData = new AgentCircuitData(); diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 3bde967..4cfa194 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -114,8 +114,10 @@ namespace OpenSim.Region.CoreModules.World.Estate if (matureLevel <= 13) m_scene.RegionInfo.RegionSettings.Maturity = 0; - else + else if (matureLevel <= 21) m_scene.RegionInfo.RegionSettings.Maturity = 1; + else + m_scene.RegionInfo.RegionSettings.Maturity = 2; if (restrictPushObject) m_scene.RegionInfo.RegionSettings.RestrictPushing = true; @@ -580,11 +582,7 @@ namespace OpenSim.Region.CoreModules.World.Estate args.redirectGridX = m_scene.RegionInfo.EstateSettings.RedirectGridX; args.redirectGridY = m_scene.RegionInfo.EstateSettings.RedirectGridY; args.regionFlags = GetRegionFlags(); - byte mature = 13; - if (m_scene.RegionInfo.RegionSettings.Maturity == 1) - mature = 21; - args.simAccess = mature; - + args.simAccess = m_scene.RegionInfo.AccessLevel; args.sunHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition; args.terrainLowerLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit; args.terrainRaiseLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; @@ -730,12 +728,8 @@ namespace OpenSim.Region.CoreModules.World.Estate args.terrainHeightRange2 = (float)m_scene.RegionInfo.RegionSettings.Elevation2SE; args.terrainStartHeight3 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NE; args.terrainHeightRange3 = (float)m_scene.RegionInfo.RegionSettings.Elevation2NE; - byte mature = 13; - if (m_scene.RegionInfo.RegionSettings.Maturity == 1) - mature = 21; - args.simAccess = mature; + args.simAccess = m_scene.RegionInfo.AccessLevel; args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; - args.regionFlags = GetRegionFlags(); args.regionName = m_scene.RegionInfo.RegionName; if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 832b6cf..f4fe625 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -126,7 +126,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { data = new MapBlockData(); data.Agents = 0; - data.Access = 21; // TODO what's this? + data.Access = info.AccessLevel; data.MapImageId = info.RegionSettings.TerrainImageID; data.Name = info.RegionName; data.RegionFlags = 0; // TODO not used? diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f9feb7f..8102b2f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7995,6 +7995,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api reply = "PG"; else if (access == 1) reply = "MATURE"; + else if (access == 2) + reply = "ADULT"; else reply = "UNKNOWN"; break; -- cgit v1.1