Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
	OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
	OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
avinationmerge
Melanie 2012-11-11 16:31:01 +00:00
commit 389077345f
35 changed files with 1359 additions and 2209 deletions

View File

@ -55,8 +55,8 @@ namespace OpenSim.Region.ClientStack.Linden
public OSDMap body; public OSDMap body;
} }
//[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class EventQueueGetModule : IEventQueue, IRegionModule public class EventQueueGetModule : IEventQueue, INonSharedRegionModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -66,8 +66,6 @@ namespace OpenSim.Region.ClientStack.Linden
public int DebugLevel { get; set; } public int DebugLevel { get; set; }
protected Scene m_scene; protected Scene m_scene;
private IConfigSource m_gConfig;
bool enabledYN;
private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>(); private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>();
@ -75,34 +73,17 @@ namespace OpenSim.Region.ClientStack.Linden
private Dictionary<UUID, UUID> m_QueueUUIDAvatarMapping = new Dictionary<UUID, UUID>(); private Dictionary<UUID, UUID> m_QueueUUIDAvatarMapping = new Dictionary<UUID, UUID>();
private Dictionary<UUID, UUID> m_AvatarQueueUUIDMapping = new Dictionary<UUID, UUID>(); private Dictionary<UUID, UUID> m_AvatarQueueUUIDMapping = new Dictionary<UUID, UUID>();
#region IRegionModule methods #region INonSharedRegionModule methods
public virtual void Initialise(Scene scene, IConfigSource config) public virtual void Initialise(IConfigSource config)
{ {
m_gConfig = config; }
IConfig startupConfig = m_gConfig.Configs["Startup"]; public void AddRegion(Scene scene)
ReadConfigAndPopulate(scene, startupConfig, "Startup");
if (enabledYN)
{ {
m_scene = scene; m_scene = scene;
scene.RegisterModuleInterface<IEventQueue>(this); scene.RegisterModuleInterface<IEventQueue>(this);
// Register fallback handler
// Why does EQG Fail on region crossings!
//scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack);
// scene.EventManager.OnNewClient += OnNewClient;
// TODO: Leaving these open, or closing them when we
// become a child is incorrect. It messes up TP in a big
// way. CAPS/EQ need to be active as long as the UDP
// circuit is there.
scene.EventManager.OnClientClosed += ClientClosed; scene.EventManager.OnClientClosed += ClientClosed;
scene.EventManager.OnMakeChildAgent += MakeChildAgent; scene.EventManager.OnMakeChildAgent += MakeChildAgent;
scene.EventManager.OnRegisterCaps += OnRegisterCaps; scene.EventManager.OnRegisterCaps += OnRegisterCaps;
@ -117,18 +98,21 @@ namespace OpenSim.Region.ClientStack.Linden
+ " >= 2 - turns on poll notification", + " >= 2 - turns on poll notification",
HandleDebugEq); HandleDebugEq);
} }
else
public void RemoveRegion(Scene scene)
{ {
m_gConfig = null; if (m_scene != scene)
} return;
scene.EventManager.OnClientClosed -= ClientClosed;
scene.EventManager.OnMakeChildAgent -= MakeChildAgent;
scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
scene.UnregisterModuleInterface<IEventQueue>(this);
m_scene = null;
} }
private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p) public void RegionLoaded(Scene scene)
{
enabledYN = startupConfig.GetBoolean("EventQueue", true);
}
public void PostInitialise()
{ {
} }
@ -141,10 +125,11 @@ namespace OpenSim.Region.ClientStack.Linden
get { return "EventQueueGetModule"; } get { return "EventQueueGetModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return false; } get { return null; }
} }
#endregion #endregion
protected void HandleDebugEq(string module, string[] args) protected void HandleDebugEq(string module, string[] args)

View File

@ -32,6 +32,7 @@ using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using Mono.Addins;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
@ -41,30 +42,60 @@ using Caps=OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Region.ClientStack.Linden namespace OpenSim.Region.ClientStack.Linden
{ {
public class ObjectAdd : IRegionModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class ObjectAdd : INonSharedRegionModule
{ {
// private static readonly ILog m_log = // private static readonly ILog m_log =
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene; private Scene m_scene;
#region IRegionModule Members
public void Initialise(Scene pScene, IConfigSource pSource) #region INonSharedRegionModule Members
public void Initialise(IConfigSource pSource)
{ {
m_scene = pScene; }
public void AddRegion(Scene scene)
{
m_scene = scene;
m_scene.EventManager.OnRegisterCaps += RegisterCaps; m_scene.EventManager.OnRegisterCaps += RegisterCaps;
} }
public void PostInitialise() public void RemoveRegion(Scene scene)
{ {
if (m_scene == scene)
{
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
m_scene = null;
} }
}
public void RegionLoaded(Scene scene)
{
}
public void Close()
{
}
public string Name
{
get { return "ObjectAddModule"; }
}
public Type ReplaceableInterface
{
get { return null; }
}
#endregion
public void RegisterCaps(UUID agentID, Caps caps) public void RegisterCaps(UUID agentID, Caps caps)
{ {
UUID capuuid = UUID.Random(); UUID capuuid = UUID.Random();
// m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/"); // m_log.InfoFormat("[OBJECTADD]: {0}", "/CAPS/OA/" + capuuid + "/");
caps.RegisterHandler( caps.RegisterHandler(
"ObjectAdd", "ObjectAdd",
@ -73,7 +104,7 @@ namespace OpenSim.Region.ClientStack.Linden
"/CAPS/OA/" + capuuid + "/", "/CAPS/OA/" + capuuid + "/",
httpMethod => ProcessAdd(httpMethod, agentID, caps), httpMethod => ProcessAdd(httpMethod, agentID, caps),
"ObjectAdd", "ObjectAdd",
agentID.ToString()));; agentID.ToString())); ;
} }
public Hashtable ProcessAdd(Hashtable request, UUID AgentId, Caps cap) public Hashtable ProcessAdd(Hashtable request, UUID AgentId, Caps cap)
@ -138,7 +169,7 @@ namespace OpenSim.Region.ClientStack.Linden
return responsedata; return responsedata;
} }
OSDMap ObjMap = (OSDMap) rm["ObjectData"]; OSDMap ObjMap = (OSDMap)rm["ObjectData"];
bypass_raycast = ObjMap["BypassRaycast"].AsBoolean(); bypass_raycast = ObjMap["BypassRaycast"].AsBoolean();
everyone_mask = readuintval(ObjMap["EveryoneMask"]); everyone_mask = readuintval(ObjMap["EveryoneMask"]);
@ -195,9 +226,9 @@ namespace OpenSim.Region.ClientStack.Linden
state = ObjMap["State"].AsInteger(); state = ObjMap["State"].AsInteger();
try try
{ {
ray_end = ((OSDArray) ObjMap["RayEnd"]).AsVector3(); ray_end = ((OSDArray)ObjMap["RayEnd"]).AsVector3();
ray_start = ((OSDArray) ObjMap["RayStart"]).AsVector3(); ray_start = ((OSDArray)ObjMap["RayStart"]).AsVector3();
scale = ((OSDArray) ObjMap["Scale"]).AsVector3(); scale = ((OSDArray)ObjMap["Scale"]).AsVector3();
rotation = ((OSDArray)ObjMap["Rotation"]).AsQuaternion(); rotation = ((OSDArray)ObjMap["Rotation"]).AsQuaternion();
} }
catch (Exception) catch (Exception)
@ -214,7 +245,7 @@ namespace OpenSim.Region.ClientStack.Linden
return responsedata; return responsedata;
} }
OSDMap AgentDataMap = (OSDMap) rm["AgentData"]; OSDMap AgentDataMap = (OSDMap)rm["AgentData"];
//session_id = AgentDataMap["SessionId"].AsUUID(); //session_id = AgentDataMap["SessionId"].AsUUID();
group_id = AgentDataMap["GroupId"].AsUUID(); group_id = AgentDataMap["GroupId"].AsUUID();
@ -286,17 +317,17 @@ namespace OpenSim.Region.ClientStack.Linden
pbs.PathRevolutions = (byte)path_revolutions; pbs.PathRevolutions = (byte)path_revolutions;
pbs.PathScaleX = (byte)path_scale_x; pbs.PathScaleX = (byte)path_scale_x;
pbs.PathScaleY = (byte)path_scale_y; pbs.PathScaleY = (byte)path_scale_y;
pbs.PathShearX = (byte) path_shear_x; pbs.PathShearX = (byte)path_shear_x;
pbs.PathShearY = (byte)path_shear_y; pbs.PathShearY = (byte)path_shear_y;
pbs.PathSkew = (sbyte)path_skew; pbs.PathSkew = (sbyte)path_skew;
pbs.PathTaperX = (sbyte)path_taper_x; pbs.PathTaperX = (sbyte)path_taper_x;
pbs.PathTaperY = (sbyte)path_taper_y; pbs.PathTaperY = (sbyte)path_taper_y;
pbs.PathTwist = (sbyte)path_twist; pbs.PathTwist = (sbyte)path_twist;
pbs.PathTwistBegin = (sbyte)path_twist_begin; pbs.PathTwistBegin = (sbyte)path_twist_begin;
pbs.HollowShape = (HollowShape) hollow; pbs.HollowShape = (HollowShape)hollow;
pbs.PCode = (byte)p_code; pbs.PCode = (byte)p_code;
pbs.ProfileBegin = (ushort) profile_begin; pbs.ProfileBegin = (ushort)profile_begin;
pbs.ProfileCurve = (byte) profile_curve; pbs.ProfileCurve = (byte)profile_curve;
pbs.ProfileEnd = (ushort)profile_end; pbs.ProfileEnd = (ushort)profile_end;
pbs.Scale = scale; pbs.Scale = scale;
pbs.State = (byte)state; pbs.State = (byte)state;
@ -329,7 +360,7 @@ namespace OpenSim.Region.ClientStack.Linden
responsedata["int_response_code"] = 200; //501; //410; //404; responsedata["int_response_code"] = 200; //501; //410; //404;
responsedata["content_type"] = "text/plain"; responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false; responsedata["keepalive"] = false;
responsedata["str_response_string"] = String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>",ConvertUintToBytes(obj.LocalId)); responsedata["str_response_string"] = String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>", ConvertUintToBytes(obj.LocalId));
return responsedata; return responsedata;
} }
@ -347,24 +378,8 @@ namespace OpenSim.Region.ClientStack.Linden
byte[] resultbytes = Utils.UIntToBytes(val); byte[] resultbytes = Utils.UIntToBytes(val);
if (BitConverter.IsLittleEndian) if (BitConverter.IsLittleEndian)
Array.Reverse(resultbytes); Array.Reverse(resultbytes);
return String.Format("<binary encoding=\"base64\">{0}</binary>",Convert.ToBase64String(resultbytes)); return String.Format("<binary encoding=\"base64\">{0}</binary>", Convert.ToBase64String(resultbytes));
} }
public void Close()
{
}
public string Name
{
get { return "ObjectAddModule"; }
}
public bool IsSharedModule
{
get { return false; }
}
#endregion
} }
} }

View File

@ -36,13 +36,17 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.Agent.IPBan namespace OpenSim.Region.CoreModules.Agent.IPBan
{ {
public class IPBanModule : IRegionModule public class IPBanModule : ISharedRegionModule
{ {
#region Implementation of IRegionModule #region Implementation of ISharedRegionModule
private List<string> m_bans = new List<string>(); private List<string> m_bans = new List<string>();
public void Initialise(Scene scene, IConfigSource source) public void Initialise(IConfigSource source)
{
}
public void AddRegion(Scene scene)
{ {
new SceneBanner(scene, m_bans); new SceneBanner(scene, m_bans);
@ -58,6 +62,14 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
} }
} }
public void RemoveRegion(Scene scene)
{
}
public void RegionLoaded(Scene scene)
{
}
public void PostInitialise() public void PostInitialise()
{ {
if (File.Exists("bans.txt")) if (File.Exists("bans.txt"))
@ -80,9 +92,9 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
get { return "IPBanModule"; } get { return "IPBanModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return true; } get { return null; }
} }
#endregion #endregion

View File

@ -45,7 +45,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
{ {
public delegate void J2KDecodeDelegate(UUID assetID); public delegate void J2KDecodeDelegate(UUID assetID);
public class J2KDecoderModule : IRegionModule, IJ2KDecoder public class J2KDecoderModule : ISharedRegionModule, IJ2KDecoder
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -56,26 +56,21 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
/// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary> /// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary>
private IImprovedAssetCache m_cache; private IImprovedAssetCache m_cache;
/// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary> /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary>
private UUID m_CreatorID = UUID.Zero;
private Scene m_scene; private Scene m_scene;
#region IRegionModule #region ISharedRegionModule
private bool m_useCSJ2K = true; private bool m_useCSJ2K = true;
public string Name { get { return "J2KDecoderModule"; } } public string Name { get { return "J2KDecoderModule"; } }
public bool IsSharedModule { get { return true; } }
public J2KDecoderModule() public J2KDecoderModule()
{ {
} }
public void Initialise(Scene scene, IConfigSource source) public void Initialise(IConfigSource source)
{ {
if (m_scene == null)
m_scene = scene;
scene.RegisterModuleInterface<IJ2KDecoder>(this);
IConfig startupConfig = source.Configs["Startup"]; IConfig startupConfig = source.Configs["Startup"];
if (startupConfig != null) if (startupConfig != null)
{ {
@ -83,6 +78,24 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
} }
} }
public void AddRegion(Scene scene)
{
if (m_scene == null)
{
m_scene = scene;
m_CreatorID = scene.RegionInfo.RegionID;
}
scene.RegisterModuleInterface<IJ2KDecoder>(this);
}
public void RemoveRegion(Scene scene)
{
if (m_scene == scene)
m_scene = null;
}
public void PostInitialise() public void PostInitialise()
{ {
m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
@ -92,6 +105,15 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
{ {
} }
public void RegionLoaded(Scene scene)
{
}
public Type ReplaceableInterface
{
get { return null; }
}
#endregion IRegionModule #endregion IRegionModule
#region IJ2KDecoder #region IJ2KDecoder
@ -279,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
{ {
string assetID = "j2kCache_" + AssetId.ToString(); string assetID = "j2kCache_" + AssetId.ToString();
AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_scene.RegionInfo.RegionID.ToString()); AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_CreatorID.ToString());
layerDecodeAsset.Local = true; layerDecodeAsset.Local = true;
layerDecodeAsset.Temporary = true; layerDecodeAsset.Temporary = true;

View File

@ -35,9 +35,12 @@ using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.Agent.Xfer namespace OpenSim.Region.CoreModules.Agent.Xfer
{ {
public class XferModule : IRegionModule, IXfer [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class XferModule : INonSharedRegionModule, IXfer
{ {
private Scene m_scene; private Scene m_scene;
private Dictionary<string, FileData> NewFiles = new Dictionary<string, FileData>(); private Dictionary<string, FileData> NewFiles = new Dictionary<string, FileData>();
@ -59,9 +62,13 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
public int Count; public int Count;
} }
#region IRegionModule Members #region INonSharedRegionModule Members
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{
}
public void AddRegion(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient; m_scene.EventManager.OnNewClient += NewClient;
@ -69,8 +76,21 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
m_scene.RegisterModuleInterface<IXfer>(this); m_scene.RegisterModuleInterface<IXfer>(this);
} }
public void PostInitialise() public void RemoveRegion(Scene scene)
{ {
m_scene.EventManager.OnNewClient -= NewClient;
m_scene.UnregisterModuleInterface<IXfer>(this);
m_scene = null;
}
public void RegionLoaded(Scene scene)
{
}
public Type ReplaceableInterface
{
get { return null; }
} }
public void Close() public void Close()
@ -82,11 +102,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
get { return "XferModule"; } get { return "XferModule"; }
} }
public bool IsSharedModule
{
get { return false; }
}
#endregion #endregion
#region IXfer Members #region IXfer Members

View File

@ -49,8 +49,8 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
[assembly: Addin("FlotsamAssetCache", "1.1")] //[assembly: Addin("FlotsamAssetCache", "1.1")]
[assembly: AddinDependency("OpenSim", "0.5")] //[assembly: AddinDependency("OpenSim", "0.5")]
namespace OpenSim.Region.CoreModules.Asset namespace OpenSim.Region.CoreModules.Asset
{ {

View File

@ -39,9 +39,12 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
{ {
public class AvatarFactoryModule : IAvatarFactoryModule, IRegionModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class AvatarFactoryModule : IAvatarFactoryModule, INonSharedRegionModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -61,10 +64,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
#region IRegionModule #region IRegionModule
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{ {
scene.RegisterModuleInterface<IAvatarFactoryModule>(this);
scene.EventManager.OnNewClient += SubscribeToClientEvents;
IConfig appearanceConfig = config.Configs["Appearance"]; IConfig appearanceConfig = config.Configs["Appearance"];
if (appearanceConfig != null) if (appearanceConfig != null)
@ -74,11 +75,29 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime);
} }
if (m_scene == null)
m_scene = scene;
} }
public void PostInitialise() public void AddRegion(Scene scene)
{
if (m_scene == null)
m_scene = scene;
scene.RegisterModuleInterface<IAvatarFactoryModule>(this);
scene.EventManager.OnNewClient += SubscribeToClientEvents;
}
public void RemoveRegion(Scene scene)
{
if (scene == m_scene)
{
scene.UnregisterModuleInterface<IAvatarFactoryModule>(this);
scene.EventManager.OnNewClient -= SubscribeToClientEvents;
}
m_scene = null;
}
public void RegionLoaded(Scene scene)
{ {
m_updateTimer.Enabled = false; m_updateTimer.Enabled = false;
m_updateTimer.AutoReset = true; m_updateTimer.AutoReset = true;
@ -100,6 +119,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
get { return false; } get { return false; }
} }
public Type ReplaceableInterface
{
get { return null; }
}
private void SubscribeToClientEvents(IClientAPI client) private void SubscribeToClientEvents(IClientAPI client)
{ {
client.OnRequestWearables += Client_OnRequestWearables; client.OnRequestWearables += Client_OnRequestWearables;

View File

@ -33,9 +33,12 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenMetaverse; using OpenMetaverse;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
{ {
public class CombatModule : IRegionModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class CombatModule : ISharedRegionModule
{ {
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -54,7 +57,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
/// </summary> /// </summary>
/// <param name="scene"></param> /// <param name="scene"></param>
/// <param name="config"></param> /// <param name="config"></param>
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{
}
public void AddRegion(Scene scene)
{ {
lock (m_scenel) lock (m_scenel)
{ {
@ -72,6 +79,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
} }
public void RemoveRegion(Scene scene)
{
if (m_scenel.ContainsKey(scene.RegionInfo.RegionHandle))
m_scenel.Remove(scene.RegionInfo.RegionHandle);
scene.EventManager.OnAvatarKilled -= KillAvatar;
scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
}
public void RegionLoaded(Scene scene)
{
}
public void PostInitialise() public void PostInitialise()
{ {
} }
@ -85,11 +105,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
get { return "CombatModule"; } get { return "CombatModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return true; } get { return null; }
} }
private void KillAvatar(uint killerObjectLocalID, ScenePresence deadAvatar) private void KillAvatar(uint killerObjectLocalID, ScenePresence deadAvatar)
{ {
string deadAvatarMessage; string deadAvatarMessage;

View File

@ -32,6 +32,7 @@ using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using Mono.Addins;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
@ -39,16 +40,27 @@ using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.Avatar.Dialog namespace OpenSim.Region.CoreModules.Avatar.Dialog
{ {
public class DialogModule : IRegionModule, IDialogModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class DialogModule : IDialogModule, INonSharedRegionModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Scene m_scene; protected Scene m_scene;
public void Initialise(Scene scene, IConfigSource source) public void Initialise(IConfigSource source) { }
public Type ReplaceableInterface { get { return null; } }
public void AddRegion(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_scene.RegisterModuleInterface<IDialogModule>(this); m_scene.RegisterModuleInterface<IDialogModule>(this);
}
public void RegionLoaded(Scene scene)
{
if (scene != m_scene)
return;
m_scene.AddCommand( m_scene.AddCommand(
"Users", this, "alert", "alert <message>", "Users", this, "alert", "alert <message>",
@ -56,22 +68,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
HandleAlertConsoleCommand); HandleAlertConsoleCommand);
m_scene.AddCommand( m_scene.AddCommand(
"Users", this, "alert-user", "alert-user <first> <last> <message>", "Users", this, "alert-user",
"alert-user <first> <last> <message>",
"Send an alert to a user", "Send an alert to a user",
HandleAlertConsoleCommand); HandleAlertConsoleCommand);
} }
public void PostInitialise() {} public void RemoveRegion(Scene scene)
public void Close() {} {
if (scene != m_scene)
return;
m_scene.UnregisterModuleInterface<IDialogModule>(this);
}
public void Close() { }
public string Name { get { return "Dialog Module"; } } public string Name { get { return "Dialog Module"; } }
public bool IsSharedModule { get { return false; } }
public void SendAlertToUser(IClientAPI client, string message) public void SendAlertToUser(IClientAPI client, string message)
{ {
SendAlertToUser(client, message, false); SendAlertToUser(client, message, false);
} }
public void SendAlertToUser(IClientAPI client, string message, bool modal) public void SendAlertToUser(IClientAPI client, string message,
bool modal)
{ {
client.SendAgentAlertMessage(message, modal); client.SendAgentAlertMessage(message, modal);
} }
@ -89,11 +109,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
sp.ControllingClient.SendAgentAlertMessage(message, modal); sp.ControllingClient.SendAgentAlertMessage(message, modal);
} }
public void SendAlertToUser(string firstName, string lastName, string message, bool modal) public void SendAlertToUser(string firstName, string lastName,
string message, bool modal)
{ {
ScenePresence presence = m_scene.GetScenePresence(firstName, lastName); ScenePresence presence = m_scene.GetScenePresence(firstName,
lastName);
if (presence != null) if (presence != null)
presence.ControllingClient.SendAgentAlertMessage(message, modal); {
presence.ControllingClient.SendAgentAlertMessage(message,
modal);
}
} }
public void SendGeneralAlert(string message) public void SendGeneralAlert(string message)
@ -104,11 +129,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
}); });
} }
public void SendDialogToUser( public void SendDialogToUser(UUID avatarID, string objectName,
UUID avatarID, string objectName, UUID objectID, UUID ownerID, UUID objectID, UUID ownerID, string message, UUID textureID,
string message, UUID textureID, int ch, string[] buttonlabels) int ch, string[] buttonlabels)
{ {
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerID); UserAccount account = m_scene.UserAccountService.GetUserAccount(
m_scene.RegionInfo.ScopeID, ownerID);
string ownerFirstName, ownerLastName; string ownerFirstName, ownerLastName;
if (account != null) if (account != null)
{ {
@ -123,22 +149,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
ScenePresence sp = m_scene.GetScenePresence(avatarID); ScenePresence sp = m_scene.GetScenePresence(avatarID);
if (sp != null) if (sp != null)
sp.ControllingClient.SendDialog( {
objectName, objectID, ownerID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels); sp.ControllingClient.SendDialog(objectName, objectID, ownerID,
ownerFirstName, ownerLastName, message, textureID, ch,
buttonlabels);
}
} }
public void SendUrlToUser( public void SendUrlToUser(UUID avatarID, string objectName,
UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url) UUID objectID, UUID ownerID, bool groupOwned, string message,
string url)
{ {
ScenePresence sp = m_scene.GetScenePresence(avatarID); ScenePresence sp = m_scene.GetScenePresence(avatarID);
if (sp != null) if (sp != null)
sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); {
sp.ControllingClient.SendLoadURL(objectName, objectID,
ownerID, groupOwned, message, url);
}
} }
public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid) public void SendTextBoxToUser(UUID avatarid, string message,
int chatChannel, string name, UUID objectid, UUID ownerid)
{ {
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); UserAccount account = m_scene.UserAccountService.GetUserAccount(
m_scene.RegionInfo.ScopeID, ownerid);
string ownerFirstName, ownerLastName; string ownerFirstName, ownerLastName;
UUID ownerID = UUID.Zero; UUID ownerID = UUID.Zero;
if (account != null) if (account != null)
@ -156,15 +191,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
ScenePresence sp = m_scene.GetScenePresence(avatarid); ScenePresence sp = m_scene.GetScenePresence(avatarid);
if (sp != null) if (sp != null)
sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerID, ownerFirstName, ownerLastName, objectid); {
sp.ControllingClient.SendTextBoxRequest(message, chatChannel,
name, ownerID, ownerFirstName, ownerLastName,
objectid);
}
} }
public void SendNotificationToUsersInRegion( public void SendNotificationToUsersInRegion(UUID fromAvatarID,
UUID fromAvatarID, string fromAvatarName, string message) string fromAvatarName, string message)
{ {
m_scene.ForEachRootClient(delegate(IClientAPI client) m_scene.ForEachRootClient(delegate(IClientAPI client)
{ {
client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); client.SendBlueBoxMessage(fromAvatarID, fromAvatarName,
message);
}); });
} }
@ -173,10 +213,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
/// </summary> /// </summary>
/// <param name="module"></param> /// <param name="module"></param>
/// <param name="cmdparams"></param> /// <param name="cmdparams"></param>
public void HandleAlertConsoleCommand(string module, string[] cmdparams) public void HandleAlertConsoleCommand(string module,
string[] cmdparams)
{
if (m_scene.ConsoleScene() != null &&
m_scene.ConsoleScene() != m_scene)
{ {
if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene)
return; return;
}
string message = string.Empty; string message = string.Empty;
@ -192,9 +236,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
string firstName = cmdparams[1]; string firstName = cmdparams[1];
string lastName = cmdparams[2]; string lastName = cmdparams[2];
message = CombineParams(cmdparams, 3); message = CombineParams(cmdparams, 3);
m_log.InfoFormat( m_log.InfoFormat("[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}",
"[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", m_scene.RegionInfo.RegionName, firstName, lastName,
m_scene.RegionInfo.RegionName, firstName, lastName, message); message);
SendAlertToUser(firstName, lastName, message, false); SendAlertToUser(firstName, lastName, message, false);
} }
else else

View File

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
@ -35,25 +36,45 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.Avatar.Gestures namespace OpenSim.Region.CoreModules.Avatar.Gestures
{ {
public class GesturesModule : IRegionModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class GesturesModule : INonSharedRegionModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Scene m_scene; protected Scene m_scene;
public void Initialise(Scene scene, IConfigSource source) public void Initialise(IConfigSource source)
{
}
public void AddRegion(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_scene.EventManager.OnNewClient += OnNewClient; m_scene.EventManager.OnNewClient += OnNewClient;
} }
public void PostInitialise() {} public void RegionLoaded(Scene scene)
{
}
public void RemoveRegion(Scene scene)
{
m_scene.EventManager.OnNewClient -= OnNewClient;
m_scene = null;
}
public void Close() {} public void Close() {}
public string Name { get { return "Gestures Module"; } } public string Name { get { return "Gestures Module"; } }
public bool IsSharedModule { get { return false; } }
public Type ReplaceableInterface
{
get { return null; }
}
private void OnNewClient(IClientAPI client) private void OnNewClient(IClientAPI client)
{ {

View File

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
@ -50,9 +51,12 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
using OSDArray = OpenMetaverse.StructuredData.OSDArray; using OSDArray = OpenMetaverse.StructuredData.OSDArray;
using OSDMap = OpenMetaverse.StructuredData.OSDMap; using OSDMap = OpenMetaverse.StructuredData.OSDMap;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.Avatar.Gods namespace OpenSim.Region.CoreModules.Avatar.Gods
{ {
public class GodsModule : IRegionModule, IGodsModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class GodsModule : INonSharedRegionModule, IGodsModule
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -66,10 +70,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
protected Dictionary<UUID, string> m_capsDict = protected Dictionary<UUID, string> m_capsDict =
new Dictionary<UUID, string>(); new Dictionary<UUID, string>();
public void Initialise(Scene scene, IConfigSource source) protected IDialogModule DialogModule
{
get
{
if (m_dialogModule == null)
m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
return m_dialogModule;
}
}
public void Initialise(IConfigSource source)
{
}
public void AddRegion(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
m_scene.RegisterModuleInterface<IGodsModule>(this); m_scene.RegisterModuleInterface<IGodsModule>(this);
m_scene.EventManager.OnNewClient += SubscribeToClientEvents; m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
@ -78,10 +96,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
OnIncomingInstantMessage; OnIncomingInstantMessage;
} }
public void PostInitialise() {} public void RemoveRegion(Scene scene)
{
m_scene.UnregisterModuleInterface<IGodsModule>(this);
m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
m_scene = null;
}
public void RegionLoaded(Scene scene)
{
}
public void Close() {} public void Close() {}
public string Name { get { return "Gods Module"; } } public string Name { get { return "Gods Module"; } }
public bool IsSharedModule { get { return false; } }
public Type ReplaceableInterface
{
get { return null; }
}
public void SubscribeToClientEvents(IClientAPI client) public void SubscribeToClientEvents(IClientAPI client)
{ {
@ -172,8 +204,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
} }
else else
{ {
if (m_dialogModule != null) if (DialogModule != null)
m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); DialogModule.SendAlertToUser(agentID, "Request for god powers denied");
} }
} }
} }

View File

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
@ -34,9 +35,12 @@ using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.Avatar.Groups namespace OpenSim.Region.CoreModules.Avatar.Groups
{ {
public class GroupsModule : IRegionModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class GroupsModule : ISharedRegionModule
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -55,9 +59,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
private static GroupMembershipData osGroup = private static GroupMembershipData osGroup =
new GroupMembershipData(); new GroupMembershipData();
#region IRegionModule Members private bool m_Enabled = false;
public void Initialise(Scene scene, IConfigSource config) #region ISharedRegionModule Members
public void Initialise(IConfigSource config)
{ {
IConfig groupsConfig = config.Configs["Groups"]; IConfig groupsConfig = config.Configs["Groups"];
@ -67,7 +73,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
} }
else else
{ {
if (!groupsConfig.GetBoolean("Enabled", false)) m_Enabled = groupsConfig.GetBoolean("Enabled", false);
if (!m_Enabled)
{ {
m_log.Info("[GROUPS]: Groups disabled in configuration"); m_log.Info("[GROUPS]: Groups disabled in configuration");
return; return;
@ -77,6 +84,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
return; return;
} }
}
public void AddRegion(Scene scene)
{
if (!m_Enabled)
return;
lock (m_SceneList) lock (m_SceneList)
{ {
if (!m_SceneList.Contains(scene)) if (!m_SceneList.Contains(scene))
@ -96,7 +110,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed; scene.EventManager.OnClientClosed += OnClientClosed;
// scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; // scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
}
public void RemoveRegion(Scene scene)
{
if (!m_Enabled)
return;
lock (m_SceneList)
{
if (m_SceneList.Contains(scene))
m_SceneList.Remove(scene);
}
scene.EventManager.OnNewClient -= OnNewClient;
scene.EventManager.OnClientClosed -= OnClientClosed;
}
public void RegionLoaded(Scene scene)
{
} }
public void PostInitialise() public void PostInitialise()
@ -105,6 +138,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
public void Close() public void Close()
{ {
if (!m_Enabled)
return;
// m_log.Debug("[GROUPS]: Shutting down group module."); // m_log.Debug("[GROUPS]: Shutting down group module.");
lock (m_ClientMap) lock (m_ClientMap)
@ -123,9 +159,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
get { return "GroupsModule"; } get { return "GroupsModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return true; } get { return null; }
} }
#endregion #endregion

View File

@ -39,20 +39,18 @@ using OpenSim.Framework.Console;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{ {
/// <summary> /// <summary>
/// This module loads and saves OpenSimulator inventory archives /// This module loads and saves OpenSimulator inventory archives
/// </summary> /// </summary>
public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class InventoryArchiverModule : ISharedRegionModule, IInventoryArchiverModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string Name { get { return "Inventory Archiver Module"; } }
public bool IsSharedModule { get { return true; } }
/// <value> /// <value>
/// Enable or disable checking whether the iar user is actually logged in /// Enable or disable checking whether the iar user is actually logged in
/// </value> /// </value>
@ -99,9 +97,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// public InventoryArchiverModule(bool disablePresenceChecks) // public InventoryArchiverModule(bool disablePresenceChecks)
// { // {
// DisablePresenceChecks = disablePresenceChecks; // DisablePresenceChecks = disablePresenceChecks;
// } // }
public void Initialise(Scene scene, IConfigSource source) #region ISharedRegionModule
public void Initialise(IConfigSource source)
{
}
public void AddRegion(Scene scene)
{ {
if (m_scenes.Count == 0) if (m_scenes.Count == 0)
{ {
@ -144,10 +148,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_scenes[scene.RegionInfo.RegionID] = scene; m_scenes[scene.RegionInfo.RegionID] = scene;
} }
public void PostInitialise() {} public void RemoveRegion(Scene scene)
{
}
public void Close() {} public void Close() {}
public void RegionLoaded(Scene scene)
{
}
public void PostInitialise()
{
}
public Type ReplaceableInterface
{
get { return null; }
}
public string Name { get { return "Inventory Archiver Module"; } }
#endregion
/// <summary> /// <summary>
/// Trigger the inventory archive saved event. /// Trigger the inventory archive saved event.
/// </summary> /// </summary>

View File

@ -38,10 +38,12 @@ using OpenSim.Region.CoreModules.Framework.Monitoring.Alerts;
using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors; using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.Framework.Monitoring namespace OpenSim.Region.CoreModules.Framework.Monitoring
{ {
public class MonitorModule : IRegionModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class MonitorModule : INonSharedRegionModule
{ {
/// <summary> /// <summary>
/// Is this module enabled? /// Is this module enabled?
@ -62,14 +64,14 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
private readonly List<IAlert> m_alerts = new List<IAlert>(); private readonly List<IAlert> m_alerts = new List<IAlert>();
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
#region Implementation of IRegionModule
public MonitorModule() public MonitorModule()
{ {
Enabled = true; Enabled = true;
} }
public void Initialise(Scene scene, IConfigSource source) #region Implementation of INonSharedRegionModule
public void Initialise(IConfigSource source)
{ {
IConfig cnfg = source.Configs["Monitoring"]; IConfig cnfg = source.Configs["Monitoring"];
@ -79,6 +81,13 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
if (!Enabled) if (!Enabled)
return; return;
}
public void AddRegion(Scene scene)
{
if (!Enabled)
return;
m_scene = scene; m_scene = scene;
m_scene.AddCommand("General", this, "monitor report", m_scene.AddCommand("General", this, "monitor report",
@ -89,101 +98,42 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID, StatsPage); MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID, StatsPage);
MainServer.Instance.AddHTTPHandler( MainServer.Instance.AddHTTPHandler(
"/monitorstats/" + Uri.EscapeDataString(m_scene.RegionInfo.RegionName), StatsPage); "/monitorstats/" + Uri.EscapeDataString(m_scene.RegionInfo.RegionName), StatsPage);
AddMonitors();
} }
public void DebugMonitors(string module, string[] args) public void RemoveRegion(Scene scene)
{
foreach (IMonitor monitor in m_staticMonitors)
{
MainConsole.Instance.OutputFormat(
"[MONITOR MODULE]: {0} reports {1} = {2}",
m_scene.RegionInfo.RegionName, monitor.GetFriendlyName(), monitor.GetFriendlyValue());
}
foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats())
{
MainConsole.Instance.OutputFormat(
"[MONITOR MODULE]: {0} reports {1} = {2}",
m_scene.RegionInfo.RegionName, tuple.Key, tuple.Value);
}
}
public void TestAlerts()
{
foreach (IAlert alert in m_alerts)
{
alert.Test();
}
}
public Hashtable StatsPage(Hashtable request)
{
// If request was for a specific monitor
// eg url/?monitor=Monitor.Name
if (request.ContainsKey("monitor"))
{
string monID = (string) request["monitor"];
foreach (IMonitor monitor in m_staticMonitors)
{
string elemName = monitor.ToString();
if (elemName.StartsWith(monitor.GetType().Namespace))
elemName = elemName.Substring(monitor.GetType().Namespace.Length + 1);
if (elemName == monID || monitor.ToString() == monID)
{
Hashtable ereply3 = new Hashtable();
ereply3["int_response_code"] = 404; // 200 OK
ereply3["str_response_string"] = monitor.GetValue().ToString();
ereply3["content_type"] = "text/plain";
return ereply3;
}
}
// FIXME: Arguably this should also be done with dynamic monitors but I'm not sure what the above code
// is even doing. Why are we inspecting the type of the monitor???
// No monitor with that name
Hashtable ereply2 = new Hashtable();
ereply2["int_response_code"] = 404; // 200 OK
ereply2["str_response_string"] = "No such monitor";
ereply2["content_type"] = "text/plain";
return ereply2;
}
string xml = "<data>";
foreach (IMonitor monitor in m_staticMonitors)
{
string elemName = monitor.GetName();
xml += "<" + elemName + ">" + monitor.GetValue().ToString() + "</" + elemName + ">";
// m_log.DebugFormat("[MONITOR MODULE]: {0} = {1}", elemName, monitor.GetValue());
}
foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats())
{
xml += "<" + tuple.Key + ">" + tuple.Value + "</" + tuple.Key + ">";
}
xml += "</data>";
Hashtable ereply = new Hashtable();
ereply["int_response_code"] = 200; // 200 OK
ereply["str_response_string"] = xml;
ereply["content_type"] = "text/xml";
return ereply;
}
public void PostInitialise()
{ {
if (!Enabled) if (!Enabled)
return; return;
MainServer.Instance.RemoveHTTPHandler("GET", "/monitorstats/" + m_scene.RegionInfo.RegionID);
MainServer.Instance.RemoveHTTPHandler("GET", "/monitorstats/" + Uri.EscapeDataString(m_scene.RegionInfo.RegionName));
m_scene = null;
}
public void Close()
{
}
public string Name
{
get { return "Region Health Monitoring Module"; }
}
public void RegionLoaded(Scene scene)
{
}
public Type ReplaceableInterface
{
get { return null; }
}
#endregion
public void AddMonitors()
{
m_staticMonitors.Add(new AgentCountMonitor(m_scene)); m_staticMonitors.Add(new AgentCountMonitor(m_scene));
m_staticMonitors.Add(new ChildAgentCountMonitor(m_scene)); m_staticMonitors.Add(new ChildAgentCountMonitor(m_scene));
m_staticMonitors.Add(new GCMemoryMonitor()); m_staticMonitors.Add(new GCMemoryMonitor());
@ -357,25 +307,98 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
} }
} }
public void DebugMonitors(string module, string[] args)
{
foreach (IMonitor monitor in m_staticMonitors)
{
MainConsole.Instance.OutputFormat(
"[MONITOR MODULE]: {0} reports {1} = {2}",
m_scene.RegionInfo.RegionName, monitor.GetFriendlyName(), monitor.GetFriendlyValue());
}
foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats())
{
MainConsole.Instance.OutputFormat(
"[MONITOR MODULE]: {0} reports {1} = {2}",
m_scene.RegionInfo.RegionName, tuple.Key, tuple.Value);
}
}
public void TestAlerts()
{
foreach (IAlert alert in m_alerts)
{
alert.Test();
}
}
public Hashtable StatsPage(Hashtable request)
{
// If request was for a specific monitor
// eg url/?monitor=Monitor.Name
if (request.ContainsKey("monitor"))
{
string monID = (string) request["monitor"];
foreach (IMonitor monitor in m_staticMonitors)
{
string elemName = monitor.ToString();
if (elemName.StartsWith(monitor.GetType().Namespace))
elemName = elemName.Substring(monitor.GetType().Namespace.Length + 1);
if (elemName == monID || monitor.ToString() == monID)
{
Hashtable ereply3 = new Hashtable();
ereply3["int_response_code"] = 404; // 200 OK
ereply3["str_response_string"] = monitor.GetValue().ToString();
ereply3["content_type"] = "text/plain";
return ereply3;
}
}
// FIXME: Arguably this should also be done with dynamic monitors but I'm not sure what the above code
// is even doing. Why are we inspecting the type of the monitor???
// No monitor with that name
Hashtable ereply2 = new Hashtable();
ereply2["int_response_code"] = 404; // 200 OK
ereply2["str_response_string"] = "No such monitor";
ereply2["content_type"] = "text/plain";
return ereply2;
}
string xml = "<data>";
foreach (IMonitor monitor in m_staticMonitors)
{
string elemName = monitor.GetName();
xml += "<" + elemName + ">" + monitor.GetValue().ToString() + "</" + elemName + ">";
// m_log.DebugFormat("[MONITOR MODULE]: {0} = {1}", elemName, monitor.GetValue());
}
foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats())
{
xml += "<" + tuple.Key + ">" + tuple.Value + "</" + tuple.Key + ">";
}
xml += "</data>";
Hashtable ereply = new Hashtable();
ereply["int_response_code"] = 200; // 200 OK
ereply["str_response_string"] = xml;
ereply["content_type"] = "text/xml";
return ereply;
}
void OnTriggerAlert(System.Type reporter, string reason, bool fatal) void OnTriggerAlert(System.Type reporter, string reason, bool fatal)
{ {
m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")"); m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")");
} }
public void Close()
{
}
public string Name
{
get { return "Region Health Monitoring Module"; }
}
public bool IsSharedModule
{
get { return false; }
}
#endregion
} }
} }

View File

@ -1,150 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using System.Text;
using log4net;
using Nini.Config;
using Nwc.XmlRpc;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.InterGrid
{
public class OGSRadmin : IRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly List<Scene> m_scenes = new List<Scene>();
private IConfigSource m_settings;
#region Implementation of IRegionModuleBase
public string Name
{
get { return "OGS Supporting RAdmin"; }
}
public void Initialise(IConfigSource source)
{
m_settings = source;
}
public void Close()
{
}
public void AddRegion(Scene scene)
{
lock (m_scenes)
m_scenes.Add(scene);
}
public void RemoveRegion(Scene scene)
{
lock (m_scenes)
m_scenes.Remove(scene);
}
public void RegionLoaded(Scene scene)
{
}
public void PostInitialise()
{
if (m_settings.Configs["Startup"].GetBoolean("gridmode", false))
{
MainServer.Instance.AddXmlRPCHandler("grid_message", GridWideMessage);
}
}
#endregion
#region IRegionModule
public void Initialise(Scene scene, IConfigSource source)
{
m_settings = source;
lock (m_scenes)
m_scenes.Add(scene);
}
public bool IsSharedModule
{
get { return true; }
}
#endregion
public XmlRpcResponse GridWideMessage(XmlRpcRequest req, IPEndPoint remoteClient)
{
XmlRpcResponse response = new XmlRpcResponse();
Hashtable responseData = new Hashtable();
Hashtable requestData = (Hashtable)req.Params[0];
// REFACTORING PROBLEM. This authorization needs to be replaced with some other
//if ((!requestData.Contains("password") || (string)requestData["password"] != m_com.NetworkServersInfo.GridRecvKey))
//{
// responseData["accepted"] = false;
// responseData["success"] = false;
// responseData["error"] = "Invalid Key";
// response.Value = responseData;
// return response;
//}
string message = (string)requestData["message"];
string user = (string)requestData["user"];
m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
lock (m_scenes)
foreach (Scene scene in m_scenes)
{
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
if (dialogModule != null)
dialogModule.SendNotificationToUsersInRegion(UUID.Random(), user, message);
}
responseData["accepted"] = true;
responseData["success"] = true;
response.Value = responseData;
return response;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,13 @@
<RegionModule id="GlynnTuckerAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" /> <RegionModule id="GlynnTuckerAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" />
<RegionModule id="CenomeMemoryAssetCache" type="OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache"/> <RegionModule id="CenomeMemoryAssetCache" type="OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache"/>
<RegionModule id="LibraryModule" type="OpenSim.Region.CoreModules.Framework.Library.LibraryModule"/> <RegionModule id="LibraryModule" type="OpenSim.Region.CoreModules.Framework.Library.LibraryModule"/>
<RegionModule id="SunModule" type="OpenSim.Region.CoreModules.SunModule"/>
<RegionModule id="WindModule" type="OpenSim.Region.CoreModules.WindModule"/>
<RegionModule id="MapSearchModule" type="OpenSim.Region.CoreModules.World.WorldMap.MapSearchModule"/>
<RegionModule id="VegetationModule" type="OpenSim.Region.CoreModules.Avatar.Vegetation.VegetationModule"/>
<RegionModule id="IPBanModule" type="OpenSim.Region.CoreModules.Agent.IPBan.IPBanModule"/>
<RegionModule id="J2KDecoderModule" type="OpenSim.Region.CoreModules.Agent.TextureSender.J2KDecoderModule"/>
<RegionModule id="CloudModule" type="OpenSim.Region.CoreModules.CloudModule"/>
<!-- Service connectors OUT modules --> <!-- Service connectors OUT modules -->
<RegionModule id="LocalAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.LocalAssetServicesConnector" /> <RegionModule id="LocalAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.LocalAssetServicesConnector" />
<RegionModule id="RemoteAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.RemoteAssetServicesConnector" /> <RegionModule id="RemoteAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.RemoteAssetServicesConnector" />

View File

@ -29,8 +29,12 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Nini.Config; using Nini.Config;
using Mono.Addins;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
@ -86,7 +90,8 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.Scripting.WorldComm namespace OpenSim.Region.CoreModules.Scripting.WorldComm
{ {
public class WorldCommModule : IRegionModule, IWorldComm [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class WorldCommModule : IWorldComm, INonSharedRegionModule
{ {
// private static readonly ILog m_log = // private static readonly ILog m_log =
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -101,9 +106,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
private int m_saydistance = 20; private int m_saydistance = 20;
private int m_shoutdistance = 100; private int m_shoutdistance = 100;
#region IRegionModule Members #region INonSharedRegionModule Members
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{ {
// wrap this in a try block so that defaults will work if // wrap this in a try block so that defaults will work if
// the config file doesn't specify otherwise. // the config file doesn't specify otherwise.
@ -111,23 +116,23 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
int maxhandles = 64; int maxhandles = 64;
try try
{ {
m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); m_whisperdistance = config.Configs["Chat"].GetInt(
m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); "whisper_distance", m_whisperdistance);
m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); m_saydistance = config.Configs["Chat"].GetInt(
maxlisteners = config.Configs["LL-Functions"].GetInt("max_listens_per_region", maxlisteners); "say_distance", m_saydistance);
maxhandles = config.Configs["LL-Functions"].GetInt("max_listens_per_script", maxhandles); m_shoutdistance = config.Configs["Chat"].GetInt(
"shout_distance", m_shoutdistance);
maxlisteners = config.Configs["LL-Functions"].GetInt(
"max_listens_per_region", maxlisteners);
maxhandles = config.Configs["LL-Functions"].GetInt(
"max_listens_per_script", maxhandles);
} }
catch (Exception) catch (Exception)
{ {
} }
if (maxlisteners < 1) maxlisteners = int.MaxValue; if (maxlisteners < 1) maxlisteners = int.MaxValue;
if (maxhandles < 1) maxhandles = int.MaxValue; if (maxhandles < 1) maxhandles = int.MaxValue;
m_scene = scene;
m_scene.RegisterModuleInterface<IWorldComm>(this);
m_listenerManager = new ListenerManager(maxlisteners, maxhandles); m_listenerManager = new ListenerManager(maxlisteners, maxhandles);
m_scene.EventManager.OnChatFromClient += DeliverClientMessage;
m_scene.EventManager.OnChatBroadcast += DeliverClientMessage;
m_pendingQ = new Queue(); m_pendingQ = new Queue();
m_pending = Queue.Synchronized(m_pendingQ); m_pending = Queue.Synchronized(m_pendingQ);
} }
@ -136,6 +141,26 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
{ {
} }
public void AddRegion(Scene scene)
{
m_scene = scene;
m_scene.RegisterModuleInterface<IWorldComm>(this);
m_scene.EventManager.OnChatFromClient += DeliverClientMessage;
m_scene.EventManager.OnChatBroadcast += DeliverClientMessage;
}
public void RegionLoaded(Scene scene) { }
public void RemoveRegion(Scene scene)
{
if (scene != m_scene)
return;
m_scene.UnregisterModuleInterface<IWorldComm>(this);
m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage;
m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage;
}
public void Close() public void Close()
{ {
} }
@ -145,10 +170,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
get { return "WorldCommModule"; } get { return "WorldCommModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface { get { return null; } }
{
get { return false; }
}
#endregion #endregion
@ -280,7 +302,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
/// <param name="name">name of sender (object or avatar)</param> /// <param name="name">name of sender (object or avatar)</param>
/// <param name="id">key of sender (object or avatar)</param> /// <param name="id">key of sender (object or avatar)</param>
/// <param name="msg">msg to sent</param> /// <param name="msg">msg to sent</param>
public void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg, Vector3 position) public void DeliverMessage(ChatTypeEnum type, int channel,
string name, UUID id, string msg, Vector3 position)
{ {
// m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}", // m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}",
// type, channel, name, id, msg); // type, channel, name, id, msg);
@ -288,17 +311,21 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
// Determine which listen event filters match the given set of arguments, this results // Determine which listen event filters match the given set of arguments, this results
// in a limited set of listeners, each belonging a host. If the host is in range, add them // in a limited set of listeners, each belonging a host. If the host is in range, add them
// to the pending queue. // to the pending queue.
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) foreach (ListenerInfo li
in m_listenerManager.GetListeners(UUID.Zero, channel,
name, id, msg))
{ {
// Dont process if this message is from yourself! // Dont process if this message is from yourself!
if (li.GetHostID().Equals(id)) if (li.GetHostID().Equals(id))
continue; continue;
SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID()); SceneObjectPart sPart = m_scene.GetSceneObjectPart(
li.GetHostID());
if (sPart == null) if (sPart == null)
continue; continue;
double dis = Util.GetDistanceTo(sPart.AbsolutePosition, position); double dis = Util.GetDistanceTo(sPart.AbsolutePosition,
position);
switch (type) switch (type)
{ {
case ChatTypeEnum.Whisper: case ChatTypeEnum.Whisper:
@ -400,11 +427,12 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
if (li.GetHostID().Equals(id)) if (li.GetHostID().Equals(id))
continue; continue;
SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID()); SceneObjectPart sPart = m_scene.GetSceneObjectPart(
li.GetHostID());
if (sPart == null) if (sPart == null)
continue; continue;
if ( li.GetHostID().Equals(target)) if (li.GetHostID().Equals(target))
{ {
QueueMessage(new ListenerInfo(li, name, id, msg)); QueueMessage(new ListenerInfo(li, name, id, msg));
break; break;
@ -458,9 +486,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
private void DeliverClientMessage(Object sender, OSChatMessage e) private void DeliverClientMessage(Object sender, OSChatMessage e)
{ {
if (null != e.Sender) if (null != e.Sender)
DeliverMessage(e.Type, e.Channel, e.Sender.Name, e.Sender.AgentId, e.Message, e.Position); {
DeliverMessage(e.Type, e.Channel, e.Sender.Name,
e.Sender.AgentId, e.Message, e.Position);
}
else else
DeliverMessage(e.Type, e.Channel, e.From, UUID.Zero, e.Message, e.Position); {
DeliverMessage(e.Type, e.Channel, e.From, UUID.Zero,
e.Message, e.Position);
}
} }
public Object[] GetSerializationData(UUID itemID) public Object[] GetSerializationData(UUID itemID)
@ -477,7 +511,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
public class ListenerManager public class ListenerManager
{ {
private Dictionary<int, List<ListenerInfo>> m_listeners = new Dictionary<int, List<ListenerInfo>>(); private Dictionary<int, List<ListenerInfo>> m_listeners =
new Dictionary<int, List<ListenerInfo>>();
private int m_maxlisteners; private int m_maxlisteners;
private int m_maxhandles; private int m_maxhandles;
private int m_curlisteners; private int m_curlisteners;
@ -536,7 +571,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
regexBitfield); regexBitfield);
List<ListenerInfo> listeners; List<ListenerInfo> listeners;
if (!m_listeners.TryGetValue(channel,out listeners)) if (!m_listeners.TryGetValue(
channel, out listeners))
{ {
listeners = new List<ListenerInfo>(); listeners = new List<ListenerInfo>();
m_listeners.Add(channel, listeners); m_listeners.Add(channel, listeners);
@ -555,11 +591,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
{ {
lock (m_listeners) lock (m_listeners)
{ {
foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) foreach (KeyValuePair<int, List<ListenerInfo>> lis
in m_listeners)
{ {
foreach (ListenerInfo li in lis.Value) foreach (ListenerInfo li in lis.Value)
{ {
if (li.GetItemID().Equals(itemID) && li.GetHandle().Equals(handle)) if (li.GetItemID().Equals(itemID) &&
li.GetHandle().Equals(handle))
{ {
lis.Value.Remove(li); lis.Value.Remove(li);
if (lis.Value.Count == 0) if (lis.Value.Count == 0)
@ -582,13 +620,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
lock (m_listeners) lock (m_listeners)
{ {
foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) foreach (KeyValuePair<int, List<ListenerInfo>> lis
in m_listeners)
{ {
foreach (ListenerInfo li in lis.Value) foreach (ListenerInfo li in lis.Value)
{ {
if (li.GetItemID().Equals(itemID)) if (li.GetItemID().Equals(itemID))
{ {
// store them first, else the enumerated bails on us // store them first, else the enumerated bails on
// us
removedListeners.Add(li); removedListeners.Add(li);
} }
} }
@ -615,11 +655,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
{ {
lock (m_listeners) lock (m_listeners)
{ {
foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) foreach (KeyValuePair<int, List<ListenerInfo>> lis
in m_listeners)
{ {
foreach (ListenerInfo li in lis.Value) foreach (ListenerInfo li in lis.Value)
{ {
if (li.GetItemID().Equals(itemID) && li.GetHandle() == handle) if (li.GetItemID().Equals(itemID) &&
li.GetHandle() == handle)
{ {
li.Activate(); li.Activate();
// only one, bail out // only one, bail out
@ -634,11 +676,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
{ {
lock (m_listeners) lock (m_listeners)
{ {
foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) foreach (KeyValuePair<int, List<ListenerInfo>> lis
in m_listeners)
{ {
foreach (ListenerInfo li in lis.Value) foreach (ListenerInfo li in lis.Value)
{ {
if (li.GetItemID().Equals(itemID) && li.GetHandle() == handle) if (li.GetItemID().Equals(itemID) &&
li.GetHandle() == handle)
{ {
li.Deactivate(); li.Deactivate();
// only one, bail out // only one, bail out
@ -649,13 +693,18 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
} }
} }
// non-locked access, since its always called in the context of the lock /// <summary>
/// non-locked access, since its always called in the context of the
/// lock
/// </summary>
/// <param name="itemID"></param>
/// <returns></returns>
private int GetNewHandle(UUID itemID) private int GetNewHandle(UUID itemID)
{ {
List<int> handles = new List<int>(); List<int> handles = new List<int>();
// build a list of used keys for this specific itemID... // build a list of used keys for this specific itemID...
foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) foreach (KeyValuePair<int, List<ListenerInfo>> lis in m_listeners)
{ {
foreach (ListenerInfo li in lis.Value) foreach (ListenerInfo li in lis.Value)
{ {
@ -690,17 +739,30 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
#endregion #endregion
// Theres probably a more clever and efficient way to /// <summary>
// do this, maybe with regex. /// Get listeners matching the input parameters.
// PM2008: Ha, one could even be smart and define a specialized Enumerator. /// </summary>
public List<ListenerInfo> GetListeners(UUID itemID, int channel, string name, UUID id, string msg) /// <remarks>
/// Theres probably a more clever and efficient way to do this, maybe
/// with regex.
/// PM2008: Ha, one could even be smart and define a specialized
/// Enumerator.
/// </remarks>
/// <param name="itemID"></param>
/// <param name="channel"></param>
/// <param name="name"></param>
/// <param name="id"></param>
/// <param name="msg"></param>
/// <returns></returns>
public List<ListenerInfo> GetListeners(UUID itemID, int channel,
string name, UUID id, string msg)
{ {
List<ListenerInfo> collection = new List<ListenerInfo>(); List<ListenerInfo> collection = new List<ListenerInfo>();
lock (m_listeners) lock (m_listeners)
{ {
List<ListenerInfo> listeners; List<ListenerInfo> listeners;
if (!m_listeners.TryGetValue(channel,out listeners)) if (!m_listeners.TryGetValue(channel, out listeners))
{ {
return collection; return collection;
} }
@ -711,7 +773,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
{ {
continue; continue;
} }
if (!itemID.Equals(UUID.Zero) && !li.GetItemID().Equals(itemID)) if (!itemID.Equals(UUID.Zero) &&
!li.GetItemID().Equals(itemID))
{ {
continue; continue;
} }
@ -776,28 +839,68 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
lock (m_listeners) lock (m_listeners)
{ {
if (!m_listeners.ContainsKey((int)item[2])) if (!m_listeners.ContainsKey((int)item[2]))
m_listeners.Add((int)item[2], new List<ListenerInfo>()); {
m_listeners.Add((int)item[2],
new List<ListenerInfo>());
}
m_listeners[(int)item[2]].Add(info); m_listeners[(int)item[2]].Add(info);
} }
idx+=dataItemLength; idx += dataItemLength;
} }
} }
} }
public class ListenerInfo : IWorldCommListenerInfo public class ListenerInfo : IWorldCommListenerInfo
{ {
private bool m_active; // Listener is active or not /// <summary>
private int m_handle; // Assigned handle of this listener /// Listener is active or not
private uint m_localID; // Local ID from script engine /// </summary>
private UUID m_itemID; // ID of the host script engine private bool m_active;
private UUID m_hostID; // ID of the host/scene part
private int m_channel; // Channel
private UUID m_id; // ID to filter messages from
private string m_name; // Object name to filter messages from
private string m_message; // The message
public ListenerInfo(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message) /// <summary>
/// Assigned handle of this listener
/// </summary>
private int m_handle;
/// <summary>
/// Local ID from script engine
/// </summary>
private uint m_localID;
/// <summary>
/// ID of the host script engine
/// </summary>
private UUID m_itemID;
/// <summary>
/// ID of the host/scene part
/// </summary>
private UUID m_hostID;
/// <summary>
/// Channel
/// </summary>
private int m_channel;
/// <summary>
/// ID to filter messages from
/// </summary>
private UUID m_id;
/// <summary>
/// Object name to filter messages from
/// </summary>
private string m_name;
/// <summary>
/// The message
/// </summary>
private string m_message;
public ListenerInfo(int handle, uint localID, UUID ItemID,
UUID hostID, int channel, string name, UUID id,
string message)
{ {
Initialise(handle, localID, ItemID, hostID, channel, name, id, Initialise(handle, localID, ItemID, hostID, channel, name, id,
message, 0); message, 0);
@ -811,17 +914,23 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
message, regexBitfield); message, regexBitfield);
} }
public ListenerInfo(ListenerInfo li, string name, UUID id, string message) public ListenerInfo(ListenerInfo li, string name, UUID id,
string message)
{ {
Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message, 0); Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID,
li.m_channel, name, id, message, 0);
} }
public ListenerInfo(ListenerInfo li, string name, UUID id, string message, int regexBitfield) public ListenerInfo(ListenerInfo li, string name, UUID id,
string message, int regexBitfield)
{ {
Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message, regexBitfield); Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID,
li.m_channel, name, id, message, regexBitfield);
} }
private void Initialise(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message, int regexBitfield) private void Initialise(int handle, uint localID, UUID ItemID,
UUID hostID, int channel, string name, UUID id,
string message, int regexBitfield)
{ {
m_active = true; m_active = true;
m_handle = handle; m_handle = handle;
@ -850,9 +959,12 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
return data; return data;
} }
public static ListenerInfo FromData(uint localID, UUID ItemID, UUID hostID, Object[] data) public static ListenerInfo FromData(uint localID, UUID ItemID,
UUID hostID, Object[] data)
{ {
ListenerInfo linfo = new ListenerInfo((int)data[1], localID, ItemID, hostID, (int)data[2], (string)data[3], (UUID)data[4], (string)data[5]); ListenerInfo linfo = new ListenerInfo((int)data[1], localID,
ItemID, hostID, (int)data[2], (string)data[3],
(UUID)data[4], (string)data[5]);
linfo.m_active = (bool)data[0]; linfo.m_active = (bool)data[0];
if (data.Length >= 7) if (data.Length >= 7)
{ {

View File

@ -35,7 +35,7 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules namespace OpenSim.Region.CoreModules
{ {
public class CloudModule : ICloudModule public class CloudModule : ICloudModule, INonSharedRegionModule
{ {
// private static readonly log4net.ILog m_log // private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules
private float m_cloudDensity = 1.0F; private float m_cloudDensity = 1.0F;
private float[] cloudCover = new float[16 * 16]; private float[] cloudCover = new float[16 * 16];
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{ {
IConfig cloudConfig = config.Configs["Cloud"]; IConfig cloudConfig = config.Configs["Cloud"];
@ -59,8 +59,12 @@ namespace OpenSim.Region.CoreModules
m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000); m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000);
} }
if (m_enabled) }
public void AddRegion(Scene scene)
{ {
if (!m_enabled)
return;
m_scene = scene; m_scene = scene;
@ -71,9 +75,24 @@ namespace OpenSim.Region.CoreModules
GenerateCloudCover(); GenerateCloudCover();
m_ready = true; m_ready = true;
} }
public void RemoveRegion(Scene scene)
{
if (!m_enabled)
return;
m_ready = false;
// Remove our hooks
m_scene.EventManager.OnNewClient -= CloudsToClient;
m_scene.EventManager.OnFrame -= CloudUpdate;
m_scene.UnregisterModuleInterface<ICloudModule>(this);
m_scene = null;
}
public void RegionLoaded(Scene scene)
{
} }
public void PostInitialise() public void PostInitialise()
@ -82,13 +101,6 @@ namespace OpenSim.Region.CoreModules
public void Close() public void Close()
{ {
if (m_enabled)
{
m_ready = false;
// Remove our hooks
m_scene.EventManager.OnNewClient -= CloudsToClient;
m_scene.EventManager.OnFrame -= CloudUpdate;
}
} }
public string Name public string Name
@ -96,12 +108,11 @@ namespace OpenSim.Region.CoreModules
get { return "CloudModule"; } get { return "CloudModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return false; } get { return null; }
} }
public float CloudCover(int x, int y, int z) public float CloudCover(int x, int y, int z)
{ {
float cover = 0f; float cover = 0f;

View File

@ -267,26 +267,17 @@ namespace OpenSim.Region.CoreModules
return GetCurrentSunHour() + 6.0f; return GetCurrentSunHour() + 6.0f;
} }
#region IRegion Methods #region INonSharedRegion Methods
// Called immediately after the module is loaded for a given region // Called immediately after the module is loaded for a given region
// i.e. Immediately after instance creation. // i.e. Immediately after instance creation.
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{ {
m_scene = scene;
m_frame = 0; m_frame = 0;
// This one puts an entry in the main help screen // This one puts an entry in the main help screen
// m_scene.AddCommand("Regions", this, "sun", "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); // m_scene.AddCommand("Regions", this, "sun", "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
// This one enables the ability to type just "sun" without any parameters
// m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand);
foreach (KeyValuePair<string, string> kvp in GetParamList())
{
string sunCommand = string.Format("sun {0}", kvp.Key);
m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand);
}
TimeZone local = TimeZone.CurrentTimeZone; TimeZone local = TimeZone.CurrentTimeZone;
TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset); m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset);
@ -358,15 +349,6 @@ namespace OpenSim.Region.CoreModules
HorizonShift = m_HorizonShift; // Z axis translation HorizonShift = m_HorizonShift; // Z axis translation
// HoursToRadians = (SunCycle/24)*VWTimeRatio; // HoursToRadians = (SunCycle/24)*VWTimeRatio;
// Insert our event handling hooks
scene.EventManager.OnFrame += SunUpdate;
scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate;
scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour;
ready = true;
m_log.Debug("[SUN]: Mode is " + m_RegionMode); m_log.Debug("[SUN]: Mode is " + m_RegionMode);
m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days");
m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift); m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift);
@ -376,14 +358,37 @@ namespace OpenSim.Region.CoreModules
break; break;
} }
scene.RegisterModuleInterface<ISunModule>(this);
} }
public void PostInitialise() public Type ReplaceableInterface
{ {
get { return null; }
} }
public void Close() public void AddRegion(Scene scene)
{
m_scene = scene;
// Insert our event handling hooks
scene.EventManager.OnFrame += SunUpdate;
scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate;
scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour;
scene.RegisterModuleInterface<ISunModule>(this);
// This one enables the ability to type just "sun" without any parameters
// m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand);
foreach (KeyValuePair<string, string> kvp in GetParamList())
{
string sunCommand = string.Format("sun {0}", kvp.Key);
m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand);
}
ready = true;
}
public void RemoveRegion(Scene scene)
{ {
ready = false; ready = false;
@ -394,16 +399,19 @@ namespace OpenSim.Region.CoreModules
m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
} }
public void RegionLoaded(Scene scene)
{
}
public void Close()
{
}
public string Name public string Name
{ {
get { return "SunModule"; } get { return "SunModule"; }
} }
public bool IsSharedModule
{
get { return false; }
}
#endregion #endregion
#region EventManager Events #region EventManager Events

View File

@ -36,7 +36,7 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.Avatar.Vegetation namespace OpenSim.Region.CoreModules.Avatar.Vegetation
{ {
public class VegetationModule : IRegionModule, IVegetationModule public class VegetationModule : INonSharedRegionModule, IVegetationModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -45,16 +45,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree }; protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree };
public PCode[] CreationCapabilities { get { return creationCapabilities; } } public PCode[] CreationCapabilities { get { return creationCapabilities; } }
public void Initialise(Scene scene, IConfigSource source) public void Initialise(IConfigSource source)
{
}
public void AddRegion(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_scene.RegisterModuleInterface<IVegetationModule>(this); m_scene.RegisterModuleInterface<IVegetationModule>(this);
} }
public void PostInitialise() {} public void RemoveRegion(Scene scene)
{
m_scene.UnregisterModuleInterface<IVegetationModule>(this);
}
public void Close() {} public void Close() {}
public string Name { get { return "Vegetation Module"; } } public string Name { get { return "Vegetation Module"; } }
public bool IsSharedModule { get { return false; } }
public Type ReplaceableInterface
{
get { return null; }
}
public void RegionLoaded(Scene scene)
{
}
public SceneObjectGroup AddTree( public SceneObjectGroup AddTree(
UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree) UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree)

View File

@ -52,31 +52,31 @@ namespace OpenSim.Region.CoreModules
private bool m_ready = false; private bool m_ready = false;
private bool m_enabled = false; private bool m_enabled = false;
private IConfig m_windConfig;
private IWindModelPlugin m_activeWindPlugin = null; private IWindModelPlugin m_activeWindPlugin = null;
private const string m_dWindPluginName = "SimpleRandomWind"; private string m_dWindPluginName = "SimpleRandomWind";
private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>(); private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>();
// Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m
private Vector2[] windSpeeds = new Vector2[16 * 16]; private Vector2[] windSpeeds = new Vector2[16 * 16];
#region IRegion Methods #region INonSharedRegionModule Methods
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{ {
IConfig windConfig = config.Configs["Wind"]; m_windConfig = config.Configs["Wind"];
string desiredWindPlugin = m_dWindPluginName; string desiredWindPlugin = m_dWindPluginName;
if (windConfig != null) if (m_windConfig != null)
{ {
m_enabled = windConfig.GetBoolean("enabled", true); m_enabled = m_windConfig.GetBoolean("enabled", true);
m_frameUpdateRate = windConfig.GetInt("wind_update_rate", 150); m_frameUpdateRate = m_windConfig.GetInt("wind_update_rate", 150);
// Determine which wind model plugin is desired // Determine which wind model plugin is desired
if (windConfig.Contains("wind_plugin")) if (m_windConfig.Contains("wind_plugin"))
{ {
desiredWindPlugin = windConfig.GetString("wind_plugin"); m_dWindPluginName = m_windConfig.GetString("wind_plugin", m_dWindPluginName);
} }
} }
@ -84,6 +84,15 @@ namespace OpenSim.Region.CoreModules
{ {
m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate);
}
}
public void AddRegion(Scene scene)
{
if (!m_enabled)
return;
m_scene = scene; m_scene = scene;
m_frame = 0; m_frame = 0;
@ -95,16 +104,16 @@ namespace OpenSim.Region.CoreModules
} }
// Check for desired plugin // Check for desired plugin
if (m_availableWindPlugins.ContainsKey(desiredWindPlugin)) if (m_availableWindPlugins.ContainsKey(m_dWindPluginName))
{ {
m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin]; m_activeWindPlugin = m_availableWindPlugins[m_dWindPluginName];
m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName);
if (windConfig != null) if (m_windConfig != null)
{ {
m_activeWindPlugin.Initialise(); m_activeWindPlugin.Initialise();
m_activeWindPlugin.WindConfig(m_scene, windConfig); m_activeWindPlugin.WindConfig(m_scene, m_windConfig);
} }
} }
@ -112,20 +121,20 @@ namespace OpenSim.Region.CoreModules
// if the plug-in wasn't found, default to no wind. // if the plug-in wasn't found, default to no wind.
if (m_activeWindPlugin == null) if (m_activeWindPlugin == null)
{ {
m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_dWindPluginName);
m_log.ErrorFormat("[WIND] Defaulting to no wind."); m_log.ErrorFormat("[WIND] Defaulting to no wind.");
} }
// This one puts an entry in the main help screen // This one puts an entry in the main help screen
// m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); // m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
// This one enables the ability to type just the base command without any parameters // This one enables the ability to type just the base command without any parameters
// m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand); // m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand);
// Get a list of the parameters for each plugin // Get a list of the parameters for each plugin
foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values)
{ {
// m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); // m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand);
m_scene.AddCommand( m_scene.AddCommand(
"Regions", "Regions",
this, this,
@ -154,19 +163,13 @@ namespace OpenSim.Region.CoreModules
// Mark Module Ready for duty // Mark Module Ready for duty
m_ready = true; m_ready = true;
} }
} public void RemoveRegion(Scene scene)
{
if (!m_enabled)
return;
public void PostInitialise()
{
}
public void Close()
{
if (m_enabled)
{
m_ready = false; m_ready = false;
// REVIEW: If a region module is closed, is there a possibility that it'll re-open/initialize ?? // REVIEW: If a region module is closed, is there a possibility that it'll re-open/initialize ??
@ -181,7 +184,11 @@ namespace OpenSim.Region.CoreModules
// Remove our hooks // Remove our hooks
m_scene.EventManager.OnFrame -= WindUpdate; m_scene.EventManager.OnFrame -= WindUpdate;
m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion; m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion;
} }
public void Close()
{
} }
public string Name public string Name
@ -189,11 +196,14 @@ namespace OpenSim.Region.CoreModules
get { return "WindModule"; } get { return "WindModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return false; } get { return null; }
} }
public void RegionLoaded(Scene scene)
{
}
#endregion #endregion

View File

@ -24,6 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
@ -37,16 +38,21 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
namespace OpenSim.Region.CoreModules.World.WorldMap namespace OpenSim.Region.CoreModules.World.WorldMap
{ {
public class MapSearchModule : IRegionModule public class MapSearchModule : ISharedRegionModule
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
Scene m_scene = null; // only need one for communication with GridService Scene m_scene = null; // only need one for communication with GridService
List<Scene> m_scenes = new List<Scene>(); List<Scene> m_scenes = new List<Scene>();
List<UUID> m_Clients;
#region IRegionModule Members #region ISharedRegionModule Members
public void Initialise(Scene scene, IConfigSource source) public void Initialise(IConfigSource source)
{
}
public void AddRegion(Scene scene)
{ {
if (m_scene == null) if (m_scene == null)
{ {
@ -55,6 +61,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
m_scenes.Add(scene); m_scenes.Add(scene);
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
m_Clients = new List<UUID>();
}
public void RemoveRegion(Scene scene)
{
m_scenes.Remove(scene);
if (m_scene == scene && m_scenes.Count > 0)
m_scene = m_scenes[0];
scene.EventManager.OnNewClient -= OnNewClient;
} }
public void PostInitialise() public void PostInitialise()
@ -72,16 +88,44 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
get { return "MapSearchModule"; } get { return "MapSearchModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return true; } get { return null; }
} }
public void RegionLoaded(Scene scene)
{
}
#endregion #endregion
private void OnNewClient(IClientAPI client) private void OnNewClient(IClientAPI client)
{ {
client.OnMapNameRequest += OnMapNameRequest; client.OnMapNameRequest += OnMapNameRequestHandler;
}
private void OnMapNameRequestHandler(IClientAPI remoteClient, string mapName, uint flags)
{
lock (m_Clients)
{
if (m_Clients.Contains(remoteClient.AgentId))
return;
m_Clients.Add(remoteClient.AgentId);
}
Util.FireAndForget(delegate
{
try
{
OnMapNameRequest(remoteClient, mapName, flags);
}
finally
{
lock (m_Clients)
m_Clients.Remove(remoteClient.AgentId);
}
});
} }
private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags)
@ -175,6 +219,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
}); });
} }
private void AddFinalBlock(List<MapBlockData> blocks)
{
// final block, closing the search result
MapBlockData data = new MapBlockData();
data.Agents = 0;
data.Access = 255;
data.MapImageId = UUID.Zero;
data.Name = "";
data.RegionFlags = 0;
data.WaterHeight = 0; // not used
data.X = 0;
data.Y = 0;
blocks.Add(data);
}
// private Scene GetClientScene(IClientAPI client) // private Scene GetClientScene(IClientAPI client)
// { // {
// foreach (Scene s in m_scenes) // foreach (Scene s in m_scenes)

View File

@ -35,15 +35,20 @@ using System.Xml;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using Mono.Addins;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Region.DataSnapshot.Interfaces; using OpenSim.Region.DataSnapshot.Interfaces;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
[assembly: Addin("DataSnapshot", "0.1")]
[assembly: AddinDependency("OpenSim", "0.5")]
namespace OpenSim.Region.DataSnapshot namespace OpenSim.Region.DataSnapshot
{ {
public class DataSnapshotManager : IRegionModule, IDataSnapshot [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class DataSnapshotManager : ISharedRegionModule, IDataSnapshot
{ {
#region Class members #region Class members
//Information from config //Information from config
@ -95,7 +100,7 @@ namespace OpenSim.Region.DataSnapshot
#region IRegionModule #region IRegionModule
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{ {
if (!m_configLoaded) if (!m_configLoaded)
{ {
@ -133,26 +138,21 @@ namespace OpenSim.Region.DataSnapshot
m_enabled = false; m_enabled = false;
return; return;
} }
}
if (m_enabled) if (m_enabled)
{
//Hand it the first scene, assuming that all scenes have the same BaseHTTPServer
new DataRequestHandler(scene, this);
m_hostname = scene.RegionInfo.ExternalHostName;
m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname); m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname);
MakeEverythingStale();
if (m_dataServices != "" && m_dataServices != "noservices")
NotifyDataServices(m_dataServices, "online");
}
} }
if (m_enabled) }
}
public void AddRegion(Scene scene)
{ {
m_log.Info("[DATASNAPSHOT]: Scene added to module."); if (!m_enabled)
return;
m_log.DebugFormat("[DATASNAPSHOT]: Module added to Scene {0}.", scene.RegionInfo.RegionName);
m_snapStore.AddScene(scene); m_snapStore.AddScene(scene);
m_scenes.Add(scene); m_scenes.Add(scene);
@ -174,41 +174,85 @@ namespace OpenSim.Region.DataSnapshot
m_dataproviders.Add(module); m_dataproviders.Add(module);
m_snapStore.AddProvider(module); m_snapStore.AddProvider(module);
m_log.Info("[DATASNAPSHOT]: Added new data provider type: " + pluginType.Name); m_log.Debug("[DATASNAPSHOT]: Added new data provider type: " + pluginType.Name);
}
} }
} }
} }
} }
//scene.OnRestart += OnSimRestart; public void RemoveRegion(Scene scene)
scene.EventManager.OnShutdown += delegate() { OnSimRestart(scene.RegionInfo); };
}
else
{ {
//m_log.Debug("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else)."); if (!m_enabled)
return;
m_log.Info("[DATASNAPSHOT]: Region " + scene.RegionInfo.RegionName + " is being removed, removing from indexing");
Scene restartedScene = SceneForUUID(scene.RegionInfo.RegionID);
m_scenes.Remove(restartedScene);
m_snapStore.RemoveScene(restartedScene);
//Getting around the fact that we can't remove objects from a collection we are enumerating over
List<IDataSnapshotProvider> providersToRemove = new List<IDataSnapshotProvider>();
foreach (IDataSnapshotProvider provider in m_dataproviders)
{
if (provider.GetParentScene == restartedScene)
{
providersToRemove.Add(provider);
} }
} }
foreach (IDataSnapshotProvider provider in providersToRemove)
{
m_dataproviders.Remove(provider);
m_snapStore.RemoveProvider(provider);
}
m_snapStore.RemoveScene(restartedScene);
}
public void PostInitialise()
{
if (!m_enabled)
return;
//Hand it the first scene, assuming that all scenes have the same BaseHTTPServer
new DataRequestHandler(m_scenes[0], this);
m_hostname = m_scenes[0].RegionInfo.ExternalHostName;
if (m_dataServices != "" && m_dataServices != "noservices")
NotifyDataServices(m_dataServices, "online");
}
public void RegionLoaded(Scene scene)
{
if (!m_enabled)
return;
m_log.DebugFormat("[DATASNAPSHOT]: Marking scene {0} as stale.", scene.RegionInfo.RegionName);
m_snapStore.ForceSceneStale(scene);
}
public void Close() public void Close()
{ {
if (!m_enabled)
return;
if (m_enabled && m_dataServices != "" && m_dataServices != "noservices") if (m_enabled && m_dataServices != "" && m_dataServices != "noservices")
NotifyDataServices(m_dataServices, "offline"); NotifyDataServices(m_dataServices, "offline");
} }
public bool IsSharedModule
{
get { return true; }
}
public string Name public string Name
{ {
get { return "External Data Generator"; } get { return "External Data Generator"; }
} }
public void PostInitialise() public Type ReplaceableInterface
{ {
get { return null; }
} }
#endregion #endregion
@ -399,35 +443,7 @@ namespace OpenSim.Region.DataSnapshot
m_snapStore.ForceSceneStale(scene); m_snapStore.ForceSceneStale(scene);
} }
} }
#endregion #endregion
public void OnSimRestart(RegionInfo thisRegion)
{
m_log.Info("[DATASNAPSHOT]: Region " + thisRegion.RegionName + " is restarting, removing from indexing");
Scene restartedScene = SceneForUUID(thisRegion.RegionID);
m_scenes.Remove(restartedScene);
m_snapStore.RemoveScene(restartedScene);
//Getting around the fact that we can't remove objects from a collection we are enumerating over
List<IDataSnapshotProvider> providersToRemove = new List<IDataSnapshotProvider>();
foreach (IDataSnapshotProvider provider in m_dataproviders)
{
if (provider.GetParentScene == restartedScene)
{
providersToRemove.Add(provider);
}
}
foreach (IDataSnapshotProvider provider in providersToRemove)
{
m_dataproviders.Remove(provider);
m_snapStore.RemoveProvider(provider);
}
m_snapStore.RemoveScene(restartedScene);
}
} }
} }

View File

@ -32,6 +32,5 @@ namespace OpenSim.Region.DataSnapshot.Interfaces
public interface IDataSnapshot public interface IDataSnapshot
{ {
XmlDocument GetSnapshot(string regionName); XmlDocument GetSnapshot(string regionName);
void MakeEverythingStale();
} }
} }

View File

@ -27,7 +27,7 @@
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
public interface ICloudModule : IRegionModule public interface ICloudModule
{ {
/// <summary> /// <summary>
/// Retrieves the cloud density at the given region coordinates /// Retrieves the cloud density at the given region coordinates

View File

@ -33,95 +33,140 @@ namespace OpenSim.Region.Framework.Interfaces
public interface IDialogModule public interface IDialogModule
{ {
/// <summary> /// <summary>
/// Send a non-modal alert message to a particular user. This can disappear from the user's view after a /// Send a non-modal alert message to a particular user. This can
/// small interval. /// disappear from the user's view after a small interval.
/// </summary> /// </summary>
/// <param name="client"></param> /// <param name="client">
/// <param name="message"></param> /// IClientAPI object representing the user.
/// </param>
/// <param name="message">Message text to send to the user.</param>
void SendAlertToUser(IClientAPI client, string message); void SendAlertToUser(IClientAPI client, string message);
/// <summary> /// <summary>
/// Send an alert message to a particular user. /// Send an alert message to a particular user.
/// </summary> /// </summary>
/// <param name="client"></param> /// <param name="client">
/// <param name="message"></param> /// IClientAPI object representing the user.
/// <param name="modal"></param> /// </param>
/// <param name="message">Message text to send to the user.</param>
/// <param name="modal">Flag to control modality.</param>
void SendAlertToUser(IClientAPI client, string message, bool modal); void SendAlertToUser(IClientAPI client, string message, bool modal);
/// <summary> /// <summary>
/// Send a non-modal alert message to a particular user. /// Send a non-modal alert message to a particular user.
/// </summary> /// </summary>
/// <param name="agentID"></param> /// <param name="agentID">UUID of agent representing the user.</param>
/// <param name="message"></param> /// <param name="message">Message text to send to the user.</param>
void SendAlertToUser(UUID agentID, string message); void SendAlertToUser(UUID agentID, string message);
/// <summary> /// <summary>
/// Send an alert message to a particular user. /// Send an alert message to a particular user.
/// </summary> /// </summary>
/// <param name="agentID"></param> /// <param name="agentID">UUID of agent representing the user.</param>
/// <param name="message"></param> /// <param name="message">Message text to send to the user.</param>
/// <param name="modal"></param> /// <param name="modal">Flag to control modality.</param>
void SendAlertToUser(UUID agentID, string message, bool modal); void SendAlertToUser(UUID agentID, string message, bool modal);
/// <summary> /// <summary>
/// Send an alert message to a particular user. /// Send an alert message to a particular user.
/// </summary> /// </summary>
/// <param name="firstName"></param> /// <param name="firstName">Account first name</param>
/// <param name="lastName"></param> /// <param name="lastName">Account last name</param>
/// <param name="message"></param> /// <param name="message">Message text to send to the user.</param>
/// <param name="modal"></param> /// <param name="modal">Flag to control modality.</param>
void SendAlertToUser(string firstName, string lastName, string message, bool modal); void SendAlertToUser(string firstName, string lastName,
string message, bool modal);
/// <summary> /// <summary>
/// Send an alert message to all users in the scene. /// Send an alert message to all users in the scene.
/// </summary> /// </summary>
/// <param name="message"></param> /// <param name="message">Message text to send to all users.</param>
void SendGeneralAlert(string message); void SendGeneralAlert(string message);
/// <summary> /// <summary>
/// Send a dialog box to a particular user. /// Send a dialog box to a particular user.
/// </summary> /// </summary>
/// <param name="avatarID"></param> /// <param name="avatarID">
/// <param name="objectName"></param> /// UUID of the avatar representing the user.
/// <param name="objectID"></param> /// </param>
/// <param name="ownerID"></param> /// <param name="objectName">
/// <param name="message"></param> /// Name of the object sending the dialog.
/// <param name="textureID"></param> /// </param>
/// <param name="ch"></param> /// <param name="objectID">
/// <param name="buttonlabels"></param> /// UUID of the object sending the dialog.
void SendDialogToUser( /// </param>
UUID avatarID, string objectName, UUID objectID, UUID ownerID, /// <param name="ownerID">
string message, UUID textureID, int ch, string[] buttonlabels); /// UUID of the user that owns the object.
/// </param>
/// <param name="message">Message text to send to the user.</param>
/// <param name="textureID">
/// Texture UUID to pass along with the dialog.
/// </param>
/// <param name="ch">
/// Channel on which the selected button text should be broadcast.
/// </param>
/// <param name="buttonlabels">Dialog button text.</param>
void SendDialogToUser(UUID avatarID, string objectName, UUID objectID,
UUID ownerID, string message, UUID textureID, int ch,
string[] buttonlabels);
/// <summary> /// <summary>
/// Send a url to a particular user. /// Send a url to a particular user.
/// </summary> /// </summary>
/// <param name="avatarID"></param> /// <param name="avatarID">
/// <param name="objectName"></param> /// UUID of the avatar representing the user.
/// <param name="objectID"></param> /// </param>
/// <param name="ownerID"></param> /// <param name="objectName">
/// <param name="groupOwned"></param> /// Name of the object sending the dialog.
/// <param name="message"></param> /// </param>
/// <param name="url"></param> /// <param name="objectID">
void SendUrlToUser( /// UUID of the object sending the dialog.
UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url); /// </param>
/// <param name="ownerID">
/// UUID of the user that owns the object.
/// </param>
/// <param name="groupOwned">
/// Flag indicating whether or not the object is group-owned.
/// </param>
/// <param name="message">Message text to send to the user.</param>
/// <param name="url">Url to send to the user.</param>
void SendUrlToUser(UUID avatarID, string objectName, UUID objectID,
UUID ownerID, bool groupOwned, string message, string url);
/// <summary> /// <summary>
/// Send a notification to all users in the scene. This notification should remain around until the /// Send a notification to all users in the scene. This notification
/// user explicitly dismisses it. /// should remain around until the user explicitly dismisses it.
/// </summary> /// </summary>
/// /// <remarks>
/// On the Linden Labs Second Client (as of 1.21), this is a big blue box message on the upper right of the /// On the Linden Labs Second Client (as of 1.21), this is a big blue
/// screen. /// box message on the upper right of the screen.
/// /// </remarks>
/// <param name="fromAvatarID">The user sending the message</param> /// <param name="fromAvatarID">The user sending the message</param>
/// <param name="fromAvatarName">The name of the user doing the sending</param> /// <param name="fromAvatarName">
/// The name of the user doing the sending
/// </param>
/// <param name="message">The message being sent to the user</param> /// <param name="message">The message being sent to the user</param>
void SendNotificationToUsersInRegion(UUID fromAvatarID, string fromAvatarName, string message); void SendNotificationToUsersInRegion(UUID fromAvatarID,
string fromAvatarName, string message);
/// <summary> /// <summary>
/// Send a textbox entry for the client to respond to /// Send a textbox entry for the client to respond to
/// </summary> /// </summary>
void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid); /// <param name="avatarID">
/// UUID of the avatar representing the user.
/// </param>
/// <param name="message">Message text to send to the user.</param>
/// <param name="chatChannel">
/// Chat channel that the user's input should be broadcast on.
/// </param>
/// <param name="name">Name of the object sending the dialog.</param>
/// <param name="objectid">
/// UUID of the object sending the dialog.
/// </param>
/// <param name="ownerid">
/// UUID of the user that owns the object.
/// </param>
void SendTextBoxToUser(UUID avatarid, string message, int chatChannel,
string name, UUID objectid, UUID ownerid);
} }
} }

View File

@ -29,7 +29,7 @@ using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
public interface ISunModule : IRegionModule public interface ISunModule : INonSharedRegionModule
{ {
double GetSunParameter(string param); double GetSunParameter(string param);

View File

@ -29,7 +29,7 @@ using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
public interface IWindModule : IRegionModule public interface IWindModule : INonSharedRegionModule
{ {
/// <summary> /// <summary>

View File

@ -1954,8 +1954,19 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs, /// <summary>
UUID groupID, DeRezAction action, UUID destinationID) /// Derez one or more objects from the scene.
/// </summary>
/// <remarks>
/// Won't actually remove the scene object in the case where the object is being copied to a user inventory.
/// </remarks>
/// <param name='remoteClient'>Client requesting derez</param>
/// <param name='localIDs'>Local ids of root parts of objects to delete.</param>
/// <param name='groupID'>Not currently used. Here because the client passes this to us.</param>
/// <param name='action'>DeRezAction</param>
/// <param name='destinationID'>User folder ID to place derezzed object</param>
public virtual void DeRezObjects(
IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID)
{ {
// First, see of we can perform the requested action and // First, see of we can perform the requested action and
// build a list of eligible objects // build a list of eligible objects

View File

@ -26,6 +26,7 @@
*/ */
using System; using System;
using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Threading; using System.Threading;
using NUnit.Framework; using NUnit.Framework;
@ -33,6 +34,7 @@ using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
@ -42,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
/// Basic scene object tests (create, read and delete but not update). /// Basic scene object tests (create, read and delete but not update).
/// </summary> /// </summary>
[TestFixture] [TestFixture]
public class SceneObjectBasicTests public class SceneObjectBasicTests : OpenSimTestCase
{ {
// [TearDown] // [TearDown]
// public void TearDown() // public void TearDown()
@ -237,38 +239,60 @@ namespace OpenSim.Region.Framework.Scenes.Tests
/// <summary> /// <summary>
/// Test deleting an object asynchronously to user inventory. /// Test deleting an object asynchronously to user inventory.
/// </summary> /// </summary>
//[Test] // [Test]
//public void TestDeleteSceneObjectAsyncToUserInventory() public void TestDeleteSceneObjectAsyncToUserInventory()
//{ {
// TestHelper.InMethod(); TestHelpers.InMethod();
// //log4net.Config.XmlConfigurator.Configure(); TestHelpers.EnableLogging();
// UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
// string myObjectName = "Fred"; string myObjectName = "Fred";
// TestScene scene = SceneSetupHelpers.SetupScene(); TestScene scene = new SceneHelpers().SetupScene();
// SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName);
// Assert.That( // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
// scene.CommsManager.UserAdminService.AddUser( AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
// "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), sogd.Enabled = false;
// Is.EqualTo(agentId));
// IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId);
// CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); // Assert.That(
// Assert.That(userInfo, Is.Not.Null); // scene.CommsManager.UserAdminService.AddUser(
// Assert.That(userInfo.RootFolder, Is.Not.Null); // "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
// Is.EqualTo(agentId));
// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client); UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId);
InventoryFolderBase folder1
= UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1");
// // Check that we now have the taken part in our inventory IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
// Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name)); scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID);
// // Check that the taken part has actually disappeared SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
// Assert.That(retrievedPart, Is.Null); Assert.That(retrievedPart, Is.Not.Null);
//} Assert.That(so.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
Assert.That(so.IsDeleted, Is.True);
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Null);
// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
InventoryItemBase retrievedItem
= UserInventoryHelpers.GetInventoryItem(
scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName);
// Check that we now have the taken part in our inventory
Assert.That(retrievedItem, Is.Not.Null);
// Check that the taken part has actually disappeared
// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
// Assert.That(retrievedPart, Is.Null);
}
/// <summary> /// <summary>
/// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not

View File

@ -14,5 +14,6 @@
<RegionModule id="VivoxVoice" type="OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice.VivoxVoiceModule" /> <RegionModule id="VivoxVoice" type="OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice.VivoxVoiceModule" />
<RegionModule id="WorldViewModule" type="OpenSim.Region.OptionalModules.World.WorldView.WorldViewModule" /> <RegionModule id="WorldViewModule" type="OpenSim.Region.OptionalModules.World.WorldView.WorldViewModule" />
<RegionModule id="AutoBackupModule" type="OpenSim.Region.OptionalModules.World.AutoBackup.AutoBackupModule" /> <RegionModule id="AutoBackupModule" type="OpenSim.Region.OptionalModules.World.AutoBackup.AutoBackupModule" />
<RegionModule id="TreePopulatorModule" type="OpenSim.Region.OptionalModules.World.TreePopulator.TreePopulatorModule" />
</Extension> </Extension>
</Addin> </Addin>

View File

@ -46,7 +46,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
/// <summary> /// <summary>
/// Version 2.02 - Still hacky /// Version 2.02 - Still hacky
/// </summary> /// </summary>
public class TreePopulatorModule : IRegionModule, ICommandableModule, IVegetationModule public class TreePopulatorModule : INonSharedRegionModule, ICommandableModule, IVegetationModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Commander m_commander = new Commander("tree"); private readonly Commander m_commander = new Commander("tree");
@ -170,13 +170,9 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
#region IRegionModule Members #region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{ {
m_scene = scene;
m_scene.RegisterModuleInterface<IRegionModule>(this);
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
// ini file settings // ini file settings
try try
{ {
@ -201,7 +197,20 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
m_log.Debug("[TREES]: Initialised tree module"); m_log.Debug("[TREES]: Initialised tree module");
} }
public void PostInitialise() public void AddRegion(Scene scene)
{
m_scene = scene;
//m_scene.RegisterModuleInterface<IRegionModule>(this);
m_scene.RegisterModuleCommander(m_commander);
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
}
public void RemoveRegion(Scene scene)
{
}
public void RegionLoaded(Scene scene)
{ {
ReloadCopse(); ReloadCopse();
if (m_copse.Count > 0) if (m_copse.Count > 0)
@ -220,11 +229,12 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
get { return "TreePopulatorModule"; } get { return "TreePopulatorModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return false; } get { return null; }
} }
#endregion #endregion
//-------------------------------------------------------------- //--------------------------------------------------------------
@ -448,8 +458,6 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
m_commander.RegisterCommand("reload", treeReloadCommand); m_commander.RegisterCommand("reload", treeReloadCommand);
m_commander.RegisterCommand("remove", treeRemoveCommand); m_commander.RegisterCommand("remove", treeRemoveCommand);
m_commander.RegisterCommand("statistics", treeStatisticsCommand); m_commander.RegisterCommand("statistics", treeStatisticsCommand);
m_scene.RegisterModuleCommander(m_commander);
} }
/// <summary> /// <summary>

View File

@ -141,9 +141,9 @@ namespace OpenSim.Tests.Common
TestScene testScene = new TestScene( TestScene testScene = new TestScene(
regInfo, m_acm, scs, m_simDataService, m_estateDataService, null, false, configSource, null); regInfo, m_acm, scs, m_simDataService, m_estateDataService, null, false, configSource, null);
IRegionModule godsModule = new GodsModule(); INonSharedRegionModule godsModule = new GodsModule();
godsModule.Initialise(testScene, new IniConfigSource()); godsModule.Initialise(new IniConfigSource());
testScene.AddModule(godsModule.Name, godsModule); godsModule.AddRegion(testScene);
// Add scene to services // Add scene to services
m_assetService.AddRegion(testScene); m_assetService.AddRegion(testScene);
@ -383,11 +383,6 @@ namespace OpenSim.Tests.Common
} }
} }
foreach (IRegionModuleBase module in newModules)
{
if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise();
}
foreach (IRegionModuleBase module in newModules) foreach (IRegionModuleBase module in newModules)
{ {
foreach (Scene scene in scenes) foreach (Scene scene in scenes)
@ -397,6 +392,11 @@ namespace OpenSim.Tests.Common
} }
} }
foreach (IRegionModuleBase module in newModules)
{
if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise();
}
// RegionLoaded is fired after all modules have been appropriately added to all scenes // RegionLoaded is fired after all modules have been appropriately added to all scenes
foreach (IRegionModuleBase module in newModules) foreach (IRegionModuleBase module in newModules)
foreach (Scene scene in scenes) foreach (Scene scene in scenes)

View File

@ -57,9 +57,6 @@
; ## CLIENTS ; ## CLIENTS
; ## ; ##
; Enables EventQueueGet Service.
EventQueue = true
; Set this to the DLL containing the client stack to use. ; Set this to the DLL containing the client stack to use.
clientstack_plugin="OpenSim.Region.ClientStack.LindenUDP.dll" clientstack_plugin="OpenSim.Region.ClientStack.LindenUDP.dll"