diff options
author | Melanie | 2010-01-10 03:48:10 +0000 |
---|---|---|
committer | Melanie | 2010-01-10 03:48:10 +0000 |
commit | b9e6f4583cbfc10f566f702f70cecb5348fec023 (patch) | |
tree | 7f3b9aa5a48c509cde957dfcfe871aac35aeaf63 /OpenSim | |
parent | Add "StartDisabled" to [Startup] to make all regions start up with (diff) | |
download | opensim-SC_OLD-b9e6f4583cbfc10f566f702f70cecb5348fec023.zip opensim-SC_OLD-b9e6f4583cbfc10f566f702f70cecb5348fec023.tar.gz opensim-SC_OLD-b9e6f4583cbfc10f566f702f70cecb5348fec023.tar.bz2 opensim-SC_OLD-b9e6f4583cbfc10f566f702f70cecb5348fec023.tar.xz |
Implement access module commands
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Access/AccessModule.cs | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index 108dcfb..dfa8df6 100644 --- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs | |||
@@ -32,6 +32,7 @@ using log4net; | |||
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Framework.Communications.Cache; | 36 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
@@ -45,8 +46,30 @@ namespace OpenSim.Region.CoreModules.World | |||
45 | LogManager.GetLogger( | 46 | LogManager.GetLogger( |
46 | MethodBase.GetCurrentMethod().DeclaringType); | 47 | MethodBase.GetCurrentMethod().DeclaringType); |
47 | 48 | ||
49 | private List<Scene> m_SceneList = new List<Scene>(); | ||
50 | |||
48 | public void Initialise(IConfigSource config) | 51 | public void Initialise(IConfigSource config) |
49 | { | 52 | { |
53 | MainConsole.Instance.Commands.AddCommand("access", true, | ||
54 | "login enable", | ||
55 | "login enable", | ||
56 | "Enable simulator logins", | ||
57 | String.Empty, | ||
58 | HandleLoginCommand); | ||
59 | |||
60 | MainConsole.Instance.Commands.AddCommand("access", true, | ||
61 | "login disable", | ||
62 | "login disable", | ||
63 | "Disable simulator logins", | ||
64 | String.Empty, | ||
65 | HandleLoginCommand); | ||
66 | |||
67 | MainConsole.Instance.Commands.AddCommand("access", true, | ||
68 | "login status", | ||
69 | "login status", | ||
70 | "Show login status", | ||
71 | String.Empty, | ||
72 | HandleLoginCommand); | ||
50 | } | 73 | } |
51 | 74 | ||
52 | public void PostInitialise() | 75 | public void PostInitialise() |
@@ -69,14 +92,67 @@ namespace OpenSim.Region.CoreModules.World | |||
69 | 92 | ||
70 | public void AddRegion(Scene scene) | 93 | public void AddRegion(Scene scene) |
71 | { | 94 | { |
95 | if (!m_SceneList.Contains(scene)) | ||
96 | m_SceneList.Add(scene); | ||
72 | } | 97 | } |
73 | 98 | ||
74 | public void RemoveRegion(Scene scene) | 99 | public void RemoveRegion(Scene scene) |
75 | { | 100 | { |
101 | m_SceneList.Remove(scene); | ||
76 | } | 102 | } |
77 | 103 | ||
78 | public void RegionLoaded(Scene scene) | 104 | public void RegionLoaded(Scene scene) |
79 | { | 105 | { |
80 | } | 106 | } |
107 | |||
108 | public void HandleLoginCommand(string module, string[] cmd) | ||
109 | { | ||
110 | if ((Scene)MainConsole.Instance.ConsoleScene == null) | ||
111 | { | ||
112 | foreach (Scene s in m_SceneList) | ||
113 | { | ||
114 | if(!ProcessCommand(s, cmd)) | ||
115 | break; | ||
116 | } | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | ProcessCommand((Scene)MainConsole.Instance.ConsoleScene, cmd); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | bool ProcessCommand(Scene scene, string[] cmd) | ||
125 | { | ||
126 | if (cmd.Length < 2) | ||
127 | { | ||
128 | MainConsole.Instance.Output("Syntax: login enable|disable|status"); | ||
129 | return false; | ||
130 | } | ||
131 | |||
132 | switch (cmd[1]) | ||
133 | { | ||
134 | case "enable": | ||
135 | if (scene.LoginsDisabled) | ||
136 | MainConsole.Instance.Output(String.Format("Enabling logins for region {0}", scene.RegionInfo.RegionName)); | ||
137 | scene.LoginsDisabled = false; | ||
138 | break; | ||
139 | case "disable": | ||
140 | if (!scene.LoginsDisabled) | ||
141 | MainConsole.Instance.Output(String.Format("Disabling logins for region {0}", scene.RegionInfo.RegionName)); | ||
142 | scene.LoginsDisabled = true; | ||
143 | break; | ||
144 | case "status": | ||
145 | if (scene.LoginsDisabled) | ||
146 | MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName)); | ||
147 | else | ||
148 | MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName)); | ||
149 | break; | ||
150 | default: | ||
151 | MainConsole.Instance.Output("Syntax: login enable|disable|status"); | ||
152 | return false; | ||
153 | } | ||
154 | |||
155 | return true; | ||
156 | } | ||
81 | } | 157 | } |
82 | } | 158 | } |