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.
0.6.5-rc1
Charles Krinke 2009-05-12 03:30:37 +00:00
parent 16efb78698
commit c1d680b6c3
14 changed files with 100 additions and 22 deletions

View File

@ -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;

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE regions add column access integer unsigned default 1;
COMMIT;

View File

@ -131,6 +131,11 @@ namespace OpenSim.Data
/// </summary>
public UUID originUUID;
/// <summary>
/// The Maturity rating of the region
/// </summary>
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;
}
}

View File

@ -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;

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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();

View File

@ -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)

View File

@ -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?

View File

@ -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;