aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
diff options
context:
space:
mode:
authorlbsa712009-03-10 20:06:25 +0000
committerlbsa712009-03-10 20:06:25 +0000
commit63a5a0194554fa52d8e3dd135afb711b14888460 (patch)
treef93876f4df00812928e98b6e1e91c729c1116221 /OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
parent* Cleanup and CCC (Code Convention Conformance) (diff)
downloadopensim-SC_OLD-63a5a0194554fa52d8e3dd135afb711b14888460.zip
opensim-SC_OLD-63a5a0194554fa52d8e3dd135afb711b14888460.tar.gz
opensim-SC_OLD-63a5a0194554fa52d8e3dd135afb711b14888460.tar.bz2
opensim-SC_OLD-63a5a0194554fa52d8e3dd135afb711b14888460.tar.xz
* Cleanup and CCC (Code Convention Conformance)
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs458
1 files changed, 250 insertions, 208 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index f3ee783..4bf6712 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -55,16 +55,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
55 private string requiredPassword = String.Empty; 55 private string requiredPassword = String.Empty;
56 56
57 // TODO: required by IPlugin, but likely not at all right 57 // TODO: required by IPlugin, but likely not at all right
58 string m_name = "RemoteAdminPlugin"; 58 private string m_name = "RemoteAdminPlugin";
59 string m_version = "0.0"; 59 private string m_version = "0.0";
60 60
61 public string Version { get { return m_version; } } 61 public string Version
62 public string Name { get { return m_name; } } 62 {
63 get { return m_version; }
64 }
65
66 public string Name
67 {
68 get { return m_name; }
69 }
63 70
64 public void Initialise() 71 public void Initialise()
65 { 72 {
66 m_log.Info("[RADMIN]: " + Name + " cannot be default-initialized!"); 73 m_log.Info("[RADMIN]: " + Name + " cannot be default-initialized!");
67 throw new PluginNotInitialisedException (Name); 74 throw new PluginNotInitialisedException(Name);
68 } 75 }
69 76
70 77
@@ -85,7 +92,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
85 requiredPassword = m_config.GetString("access_password", String.Empty); 92 requiredPassword = m_config.GetString("access_password", String.Empty);
86 93
87 m_app = openSim; 94 m_app = openSim;
88 m_httpd = openSim.HttpServer; 95 m_httpd = openSim.HttpServer;
89 96
90 Dictionary<string, XmlRpcMethod> availableMethods = new Dictionary<string, XmlRpcMethod>(); 97 Dictionary<string, XmlRpcMethod> availableMethods = new Dictionary<string, XmlRpcMethod>();
91 availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod; 98 availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod;
@@ -140,14 +147,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController
140 XmlRpcResponse response = new XmlRpcResponse(); 147 XmlRpcResponse response = new XmlRpcResponse();
141 Hashtable responseData = new Hashtable(); 148 Hashtable responseData = new Hashtable();
142 149
143 try { 150 try
151 {
144 Hashtable requestData = (Hashtable) request.Params[0]; 152 Hashtable requestData = (Hashtable) request.Params[0];
145 153
146 m_log.Info("[RADMIN]: Request to restart Region."); 154 m_log.Info("[RADMIN]: Request to restart Region.");
147 checkStringParameters(request, new string[] { "password", "regionID" }); 155 checkStringParameters(request, new string[] {"password", "regionID"});
148 156
149 if (requiredPassword != String.Empty && 157 if (requiredPassword != String.Empty &&
150 (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) 158 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
151 { 159 {
152 throw new Exception("wrong password"); 160 throw new Exception("wrong password");
153 } 161 }
@@ -167,7 +175,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
167 response.Value = responseData; 175 response.Value = responseData;
168 rebootedScene.Restart(30); 176 rebootedScene.Restart(30);
169 } 177 }
170 catch(Exception e) 178 catch (Exception e)
171 { 179 {
172 m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message); 180 m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message);
173 m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString()); 181 m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString());
@@ -186,11 +194,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
186 XmlRpcResponse response = new XmlRpcResponse(); 194 XmlRpcResponse response = new XmlRpcResponse();
187 Hashtable responseData = new Hashtable(); 195 Hashtable responseData = new Hashtable();
188 196
189 try 197 try
190 { 198 {
191 Hashtable requestData = (Hashtable) request.Params[0]; 199 Hashtable requestData = (Hashtable) request.Params[0];
192 200
193 checkStringParameters(request, new string[] { "password", "message" }); 201 checkStringParameters(request, new string[] {"password", "message"});
194 202
195 if (requiredPassword != String.Empty && 203 if (requiredPassword != String.Empty &&
196 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) 204 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
@@ -202,16 +210,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
202 responseData["accepted"] = "true"; 210 responseData["accepted"] = "true";
203 responseData["success"] = "true"; 211 responseData["success"] = "true";
204 response.Value = responseData; 212 response.Value = responseData;
205 213
206 m_app.SceneManager.ForEachScene( 214 m_app.SceneManager.ForEachScene(
207 delegate(Scene scene) 215 delegate(Scene scene)
208 { 216 {
209 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); 217 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
210 if (dialogModule != null) 218 if (dialogModule != null)
211 dialogModule.SendGeneralAlert(message); 219 dialogModule.SendGeneralAlert(message);
212 }); 220 });
213 } 221 }
214 catch(Exception e) 222 catch (Exception e)
215 { 223 {
216 m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message); 224 m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
217 m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString()); 225 m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
@@ -230,8 +238,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
230 XmlRpcResponse response = new XmlRpcResponse(); 238 XmlRpcResponse response = new XmlRpcResponse();
231 Hashtable responseData = new Hashtable(); 239 Hashtable responseData = new Hashtable();
232 240
233 try { 241 try
234 Hashtable requestData = (Hashtable)request.Params[0]; 242 {
243 Hashtable requestData = (Hashtable) request.Params[0];
235 244
236 m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString()); 245 m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString());
237 // foreach (string k in requestData.Keys) 246 // foreach (string k in requestData.Keys)
@@ -240,14 +249,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
240 // k, (string)requestData[k], ((string)requestData[k]).Length); 249 // k, (string)requestData[k], ((string)requestData[k]).Length);
241 // } 250 // }
242 251
243 checkStringParameters(request, new string[] { "password", "filename", "regionid"}); 252 checkStringParameters(request, new string[] {"password", "filename", "regionid"});
244 253
245 if (requiredPassword != String.Empty && 254 if (requiredPassword != String.Empty &&
246 (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) 255 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
247 throw new Exception("wrong password"); 256 throw new Exception("wrong password");
248 257
249 string file = (string)requestData["filename"]; 258 string file = (string) requestData["filename"];
250 UUID regionID = (UUID)(string) requestData["regionid"]; 259 UUID regionID = (UUID) (string) requestData["regionid"];
251 m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file); 260 m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file);
252 261
253 responseData["accepted"] = "true"; 262 responseData["accepted"] = "true";
@@ -283,7 +292,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
283 XmlRpcResponse response = new XmlRpcResponse(); 292 XmlRpcResponse response = new XmlRpcResponse();
284 Hashtable responseData = new Hashtable(); 293 Hashtable responseData = new Hashtable();
285 294
286 try { 295 try
296 {
287 Hashtable requestData = (Hashtable) request.Params[0]; 297 Hashtable requestData = (Hashtable) request.Params[0];
288 298
289 if (requiredPassword != String.Empty && 299 if (requiredPassword != String.Empty &&
@@ -294,30 +304,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController
294 response.Value = responseData; 304 response.Value = responseData;
295 305
296 int timeout = 2000; 306 int timeout = 2000;
297 string message; 307 string message;
298 308
299 if (requestData.ContainsKey("shutdown") 309 if (requestData.ContainsKey("shutdown")
300 && ((string) requestData["shutdown"] == "delayed") 310 && ((string) requestData["shutdown"] == "delayed")
301 && requestData.ContainsKey("milliseconds")) 311 && requestData.ContainsKey("milliseconds"))
302 { 312 {
303 timeout = (Int32) requestData["milliseconds"]; 313 timeout = (Int32) requestData["milliseconds"];
304 314
305 message 315 message
306 = "Region is going down in " + ((int) (timeout/1000)).ToString() 316 = "Region is going down in " + ((int) (timeout/1000)).ToString()
307 + " second(s). Please save what you are doing and log out."; 317 + " second(s). Please save what you are doing and log out.";
308 } 318 }
309 else 319 else
310 { 320 {
311 message = "Region is going down now."; 321 message = "Region is going down now.";
312 } 322 }
313 323
314 m_app.SceneManager.ForEachScene( 324 m_app.SceneManager.ForEachScene(
315 delegate(Scene scene) 325 delegate(Scene scene)
316 { 326 {
317 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); 327 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
318 if (dialogModule != null) 328 if (dialogModule != null)
319 dialogModule.SendGeneralAlert(message); 329 dialogModule.SendGeneralAlert(message);
320 }); 330 });
321 331
322 // Perform shutdown 332 // Perform shutdown
323 Timer shutdownTimer = new Timer(timeout); // Wait before firing 333 Timer shutdownTimer = new Timer(timeout); // Wait before firing
@@ -353,7 +363,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
353 { 363 {
354 if (!requestData.Contains(p)) 364 if (!requestData.Contains(p))
355 throw new Exception(String.Format("missing string parameter {0}", p)); 365 throw new Exception(String.Format("missing string parameter {0}", p));
356 if (String.IsNullOrEmpty((string)requestData[p])) 366 if (String.IsNullOrEmpty((string) requestData[p]))
357 throw new Exception(String.Format("parameter {0} is empty", p)); 367 throw new Exception(String.Format("parameter {0} is empty", p));
358 } 368 }
359 } 369 }
@@ -423,23 +433,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController
423 XmlRpcResponse response = new XmlRpcResponse(); 433 XmlRpcResponse response = new XmlRpcResponse();
424 Hashtable responseData = new Hashtable(); 434 Hashtable responseData = new Hashtable();
425 435
426 lock (this) 436 lock (this)
427 { 437 {
428 int m_regionLimit = m_config.GetInt("region_limit", 0); 438 int m_regionLimit = m_config.GetInt("region_limit", 0);
429 439
430 try { 440 try
441 {
431 Hashtable requestData = (Hashtable) request.Params[0]; 442 Hashtable requestData = (Hashtable) request.Params[0];
432 443
433 checkStringParameters(request, new string[] { "password", 444 checkStringParameters(request, new string[]
434 "region_name", 445 {
435 "region_master_first", "region_master_last", 446 "password",
436 "region_master_password", 447 "region_name",
437 "listen_ip", "external_address"}); 448 "region_master_first", "region_master_last",
449 "region_master_password",
450 "listen_ip", "external_address"
451 });
438 checkIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"}); 452 checkIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"});
439 453
440 // check password 454 // check password
441 if (!String.IsNullOrEmpty(requiredPassword) && 455 if (!String.IsNullOrEmpty(requiredPassword) &&
442 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 456 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
443 457
444 // check whether we still have space left (iff we are using limits) 458 // check whether we still have space left (iff we are using limits)
445 if (m_regionLimit != 0 && m_app.SceneManager.Scenes.Count >= m_regionLimit) 459 if (m_regionLimit != 0 && m_app.SceneManager.Scenes.Count >= m_regionLimit)
@@ -450,13 +464,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
450 Scene scene = null; 464 Scene scene = null;
451 UUID regionID = UUID.Zero; 465 UUID regionID = UUID.Zero;
452 if (requestData.ContainsKey("region_id") && 466 if (requestData.ContainsKey("region_id") &&
453 !String.IsNullOrEmpty((string)requestData["region_id"])) 467 !String.IsNullOrEmpty((string) requestData["region_id"]))
454 { 468 {
455 regionID = (UUID)(string)requestData["region_id"]; 469 regionID = (UUID) (string) requestData["region_id"];
456 if (m_app.SceneManager.TryGetScene(regionID, out scene)) 470 if (m_app.SceneManager.TryGetScene(regionID, out scene))
457 throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", 471 throw new Exception(
458 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 472 String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>",
459 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); 473 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
474 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
460 } 475 }
461 else 476 else
462 { 477 {
@@ -475,15 +490,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController
475 // check for collisions: region name, region UUID, 490 // check for collisions: region name, region UUID,
476 // region location 491 // region location
477 if (m_app.SceneManager.TryGetScene(region.RegionName, out scene)) 492 if (m_app.SceneManager.TryGetScene(region.RegionName, out scene))
478 throw new Exception(String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>", 493 throw new Exception(
479 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 494 String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>",
480 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); 495 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
496 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
481 497
482 if (m_app.SceneManager.TryGetScene(region.RegionLocX, region.RegionLocY, out scene)) 498 if (m_app.SceneManager.TryGetScene(region.RegionLocX, region.RegionLocY, out scene))
483 throw new Exception(String.Format("region location <{0},{1}> already in use by region {2}, UUID {3}, <{4},{5}>", 499 throw new Exception(
484 region.RegionLocX, region.RegionLocY, 500 String.Format("region location <{0},{1}> already in use by region {2}, UUID {3}, <{4},{5}>",
485 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 501 region.RegionLocX, region.RegionLocY,
486 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); 502 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
503 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
487 504
488 region.InternalEndPoint = 505 region.InternalEndPoint =
489 new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0); 506 new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0);
@@ -491,39 +508,42 @@ namespace OpenSim.ApplicationPlugins.RemoteController
491 region.InternalEndPoint.Port = Convert.ToInt32(requestData["listen_port"]); 508 region.InternalEndPoint.Port = Convert.ToInt32(requestData["listen_port"]);
492 if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0"); 509 if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0");
493 if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene)) 510 if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene))
494 throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>", 511 throw new Exception(
495 region.InternalEndPoint.Address, 512 String.Format(
496 region.InternalEndPoint.Port, 513 "region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>",
497 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 514 region.InternalEndPoint.Address,
498 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); 515 region.InternalEndPoint.Port,
516 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
517 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
499 518
500 519
501 region.ExternalHostName = (string)requestData["external_address"]; 520 region.ExternalHostName = (string) requestData["external_address"];
502 521
503 string masterFirst = (string)requestData["region_master_first"]; 522 string masterFirst = (string) requestData["region_master_first"];
504 string masterLast = (string)requestData["region_master_last"]; 523 string masterLast = (string) requestData["region_master_last"];
505 string masterPassword = (string)requestData["region_master_password"]; 524 string masterPassword = (string) requestData["region_master_password"];
506 525
507 UUID userID = UUID.Zero; 526 UUID userID = UUID.Zero;
508 if (requestData.ContainsKey("region_master_uuid")) 527 if (requestData.ContainsKey("region_master_uuid"))
509 { 528 {
510 // ok, client wants us to use an explicit UUID 529 // ok, client wants us to use an explicit UUID
511 // regardless of what the avatar name provided 530 // regardless of what the avatar name provided
512 userID = new UUID((string)requestData["region_master_uuid"]); 531 userID = new UUID((string) requestData["region_master_uuid"]);
513 } 532 }
514 else 533 else
515 { 534 {
516 // no client supplied UUID: look it up... 535 // no client supplied UUID: look it up...
517 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(masterFirst, masterLast); 536 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(masterFirst, masterLast);
518 if (null == userProfile) 537 if (null == userProfile)
519 { 538 {
520 m_log.InfoFormat("master avatar does not exist, creating it"); 539 m_log.InfoFormat("master avatar does not exist, creating it");
521 // ...or create new user 540 // ...or create new user
522 userID = m_app.CommunicationsManager.UserAdminService.AddUser( 541 userID = m_app.CommunicationsManager.UserAdminService.AddUser(
523 masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY); 542 masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY);
524 543
525 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", 544 if (userID == UUID.Zero)
526 masterFirst, masterLast)); 545 throw new Exception(String.Format("failed to create new user {0} {1}",
546 masterFirst, masterLast));
527 } 547 }
528 else 548 else
529 { 549 {
@@ -536,7 +556,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
536 region.MasterAvatarSandboxPassword = masterPassword; 556 region.MasterAvatarSandboxPassword = masterPassword;
537 region.MasterAvatarAssignedUUID = userID; 557 region.MasterAvatarAssignedUUID = userID;
538 558
539 bool persist = Convert.ToBoolean((string)requestData["persist"]); 559 bool persist = Convert.ToBoolean((string) requestData["persist"]);
540 if (persist) 560 if (persist)
541 { 561 {
542 // default place for region XML files is in the 562 // default place for region XML files is in the
@@ -545,7 +565,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
545 try 565 try
546 { 566 {
547 // OpenSim.ini can specify a different regions dir 567 // OpenSim.ini can specify a different regions dir
548 IConfig startupConfig = (IConfig)m_configSource.Configs["Startup"]; 568 IConfig startupConfig = (IConfig) m_configSource.Configs["Startup"];
549 regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim(); 569 regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim();
550 } 570 }
551 catch (Exception) 571 catch (Exception)
@@ -553,12 +573,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController
553 // No INI setting recorded. 573 // No INI setting recorded.
554 } 574 }
555 string regionXmlPath = Path.Combine(regionConfigPath, 575 string regionXmlPath = Path.Combine(regionConfigPath,
556 String.Format(m_config.GetString("region_file_template", "{0}x{1}-{2}.xml"), 576 String.Format(
557 region.RegionLocX.ToString(), 577 m_config.GetString("region_file_template",
558 region.RegionLocY.ToString(), 578 "{0}x{1}-{2}.xml"),
559 regionID.ToString(), 579 region.RegionLocX.ToString(),
560 region.InternalEndPoint.Port.ToString(), 580 region.RegionLocY.ToString(),
561 region.RegionName.Replace(" ", "_").Replace(":", "_").Replace("/", "_"))); 581 regionID.ToString(),
582 region.InternalEndPoint.Port.ToString(),
583 region.RegionName.Replace(" ", "_").Replace(":", "_").
584 Replace("/", "_")));
562 m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", 585 m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
563 region.RegionID, regionXmlPath); 586 region.RegionID, regionXmlPath);
564 region.SaveRegionToFile("dynamic region", regionXmlPath); 587 region.SaveRegionToFile("dynamic region", regionXmlPath);
@@ -566,7 +589,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
566 IScene newscene; 589 IScene newscene;
567 m_app.CreateRegion(region, out newscene); 590 m_app.CreateRegion(region, out newscene);
568 591
569 responseData["success"] = "true"; 592 responseData["success"] = "true";
570 responseData["region_name"] = region.RegionName; 593 responseData["region_name"] = region.RegionName;
571 responseData["region_uuid"] = region.RegionID.ToString(); 594 responseData["region_uuid"] = region.RegionID.ToString();
572 595
@@ -618,17 +641,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
618 XmlRpcResponse response = new XmlRpcResponse(); 641 XmlRpcResponse response = new XmlRpcResponse();
619 Hashtable responseData = new Hashtable(); 642 Hashtable responseData = new Hashtable();
620 643
621 lock (this) 644 lock (this)
622 { 645 {
623 try { 646 try
647 {
624 Hashtable requestData = (Hashtable) request.Params[0]; 648 Hashtable requestData = (Hashtable) request.Params[0];
625 checkStringParameters(request, new string[] {"password", "region_name"}); 649 checkStringParameters(request, new string[] {"password", "region_name"});
626 650
627 Scene scene = null; 651 Scene scene = null;
628 string regionName = (string)requestData["region_name"]; 652 string regionName = (string) requestData["region_name"];
629 if (!m_app.SceneManager.TryGetScene(regionName, out scene)) 653 if (!m_app.SceneManager.TryGetScene(regionName, out scene))
630 throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); 654 throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
631 655
632 m_app.RemoveRegion(scene, true); 656 m_app.RemoveRegion(scene, true);
633 657
634 responseData["success"] = "true"; 658 responseData["success"] = "true";
@@ -648,7 +672,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
648 } 672 }
649 673
650 return response; 674 return response;
651
652 } 675 }
653 } 676 }
654 677
@@ -694,40 +717,44 @@ namespace OpenSim.ApplicationPlugins.RemoteController
694 XmlRpcResponse response = new XmlRpcResponse(); 717 XmlRpcResponse response = new XmlRpcResponse();
695 Hashtable responseData = new Hashtable(); 718 Hashtable responseData = new Hashtable();
696 719
697 lock (this) 720 lock (this)
698 { 721 {
699 try 722 try
700 { 723 {
701 Hashtable requestData = (Hashtable) request.Params[0]; 724 Hashtable requestData = (Hashtable) request.Params[0];
702 725
703 // check completeness 726 // check completeness
704 checkStringParameters(request, new string[] { "password", "user_firstname", 727 checkStringParameters(request, new string[]
705 "user_lastname", "user_password", }); 728 {
706 checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" }); 729 "password", "user_firstname",
730 "user_lastname", "user_password",
731 });
732 checkIntegerParams(request, new string[] {"start_region_x", "start_region_y"});
707 733
708 // check password 734 // check password
709 if (!String.IsNullOrEmpty(requiredPassword) && 735 if (!String.IsNullOrEmpty(requiredPassword) &&
710 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 736 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
711 737
712 // do the job 738 // do the job
713 string firstname = (string) requestData["user_firstname"]; 739 string firstname = (string) requestData["user_firstname"];
714 string lastname = (string) requestData["user_lastname"]; 740 string lastname = (string) requestData["user_lastname"];
715 string passwd = (string) requestData["user_password"]; 741 string passwd = (string) requestData["user_password"];
716 string email = ""; //Empty string for email 742 string email = ""; //Empty string for email
717 uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]); 743 uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
718 uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]); 744 uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
719 745
720 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); 746 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
721 if (null != userProfile) 747 if (null != userProfile)
722 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname)); 748 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
723 749
724 UUID userID = m_app.CommunicationsManager.UserAdminService.AddUser(firstname, lastname, 750 UUID userID = m_app.CommunicationsManager.UserAdminService.AddUser(firstname, lastname,
725 passwd, email, regX, regY); 751 passwd, email, regX, regY);
726 752
727 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", 753 if (userID == UUID.Zero)
728 firstname, lastname)); 754 throw new Exception(String.Format("failed to create new user {0} {1}",
755 firstname, lastname));
729 756
730 responseData["success"] = "true"; 757 responseData["success"] = "true";
731 responseData["avatar_uuid"] = userID.ToString(); 758 responseData["avatar_uuid"] = userID.ToString();
732 759
733 response.Value = responseData; 760 response.Value = responseData;
@@ -739,14 +766,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
739 m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message); 766 m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message);
740 m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString()); 767 m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString());
741 768
742 responseData["success"] = "false"; 769 responseData["success"] = "false";
743 responseData["avatar_uuid"] = UUID.Zero.ToString(); 770 responseData["avatar_uuid"] = UUID.Zero.ToString();
744 responseData["error"] = e.Message; 771 responseData["error"] = e.Message;
745 772
746 response.Value = responseData; 773 response.Value = responseData;
747 } 774 }
748 return response; 775 return response;
749
750 } 776 }
751 } 777 }
752 778
@@ -794,30 +820,34 @@ namespace OpenSim.ApplicationPlugins.RemoteController
794 XmlRpcResponse response = new XmlRpcResponse(); 820 XmlRpcResponse response = new XmlRpcResponse();
795 Hashtable responseData = new Hashtable(); 821 Hashtable responseData = new Hashtable();
796 822
797 lock (this) 823 lock (this)
798 { 824 {
799 try 825 try
800 { 826 {
801 Hashtable requestData = (Hashtable)request.Params[0]; 827 Hashtable requestData = (Hashtable) request.Params[0];
802 828
803 // check completeness 829 // check completeness
804 checkStringParameters(request, new string[] { "password", "user_firstname", 830 checkStringParameters(request, new string[]
805 "user_lastname", "user_password", "user_email" }); 831 {
806 checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" }); 832 "password", "user_firstname",
833 "user_lastname", "user_password", "user_email"
834 });
835 checkIntegerParams(request, new string[] {"start_region_x", "start_region_y"});
807 836
808 // check password 837 // check password
809 if (!String.IsNullOrEmpty(requiredPassword) && 838 if (!String.IsNullOrEmpty(requiredPassword) &&
810 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 839 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
811 840
812 // do the job 841 // do the job
813 string firstname = (string)requestData["user_firstname"]; 842 string firstname = (string) requestData["user_firstname"];
814 string lastname = (string)requestData["user_lastname"]; 843 string lastname = (string) requestData["user_lastname"];
815 string passwd = (string)requestData["user_password"]; 844 string passwd = (string) requestData["user_password"];
816 string email = (string)requestData["user_email"]; 845 string email = (string) requestData["user_email"];
817 uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]); 846 uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
818 uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]); 847 uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
819 848
820 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); 849 UserProfileData userProfile =
850 m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
821 if (null != userProfile) 851 if (null != userProfile)
822 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname)); 852 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
823 853
@@ -825,8 +855,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
825 = m_app.CommunicationsManager.UserAdminService.AddUser( 855 = m_app.CommunicationsManager.UserAdminService.AddUser(
826 firstname, lastname, passwd, email, regX, regY); 856 firstname, lastname, passwd, email, regX, regY);
827 857
828 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", 858 if (userID == UUID.Zero)
829 firstname, lastname)); 859 throw new Exception(String.Format("failed to create new user {0} {1}",
860 firstname, lastname));
830 861
831 responseData["success"] = "true"; 862 responseData["success"] = "true";
832 responseData["avatar_uuid"] = userID.ToString(); 863 responseData["avatar_uuid"] = userID.ToString();
@@ -847,7 +878,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
847 response.Value = responseData; 878 response.Value = responseData;
848 } 879 }
849 return response; 880 return response;
850
851 } 881 }
852 } 882 }
853 883
@@ -892,11 +922,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
892 Hashtable requestData = (Hashtable) request.Params[0]; 922 Hashtable requestData = (Hashtable) request.Params[0];
893 923
894 // check completeness 924 // check completeness
895 checkStringParameters(request, new string[] { "password", "user_firstname", "user_lastname"}); 925 checkStringParameters(request, new string[] {"password", "user_firstname", "user_lastname"});
896 926
897 string firstname = (string) requestData["user_firstname"]; 927 string firstname = (string) requestData["user_firstname"];
898 string lastname = (string) requestData["user_lastname"]; 928 string lastname = (string) requestData["user_lastname"];
899 929
900 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); 930 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
901 931
902 responseData["user_firstname"] = firstname; 932 responseData["user_firstname"] = firstname;
@@ -906,7 +936,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
906 responseData["success"] = false; 936 responseData["success"] = false;
907 else 937 else
908 responseData["success"] = true; 938 responseData["success"] = true;
909 939
910 response.Value = responseData; 940 response.Value = responseData;
911 } 941 }
912 catch (Exception e) 942 catch (Exception e)
@@ -963,47 +993,58 @@ namespace OpenSim.ApplicationPlugins.RemoteController
963 XmlRpcResponse response = new XmlRpcResponse(); 993 XmlRpcResponse response = new XmlRpcResponse();
964 Hashtable responseData = new Hashtable(); 994 Hashtable responseData = new Hashtable();
965 995
966 lock (this) 996 lock (this)
967 { 997 {
968 try 998 try
969 { 999 {
970 Hashtable requestData = (Hashtable) request.Params[0]; 1000 Hashtable requestData = (Hashtable) request.Params[0];
971 1001
972 // check completeness 1002 // check completeness
973 checkStringParameters(request, new string[] { "password", "user_firstname", 1003 checkStringParameters(request, new string[]
974 "user_lastname" }); 1004 {
1005 "password", "user_firstname",
1006 "user_lastname"
1007 });
975 1008
976 // check password 1009 // check password
977 if (!String.IsNullOrEmpty(requiredPassword) && 1010 if (!String.IsNullOrEmpty(requiredPassword) &&
978 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 1011 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
979 1012
980 // do the job 1013 // do the job
981 string firstname = (string) requestData["user_firstname"]; 1014 string firstname = (string) requestData["user_firstname"];
982 string lastname = (string) requestData["user_lastname"]; 1015 string lastname = (string) requestData["user_lastname"];
983 1016
984 1017
985 string passwd = String.Empty; 1018 string passwd = String.Empty;
986 uint? regX = null; 1019 uint? regX = null;
987 uint? regY = null; 1020 uint? regY = null;
988 uint? ulaX = null; 1021 uint? ulaX = null;
989 uint? ulaY = null; 1022 uint? ulaY = null;
990 uint? ulaZ = null; 1023 uint? ulaZ = null;
991 uint? usaX = null; 1024 uint? usaX = null;
992 uint? usaY = null; 1025 uint? usaY = null;
993 uint? usaZ = null; 1026 uint? usaZ = null;
994 1027
995 1028
996 if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; 1029 if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"];
997 if (requestData.ContainsKey("start_region_x")) regX = Convert.ToUInt32((Int32)requestData["start_region_x"]); 1030 if (requestData.ContainsKey("start_region_x"))
998 if (requestData.ContainsKey("start_region_y")) regY = Convert.ToUInt32((Int32)requestData["start_region_y"]); 1031 regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
999 1032 if (requestData.ContainsKey("start_region_y"))
1000 if (requestData.ContainsKey("start_lookat_x")) ulaX = Convert.ToUInt32((Int32)requestData["start_lookat_x"]); 1033 regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
1001 if (requestData.ContainsKey("start_lookat_y")) ulaY = Convert.ToUInt32((Int32)requestData["start_lookat_y"]); 1034
1002 if (requestData.ContainsKey("start_lookat_z")) ulaZ = Convert.ToUInt32((Int32)requestData["start_lookat_z"]); 1035 if (requestData.ContainsKey("start_lookat_x"))
1003 1036 ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]);
1004 if (requestData.ContainsKey("start_standat_x")) usaX = Convert.ToUInt32((Int32)requestData["start_standat_x"]); 1037 if (requestData.ContainsKey("start_lookat_y"))
1005 if (requestData.ContainsKey("start_standat_y")) usaY = Convert.ToUInt32((Int32)requestData["start_standat_y"]); 1038 ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]);
1006 if (requestData.ContainsKey("start_standat_z")) usaZ = Convert.ToUInt32((Int32)requestData["start_standat_z"]); 1039 if (requestData.ContainsKey("start_lookat_z"))
1040 ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]);
1041
1042 if (requestData.ContainsKey("start_standat_x"))
1043 usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]);
1044 if (requestData.ContainsKey("start_standat_y"))
1045 usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]);
1046 if (requestData.ContainsKey("start_standat_z"))
1047 usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]);
1007 1048
1008 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); 1049 UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
1009 1050
@@ -1016,17 +1057,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1016 userProfile.PasswordHash = md5PasswdHash; 1057 userProfile.PasswordHash = md5PasswdHash;
1017 } 1058 }
1018 1059
1019 if (null != regX) userProfile.HomeRegionX = (uint)regX; 1060 if (null != regX) userProfile.HomeRegionX = (uint) regX;
1020 if (null != regY) userProfile.HomeRegionY = (uint)regY; 1061 if (null != regY) userProfile.HomeRegionY = (uint) regY;
1021 1062
1022 if (null != usaX) userProfile.HomeLocationX = (uint)usaX; 1063 if (null != usaX) userProfile.HomeLocationX = (uint) usaX;
1023 if (null != usaY) userProfile.HomeLocationY = (uint)usaY; 1064 if (null != usaY) userProfile.HomeLocationY = (uint) usaY;
1024 if (null != usaZ) userProfile.HomeLocationZ = (uint)usaZ; 1065 if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ;
1025 1066
1026 if (null != ulaX) userProfile.HomeLookAtX = (uint)ulaX; 1067 if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX;
1027 if (null != ulaY) userProfile.HomeLookAtY = (uint)ulaY; 1068 if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY;
1028 if (null != ulaZ) userProfile.HomeLookAtZ = (uint)ulaZ; 1069 if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ;
1029 1070
1030 if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) 1071 if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile))
1031 throw new Exception("did not manage to update user profile"); 1072 throw new Exception("did not manage to update user profile");
1032 1073
@@ -1034,7 +1075,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1034 1075
1035 response.Value = responseData; 1076 response.Value = responseData;
1036 1077
1037 m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", firstname, lastname, 1078 m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}",
1079 firstname, lastname,
1038 userProfile.ID); 1080 userProfile.ID);
1039 } 1081 }
1040 catch (Exception e) 1082 catch (Exception e)
@@ -1090,49 +1132,49 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1090 XmlRpcResponse response = new XmlRpcResponse(); 1132 XmlRpcResponse response = new XmlRpcResponse();
1091 Hashtable responseData = new Hashtable(); 1133 Hashtable responseData = new Hashtable();
1092 1134
1093 lock (this) 1135 lock (this)
1094 { 1136 {
1095 try 1137 try
1096 { 1138 {
1097 Hashtable requestData = (Hashtable) request.Params[0]; 1139 Hashtable requestData = (Hashtable) request.Params[0];
1098 1140
1099 // check completeness 1141 // check completeness
1100 foreach (string p in new string[] { "password", "filename" }) 1142 foreach (string p in new string[] {"password", "filename"})
1101 { 1143 {
1102 if (!requestData.Contains(p)) 1144 if (!requestData.Contains(p))
1103 throw new Exception(String.Format("missing parameter {0}", p)); 1145 throw new Exception(String.Format("missing parameter {0}", p));
1104 if (String.IsNullOrEmpty((string)requestData[p])) 1146 if (String.IsNullOrEmpty((string) requestData[p]))
1105 throw new Exception(String.Format("parameter {0} is empty")); 1147 throw new Exception(String.Format("parameter {0} is empty"));
1106 } 1148 }
1107 1149
1108 // check password 1150 // check password
1109 if (!String.IsNullOrEmpty(requiredPassword) && 1151 if (!String.IsNullOrEmpty(requiredPassword) &&
1110 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 1152 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
1111 1153
1112 string filename = (string)requestData["filename"]; 1154 string filename = (string) requestData["filename"];
1113 Scene scene = null; 1155 Scene scene = null;
1114 if (requestData.Contains("region_uuid")) 1156 if (requestData.Contains("region_uuid"))
1115 { 1157 {
1116 UUID region_uuid = (UUID)(string)requestData["region_uuid"]; 1158 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
1117 if (!m_app.SceneManager.TryGetScene(region_uuid, out scene)) 1159 if (!m_app.SceneManager.TryGetScene(region_uuid, out scene))
1118 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 1160 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1119 } 1161 }
1120 else if (requestData.Contains("region_name")) 1162 else if (requestData.Contains("region_name"))
1121 { 1163 {
1122 string region_name = (string)requestData["region_name"]; 1164 string region_name = (string) requestData["region_name"];
1123 if (!m_app.SceneManager.TryGetScene(region_name, out scene)) 1165 if (!m_app.SceneManager.TryGetScene(region_name, out scene))
1124 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 1166 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1125 } 1167 }
1126 else throw new Exception("neither region_name nor region_uuid given"); 1168 else throw new Exception("neither region_name nor region_uuid given");
1127 1169
1128 IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>(); 1170 IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
1129 if (archiver != null) 1171 if (archiver != null)
1130 archiver.DearchiveRegion(filename); 1172 archiver.DearchiveRegion(filename);
1131 else 1173 else
1132 throw new Exception("Archiver module not present for scene"); 1174 throw new Exception("Archiver module not present for scene");
1133 1175
1134 responseData["loaded"] = "true"; 1176 responseData["loaded"] = "true";
1135 1177
1136 response.Value = responseData; 1178 response.Value = responseData;
1137 } 1179 }
1138 catch (Exception e) 1180 catch (Exception e)
@@ -1193,29 +1235,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1193 Hashtable requestData = (Hashtable) request.Params[0]; 1235 Hashtable requestData = (Hashtable) request.Params[0];
1194 1236
1195 // check completeness 1237 // check completeness
1196 foreach (string p in new string[] { "password", "filename" }) 1238 foreach (string p in new string[] {"password", "filename"})
1197 { 1239 {
1198 if (!requestData.Contains(p)) 1240 if (!requestData.Contains(p))
1199 throw new Exception(String.Format("missing parameter {0}", p)); 1241 throw new Exception(String.Format("missing parameter {0}", p));
1200 if (String.IsNullOrEmpty((string)requestData[p])) 1242 if (String.IsNullOrEmpty((string) requestData[p]))
1201 throw new Exception(String.Format("parameter {0} is empty")); 1243 throw new Exception(String.Format("parameter {0} is empty"));
1202 } 1244 }
1203 1245
1204 // check password 1246 // check password
1205 if (!String.IsNullOrEmpty(requiredPassword) && 1247 if (!String.IsNullOrEmpty(requiredPassword) &&
1206 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 1248 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
1207 1249
1208 string filename = (string)requestData["filename"]; 1250 string filename = (string) requestData["filename"];
1209 Scene scene = null; 1251 Scene scene = null;
1210 if (requestData.Contains("region_uuid")) 1252 if (requestData.Contains("region_uuid"))
1211 { 1253 {
1212 UUID region_uuid = (UUID)(string)requestData["region_uuid"]; 1254 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
1213 if (!m_app.SceneManager.TryGetScene(region_uuid, out scene)) 1255 if (!m_app.SceneManager.TryGetScene(region_uuid, out scene))
1214 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 1256 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1215 } 1257 }
1216 else if (requestData.Contains("region_name")) 1258 else if (requestData.Contains("region_name"))
1217 { 1259 {
1218 string region_name = (string)requestData["region_name"]; 1260 string region_name = (string) requestData["region_name"];
1219 if (!m_app.SceneManager.TryGetScene(region_name, out scene)) 1261 if (!m_app.SceneManager.TryGetScene(region_name, out scene))
1220 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 1262 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1221 } 1263 }
@@ -1224,8 +1266,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1224 IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>(); 1266 IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
1225 if (archiver != null) 1267 if (archiver != null)
1226 archiver.ArchiveRegion(filename); 1268 archiver.ArchiveRegion(filename);
1227 else 1269 else
1228 throw new Exception("Archiver module not present for scene"); 1270 throw new Exception("Archiver module not present for scene");
1229 1271
1230 responseData["saved"] = "true"; 1272 responseData["saved"] = "true";
1231 1273
@@ -1250,37 +1292,37 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1250 m_log.Info("[RADMIN]: Received Load XML Administrator Request"); 1292 m_log.Info("[RADMIN]: Received Load XML Administrator Request");
1251 XmlRpcResponse response = new XmlRpcResponse(); 1293 XmlRpcResponse response = new XmlRpcResponse();
1252 Hashtable responseData = new Hashtable(); 1294 Hashtable responseData = new Hashtable();
1253 1295
1254 lock (this) 1296 lock (this)
1255 { 1297 {
1256 try 1298 try
1257 { 1299 {
1258 Hashtable requestData = (Hashtable) request.Params[0]; 1300 Hashtable requestData = (Hashtable) request.Params[0];
1259 1301
1260 // check completeness 1302 // check completeness
1261 foreach (string p in new string[] { "password", "filename" }) 1303 foreach (string p in new string[] {"password", "filename"})
1262 { 1304 {
1263 if (!requestData.Contains(p)) 1305 if (!requestData.Contains(p))
1264 throw new Exception(String.Format("missing parameter {0}", p)); 1306 throw new Exception(String.Format("missing parameter {0}", p));
1265 if (String.IsNullOrEmpty((string)requestData[p])) 1307 if (String.IsNullOrEmpty((string) requestData[p]))
1266 throw new Exception(String.Format("parameter {0} is empty")); 1308 throw new Exception(String.Format("parameter {0} is empty"));
1267 } 1309 }
1268 1310
1269 // check password 1311 // check password
1270 if (!String.IsNullOrEmpty(requiredPassword) && 1312 if (!String.IsNullOrEmpty(requiredPassword) &&
1271 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 1313 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
1272 1314
1273 string filename = (string)requestData["filename"]; 1315 string filename = (string) requestData["filename"];
1274 if (requestData.Contains("region_uuid")) 1316 if (requestData.Contains("region_uuid"))
1275 { 1317 {
1276 UUID region_uuid = (UUID)(string)requestData["region_uuid"]; 1318 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
1277 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) 1319 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid))
1278 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 1320 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1279 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 1321 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
1280 } 1322 }
1281 else if (requestData.Contains("region_name")) 1323 else if (requestData.Contains("region_name"))
1282 { 1324 {
1283 string region_name = (string)requestData["region_name"]; 1325 string region_name = (string) requestData["region_name"];
1284 if (!m_app.SceneManager.TrySetCurrentScene(region_name)) 1326 if (!m_app.SceneManager.TrySetCurrentScene(region_name))
1285 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 1327 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1286 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 1328 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
@@ -1292,7 +1334,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1292 string xml_version = "1"; 1334 string xml_version = "1";
1293 if (requestData.Contains("xml_version")) 1335 if (requestData.Contains("xml_version"))
1294 { 1336 {
1295 xml_version = (string)requestData["xml_version"]; 1337 xml_version = (string) requestData["xml_version"];
1296 } 1338 }
1297 1339
1298 switch (xml_version) 1340 switch (xml_version)
@@ -1317,7 +1359,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1317 m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message); 1359 m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message);
1318 m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString()); 1360 m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString());
1319 1361
1320 responseData["loaded"] = "false"; 1362 responseData["loaded"] = "false";
1321 responseData["switched"] = "false"; 1363 responseData["switched"] = "false";
1322 responseData["error"] = e.Message; 1364 responseData["error"] = e.Message;
1323 1365
@@ -1337,32 +1379,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1337 1379
1338 try 1380 try
1339 { 1381 {
1340 Hashtable requestData = (Hashtable)request.Params[0]; 1382 Hashtable requestData = (Hashtable) request.Params[0];
1341 1383
1342 // check completeness 1384 // check completeness
1343 foreach (string p in new string[] { "password", "filename" }) 1385 foreach (string p in new string[] {"password", "filename"})
1344 { 1386 {
1345 if (!requestData.Contains(p)) 1387 if (!requestData.Contains(p))
1346 throw new Exception(String.Format("missing parameter {0}", p)); 1388 throw new Exception(String.Format("missing parameter {0}", p));
1347 if (String.IsNullOrEmpty((string)requestData[p])) 1389 if (String.IsNullOrEmpty((string) requestData[p]))
1348 throw new Exception(String.Format("parameter {0} is empty")); 1390 throw new Exception(String.Format("parameter {0} is empty"));
1349 } 1391 }
1350 1392
1351 // check password 1393 // check password
1352 if (!String.IsNullOrEmpty(requiredPassword) && 1394 if (!String.IsNullOrEmpty(requiredPassword) &&
1353 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 1395 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
1354 1396
1355 string filename = (string)requestData["filename"]; 1397 string filename = (string) requestData["filename"];
1356 if (requestData.Contains("region_uuid")) 1398 if (requestData.Contains("region_uuid"))
1357 { 1399 {
1358 UUID region_uuid = (UUID)(string)requestData["region_uuid"]; 1400 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
1359 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) 1401 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid))
1360 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 1402 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1361 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 1403 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
1362 } 1404 }
1363 else if (requestData.Contains("region_name")) 1405 else if (requestData.Contains("region_name"))
1364 { 1406 {
1365 string region_name = (string)requestData["region_name"]; 1407 string region_name = (string) requestData["region_name"];
1366 if (!m_app.SceneManager.TrySetCurrentScene(region_name)) 1408 if (!m_app.SceneManager.TrySetCurrentScene(region_name))
1367 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 1409 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1368 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 1410 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
@@ -1374,7 +1416,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1374 string xml_version = "1"; 1416 string xml_version = "1";
1375 if (requestData.Contains("xml_version")) 1417 if (requestData.Contains("xml_version"))
1376 { 1418 {
1377 xml_version = (string)requestData["xml_version"]; 1419 xml_version = (string) requestData["xml_version"];
1378 } 1420 }
1379 1421
1380 switch (xml_version) 1422 switch (xml_version)
@@ -1420,24 +1462,24 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1420 { 1462 {
1421 responseData["success"] = "true"; 1463 responseData["success"] = "true";
1422 1464
1423 Hashtable requestData = (Hashtable)request.Params[0]; 1465 Hashtable requestData = (Hashtable) request.Params[0];
1424 1466
1425 // check completeness 1467 // check completeness
1426 if (!requestData.Contains("password")) 1468 if (!requestData.Contains("password"))
1427 throw new Exception(String.Format("missing required parameter")); 1469 throw new Exception(String.Format("missing required parameter"));
1428 if (!String.IsNullOrEmpty(requiredPassword) && 1470 if (!String.IsNullOrEmpty(requiredPassword) &&
1429 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); 1471 (string) requestData["password"] != requiredPassword) throw new Exception("wrong password");
1430 1472
1431 if (requestData.Contains("region_uuid")) 1473 if (requestData.Contains("region_uuid"))
1432 { 1474 {
1433 UUID region_uuid = (UUID)(string)requestData["region_uuid"]; 1475 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
1434 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) 1476 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid))
1435 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 1477 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1436 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 1478 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
1437 } 1479 }
1438 else if (requestData.Contains("region_name")) 1480 else if (requestData.Contains("region_name"))
1439 { 1481 {
1440 string region_name = (string)requestData["region_name"]; 1482 string region_name = (string) requestData["region_name"];
1441 if (!m_app.SceneManager.TrySetCurrentScene(region_name)) 1483 if (!m_app.SceneManager.TrySetCurrentScene(region_name))
1442 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 1484 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1443 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 1485 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
@@ -1469,4 +1511,4 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1469 { 1511 {
1470 } 1512 }
1471 } 1513 }
1472} 1514} \ No newline at end of file