diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs index b258e13..27f94ea 100644 --- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using log4net; | 31 | using log4net; |
@@ -34,9 +35,12 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
36 | 37 | ||
38 | using Mono.Addins; | ||
39 | |||
37 | namespace OpenSim.Region.CoreModules.Avatar.Groups | 40 | namespace OpenSim.Region.CoreModules.Avatar.Groups |
38 | { | 41 | { |
39 | public class GroupsModule : IRegionModule | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
43 | public class GroupsModule : ISharedRegionModule | ||
40 | { | 44 | { |
41 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
42 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -55,9 +59,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
55 | private static GroupMembershipData osGroup = | 59 | private static GroupMembershipData osGroup = |
56 | new GroupMembershipData(); | 60 | new GroupMembershipData(); |
57 | 61 | ||
58 | #region IRegionModule Members | 62 | private bool m_Enabled = false; |
63 | |||
64 | #region ISharedRegionModule Members | ||
59 | 65 | ||
60 | public void Initialise(Scene scene, IConfigSource config) | 66 | public void Initialise(IConfigSource config) |
61 | { | 67 | { |
62 | IConfig groupsConfig = config.Configs["Groups"]; | 68 | IConfig groupsConfig = config.Configs["Groups"]; |
63 | 69 | ||
@@ -67,7 +73,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
67 | } | 73 | } |
68 | else | 74 | else |
69 | { | 75 | { |
70 | if (!groupsConfig.GetBoolean("Enabled", false)) | 76 | m_Enabled = groupsConfig.GetBoolean("Enabled", false); |
77 | if (!m_Enabled) | ||
71 | { | 78 | { |
72 | m_log.Info("[GROUPS]: Groups disabled in configuration"); | 79 | m_log.Info("[GROUPS]: Groups disabled in configuration"); |
73 | return; | 80 | return; |
@@ -77,6 +84,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
77 | return; | 84 | return; |
78 | } | 85 | } |
79 | 86 | ||
87 | } | ||
88 | |||
89 | public void AddRegion(Scene scene) | ||
90 | { | ||
91 | if (!m_Enabled) | ||
92 | return; | ||
93 | |||
80 | lock (m_SceneList) | 94 | lock (m_SceneList) |
81 | { | 95 | { |
82 | if (!m_SceneList.Contains(scene)) | 96 | if (!m_SceneList.Contains(scene)) |
@@ -96,7 +110,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
96 | 110 | ||
97 | scene.EventManager.OnNewClient += OnNewClient; | 111 | scene.EventManager.OnNewClient += OnNewClient; |
98 | scene.EventManager.OnClientClosed += OnClientClosed; | 112 | scene.EventManager.OnClientClosed += OnClientClosed; |
99 | // scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 113 | // scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
114 | } | ||
115 | |||
116 | public void RemoveRegion(Scene scene) | ||
117 | { | ||
118 | if (!m_Enabled) | ||
119 | return; | ||
120 | |||
121 | lock (m_SceneList) | ||
122 | { | ||
123 | if (m_SceneList.Contains(scene)) | ||
124 | m_SceneList.Remove(scene); | ||
125 | } | ||
126 | |||
127 | scene.EventManager.OnNewClient -= OnNewClient; | ||
128 | scene.EventManager.OnClientClosed -= OnClientClosed; | ||
129 | } | ||
130 | |||
131 | public void RegionLoaded(Scene scene) | ||
132 | { | ||
100 | } | 133 | } |
101 | 134 | ||
102 | public void PostInitialise() | 135 | public void PostInitialise() |
@@ -105,6 +138,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
105 | 138 | ||
106 | public void Close() | 139 | public void Close() |
107 | { | 140 | { |
141 | if (!m_Enabled) | ||
142 | return; | ||
143 | |||
108 | // m_log.Debug("[GROUPS]: Shutting down group module."); | 144 | // m_log.Debug("[GROUPS]: Shutting down group module."); |
109 | 145 | ||
110 | lock (m_ClientMap) | 146 | lock (m_ClientMap) |
@@ -123,9 +159,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
123 | get { return "GroupsModule"; } | 159 | get { return "GroupsModule"; } |
124 | } | 160 | } |
125 | 161 | ||
126 | public bool IsSharedModule | 162 | public Type ReplaceableInterface |
127 | { | 163 | { |
128 | get { return true; } | 164 | get { return null; } |
129 | } | 165 | } |
130 | 166 | ||
131 | #endregion | 167 | #endregion |