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 // World Map Addition
UUID.TryParse((string)reader["regionMapTexture"], out retval.regionMapTextureID); UUID.TryParse((string)reader["regionMapTexture"], out retval.regionMapTextureID);
UUID.TryParse((string)reader["owner_uuid"], out retval.owner_uuid); UUID.TryParse((string)reader["owner_uuid"], out retval.owner_uuid);
retval.maturity = Convert.ToUInt32(reader["access"]);
} }
else 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, // 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 // as well as the related parameterization
sql += 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 += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, ";
sql += sql +=
"?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, ";
sql += 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) if (GRID_ONLY_UPDATE_NECESSARY_DATA)
{ {
@ -1023,6 +1024,7 @@ namespace OpenSim.Data.MySQL
parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString(); parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString();
parameters["?owner_uuid"] = regiondata.owner_uuid.ToString(); parameters["?owner_uuid"] = regiondata.owner_uuid.ToString();
parameters["?originUUID"] = regiondata.originUUID.ToString(); parameters["?originUUID"] = regiondata.originUUID.ToString();
parameters["?access"] = regiondata.maturity.ToString();
bool returnval = false; 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> /// </summary>
public UUID originUUID; public UUID originUUID;
/// <summary>
/// The Maturity rating of the region
/// </summary>
public uint maturity;
//Data Wrappers //Data Wrappers
public string RegionName public string RegionName
@ -279,6 +284,17 @@ namespace OpenSim.Data
get { return originUUID; } get { return originUUID; }
set { originUUID = value; } set { originUUID = value; }
} }
public uint Maturity
{
get { return maturity; }
set { maturity = value; }
}
public byte AccessLevel
{
get { return Util.ConvertMaturityToAccessLevel(maturity); }
}
public RegionInfo ToRegionInfo() public RegionInfo ToRegionInfo()
{ {
@ -295,10 +311,10 @@ namespace OpenSim.Data
return Create(regionInfo.RegionID, regionInfo.RegionName, regionInfo.RegionLocX, return Create(regionInfo.RegionID, regionInfo.RegionName, regionInfo.RegionLocX,
regionInfo.RegionLocY, regionInfo.ExternalHostName, regionInfo.RegionLocY, regionInfo.ExternalHostName,
(uint) regionInfo.ExternalEndPoint.Port, regionInfo.HttpPort, regionInfo.RemotingPort, (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; RegionProfileData regionProfile;
regionProfile = new RegionProfileData(); regionProfile = new RegionProfileData();
@ -315,6 +331,7 @@ namespace OpenSim.Data
regionProfile.httpServerURI = "http://" + externalHostName + ":" + httpPort + "/"; regionProfile.httpServerURI = "http://" + externalHostName + ":" + httpPort + "/";
regionProfile.UUID = regionID; regionProfile.UUID = regionID;
regionProfile.regionName = regionName; regionProfile.regionName = regionName;
regionProfile.maturity = access;
return regionProfile; return regionProfile;
} }
} }

View File

@ -65,8 +65,9 @@ namespace OpenSim.Data
string serverUri = (string)responseData["server_uri"]; string serverUri = (string)responseData["server_uri"];
UUID regionID = new UUID((string)responseData["region_UUID"]); UUID regionID = new UUID((string)responseData["region_UUID"]);
string regionName = (string)responseData["region_name"]; 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; return simData;

View File

@ -334,6 +334,11 @@ namespace OpenSim.Framework
get { return m_objectCapacity; } get { return m_objectCapacity; }
} }
public byte AccessLevel
{
get { return (byte)Util.ConvertMaturityToAccessLevel((uint)m_regionSettings.Maturity); }
}
public void SetEndPoint(string ipaddr, int port) public void SetEndPoint(string ipaddr, int port)
{ {
IPAddress tmpIP = IPAddress.Parse(ipaddr); IPAddress tmpIP = IPAddress.Parse(ipaddr);
@ -691,5 +696,6 @@ namespace OpenSim.Framework
regionInfo.ServerURI = serverURI; regionInfo.ServerURI = serverURI;
return regionInfo; return regionInfo;
} }
} }
} }

View File

@ -1045,5 +1045,29 @@ namespace OpenSim.Framework
return guid; 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.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/";
sim.regionName = (string)requestData["sim_name"]; 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; return sim;
} }
@ -725,7 +738,7 @@ namespace OpenSim.Grid.GridServer.Modules
simProfileBlock["y"] = aSim.regionLocY.ToString(); simProfileBlock["y"] = aSim.regionLocY.ToString();
//m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.regionLocX, aSim.regionLocY); //m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.regionLocX, aSim.regionLocY);
simProfileBlock["name"] = aSim.regionName; simProfileBlock["name"] = aSim.regionName;
simProfileBlock["access"] = 21; simProfileBlock["access"] = aSim.AccessLevel;
simProfileBlock["region-flags"] = 512; simProfileBlock["region-flags"] = 512;
simProfileBlock["water-height"] = 0; simProfileBlock["water-height"] = 0;
simProfileBlock["agents"] = 1; simProfileBlock["agents"] = 1;
@ -760,7 +773,7 @@ namespace OpenSim.Grid.GridServer.Modules
simProfileBlock["x"] = x; simProfileBlock["x"] = x;
simProfileBlock["y"] = y; simProfileBlock["y"] = y;
simProfileBlock["name"] = simProfile.regionName; simProfileBlock["name"] = simProfile.regionName;
simProfileBlock["access"] = 0; simProfileBlock["access"] = simProfile.AccessLevel;
simProfileBlock["region-flags"] = 0; simProfileBlock["region-flags"] = 0;
simProfileBlock["water-height"] = 20; simProfileBlock["water-height"] = 20;
simProfileBlock["agents"] = 1; simProfileBlock["agents"] = 1;

View File

@ -335,7 +335,7 @@ namespace OpenSim.Region.Communications.Hypergrid
// m_log.Debug("ImgID: " + map.MapImageId); // m_log.Debug("ImgID: " + map.MapImageId);
map.Agents = 1; map.Agents = 1;
map.RegionFlags = 72458694; map.RegionFlags = 72458694;
map.Access = 13; map.Access = regInfo.AccessLevel;
neighbours.Add(map); neighbours.Add(map);
} }
} }

View File

@ -269,7 +269,7 @@ namespace OpenSim.Region.Communications.Local
map.MapImageId = regInfo.RegionSettings.TerrainImageID; map.MapImageId = regInfo.RegionSettings.TerrainImageID;
map.Agents = 1; map.Agents = 1;
map.RegionFlags = 72458694; map.RegionFlags = 72458694;
map.Access = 13; map.Access = regInfo.AccessLevel;
mapBlocks.Add(map); mapBlocks.Add(map);
} }
} }

View File

@ -140,6 +140,8 @@ namespace OpenSim.Region.Communications.OGS1
else else
GridParams["master_avatar_uuid"] = regionInfo.EstateSettings.EstateOwner.ToString(); GridParams["master_avatar_uuid"] = regionInfo.EstateSettings.EstateOwner.ToString();
GridParams["maturity"] = regionInfo.RegionSettings.Maturity.ToString();
// Package into an XMLRPC Request // Package into an XMLRPC Request
ArrayList SendParams = new ArrayList(); ArrayList SendParams = new ArrayList();
SendParams.Add(GridParams); 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_x"] = OSD.FromInteger(reg.RegionLocX * (uint)Constants.RegionSize); // LLX
responseMap["region_y"] = OSD.FromInteger(reg.RegionLocY * (uint)Constants.RegionSize); // LLY responseMap["region_y"] = OSD.FromInteger(reg.RegionLocY * (uint)Constants.RegionSize); // LLY
responseMap["region_id"] = OSD.FromUUID(reg.originRegionID); 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 // Generate a dummy agent for the user so we can get back a CAPS path
AgentCircuitData agentData = new AgentCircuitData(); AgentCircuitData agentData = new AgentCircuitData();

View File

@ -114,8 +114,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
if (matureLevel <= 13) if (matureLevel <= 13)
m_scene.RegionInfo.RegionSettings.Maturity = 0; m_scene.RegionInfo.RegionSettings.Maturity = 0;
else else if (matureLevel <= 21)
m_scene.RegionInfo.RegionSettings.Maturity = 1; m_scene.RegionInfo.RegionSettings.Maturity = 1;
else
m_scene.RegionInfo.RegionSettings.Maturity = 2;
if (restrictPushObject) if (restrictPushObject)
m_scene.RegionInfo.RegionSettings.RestrictPushing = true; m_scene.RegionInfo.RegionSettings.RestrictPushing = true;
@ -580,11 +582,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
args.redirectGridX = m_scene.RegionInfo.EstateSettings.RedirectGridX; args.redirectGridX = m_scene.RegionInfo.EstateSettings.RedirectGridX;
args.redirectGridY = m_scene.RegionInfo.EstateSettings.RedirectGridY; args.redirectGridY = m_scene.RegionInfo.EstateSettings.RedirectGridY;
args.regionFlags = GetRegionFlags(); args.regionFlags = GetRegionFlags();
byte mature = 13; args.simAccess = m_scene.RegionInfo.AccessLevel;
if (m_scene.RegionInfo.RegionSettings.Maturity == 1)
mature = 21;
args.simAccess = mature;
args.sunHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition; args.sunHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition;
args.terrainLowerLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit; args.terrainLowerLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit;
args.terrainRaiseLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; 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.terrainHeightRange2 = (float)m_scene.RegionInfo.RegionSettings.Elevation2SE;
args.terrainStartHeight3 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NE; args.terrainStartHeight3 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NE;
args.terrainHeightRange3 = (float)m_scene.RegionInfo.RegionSettings.Elevation2NE; args.terrainHeightRange3 = (float)m_scene.RegionInfo.RegionSettings.Elevation2NE;
byte mature = 13; args.simAccess = m_scene.RegionInfo.AccessLevel;
if (m_scene.RegionInfo.RegionSettings.Maturity == 1)
mature = 21;
args.simAccess = mature;
args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;
args.regionFlags = GetRegionFlags(); args.regionFlags = GetRegionFlags();
args.regionName = m_scene.RegionInfo.RegionName; args.regionName = m_scene.RegionInfo.RegionName;
if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)

View File

@ -126,7 +126,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{ {
data = new MapBlockData(); data = new MapBlockData();
data.Agents = 0; data.Agents = 0;
data.Access = 21; // TODO what's this? data.Access = info.AccessLevel;
data.MapImageId = info.RegionSettings.TerrainImageID; data.MapImageId = info.RegionSettings.TerrainImageID;
data.Name = info.RegionName; data.Name = info.RegionName;
data.RegionFlags = 0; // TODO not used? data.RegionFlags = 0; // TODO not used?

View File

@ -7995,6 +7995,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
reply = "PG"; reply = "PG";
else if (access == 1) else if (access == 1)
reply = "MATURE"; reply = "MATURE";
else if (access == 2)
reply = "ADULT";
else else
reply = "UNKNOWN"; reply = "UNKNOWN";
break; break;