diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 78 |
1 files changed, 38 insertions, 40 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 9ae1a7b..b57d3e6 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -27,24 +27,19 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.Net; | ||
33 | using OpenSim; | ||
34 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Servers; | ||
37 | using Mono.Addins; | ||
38 | using Mono.Addins.Description; | ||
39 | using Nini; | ||
40 | using Nini.Config; | ||
41 | using Nwc.XmlRpc; | ||
42 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Net; | ||
43 | using System.Timers; | 32 | using System.Timers; |
44 | using libsecondlife; | 33 | using libsecondlife; |
34 | using Mono.Addins; | ||
35 | using Nwc.XmlRpc; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Console; | ||
38 | using OpenSim.Framework.Servers; | ||
39 | using OpenSim.Region.Environment.Scenes; | ||
45 | 40 | ||
46 | [assembly: Addin] | 41 | [assembly : Addin] |
47 | [assembly: AddinDependency("OpenSim", "0.4")] | 42 | [assembly : AddinDependency("OpenSim", "0.4")] |
48 | 43 | ||
49 | namespace OpenSim.ApplicationPlugins.LoadRegions | 44 | namespace OpenSim.ApplicationPlugins.LoadRegions |
50 | { | 45 | { |
@@ -54,6 +49,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
54 | private OpenSimMain m_app; | 49 | private OpenSimMain m_app; |
55 | private BaseHttpServer m_httpd; | 50 | private BaseHttpServer m_httpd; |
56 | private string requiredPassword = ""; | 51 | private string requiredPassword = ""; |
52 | |||
57 | public void Initialise(OpenSimMain openSim) | 53 | public void Initialise(OpenSimMain openSim) |
58 | { | 54 | { |
59 | try | 55 | try |
@@ -81,12 +77,13 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
81 | public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) | 77 | public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) |
82 | { | 78 | { |
83 | XmlRpcResponse response = new XmlRpcResponse(); | 79 | XmlRpcResponse response = new XmlRpcResponse(); |
84 | Hashtable requestData = (Hashtable)request.Params[0]; | 80 | Hashtable requestData = (Hashtable) request.Params[0]; |
85 | 81 | ||
86 | LLUUID regionID = new LLUUID((string)requestData["regionID"]); | 82 | LLUUID regionID = new LLUUID((string) requestData["regionID"]); |
87 | 83 | ||
88 | Hashtable responseData = new Hashtable(); | 84 | Hashtable responseData = new Hashtable(); |
89 | if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) | 85 | if (requiredPassword != "" && |
86 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | ||
90 | { | 87 | { |
91 | responseData["accepted"] = "false"; | 88 | responseData["accepted"] = "false"; |
92 | response.Value = responseData; | 89 | response.Value = responseData; |
@@ -96,7 +93,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
96 | responseData["accepted"] = "true"; | 93 | responseData["accepted"] = "true"; |
97 | response.Value = responseData; | 94 | response.Value = responseData; |
98 | 95 | ||
99 | OpenSim.Region.Environment.Scenes.Scene RebootedScene; | 96 | Scene RebootedScene; |
100 | 97 | ||
101 | if (m_app.SceneManager.TryGetScene(regionID, out RebootedScene)) | 98 | if (m_app.SceneManager.TryGetScene(regionID, out RebootedScene)) |
102 | { | 99 | { |
@@ -115,18 +112,18 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
115 | public XmlRpcResponse XmlRpcAlertMethod(XmlRpcRequest request) | 112 | public XmlRpcResponse XmlRpcAlertMethod(XmlRpcRequest request) |
116 | { | 113 | { |
117 | XmlRpcResponse response = new XmlRpcResponse(); | 114 | XmlRpcResponse response = new XmlRpcResponse(); |
118 | Hashtable requestData = (Hashtable)request.Params[0]; | 115 | Hashtable requestData = (Hashtable) request.Params[0]; |
119 | 116 | ||
120 | Hashtable responseData = new Hashtable(); | 117 | Hashtable responseData = new Hashtable(); |
121 | if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) | 118 | if (requiredPassword != "" && |
119 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | ||
122 | { | 120 | { |
123 | responseData["accepted"] = "false"; | 121 | responseData["accepted"] = "false"; |
124 | response.Value = responseData; | 122 | response.Value = responseData; |
125 | } | 123 | } |
126 | else | 124 | else |
127 | { | 125 | { |
128 | 126 | string message = (string) requestData["message"]; | |
129 | string message = (string)requestData["message"]; | ||
130 | MainLog.Instance.Verbose("RADMIN", "Broadcasting: " + message); | 127 | MainLog.Instance.Verbose("RADMIN", "Broadcasting: " + message); |
131 | 128 | ||
132 | responseData["accepted"] = "true"; | 129 | responseData["accepted"] = "true"; |
@@ -142,23 +139,24 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
142 | { | 139 | { |
143 | MainLog.Instance.Verbose("RADMIN", "Received Shutdown Administrator Request"); | 140 | MainLog.Instance.Verbose("RADMIN", "Received Shutdown Administrator Request"); |
144 | XmlRpcResponse response = new XmlRpcResponse(); | 141 | XmlRpcResponse response = new XmlRpcResponse(); |
145 | Hashtable requestData = (Hashtable)request.Params[0]; | 142 | Hashtable requestData = (Hashtable) request.Params[0]; |
146 | Hashtable responseData = new Hashtable(); | 143 | Hashtable responseData = new Hashtable(); |
147 | if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) | 144 | if (requiredPassword != "" && |
145 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | ||
148 | { | 146 | { |
149 | responseData["accepted"] = "false"; | 147 | responseData["accepted"] = "false"; |
150 | response.Value = responseData; | 148 | response.Value = responseData; |
151 | } | 149 | } |
152 | else | 150 | else |
153 | { | 151 | { |
154 | if ((string)requestData["shutdown"] == "delayed") | 152 | if ((string) requestData["shutdown"] == "delayed") |
155 | { | 153 | { |
156 | int timeout = (Int32)requestData["milliseconds"]; | 154 | int timeout = (Int32) requestData["milliseconds"]; |
157 | 155 | ||
158 | responseData["accepted"] = "true"; | 156 | responseData["accepted"] = "true"; |
159 | response.Value = responseData; | 157 | response.Value = responseData; |
160 | 158 | ||
161 | m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() + | 159 | m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() + |
162 | " second(s). Please save what you are doing and log out."); | 160 | " second(s). Please save what you are doing and log out."); |
163 | 161 | ||
164 | // Perform shutdown | 162 | // Perform shutdown |
@@ -197,9 +195,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
197 | { | 195 | { |
198 | MainLog.Instance.Verbose("RADMIN", "Received Create Region Administrator Request"); | 196 | MainLog.Instance.Verbose("RADMIN", "Received Create Region Administrator Request"); |
199 | XmlRpcResponse response = new XmlRpcResponse(); | 197 | XmlRpcResponse response = new XmlRpcResponse(); |
200 | Hashtable requestData = (Hashtable)request.Params[0]; | 198 | Hashtable requestData = (Hashtable) request.Params[0]; |
201 | Hashtable responseData = new Hashtable(); | 199 | Hashtable responseData = new Hashtable(); |
202 | if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) | 200 | if (requiredPassword != "" && |
201 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | ||
203 | { | 202 | { |
204 | responseData["created"] = "false"; | 203 | responseData["created"] = "false"; |
205 | response.Value = responseData; | 204 | response.Value = responseData; |
@@ -210,22 +209,22 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
210 | 209 | ||
211 | try | 210 | try |
212 | { | 211 | { |
213 | newRegionData.RegionID = (string)requestData["region_id"]; | 212 | newRegionData.RegionID = (string) requestData["region_id"]; |
214 | newRegionData.RegionName = (string)requestData["region_name"]; | 213 | newRegionData.RegionName = (string) requestData["region_name"]; |
215 | newRegionData.RegionLocX = Convert.ToUInt32((Int32)requestData["region_x"]); | 214 | newRegionData.RegionLocX = Convert.ToUInt32((Int32) requestData["region_x"]); |
216 | newRegionData.RegionLocY = Convert.ToUInt32((Int32)requestData["region_y"]); | 215 | newRegionData.RegionLocY = Convert.ToUInt32((Int32) requestData["region_y"]); |
217 | 216 | ||
218 | // Security risk | 217 | // Security risk |
219 | newRegionData.DataStore = (string)requestData["datastore"]; | 218 | newRegionData.DataStore = (string) requestData["datastore"]; |
220 | 219 | ||
221 | newRegionData.InternalEndPoint = new IPEndPoint( | 220 | newRegionData.InternalEndPoint = new IPEndPoint( |
222 | IPAddress.Parse((string)requestData["listen_ip"]), 0); | 221 | IPAddress.Parse((string) requestData["listen_ip"]), 0); |
223 | 222 | ||
224 | newRegionData.InternalEndPoint.Port = (Int32)requestData["listen_port"]; | 223 | newRegionData.InternalEndPoint.Port = (Int32) requestData["listen_port"]; |
225 | newRegionData.ExternalHostName = (string)requestData["external_address"]; | 224 | newRegionData.ExternalHostName = (string) requestData["external_address"]; |
226 | 225 | ||
227 | newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"]; | 226 | newRegionData.MasterAvatarFirstName = (string) requestData["region_master_first"]; |
228 | newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"]; | 227 | newRegionData.MasterAvatarLastName = (string) requestData["region_master_last"]; |
229 | 228 | ||
230 | m_app.CreateRegion(newRegionData); | 229 | m_app.CreateRegion(newRegionData); |
231 | 230 | ||
@@ -245,7 +244,6 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
245 | 244 | ||
246 | public void Close() | 245 | public void Close() |
247 | { | 246 | { |
248 | |||
249 | } | 247 | } |
250 | } | 248 | } |
251 | } \ No newline at end of file | 249 | } \ No newline at end of file |