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