One more module converted: GroupsModule.
parent
2ef0062664
commit
09deaa890d
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue