mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
merge issue
This commit is contained in:
@@ -41,6 +41,7 @@ using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Region.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Framework.Servers;
|
||||
@@ -89,23 +90,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_Scene;
|
||||
private UUID m_AgentID;
|
||||
private Caps m_HostCapsObj;
|
||||
private ModelCost m_ModelCost;
|
||||
|
||||
private static readonly string m_requestPath = "0000/";
|
||||
// private static readonly string m_mapLayerPath = "0001/";
|
||||
private static readonly string m_newInventory = "0002/";
|
||||
//private static readonly string m_requestTexture = "0003/";
|
||||
private static readonly string m_notecardUpdatePath = "0004/";
|
||||
private static readonly string m_notecardTaskUpdatePath = "0005/";
|
||||
// private static readonly string m_fetchInventoryPath = "0006/";
|
||||
private static readonly string m_copyFromNotecardPath = "0007/";
|
||||
// private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
|
||||
private static readonly string m_getObjectPhysicsDataPath = "0101/";
|
||||
private static readonly string m_getObjectCostPath = "0102/";
|
||||
private static readonly string m_ResourceCostSelectedPath = "0103/";
|
||||
private static readonly string m_UpdateAgentInformationPath = "0500/";
|
||||
private static readonly string m_animSetTaskUpdatePath = "0260/";
|
||||
|
||||
// These are callbacks which will be setup by the scene so that we can update scene data when we
|
||||
// receive capability calls
|
||||
@@ -134,6 +123,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
private float m_PrimScaleMin = 0.001f;
|
||||
|
||||
private bool m_AllowCapHomeLocation = true;
|
||||
private bool m_AllowCapGroupMemberData = true;
|
||||
|
||||
private enum FileAgentInventoryState : int
|
||||
{
|
||||
idle = 0,
|
||||
@@ -143,27 +135,16 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
private FileAgentInventoryState m_FileAgentInventoryState = FileAgentInventoryState.idle;
|
||||
|
||||
public BunchOfCaps(Scene scene, Caps caps)
|
||||
public BunchOfCaps(Scene scene, UUID agentID, Caps caps)
|
||||
{
|
||||
m_Scene = scene;
|
||||
m_AgentID = agentID;
|
||||
m_HostCapsObj = caps;
|
||||
|
||||
// create a model upload cost provider
|
||||
m_ModelCost = new ModelCost();
|
||||
// tell it about scene object limits
|
||||
m_ModelCost.NonPhysicalPrimScaleMax = m_Scene.m_maxNonphys;
|
||||
m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys;
|
||||
m_ModelCost.ObjectLinkedPartsMax = m_Scene.m_linksetCapacity;
|
||||
|
||||
// m_ModelCost.ObjectLinkedPartsMax = ??
|
||||
// m_ModelCost.PrimScaleMin = ??
|
||||
|
||||
m_ModelCost = new ModelCost(scene);
|
||||
|
||||
m_PrimScaleMin = m_ModelCost.PrimScaleMin;
|
||||
float modelTextureUploadFactor = m_ModelCost.ModelTextureCostFactor;
|
||||
float modelUploadFactor = m_ModelCost.ModelMeshCostFactor;
|
||||
float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor;
|
||||
float modelPrimCreationCost = m_ModelCost.primCreationCost;
|
||||
float modelMeshByteCost = m_ModelCost.bytecost;
|
||||
|
||||
IConfigSource config = m_Scene.Config;
|
||||
if (config != null)
|
||||
@@ -183,12 +164,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
IConfig EconomyConfig = config.Configs["Economy"];
|
||||
if (EconomyConfig != null)
|
||||
{
|
||||
modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor);
|
||||
modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor);
|
||||
modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor);
|
||||
// next 2 are normalized so final cost is afected by modelUploadFactor above and normal cost
|
||||
modelPrimCreationCost = EconomyConfig.GetFloat("ModelPrimCreationCost", modelPrimCreationCost);
|
||||
modelMeshByteCost = EconomyConfig.GetFloat("ModelMeshByteCost", modelMeshByteCost);
|
||||
m_ModelCost.Econfig(EconomyConfig);
|
||||
|
||||
m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", m_enableModelUploadTextureToInventory);
|
||||
|
||||
@@ -203,12 +179,18 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
if (id != null)
|
||||
m_testAssetsCreatorID = id;
|
||||
}
|
||||
}
|
||||
|
||||
m_ModelCost.ModelMeshCostFactor = modelUploadFactor;
|
||||
m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor;
|
||||
m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor;
|
||||
m_ModelCost.primCreationCost = modelPrimCreationCost;
|
||||
m_ModelCost.bytecost = modelMeshByteCost;
|
||||
IConfig CapsConfig = config.Configs["ClientStack.LindenCaps"];
|
||||
if (CapsConfig != null)
|
||||
{
|
||||
string homeLocationUrl = CapsConfig.GetString("Cap_HomeLocation", "localhost");
|
||||
if(homeLocationUrl == String.Empty)
|
||||
m_AllowCapHomeLocation = false;
|
||||
|
||||
string GroupMemberDataUrl = CapsConfig.GetString("Cap_GroupMemberData", "localhost");
|
||||
if(GroupMemberDataUrl == String.Empty)
|
||||
m_AllowCapGroupMemberData = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,51 +207,71 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_FileAgentInventoryState = FileAgentInventoryState.idle;
|
||||
}
|
||||
|
||||
public string GetNewCapPath()
|
||||
{
|
||||
return "/CAPS/" + UUID.Random();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register a bunch of CAPS http service handlers
|
||||
/// </summary>
|
||||
public void RegisterHandlers()
|
||||
{
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
// this path is also defined elsewhere so keeping it
|
||||
string seedcapsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath +"0000/";
|
||||
|
||||
RegisterRegionServiceHandlers(capsBase);
|
||||
RegisterInventoryServiceHandlers(capsBase);
|
||||
// the root of all evil path needs to be capsBase + m_requestPath
|
||||
m_HostCapsObj.RegisterHandler(
|
||||
"SEED", new RestStreamHandler("POST", seedcapsBase, SeedCapRequest, "SEED", null));
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[CAPS]: Registered seed capability {0} for {1}", seedcapsBase, m_HostCapsObj.AgentID);
|
||||
|
||||
RegisterRegionServiceHandlers();
|
||||
RegisterInventoryServiceHandlers();
|
||||
}
|
||||
|
||||
public void RegisterRegionServiceHandlers(string capsBase)
|
||||
public void RegisterRegionServiceHandlers()
|
||||
{
|
||||
try
|
||||
{
|
||||
// the root of all evil
|
||||
m_HostCapsObj.RegisterHandler(
|
||||
"SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest, "SEED", null));
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID);
|
||||
|
||||
//m_capsHandlers["MapLayer"] =
|
||||
// new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
|
||||
// capsBase + m_mapLayerPath,
|
||||
// GetNewCapPath(),
|
||||
// GetMapLayer);
|
||||
|
||||
IRequestHandler getObjectPhysicsDataHandler
|
||||
= new RestStreamHandler(
|
||||
"POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null);
|
||||
IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler(
|
||||
"POST", GetNewCapPath(), GetObjectPhysicsData, "GetObjectPhysicsData", null);
|
||||
m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
|
||||
|
||||
IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost);
|
||||
IRequestHandler getObjectCostHandler = new RestStreamHandler(
|
||||
"POST", GetNewCapPath(), GetObjectCost, "GetObjectCost", null );
|
||||
m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler);
|
||||
IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected);
|
||||
|
||||
IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler(
|
||||
"POST", GetNewCapPath(), ResourceCostSelected, "ResourceCostSelected", null);
|
||||
m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler);
|
||||
|
||||
|
||||
IRequestHandler req
|
||||
= new RestStreamHandler(
|
||||
"POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null);
|
||||
|
||||
IRequestHandler req = new RestStreamHandler(
|
||||
"POST", GetNewCapPath(), ScriptTaskInventory, "UpdateScript", null);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptTask", req);
|
||||
|
||||
if(m_AllowCapHomeLocation)
|
||||
{
|
||||
IRequestHandler HomeLocationHandler = new RestStreamHandler(
|
||||
"POST", GetNewCapPath(), HomeLocation, "HomeLocation", null);
|
||||
m_HostCapsObj.RegisterHandler("HomeLocation", HomeLocationHandler);
|
||||
}
|
||||
|
||||
if(m_AllowCapGroupMemberData)
|
||||
{
|
||||
IRequestHandler GroupMemberDataHandler = new RestStreamHandler(
|
||||
"POST", GetNewCapPath(), GroupMemberData, "GroupMemberData", null);
|
||||
m_HostCapsObj.RegisterHandler("GroupMemberData", GroupMemberDataHandler);
|
||||
}
|
||||
|
||||
|
||||
// IRequestHandler animSetRequestHandler
|
||||
// = new RestStreamHandler(
|
||||
// "POST", capsBase + m_animSetTaskUpdatePath, AnimSetTaskInventory, "UpdateScript", null);
|
||||
@@ -282,65 +284,29 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterInventoryServiceHandlers(string capsBase)
|
||||
public void RegisterInventoryServiceHandlers()
|
||||
{
|
||||
try
|
||||
{
|
||||
m_HostCapsObj.RegisterHandler(
|
||||
"NewFileAgentInventory",
|
||||
m_HostCapsObj.RegisterHandler("NewFileAgentInventory",
|
||||
new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>(
|
||||
"POST",
|
||||
capsBase + m_newInventory,
|
||||
NewAgentInventoryRequest,
|
||||
"NewFileAgentInventory",
|
||||
null));
|
||||
|
||||
IRequestHandler req
|
||||
= new RestStreamHandler(
|
||||
"POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory, "Update*", null);
|
||||
"POST", GetNewCapPath(), NewAgentInventoryRequest, "NewFileAgentInventory", null));
|
||||
|
||||
IRequestHandler req = new RestStreamHandler(
|
||||
"POST", GetNewCapPath(), NoteCardAgentInventory, "Update*", null);
|
||||
m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateAnimSetAgentInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
|
||||
|
||||
|
||||
|
||||
IRequestHandler UpdateAgentInformationHandler
|
||||
= new RestStreamHandler(
|
||||
"POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation, "UpdateAgentInformation", null);
|
||||
IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler(
|
||||
"POST", GetNewCapPath(), UpdateAgentInformation, "UpdateAgentInformation", null);
|
||||
m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler);
|
||||
|
||||
m_HostCapsObj.RegisterHandler(
|
||||
"CopyInventoryFromNotecard",
|
||||
new RestStreamHandler(
|
||||
"POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard, "CopyInventoryFromNotecard", null));
|
||||
IRequestHandler CopyInventoryFromNotecardHandler = new RestStreamHandler(
|
||||
"POST", GetNewCapPath(), CopyInventoryFromNotecard, "CopyInventoryFromNotecard", null);
|
||||
m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", CopyInventoryFromNotecardHandler);
|
||||
|
||||
// As of RC 1.22.9 of the Linden client this is
|
||||
// supported
|
||||
|
||||
//m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest);
|
||||
|
||||
// justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and
|
||||
// subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires
|
||||
// enhancements (probably filling out the folder part of the LLSD reply) to our CAPS service,
|
||||
// but when I went on the Linden grid, the
|
||||
// simulators I visited (version 1.21) were, surprisingly, no longer supplying this capability. Instead,
|
||||
// the 1.19.1.4 client appeared to be happily flowing inventory data over UDP
|
||||
//
|
||||
// This is very probably just a temporary measure - once the CAPS service appears again on the Linden grid
|
||||
// we will be
|
||||
// able to get the data we need to implement the necessary part of the protocol to fix the issue above.
|
||||
// m_capsHandlers["FetchInventoryDescendents"] =
|
||||
// new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryRequest);
|
||||
|
||||
// m_capsHandlers["FetchInventoryDescendents"] =
|
||||
// new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST",
|
||||
// capsBase + m_fetchInventory,
|
||||
// FetchInventory));
|
||||
// m_capsHandlers["RequestTextureDownload"] = new RestStreamHandler("POST",
|
||||
// capsBase + m_requestTexture,
|
||||
// RequestTexture);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -409,30 +375,28 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate();
|
||||
LLSDHelpers.DeserialiseOSDMap(hash, llsdUpdateRequest);
|
||||
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
string uploaderPath = GetNewCapPath();
|
||||
|
||||
TaskInventoryScriptUpdater uploader =
|
||||
new TaskInventoryScriptUpdater(
|
||||
llsdUpdateRequest.item_id,
|
||||
llsdUpdateRequest.task_id,
|
||||
llsdUpdateRequest.is_script_running,
|
||||
capsBase + uploaderPath,
|
||||
uploaderPath,
|
||||
m_HostCapsObj.HttpListener,
|
||||
m_dumpAssetsToFile);
|
||||
uploader.OnUpLoad += TaskScriptUpdated;
|
||||
|
||||
m_HostCapsObj.HttpListener.AddStreamHandler(
|
||||
new BinaryStreamHandler(
|
||||
"POST", capsBase + uploaderPath, uploader.uploaderCaps, "TaskInventoryScriptUpdater", null));
|
||||
"POST", uploaderPath, uploader.uploaderCaps, "TaskInventoryScriptUpdater", null));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
if (m_HostCapsObj.SSLCaps)
|
||||
protocol = "https://";
|
||||
|
||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase +
|
||||
uploaderPath;
|
||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + uploaderPath;
|
||||
|
||||
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
|
||||
uploadResponse.uploader = uploaderURL;
|
||||
@@ -653,11 +617,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
|
||||
string assetDes = llsdRequest.description;
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
UUID newAsset = UUID.Random();
|
||||
UUID newInvItem = UUID.Random();
|
||||
UUID parentFolder = llsdRequest.folder_id;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
string uploaderPath = GetNewCapPath();
|
||||
UUID texturesFolder = UUID.Zero;
|
||||
|
||||
if(!IsAtestUpload && m_enableModelUploadTextureToInventory)
|
||||
@@ -665,26 +628,23 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
AssetUploader uploader =
|
||||
new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
|
||||
llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost,
|
||||
llsdRequest.asset_type, uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost,
|
||||
texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload,
|
||||
llsdRequest.next_owner_mask, llsdRequest.group_mask, llsdRequest.everyone_mask);
|
||||
|
||||
m_HostCapsObj.HttpListener.AddStreamHandler(
|
||||
new BinaryStreamHandler(
|
||||
"POST",
|
||||
capsBase + uploaderPath,
|
||||
uploaderPath,
|
||||
uploader.uploaderCaps,
|
||||
"NewAgentInventoryRequest",
|
||||
m_HostCapsObj.AgentID.ToString()));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
if (m_HostCapsObj.SSLCaps)
|
||||
protocol = "https://";
|
||||
|
||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase +
|
||||
uploaderPath;
|
||||
|
||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + uploaderPath;
|
||||
|
||||
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
|
||||
uploadResponse.uploader = uploaderURL;
|
||||
@@ -1313,24 +1273,22 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
|
||||
LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest);
|
||||
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
string uploaderPath = GetNewCapPath();
|
||||
|
||||
ItemUpdater uploader =
|
||||
new ItemUpdater(llsdRequest.item_id, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile);
|
||||
new ItemUpdater(llsdRequest.item_id, uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile);
|
||||
uploader.OnUpLoad += ItemUpdated;
|
||||
|
||||
m_HostCapsObj.HttpListener.AddStreamHandler(
|
||||
new BinaryStreamHandler(
|
||||
"POST", capsBase + uploaderPath, uploader.uploaderCaps, "NoteCardAgentInventory", null));
|
||||
"POST", uploaderPath, uploader.uploaderCaps, "NoteCardAgentInventory", null));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
if (m_HostCapsObj.SSLCaps)
|
||||
protocol = "https://";
|
||||
|
||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase +
|
||||
uploaderPath;
|
||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + uploaderPath;
|
||||
|
||||
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
|
||||
uploadResponse.uploader = uploaderURL;
|
||||
@@ -1576,6 +1534,266 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
string response = OSDParser.SerializeLLSDXmlString(resp);
|
||||
return response;
|
||||
}
|
||||
|
||||
public bool OSDMapTOVector3(OSDMap map, out Vector3 v)
|
||||
{
|
||||
v = Vector3.Zero;
|
||||
if(!map.ContainsKey("X"))
|
||||
return false;
|
||||
if(!map.ContainsKey("Y"))
|
||||
return false;
|
||||
if(!map.ContainsKey("Z"))
|
||||
return false;
|
||||
v.X = (float)map["X"].AsReal();
|
||||
v.Y = (float)map["Y"].AsReal();
|
||||
v.Z = (float)map["Z"].AsReal();
|
||||
return true;
|
||||
}
|
||||
|
||||
public string HomeLocation(string request, string path, string param, IOSHttpRequest httpRequest,
|
||||
IOSHttpResponse httpResponse)
|
||||
{
|
||||
OSDMap resp = new OSDMap();
|
||||
|
||||
resp["success"] = "false";
|
||||
|
||||
|
||||
bool fail = true;
|
||||
string message = "Set Home request failed";
|
||||
int locationID = 1;
|
||||
Vector3 pos = Vector3.Zero;
|
||||
Vector3 lookAt = Vector3.Zero;
|
||||
|
||||
IClientAPI client = null;
|
||||
ScenePresence sp;
|
||||
|
||||
while(true)
|
||||
{
|
||||
if(m_Scene.GridUserService == null)
|
||||
break;
|
||||
|
||||
if(m_Scene.UserManagementModule == null)
|
||||
break;
|
||||
|
||||
m_Scene.TryGetScenePresence(m_AgentID, out sp);
|
||||
if(sp == null || sp.IsChildAgent || sp.IsDeleted || sp.IsInTransit)
|
||||
break;
|
||||
|
||||
client = sp.ControllingClient;
|
||||
|
||||
if(!m_Scene.UserManagementModule.IsLocalGridUser(m_AgentID))
|
||||
break;
|
||||
|
||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
if(!req.ContainsKey("HomeLocation"))
|
||||
break;
|
||||
|
||||
OSDMap HLocation = (OSDMap)req["HomeLocation"];
|
||||
if(!HLocation.ContainsKey("LocationPos"))
|
||||
break;
|
||||
if(!HLocation.ContainsKey("LocationLookAt"))
|
||||
break;
|
||||
|
||||
locationID = HLocation["LocationId"].AsInteger();
|
||||
|
||||
if(!OSDMapTOVector3((OSDMap)HLocation["LocationPos"], out pos))
|
||||
break;
|
||||
|
||||
if(!OSDMapTOVector3((OSDMap)HLocation["LocationLookAt"], out lookAt))
|
||||
break;
|
||||
|
||||
ILandObject land = m_Scene.LandChannel.GetLandObject(pos);
|
||||
if(land == null)
|
||||
break;
|
||||
|
||||
ulong gpowers = client.GetGroupPowers(land.LandData.GroupID);
|
||||
SceneObjectGroup telehub = null;
|
||||
if (m_Scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero)
|
||||
// Does the telehub exist in the scene?
|
||||
telehub = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject);
|
||||
|
||||
if (!m_Scene.Permissions.IsAdministrator(m_AgentID) && // (a) gods and land managers can set home
|
||||
!m_Scene.Permissions.IsGod(m_AgentID) &&
|
||||
m_AgentID != land.LandData.OwnerID && // (b) land owners can set home
|
||||
// (c) members of the land-associated group in roles that can set home
|
||||
((gpowers & (ulong)GroupPowers.AllowSetHome) != (ulong)GroupPowers.AllowSetHome) &&
|
||||
// (d) parcels with telehubs can be the home of anyone
|
||||
(telehub == null || !land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y)))
|
||||
{
|
||||
message = "You are not allowed to set your home location in this parcel.";
|
||||
break;
|
||||
}
|
||||
|
||||
string userId;
|
||||
UUID test;
|
||||
if (!m_Scene.UserManagementModule.GetUserUUI(m_AgentID, out userId))
|
||||
{
|
||||
message = "Set Home request failed. (User Lookup)";
|
||||
break;
|
||||
}
|
||||
|
||||
if (!UUID.TryParse(userId, out test))
|
||||
{
|
||||
message = "Set Home request failed. (HG visitor)";
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_Scene.GridUserService.SetHome(userId, land.RegionUUID, pos, lookAt))
|
||||
fail = false;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
string response;
|
||||
|
||||
if(fail)
|
||||
{
|
||||
if(client != null)
|
||||
client.SendAlertMessage(message, "HomePositionSet");
|
||||
response = OSDParser.SerializeLLSDXmlString(resp);
|
||||
return response;
|
||||
}
|
||||
|
||||
// so its http but still needs a udp reply to inform user? crap :p
|
||||
if(client != null)
|
||||
client.SendAlertMessage("Home position set.","HomePositionSet");
|
||||
|
||||
resp["success"] = "true";
|
||||
OSDMap homeloc = new OSDMap();
|
||||
OSDMap homelocpos = new OSDMap();
|
||||
// for some odd reason viewers send pos as reals but read as integer
|
||||
homelocpos["X"] = new OSDReal(pos.X);
|
||||
homelocpos["Y"] = new OSDReal(pos.Y);
|
||||
homelocpos["Z"] = new OSDReal(pos.Z);
|
||||
homeloc["LocationPos"] = homelocpos;
|
||||
|
||||
resp["HomeLocation"] = homeloc;
|
||||
|
||||
response = OSDParser.SerializeLLSDXmlString(resp);
|
||||
return response;
|
||||
}
|
||||
|
||||
private static int CompareRolesByMembersDesc(GroupRolesData x, GroupRolesData y)
|
||||
{
|
||||
return -(x.Members.CompareTo(y.Members));
|
||||
}
|
||||
|
||||
public string GroupMemberData(string request, string path, string param, IOSHttpRequest httpRequest,
|
||||
IOSHttpResponse httpResponse)
|
||||
{
|
||||
OSDMap resp = new OSDMap();
|
||||
|
||||
string response;
|
||||
|
||||
bool fail = true;
|
||||
IClientAPI client = null;
|
||||
ScenePresence sp;
|
||||
IGroupsModule m_GroupsModule;
|
||||
UUID groupID = UUID.Zero;
|
||||
|
||||
while(true)
|
||||
{
|
||||
m_GroupsModule = m_Scene.RequestModuleInterface<IGroupsModule>();
|
||||
if(m_GroupsModule == null)
|
||||
break;
|
||||
|
||||
m_Scene.TryGetScenePresence(m_AgentID, out sp);
|
||||
if(sp == null || sp.IsChildAgent || sp.IsDeleted || sp.IsInTransit)
|
||||
break;
|
||||
|
||||
client = sp.ControllingClient;
|
||||
|
||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
if(!req.ContainsKey("group_id"))
|
||||
break;
|
||||
|
||||
groupID = req["group_id"].AsUUID();
|
||||
if(groupID == UUID.Zero)
|
||||
break;
|
||||
|
||||
List<GroupRolesData> roles = m_GroupsModule.GroupRoleDataRequest(client, groupID);
|
||||
if(roles == null || roles.Count == 0)
|
||||
break;
|
||||
|
||||
List<GroupMembersData> members = m_GroupsModule.GroupMembersRequest(client, groupID);
|
||||
if(members == null || members.Count == 0)
|
||||
break;
|
||||
|
||||
int memberCount = members.Count;
|
||||
|
||||
Dictionary<string,int> titles = new Dictionary<string,int>();
|
||||
int i = 0;
|
||||
|
||||
ulong defaultPowers = 0;
|
||||
|
||||
|
||||
// build titles array and index
|
||||
roles.Sort(CompareRolesByMembersDesc);
|
||||
|
||||
OSDArray osdtitles = new OSDArray();
|
||||
foreach(GroupRolesData grd in roles)
|
||||
{
|
||||
if(grd.Title == null)
|
||||
continue;
|
||||
string title = grd.Title;
|
||||
if(i==0)
|
||||
defaultPowers = grd.Powers;
|
||||
|
||||
if(!titles.ContainsKey(title))
|
||||
{
|
||||
titles[title] = i++;
|
||||
osdtitles.Add(new OSDString(title));
|
||||
}
|
||||
}
|
||||
|
||||
if(titles.Count == 0)
|
||||
break;
|
||||
|
||||
OSDMap osdmembers = new OSDMap();
|
||||
foreach(GroupMembersData gmd in members)
|
||||
{
|
||||
OSDMap m = new OSDMap();
|
||||
if(gmd.OnlineStatus != null && gmd.OnlineStatus != "")
|
||||
m["last_login"] = new OSDString(gmd.OnlineStatus);
|
||||
if(gmd.AgentPowers != defaultPowers)
|
||||
m["powers"] = new OSDString((gmd.AgentPowers).ToString("X"));
|
||||
if(gmd.Title != null && titles.ContainsKey(gmd.Title) && titles[gmd.Title] != 0)
|
||||
m["title"] = new OSDInteger(titles[gmd.Title]);
|
||||
if(gmd.IsOwner)
|
||||
m["owner"] = new OSDString("true");
|
||||
if(gmd.Contribution != 0)
|
||||
m["donated_square_meters"] = new OSDInteger(gmd.Contribution);
|
||||
|
||||
osdmembers[(gmd.AgentID).ToString()] = m;
|
||||
}
|
||||
|
||||
OSDMap osddefaults = new OSDMap();
|
||||
osddefaults["default_powers"] = new OSDString(defaultPowers.ToString("X"));
|
||||
|
||||
resp["group_id"] = new OSDUUID(groupID);
|
||||
resp["agent_id"] = new OSDUUID(m_AgentID);
|
||||
resp["member_count"] = new OSDInteger(memberCount);
|
||||
resp["defaults"] = osddefaults;
|
||||
resp["titles"] = osdtitles;
|
||||
resp["members"] = osdmembers;
|
||||
|
||||
fail = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(fail)
|
||||
{
|
||||
resp["group_id"] = new OSDUUID(groupID);
|
||||
resp["agent_id"] = new OSDUUID(m_AgentID);
|
||||
resp["member_count"] = new OSDInteger(0);
|
||||
resp["defaults"] = new OSDMap();
|
||||
resp["titles"] = new OSDArray();
|
||||
resp["members"] = new OSDMap();
|
||||
}
|
||||
|
||||
response = OSDParser.SerializeLLSDXmlString(resp);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
public class AssetUploader
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
private void OnRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
new BunchOfCaps(m_Scene, caps);
|
||||
new BunchOfCaps(m_Scene, agentID, caps);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ using ComponentAce.Compression.Libs.zlib;
|
||||
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
public struct ModelPrimLimits
|
||||
@@ -100,6 +102,25 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
public float PhysicalPrimScaleMax = 10f;
|
||||
public int ObjectLinkedPartsMax = 512;
|
||||
|
||||
|
||||
public ModelCost(Scene scene)
|
||||
{
|
||||
PrimScaleMin = scene.m_minNonphys;
|
||||
NonPhysicalPrimScaleMax = scene.m_maxNonphys;
|
||||
PhysicalPrimScaleMax = scene.m_maxPhys;
|
||||
ObjectLinkedPartsMax = scene.m_linksetCapacity;
|
||||
}
|
||||
|
||||
public void Econfig(IConfig EconomyConfig)
|
||||
{
|
||||
ModelMeshCostFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", ModelMeshCostFactor);
|
||||
ModelTextureCostFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", ModelTextureCostFactor);
|
||||
ModelMinCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", ModelMinCostFactor);
|
||||
// next 2 are normalized so final cost is afected by modelUploadFactor above and normal cost
|
||||
primCreationCost = EconomyConfig.GetFloat("ModelPrimCreationCost", primCreationCost);
|
||||
bytecost = EconomyConfig.GetFloat("ModelMeshByteCost", bytecost);
|
||||
}
|
||||
|
||||
// storage for a single mesh asset cost parameters
|
||||
private class ameshCostParam
|
||||
{
|
||||
|
||||
@@ -577,6 +577,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
//m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item);
|
||||
}
|
||||
|
||||
public void ChatterBoxForceClose(UUID toAgent, UUID sessionID, string reason)
|
||||
{
|
||||
OSD item = EventQueueHelper.ChatterBoxForceClose(sessionID, reason);
|
||||
|
||||
Enqueue(item, toAgent);
|
||||
}
|
||||
|
||||
public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
|
||||
{
|
||||
OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
|
||||
|
||||
@@ -342,6 +342,18 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
return chatterBoxSessionAgentListUpdates;
|
||||
}
|
||||
|
||||
public static OSD ChatterBoxForceClose(UUID sessionID, string reason)
|
||||
{
|
||||
OSDMap body = new OSDMap(2);
|
||||
body.Add("session_id", new OSDUUID(sessionID));
|
||||
body.Add("reason", new OSDString(reason));
|
||||
|
||||
OSDMap chatterBoxForceClose = new OSDMap(2);
|
||||
chatterBoxForceClose.Add("message", new OSDString("ForceCloseChatterBoxSession"));
|
||||
chatterBoxForceClose.Add("body", body);
|
||||
return chatterBoxForceClose;
|
||||
}
|
||||
|
||||
public static OSD GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data)
|
||||
{
|
||||
OSDArray AgentData = new OSDArray(1);
|
||||
|
||||
@@ -1711,11 +1711,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
public void SendKillObject(List<uint> localIDs)
|
||||
{
|
||||
// think we do need this
|
||||
// foreach (uint id in localIDs)
|
||||
// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle);
|
||||
|
||||
// remove pending entities
|
||||
// remove pending entities to reduce looping chances.
|
||||
lock (m_entityProps.SyncRoot)
|
||||
m_entityProps.Remove(localIDs);
|
||||
lock (m_entityUpdates.SyncRoot)
|
||||
@@ -2412,6 +2411,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
OutPacket(alertPack, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
public void SendAlertMessage(string message, string info)
|
||||
{
|
||||
AlertMessagePacket alertPack = (AlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AlertMessage);
|
||||
alertPack.AlertData = new AlertMessagePacket.AlertDataBlock();
|
||||
alertPack.AlertData.Message = Util.StringToBytes256(message);
|
||||
alertPack.AlertInfo = new AlertMessagePacket.AlertInfoBlock[1];
|
||||
alertPack.AlertInfo[0] = new AlertMessagePacket.AlertInfoBlock();
|
||||
alertPack.AlertInfo[0].Message = Util.StringToBytes256(info);
|
||||
alertPack.AlertInfo[0].ExtraParams = new Byte[0];
|
||||
OutPacket(alertPack, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send an agent alert message to the client.
|
||||
/// </summary>
|
||||
@@ -4007,7 +4018,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
bool doCulling = m_scene.ObjectsCullingByDistance;
|
||||
float cullingrange = 64.0f;
|
||||
HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>();
|
||||
List<SceneObjectGroup> kills = new List<SceneObjectGroup>();
|
||||
// Vector3 mycamera = Vector3.Zero;
|
||||
Vector3 mypos = Vector3.Zero;
|
||||
ScenePresence mysp = (ScenePresence)SceneAgent;
|
||||
@@ -4047,8 +4057,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// Don't send updates for objects that have been marked deleted.
|
||||
// Instead send another kill object, because the first one may have gotten
|
||||
// into a race condition
|
||||
if (!m_killRecord.Contains(grp.LocalId))
|
||||
if (part == grp.RootPart && !m_killRecord.Contains(grp.LocalId))
|
||||
{
|
||||
m_killRecord.Add(grp.LocalId);
|
||||
maxUpdatesBytes -= 30;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -4336,16 +4349,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_killRecord.Clear();
|
||||
}
|
||||
|
||||
if (kills.Count > 0)
|
||||
{
|
||||
foreach(SceneObjectGroup grp in kills)
|
||||
{
|
||||
foreach(SceneObjectPart p in grp.Parts)
|
||||
SendEntityUpdate(p,PrimUpdateFlags.Kill);
|
||||
}
|
||||
kills.Clear();
|
||||
}
|
||||
|
||||
if(GroupsNeedFullUpdate.Count > 0)
|
||||
{
|
||||
foreach(SceneObjectGroup grp in GroupsNeedFullUpdate)
|
||||
@@ -4471,12 +4474,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
if (kills.Count > 0)
|
||||
{
|
||||
List<uint> partIDs = new List<uint>();
|
||||
foreach(SceneObjectGroup grp in kills)
|
||||
{
|
||||
SendEntityUpdate(grp.RootPart,PrimUpdateFlags.Kill);
|
||||
foreach(SceneObjectPart p in grp.Parts)
|
||||
SendEntityUpdate(p,PrimUpdateFlags.Kill);
|
||||
{
|
||||
if(p != grp.RootPart)
|
||||
partIDs.Add(p.LocalId);
|
||||
}
|
||||
}
|
||||
kills.Clear();
|
||||
if(partIDs.Count > 0)
|
||||
{
|
||||
lock (m_entityProps.SyncRoot)
|
||||
m_entityProps.Remove(partIDs);
|
||||
lock (m_entityUpdates.SyncRoot)
|
||||
m_entityUpdates.Remove(partIDs);
|
||||
}
|
||||
}
|
||||
|
||||
if(GroupsNeedFullUpdate.Count > 0)
|
||||
@@ -11418,12 +11433,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_GroupsModule.GroupMembersRequest(this, groupMembersRequestPacket.GroupData.GroupID);
|
||||
|
||||
int memberCount = members.Count;
|
||||
|
||||
while (true)
|
||||
int indx = 0;
|
||||
while (indx < memberCount)
|
||||
{
|
||||
int blockCount = members.Count;
|
||||
if (blockCount > 40)
|
||||
blockCount = 40;
|
||||
int blockCount = memberCount - indx;
|
||||
if (blockCount > 25)
|
||||
blockCount = 25;
|
||||
|
||||
GroupMembersReplyPacket groupMembersReply = (GroupMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupMembersReply);
|
||||
|
||||
@@ -11444,8 +11459,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
for (int i = 0; i < blockCount; i++)
|
||||
{
|
||||
GroupMembersData m = members[0];
|
||||
members.RemoveAt(0);
|
||||
GroupMembersData m = members[indx++];
|
||||
|
||||
groupMembersReply.MemberData[i] =
|
||||
new GroupMembersReplyPacket.MemberDataBlock();
|
||||
@@ -11463,8 +11477,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m.IsOwner;
|
||||
}
|
||||
OutPacket(groupMembersReply, ThrottleOutPacketType.Task);
|
||||
if (members.Count == 0)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user