aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs68
1 files changed, 53 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index 2e3312f..5a7446f 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
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using Nini.Config; 30using Nini.Config;
30using OpenMetaverse; 31using OpenMetaverse;
@@ -32,29 +33,59 @@ using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
33using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
34 35
36using Mono.Addins;
37
35namespace OpenSim.Region.CoreModules.Avatar.Gods 38namespace OpenSim.Region.CoreModules.Avatar.Gods
36{ 39{
37 public class GodsModule : IRegionModule, IGodsModule 40 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GodsModule")]
41 public class GodsModule : INonSharedRegionModule, IGodsModule
38 { 42 {
39 /// <summary>Special UUID for actions that apply to all agents</summary> 43 /// <summary>Special UUID for actions that apply to all agents</summary>
40 private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); 44 private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb");
41 45
42 protected Scene m_scene; 46 protected Scene m_scene;
43 protected IDialogModule m_dialogModule; 47 protected IDialogModule m_dialogModule;
44 48 protected IDialogModule DialogModule
45 public void Initialise(Scene scene, IConfigSource source) 49 {
50 get
51 {
52 if (m_dialogModule == null)
53 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
54
55 return m_dialogModule;
56 }
57 }
58
59 public void Initialise(IConfigSource source)
60 {
61 }
62
63 public void AddRegion(Scene scene)
46 { 64 {
47 m_scene = scene; 65 m_scene = scene;
48 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
49 m_scene.RegisterModuleInterface<IGodsModule>(this); 66 m_scene.RegisterModuleInterface<IGodsModule>(this);
50 m_scene.EventManager.OnNewClient += SubscribeToClientEvents; 67 m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
51 } 68 }
52 69
53 public void PostInitialise() {} 70 public void RemoveRegion(Scene scene)
71 {
72 m_scene.UnregisterModuleInterface<IGodsModule>(this);
73 m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
74 m_scene = null;
75 }
76
77 public void RegionLoaded(Scene scene)
78 {
79 }
80
54 public void Close() {} 81 public void Close() {}
55 public string Name { get { return "Gods Module"; } } 82 public string Name { get { return "Gods Module"; } }
56 public bool IsSharedModule { get { return false; } } 83
57 84 public Type ReplaceableInterface
85 {
86 get { return null; }
87 }
88
58 public void SubscribeToClientEvents(IClientAPI client) 89 public void SubscribeToClientEvents(IClientAPI client)
59 { 90 {
60 client.OnGodKickUser += KickUser; 91 client.OnGodKickUser += KickUser;
@@ -96,8 +127,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
96 } 127 }
97 else 128 else
98 { 129 {
99 if (m_dialogModule != null) 130 if (DialogModule != null)
100 m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); 131 DialogModule.SendAlertToUser(agentID, "Request for god powers denied");
101 } 132 }
102 } 133 }
103 } 134 }
@@ -162,20 +193,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
162 if (kickflags == 1) 193 if (kickflags == 1)
163 { 194 {
164 sp.AllowMovement = false; 195 sp.AllowMovement = false;
165 m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); 196 if (DialogModule != null)
166 m_dialogModule.SendAlertToUser(godID, "User Frozen"); 197 {
198 DialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
199 DialogModule.SendAlertToUser(godID, "User Frozen");
200 }
167 } 201 }
168 202
169 if (kickflags == 2) 203 if (kickflags == 2)
170 { 204 {
171 sp.AllowMovement = true; 205 sp.AllowMovement = true;
172 m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); 206 if (DialogModule != null)
173 m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); 207 {
208 DialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
209 DialogModule.SendAlertToUser(godID, "User Unfrozen");
210 }
174 } 211 }
175 } 212 }
176 else 213 else
177 { 214 {
178 m_dialogModule.SendAlertToUser(godID, "Kick request denied"); 215 if (DialogModule != null)
216 DialogModule.SendAlertToUser(godID, "Kick request denied");
179 } 217 }
180 } 218 }
181 } 219 }