* Cruft removal step #1. Cleaning Modules directory.
parent
3da6a05eaa
commit
be20f41637
|
@ -37,24 +37,27 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetDownload
|
|||
{
|
||||
public class AssetDownloadModule : IRegionModule
|
||||
{
|
||||
private Scene m_scene;
|
||||
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
|
||||
///
|
||||
/// Assets requests (for each user) which are waiting for asset server data. This includes texture requests
|
||||
/// </summary>
|
||||
private Dictionary<LLUUID, Dictionary<LLUUID,AssetRequest>> RequestedAssets;
|
||||
|
||||
/// <summary>
|
||||
/// Asset requests with data which are ready to be sent back to requesters. This includes textures.
|
||||
/// </summary>
|
||||
private List<AssetRequest> AssetRequests;
|
||||
|
||||
private Scene m_scene;
|
||||
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
|
||||
|
||||
///
|
||||
/// Assets requests (for each user) which are waiting for asset server data. This includes texture requests
|
||||
/// </summary>
|
||||
private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> RequestedAssets;
|
||||
|
||||
public AssetDownloadModule()
|
||||
{
|
||||
RequestedAssets = new Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>>();
|
||||
AssetRequests = new List<AssetRequest>();
|
||||
}
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||
|
@ -92,6 +95,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetDownload
|
|||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void NewClient(IClientAPI client)
|
||||
{
|
||||
// client.OnRequestAsset += AddAssetRequest;
|
||||
|
@ -308,26 +313,30 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetDownload
|
|||
return numPackets;
|
||||
}
|
||||
|
||||
#region Nested type: AssetRequest
|
||||
|
||||
public class AssetRequest
|
||||
{
|
||||
public IClientAPI RequestUser;
|
||||
public LLUUID RequestAssetID;
|
||||
public AssetBase AssetInf;
|
||||
public AssetBase ImageInfo;
|
||||
public LLUUID TransferRequestID;
|
||||
public byte AssetRequestSource = 2;
|
||||
public long DataPointer = 0;
|
||||
public int DiscardLevel = -1;
|
||||
public AssetBase ImageInfo;
|
||||
public bool IsTextureRequest;
|
||||
public int NumPackets = 0;
|
||||
public int PacketCounter = 0;
|
||||
public bool IsTextureRequest;
|
||||
public byte AssetRequestSource = 2;
|
||||
public byte[] Params = null;
|
||||
public LLUUID RequestAssetID;
|
||||
public IClientAPI RequestUser;
|
||||
public LLUUID TransferRequestID;
|
||||
//public bool AssetInCache;
|
||||
//public int TimeRequested;
|
||||
public int DiscardLevel = -1;
|
||||
|
||||
public AssetRequest()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -44,10 +44,10 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
|
|||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
// Fields
|
||||
private bool m_dumpAssetsToFile;
|
||||
public AgentAssetTransactionsManager Manager;
|
||||
public LLUUID UserID;
|
||||
public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>();
|
||||
public AgentAssetTransactionsManager Manager;
|
||||
private bool m_dumpAssetsToFile;
|
||||
|
||||
// Methods
|
||||
public AgentAssetTransactions(LLUUID agentID, AgentAssetTransactionsManager manager, bool dumpAssetsToFile)
|
||||
|
@ -135,27 +135,30 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
|
|||
}
|
||||
|
||||
// Nested Types
|
||||
|
||||
#region Nested type: AssetXferUploader
|
||||
|
||||
public class AssetXferUploader
|
||||
{
|
||||
// Fields
|
||||
public bool AddToInventory;
|
||||
public AssetBase Asset;
|
||||
public LLUUID InventFolder = LLUUID.Zero;
|
||||
private sbyte invType = 0;
|
||||
private bool m_createItem = false;
|
||||
private string m_description = String.Empty;
|
||||
private bool m_dumpAssetToFile;
|
||||
private bool m_finished = false;
|
||||
private string m_name = String.Empty;
|
||||
private bool m_storeLocal;
|
||||
private AgentAssetTransactions m_userTransactions;
|
||||
private uint nextPerm = 0;
|
||||
private IClientAPI ourClient;
|
||||
public LLUUID TransactionID = LLUUID.Zero;
|
||||
public bool UploadComplete;
|
||||
public ulong XferID;
|
||||
private string m_name = String.Empty;
|
||||
private string m_description = String.Empty;
|
||||
private sbyte type = 0;
|
||||
private sbyte invType = 0;
|
||||
public bool UploadComplete;
|
||||
private byte wearableType = 0;
|
||||
private uint nextPerm = 0;
|
||||
private bool m_finished = false;
|
||||
private bool m_createItem = false;
|
||||
private AgentAssetTransactions m_userTransactions;
|
||||
private bool m_storeLocal;
|
||||
private bool m_dumpAssetToFile;
|
||||
public ulong XferID;
|
||||
|
||||
public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
|
||||
{
|
||||
|
@ -403,5 +406,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -33,7 +33,6 @@ using log4net;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Modules.Agent.AssetTransaction;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
|
||||
|
@ -41,8 +40,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
|
|||
public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions
|
||||
{
|
||||
private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
|
||||
private Scene m_scene = null;
|
||||
private bool m_dumpAssetsToFile = false;
|
||||
private Scene m_scene = null;
|
||||
|
||||
private AgentAssetTransactionsManager m_transactionManager;
|
||||
|
||||
|
@ -51,6 +50,31 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
|
|||
// System.Console.WriteLine("creating AgentAssetTransactionModule");
|
||||
}
|
||||
|
||||
#region IAgentAssetTransactions Members
|
||||
|
||||
public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
|
||||
uint callbackID, string description, string name, sbyte invType,
|
||||
sbyte type, byte wearableType, uint nextOwnerMask)
|
||||
{
|
||||
m_transactionManager.HandleItemCreationFromTransaction(remoteClient, transactionID, folderID, callbackID, description, name, invType, type,
|
||||
wearableType, nextOwnerMask);
|
||||
}
|
||||
|
||||
public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, LLUUID transactionID,
|
||||
InventoryItemBase item)
|
||||
{
|
||||
m_transactionManager.HandleItemUpdateFromTransaction(remoteClient, transactionID, item);
|
||||
}
|
||||
|
||||
public void RemoveAgentAssetTransactions(LLUUID userID)
|
||||
{
|
||||
m_transactionManager.RemoveAgentAssetTransactions(userID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||
|
@ -81,13 +105,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
|
|||
{
|
||||
m_transactionManager = new AgentAssetTransactionsManager(m_scene, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
@ -104,29 +126,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
|
|||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void NewClient(IClientAPI client)
|
||||
{
|
||||
client.OnAssetUploadRequest += m_transactionManager.HandleUDPUploadRequest;
|
||||
client.OnXferReceive += m_transactionManager.HandleXfer;
|
||||
}
|
||||
|
||||
public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
|
||||
uint callbackID, string description, string name, sbyte invType,
|
||||
sbyte type, byte wearableType, uint nextOwnerMask)
|
||||
{
|
||||
m_transactionManager.HandleItemCreationFromTransaction(remoteClient, transactionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask);
|
||||
}
|
||||
|
||||
public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, LLUUID transactionID,
|
||||
InventoryItemBase item)
|
||||
{
|
||||
m_transactionManager.HandleItemUpdateFromTransaction(remoteClient, transactionID, item);
|
||||
}
|
||||
|
||||
public void RemoveAgentAssetTransactions(LLUUID userID)
|
||||
{
|
||||
m_transactionManager.RemoveAgentAssetTransactions(userID);
|
||||
}
|
||||
}
|
||||
|
||||
public class AgentAssetTransactionsManager
|
||||
|
@ -135,7 +141,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
|
|||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
// Fields
|
||||
public Scene MyScene;
|
||||
|
||||
/// <summary>
|
||||
/// Each agent has its own singleton collection of transactions
|
||||
|
@ -148,6 +153,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
|
|||
/// </summary>
|
||||
private bool m_dumpAssetsToFile;
|
||||
|
||||
public Scene MyScene;
|
||||
|
||||
public AgentAssetTransactionsManager(Scene scene, bool dumpAssetsToFile)
|
||||
{
|
||||
MyScene = scene;
|
||||
|
@ -260,10 +267,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
|
|||
AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
|
||||
if (uploader != null)
|
||||
{
|
||||
|
||||
if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,9 +41,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
|||
//private static readonly log4net.ILog m_log
|
||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private List<Scene> m_scenes = new List<Scene>();
|
||||
|
||||
/// <summary>
|
||||
/// There is one queue for all textures waiting to be sent, regardless of the requesting user.
|
||||
/// </summary>
|
||||
|
@ -56,12 +53,17 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
|||
private readonly Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices =
|
||||
new Dictionary<LLUUID, UserTextureDownloadService>();
|
||||
|
||||
private Scene m_scene;
|
||||
private List<Scene> m_scenes = new List<Scene>();
|
||||
|
||||
private Thread m_thread;
|
||||
|
||||
public TextureDownloadModule()
|
||||
{
|
||||
}
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
if (m_scene == null)
|
||||
|
@ -83,6 +85,26 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
|||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "TextureDownloadModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Cleanup the texture service related objects for the removed presence.
|
||||
/// </summary>
|
||||
|
@ -102,24 +124,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
|||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "TextureDownloadModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public void NewClient(IClientAPI client)
|
||||
{
|
||||
client.OnRequestTexture += TextureRequest;
|
||||
|
|
|
@ -40,33 +40,36 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
|||
//private static readonly log4net.ILog m_log
|
||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private LLUUID m_textureId;
|
||||
private bool m_cancel = false;
|
||||
private IClientAPI m_client;
|
||||
|
||||
// See ITextureSender
|
||||
|
||||
private bool m_sending = false;
|
||||
private LLUUID m_textureId;
|
||||
|
||||
// See ITextureSender
|
||||
|
||||
public TextureNotFoundSender(IClientAPI client, LLUUID textureID)
|
||||
{
|
||||
m_client = client;
|
||||
m_textureId = textureID;
|
||||
}
|
||||
|
||||
#region ITextureSender Members
|
||||
|
||||
public bool Sending
|
||||
{
|
||||
get { return false; }
|
||||
set { m_sending = value; }
|
||||
}
|
||||
|
||||
private bool m_sending = false;
|
||||
|
||||
// See ITextureSender
|
||||
public bool Cancel
|
||||
{
|
||||
get { return false; }
|
||||
set { m_cancel = value; }
|
||||
}
|
||||
|
||||
private bool m_cancel = false;
|
||||
|
||||
public TextureNotFoundSender(IClientAPI client, LLUUID textureID)
|
||||
{
|
||||
m_client = client;
|
||||
m_textureId = textureID;
|
||||
}
|
||||
|
||||
// See ITextureSender
|
||||
public void UpdateRequest(int discardLevel, uint packetNumber)
|
||||
{
|
||||
|
@ -89,5 +92,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -32,8 +32,6 @@ using log4net;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications.Limit;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Modules.Agent.TextureDownload;
|
||||
using OpenSim.Region.Environment.Modules.Agent.TextureSender;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
||||
|
@ -57,24 +55,14 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
|||
/// </summary>
|
||||
private static readonly int MAX_ALLOWED_TEXTURE_REQUESTS = 5;
|
||||
|
||||
/// <summary>
|
||||
/// We're going to limit requests for the same missing texture.
|
||||
/// XXX This is really a temporary solution to deal with the situation where a client continually requests
|
||||
/// the same missing textures
|
||||
/// </summary>
|
||||
private readonly IRequestLimitStrategy<LLUUID> missingTextureLimitStrategy
|
||||
= new RepeatLimitStrategy<LLUUID>(MAX_ALLOWED_TEXTURE_REQUESTS);
|
||||
|
||||
/// <summary>
|
||||
/// XXX Also going to limit requests for found textures.
|
||||
/// </summary>
|
||||
private readonly IRequestLimitStrategy<LLUUID> foundTextureLimitStrategy
|
||||
= new RepeatLimitStrategy<LLUUID>(MAX_ALLOWED_TEXTURE_REQUESTS);
|
||||
|
||||
/// <summary>
|
||||
/// Holds texture senders before they have received the appropriate texture from the asset cache.
|
||||
/// </summary>
|
||||
private readonly Dictionary<LLUUID, TextureSender.TextureSender> m_textureSenders = new Dictionary<LLUUID, TextureSender.TextureSender>();
|
||||
private readonly IClientAPI m_client;
|
||||
private readonly Scene m_scene;
|
||||
|
||||
/// <summary>
|
||||
/// Texture Senders are placed in this queue once they have received their texture from the asset
|
||||
|
@ -82,9 +70,18 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
|
|||
/// </summary>
|
||||
private readonly BlockingQueue<ITextureSender> m_sharedSendersQueue;
|
||||
|
||||
private readonly Scene m_scene;
|
||||
/// <summary>
|
||||
/// Holds texture senders before they have received the appropriate texture from the asset cache.
|
||||
/// </summary>
|
||||
private readonly Dictionary<LLUUID, TextureSender.TextureSender> m_textureSenders = new Dictionary<LLUUID, TextureSender.TextureSender>();
|
||||
|
||||
private readonly IClientAPI m_client;
|
||||
/// <summary>
|
||||
/// We're going to limit requests for the same missing texture.
|
||||
/// XXX This is really a temporary solution to deal with the situation where a client continually requests
|
||||
/// the same missing textures
|
||||
/// </summary>
|
||||
private readonly IRequestLimitStrategy<LLUUID> missingTextureLimitStrategy
|
||||
= new RepeatLimitStrategy<LLUUID>(MAX_ALLOWED_TEXTURE_REQUESTS);
|
||||
|
||||
public UserTextureDownloadService(
|
||||
IClientAPI client, Scene scene, BlockingQueue<ITextureSender> sharedQueue)
|
||||
|
|
|
@ -48,6 +48,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
|
|||
/// </summary>
|
||||
public int counter = 0;
|
||||
|
||||
public bool ImageLoaded = false;
|
||||
|
||||
/// <summary>
|
||||
/// Holds the texture asset to send.
|
||||
/// </summary>
|
||||
|
@ -55,6 +57,12 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
|
|||
|
||||
//public LLUUID assetID { get { return m_asset.FullID; } }
|
||||
|
||||
private bool m_cancel = false;
|
||||
|
||||
// See ITextureSender
|
||||
|
||||
private bool m_sending = false;
|
||||
|
||||
/// <summary>
|
||||
/// This is actually the number of extra packets required to send the texture data! We always assume
|
||||
/// at least one is required.
|
||||
|
@ -67,29 +75,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
|
|||
/// </summary>
|
||||
private int PacketCounter = 0;
|
||||
|
||||
// See ITextureSender
|
||||
public bool Cancel
|
||||
{
|
||||
get { return false; }
|
||||
set { m_cancel = value; }
|
||||
}
|
||||
|
||||
private bool m_cancel = false;
|
||||
|
||||
// See ITextureSender
|
||||
public bool Sending
|
||||
{
|
||||
get { return false; }
|
||||
set { m_sending = value; }
|
||||
}
|
||||
|
||||
private bool m_sending = false;
|
||||
|
||||
public bool ImageLoaded = false;
|
||||
|
||||
private IClientAPI RequestUser;
|
||||
|
||||
private int RequestedDiscardLevel = -1;
|
||||
private IClientAPI RequestUser;
|
||||
private uint StartPacketNumber = 0;
|
||||
|
||||
public TextureSender(IClientAPI client, int discardLevel, uint packetNumber)
|
||||
|
@ -99,18 +86,18 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
|
|||
StartPacketNumber = packetNumber;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load up the texture data to send.
|
||||
/// </summary>
|
||||
/// <param name="asset">
|
||||
/// A <see cref="AssetBase"/>
|
||||
/// </param>
|
||||
public void TextureReceived(AssetBase asset)
|
||||
#region ITextureSender Members
|
||||
|
||||
public bool Cancel
|
||||
{
|
||||
m_asset = asset;
|
||||
NumPackets = CalculateNumPackets(asset.Data.Length);
|
||||
PacketCounter = (int) StartPacketNumber;
|
||||
ImageLoaded = true;
|
||||
get { return false; }
|
||||
set { m_cancel = value; }
|
||||
}
|
||||
|
||||
public bool Sending
|
||||
{
|
||||
get { return false; }
|
||||
set { m_sending = value; }
|
||||
}
|
||||
|
||||
// See ITextureSender
|
||||
|
@ -136,6 +123,22 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
|
|||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Load up the texture data to send.
|
||||
/// </summary>
|
||||
/// <param name="asset">
|
||||
/// A <see cref="AssetBase"/>
|
||||
/// </param>
|
||||
public void TextureReceived(AssetBase asset)
|
||||
{
|
||||
m_asset = asset;
|
||||
NumPackets = CalculateNumPackets(asset.Data.Length);
|
||||
PacketCounter = (int) StartPacketNumber;
|
||||
ImageLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a texture packet to the client.
|
||||
/// </summary>
|
||||
|
|
|
@ -37,15 +37,16 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
|
|||
{
|
||||
public class XferModule : IRegionModule, IXfer
|
||||
{
|
||||
private Scene m_scene;
|
||||
public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
|
||||
public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
public XferModule()
|
||||
{
|
||||
}
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
m_scene = scene;
|
||||
|
@ -72,6 +73,28 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IXfer Members
|
||||
|
||||
public bool AddNewFile(string fileName, byte[] data)
|
||||
{
|
||||
lock (NewFiles)
|
||||
{
|
||||
if (NewFiles.ContainsKey(fileName))
|
||||
{
|
||||
NewFiles[fileName] = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
NewFiles.Add(fileName, data);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void NewClient(IClientAPI client)
|
||||
{
|
||||
client.OnRequestXfer += RequestXfer;
|
||||
|
@ -119,33 +142,18 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
|
|||
}
|
||||
}
|
||||
|
||||
public bool AddNewFile(string fileName, byte[] data)
|
||||
{
|
||||
lock (NewFiles)
|
||||
{
|
||||
if (NewFiles.ContainsKey(fileName))
|
||||
{
|
||||
NewFiles[fileName] = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
NewFiles.Add(fileName, data);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#region Nested type: XferDownLoad
|
||||
|
||||
public class XferDownLoad
|
||||
{
|
||||
public byte[] Data = new byte[0];
|
||||
public string FileName = String.Empty;
|
||||
public ulong XferID = 0;
|
||||
public int DataPointer = 0;
|
||||
public uint Packet = 0;
|
||||
public IClientAPI Client;
|
||||
public uint Serial = 1;
|
||||
private bool complete;
|
||||
public byte[] Data = new byte[0];
|
||||
public int DataPointer = 0;
|
||||
public string FileName = String.Empty;
|
||||
public uint Packet = 0;
|
||||
public uint Serial = 1;
|
||||
public ulong XferID = 0;
|
||||
|
||||
public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
|
||||
{
|
||||
|
@ -221,5 +229,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
|
|||
return complete;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -44,21 +44,21 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
public class ChatModule : IRegionModule, ISimChat
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private List<Scene> m_scenes = new List<Scene>();
|
||||
|
||||
private int m_whisperdistance = 10;
|
||||
private int m_saydistance = 30;
|
||||
private int m_shoutdistance = 100;
|
||||
private string m_defaultzone = null;
|
||||
|
||||
private IRCChatModule m_irc = null;
|
||||
private Thread m_irc_connector = null;
|
||||
|
||||
private string m_last_new_user = null;
|
||||
private string m_last_leaving_user = null;
|
||||
private string m_defaultzone = null;
|
||||
private string m_last_new_user = null;
|
||||
private int m_saydistance = 30;
|
||||
private List<Scene> m_scenes = new List<Scene>();
|
||||
private int m_shoutdistance = 100;
|
||||
internal object m_syncInit = new object();
|
||||
internal object m_syncLogout = new object();
|
||||
private Thread m_irc_connector=null;
|
||||
private int m_whisperdistance = 10;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
|
@ -92,7 +92,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
}
|
||||
|
||||
// setup IRC Relay
|
||||
if (m_irc == null) { m_irc = new IRCChatModule(config); }
|
||||
if (m_irc == null)
|
||||
{
|
||||
m_irc = new IRCChatModule(config);
|
||||
}
|
||||
if (m_irc_connector == null)
|
||||
{
|
||||
m_irc_connector = new Thread(IRCConnectRun);
|
||||
|
@ -142,83 +145,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
get { return true; }
|
||||
}
|
||||
|
||||
public void NewClient(IClientAPI client)
|
||||
{
|
||||
try
|
||||
{
|
||||
client.OnChatFromViewer += SimChat;
|
||||
#endregion
|
||||
|
||||
if ((m_irc.Enabled) && (m_irc.Connected))
|
||||
{
|
||||
string clientName = client.FirstName + " " + client.LastName;
|
||||
// handles simple case. May not work for hundred connecting in per second.
|
||||
// and the NewClients calles getting interleved
|
||||
// but filters out multiple reports
|
||||
if (clientName != m_last_new_user)
|
||||
{
|
||||
m_last_new_user = clientName;
|
||||
string clientRegion = FindClientRegion(client.FirstName, client.LastName);
|
||||
m_irc.PrivMsg(m_irc.Nick, "Sim", "notices " + clientName + " in "+clientRegion);
|
||||
}
|
||||
}
|
||||
client.OnLogout += ClientLoggedOut;
|
||||
client.OnConnectionClosed += ClientLoggedOut;
|
||||
client.OnLogout += ClientLoggedOut;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Error("[IRC]: NewClient exception trap:" + ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void ClientLoggedOut(IClientAPI client)
|
||||
{
|
||||
lock (m_syncLogout)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((m_irc.Enabled) && (m_irc.Connected))
|
||||
{
|
||||
string clientName = client.FirstName + " " + client.LastName;
|
||||
string clientRegion = FindClientRegion(client.FirstName, client.LastName);
|
||||
// handles simple case. May not work for hundred connecting in per second.
|
||||
// and the NewClients calles getting interleved
|
||||
// but filters out multiple reports
|
||||
if (clientName != m_last_leaving_user)
|
||||
{
|
||||
m_last_leaving_user = clientName;
|
||||
m_irc.PrivMsg(m_irc.Nick, "Sim", "notices " + clientName + " left " + clientRegion);
|
||||
m_log.Info("[IRC]: IRC watcher notices " + clientName + " left " + clientRegion);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TrySendChatMessage(ScenePresence presence, LLVector3 fromPos, LLVector3 regionPos,
|
||||
LLUUID fromAgentID, string fromName, ChatTypeEnum type, string message)
|
||||
{
|
||||
if (!presence.IsChildAgent)
|
||||
{
|
||||
LLVector3 fromRegionPos = fromPos + regionPos;
|
||||
LLVector3 toRegionPos = presence.AbsolutePosition + regionPos;
|
||||
int dis = Math.Abs((int) Util.GetDistanceTo(toRegionPos, fromRegionPos));
|
||||
|
||||
if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
|
||||
type == ChatTypeEnum.Say && dis > m_saydistance ||
|
||||
type == ChatTypeEnum.Shout && dis > m_shoutdistance)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: should change so the message is sent through the avatar rather than direct to the ClientView
|
||||
presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, fromAgentID);
|
||||
}
|
||||
}
|
||||
#region ISimChat Members
|
||||
|
||||
public void SimChat(Object sender, ChatFromViewerArgs e)
|
||||
{
|
||||
|
@ -301,6 +230,86 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void NewClient(IClientAPI client)
|
||||
{
|
||||
try
|
||||
{
|
||||
client.OnChatFromViewer += SimChat;
|
||||
|
||||
if ((m_irc.Enabled) && (m_irc.Connected))
|
||||
{
|
||||
string clientName = client.FirstName + " " + client.LastName;
|
||||
// handles simple case. May not work for hundred connecting in per second.
|
||||
// and the NewClients calles getting interleved
|
||||
// but filters out multiple reports
|
||||
if (clientName != m_last_new_user)
|
||||
{
|
||||
m_last_new_user = clientName;
|
||||
string clientRegion = FindClientRegion(client.FirstName, client.LastName);
|
||||
m_irc.PrivMsg(m_irc.Nick, "Sim", "notices " + clientName + " in " + clientRegion);
|
||||
}
|
||||
}
|
||||
client.OnLogout += ClientLoggedOut;
|
||||
client.OnConnectionClosed += ClientLoggedOut;
|
||||
client.OnLogout += ClientLoggedOut;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Error("[IRC]: NewClient exception trap:" + ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void ClientLoggedOut(IClientAPI client)
|
||||
{
|
||||
lock (m_syncLogout)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((m_irc.Enabled) && (m_irc.Connected))
|
||||
{
|
||||
string clientName = client.FirstName + " " + client.LastName;
|
||||
string clientRegion = FindClientRegion(client.FirstName, client.LastName);
|
||||
// handles simple case. May not work for hundred connecting in per second.
|
||||
// and the NewClients calles getting interleved
|
||||
// but filters out multiple reports
|
||||
if (clientName != m_last_leaving_user)
|
||||
{
|
||||
m_last_leaving_user = clientName;
|
||||
m_irc.PrivMsg(m_irc.Nick, "Sim", "notices " + clientName + " left " + clientRegion);
|
||||
m_log.Info("[IRC]: IRC watcher notices " + clientName + " left " + clientRegion);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TrySendChatMessage(ScenePresence presence, LLVector3 fromPos, LLVector3 regionPos,
|
||||
LLUUID fromAgentID, string fromName, ChatTypeEnum type, string message)
|
||||
{
|
||||
if (!presence.IsChildAgent)
|
||||
{
|
||||
LLVector3 fromRegionPos = fromPos + regionPos;
|
||||
LLVector3 toRegionPos = presence.AbsolutePosition + regionPos;
|
||||
int dis = Math.Abs((int) Util.GetDistanceTo(toRegionPos, fromRegionPos));
|
||||
|
||||
if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
|
||||
type == ChatTypeEnum.Say && dis > m_saydistance ||
|
||||
type == ChatTypeEnum.Shout && dis > m_shoutdistance)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: should change so the message is sent through the avatar rather than direct to the ClientView
|
||||
presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, fromAgentID);
|
||||
}
|
||||
}
|
||||
|
||||
// if IRC is enabled then just keep trying using a monitor thread
|
||||
public void IRCConnectRun()
|
||||
{
|
||||
|
@ -331,37 +340,59 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
});
|
||||
if (sourceRegion != null) return sourceRegion;
|
||||
}
|
||||
if (m_defaultzone == null) { m_defaultzone = "Sim"; }
|
||||
if (m_defaultzone == null)
|
||||
{
|
||||
m_defaultzone = "Sim";
|
||||
}
|
||||
return m_defaultzone;
|
||||
}
|
||||
}
|
||||
|
||||
internal class IRCChatModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#region ErrorReplies enum
|
||||
|
||||
public enum ErrorReplies
|
||||
{
|
||||
NotRegistered = 451, // ":You have not registered"
|
||||
NicknameInUse = 433 // "<nick> :Nickname is already in use"
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Replies enum
|
||||
|
||||
public enum Replies
|
||||
{
|
||||
MotdStart = 375, // ":- <server> Message of the day - "
|
||||
Motd = 372, // ":- <text>"
|
||||
EndOfMotd = 376 // ":End of /MOTD command"
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private Thread listener;
|
||||
|
||||
private string m_server = null;
|
||||
private uint m_port = 6668;
|
||||
private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
|
||||
private string m_nick = null;
|
||||
private string m_basenick = null;
|
||||
private string m_channel = null;
|
||||
private bool m_connected = false;
|
||||
private bool m_enabled = false;
|
||||
private List<Scene> m_last_scenes = null;
|
||||
private string m_nick = null;
|
||||
private uint m_port = 6668;
|
||||
private string m_privmsgformat = "PRIVMSG {0} :<{1} in {2}>: {3}";
|
||||
private StreamReader m_reader;
|
||||
private List<Scene> m_scenes = null;
|
||||
private string m_server = null;
|
||||
|
||||
private NetworkStream m_stream;
|
||||
internal object m_syncConnect = new object();
|
||||
private TcpClient m_tcp;
|
||||
private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
|
||||
private StreamWriter m_writer;
|
||||
private StreamReader m_reader;
|
||||
|
||||
private Thread pingSender;
|
||||
private Thread listener;
|
||||
internal object m_syncConnect = new object();
|
||||
|
||||
private bool m_enabled = false;
|
||||
private bool m_connected = false;
|
||||
|
||||
private List<Scene> m_scenes = null;
|
||||
private List<Scene> m_last_scenes = null;
|
||||
|
||||
public IRCChatModule(IConfigSource config)
|
||||
{
|
||||
|
@ -412,6 +443,21 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get { return m_enabled; }
|
||||
}
|
||||
|
||||
public bool Connected
|
||||
{
|
||||
get { return m_connected; }
|
||||
}
|
||||
|
||||
public string Nick
|
||||
{
|
||||
get { return m_nick; }
|
||||
}
|
||||
|
||||
public bool Connect(List<Scene> scenes)
|
||||
{
|
||||
lock (m_syncConnect)
|
||||
|
@ -420,7 +466,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
{
|
||||
if (m_connected) return true;
|
||||
m_scenes = scenes;
|
||||
if (m_last_scenes == null) { m_last_scenes = scenes; }
|
||||
if (m_last_scenes == null)
|
||||
{
|
||||
m_last_scenes = scenes;
|
||||
}
|
||||
|
||||
m_tcp = new TcpClient(m_server, (int) m_port);
|
||||
m_log.Info("[IRC]: Connecting...");
|
||||
|
@ -458,21 +507,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get { return m_enabled; }
|
||||
}
|
||||
|
||||
public bool Connected
|
||||
{
|
||||
get { return m_connected; }
|
||||
}
|
||||
|
||||
public string Nick
|
||||
{
|
||||
get { return m_nick; }
|
||||
}
|
||||
|
||||
public void Reconnect()
|
||||
{
|
||||
m_connected = false;
|
||||
|
@ -481,7 +515,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
m_writer.Close();
|
||||
m_reader.Close();
|
||||
m_tcp.Close();
|
||||
if (m_enabled) { Connect(m_last_scenes); }
|
||||
if (m_enabled)
|
||||
{
|
||||
Connect(m_last_scenes);
|
||||
}
|
||||
}
|
||||
|
||||
public void PrivMsg(string from, string region, string msg)
|
||||
|
@ -652,19 +689,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public enum ErrorReplies
|
||||
{
|
||||
NotRegistered = 451, // ":You have not registered"
|
||||
NicknameInUse = 433 // "<nick> :Nickname is already in use"
|
||||
}
|
||||
|
||||
public enum Replies
|
||||
{
|
||||
MotdStart = 375, // ":- <server> Message of the day - "
|
||||
Motd = 372, // ":- <text>"
|
||||
EndOfMotd = 376 // ":End of /MOTD command"
|
||||
}
|
||||
|
||||
public void ProcessIRCCommand(string command)
|
||||
{
|
||||
//m_log.Info("[IRC]: ProcessIRCCommand:" + command);
|
||||
|
@ -739,13 +763,26 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
string commAct = commArgs[1];
|
||||
switch (commAct)
|
||||
{
|
||||
case "JOIN": eventIrcJoin(commArgs); break;
|
||||
case "PART": eventIrcPart(commArgs); break;
|
||||
case "MODE": eventIrcMode(commArgs); break;
|
||||
case "NICK": eventIrcNickChange(commArgs); break;
|
||||
case "KICK": eventIrcKick(commArgs); break;
|
||||
case "QUIT": eventIrcQuit(commArgs); break;
|
||||
case "PONG": break; // that's nice
|
||||
case "JOIN":
|
||||
eventIrcJoin(commArgs);
|
||||
break;
|
||||
case "PART":
|
||||
eventIrcPart(commArgs);
|
||||
break;
|
||||
case "MODE":
|
||||
eventIrcMode(commArgs);
|
||||
break;
|
||||
case "NICK":
|
||||
eventIrcNickChange(commArgs);
|
||||
break;
|
||||
case "KICK":
|
||||
eventIrcKick(commArgs);
|
||||
break;
|
||||
case "QUIT":
|
||||
eventIrcQuit(commArgs);
|
||||
break;
|
||||
case "PONG":
|
||||
break; // that's nice
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -42,13 +42,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Dictionary<LLUUID, List<FriendListItem>> FriendLists = new Dictionary<LLUUID, List<FriendListItem>>();
|
||||
private Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>();
|
||||
private Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>();
|
||||
private List<Scene> m_scene = new List<Scene>();
|
||||
|
||||
Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>();
|
||||
|
||||
Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>();
|
||||
|
||||
Dictionary<LLUUID, List<FriendListItem>> FriendLists = new Dictionary<LLUUID, List<FriendListItem>>();
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
|
@ -68,11 +67,33 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
scene.EventManager.OnMakeChildAgent += MakeChildAgent;
|
||||
scene.EventManager.OnClientClosed += ClientLoggedOut;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "FriendsModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public XmlRpcResponse processPresenceUpdate(XmlRpcRequest req)
|
||||
{
|
||||
m_log.Info("[FRIENDS]: Got Notification about a user! OMG");
|
||||
return new XmlRpcResponse();
|
||||
}
|
||||
|
||||
private void OnNewClient(IClientAPI client)
|
||||
{
|
||||
// All friends establishment protocol goes over instant message
|
||||
|
@ -169,10 +190,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
onp.AgentBlock = onpb;
|
||||
client.OutPacket(onp, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void ClientLoggedOut(LLUUID AgentId)
|
||||
|
@ -208,7 +225,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
List<FriendListItem> flfli = new List<FriendListItem>();
|
||||
try
|
||||
{
|
||||
|
||||
lock (FriendLists)
|
||||
{
|
||||
if (FriendLists.ContainsKey(updateUsers[i]))
|
||||
|
@ -231,7 +247,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
{
|
||||
flfli[i].onlinestatus = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch (IndexOutOfRangeException)
|
||||
|
@ -242,7 +257,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
m_log.Info("[FRIEND]: Unable to enumerate last friendlist user. User logged off");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < updateUsers.Count; i++)
|
||||
|
@ -250,7 +264,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
ScenePresence av = GetPresenceFromAgentID(updateUsers[i]);
|
||||
if (av != null)
|
||||
{
|
||||
|
||||
OfflineNotificationPacket onp = new OfflineNotificationPacket();
|
||||
OfflineNotificationPacket.AgentBlockBlock[] onpb = new OfflineNotificationPacket.AgentBlockBlock[1];
|
||||
OfflineNotificationPacket.AgentBlockBlock onpbl = new OfflineNotificationPacket.AgentBlockBlock();
|
||||
|
@ -265,7 +278,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
{
|
||||
FriendLists.Remove(AgentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, LLUUID regionID)
|
||||
|
@ -282,7 +294,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
{
|
||||
JId avatarID = new JId(avatar.JID);
|
||||
// REST Post XMPP Stanzas!
|
||||
|
||||
}
|
||||
// Claim User! my user! Mine mine mine!
|
||||
}
|
||||
|
@ -295,9 +306,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
}
|
||||
//m_log.Info("[FRIEND]: " + avatar.Name + " status:" + (!avatar.IsChildAgent).ToString());
|
||||
}
|
||||
|
||||
private void MakeChildAgent(ScenePresence avatar)
|
||||
{
|
||||
|
||||
lock (m_rootAgents)
|
||||
{
|
||||
if (m_rootAgents.ContainsKey(avatar.UUID))
|
||||
|
@ -307,12 +318,34 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
m_rootAgents.Remove(avatar.UUID);
|
||||
m_log.Info("[FRIEND]: Removing " + avatar.Firstname + " " + avatar.Lastname + " as a root agent");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ScenePresence GetPresenceFromAgentID(LLUUID AgentID)
|
||||
{
|
||||
ScenePresence returnAgent = null;
|
||||
lock (m_scene)
|
||||
{
|
||||
ScenePresence queryagent = null;
|
||||
for (int i = 0; i < m_scene.Count; i++)
|
||||
{
|
||||
queryagent = m_scene[i].GetScenePresence(AgentID);
|
||||
if (queryagent != null)
|
||||
{
|
||||
if (!queryagent.IsChildAgent)
|
||||
{
|
||||
returnAgent = queryagent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnAgent;
|
||||
}
|
||||
|
||||
#region FriendRequestHandling
|
||||
|
||||
private void OnInstantMessage(IClientAPI client, LLUUID fromAgentID,
|
||||
LLUUID fromAgentSession, LLUUID toAgentID,
|
||||
LLUUID imSessionID, uint timestamp, string fromAgentName,
|
||||
|
@ -330,7 +363,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
|
||||
m_pendingFriendRequests.Add(friendTransactionID, fromAgentID);
|
||||
|
||||
m_log.Info("[FRIEND]: 38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message);
|
||||
m_log.Info("[FRIEND]: 38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
|
||||
message);
|
||||
GridInstantMessage msg = new GridInstantMessage();
|
||||
msg.fromAgentID = fromAgentID.UUID;
|
||||
msg.fromAgentSession = fromAgentSession.UUID;
|
||||
|
@ -361,13 +395,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
// 39 == Accept Friendship
|
||||
if (dialog == (byte) 39)
|
||||
{
|
||||
m_log.Info("[FRIEND]: 39 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message);
|
||||
m_log.Info("[FRIEND]: 39 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
|
||||
message);
|
||||
}
|
||||
|
||||
// 40 == Decline Friendship
|
||||
if (dialog == (byte) 40)
|
||||
{
|
||||
m_log.Info("[FRIEND]: 40 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" + message);
|
||||
m_log.Info("[FRIEND]: 40 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
|
||||
message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,46 +495,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID),
|
||||
msg.binaryBucket);
|
||||
}
|
||||
|
||||
#endregion
|
||||
private ScenePresence GetPresenceFromAgentID(LLUUID AgentID)
|
||||
{
|
||||
ScenePresence returnAgent = null;
|
||||
lock (m_scene)
|
||||
{
|
||||
ScenePresence queryagent = null;
|
||||
for (int i = 0; i < m_scene.Count; i++)
|
||||
{
|
||||
queryagent = m_scene[i].GetScenePresence(AgentID);
|
||||
if (queryagent != null)
|
||||
{
|
||||
if (!queryagent.IsChildAgent)
|
||||
{
|
||||
returnAgent = queryagent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnAgent;
|
||||
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "FriendsModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,10 +41,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private List<Scene> m_scene = new List<Scene>();
|
||||
private Dictionary<LLUUID, IClientAPI> m_iclientmap = new Dictionary<LLUUID, IClientAPI>();
|
||||
private Dictionary<LLUUID, GroupData> m_groupmap = new Dictionary<LLUUID, GroupData>();
|
||||
private Dictionary<LLUUID, GroupList> m_grouplistmap = new Dictionary<LLUUID, GroupList>();
|
||||
private Dictionary<LLUUID, GroupData> m_groupmap = new Dictionary<LLUUID, GroupData>();
|
||||
private Dictionary<LLUUID, IClientAPI> m_iclientmap = new Dictionary<LLUUID, IClientAPI>();
|
||||
private List<Scene> m_scene = new List<Scene>();
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
|
@ -58,6 +60,42 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
|
|||
//scene.EventManager.
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
m_log.Info("[GROUP]: Shutting down group module.");
|
||||
lock (m_iclientmap)
|
||||
{
|
||||
m_iclientmap.Clear();
|
||||
}
|
||||
|
||||
lock (m_groupmap)
|
||||
{
|
||||
m_groupmap.Clear();
|
||||
}
|
||||
|
||||
lock (m_grouplistmap)
|
||||
{
|
||||
m_grouplistmap.Clear();
|
||||
}
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "GroupsModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void OnNewClient(IClientAPI client)
|
||||
{
|
||||
// All friends establishment protocol goes over instant message
|
||||
|
@ -139,11 +177,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
|
|||
}
|
||||
|
||||
//remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname, lastname, ActiveGroupPowers, ActiveGroupName, ActiveGroupTitle);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnInstantMessage(IClientAPI client, LLUUID fromAgentID,
|
||||
|
@ -201,63 +237,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
|
|||
}
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
m_log.Info("[GROUP]: Shutting down group module.");
|
||||
lock (m_iclientmap)
|
||||
{
|
||||
m_iclientmap.Clear();
|
||||
}
|
||||
|
||||
lock (m_groupmap)
|
||||
{
|
||||
m_groupmap.Clear();
|
||||
}
|
||||
|
||||
lock (m_grouplistmap)
|
||||
{
|
||||
m_grouplistmap.Clear();
|
||||
}
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "GroupsModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class GroupData
|
||||
{
|
||||
public LLUUID GroupID;
|
||||
public string groupName;
|
||||
public string ActiveGroupTitle;
|
||||
public List<string> GroupTitles;
|
||||
public LLUUID GroupID;
|
||||
public List<LLUUID> GroupMembers;
|
||||
public string groupName;
|
||||
public uint groupPowers = (uint) (GroupPowers.LandAllowLandmark | GroupPowers.LandAllowSetHome);
|
||||
|
||||
public GroupPowers ActiveGroupPowers
|
||||
{
|
||||
set
|
||||
{
|
||||
groupPowers = (uint) value;
|
||||
}
|
||||
get
|
||||
{
|
||||
return (GroupPowers)groupPowers;
|
||||
}
|
||||
}
|
||||
public List<string> GroupTitles;
|
||||
|
||||
public GroupData()
|
||||
{
|
||||
|
@ -265,11 +254,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
|
|||
GroupMembers = new List<LLUUID>();
|
||||
}
|
||||
|
||||
public GroupPowers ActiveGroupPowers
|
||||
{
|
||||
set { groupPowers = (uint) value; }
|
||||
get { return (GroupPowers) groupPowers; }
|
||||
}
|
||||
}
|
||||
|
||||
public class GroupList
|
||||
{
|
||||
public List<LLUUID> m_GroupList;
|
||||
|
||||
public GroupList()
|
||||
{
|
||||
m_GroupList = new List<LLUUID>();
|
||||
|
|
|
@ -38,6 +38,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
|
|||
{
|
||||
private readonly List<Scene> m_scenes = new List<Scene>();
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
lock (m_scenes)
|
||||
|
@ -56,6 +58,26 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
|
|||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "InstantMessageModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void OnNewClient(IClientAPI client)
|
||||
{
|
||||
client.OnInstantMessage += OnInstantMessage;
|
||||
|
@ -111,10 +133,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
|
|||
timestamp);
|
||||
// Message sent
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,25 +153,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
|
|||
msg.message, msg.dialog, msg.fromGroup, msg.offline, msg.ParentEstateID,
|
||||
new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID),
|
||||
msg.binaryBucket);
|
||||
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "InstantMessageModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,8 +41,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
|
|||
private static readonly ILog m_log
|
||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
/// <summary>
|
||||
/// We need to keep track of the pending item offers between clients since the itemId offered only
|
||||
/// occurs in the initial offer message, not the accept message. So this dictionary links
|
||||
|
@ -50,6 +48,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
|
|||
/// </summary>
|
||||
private IDictionary<LLUUID, LLUUID> m_pendingOffers = new Dictionary<LLUUID, LLUUID>();
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
m_scene = scene;
|
||||
|
@ -74,6 +76,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void OnNewClient(IClientAPI client)
|
||||
{
|
||||
// Inventory giving is conducted via instant message
|
||||
|
|
|
@ -45,6 +45,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Profiles
|
|||
{
|
||||
}
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
m_scene = scene;
|
||||
|
@ -69,6 +71,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Profiles
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void NewClient(IClientAPI client)
|
||||
{
|
||||
client.OnRequestAvatarProperties += RequestAvatarProperty;
|
||||
|
|
|
@ -47,17 +47,19 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.AsterixVoice
|
|||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private IConfig m_config;
|
||||
private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
|
||||
private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
|
||||
|
||||
private string m_asterisk;
|
||||
private string m_asterisk_password;
|
||||
private string m_asterisk_salt;
|
||||
private int m_asterisk_timeout;
|
||||
private string m_sipDomain;
|
||||
private string m_confDomain;
|
||||
private IConfig m_config;
|
||||
private Scene m_scene;
|
||||
private string m_sipDomain;
|
||||
|
||||
private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
|
||||
private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
|
@ -77,7 +79,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.AsterixVoice
|
|||
}
|
||||
m_log.Info("[ASTERISKVOICE] plugin enabled");
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
m_sipDomain = m_config.GetString("sip_domain", String.Empty);
|
||||
m_log.InfoFormat("[ASTERISKVOICE] using SIP domain {0}", m_sipDomain);
|
||||
|
||||
|
@ -120,6 +123,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.AsterixVoice
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void OnRegisterCaps(LLUUID agentID, Caps caps)
|
||||
{
|
||||
m_log.DebugFormat("[ASTERISKVOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
||||
|
|
|
@ -46,12 +46,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.SIPVoice
|
|||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
private IConfig m_config;
|
||||
private string m_sipDomain;
|
||||
|
||||
private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
|
||||
private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
|
||||
private IConfig m_config;
|
||||
private Scene m_scene;
|
||||
private string m_sipDomain;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
|
@ -95,6 +96,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.SIPVoice
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void OnRegisterCaps(LLUUID agentID, Caps caps)
|
||||
{
|
||||
m_log.DebugFormat("[VOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
||||
|
|
|
@ -28,15 +28,23 @@
|
|||
using System;
|
||||
using Nini.Config;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Modules.Framework;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules.Framework
|
||||
{
|
||||
public class CommanderTestModule : IRegionModule, ICommandableModule
|
||||
{
|
||||
Commander m_commander = new Commander("CommanderTest");
|
||||
Scene m_scene;
|
||||
private Commander m_commander = new Commander("CommanderTest");
|
||||
private Scene m_scene;
|
||||
|
||||
#region ICommandableModule Members
|
||||
|
||||
public ICommander CommandInterface
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
|
@ -45,11 +53,6 @@ namespace OpenSim.Region.Environment.Modules.Framework
|
|||
m_scene = scene;
|
||||
}
|
||||
|
||||
private void InterfaceHelloWorld(Object[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World");
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
Command testCommand = new Command("hello", InterfaceHelloWorld, "Says a simple debugging test string");
|
||||
|
@ -77,13 +80,9 @@ namespace OpenSim.Region.Environment.Modules.Framework
|
|||
|
||||
#endregion
|
||||
|
||||
#region ICommandableModule Members
|
||||
|
||||
public ICommander CommandInterface
|
||||
private void InterfaceHelloWorld(Object[] args)
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
Console.WriteLine("Hello World");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,61 +35,14 @@ namespace OpenSim.Region.Environment.Modules.Communications.Interregion
|
|||
private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>();
|
||||
private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>();
|
||||
private IConfigSource m_config;
|
||||
private RemotingObject m_myRemote;
|
||||
|
||||
private Object m_lockObject = new object();
|
||||
private TcpChannel m_tcpChannel;
|
||||
private int m_tcpPort = 10101;
|
||||
private bool m_enabled = false;
|
||||
|
||||
#region IRegionModule Members
|
||||
private Object m_lockObject = new object();
|
||||
private RemotingObject m_myRemote;
|
||||
private TcpChannel m_tcpChannel;
|
||||
private int m_tcpPort = 10101;
|
||||
|
||||
//TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated.
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
m_myLocations.Add(new Location((int) scene.RegionInfo.RegionLocX,
|
||||
(int) scene.RegionInfo.RegionLocY));
|
||||
m_config = source;
|
||||
|
||||
scene.RegisterModuleInterface<IInterregionModule>(this);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated.
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_tcpPort = m_config.Configs["Comms"].GetInt("remoting_port", m_tcpPort);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
internal_CreateRemotingObjects();
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
ChannelServices.UnregisterChannel(m_tcpChannel);
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "InterregionModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region IInterregionModule Members
|
||||
|
||||
public void internal_CreateRemotingObjects()
|
||||
{
|
||||
|
@ -106,22 +59,6 @@ namespace OpenSim.Region.Environment.Modules.Communications.Interregion
|
|||
}
|
||||
}
|
||||
|
||||
public void RegisterRemoteRegion(string uri)
|
||||
{
|
||||
RegisterRemotingInterface((RemotingObject) Activator.GetObject(typeof (RemotingObject), uri));
|
||||
}
|
||||
|
||||
private void RegisterRemotingInterface(RemotingObject remote)
|
||||
{
|
||||
Location[] locs = remote.GetLocations();
|
||||
string[] interfaces = remote.GetInterfaces();
|
||||
foreach (Location loc in locs)
|
||||
{
|
||||
m_neighbourInterfaces[loc] = interfaces;
|
||||
m_neighbourRemote[loc] = remote;
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterMethod<T>(T e)
|
||||
{
|
||||
m_interfaces[typeof (T)] = e;
|
||||
|
@ -171,5 +108,73 @@ namespace OpenSim.Region.Environment.Modules.Communications.Interregion
|
|||
{
|
||||
return new Location(0, 0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
//TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated.
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
m_myLocations.Add(new Location((int) scene.RegionInfo.RegionLocX,
|
||||
(int) scene.RegionInfo.RegionLocY));
|
||||
m_config = source;
|
||||
|
||||
scene.RegisterModuleInterface<IInterregionModule>(this);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated.
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_tcpPort = m_config.Configs["Comms"].GetInt("remoting_port", m_tcpPort);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
internal_CreateRemotingObjects();
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
ChannelServices.UnregisterChannel(m_tcpChannel);
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "InterregionModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void RegisterRemoteRegion(string uri)
|
||||
{
|
||||
RegisterRemotingInterface((RemotingObject) Activator.GetObject(typeof (RemotingObject), uri));
|
||||
}
|
||||
|
||||
private void RegisterRemotingInterface(RemotingObject remote)
|
||||
{
|
||||
Location[] locs = remote.GetLocations();
|
||||
string[] interfaces = remote.GetInterfaces();
|
||||
foreach (Location loc in locs)
|
||||
{
|
||||
m_neighbourInterfaces[loc] = interfaces;
|
||||
m_neighbourRemote[loc] = remote;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -47,32 +47,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
|
|||
|
||||
private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||
{
|
||||
RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
|
||||
scene.RegisterModuleInterface<IDynamicTextureManager>(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "DynamicTextureModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
#region IDynamicTextureManager Members
|
||||
|
||||
public void RegisterRender(string handleType, IDynamicTextureRender render)
|
||||
{
|
||||
|
@ -164,20 +139,55 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
|
|||
return LLUUID.Zero;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||
{
|
||||
RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
|
||||
scene.RegisterModuleInterface<IDynamicTextureManager>(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "DynamicTextureModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: DynamicTextureUpdater
|
||||
|
||||
public class DynamicTextureUpdater
|
||||
{
|
||||
public LLUUID SimUUID;
|
||||
public LLUUID UpdaterID;
|
||||
public string ContentType;
|
||||
public string Url;
|
||||
public bool BlendWithOldTexture = false;
|
||||
public string BodyData;
|
||||
public LLUUID PrimID;
|
||||
public int UpdateTimer;
|
||||
public string ContentType;
|
||||
public byte FrontAlpha = 255;
|
||||
public LLUUID LastAssetID;
|
||||
public string Params;
|
||||
public bool BlendWithOldTexture = false;
|
||||
public LLUUID PrimID;
|
||||
public bool SetNewFrontAlpha = false;
|
||||
public byte FrontAlpha = 255;
|
||||
public LLUUID SimUUID;
|
||||
public LLUUID UpdaterID;
|
||||
public int UpdateTimer;
|
||||
public string Url;
|
||||
|
||||
public DynamicTextureUpdater()
|
||||
{
|
||||
|
@ -273,5 +283,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -84,45 +84,20 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
|
|||
{
|
||||
public class HttpRequestModule : IRegionModule, IHttpRequests
|
||||
{
|
||||
private Scene m_scene;
|
||||
private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>();
|
||||
private object HttpListLock = new object();
|
||||
private string m_name = "HttpScriptRequests";
|
||||
private int httpTimeout = 30000;
|
||||
private string m_name = "HttpScriptRequests";
|
||||
|
||||
// <request id, HttpRequestClass>
|
||||
private Dictionary<LLUUID, HttpRequestClass> m_pendingRequests;
|
||||
private Scene m_scene;
|
||||
private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>();
|
||||
|
||||
public HttpRequestModule()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
m_scene = scene;
|
||||
|
||||
m_scene.RegisterModuleInterface<IHttpRequests>(this);
|
||||
|
||||
m_pendingRequests = new Dictionary<LLUUID, HttpRequestClass>();
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return m_name; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
#region IHttpRequests Members
|
||||
|
||||
public LLUUID MakeHttpRequest(string url, string parameters, string body)
|
||||
{
|
||||
|
@ -187,7 +162,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
|
|||
|
||||
public void StopHttpRequest(uint m_localID, LLUUID m_itemID)
|
||||
{
|
||||
if(m_pendingRequests != null) {
|
||||
if (m_pendingRequests != null)
|
||||
{
|
||||
lock (HttpListLock)
|
||||
{
|
||||
HttpRequestClass tmpReq;
|
||||
|
@ -243,36 +219,68 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
m_scene = scene;
|
||||
|
||||
m_scene.RegisterModuleInterface<IHttpRequests>(this);
|
||||
|
||||
m_pendingRequests = new Dictionary<LLUUID, HttpRequestClass>();
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return m_name; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class HttpRequestClass
|
||||
{
|
||||
// Constants for parameters
|
||||
public const int HTTP_BODY_MAXLENGTH = 2;
|
||||
public const int HTTP_METHOD = 0;
|
||||
public const int HTTP_MIMETYPE = 1;
|
||||
public const int HTTP_BODY_MAXLENGTH = 2;
|
||||
public const int HTTP_VERIFY_CERT = 3;
|
||||
public bool finished;
|
||||
public int httpBodyMaxLen = 2048; // not implemented
|
||||
|
||||
// Parameter members and default values
|
||||
public string httpMethod = "GET";
|
||||
public string httpMIMEType = "text/plain;charset=utf-8";
|
||||
public int httpBodyMaxLen = 2048; // not implemented
|
||||
private Thread httpThread;
|
||||
public int httpTimeout;
|
||||
public bool httpVerifyCert = true; // not implemented
|
||||
|
||||
// Request info
|
||||
public uint localID;
|
||||
public LLUUID itemID;
|
||||
public LLUUID reqID;
|
||||
public int httpTimeout;
|
||||
public string url;
|
||||
public string outbound_body;
|
||||
public uint localID;
|
||||
public DateTime next;
|
||||
public int status;
|
||||
public bool finished;
|
||||
public List<string> response_metadata;
|
||||
public string response_body;
|
||||
public string outbound_body;
|
||||
public LLUUID reqID;
|
||||
public HttpWebRequest request;
|
||||
private Thread httpThread;
|
||||
public string response_body;
|
||||
public List<string> response_metadata;
|
||||
public int status;
|
||||
public string url;
|
||||
|
||||
public void process()
|
||||
{
|
||||
|
|
|
@ -40,39 +40,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
|
|||
public class LoadImageURLModule : IRegionModule, IDynamicTextureRender
|
||||
{
|
||||
private string m_name = "LoadImageURL";
|
||||
private IDynamicTextureManager m_textureManager;
|
||||
private Scene m_scene;
|
||||
private IDynamicTextureManager m_textureManager;
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
if (m_scene == null)
|
||||
{
|
||||
m_scene = scene;
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
||||
if (m_textureManager != null)
|
||||
{
|
||||
m_textureManager.RegisterRender(GetContentType(), this);
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return m_name; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
#region IDynamicTextureRender Members
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
|
@ -110,6 +81,43 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
|
|||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
if (m_scene == null)
|
||||
{
|
||||
m_scene = scene;
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
||||
if (m_textureManager != null)
|
||||
{
|
||||
m_textureManager.RegisterRender(GetContentType(), this);
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return m_name; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void MakeHttpRequest(string url, LLUUID requestID)
|
||||
{
|
||||
WebRequest request = HttpWebRequest.Create(url);
|
||||
|
@ -163,6 +171,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
|
|||
}
|
||||
}
|
||||
|
||||
#region Nested type: RequestState
|
||||
|
||||
public class RequestState
|
||||
{
|
||||
public HttpWebRequest Request = null;
|
||||
|
@ -175,5 +185,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
|
|||
RequestID = requestID;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -44,14 +44,56 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
|
|||
{
|
||||
public class VectorRenderModule : IRegionModule, IDynamicTextureRender
|
||||
{
|
||||
private Scene m_scene;
|
||||
private string m_name = "VectorRenderModule";
|
||||
private Scene m_scene;
|
||||
private IDynamicTextureManager m_textureManager;
|
||||
|
||||
public VectorRenderModule()
|
||||
{
|
||||
}
|
||||
|
||||
#region IDynamicTextureRender Members
|
||||
|
||||
public string GetContentType()
|
||||
{
|
||||
return ("vector");
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
public bool SupportsAsynchronous()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte[] ConvertUrl(string url, string extraParams)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] ConvertStream(Stream data, string extraParams)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool AsyncConvertUrl(LLUUID id, string url, string extraParams)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams)
|
||||
{
|
||||
Draw(bodyData, id, extraParams);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
if (m_scene == null)
|
||||
|
@ -83,14 +125,18 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
|
|||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void Draw(string data, LLUUID id, string extraParams)
|
||||
{
|
||||
// TODO: this is a brutal hack. extraParams should actually be parsed reasonably.
|
||||
int size = 256;
|
||||
try {
|
||||
try
|
||||
{
|
||||
size = Convert.ToInt32(extraParams);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used
|
||||
Console.WriteLine("Problem with Draw. Please verify parameters." + e.ToString());
|
||||
}
|
||||
|
@ -122,12 +168,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
|
|||
}
|
||||
|
||||
|
||||
|
||||
GDIDraw(data, graph);
|
||||
|
||||
byte[] imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true);
|
||||
m_textureManager.ReturnData(id, imageJ2000);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -321,41 +365,5 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetContentType()
|
||||
{
|
||||
return ("vector");
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
public bool SupportsAsynchronous()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte[] ConvertUrl(string url, string extraParams)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] ConvertStream(Stream data, string extraParams)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool AsyncConvertUrl(LLUUID id, string url, string extraParams)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AsyncConvertData(LLUUID id, string bodyData, string extraParams)
|
||||
{
|
||||
Draw(bodyData, id, extraParams);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -67,18 +67,20 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
|
|||
{
|
||||
public class WorldCommModule : IRegionModule, IWorldComm
|
||||
{
|
||||
private Scene m_scene;
|
||||
private object CommListLock = new object();
|
||||
private object ListLock = new object();
|
||||
private string m_name = "WorldCommModule";
|
||||
private ListenerManager m_listenerManager;
|
||||
private Queue m_pendingQ;
|
||||
private string m_name = "WorldCommModule";
|
||||
private Queue m_pending;
|
||||
private Queue m_pendingQ;
|
||||
private Scene m_scene;
|
||||
|
||||
public WorldCommModule()
|
||||
{
|
||||
}
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
m_scene = scene;
|
||||
|
@ -107,23 +109,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
public void NewClient(IClientAPI client)
|
||||
{
|
||||
client.OnChatFromViewer += DeliverClientMessage;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* Listener Stuff
|
||||
*
|
||||
* *****************************************************************/
|
||||
private void DeliverClientMessage(Object sender, ChatFromViewerArgs e)
|
||||
{
|
||||
DeliverMessage(e.Sender.AgentId.ToString(),
|
||||
e.Type, e.Channel,
|
||||
e.Sender.FirstName + " " + e.Sender.LastName,
|
||||
e.Message);
|
||||
}
|
||||
#region IWorldComm Members
|
||||
|
||||
public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg)
|
||||
{
|
||||
|
@ -310,13 +298,34 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
|
|||
{
|
||||
return ((ListenerInfo) m_pending.Peek()).GetItemID();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void NewClient(IClientAPI client)
|
||||
{
|
||||
client.OnChatFromViewer += DeliverClientMessage;
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* Listener Stuff
|
||||
*
|
||||
* *****************************************************************/
|
||||
|
||||
private void DeliverClientMessage(Object sender, ChatFromViewerArgs e)
|
||||
{
|
||||
DeliverMessage(e.Sender.AgentId.ToString(),
|
||||
e.Type, e.Channel,
|
||||
e.Sender.FirstName + " " + e.Sender.LastName,
|
||||
e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public class ListenerManager
|
||||
{
|
||||
//private Dictionary<int, ListenerInfo> m_listeners;
|
||||
private Hashtable m_listeners = Hashtable.Synchronized(new Hashtable());
|
||||
private object ListenersLock = new object();
|
||||
private Hashtable m_listeners = Hashtable.Synchronized(new Hashtable());
|
||||
private int m_MaxListeners = 100;
|
||||
|
||||
public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg)
|
||||
|
@ -400,7 +409,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
|
|||
|
||||
public void Activate(int handle)
|
||||
{
|
||||
|
||||
if (m_listeners.ContainsKey(handle))
|
||||
{
|
||||
lock (m_listeners.SyncRoot)
|
||||
|
@ -413,7 +421,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
|
|||
|
||||
public void Dectivate(int handle)
|
||||
{
|
||||
|
||||
if (m_listeners.ContainsKey(handle))
|
||||
{
|
||||
ListenerInfo li = (ListenerInfo) m_listeners[handle];
|
||||
|
@ -478,16 +485,16 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
|
|||
|
||||
public class ListenerInfo
|
||||
{
|
||||
private LLUUID m_itemID; // ID of the host script engine
|
||||
private LLUUID m_hostID; // ID of the host/scene part
|
||||
private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
|
||||
private bool m_active; // Listener is active or not
|
||||
private int m_channel; // Channel
|
||||
private int m_handle; // Assigned handle of this listener
|
||||
private uint m_localID; // Local ID from script engine
|
||||
private string m_name; // Object name to filter messages from
|
||||
private LLUUID m_hostID; // ID of the host/scene part
|
||||
private LLUUID m_id; // ID to filter messages from
|
||||
private LLUUID m_itemID; // ID of the host script engine
|
||||
private uint m_localID; // Local ID from script engine
|
||||
private string m_message; // The message
|
||||
private bool m_active; // Listener is active or not
|
||||
private string m_name; // Object name to filter messages from
|
||||
private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
|
||||
|
||||
public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message)
|
||||
{
|
||||
|
|
|
@ -79,20 +79,21 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private object XMLRPCListLock = new object();
|
||||
private string m_name = "XMLRPCModule";
|
||||
private int RemoteReplyScriptWait = 300;
|
||||
private int RemoteReplyScriptTimeout = 9000;
|
||||
private int m_remoteDataPort = 0;
|
||||
private List<Scene> m_scenes = new List<Scene>();
|
||||
|
||||
// <channel id, RPCChannelInfo>
|
||||
private Dictionary<LLUUID, RPCChannelInfo> m_openChannels;
|
||||
private Dictionary<LLUUID, SendRemoteDataRequest> m_pendingSRDResponses;
|
||||
private int m_remoteDataPort = 0;
|
||||
|
||||
private Dictionary<LLUUID, RPCRequestInfo> m_rpcPending;
|
||||
private Dictionary<LLUUID, RPCRequestInfo> m_rpcPendingResponses;
|
||||
private List<Scene> m_scenes = new List<Scene>();
|
||||
private int RemoteReplyScriptTimeout = 9000;
|
||||
private int RemoteReplyScriptWait = 300;
|
||||
private object XMLRPCListLock = new object();
|
||||
|
||||
private Dictionary<LLUUID, SendRemoteDataRequest> m_pendingSRDResponses;
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
|
@ -145,6 +146,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
|||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IXMLRPC Members
|
||||
|
||||
public bool IsEnabled()
|
||||
{
|
||||
return (m_remoteDataPort > 0);
|
||||
|
@ -196,7 +201,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
|||
// for when a script is deleted
|
||||
public void DeleteChannels(LLUUID itemID)
|
||||
{
|
||||
|
||||
if (m_openChannels != null)
|
||||
{
|
||||
ArrayList tmp = new ArrayList();
|
||||
|
@ -215,9 +219,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
|||
while (tmpEnumerator.MoveNext())
|
||||
m_openChannels.Remove((LLUUID) tmpEnumerator.Current);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**********************************************
|
||||
|
@ -255,6 +257,113 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
|||
}
|
||||
|
||||
|
||||
public bool hasRequests()
|
||||
{
|
||||
lock (XMLRPCListLock)
|
||||
{
|
||||
if (m_rpcPending != null)
|
||||
return (m_rpcPending.Count > 0);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public RPCRequestInfo GetNextCompletedRequest()
|
||||
{
|
||||
if (m_rpcPending != null)
|
||||
{
|
||||
lock (XMLRPCListLock)
|
||||
{
|
||||
foreach (LLUUID luid in m_rpcPending.Keys)
|
||||
{
|
||||
RPCRequestInfo tmpReq;
|
||||
|
||||
if (m_rpcPending.TryGetValue(luid, out tmpReq))
|
||||
{
|
||||
if (!tmpReq.IsProcessed()) return tmpReq;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void RemoveCompletedRequest(LLUUID id)
|
||||
{
|
||||
lock (XMLRPCListLock)
|
||||
{
|
||||
RPCRequestInfo tmp;
|
||||
if (m_rpcPending.TryGetValue(id, out tmp))
|
||||
{
|
||||
m_rpcPending.Remove(id);
|
||||
m_rpcPendingResponses.Add(id, tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("UNABLE TO REMOVE COMPLETED REQUEST");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LLUUID SendRemoteData(uint localID, LLUUID itemID, string channel, string dest, int idata, string sdata)
|
||||
{
|
||||
SendRemoteDataRequest req = new SendRemoteDataRequest(
|
||||
localID, itemID, channel, dest, idata, sdata
|
||||
);
|
||||
m_pendingSRDResponses.Add(req.GetReqID(), req);
|
||||
return req.process();
|
||||
}
|
||||
|
||||
public SendRemoteDataRequest GetNextCompletedSRDRequest()
|
||||
{
|
||||
if (m_pendingSRDResponses != null)
|
||||
{
|
||||
lock (XMLRPCListLock)
|
||||
{
|
||||
foreach (LLUUID luid in m_pendingSRDResponses.Keys)
|
||||
{
|
||||
SendRemoteDataRequest tmpReq;
|
||||
|
||||
if (m_pendingSRDResponses.TryGetValue(luid, out tmpReq))
|
||||
{
|
||||
if (tmpReq.finished)
|
||||
return tmpReq;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void RemoveCompletedSRDRequest(LLUUID id)
|
||||
{
|
||||
lock (XMLRPCListLock)
|
||||
{
|
||||
SendRemoteDataRequest tmpReq;
|
||||
if (m_pendingSRDResponses.TryGetValue(id, out tmpReq))
|
||||
{
|
||||
m_pendingSRDResponses.Remove(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CancelSRDRequests(LLUUID itemID)
|
||||
{
|
||||
if (m_pendingSRDResponses != null)
|
||||
{
|
||||
lock (XMLRPCListLock)
|
||||
{
|
||||
foreach (SendRemoteDataRequest li in m_pendingSRDResponses.Values)
|
||||
{
|
||||
if (li.m_itemID.Equals(itemID))
|
||||
m_pendingSRDResponses.Remove(li.GetReqID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public XmlRpcResponse XmlRpcRemoteData(XmlRpcRequest request)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
|
@ -315,127 +424,19 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
|||
|
||||
return response;
|
||||
}
|
||||
|
||||
public bool hasRequests()
|
||||
{
|
||||
lock (XMLRPCListLock)
|
||||
{
|
||||
if (m_rpcPending != null)
|
||||
return (m_rpcPending.Count > 0);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public RPCRequestInfo GetNextCompletedRequest()
|
||||
{
|
||||
if (m_rpcPending != null)
|
||||
{
|
||||
lock (XMLRPCListLock)
|
||||
{
|
||||
foreach (LLUUID luid in m_rpcPending.Keys)
|
||||
{
|
||||
RPCRequestInfo tmpReq;
|
||||
|
||||
if (m_rpcPending.TryGetValue(luid, out tmpReq))
|
||||
{
|
||||
|
||||
if (!tmpReq.IsProcessed()) return tmpReq;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void RemoveCompletedRequest(LLUUID id)
|
||||
{
|
||||
lock (XMLRPCListLock)
|
||||
{
|
||||
RPCRequestInfo tmp;
|
||||
if (m_rpcPending.TryGetValue(id, out tmp))
|
||||
{
|
||||
m_rpcPending.Remove(id);
|
||||
m_rpcPendingResponses.Add(id, tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("UNABLE TO REMOVE COMPLETED REQUEST");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LLUUID SendRemoteData(uint localID, LLUUID itemID, string channel, string dest, int idata, string sdata)
|
||||
{
|
||||
|
||||
SendRemoteDataRequest req = new SendRemoteDataRequest(
|
||||
localID, itemID, channel, dest, idata, sdata
|
||||
);
|
||||
m_pendingSRDResponses.Add(req.GetReqID(), req);
|
||||
return req.process();
|
||||
|
||||
}
|
||||
|
||||
public SendRemoteDataRequest GetNextCompletedSRDRequest()
|
||||
{
|
||||
if (m_pendingSRDResponses != null)
|
||||
{
|
||||
lock (XMLRPCListLock)
|
||||
{
|
||||
foreach (LLUUID luid in m_pendingSRDResponses.Keys)
|
||||
{
|
||||
SendRemoteDataRequest tmpReq;
|
||||
|
||||
if (m_pendingSRDResponses.TryGetValue(luid, out tmpReq))
|
||||
{
|
||||
if (tmpReq.finished)
|
||||
return tmpReq;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void RemoveCompletedSRDRequest(LLUUID id)
|
||||
{
|
||||
lock (XMLRPCListLock)
|
||||
{
|
||||
SendRemoteDataRequest tmpReq;
|
||||
if (m_pendingSRDResponses.TryGetValue(id, out tmpReq))
|
||||
{
|
||||
m_pendingSRDResponses.Remove(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CancelSRDRequests(LLUUID itemID)
|
||||
{
|
||||
if (m_pendingSRDResponses != null)
|
||||
{
|
||||
lock (XMLRPCListLock)
|
||||
{
|
||||
foreach (SendRemoteDataRequest li in m_pendingSRDResponses.Values)
|
||||
{
|
||||
if (li.m_itemID.Equals(itemID))
|
||||
m_pendingSRDResponses.Remove(li.GetReqID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class RPCRequestInfo
|
||||
{
|
||||
private string m_StrVal;
|
||||
private string m_IntVal;
|
||||
private bool m_processed;
|
||||
private string m_respStr;
|
||||
private int m_respInt;
|
||||
private uint m_localID;
|
||||
private LLUUID m_ItemID;
|
||||
private LLUUID m_MessageID;
|
||||
private LLUUID m_ChannelKey;
|
||||
private string m_IntVal;
|
||||
private LLUUID m_ItemID;
|
||||
private uint m_localID;
|
||||
private LLUUID m_MessageID;
|
||||
private bool m_processed;
|
||||
private int m_respInt;
|
||||
private string m_respStr;
|
||||
private string m_StrVal;
|
||||
|
||||
public RPCRequestInfo(uint localID, LLUUID itemID, LLUUID channelKey, string strVal, string intVal)
|
||||
{
|
||||
|
@ -474,6 +475,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
|||
{
|
||||
return m_respStr;
|
||||
}
|
||||
|
||||
public void SetIntRetval(int resp)
|
||||
{
|
||||
m_respInt = resp;
|
||||
|
@ -483,6 +485,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
|||
{
|
||||
return m_respInt;
|
||||
}
|
||||
|
||||
public uint GetLocalID()
|
||||
{
|
||||
return m_localID;
|
||||
|
@ -511,9 +514,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
|||
|
||||
public class RPCChannelInfo
|
||||
{
|
||||
private LLUUID m_ChannelKey;
|
||||
private LLUUID m_itemID;
|
||||
private uint m_localID;
|
||||
private LLUUID m_ChannelKey;
|
||||
|
||||
public RPCChannelInfo(uint localID, LLUUID itemID, LLUUID channelID)
|
||||
{
|
||||
|
@ -536,38 +539,34 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
|||
{
|
||||
return m_localID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class SendRemoteDataRequest
|
||||
{
|
||||
|
||||
public LLUUID reqID;
|
||||
public string destURL;
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public string channel;
|
||||
public string sdata;
|
||||
public int idata;
|
||||
public string destURL;
|
||||
public bool finished;
|
||||
public string response_sdata;
|
||||
public int response_idata;
|
||||
public XmlRpcRequest request;
|
||||
private Thread httpThread;
|
||||
public int idata;
|
||||
public LLUUID m_itemID;
|
||||
public uint m_localID;
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public LLUUID reqID;
|
||||
public XmlRpcRequest request;
|
||||
public int response_idata;
|
||||
public string response_sdata;
|
||||
public string sdata;
|
||||
|
||||
public SendRemoteDataRequest(uint localID, LLUUID itemID, string channel, string dest, int idata, string sdata)
|
||||
{
|
||||
|
||||
this.channel = channel;
|
||||
this.destURL = dest;
|
||||
destURL = dest;
|
||||
this.idata = idata;
|
||||
this.sdata = sdata;
|
||||
m_itemID = itemID;
|
||||
m_localID = localID;
|
||||
|
||||
reqID = LLUUID.Random();
|
||||
|
||||
}
|
||||
|
||||
public LLUUID process()
|
||||
|
@ -581,7 +580,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
|||
ThreadTracker.Add(httpThread);
|
||||
|
||||
return reqID;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -615,10 +613,12 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
|
|||
if (resp != null)
|
||||
{
|
||||
Hashtable respParms;
|
||||
if(resp.Value.GetType().Equals(Type.GetType("System.Collections.Hashtable"))) {
|
||||
if (resp.Value.GetType().Equals(Type.GetType("System.Collections.Hashtable")))
|
||||
{
|
||||
respParms = (Hashtable) resp.Value;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
ArrayList respData = (ArrayList) resp.Value;
|
||||
respParms = (Hashtable) respData[0];
|
||||
}
|
||||
|
|
|
@ -43,61 +43,45 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
|
||||
//Land types set with flags in ParcelOverlay.
|
||||
//Only one of these can be used.
|
||||
public const byte LAND_TYPE_PUBLIC = (byte)0; //Equals 00000000
|
||||
public const byte LAND_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001
|
||||
public const byte LAND_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010
|
||||
public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011
|
||||
public const byte LAND_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100
|
||||
public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101
|
||||
|
||||
//Flags that when set, a border on the given side will be placed
|
||||
//NOTE: North and East is assumable by the west and south sides (if land to east has a west border, then I have an east border; etc)
|
||||
//This took forever to figure out -- jeesh. /blame LL for even having to send these
|
||||
public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000
|
||||
public const float BAN_LINE_SAFETY_HIEGHT = 100;
|
||||
public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte) 128; //Equals 10000000
|
||||
public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte) 64; //Equals 01000000
|
||||
|
||||
//RequestResults (I think these are right, they seem to work):
|
||||
public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land
|
||||
public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land
|
||||
public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land
|
||||
|
||||
//ParcelSelectObjects
|
||||
public const int LAND_SELECT_OBJECTS_OWNER = 2;
|
||||
public const int LAND_SELECT_OBJECTS_GROUP = 4;
|
||||
public const int LAND_SELECT_OBJECTS_OTHER = 8;
|
||||
public const int LAND_SELECT_OBJECTS_OWNER = 2;
|
||||
public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte) 5; //Equals 00000101
|
||||
public const byte LAND_TYPE_IS_FOR_SALE = (byte) 4; //Equals 00000100
|
||||
public const byte LAND_TYPE_OWNED_BY_GROUP = (byte) 2; //Equals 00000010
|
||||
public const byte LAND_TYPE_OWNED_BY_OTHER = (byte) 1; //Equals 00000001
|
||||
public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte) 3; //Equals 00000011
|
||||
public const byte LAND_TYPE_PUBLIC = (byte) 0; //Equals 00000000
|
||||
|
||||
//These are other constants. Yay!
|
||||
public const int START_LAND_LOCAL_ID = 1;
|
||||
|
||||
public const float BAN_LINE_SAFETY_HIEGHT = 100;
|
||||
|
||||
#endregion
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
private Dictionary<int, ILandObject> landList = new Dictionary<int, ILandObject>();
|
||||
private int lastLandLocalID = START_LAND_LOCAL_ID - 1;
|
||||
private int[,] landIDList = new int[64,64];
|
||||
private Dictionary<int, ILandObject> landList = new Dictionary<int, ILandObject>();
|
||||
|
||||
private bool landPrimCountTainted = false;
|
||||
private int lastLandLocalID = START_LAND_LOCAL_ID - 1;
|
||||
|
||||
private bool m_allowedForcefulBans = true;
|
||||
public bool allowedForcefulBans
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_allowedForcefulBans;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_allowedForcefulBans = value;
|
||||
}
|
||||
}
|
||||
private Scene m_scene;
|
||||
|
||||
public LandChannel(Scene scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
landIDList.Initialize();
|
||||
}
|
||||
|
||||
#region Land Object From Storage Functions
|
||||
|
||||
public void IncomingLandObjectsFromStorage(List<LandData> data)
|
||||
|
@ -137,6 +121,60 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
|
||||
#region Parcel Add/Remove/Get/Create
|
||||
|
||||
public void updateLandObject(int local_id, LandData newData)
|
||||
{
|
||||
if (landList.ContainsKey(local_id))
|
||||
{
|
||||
landList[local_id].landData = newData.Copy();
|
||||
m_scene.EventManager.TriggerLandObjectUpdated((uint) local_id, landList[local_id]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the land object at the specified point
|
||||
/// </summary>
|
||||
/// <param name="x">Value between 0 - 256 on the x axis of the point</param>
|
||||
/// <param name="y">Value between 0 - 256 on the y axis of the point</param>
|
||||
/// <returns>Land object at the point supplied</returns>
|
||||
public ILandObject getLandObject(float x_float, float y_float)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
|
||||
try
|
||||
{
|
||||
x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / Convert.ToDouble(4.0)));
|
||||
y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / Convert.ToDouble(4.0)));
|
||||
}
|
||||
catch (OverflowException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (x >= 64 || y >= 64 || x < 0 || y < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return landList[landIDList[x, y]];
|
||||
}
|
||||
}
|
||||
|
||||
public ILandObject getLandObject(int x, int y)
|
||||
{
|
||||
if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0)
|
||||
{
|
||||
// These exceptions here will cause a lot of complaints from the users specifically because
|
||||
// they happen every time at border crossings
|
||||
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
||||
}
|
||||
else
|
||||
{
|
||||
return landList[landIDList[x / 4, y / 4]];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a basic Parcel object without an owner (a zeroed key)
|
||||
/// </summary>
|
||||
|
@ -197,15 +235,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
landList.Remove(local_id);
|
||||
}
|
||||
|
||||
public void updateLandObject(int local_id, LandData newData)
|
||||
{
|
||||
if (landList.ContainsKey(local_id))
|
||||
{
|
||||
landList[local_id].landData = newData.Copy();
|
||||
m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landList[local_id]);
|
||||
}
|
||||
}
|
||||
|
||||
private void performFinalLandJoin(ILandObject master, ILandObject slave)
|
||||
{
|
||||
int x, y;
|
||||
|
@ -225,37 +254,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
updateLandObject(master.landData.localID, master.landData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the land object at the specified point
|
||||
/// </summary>
|
||||
/// <param name="x">Value between 0 - 256 on the x axis of the point</param>
|
||||
/// <param name="y">Value between 0 - 256 on the y axis of the point</param>
|
||||
/// <returns>Land object at the point supplied</returns>
|
||||
public ILandObject getLandObject(float x_float, float y_float)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
|
||||
try
|
||||
{
|
||||
x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / Convert.ToDouble(4.0)));
|
||||
y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / Convert.ToDouble(4.0)));
|
||||
}
|
||||
catch (OverflowException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (x >= 64 || y >= 64 || x < 0 || y < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return landList[landIDList[x, y]];
|
||||
}
|
||||
}
|
||||
|
||||
public ILandObject getLandObject(int parcelLocalID)
|
||||
{
|
||||
lock (landList)
|
||||
|
@ -268,24 +266,102 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
return null;
|
||||
}
|
||||
|
||||
public ILandObject getLandObject(int x, int y)
|
||||
{
|
||||
if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0)
|
||||
{
|
||||
// These exceptions here will cause a lot of complaints from the users specifically because
|
||||
// they happen every time at border crossings
|
||||
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
||||
}
|
||||
else
|
||||
{
|
||||
return landList[landIDList[x / 4, y / 4]];
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Parcel Modification
|
||||
|
||||
public void resetAllLandPrimCounts()
|
||||
{
|
||||
foreach (LandObject p in landList.Values)
|
||||
{
|
||||
p.resetLandPrimCounts();
|
||||
}
|
||||
}
|
||||
|
||||
public void setPrimsTainted()
|
||||
{
|
||||
landPrimCountTainted = true;
|
||||
}
|
||||
|
||||
public bool isLandPrimCountTainted()
|
||||
{
|
||||
return landPrimCountTainted;
|
||||
}
|
||||
|
||||
public void addPrimToLandPrimCounts(SceneObjectGroup obj)
|
||||
{
|
||||
LLVector3 position = obj.AbsolutePosition;
|
||||
ILandObject landUnderPrim = getLandObject(position.X, position.Y);
|
||||
if (landUnderPrim != null)
|
||||
{
|
||||
landUnderPrim.addPrimToCount(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public void removePrimFromLandPrimCounts(SceneObjectGroup obj)
|
||||
{
|
||||
foreach (LandObject p in landList.Values)
|
||||
{
|
||||
p.removePrimFromCount(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public void finalizeLandPrimCountUpdate()
|
||||
{
|
||||
//Get Simwide prim count for owner
|
||||
Dictionary<LLUUID, List<LandObject>> landOwnersAndParcels = new Dictionary<LLUUID, List<LandObject>>();
|
||||
foreach (LandObject p in landList.Values)
|
||||
{
|
||||
if (!landOwnersAndParcels.ContainsKey(p.landData.ownerID))
|
||||
{
|
||||
List<LandObject> tempList = new List<LandObject>();
|
||||
tempList.Add(p);
|
||||
landOwnersAndParcels.Add(p.landData.ownerID, tempList);
|
||||
}
|
||||
else
|
||||
{
|
||||
landOwnersAndParcels[p.landData.ownerID].Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (LLUUID owner in landOwnersAndParcels.Keys)
|
||||
{
|
||||
int simArea = 0;
|
||||
int simPrims = 0;
|
||||
foreach (LandObject p in landOwnersAndParcels[owner])
|
||||
{
|
||||
simArea += p.landData.area;
|
||||
simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims +
|
||||
p.landData.selectedPrims;
|
||||
}
|
||||
|
||||
foreach (LandObject p in landOwnersAndParcels[owner])
|
||||
{
|
||||
p.landData.simwideArea = simArea;
|
||||
p.landData.simwidePrims = simPrims;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLandPrimCounts()
|
||||
{
|
||||
foreach (EntityBase obj in m_scene.Entities.Values)
|
||||
{
|
||||
if (obj is SceneObjectGroup)
|
||||
{
|
||||
m_scene.EventManager.TriggerParcelPrimCountAdd((SceneObjectGroup) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void performParcelPrimCountUpdate()
|
||||
{
|
||||
resetAllLandPrimCounts();
|
||||
m_scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
finalizeLandPrimCountUpdate();
|
||||
landPrimCountTainted = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Subdivides a piece of land
|
||||
/// </summary>
|
||||
|
@ -435,97 +511,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
return true;
|
||||
}
|
||||
|
||||
public void resetAllLandPrimCounts()
|
||||
{
|
||||
foreach (LandObject p in landList.Values)
|
||||
{
|
||||
p.resetLandPrimCounts();
|
||||
}
|
||||
}
|
||||
|
||||
public void setPrimsTainted()
|
||||
{
|
||||
landPrimCountTainted = true;
|
||||
}
|
||||
|
||||
public bool isLandPrimCountTainted()
|
||||
{
|
||||
return landPrimCountTainted;
|
||||
}
|
||||
|
||||
public void addPrimToLandPrimCounts(SceneObjectGroup obj)
|
||||
{
|
||||
LLVector3 position = obj.AbsolutePosition;
|
||||
ILandObject landUnderPrim = getLandObject(position.X, position.Y);
|
||||
if (landUnderPrim != null)
|
||||
{
|
||||
landUnderPrim.addPrimToCount(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public void removePrimFromLandPrimCounts(SceneObjectGroup obj)
|
||||
{
|
||||
foreach (LandObject p in landList.Values)
|
||||
{
|
||||
p.removePrimFromCount(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public void finalizeLandPrimCountUpdate()
|
||||
{
|
||||
//Get Simwide prim count for owner
|
||||
Dictionary<LLUUID, List<LandObject>> landOwnersAndParcels = new Dictionary<LLUUID, List<LandObject>>();
|
||||
foreach (LandObject p in landList.Values)
|
||||
{
|
||||
if (!landOwnersAndParcels.ContainsKey(p.landData.ownerID))
|
||||
{
|
||||
List<LandObject> tempList = new List<LandObject>();
|
||||
tempList.Add(p);
|
||||
landOwnersAndParcels.Add(p.landData.ownerID, tempList);
|
||||
}
|
||||
else
|
||||
{
|
||||
landOwnersAndParcels[p.landData.ownerID].Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (LLUUID owner in landOwnersAndParcels.Keys)
|
||||
{
|
||||
int simArea = 0;
|
||||
int simPrims = 0;
|
||||
foreach (LandObject p in landOwnersAndParcels[owner])
|
||||
{
|
||||
simArea += p.landData.area;
|
||||
simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims +
|
||||
p.landData.selectedPrims;
|
||||
}
|
||||
|
||||
foreach (LandObject p in landOwnersAndParcels[owner])
|
||||
{
|
||||
p.landData.simwideArea = simArea;
|
||||
p.landData.simwidePrims = simPrims;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLandPrimCounts()
|
||||
{
|
||||
foreach (EntityBase obj in m_scene.Entities.Values)
|
||||
{
|
||||
if (obj is SceneObjectGroup)
|
||||
{
|
||||
m_scene.EventManager.TriggerParcelPrimCountAdd((SceneObjectGroup)obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void performParcelPrimCountUpdate()
|
||||
{
|
||||
resetAllLandPrimCounts();
|
||||
m_scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
finalizeLandPrimCountUpdate();
|
||||
landPrimCountTainted = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Parcel Updating
|
||||
|
@ -652,7 +637,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
{
|
||||
for (y = 0; y < inc_y; y++)
|
||||
{
|
||||
|
||||
ILandObject currentParcel = null;
|
||||
try
|
||||
{
|
||||
|
@ -693,7 +677,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
if (landList.ContainsKey(packet.ParcelData.LocalID))
|
||||
{
|
||||
landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -719,6 +702,14 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
|
||||
#endregion
|
||||
|
||||
#region ILandChannel Members
|
||||
|
||||
public bool allowedForcefulBans
|
||||
{
|
||||
get { return m_allowedForcefulBans; }
|
||||
set { m_allowedForcefulBans = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the sim to the default land object (full sim piece of land owned by the default user)
|
||||
/// </summary>
|
||||
|
@ -816,7 +807,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
{
|
||||
if (presence.UUID == avatar.AgentId)
|
||||
{
|
||||
|
||||
List<ILandObject> checkLandParcels = parcelsNearPoint(presence.AbsolutePosition);
|
||||
foreach (ILandObject checkBan in checkLandParcels)
|
||||
{
|
||||
|
@ -873,11 +863,12 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sendLandUpdate(ScenePresence avatar)
|
||||
{
|
||||
sendLandUpdate(avatar, false);
|
||||
|
||||
}
|
||||
|
||||
public void handleSignificantClientMovement(IClientAPI remote_client)
|
||||
{
|
||||
ScenePresence clientAvatar = m_scene.GetScenePresence(remote_client.AgentId);
|
||||
|
@ -949,6 +940,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// If the economy has been validated by the economy module,
|
||||
// and land has been validated as well, this method transfers
|
||||
// the land ownership
|
||||
|
@ -990,16 +983,15 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
int saleprice = lob.landData.salePrice;
|
||||
LLUUID pOwnerID = lob.landData.ownerID;
|
||||
|
||||
bool landforsale = ((lob.landData.landFlags & (uint)(Parcel.ParcelFlags.ForSale | Parcel.ParcelFlags.ForSaleObjects | Parcel.ParcelFlags.SellParcelObjects)) != 0);
|
||||
bool landforsale = ((lob.landData.landFlags &
|
||||
(uint) (Parcel.ParcelFlags.ForSale | Parcel.ParcelFlags.ForSaleObjects | Parcel.ParcelFlags.SellParcelObjects)) != 0);
|
||||
if ((AuthorizedID == LLUUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice && landforsale)
|
||||
{
|
||||
lock (e)
|
||||
{
|
||||
e.parcelOwnerID = pOwnerID;
|
||||
e.landValidated = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
using Nini.Config;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Modules.World.Land;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules.World.Land
|
||||
|
@ -59,12 +58,10 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
|
||||
public void PostInitialise()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string Name
|
||||
|
@ -77,10 +74,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -33,7 +33,6 @@ using libsecondlife.Packets;
|
|||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Modules.World.Land;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules.World.Land
|
||||
|
@ -46,23 +45,16 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
#region Member Variables
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private bool[,] m_landBitmap = new bool[64,64];
|
||||
|
||||
protected LandData m_landData = new LandData();
|
||||
protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
|
||||
protected Scene m_scene;
|
||||
|
||||
private bool[,] m_landBitmap = new bool[64,64];
|
||||
protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
|
||||
|
||||
public bool[,] landBitmap
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_landBitmap;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_landBitmap = value;
|
||||
}
|
||||
get { return m_landBitmap; }
|
||||
set { m_landBitmap = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -71,15 +63,9 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
|
||||
public LandData landData
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_landData;
|
||||
}
|
||||
get { return m_landData; }
|
||||
|
||||
set
|
||||
{
|
||||
m_landData = value;
|
||||
}
|
||||
set { m_landData = value; }
|
||||
}
|
||||
|
||||
public LLUUID regionUUID
|
||||
|
@ -87,9 +73,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
get { return m_scene.RegionInfo.RegionID; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Constructors
|
||||
|
||||
public LandObject(LLUUID owner_id, bool is_group_owned, Scene scene)
|
||||
|
@ -261,6 +244,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
sendLandUpdateToAvatarsOverMe();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLandSold(LLUUID avatarID, LLUUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
|
||||
{
|
||||
LandData newData = landData.Copy();
|
||||
|
@ -344,7 +328,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " + Math.Round(avatars[i].AbsolutePosition.Y));
|
||||
m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " +
|
||||
Math.Round(avatars[i].AbsolutePosition.Y));
|
||||
}
|
||||
|
||||
if (over != null)
|
||||
|
@ -463,6 +448,25 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
|
||||
#region Update Functions
|
||||
|
||||
public void updateLandBitmapByteArray()
|
||||
{
|
||||
landData.landBitmapByteArray = convertLandBitmapToBytes();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update all settings in land such as area, bitmap byte array, etc
|
||||
/// </summary>
|
||||
public void forceUpdateLandInfo()
|
||||
{
|
||||
updateAABBAndAreaValues();
|
||||
updateLandBitmapByteArray();
|
||||
}
|
||||
|
||||
public void setLandBitmapFromByteArray()
|
||||
{
|
||||
landBitmap = convertBytesToLandBitmap();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the AABBMin and AABBMax values after area/shape modification of the land object
|
||||
/// </summary>
|
||||
|
@ -510,25 +514,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
landData.area = tempArea;
|
||||
}
|
||||
|
||||
public void updateLandBitmapByteArray()
|
||||
{
|
||||
landData.landBitmapByteArray = convertLandBitmapToBytes();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update all settings in land such as area, bitmap byte array, etc
|
||||
/// </summary>
|
||||
public void forceUpdateLandInfo()
|
||||
{
|
||||
updateAABBAndAreaValues();
|
||||
updateLandBitmapByteArray();
|
||||
}
|
||||
|
||||
public void setLandBitmapFromByteArray()
|
||||
{
|
||||
landBitmap = convertBytesToLandBitmap();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Land Bitmap Functions
|
||||
|
@ -561,57 +546,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
return landBitmap;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the land bitmap to a packet friendly byte array
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private byte[] convertLandBitmapToBytes()
|
||||
{
|
||||
byte[] tempConvertArr = new byte[512];
|
||||
byte tempByte = 0;
|
||||
int x, y, i, byteNum = 0;
|
||||
i = 0;
|
||||
for (y = 0; y < 64; y++)
|
||||
{
|
||||
for (x = 0; x < 64; x++)
|
||||
{
|
||||
tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++%8));
|
||||
if (i%8 == 0)
|
||||
{
|
||||
tempConvertArr[byteNum] = tempByte;
|
||||
tempByte = (byte) 0;
|
||||
i = 0;
|
||||
byteNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tempConvertArr;
|
||||
}
|
||||
|
||||
private bool[,] convertBytesToLandBitmap()
|
||||
{
|
||||
bool[,] tempConvertMap = new bool[64,64];
|
||||
tempConvertMap.Initialize();
|
||||
byte tempByte = 0;
|
||||
int x = 0, y = 0, i = 0, bitNum = 0;
|
||||
for (i = 0; i < 512; i++)
|
||||
{
|
||||
tempByte = landData.landBitmapByteArray[i];
|
||||
for (bitNum = 0; bitNum < 8; bitNum++)
|
||||
{
|
||||
bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1);
|
||||
tempConvertMap[x, y] = bit;
|
||||
x++;
|
||||
if (x > 63)
|
||||
{
|
||||
x = 0;
|
||||
y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tempConvertMap;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Full sim land object creation
|
||||
/// </summary>
|
||||
|
@ -705,6 +639,57 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
return bitmap_base;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the land bitmap to a packet friendly byte array
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private byte[] convertLandBitmapToBytes()
|
||||
{
|
||||
byte[] tempConvertArr = new byte[512];
|
||||
byte tempByte = 0;
|
||||
int x, y, i, byteNum = 0;
|
||||
i = 0;
|
||||
for (y = 0; y < 64; y++)
|
||||
{
|
||||
for (x = 0; x < 64; x++)
|
||||
{
|
||||
tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++ % 8));
|
||||
if (i % 8 == 0)
|
||||
{
|
||||
tempConvertArr[byteNum] = tempByte;
|
||||
tempByte = (byte) 0;
|
||||
i = 0;
|
||||
byteNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tempConvertArr;
|
||||
}
|
||||
|
||||
private bool[,] convertBytesToLandBitmap()
|
||||
{
|
||||
bool[,] tempConvertMap = new bool[64,64];
|
||||
tempConvertMap.Initialize();
|
||||
byte tempByte = 0;
|
||||
int x = 0, y = 0, i = 0, bitNum = 0;
|
||||
for (i = 0; i < 512; i++)
|
||||
{
|
||||
tempByte = landData.landBitmapByteArray[i];
|
||||
for (bitNum = 0; bitNum < 8; bitNum++)
|
||||
{
|
||||
bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1);
|
||||
tempConvertMap[x, y] = bit;
|
||||
x++;
|
||||
if (x > 63)
|
||||
{
|
||||
x = 0;
|
||||
y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tempConvertMap;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Object Select and Object Owner Listing
|
||||
|
@ -938,6 +923,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -110,6 +110,7 @@ namespace OpenSim.Region.Environment.Modules.ExportSerialiser
|
|||
private static void CreateCompressedXmlFile(MemoryStream xmlStream, string fileName)
|
||||
{
|
||||
#region GZip Compressed Version
|
||||
|
||||
FileStream objectsFileCompressed = new FileStream(fileName + ".gzs", FileMode.Create);
|
||||
MemoryStream gzipMSStream = new MemoryStream();
|
||||
GZipStream gzipStream = new GZipStream(gzipMSStream, CompressionMode.Compress);
|
||||
|
@ -117,6 +118,7 @@ namespace OpenSim.Region.Environment.Modules.ExportSerialiser
|
|||
gzipMSStream.WriteTo(objectsFileCompressed);
|
||||
objectsFileCompressed.Flush();
|
||||
objectsFileCompressed.Close();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,15 +39,17 @@ namespace OpenSim.Region.Environment.Modules
|
|||
{
|
||||
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private const double m_real_day = 24.0;
|
||||
private const int m_default_frame = 100;
|
||||
private int m_frame_mod;
|
||||
private const double m_real_day = 24.0;
|
||||
private double m_day_length;
|
||||
private int m_dilation;
|
||||
private int m_frame;
|
||||
private long m_start;
|
||||
private int m_frame_mod;
|
||||
|
||||
private Scene m_scene;
|
||||
private long m_start;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
|
@ -90,6 +92,8 @@ namespace OpenSim.Region.Environment.Modules
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void SunToClient(IClientAPI client)
|
||||
{
|
||||
client.SendSunPos(SunPos(HourOfTheDay()), new LLVector3(0, 0.0f, 10.0f));
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
|
||||
{
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
|
||||
{
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
|
||||
{
|
||||
|
|
|
@ -35,7 +35,6 @@ using Nini.Config;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Modules.Framework;
|
||||
using OpenSim.Region.Environment.Modules.World.Terrain;
|
||||
using OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders;
|
||||
using OpenSim.Region.Environment.Modules.World.Terrain.FloodBrushes;
|
||||
using OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes;
|
||||
|
@ -79,9 +78,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
|
|||
private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects =
|
||||
new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>();
|
||||
|
||||
private Dictionary<Location, ITerrainChannel> m_channels;
|
||||
|
||||
private ITerrainChannel m_channel;
|
||||
private Dictionary<Location, ITerrainChannel> m_channels;
|
||||
private Dictionary<string, ITerrainEffect> m_plugineffects;
|
||||
private ITerrainChannel m_revert;
|
||||
private Scene m_scene;
|
||||
|
@ -252,7 +250,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
|
|||
{
|
||||
m_plugineffects.Add(pluginType.Name, terEffect);
|
||||
m_log.Info("E ... " + pluginType.Name);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("E ... " + pluginType.Name + " (Already added)");
|
||||
}
|
||||
|
|
|
@ -44,13 +44,14 @@ namespace OpenSim.Region.Environment.Modules
|
|||
/// </summary>
|
||||
public class TreePopulatorModule : IRegionModule
|
||||
{
|
||||
private Scene m_scene;
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private List<LLUUID> m_trees;
|
||||
private Scene m_scene;
|
||||
|
||||
public double m_tree_density = 50.0; // Aim for this many per region
|
||||
public double m_tree_updates = 1000.0; // MS between updates
|
||||
private List<LLUUID> m_trees;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
|
@ -59,7 +60,8 @@ namespace OpenSim.Region.Environment.Modules
|
|||
m_tree_density = config.Configs["Trees"].GetDouble("tree_density", m_tree_density);
|
||||
}
|
||||
catch (Exception)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
m_trees = new List<LLUUID>();
|
||||
m_scene = scene;
|
||||
|
@ -72,7 +74,27 @@ namespace OpenSim.Region.Environment.Modules
|
|||
m_log.Debug("[TREES]: Initialised tree module");
|
||||
}
|
||||
|
||||
void EventManager_OnPluginConsole(string[] args)
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "TreePopulatorModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void EventManager_OnPluginConsole(string[] args)
|
||||
{
|
||||
if (args[0] == "tree")
|
||||
{
|
||||
|
@ -81,7 +103,7 @@ namespace OpenSim.Region.Environment.Modules
|
|||
}
|
||||
}
|
||||
|
||||
void growTrees()
|
||||
private void growTrees()
|
||||
{
|
||||
foreach (LLUUID tree in m_trees)
|
||||
{
|
||||
|
@ -101,7 +123,7 @@ namespace OpenSim.Region.Environment.Modules
|
|||
}
|
||||
}
|
||||
|
||||
void seedTrees()
|
||||
private void seedTrees()
|
||||
{
|
||||
foreach (LLUUID tree in m_trees)
|
||||
{
|
||||
|
@ -116,7 +138,6 @@ namespace OpenSim.Region.Environment.Modules
|
|||
SpawnChild(s_tree);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -125,7 +146,7 @@ namespace OpenSim.Region.Environment.Modules
|
|||
}
|
||||
}
|
||||
|
||||
void killTrees()
|
||||
private void killTrees()
|
||||
{
|
||||
foreach (LLUUID tree in m_trees)
|
||||
{
|
||||
|
@ -220,29 +241,11 @@ namespace OpenSim.Region.Environment.Modules
|
|||
tree.SendGroupFullUpdate();
|
||||
}
|
||||
|
||||
void CalculateTrees_Elapsed(object sender, ElapsedEventArgs e)
|
||||
private void CalculateTrees_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
growTrees();
|
||||
seedTrees();
|
||||
killTrees();
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "TreePopulatorModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue