diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 716cc69..9fa9be1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.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 Nini.Config; | 30 | using Nini.Config; |
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
@@ -50,9 +51,12 @@ using Caps = OpenSim.Framework.Capabilities.Caps; | |||
50 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; | 51 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; |
51 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | 52 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; |
52 | 53 | ||
54 | using Mono.Addins; | ||
55 | |||
53 | namespace OpenSim.Region.CoreModules.Avatar.Gods | 56 | namespace OpenSim.Region.CoreModules.Avatar.Gods |
54 | { | 57 | { |
55 | public class GodsModule : IRegionModule, IGodsModule | 58 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GodsModule")] |
59 | public class GodsModule : INonSharedRegionModule, IGodsModule | ||
56 | { | 60 | { |
57 | private static readonly ILog m_log = | 61 | private static readonly ILog m_log = |
58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 62 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -66,10 +70,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
66 | protected Dictionary<UUID, string> m_capsDict = | 70 | protected Dictionary<UUID, string> m_capsDict = |
67 | new Dictionary<UUID, string>(); | 71 | new Dictionary<UUID, string>(); |
68 | 72 | ||
69 | public void Initialise(Scene scene, IConfigSource source) | 73 | protected IDialogModule DialogModule |
74 | { | ||
75 | get | ||
76 | { | ||
77 | if (m_dialogModule == null) | ||
78 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | ||
79 | |||
80 | return m_dialogModule; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | public void Initialise(IConfigSource source) | ||
85 | { | ||
86 | } | ||
87 | |||
88 | public void AddRegion(Scene scene) | ||
70 | { | 89 | { |
71 | m_scene = scene; | 90 | m_scene = scene; |
72 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | ||
73 | m_scene.RegisterModuleInterface<IGodsModule>(this); | 91 | m_scene.RegisterModuleInterface<IGodsModule>(this); |
74 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 92 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; |
75 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; | 93 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; |
@@ -77,12 +95,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
77 | scene.EventManager.OnIncomingInstantMessage += | 95 | scene.EventManager.OnIncomingInstantMessage += |
78 | OnIncomingInstantMessage; | 96 | OnIncomingInstantMessage; |
79 | } | 97 | } |
80 | 98 | ||
81 | public void PostInitialise() {} | 99 | public void RemoveRegion(Scene scene) |
100 | { | ||
101 | m_scene.UnregisterModuleInterface<IGodsModule>(this); | ||
102 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | ||
103 | m_scene = null; | ||
104 | } | ||
105 | |||
106 | public void RegionLoaded(Scene scene) | ||
107 | { | ||
108 | } | ||
109 | |||
82 | public void Close() {} | 110 | public void Close() {} |
83 | public string Name { get { return "Gods Module"; } } | 111 | public string Name { get { return "Gods Module"; } } |
84 | public bool IsSharedModule { get { return false; } } | 112 | |
85 | 113 | public Type ReplaceableInterface | |
114 | { | ||
115 | get { return null; } | ||
116 | } | ||
117 | |||
86 | public void SubscribeToClientEvents(IClientAPI client) | 118 | public void SubscribeToClientEvents(IClientAPI client) |
87 | { | 119 | { |
88 | client.OnGodKickUser += KickUser; | 120 | client.OnGodKickUser += KickUser; |
@@ -172,8 +204,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
172 | } | 204 | } |
173 | else | 205 | else |
174 | { | 206 | { |
175 | if (m_dialogModule != null) | 207 | if (DialogModule != null) |
176 | m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); | 208 | DialogModule.SendAlertToUser(agentID, "Request for god powers denied"); |
177 | } | 209 | } |
178 | } | 210 | } |
179 | } | 211 | } |
@@ -206,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
206 | transferModule.SendInstantMessage(new GridInstantMessage( | 238 | transferModule.SendInstantMessage(new GridInstantMessage( |
207 | m_scene, godID, "God", agentID, (byte)250, false, | 239 | m_scene, godID, "God", agentID, (byte)250, false, |
208 | Utils.BytesToString(reason), UUID.Zero, true, | 240 | Utils.BytesToString(reason), UUID.Zero, true, |
209 | new Vector3(), new byte[] {(byte)kickflags}), | 241 | new Vector3(), new byte[] {(byte)kickflags}, true), |
210 | delegate(bool success) {} ); | 242 | delegate(bool success) {} ); |
211 | } | 243 | } |
212 | return; | 244 | return; |