Merge branch 'master' into careminster

avinationmerge
Melanie 2012-01-21 19:52:33 +00:00
commit ba3b0c69f1
22 changed files with 762 additions and 46 deletions

View File

@ -361,6 +361,8 @@ namespace OpenSim.Framework
public delegate void EstateChangeInfo(IClientAPI client, UUID invoice, UUID senderID, UInt32 param1, UInt32 param2); public delegate void EstateChangeInfo(IClientAPI client, UUID invoice, UUID senderID, UInt32 param1, UInt32 param2);
public delegate void EstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, UInt32 param1);
public delegate void RequestTerrain(IClientAPI remoteClient, string clientFileName); public delegate void RequestTerrain(IClientAPI remoteClient, string clientFileName);
public delegate void BakeTerrain(IClientAPI remoteClient); public delegate void BakeTerrain(IClientAPI remoteClient);
@ -774,6 +776,7 @@ namespace OpenSim.Framework
event ModifyTerrain OnModifyTerrain; event ModifyTerrain OnModifyTerrain;
event BakeTerrain OnBakeTerrain; event BakeTerrain OnBakeTerrain;
event EstateChangeInfo OnEstateChangeInfo; event EstateChangeInfo OnEstateChangeInfo;
event EstateManageTelehub OnEstateManageTelehub;
// [Obsolete("LLClientView Specific.")] // [Obsolete("LLClientView Specific.")]
event SetAppearance OnSetAppearance; event SetAppearance OnSetAppearance;
// [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")] // [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")]
@ -1149,6 +1152,8 @@ namespace OpenSim.Framework
void SendTaskInventory(UUID taskID, short serial, byte[] fileName); void SendTaskInventory(UUID taskID, short serial, byte[] fileName);
void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint);
/// <summary> /// <summary>
/// Used by the server to inform the client of new inventory items and folders. /// Used by the server to inform the client of new inventory items and folders.
/// </summary> /// </summary>

View File

@ -45,6 +45,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private const int IMAGE_PACKET_SIZE = 1000; private const int IMAGE_PACKET_SIZE = 1000;
private const int FIRST_PACKET_SIZE = 600; private const int FIRST_PACKET_SIZE = 600;
/// <summary>
/// If we've requested an asset but not received it in this ticks timeframe, then allow a duplicate
/// request from the client to trigger a fresh asset request.
/// </summary>
/// <remarks>
/// There are 10,000 ticks in a millisecond
/// </remarks>
private const int ASSET_REQUEST_TIMEOUT = 100000000;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public uint LastSequence; public uint LastSequence;
@ -57,8 +66,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public UUID AgentID; public UUID AgentID;
public IInventoryAccessModule InventoryAccessModule; public IInventoryAccessModule InventoryAccessModule;
private OpenJPEG.J2KLayerInfo[] m_layers; private OpenJPEG.J2KLayerInfo[] m_layers;
/// <summary>
/// Has this request decoded the asset data?
/// </summary>
public bool IsDecoded { get; private set; } public bool IsDecoded { get; private set; }
/// <summary>
/// Has this request received the required asset data?
/// </summary>
public bool HasAsset { get; private set; } public bool HasAsset { get; private set; }
/// <summary>
/// Time in milliseconds at which the asset was requested.
/// </summary>
public long AssetRequestTime { get; private set; }
public C5.IPriorityQueueHandle<J2KImage> PriorityQueueHandle; public C5.IPriorityQueueHandle<J2KImage> PriorityQueueHandle;
private uint m_currentPacket; private uint m_currentPacket;
@ -82,7 +105,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="packetsToSend">Maximum number of packets to send during this call</param> /// <param name="packetsToSend">Maximum number of packets to send during this call</param>
/// <param name="packetsSent">Number of packets sent during this call</param> /// <param name="packetsSent">Number of packets sent during this call</param>
/// <returns>True if the transfer completes at the current discard level, otherwise false</returns> /// <returns>True if the transfer completes at the current discard level, otherwise false</returns>
public bool SendPackets(LLClientView client, int packetsToSend, out int packetsSent) public bool SendPackets(IClientAPI client, int packetsToSend, out int packetsSent)
{ {
packetsSent = 0; packetsSent = 0;
@ -123,10 +146,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
if (!HasAsset) if (!HasAsset)
{ {
if (!m_assetRequested) if (!m_assetRequested || DateTime.UtcNow.Ticks > AssetRequestTime + ASSET_REQUEST_TIMEOUT)
{ {
// m_log.DebugFormat(
// "[J2KIMAGE]: Requesting asset {0} from request in packet {1}, already requested? {2}, due to timeout? {3}",
// TextureID, LastSequence, m_assetRequested, DateTime.UtcNow.Ticks > AssetRequestTime + ASSET_REQUEST_TIMEOUT);
m_assetRequested = true; m_assetRequested = true;
// m_log.DebugFormat("[J2KIMAGE]: Requesting asset {0}", TextureID); AssetRequestTime = DateTime.UtcNow.Ticks;
AssetService.Get(TextureID.ToString(), this, AssetReceived); AssetService.Get(TextureID.ToString(), this, AssetReceived);
} }
} }
@ -215,7 +243,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
private bool SendFirstPacket(LLClientView client) private bool SendFirstPacket(IClientAPI client)
{ {
if (client == null) if (client == null)
return false; return false;
@ -250,7 +278,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return false; return false;
} }
private bool SendPacket(LLClientView client) private bool SendPacket(IClientAPI client)
{ {
if (client == null) if (client == null)
return false; return false;
@ -380,6 +408,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void AssetReceived(string id, Object sender, AssetBase asset) private void AssetReceived(string id, Object sender, AssetBase asset)
{ {
// m_log.DebugFormat(
// "[J2KIMAGE]: Received asset {0} ({1} bytes)", id, asset != null ? asset.Data.Length.ToString() : "n/a");
UUID assetID = UUID.Zero; UUID assetID = UUID.Zero;
if (asset != null) if (asset != null)
{ {

View File

@ -220,6 +220,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event BakeTerrain OnBakeTerrain; public event BakeTerrain OnBakeTerrain;
public event RequestTerrain OnUploadTerrain; public event RequestTerrain OnUploadTerrain;
public event EstateChangeInfo OnEstateChangeInfo; public event EstateChangeInfo OnEstateChangeInfo;
public event EstateManageTelehub OnEstateManageTelehub;
public event EstateRestartSimRequest OnEstateRestartSimRequest; public event EstateRestartSimRequest OnEstateRestartSimRequest;
public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
@ -4537,6 +4538,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(packet, ThrottleOutPacketType.Task); OutPacket(packet, ThrottleOutPacketType.Task);
} }
public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
{
TelehubInfoPacket packet = (TelehubInfoPacket)PacketPool.Instance.GetPacket(PacketType.TelehubInfo);
packet.TelehubBlock.ObjectID = ObjectID;
packet.TelehubBlock.ObjectName = Utils.StringToBytes(ObjectName);
packet.TelehubBlock.TelehubPos = ObjectPos;
packet.TelehubBlock.TelehubRot = ObjectRot;
packet.SpawnPointBlock = new TelehubInfoPacket.SpawnPointBlockBlock[SpawnPoint.Count];
for (int n = 0; n < SpawnPoint.Count; n++)
{
packet.SpawnPointBlock[n] = new TelehubInfoPacket.SpawnPointBlockBlock{SpawnPointPos = SpawnPoint[n]};
}
OutPacket(packet, ThrottleOutPacketType.Task);
}
#endregion #endregion
#region Land Data Sending Methods #region Land Data Sending Methods
@ -8981,7 +8999,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack) private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack)
{ {
EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
//m_log.Debug(messagePacket.ToString()); // m_log.InfoFormat("[LLCLIENTVIEW]: Packet: {0}", Utils.BytesToString(messagePacket.MethodData.Method));
GodLandStatRequest handlerLandStatRequest; GodLandStatRequest handlerLandStatRequest;
#region Packet Session and User Check #region Packet Session and User Check
@ -9280,6 +9298,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
return true; return true;
case "telehub":
if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
{
UUID invoice = messagePacket.MethodData.Invoice;
UUID SenderID = messagePacket.AgentData.AgentID;
UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter);
EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub;
if (handlerEstateManageTelehub != null)
{
handlerEstateManageTelehub(this, invoice, SenderID, command, param1);
}
}
return true;
default: default:
m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket); m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket);
return true; return true;
@ -9291,8 +9326,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts
//lsrp.RequestData.RequestFlags; //lsrp.RequestData.RequestFlags;
//lsrp.RequestData.Filter; //lsrp.RequestData.Filter;
// return true;
} }
private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack)

View File

@ -55,18 +55,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_shuttingdown; private bool m_shuttingdown;
private AssetBase m_missingImage; private AssetBase m_missingImage;
private LLClientView m_client; //Client we're assigned to private IAssetService m_assetCache;
private IAssetService m_assetCache; //Asset Cache private IJ2KDecoder m_j2kDecodeModule;
private IJ2KDecoder m_j2kDecodeModule; //Our J2K module
/// <summary>
/// Priority queue for determining which image to send first.
/// </summary>
private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer()); private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
/// <summary>
/// Used to control thread access to the priority queue.
/// </summary>
private object m_syncRoot = new object(); private object m_syncRoot = new object();
public LLClientView Client { get { return m_client; } } /// <summary>
/// Client served by this image manager
/// </summary>
public IClientAPI Client { get; private set; }
public AssetBase MissingImage { get { return m_missingImage; } } public AssetBase MissingImage { get { return m_missingImage; } }
public LLImageManager(LLClientView client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule) public LLImageManager(IClientAPI client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule)
{ {
m_client = client; Client = client;
m_assetCache = pAssetCache; m_assetCache = pAssetCache;
if (pAssetCache != null) if (pAssetCache != null)
@ -111,8 +122,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", // "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}",
// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); // newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name);
//m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", // m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}",
// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
//Check the packet sequence to make sure this isn't older than //Check the packet sequence to make sure this isn't older than
//one we've already received //one we've already received
@ -178,8 +189,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
imgrequest = new J2KImage(this); imgrequest = new J2KImage(this);
imgrequest.J2KDecoder = m_j2kDecodeModule; imgrequest.J2KDecoder = m_j2kDecodeModule;
imgrequest.AssetService = m_assetCache; imgrequest.AssetService = m_assetCache;
imgrequest.AgentID = m_client.AgentId; imgrequest.AgentID = Client.AgentId;
imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>(); imgrequest.InventoryAccessModule = Client.Scene.RequestModuleInterface<IInventoryAccessModule>();
imgrequest.DiscardLevel = newRequest.DiscardLevel; imgrequest.DiscardLevel = newRequest.DiscardLevel;
imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber); imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
imgrequest.Priority = newRequest.Priority; imgrequest.Priority = newRequest.Priority;
@ -210,7 +221,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (image.IsDecoded) if (image.IsDecoded)
{ {
int sent; int sent;
bool imageDone = image.SendPackets(m_client, packetsToSend - packetsSent, out sent); bool imageDone = image.SendPackets(Client, packetsToSend - packetsSent, out sent);
packetsSent += sent; packetsSent += sent;
// If the send is complete, destroy any knowledge of this transfer // If the send is complete, destroy any knowledge of this transfer
@ -245,6 +256,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_shuttingdown = true; m_shuttingdown = true;
} }
/// <summary>
/// Clear the image queue.
/// </summary>
/// <returns>The number of requests cleared.</returns>
public int ClearImageQueue()
{
int requestsDeleted;
lock (m_priorityQueue)
{
requestsDeleted = m_priorityQueue.Count;
// Surprisingly, there doesn't seem to be a clear method at this time.
while (!m_priorityQueue.IsEmpty)
m_priorityQueue.DeleteMax();
}
return requestsDeleted;
}
/// <summary> /// <summary>
/// Returns an array containing all the images in the queue. /// Returns an array containing all the images in the queue.
/// </summary> /// </summary>

View File

@ -0,0 +1,160 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.IO;
using System.Net;
using System.Reflection;
using log4net.Config;
using Nini.Config;
using NUnit.Framework;
using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenSim.Framework;
using OpenSim.Region.CoreModules.Agent.TextureSender;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
namespace OpenSim.Region.ClientStack.LindenUDP.Tests
{
[TestFixture]
public class LLImageManagerTests
{
private AssetBase m_testImageAsset;
private Scene scene;
private LLImageManager llim;
private TestClient tc;
[TestFixtureSetUp]
public void FixtureInit()
{
using (
Stream resource
= GetType().Assembly.GetManifestResourceStream(
"OpenSim.Region.ClientStack.LindenUDP.Tests.Resources.4-tile2.jp2"))
{
using (BinaryReader br = new BinaryReader(resource))
{
m_testImageAsset
= new AssetBase(
TestHelpers.ParseTail(0x1),
"Test Image",
(sbyte)AssetType.Texture,
TestHelpers.ParseTail(0x2).ToString());
m_testImageAsset.Data = br.ReadBytes(99999999);
}
}
}
[SetUp]
public void SetUp()
{
UUID userId = TestHelpers.ParseTail(0x3);
J2KDecoderModule j2kdm = new J2KDecoderModule();
scene = SceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(scene, j2kdm);
tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
llim = new LLImageManager(tc, scene.AssetService, j2kdm);
}
[Test]
public void TestSendImage()
{
TestHelpers.InMethod();
// XmlConfigurator.Configure();
scene.AssetService.Store(m_testImageAsset);
TextureRequestArgs args = new TextureRequestArgs();
args.RequestedAssetID = m_testImageAsset.FullID;
args.DiscardLevel = 0;
args.PacketNumber = 1;
args.Priority = 5;
args.requestSequence = 1;
llim.EnqueueReq(args);
llim.ProcessImageQueue(20);
Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1));
}
[Test]
public void TestDiscardImage()
{
TestHelpers.InMethod();
// XmlConfigurator.Configure();
scene.AssetService.Store(m_testImageAsset);
TextureRequestArgs args = new TextureRequestArgs();
args.RequestedAssetID = m_testImageAsset.FullID;
args.DiscardLevel = 0;
args.PacketNumber = 1;
args.Priority = 5;
args.requestSequence = 1;
llim.EnqueueReq(args);
// Now create a discard request
TextureRequestArgs discardArgs = new TextureRequestArgs();
discardArgs.RequestedAssetID = m_testImageAsset.FullID;
discardArgs.DiscardLevel = -1;
discardArgs.PacketNumber = 1;
discardArgs.Priority = 0;
discardArgs.requestSequence = 2;
llim.EnqueueReq(discardArgs);
llim.ProcessImageQueue(20);
Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0));
}
[Test]
public void TestMissingImage()
{
TestHelpers.InMethod();
// XmlConfigurator.Configure();
TextureRequestArgs args = new TextureRequestArgs();
args.RequestedAssetID = m_testImageAsset.FullID;
args.DiscardLevel = 0;
args.PacketNumber = 1;
args.Priority = 5;
args.requestSequence = 1;
llim.EnqueueReq(args);
llim.ProcessImageQueue(20);
Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0));
Assert.That(tc.SentImageNotInDatabasePackets.Count, Is.EqualTo(1));
}
}
}

View File

@ -100,12 +100,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; }); options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; });
// Send a message to the region ready module // Send a message to the region ready module
/* bluewall* Disable this for the time being
IRegionReadyModule rready = m_scene.RequestModuleInterface<IRegionReadyModule>(); IRegionReadyModule rready = m_scene.RequestModuleInterface<IRegionReadyModule>();
if (rready != null) if (rready != null)
{ {
rready.OarLoadingAlert("load"); rready.OarLoadingAlert("load");
} }
*/
List<string> mainParams = options.Parse(cmdparams); List<string> mainParams = options.Parse(cmdparams);

View File

@ -344,7 +344,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
{ {
using (BinaryReader br = new BinaryReader(resource)) using (BinaryReader br = new BinaryReader(resource))
{ {
// FIXME: Use the inspector insteadthere are so many forums and lists already, though admittedly none of them are suitable for cross virtual-enivornemnt discussion // FIXME: Use the inspector instead
soundData = br.ReadBytes(99999999); soundData = br.ReadBytes(99999999);
UUID soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); UUID soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
string soundAssetFileName string soundAssetFileName

View File

@ -55,6 +55,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
protected EstateManagementCommands m_commands; protected EstateManagementCommands m_commands;
private EstateTerrainXferHandler TerrainUploader; private EstateTerrainXferHandler TerrainUploader;
private TelehubManager m_Telehub;
public event ChangeDelegate OnRegionInfoChange; public event ChangeDelegate OnRegionInfoChange;
public event ChangeDelegate OnEstateInfoChange; public event ChangeDelegate OnEstateInfoChange;
@ -614,6 +615,65 @@ namespace OpenSim.Region.CoreModules.World.Estate
} }
} }
private void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1)
{
uint ObjectLocalID;
SceneObjectPart part;
// UUID EstateID = Scene.RegionInfo.EstateSettings.EstateID;
TelehubManager.Telehub telehub;
switch (cmd)
{
case "info ui":
// Send info:
if (m_Telehub.HasTelehub)
{
telehub = m_Telehub.TelehubVals();
client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition,
telehub.ObjectRotation, telehub.SpawnPoint);
}
else
{
return;
}
break;
case "connect":
// Add the Telehub
part = Scene.GetSceneObjectPart((uint)param1);
telehub = m_Telehub.Connect(part);
client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition,
telehub.ObjectRotation, telehub.SpawnPoint);
break;
case "delete":
// Disconnect Telehub
part = Scene.GetSceneObjectPart((uint)param1);
telehub = m_Telehub.DisConnect(part);
client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition,
telehub.ObjectRotation, telehub.SpawnPoint);
break;
case "spawnpoint add":
// Add SpawnPoint to the Telehub
part = Scene.GetSceneObjectPart((uint)param1);
telehub = m_Telehub.AddSpawnPoint(part.AbsolutePosition);
client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition,
telehub.ObjectRotation, telehub.SpawnPoint);
break;
case "spawnpoint remove":
// Remove SpawnPoint from Telehub
telehub = m_Telehub.RemoveSpawnPoint((int)param1);
client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition,
telehub.ObjectRotation, telehub.SpawnPoint);
break;
default:
break;
}
}
private void SendSimulatorBlueBoxMessage( private void SendSimulatorBlueBoxMessage(
IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message)
{ {
@ -1084,7 +1144,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
Scene.RegisterModuleInterface<IEstateModule>(this); Scene.RegisterModuleInterface<IEstateModule>(this);
Scene.EventManager.OnNewClient += EventManager_OnNewClient; Scene.EventManager.OnNewClient += EventManager_OnNewClient;
Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
m_Telehub = new TelehubManager(scene);
m_commands = new EstateManagementCommands(this); m_commands = new EstateManagementCommands(this);
m_commands.Initialise(); m_commands.Initialise();
} }
@ -1138,6 +1200,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; client.OnEstateRestartSimRequest += handleEstateRestartSimRequest;
client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest;
client.OnEstateChangeInfo += handleEstateChangeInfo; client.OnEstateChangeInfo += handleEstateChangeInfo;
client.OnEstateManageTelehub += handleOnEstateManageTelehub;
client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest;
client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage;
client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage;

View File

@ -0,0 +1,130 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using OpenMetaverse;
using System.Collections.Generic;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.World.Estate
{
public class TelehubManager
{
public struct Telehub
{
public UUID ObjectID;
public string ObjectName;
public Vector3 ObjectPosition;
public Quaternion ObjectRotation;
public List<Vector3> SpawnPoint;
};
private UUID ObjectID;
private string ObjectName;
private Vector3 ObjectPosition;
Quaternion ObjectRotation;
List<Vector3> SpawnPoint = new List<Vector3>();
UUID EstateID;
bool m_HasTelehub = false;
Scene m_Scene;
// This will get an option...
Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,-3.0f);
public bool HasTelehub
{
get { return m_HasTelehub; }
}
public TelehubManager(Scene scene)
{
m_Scene = scene;
}
// Fill our Telehub struct with values
public Telehub TelehubVals()
{
Telehub telehub = new Telehub();
telehub.ObjectID = ObjectID;
telehub.ObjectName = ObjectName;
telehub.ObjectPosition = ObjectPosition;
telehub.ObjectRotation = ObjectRotation;
telehub.SpawnPoint = SpawnPoint;
return telehub;
}
// Connect the Telehub
public Telehub Connect(SceneObjectPart part)
{
ObjectID = part.UUID;
ObjectName = part.Name;
ObjectPosition = part.AbsolutePosition;
ObjectRotation = part.GetWorldRotation();
// Clear this for now
SpawnPoint.Clear();
SpawnPoint.Add(InitialSpawnPoint);
m_HasTelehub = true;
return TelehubVals();
}
// Disconnect the Telehub
public Telehub DisConnect(SceneObjectPart part)
{
ObjectID = UUID.Zero;
ObjectName = String.Empty;
ObjectPosition = Vector3.Zero;
ObjectRotation = Quaternion.Identity;
SpawnPoint.Clear();
m_HasTelehub = false;
return TelehubVals();
}
// Add a SpawnPoint to the Telehub
public Telehub AddSpawnPoint(Vector3 point)
{
float dist = (float) Util.GetDistanceTo(ObjectPosition, point);
Vector3 nvec = Util.GetNormalizedVector(point - ObjectPosition);
Vector3 spoint = nvec * dist;
SpawnPoint.Add(spoint);
return TelehubVals();
}
// Remove a SpawnPoint from the Telehub
public Telehub RemoveSpawnPoint(int spawnpoint)
{
SpawnPoint.RemoveAt(spawnpoint);
return TelehubVals();
}
}
}

View File

@ -658,6 +658,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public event ModifyTerrain OnModifyTerrain; public event ModifyTerrain OnModifyTerrain;
public event BakeTerrain OnBakeTerrain; public event BakeTerrain OnBakeTerrain;
public event EstateChangeInfo OnEstateChangeInfo; public event EstateChangeInfo OnEstateChangeInfo;
public event EstateManageTelehub OnEstateManageTelehub;
public event SetAppearance OnSetAppearance; public event SetAppearance OnSetAppearance;
public event AvatarNowWearing OnAvatarNowWearing; public event AvatarNowWearing OnAvatarNowWearing;
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
@ -1537,6 +1538,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
} }
public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
{
}
public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags) public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
{ {

View File

@ -79,7 +79,19 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
lock (m_scenes) lock (m_scenes)
m_scenes[scene.RegionInfo.RegionID] = scene; m_scenes[scene.RegionInfo.RegionID] = scene;
scene.AddCommand(
this, "image queues clear",
"image queues clear <first-name> <last-name>",
"Clear the image queues (textures downloaded via UDP) for a particular client.",
(mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd)));
scene.AddCommand(
this, "show image queues",
"image queues show <first-name> <last-name>",
"Show the image queues (textures downloaded via UDP) for a particular client.",
(mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd)));
scene.AddCommand( scene.AddCommand(
this, "show pqueues", this, "show pqueues",
@ -116,7 +128,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
"emergency-monitoring", "emergency-monitoring",
"Go on/off emergency monitoring mode", "Go on/off emergency monitoring mode",
"Go on/off emergency monitoring mode", "Go on/off emergency monitoring mode",
EmergencyMonitoring); HandleEmergencyMonitoring);
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
@ -132,7 +144,49 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
} }
protected void EmergencyMonitoring(string module, string[] cmd) protected string HandleImageQueuesClear(string[] cmd)
{
if (cmd.Length != 5)
return "Usage: image queues clear <first-name> <last-name>";
string firstName = cmd[3];
string lastName = cmd[4];
List<ScenePresence> foundAgents = new List<ScenePresence>();
lock (m_scenes)
{
foreach (Scene scene in m_scenes.Values)
{
ScenePresence sp = scene.GetScenePresence(firstName, lastName);
if (sp != null)
foundAgents.Add(sp);
}
}
if (foundAgents.Count == 0)
return string.Format("No agents found for {0} {1}", firstName, lastName);
StringBuilder report = new StringBuilder();
foreach (ScenePresence agent in foundAgents)
{
LLClientView client = agent.ControllingClient as LLClientView;
if (client == null)
return "This command is only supported for LLClientView";
int requestsDeleted = client.ImageManager.ClearImageQueue();
report.AppendFormat(
"In region {0} ({1} agent) cleared {2} requests\n",
agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root", requestsDeleted);
}
return report.ToString();
}
protected void HandleEmergencyMonitoring(string module, string[] cmd)
{ {
bool mode = true; bool mode = true;
if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on")) if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on"))
@ -239,10 +293,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
private string GetImageQueuesReport(string[] showParams) private string GetImageQueuesReport(string[] showParams)
{ {
if (showParams.Length < 5 || showParams.Length > 6) if (showParams.Length < 5 || showParams.Length > 6)
{ return "Usage: show image queues <first-name> <last-name> [full]";
MainConsole.Instance.OutputFormat("Usage: show image queues <first-name> <last-name> [full]");
return "";
}
string firstName = showParams[3]; string firstName = showParams[3];
string lastName = showParams[4]; string lastName = showParams[4];
@ -262,10 +313,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
} }
if (foundAgents.Count == 0) if (foundAgents.Count == 0)
{ return string.Format("No agents found for {0} {1}", firstName, lastName);
MainConsole.Instance.OutputFormat("No agents found for {0} {1}", firstName, lastName);
return "";
}
StringBuilder report = new StringBuilder(); StringBuilder report = new StringBuilder();
@ -274,10 +322,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
LLClientView client = agent.ControllingClient as LLClientView; LLClientView client = agent.ControllingClient as LLClientView;
if (client == null) if (client == null)
{ return "This command is only supported for LLClientView";
MainConsole.Instance.OutputFormat("This command is only supported for LLClientView");
return "";
}
J2KImage[] images = client.ImageManager.GetImages(); J2KImage[] images = client.ImageManager.GetImages();

View File

@ -243,6 +243,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
public void OarLoadingAlert(string msg) public void OarLoadingAlert(string msg)
{ {
// Let's bypass this for now until some better feedback can be established
//
return;
if (msg == "load") if (msg == "load")
{ {
m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
@ -251,7 +255,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.EventManager.OnRezScript += OnRezScript; m_scene.EventManager.OnRezScript += OnRezScript;
m_oarFileLoading = true; m_oarFileLoading = true;
m_firstEmptyCompileQueue = true; m_firstEmptyCompileQueue = true;
// Will need some controls around this
m_scene.LoginsDisabled = true; m_scene.LoginsDisabled = true;
m_scene.LoginLock = true; m_scene.LoginLock = true;
if ( m_uri != string.Empty ) if ( m_uri != string.Empty )

View File

@ -32,6 +32,7 @@ using OpenMetaverse;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.CoreModules.World.Estate;
namespace OpenSim.Region.OptionalModules.World.NPC namespace OpenSim.Region.OptionalModules.World.NPC
{ {
@ -334,6 +335,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest; public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
public event EstateChangeInfo OnEstateChangeInfo; public event EstateChangeInfo OnEstateChangeInfo;
public event EstateManageTelehub OnEstateManageTelehub;
public event ScriptReset OnScriptReset; public event ScriptReset OnScriptReset;
public event GetScriptRunning OnGetScriptRunning; public event GetScriptRunning OnGetScriptRunning;
public event SetScriptRunning OnSetScriptRunning; public event SetScriptRunning OnSetScriptRunning;
@ -927,6 +929,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public void SendEstateCovenantInformation(UUID covenant) public void SendEstateCovenantInformation(UUID covenant)
{ {
} }
public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
{
}
public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
{ {
} }

View File

@ -1953,6 +1953,69 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
private enum InfoType
{
Nick,
Name,
Login,
Home,
Custom
};
private string GridUserInfo(InfoType type)
{
return GridUserInfo(type, "");
}
private string GridUserInfo(InfoType type, string key)
{
string retval = String.Empty;
IConfigSource config = m_ScriptEngine.ConfigSource;
string url = config.Configs["GridInfo"].GetString("GridInfoURI", String.Empty);
if (String.IsNullOrEmpty(url))
return "Configuration Error!";
string verb ="/json_grid_info";
OSDMap json = new OSDMap();
OSDMap info = WebUtil.GetFromService(String.Format("{0}{1}",url,verb), 3000);
if (info["Success"] != true)
return "Get GridInfo Failed!";
json = (OSDMap)OSDParser.DeserializeJson(info["_RawResult"].AsString());
switch (type)
{
case InfoType.Nick:
retval = json["gridnick"];
break;
case InfoType.Name:
retval = json["gridname"];
break;
case InfoType.Login:
retval = json["login"];
break;
case InfoType.Home:
retval = json["home"];
break;
case InfoType.Custom:
retval = json[key];
break;
default:
retval = "error";
break;
}
return retval;
}
/// <summary> /// <summary>
/// Get the nickname of this grid, as set in the [GridInfo] config section. /// Get the nickname of this grid, as set in the [GridInfo] config section.
/// </summary> /// </summary>
@ -1966,10 +2029,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
string nick = "hippogrid";
string nick = String.Empty;
IConfigSource config = m_ScriptEngine.ConfigSource; IConfigSource config = m_ScriptEngine.ConfigSource;
if (config.Configs["GridInfo"] != null) if (config.Configs["GridInfo"] != null)
nick = config.Configs["GridInfo"].GetString("gridnick", nick); nick = config.Configs["GridInfo"].GetString("gridnick", nick);
if (String.IsNullOrEmpty(nick))
nick = GridUserInfo(InfoType.Nick);
return nick; return nick;
} }
@ -1977,10 +2046,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridName"); CheckThreatLevel(ThreatLevel.Moderate, "osGetGridName");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
string name = "the lost continent of hippo";
string name = String.Empty;
IConfigSource config = m_ScriptEngine.ConfigSource; IConfigSource config = m_ScriptEngine.ConfigSource;
if (config.Configs["GridInfo"] != null) if (config.Configs["GridInfo"] != null)
name = config.Configs["GridInfo"].GetString("gridname", name); name = config.Configs["GridInfo"].GetString("gridname", name);
if (String.IsNullOrEmpty(name))
name = GridUserInfo(InfoType.Name);
return name; return name;
} }
@ -1988,13 +2063,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI"); CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
string loginURI = "http://127.0.0.1:9000/";
string loginURI = String.Empty;
IConfigSource config = m_ScriptEngine.ConfigSource; IConfigSource config = m_ScriptEngine.ConfigSource;
if (config.Configs["GridInfo"] != null) if (config.Configs["GridInfo"] != null)
loginURI = config.Configs["GridInfo"].GetString("login", loginURI); loginURI = config.Configs["GridInfo"].GetString("login", loginURI);
if (String.IsNullOrEmpty(loginURI))
loginURI = GridUserInfo(InfoType.Login);
return loginURI; return loginURI;
} }
public string osGetGridHomeURI()
{
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI");
m_host.AddScriptLPS(1);
string HomeURI = String.Empty;
IConfigSource config = m_ScriptEngine.ConfigSource;
if (config.Configs["LoginService"] != null)
HomeURI = config.Configs["LoginService"].GetString("SRV_HomeURI", HomeURI);
if (String.IsNullOrEmpty(HomeURI))
HomeURI = GridUserInfo(InfoType.Home);
return HomeURI;
}
public string osGetGridCustom(string key)
{
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom");
m_host.AddScriptLPS(1);
string retval = String.Empty;
IConfigSource config = m_ScriptEngine.ConfigSource;
if (config.Configs["GridInfo"] != null)
retval = config.Configs["GridInfo"].GetString(key, retval);
if (String.IsNullOrEmpty(retval))
retval = GridUserInfo(InfoType.Custom, key);
return retval;
}
public LSL_String osFormatString(string str, LSL_List strings) public LSL_String osFormatString(string str, LSL_List strings)
{ {
CheckThreatLevel(ThreatLevel.Low, "osFormatString"); CheckThreatLevel(ThreatLevel.Low, "osFormatString");

View File

@ -160,6 +160,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
string osGetGridNick(); string osGetGridNick();
string osGetGridName(); string osGetGridName();
string osGetGridLoginURI(); string osGetGridLoginURI();
string osGetGridHomeURI();
string osGetGridCustom(string key);
LSL_String osFormatString(string str, LSL_List strings); LSL_String osFormatString(string str, LSL_List strings);
LSL_List osMatchString(string src, string pattern, int start); LSL_List osMatchString(string src, string pattern, int start);

View File

@ -452,6 +452,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osGetGridLoginURI(); return m_OSSL_Functions.osGetGridLoginURI();
} }
public string osGetGridHomeURI()
{
return m_OSSL_Functions.osGetGridHomeURI();
}
public string osGetGridCustom(string key)
{
return m_OSSL_Functions.osGetGridCustom(key);
}
public LSL_String osFormatString(string str, LSL_List strings) public LSL_String osFormatString(string str, LSL_List strings)
{ {
return m_OSSL_Functions.osFormatString(str, strings); return m_OSSL_Functions.osFormatString(str, strings);

View File

@ -37,13 +37,14 @@ using Nini.Config;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse.StructuredData;
namespace OpenSim.Server.Handlers.Grid namespace OpenSim.Server.Handlers.Grid
{ {
public class GridInfoHandlers public class GridInfoHandlers
{ {
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IConfigSource m_Config;
private Hashtable _info = new Hashtable(); private Hashtable _info = new Hashtable();
/// <summary> /// <summary>
@ -59,6 +60,7 @@ namespace OpenSim.Server.Handlers.Grid
/// </remarks> /// </remarks>
public GridInfoHandlers(IConfigSource configSource) public GridInfoHandlers(IConfigSource configSource)
{ {
m_Config = configSource;
loadGridInfo(configSource); loadGridInfo(configSource);
} }
@ -142,5 +144,53 @@ namespace OpenSim.Server.Handlers.Grid
return sb.ToString(); return sb.ToString();
} }
/// <summary>
/// Get GridInfo in json format: Used bu the OSSL osGetGrid*
/// Adding the SRV_HomeIRI to the kvp returned for use in scripts
/// </summary>
/// <returns>
/// json string
/// </returns>
/// <param name='request'>
/// Request.
/// </param>
/// <param name='path'>
/// /json_grid_info
/// </param>
/// <param name='param'>
/// Parameter.
/// </param>
/// <param name='httpRequest'>
/// Http request.
/// </param>
/// <param name='httpResponse'>
/// Http response.
/// </param>
public string JsonGetGridInfoMethod(string request, string path, string param,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
string HomeURI = String.Empty;
IConfig cfg = m_Config.Configs["LoginService"];
if (null != cfg)
{
HomeURI = cfg.GetString("SRV_HomeURI", HomeURI);
}
OSDMap map = new OSDMap();
foreach (string k in _info.Keys)
{
map[k] = OSD.FromString(_info[k].ToString());
}
if (!String.IsNullOrEmpty(HomeURI))
{
map["home"] = OSD.FromString(HomeURI);
}
return OSDParser.SerializeJsonString(map).ToString();
}
} }
} }

View File

@ -48,6 +48,8 @@ namespace OpenSim.Server.Handlers.Grid
server.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", server.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info",
handlers.RestGetGridInfoMethod)); handlers.RestGetGridInfoMethod));
server.AddStreamHandler(new RestStreamHandler("GET", "/json_grid_info",
handlers.JsonGetGridInfoMethod));
server.AddXmlRPCHandler("get_grid_info", handlers.XmlRpcGridInfoMethod); server.AddXmlRPCHandler("get_grid_info", handlers.XmlRpcGridInfoMethod);
} }

View File

@ -44,9 +44,6 @@ namespace OpenSim.Tests.Common.Mock
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// Mock testing variables
public List<ImageDataPacket> sentdatapkt = new List<ImageDataPacket>();
public List<ImagePacketPacket> sentpktpkt = new List<ImagePacketPacket>();
EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
// TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup // TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup
@ -61,6 +58,10 @@ namespace OpenSim.Tests.Common.Mock
public List<UUID> ReceivedOnlineNotifications { get; private set; } public List<UUID> ReceivedOnlineNotifications { get; private set; }
public List<UUID> ReceivedFriendshipTerminations { get; private set; } public List<UUID> ReceivedFriendshipTerminations { get; private set; }
public List<ImageDataPacket> SentImageDataPackets { get; private set; }
public List<ImagePacketPacket> SentImagePacketPackets { get; private set; }
public List<ImageNotInDatabasePacket> SentImageNotInDatabasePackets { get; private set; }
// disable warning: public events, part of the public API // disable warning: public events, part of the public API
#pragma warning disable 67 #pragma warning disable 67
@ -193,6 +194,7 @@ namespace OpenSim.Tests.Common.Mock
public event RegionInfoRequest OnRegionInfoRequest; public event RegionInfoRequest OnRegionInfoRequest;
public event EstateCovenantRequest OnEstateCovenantRequest; public event EstateCovenantRequest OnEstateCovenantRequest;
public event EstateChangeInfo OnEstateChangeInfo; public event EstateChangeInfo OnEstateChangeInfo;
public event EstateManageTelehub OnEstateManageTelehub;
public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
@ -453,6 +455,10 @@ namespace OpenSim.Tests.Common.Mock
ReceivedOfflineNotifications = new List<UUID>(); ReceivedOfflineNotifications = new List<UUID>();
ReceivedOnlineNotifications = new List<UUID>(); ReceivedOnlineNotifications = new List<UUID>();
ReceivedFriendshipTerminations = new List<UUID>(); ReceivedFriendshipTerminations = new List<UUID>();
SentImageDataPackets = new List<ImageDataPacket>();
SentImagePacketPackets = new List<ImagePacketPacket>();
SentImageNotInDatabasePackets = new List<ImageNotInDatabasePacket>();
} }
/// <summary> /// <summary>
@ -805,7 +811,7 @@ namespace OpenSim.Tests.Common.Mock
im.ImageData.Data = ImageData; im.ImageData.Data = ImageData;
im.ImageID.Codec = imageCodec; im.ImageID.Codec = imageCodec;
im.Header.Zerocoded = true; im.Header.Zerocoded = true;
sentdatapkt.Add(im); SentImageDataPackets.Add(im);
} }
public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData) public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData)
@ -815,11 +821,15 @@ namespace OpenSim.Tests.Common.Mock
im.ImageID.Packet = partNumber; im.ImageID.Packet = partNumber;
im.ImageID.ID = imageUuid; im.ImageID.ID = imageUuid;
im.ImageData.Data = imageData; im.ImageData.Data = imageData;
sentpktpkt.Add(im); SentImagePacketPackets.Add(im);
} }
public void SendImageNotFound(UUID imageid) public void SendImageNotFound(UUID imageid)
{ {
ImageNotInDatabasePacket p = new ImageNotInDatabasePacket();
p.ImageID.ID = imageid;
SentImageNotInDatabasePackets.Add(p);
} }
public void SendShutdownConnectionNotice() public void SendShutdownConnectionNotice()
@ -947,6 +957,10 @@ namespace OpenSim.Tests.Common.Mock
{ {
} }
public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
{
}
public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{ {
} }

View File

@ -58,6 +58,12 @@
; ;
InventoryServerURI = "http://mygridserver.com:8003" InventoryServerURI = "http://mygridserver.com:8003"
[GridInfo]
;
; Change this to your grid info service
;
GridInfoURI = "http://mygridserver.com:8002"
[GridService] [GridService]
; ;
; Change this to your grid-wide grid server ; Change this to your grid-wide grid server

View File

@ -3196,12 +3196,14 @@
<Reference name="OpenSim.Framework.Statistics"/> <Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.ClientStack"/> <Reference name="OpenSim.Region.ClientStack"/>
<Reference name="OpenSim.Region.ClientStack.LindenUDP"/> <Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
<Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Services.Interfaces"/> <Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Tests.Common"/> <Reference name="OpenSim.Tests.Common"/>
<Files> <Files>
<Match pattern="*.cs" recurse="false"/> <Match pattern="*.cs" recurse="false"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*"/>
</Files> </Files>
</Project> </Project>