diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 997 |
1 files changed, 499 insertions, 498 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 03b8e9f..026c6ed 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -58,12 +58,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
58 | { | 58 | { |
59 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 59 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
60 | 60 | ||
61 | private static bool daload = false; | 61 | private static bool m_defaultAvatarsLoaded = false; |
62 | private static Object rslock = new Object(); | 62 | private static Object m_requestLock = new Object(); |
63 | private static Object SOLock = new Object(); | 63 | private static Object m_saveOarLock = new Object(); |
64 | 64 | ||
65 | private OpenSimBase m_app; | 65 | private OpenSimBase m_application; |
66 | private IHttpServer m_httpd; | 66 | private IHttpServer m_httpServer; |
67 | private IConfig m_config; | 67 | private IConfig m_config; |
68 | private IConfigSource m_configSource; | 68 | private IConfigSource m_configSource; |
69 | private string m_requiredPassword = String.Empty; | 69 | private string m_requiredPassword = String.Empty; |
@@ -115,8 +115,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
115 | m_requiredPassword = m_config.GetString("access_password", String.Empty); | 115 | m_requiredPassword = m_config.GetString("access_password", String.Empty); |
116 | int port = m_config.GetInt("port", 0); | 116 | int port = m_config.GetInt("port", 0); |
117 | 117 | ||
118 | m_app = openSim; | 118 | m_application = openSim; |
119 | m_httpd = MainServer.GetHttpServer((uint)port); | 119 | m_httpServer = MainServer.GetHttpServer((uint)port); |
120 | 120 | ||
121 | Dictionary<string, XmlRpcMethod> availableMethods = new Dictionary<string, XmlRpcMethod>(); | 121 | Dictionary<string, XmlRpcMethod> availableMethods = new Dictionary<string, XmlRpcMethod>(); |
122 | availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod; | 122 | availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod; |
@@ -161,14 +161,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
161 | { | 161 | { |
162 | foreach (string method in availableMethods.Keys) | 162 | foreach (string method in availableMethods.Keys) |
163 | { | 163 | { |
164 | m_httpd.AddXmlRPCHandler(method, availableMethods[method], false); | 164 | m_httpServer.AddXmlRPCHandler(method, availableMethods[method], false); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | else | 167 | else |
168 | { | 168 | { |
169 | foreach (string enabledMethod in enabledMethods.Split('|')) | 169 | foreach (string enabledMethod in enabledMethods.Split('|')) |
170 | { | 170 | { |
171 | m_httpd.AddXmlRPCHandler(enabledMethod, availableMethods[enabledMethod]); | 171 | m_httpServer.AddXmlRPCHandler(enabledMethod, availableMethods[enabledMethod]); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | } | 174 | } |
@@ -181,7 +181,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
181 | 181 | ||
182 | public void PostInitialise() | 182 | public void PostInitialise() |
183 | { | 183 | { |
184 | if (!createDefaultAvatars()) | 184 | if (!CreateDefaultAvatars()) |
185 | { | 185 | { |
186 | m_log.Info("[RADMIN]: Default avatars not loaded"); | 186 | m_log.Info("[RADMIN]: Default avatars not loaded"); |
187 | } | 187 | } |
@@ -197,7 +197,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
197 | Hashtable requestData = (Hashtable) request.Params[0]; | 197 | Hashtable requestData = (Hashtable) request.Params[0]; |
198 | 198 | ||
199 | m_log.Info("[RADMIN]: Request to restart Region."); | 199 | m_log.Info("[RADMIN]: Request to restart Region."); |
200 | checkStringParameters(request, new string[] {"password", "regionID"}); | 200 | CheckStringParameters(request, new string[] {"password", "regionID"}); |
201 | 201 | ||
202 | if (m_requiredPassword != String.Empty && | 202 | if (m_requiredPassword != String.Empty && |
203 | (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) | 203 | (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) |
@@ -213,7 +213,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
213 | 213 | ||
214 | Scene rebootedScene; | 214 | Scene rebootedScene; |
215 | 215 | ||
216 | if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) | 216 | if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene)) |
217 | throw new Exception("region not found"); | 217 | throw new Exception("region not found"); |
218 | 218 | ||
219 | int timeout = 30000; | 219 | int timeout = 30000; |
@@ -243,7 +243,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
243 | if (requestData.ContainsKey("noticetype") | 243 | if (requestData.ContainsKey("noticetype") |
244 | && ((string)requestData["noticetype"] == "dialog")) | 244 | && ((string)requestData["noticetype"] == "dialog")) |
245 | { | 245 | { |
246 | m_app.SceneManager.ForEachScene( | 246 | m_application.SceneManager.ForEachScene( |
247 | delegate(Scene scene) | 247 | delegate(Scene scene) |
248 | { | 248 | { |
249 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 249 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
@@ -256,7 +256,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
256 | if (!requestData.ContainsKey("noticetype") | 256 | if (!requestData.ContainsKey("noticetype") |
257 | || ((string)requestData["noticetype"] != "none")) | 257 | || ((string)requestData["noticetype"] != "none")) |
258 | { | 258 | { |
259 | m_app.SceneManager.ForEachScene( | 259 | m_application.SceneManager.ForEachScene( |
260 | delegate(Scene scene) | 260 | delegate(Scene scene) |
261 | { | 261 | { |
262 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 262 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
@@ -296,7 +296,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
296 | { | 296 | { |
297 | Hashtable requestData = (Hashtable) request.Params[0]; | 297 | Hashtable requestData = (Hashtable) request.Params[0]; |
298 | 298 | ||
299 | checkStringParameters(request, new string[] {"password", "message"}); | 299 | CheckStringParameters(request, new string[] {"password", "message"}); |
300 | 300 | ||
301 | if (m_requiredPassword != String.Empty && | 301 | if (m_requiredPassword != String.Empty && |
302 | (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) | 302 | (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) |
@@ -309,7 +309,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
309 | responseData["success"] = true; | 309 | responseData["success"] = true; |
310 | response.Value = responseData; | 310 | response.Value = responseData; |
311 | 311 | ||
312 | m_app.SceneManager.ForEachScene( | 312 | m_application.SceneManager.ForEachScene( |
313 | delegate(Scene scene) | 313 | delegate(Scene scene) |
314 | { | 314 | { |
315 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 315 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
@@ -342,7 +342,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
342 | { | 342 | { |
343 | Hashtable requestData = (Hashtable)request.Params[0]; | 343 | Hashtable requestData = (Hashtable)request.Params[0]; |
344 | 344 | ||
345 | checkStringParameters(request, new string[] { "password", "from", "message" }); | 345 | CheckStringParameters(request, new string[] { "password", "from", "message" }); |
346 | 346 | ||
347 | if (m_requiredPassword != String.Empty && | 347 | if (m_requiredPassword != String.Empty && |
348 | (!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword)) | 348 | (!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword)) |
@@ -356,7 +356,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
356 | responseData["success"] = true; | 356 | responseData["success"] = true; |
357 | response.Value = responseData; | 357 | response.Value = responseData; |
358 | 358 | ||
359 | m_app.SceneManager.ForEachScene( | 359 | m_application.SceneManager.ForEachScene( |
360 | delegate(Scene scene) | 360 | delegate(Scene scene) |
361 | { | 361 | { |
362 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 362 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
@@ -397,7 +397,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
397 | // k, (string)requestData[k], ((string)requestData[k]).Length); | 397 | // k, (string)requestData[k], ((string)requestData[k]).Length); |
398 | // } | 398 | // } |
399 | 399 | ||
400 | checkStringParameters(request, new string[] {"password", "filename", "regionid"}); | 400 | CheckStringParameters(request, new string[] {"password", "filename", "regionid"}); |
401 | 401 | ||
402 | if (m_requiredPassword != String.Empty && | 402 | if (m_requiredPassword != String.Empty && |
403 | (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) | 403 | (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) |
@@ -411,7 +411,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
411 | 411 | ||
412 | Scene region = null; | 412 | Scene region = null; |
413 | 413 | ||
414 | if (!m_app.SceneManager.TryGetScene(regionID, out region)) | 414 | if (!m_application.SceneManager.TryGetScene(regionID, out region)) |
415 | throw new Exception("1: unable to get a scene with that name"); | 415 | throw new Exception("1: unable to get a scene with that name"); |
416 | 416 | ||
417 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); | 417 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); |
@@ -488,7 +488,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
488 | if (requestData.ContainsKey("noticetype") | 488 | if (requestData.ContainsKey("noticetype") |
489 | && ((string) requestData["noticetype"] == "dialog")) | 489 | && ((string) requestData["noticetype"] == "dialog")) |
490 | { | 490 | { |
491 | m_app.SceneManager.ForEachScene( | 491 | m_application.SceneManager.ForEachScene( |
492 | delegate(Scene scene) | 492 | delegate(Scene scene) |
493 | { | 493 | { |
494 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 494 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
@@ -501,7 +501,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
501 | if (!requestData.ContainsKey("noticetype") | 501 | if (!requestData.ContainsKey("noticetype") |
502 | || ((string)requestData["noticetype"] != "none")) | 502 | || ((string)requestData["noticetype"] != "none")) |
503 | { | 503 | { |
504 | m_app.SceneManager.ForEachScene( | 504 | m_application.SceneManager.ForEachScene( |
505 | delegate(Scene scene) | 505 | delegate(Scene scene) |
506 | { | 506 | { |
507 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 507 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
@@ -540,7 +540,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
540 | 540 | ||
541 | private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e) | 541 | private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e) |
542 | { | 542 | { |
543 | m_app.Shutdown(); | 543 | m_application.Shutdown(); |
544 | } | 544 | } |
545 | 545 | ||
546 | /// <summary> | 546 | /// <summary> |
@@ -607,7 +607,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
607 | XmlRpcResponse response = new XmlRpcResponse(); | 607 | XmlRpcResponse response = new XmlRpcResponse(); |
608 | Hashtable responseData = new Hashtable(); | 608 | Hashtable responseData = new Hashtable(); |
609 | 609 | ||
610 | lock (rslock) | 610 | lock (m_requestLock) |
611 | { | 611 | { |
612 | int m_regionLimit = m_config.GetInt("region_limit", 0); | 612 | int m_regionLimit = m_config.GetInt("region_limit", 0); |
613 | bool m_enableVoiceForNewRegions = m_config.GetBoolean("create_region_enable_voice", false); | 613 | bool m_enableVoiceForNewRegions = m_config.GetBoolean("create_region_enable_voice", false); |
@@ -617,7 +617,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
617 | { | 617 | { |
618 | Hashtable requestData = (Hashtable) request.Params[0]; | 618 | Hashtable requestData = (Hashtable) request.Params[0]; |
619 | 619 | ||
620 | checkStringParameters(request, new string[] | 620 | CheckStringParameters(request, new string[] |
621 | { | 621 | { |
622 | "password", | 622 | "password", |
623 | "region_name", | 623 | "region_name", |
@@ -625,14 +625,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
625 | "region_master_password", | 625 | "region_master_password", |
626 | "listen_ip", "external_address" | 626 | "listen_ip", "external_address" |
627 | }); | 627 | }); |
628 | checkIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"}); | 628 | CheckIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"}); |
629 | 629 | ||
630 | // check password | 630 | // check password |
631 | if (!String.IsNullOrEmpty(m_requiredPassword) && | 631 | if (!String.IsNullOrEmpty(m_requiredPassword) && |
632 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 632 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); |
633 | 633 | ||
634 | // check whether we still have space left (iff we are using limits) | 634 | // check whether we still have space left (iff we are using limits) |
635 | if (m_regionLimit != 0 && m_app.SceneManager.Scenes.Count >= m_regionLimit) | 635 | if (m_regionLimit != 0 && m_application.SceneManager.Scenes.Count >= m_regionLimit) |
636 | throw new Exception(String.Format("cannot instantiate new region, server capacity {0} already reached; delete regions first", | 636 | throw new Exception(String.Format("cannot instantiate new region, server capacity {0} already reached; delete regions first", |
637 | m_regionLimit)); | 637 | m_regionLimit)); |
638 | // extract or generate region ID now | 638 | // extract or generate region ID now |
@@ -642,7 +642,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
642 | !String.IsNullOrEmpty((string) requestData["region_id"])) | 642 | !String.IsNullOrEmpty((string) requestData["region_id"])) |
643 | { | 643 | { |
644 | regionID = (UUID) (string) requestData["region_id"]; | 644 | regionID = (UUID) (string) requestData["region_id"]; |
645 | if (m_app.SceneManager.TryGetScene(regionID, out scene)) | 645 | if (m_application.SceneManager.TryGetScene(regionID, out scene)) |
646 | throw new Exception( | 646 | throw new Exception( |
647 | String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", | 647 | String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", |
648 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, | 648 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, |
@@ -665,13 +665,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
665 | 665 | ||
666 | // check for collisions: region name, region UUID, | 666 | // check for collisions: region name, region UUID, |
667 | // region location | 667 | // region location |
668 | if (m_app.SceneManager.TryGetScene(region.RegionName, out scene)) | 668 | if (m_application.SceneManager.TryGetScene(region.RegionName, out scene)) |
669 | throw new Exception( | 669 | throw new Exception( |
670 | String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>", | 670 | String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>", |
671 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, | 671 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, |
672 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); | 672 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); |
673 | 673 | ||
674 | if (m_app.SceneManager.TryGetScene(region.RegionLocX, region.RegionLocY, out scene)) | 674 | if (m_application.SceneManager.TryGetScene(region.RegionLocX, region.RegionLocY, out scene)) |
675 | throw new Exception( | 675 | throw new Exception( |
676 | String.Format("region location <{0},{1}> already in use by region {2}, UUID {3}, <{4},{5}>", | 676 | String.Format("region location <{0},{1}> already in use by region {2}, UUID {3}, <{4},{5}>", |
677 | region.RegionLocX, region.RegionLocY, | 677 | region.RegionLocX, region.RegionLocY, |
@@ -683,7 +683,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
683 | 683 | ||
684 | region.InternalEndPoint.Port = Convert.ToInt32(requestData["listen_port"]); | 684 | region.InternalEndPoint.Port = Convert.ToInt32(requestData["listen_port"]); |
685 | if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0"); | 685 | if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0"); |
686 | if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene)) | 686 | if (m_application.SceneManager.TryGetScene(region.InternalEndPoint, out scene)) |
687 | throw new Exception( | 687 | throw new Exception( |
688 | String.Format( | 688 | String.Format( |
689 | "region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>", | 689 | "region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>", |
@@ -743,28 +743,28 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
743 | 743 | ||
744 | // Create the region and perform any initial initialization | 744 | // Create the region and perform any initial initialization |
745 | 745 | ||
746 | IScene newscene; | 746 | IScene newScene; |
747 | m_app.CreateRegion(region, out newscene); | 747 | m_application.CreateRegion(region, out newScene); |
748 | 748 | ||
749 | // If an access specification was provided, use it. | 749 | // If an access specification was provided, use it. |
750 | // Otherwise accept the default. | 750 | // Otherwise accept the default. |
751 | newscene.RegionInfo.EstateSettings.PublicAccess = getBoolean(requestData, "public", m_publicAccess); | 751 | newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess); |
752 | newscene.RegionInfo.EstateSettings.EstateOwner = userID; | 752 | newScene.RegionInfo.EstateSettings.EstateOwner = userID; |
753 | if (persist) | 753 | if (persist) |
754 | newscene.RegionInfo.EstateSettings.Save(); | 754 | newScene.RegionInfo.EstateSettings.Save(); |
755 | 755 | ||
756 | // enable voice on newly created region if | 756 | // enable voice on newly created region if |
757 | // requested by either the XmlRpc request or the | 757 | // requested by either the XmlRpc request or the |
758 | // configuration | 758 | // configuration |
759 | if (getBoolean(requestData, "enable_voice", m_enableVoiceForNewRegions)) | 759 | if (GetBoolean(requestData, "enable_voice", m_enableVoiceForNewRegions)) |
760 | { | 760 | { |
761 | List<ILandObject> parcels = ((Scene)newscene).LandChannel.AllParcels(); | 761 | List<ILandObject> parcels = ((Scene)newScene).LandChannel.AllParcels(); |
762 | 762 | ||
763 | foreach (ILandObject parcel in parcels) | 763 | foreach (ILandObject parcel in parcels) |
764 | { | 764 | { |
765 | parcel.LandData.Flags |= (uint) ParcelFlags.AllowVoiceChat; | 765 | parcel.LandData.Flags |= (uint) ParcelFlags.AllowVoiceChat; |
766 | parcel.LandData.Flags |= (uint) ParcelFlags.UseEstateVoiceChan; | 766 | parcel.LandData.Flags |= (uint) ParcelFlags.UseEstateVoiceChan; |
767 | ((Scene)newscene).LandChannel.UpdateLandObject(parcel.LandData.LocalID, parcel.LandData); | 767 | ((Scene)newScene).LandChannel.UpdateLandObject(parcel.LandData.LocalID, parcel.LandData); |
768 | } | 768 | } |
769 | } | 769 | } |
770 | 770 | ||
@@ -822,19 +822,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
822 | XmlRpcResponse response = new XmlRpcResponse(); | 822 | XmlRpcResponse response = new XmlRpcResponse(); |
823 | Hashtable responseData = new Hashtable(); | 823 | Hashtable responseData = new Hashtable(); |
824 | 824 | ||
825 | lock (rslock) | 825 | lock (m_requestLock) |
826 | { | 826 | { |
827 | try | 827 | try |
828 | { | 828 | { |
829 | Hashtable requestData = (Hashtable) request.Params[0]; | 829 | Hashtable requestData = (Hashtable) request.Params[0]; |
830 | checkStringParameters(request, new string[] {"password", "region_name"}); | 830 | CheckStringParameters(request, new string[] {"password", "region_name"}); |
831 | 831 | ||
832 | Scene scene = null; | 832 | Scene scene = null; |
833 | string regionName = (string) requestData["region_name"]; | 833 | string regionName = (string) requestData["region_name"]; |
834 | if (!m_app.SceneManager.TryGetScene(regionName, out scene)) | 834 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) |
835 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); | 835 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); |
836 | 836 | ||
837 | m_app.RemoveRegion(scene, true); | 837 | m_application.RemoveRegion(scene, true); |
838 | 838 | ||
839 | responseData["success"] = true; | 839 | responseData["success"] = true; |
840 | responseData["region_name"] = regionName; | 840 | responseData["region_name"] = regionName; |
@@ -892,22 +892,22 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
892 | Hashtable responseData = new Hashtable(); | 892 | Hashtable responseData = new Hashtable(); |
893 | Scene scene = null; | 893 | Scene scene = null; |
894 | 894 | ||
895 | lock (rslock) | 895 | lock (m_requestLock) |
896 | { | 896 | { |
897 | try | 897 | try |
898 | { | 898 | { |
899 | Hashtable requestData = (Hashtable) request.Params[0]; | 899 | Hashtable requestData = (Hashtable) request.Params[0]; |
900 | checkStringParameters(request, new string[] {"password"}); | 900 | CheckStringParameters(request, new string[] {"password"}); |
901 | 901 | ||
902 | if (requestData.ContainsKey("region_id") && | 902 | if (requestData.ContainsKey("region_id") && |
903 | !String.IsNullOrEmpty((string) requestData["region_id"])) | 903 | !String.IsNullOrEmpty((string) requestData["region_id"])) |
904 | { | 904 | { |
905 | // Region specified by UUID | 905 | // Region specified by UUID |
906 | UUID regionID = (UUID) (string) requestData["region_id"]; | 906 | UUID regionID = (UUID) (string) requestData["region_id"]; |
907 | if (!m_app.SceneManager.TryGetScene(regionID, out scene)) | 907 | if (!m_application.SceneManager.TryGetScene(regionID, out scene)) |
908 | throw new Exception(String.Format("region \"{0}\" does not exist", regionID)); | 908 | throw new Exception(String.Format("region \"{0}\" does not exist", regionID)); |
909 | 909 | ||
910 | m_app.CloseRegion(scene); | 910 | m_application.CloseRegion(scene); |
911 | 911 | ||
912 | responseData["success"] = true; | 912 | responseData["success"] = true; |
913 | responseData["region_id"] = regionID; | 913 | responseData["region_id"] = regionID; |
@@ -920,10 +920,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
920 | // Region specified by name | 920 | // Region specified by name |
921 | 921 | ||
922 | string regionName = (string) requestData["region_name"]; | 922 | string regionName = (string) requestData["region_name"]; |
923 | if (!m_app.SceneManager.TryGetScene(regionName, out scene)) | 923 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) |
924 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); | 924 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); |
925 | 925 | ||
926 | m_app.CloseRegion(scene); | 926 | m_application.CloseRegion(scene); |
927 | 927 | ||
928 | responseData["success"] = true; | 928 | responseData["success"] = true; |
929 | responseData["region_name"] = regionName; | 929 | responseData["region_name"] = regionName; |
@@ -987,27 +987,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
987 | XmlRpcResponse response = new XmlRpcResponse(); | 987 | XmlRpcResponse response = new XmlRpcResponse(); |
988 | Hashtable responseData = new Hashtable(); | 988 | Hashtable responseData = new Hashtable(); |
989 | 989 | ||
990 | lock (rslock) | 990 | lock (m_requestLock) |
991 | { | 991 | { |
992 | try | 992 | try |
993 | { | 993 | { |
994 | Hashtable requestData = (Hashtable) request.Params[0]; | 994 | Hashtable requestData = (Hashtable) request.Params[0]; |
995 | checkStringParameters(request, new string[] {"password", "region_name"}); | 995 | CheckStringParameters(request, new string[] {"password", "region_name"}); |
996 | 996 | ||
997 | Scene scene = null; | 997 | Scene scene = null; |
998 | string regionName = (string) requestData["region_name"]; | 998 | string regionName = (string) requestData["region_name"]; |
999 | if (!m_app.SceneManager.TryGetScene(regionName, out scene)) | 999 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) |
1000 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); | 1000 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); |
1001 | 1001 | ||
1002 | // Modify access | 1002 | // Modify access |
1003 | scene.RegionInfo.EstateSettings.PublicAccess = | 1003 | scene.RegionInfo.EstateSettings.PublicAccess = |
1004 | getBoolean(requestData,"public", scene.RegionInfo.EstateSettings.PublicAccess); | 1004 | GetBoolean(requestData,"public", scene.RegionInfo.EstateSettings.PublicAccess); |
1005 | if (scene.RegionInfo.Persistent) | 1005 | if (scene.RegionInfo.Persistent) |
1006 | scene.RegionInfo.EstateSettings.Save(); | 1006 | scene.RegionInfo.EstateSettings.Save(); |
1007 | 1007 | ||
1008 | if (requestData.ContainsKey("enable_voice")) | 1008 | if (requestData.ContainsKey("enable_voice")) |
1009 | { | 1009 | { |
1010 | bool enableVoice = getBoolean(requestData, "enable_voice", true); | 1010 | bool enableVoice = GetBoolean(requestData, "enable_voice", true); |
1011 | List<ILandObject> parcels = ((Scene)scene).LandChannel.AllParcels(); | 1011 | List<ILandObject> parcels = ((Scene)scene).LandChannel.AllParcels(); |
1012 | 1012 | ||
1013 | foreach (ILandObject parcel in parcels) | 1013 | foreach (ILandObject parcel in parcels) |
@@ -1094,66 +1094,66 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1094 | XmlRpcResponse response = new XmlRpcResponse(); | 1094 | XmlRpcResponse response = new XmlRpcResponse(); |
1095 | Hashtable responseData = new Hashtable(); | 1095 | Hashtable responseData = new Hashtable(); |
1096 | 1096 | ||
1097 | lock (rslock) | 1097 | lock (m_requestLock) |
1098 | { | 1098 | { |
1099 | try | 1099 | try |
1100 | { | 1100 | { |
1101 | Hashtable requestData = (Hashtable) request.Params[0]; | 1101 | Hashtable requestData = (Hashtable) request.Params[0]; |
1102 | 1102 | ||
1103 | // check completeness | 1103 | // check completeness |
1104 | checkStringParameters(request, new string[] | 1104 | CheckStringParameters(request, new string[] |
1105 | { | 1105 | { |
1106 | "password", "user_firstname", | 1106 | "password", "user_firstname", |
1107 | "user_lastname", "user_password", | 1107 | "user_lastname", "user_password", |
1108 | }); | 1108 | }); |
1109 | checkIntegerParams(request, new string[] {"start_region_x", "start_region_y"}); | 1109 | CheckIntegerParams(request, new string[] {"start_region_x", "start_region_y"}); |
1110 | 1110 | ||
1111 | // check password | 1111 | // check password |
1112 | if (!String.IsNullOrEmpty(m_requiredPassword) && | 1112 | if (!String.IsNullOrEmpty(m_requiredPassword) && |
1113 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 1113 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); |
1114 | 1114 | ||
1115 | // do the job | 1115 | // do the job |
1116 | string firstname = (string) requestData["user_firstname"]; | 1116 | string firstName = (string) requestData["user_firstname"]; |
1117 | string lastname = (string) requestData["user_lastname"]; | 1117 | string lastName = (string) requestData["user_lastname"]; |
1118 | string passwd = (string) requestData["user_password"]; | 1118 | string password = (string) requestData["user_password"]; |
1119 | 1119 | ||
1120 | uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); | 1120 | uint regionXLocation = Convert.ToUInt32((Int32) requestData["start_region_x"]); |
1121 | uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); | 1121 | uint regionYLocation = Convert.ToUInt32((Int32) requestData["start_region_y"]); |
1122 | 1122 | ||
1123 | string email = ""; // empty string for email | 1123 | string email = ""; // empty string for email |
1124 | if (requestData.Contains("user_email")) | 1124 | if (requestData.Contains("user_email")) |
1125 | email = (string)requestData["user_email"]; | 1125 | email = (string)requestData["user_email"]; |
1126 | 1126 | ||
1127 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 1127 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
1128 | UUID scopeID = scene.RegionInfo.ScopeID; | 1128 | UUID scopeID = scene.RegionInfo.ScopeID; |
1129 | 1129 | ||
1130 | UserAccount account = CreateUser(scopeID, firstname, lastname, passwd, email); | 1130 | UserAccount account = CreateUser(scopeID, firstName, lastName, password, email); |
1131 | 1131 | ||
1132 | if (null == account) | 1132 | if (null == account) |
1133 | throw new Exception(String.Format("failed to create new user {0} {1}", | 1133 | throw new Exception(String.Format("failed to create new user {0} {1}", |
1134 | firstname, lastname)); | 1134 | firstName, lastName)); |
1135 | 1135 | ||
1136 | // Set home position | 1136 | // Set home position |
1137 | 1137 | ||
1138 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, | 1138 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, |
1139 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | 1139 | (int)(regionXLocation * Constants.RegionSize), (int)(regionYLocation * Constants.RegionSize)); |
1140 | if (null == home) { | 1140 | if (null == home) { |
1141 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstname, lastname); | 1141 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstName, lastName); |
1142 | } else { | 1142 | } else { |
1143 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | 1143 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); |
1144 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstname, lastname); | 1144 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstName, lastName); |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | // Establish the avatar's initial appearance | 1147 | // Establish the avatar's initial appearance |
1148 | 1148 | ||
1149 | updateUserAppearance(responseData, requestData, account.PrincipalID); | 1149 | UpdateUserAppearance(responseData, requestData, account.PrincipalID); |
1150 | 1150 | ||
1151 | responseData["success"] = true; | 1151 | responseData["success"] = true; |
1152 | responseData["avatar_uuid"] = account.PrincipalID.ToString(); | 1152 | responseData["avatar_uuid"] = account.PrincipalID.ToString(); |
1153 | 1153 | ||
1154 | response.Value = responseData; | 1154 | response.Value = responseData; |
1155 | 1155 | ||
1156 | m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, account.PrincipalID); | 1156 | m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstName, lastName, account.PrincipalID); |
1157 | } | 1157 | } |
1158 | catch (Exception e) | 1158 | catch (Exception e) |
1159 | { | 1159 | { |
@@ -1217,17 +1217,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1217 | Hashtable requestData = (Hashtable) request.Params[0]; | 1217 | Hashtable requestData = (Hashtable) request.Params[0]; |
1218 | 1218 | ||
1219 | // check completeness | 1219 | // check completeness |
1220 | checkStringParameters(request, new string[] {"password", "user_firstname", "user_lastname"}); | 1220 | CheckStringParameters(request, new string[] {"password", "user_firstname", "user_lastname"}); |
1221 | 1221 | ||
1222 | string firstname = (string) requestData["user_firstname"]; | 1222 | string firstName = (string) requestData["user_firstname"]; |
1223 | string lastname = (string) requestData["user_lastname"]; | 1223 | string lastName = (string) requestData["user_lastname"]; |
1224 | 1224 | ||
1225 | responseData["user_firstname"] = firstname; | 1225 | responseData["user_firstname"] = firstName; |
1226 | responseData["user_lastname"] = lastname; | 1226 | responseData["user_lastname"] = lastName; |
1227 | 1227 | ||
1228 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 1228 | UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
1229 | 1229 | ||
1230 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname); | 1230 | UserAccount account = m_application.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstName, lastName); |
1231 | 1231 | ||
1232 | if (null == account) | 1232 | if (null == account) |
1233 | { | 1233 | { |
@@ -1236,9 +1236,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1236 | } | 1236 | } |
1237 | else | 1237 | else |
1238 | { | 1238 | { |
1239 | GridUserInfo guinfo = m_app.SceneManager.CurrentOrFirstScene.GridUserService.GetGridUserInfo(account.PrincipalID.ToString()); | 1239 | GridUserInfo userInfo = m_application.SceneManager.CurrentOrFirstScene.GridUserService.GetGridUserInfo(account.PrincipalID.ToString()); |
1240 | if (guinfo != null) | 1240 | if (userInfo != null) |
1241 | responseData["lastlogin"] = guinfo.Login; | 1241 | responseData["lastlogin"] = userInfo.Login; |
1242 | else | 1242 | else |
1243 | responseData["lastlogin"] = 0; | 1243 | responseData["lastlogin"] = 0; |
1244 | 1244 | ||
@@ -1315,14 +1315,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1315 | XmlRpcResponse response = new XmlRpcResponse(); | 1315 | XmlRpcResponse response = new XmlRpcResponse(); |
1316 | Hashtable responseData = new Hashtable(); | 1316 | Hashtable responseData = new Hashtable(); |
1317 | 1317 | ||
1318 | lock (rslock) | 1318 | lock (m_requestLock) |
1319 | { | 1319 | { |
1320 | try | 1320 | try |
1321 | { | 1321 | { |
1322 | Hashtable requestData = (Hashtable) request.Params[0]; | 1322 | Hashtable requestData = (Hashtable) request.Params[0]; |
1323 | 1323 | ||
1324 | // check completeness | 1324 | // check completeness |
1325 | checkStringParameters(request, new string[] { | 1325 | CheckStringParameters(request, new string[] { |
1326 | "password", "user_firstname", | 1326 | "password", "user_firstname", |
1327 | "user_lastname"}); | 1327 | "user_lastname"}); |
1328 | 1328 | ||
@@ -1331,12 +1331,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1331 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 1331 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); |
1332 | 1332 | ||
1333 | // do the job | 1333 | // do the job |
1334 | string firstname = (string) requestData["user_firstname"]; | 1334 | string firstName = (string) requestData["user_firstname"]; |
1335 | string lastname = (string) requestData["user_lastname"]; | 1335 | string lastName = (string) requestData["user_lastname"]; |
1336 | 1336 | ||
1337 | string passwd = String.Empty; | 1337 | string password = String.Empty; |
1338 | uint? regX = null; | 1338 | uint? regionXLocation = null; |
1339 | uint? regY = null; | 1339 | uint? regionYLocation = null; |
1340 | // uint? ulaX = null; | 1340 | // uint? ulaX = null; |
1341 | // uint? ulaY = null; | 1341 | // uint? ulaY = null; |
1342 | // uint? ulaZ = null; | 1342 | // uint? ulaZ = null; |
@@ -1346,11 +1346,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1346 | // string aboutFirstLive = String.Empty; | 1346 | // string aboutFirstLive = String.Empty; |
1347 | // string aboutAvatar = String.Empty; | 1347 | // string aboutAvatar = String.Empty; |
1348 | 1348 | ||
1349 | if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; | 1349 | if (requestData.ContainsKey("user_password")) password = (string) requestData["user_password"]; |
1350 | if (requestData.ContainsKey("start_region_x")) | 1350 | if (requestData.ContainsKey("start_region_x")) |
1351 | regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); | 1351 | regionXLocation = Convert.ToUInt32((Int32) requestData["start_region_x"]); |
1352 | if (requestData.ContainsKey("start_region_y")) | 1352 | if (requestData.ContainsKey("start_region_y")) |
1353 | regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); | 1353 | regionYLocation = Convert.ToUInt32((Int32) requestData["start_region_y"]); |
1354 | 1354 | ||
1355 | // if (requestData.ContainsKey("start_lookat_x")) | 1355 | // if (requestData.ContainsKey("start_lookat_x")) |
1356 | // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); | 1356 | // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); |
@@ -1370,17 +1370,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1370 | // if (requestData.ContainsKey("about_virtual_world")) | 1370 | // if (requestData.ContainsKey("about_virtual_world")) |
1371 | // aboutAvatar = (string)requestData["about_virtual_world"]; | 1371 | // aboutAvatar = (string)requestData["about_virtual_world"]; |
1372 | 1372 | ||
1373 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 1373 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
1374 | UUID scopeID = scene.RegionInfo.ScopeID; | 1374 | UUID scopeID = scene.RegionInfo.ScopeID; |
1375 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, firstname, lastname); | 1375 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, firstName, lastName); |
1376 | 1376 | ||
1377 | if (null == account) | 1377 | if (null == account) |
1378 | throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); | 1378 | throw new Exception(String.Format("avatar {0} {1} does not exist", firstName, lastName)); |
1379 | 1379 | ||
1380 | if (!String.IsNullOrEmpty(passwd)) | 1380 | if (!String.IsNullOrEmpty(password)) |
1381 | { | 1381 | { |
1382 | m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname); | 1382 | m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstName, lastName); |
1383 | ChangeUserPassword(firstname, lastname, passwd); | 1383 | ChangeUserPassword(firstName, lastName, password); |
1384 | } | 1384 | } |
1385 | 1385 | ||
1386 | // if (null != usaX) userProfile.HomeLocationX = (uint) usaX; | 1386 | // if (null != usaX) userProfile.HomeLocationX = (uint) usaX; |
@@ -1396,21 +1396,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1396 | 1396 | ||
1397 | // Set home position | 1397 | // Set home position |
1398 | 1398 | ||
1399 | if ((null != regX) && (null != regY)) | 1399 | if ((null != regionXLocation) && (null != regionYLocation)) |
1400 | { | 1400 | { |
1401 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, | 1401 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, |
1402 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | 1402 | (int)(regionXLocation * Constants.RegionSize), (int)(regionYLocation * Constants.RegionSize)); |
1403 | if (null == home) { | 1403 | if (null == home) { |
1404 | m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstname, lastname); | 1404 | m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstName, lastName); |
1405 | } else { | 1405 | } else { |
1406 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | 1406 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); |
1407 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstname, lastname); | 1407 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstName, lastName); |
1408 | } | 1408 | } |
1409 | } | 1409 | } |
1410 | 1410 | ||
1411 | // User has been created. Now establish gender and appearance. | 1411 | // User has been created. Now establish gender and appearance. |
1412 | 1412 | ||
1413 | updateUserAppearance(responseData, requestData, account.PrincipalID); | 1413 | UpdateUserAppearance(responseData, requestData, account.PrincipalID); |
1414 | 1414 | ||
1415 | responseData["success"] = true; | 1415 | responseData["success"] = true; |
1416 | responseData["avatar_uuid"] = account.PrincipalID.ToString(); | 1416 | responseData["avatar_uuid"] = account.PrincipalID.ToString(); |
@@ -1418,7 +1418,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1418 | response.Value = responseData; | 1418 | response.Value = responseData; |
1419 | 1419 | ||
1420 | m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", | 1420 | m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", |
1421 | firstname, lastname, | 1421 | firstName, lastName, |
1422 | account.PrincipalID); | 1422 | account.PrincipalID); |
1423 | } | 1423 | } |
1424 | catch (Exception e) | 1424 | catch (Exception e) |
@@ -1446,13 +1446,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1446 | /// This should probably get moved into somewhere more core eventually. | 1446 | /// This should probably get moved into somewhere more core eventually. |
1447 | /// </summary> | 1447 | /// </summary> |
1448 | 1448 | ||
1449 | private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) | 1449 | private void UpdateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) |
1450 | { | 1450 | { |
1451 | m_log.DebugFormat("[RADMIN] updateUserAppearance"); | 1451 | m_log.DebugFormat("[RADMIN] updateUserAppearance"); |
1452 | 1452 | ||
1453 | string dmale = m_config.GetString("default_male", "Default Male"); | 1453 | string defaultMale = m_config.GetString("default_male", "Default Male"); |
1454 | string dfemale = m_config.GetString("default_female", "Default Female"); | 1454 | string defaultFemale = m_config.GetString("default_female", "Default Female"); |
1455 | string dneut = m_config.GetString("default_female", "Default Default"); | 1455 | string defaultNeutral = m_config.GetString("default_female", "Default Default"); |
1456 | string model = String.Empty; | 1456 | string model = String.Empty; |
1457 | 1457 | ||
1458 | // Has a gender preference been supplied? | 1458 | // Has a gender preference been supplied? |
@@ -1463,16 +1463,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1463 | { | 1463 | { |
1464 | case "m" : | 1464 | case "m" : |
1465 | case "male" : | 1465 | case "male" : |
1466 | model = dmale; | 1466 | model = defaultMale; |
1467 | break; | 1467 | break; |
1468 | case "f" : | 1468 | case "f" : |
1469 | case "female" : | 1469 | case "female" : |
1470 | model = dfemale; | 1470 | model = defaultFemale; |
1471 | break; | 1471 | break; |
1472 | case "n" : | 1472 | case "n" : |
1473 | case "neutral" : | 1473 | case "neutral" : |
1474 | default : | 1474 | default : |
1475 | model = dneut; | 1475 | model = defaultNeutral; |
1476 | break; | 1476 | break; |
1477 | } | 1477 | } |
1478 | } | 1478 | } |
@@ -1494,19 +1494,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1494 | 1494 | ||
1495 | m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model <{1}>", userid, model); | 1495 | m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model <{1}>", userid, model); |
1496 | 1496 | ||
1497 | string[] nomens = model.Split(); | 1497 | string[] modelSpecifiers = model.Split(); |
1498 | if (nomens.Length != 2) | 1498 | if (modelSpecifiers.Length != 2) |
1499 | { | 1499 | { |
1500 | m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); | 1500 | m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); |
1501 | // nomens = dmodel.Split(); | 1501 | // modelSpecifiers = dmodel.Split(); |
1502 | return; | 1502 | return; |
1503 | } | 1503 | } |
1504 | 1504 | ||
1505 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 1505 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
1506 | UUID scopeID = scene.RegionInfo.ScopeID; | 1506 | UUID scopeID = scene.RegionInfo.ScopeID; |
1507 | UserAccount mprof = scene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]); | 1507 | UserAccount modelProfile = scene.UserAccountService.GetUserAccount(scopeID, modelSpecifiers[0], modelSpecifiers[1]); |
1508 | 1508 | ||
1509 | if (mprof == null) | 1509 | if (modelProfile == null) |
1510 | { | 1510 | { |
1511 | m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); | 1511 | m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); |
1512 | return; | 1512 | return; |
@@ -1516,7 +1516,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1516 | // actual asset ids, however to complete the magic we need to populate the inventory with the | 1516 | // actual asset ids, however to complete the magic we need to populate the inventory with the |
1517 | // assets in question. | 1517 | // assets in question. |
1518 | 1518 | ||
1519 | establishAppearance(userid, mprof.PrincipalID); | 1519 | EstablishAppearance(userid, modelProfile.PrincipalID); |
1520 | 1520 | ||
1521 | m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", | 1521 | m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", |
1522 | userid, model); | 1522 | userid, model); |
@@ -1528,17 +1528,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1528 | /// is known to exist, as is the target avatar. | 1528 | /// is known to exist, as is the target avatar. |
1529 | /// </summary> | 1529 | /// </summary> |
1530 | 1530 | ||
1531 | private void establishAppearance(UUID dest, UUID srca) | 1531 | private void EstablishAppearance(UUID destination, UUID source) |
1532 | { | 1532 | { |
1533 | m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca); | 1533 | m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", destination, source); |
1534 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 1534 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
1535 | AvatarAppearance ava = null; | 1535 | AvatarAppearance avatarAppearance = null; |
1536 | AvatarData avatar = scene.AvatarService.GetAvatar(srca); | 1536 | AvatarData avatar = scene.AvatarService.GetAvatar(source); |
1537 | if (avatar != null) | 1537 | if (avatar != null) |
1538 | ava = avatar.ToAvatarAppearance(srca); | 1538 | avatarAppearance = avatar.ToAvatarAppearance(source); |
1539 | 1539 | ||
1540 | // If the model has no associated appearance we're done. | 1540 | // If the model has no associated appearance we're done. |
1541 | if (ava == null) | 1541 | if (avatarAppearance == null) |
1542 | return; | 1542 | return; |
1543 | 1543 | ||
1544 | // Simple appearance copy or copy Clothing and Bodyparts folders? | 1544 | // Simple appearance copy or copy Clothing and Bodyparts folders? |
@@ -1549,15 +1549,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1549 | // Simple copy of wearables and appearance update | 1549 | // Simple copy of wearables and appearance update |
1550 | try | 1550 | try |
1551 | { | 1551 | { |
1552 | copyWearablesAndAttachments(dest, srca, ava); | 1552 | CopyWearablesAndAttachments(destination, source, avatarAppearance); |
1553 | 1553 | ||
1554 | AvatarData adata = new AvatarData(ava); | 1554 | AvatarData avatarData = new AvatarData(avatarAppearance); |
1555 | scene.AvatarService.SetAvatar(dest, adata); | 1555 | scene.AvatarService.SetAvatar(destination, avatarData); |
1556 | } | 1556 | } |
1557 | catch (Exception e) | 1557 | catch (Exception e) |
1558 | { | 1558 | { |
1559 | m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", | 1559 | m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", |
1560 | dest, e.Message); | 1560 | destination, e.Message); |
1561 | } | 1561 | } |
1562 | 1562 | ||
1563 | return; | 1563 | return; |
@@ -1566,30 +1566,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1566 | // Copy Clothing and Bodypart folders and appearance update | 1566 | // Copy Clothing and Bodypart folders and appearance update |
1567 | try | 1567 | try |
1568 | { | 1568 | { |
1569 | Dictionary<UUID,UUID> imap = new Dictionary<UUID,UUID>(); | 1569 | Dictionary<UUID,UUID> inventoryMap = new Dictionary<UUID,UUID>(); |
1570 | copyInventoryFolders(dest, srca, AssetType.Clothing, imap, ava); | 1570 | CopyInventoryFolders(destination, source, AssetType.Clothing, inventoryMap, avatarAppearance); |
1571 | copyInventoryFolders(dest, srca, AssetType.Bodypart, imap, ava); | 1571 | CopyInventoryFolders(destination, source, AssetType.Bodypart, inventoryMap, avatarAppearance); |
1572 | 1572 | ||
1573 | AvatarWearable[] wearables = ava.Wearables; | 1573 | AvatarWearable[] wearables = avatarAppearance.Wearables; |
1574 | 1574 | ||
1575 | for (int i=0; i<wearables.Length; i++) | 1575 | for (int i=0; i<wearables.Length; i++) |
1576 | { | 1576 | { |
1577 | if (imap.ContainsKey(wearables[i].ItemID)) | 1577 | if (inventoryMap.ContainsKey(wearables[i].ItemID)) |
1578 | { | 1578 | { |
1579 | AvatarWearable dw = new AvatarWearable(); | 1579 | AvatarWearable wearable = new AvatarWearable(); |
1580 | dw.AssetID = wearables[i].AssetID; | 1580 | wearable.AssetID = wearables[i].AssetID; |
1581 | dw.ItemID = imap[wearables[i].ItemID]; | 1581 | wearable.ItemID = inventoryMap[wearables[i].ItemID]; |
1582 | ava.SetWearable(i, dw); | 1582 | avatarAppearance.SetWearable(i, wearable); |
1583 | } | 1583 | } |
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | AvatarData adata = new AvatarData(ava); | 1586 | AvatarData avatarData = new AvatarData(avatarAppearance); |
1587 | scene.AvatarService.SetAvatar(dest, adata); | 1587 | scene.AvatarService.SetAvatar(destination, avatarData); |
1588 | } | 1588 | } |
1589 | catch (Exception e) | 1589 | catch (Exception e) |
1590 | { | 1590 | { |
1591 | m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", | 1591 | m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", |
1592 | dest, e.Message); | 1592 | destination, e.Message); |
1593 | } | 1593 | } |
1594 | 1594 | ||
1595 | return; | 1595 | return; |
@@ -1601,32 +1601,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1601 | /// In parallel the avatar wearables and attachments are updated. | 1601 | /// In parallel the avatar wearables and attachments are updated. |
1602 | /// </summary> | 1602 | /// </summary> |
1603 | 1603 | ||
1604 | private void copyWearablesAndAttachments(UUID dest, UUID srca, AvatarAppearance ava) | 1604 | private void CopyWearablesAndAttachments(UUID destination, UUID source, AvatarAppearance avatarAppearance) |
1605 | { | 1605 | { |
1606 | IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService; | 1606 | IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService; |
1607 | 1607 | ||
1608 | // Get Clothing folder of receiver | 1608 | // Get Clothing folder of receiver |
1609 | InventoryFolderBase dstf = iserv.GetFolderForType(dest, AssetType.Clothing); | 1609 | InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, AssetType.Clothing); |
1610 | 1610 | ||
1611 | if (dstf == null) | 1611 | if (destinationFolder == null) |
1612 | throw new Exception("Cannot locate folder(s)"); | 1612 | throw new Exception("Cannot locate folder(s)"); |
1613 | 1613 | ||
1614 | // Missing destination folder? This should *never* be the case | 1614 | // Missing destination folder? This should *never* be the case |
1615 | if (dstf.Type != (short)AssetType.Clothing) | 1615 | if (destinationFolder.Type != (short)AssetType.Clothing) |
1616 | { | 1616 | { |
1617 | dstf = new InventoryFolderBase(); | 1617 | destinationFolder = new InventoryFolderBase(); |
1618 | dstf.ID = UUID.Random(); | 1618 | |
1619 | dstf.Name = "Clothing"; | 1619 | destinationFolder.ID = UUID.Random(); |
1620 | dstf.Owner = dest; | 1620 | destinationFolder.Name = "Clothing"; |
1621 | dstf.Type = (short)AssetType.Clothing; | 1621 | destinationFolder.Owner = destination; |
1622 | dstf.ParentID = iserv.GetRootFolder(dest).ID; | 1622 | destinationFolder.Type = (short)AssetType.Clothing; |
1623 | dstf.Version = 1; | 1623 | destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID; |
1624 | iserv.AddFolder(dstf); // store base record | 1624 | destinationFolder.Version = 1; |
1625 | m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", srca); | 1625 | inventoryService.AddFolder(destinationFolder); // store base record |
1626 | m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source); | ||
1626 | } | 1627 | } |
1627 | 1628 | ||
1628 | // Wearables | 1629 | // Wearables |
1629 | AvatarWearable[] wearables = ava.Wearables; | 1630 | AvatarWearable[] wearables = avatarAppearance.Wearables; |
1630 | AvatarWearable wearable; | 1631 | AvatarWearable wearable; |
1631 | 1632 | ||
1632 | for (int i=0; i<wearables.Length; i++) | 1633 | for (int i=0; i<wearables.Length; i++) |
@@ -1635,95 +1636,95 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1635 | if (wearable.ItemID != UUID.Zero) | 1636 | if (wearable.ItemID != UUID.Zero) |
1636 | { | 1637 | { |
1637 | // Get inventory item and copy it | 1638 | // Get inventory item and copy it |
1638 | InventoryItemBase item = new InventoryItemBase(wearable.ItemID, srca); | 1639 | InventoryItemBase item = new InventoryItemBase(wearable.ItemID, source); |
1639 | item = iserv.GetItem(item); | 1640 | item = inventoryService.GetItem(item); |
1640 | 1641 | ||
1641 | if (item != null) | 1642 | if (item != null) |
1642 | { | 1643 | { |
1643 | InventoryItemBase dsti = new InventoryItemBase(UUID.Random(), dest); | 1644 | InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); |
1644 | dsti.Name = item.Name; | 1645 | destinationItem.Name = item.Name; |
1645 | dsti.Description = item.Description; | 1646 | destinationItem.Description = item.Description; |
1646 | dsti.InvType = item.InvType; | 1647 | destinationItem.InvType = item.InvType; |
1647 | dsti.CreatorId = item.CreatorId; | 1648 | destinationItem.CreatorId = item.CreatorId; |
1648 | dsti.CreatorIdAsUuid = item.CreatorIdAsUuid; | 1649 | destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid; |
1649 | dsti.NextPermissions = item.NextPermissions; | 1650 | destinationItem.NextPermissions = item.NextPermissions; |
1650 | dsti.CurrentPermissions = item.CurrentPermissions; | 1651 | destinationItem.CurrentPermissions = item.CurrentPermissions; |
1651 | dsti.BasePermissions = item.BasePermissions; | 1652 | destinationItem.BasePermissions = item.BasePermissions; |
1652 | dsti.EveryOnePermissions = item.EveryOnePermissions; | 1653 | destinationItem.EveryOnePermissions = item.EveryOnePermissions; |
1653 | dsti.GroupPermissions = item.GroupPermissions; | 1654 | destinationItem.GroupPermissions = item.GroupPermissions; |
1654 | dsti.AssetType = item.AssetType; | 1655 | destinationItem.AssetType = item.AssetType; |
1655 | dsti.AssetID = item.AssetID; | 1656 | destinationItem.AssetID = item.AssetID; |
1656 | dsti.GroupID = item.GroupID; | 1657 | destinationItem.GroupID = item.GroupID; |
1657 | dsti.GroupOwned = item.GroupOwned; | 1658 | destinationItem.GroupOwned = item.GroupOwned; |
1658 | dsti.SalePrice = item.SalePrice; | 1659 | destinationItem.SalePrice = item.SalePrice; |
1659 | dsti.SaleType = item.SaleType; | 1660 | destinationItem.SaleType = item.SaleType; |
1660 | dsti.Flags = item.Flags; | 1661 | destinationItem.Flags = item.Flags; |
1661 | dsti.CreationDate = item.CreationDate; | 1662 | destinationItem.CreationDate = item.CreationDate; |
1662 | dsti.Folder = dstf.ID; | 1663 | destinationItem.Folder = destinationFolder.ID; |
1663 | 1664 | ||
1664 | iserv.AddItem(dsti); | 1665 | inventoryService.AddItem(destinationItem); |
1665 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, dstf.ID); | 1666 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); |
1666 | 1667 | ||
1667 | // Wear item | 1668 | // Wear item |
1668 | AvatarWearable dw = new AvatarWearable(); | 1669 | AvatarWearable newWearable = new AvatarWearable(); |
1669 | dw.AssetID = wearable.AssetID; | 1670 | newWearable.AssetID = wearable.AssetID; |
1670 | dw.ItemID = dsti.ID; | 1671 | newWearable.ItemID = destinationItem.ID; |
1671 | ava.SetWearable(i, dw); | 1672 | avatarAppearance.SetWearable(i, newWearable); |
1672 | } | 1673 | } |
1673 | else | 1674 | else |
1674 | { | 1675 | { |
1675 | m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, dstf.ID); | 1676 | m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); |
1676 | } | 1677 | } |
1677 | } | 1678 | } |
1678 | } | 1679 | } |
1679 | 1680 | ||
1680 | // Attachments | 1681 | // Attachments |
1681 | Dictionary<int, UUID[]> attachments = ava.GetAttachmentDictionary(); | 1682 | Dictionary<int, UUID[]> attachments = avatarAppearance.GetAttachmentDictionary(); |
1682 | 1683 | ||
1683 | foreach (KeyValuePair<int, UUID[]> kvp in attachments) | 1684 | foreach (KeyValuePair<int, UUID[]> attachment in attachments) |
1684 | { | 1685 | { |
1685 | int attachpoint = kvp.Key; | 1686 | int attachpoint = attachment.Key; |
1686 | UUID itemID = kvp.Value[0]; | 1687 | UUID itemID = attachment.Value[0]; |
1687 | 1688 | ||
1688 | if (itemID != UUID.Zero) | 1689 | if (itemID != UUID.Zero) |
1689 | { | 1690 | { |
1690 | // Get inventory item and copy it | 1691 | // Get inventory item and copy it |
1691 | InventoryItemBase item = new InventoryItemBase(itemID, srca); | 1692 | InventoryItemBase item = new InventoryItemBase(itemID, source); |
1692 | item = iserv.GetItem(item); | 1693 | item = inventoryService.GetItem(item); |
1693 | 1694 | ||
1694 | if (item != null) | 1695 | if (item != null) |
1695 | { | 1696 | { |
1696 | InventoryItemBase dsti = new InventoryItemBase(UUID.Random(), dest); | 1697 | InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); |
1697 | dsti.Name = item.Name; | 1698 | destinationItem.Name = item.Name; |
1698 | dsti.Description = item.Description; | 1699 | destinationItem.Description = item.Description; |
1699 | dsti.InvType = item.InvType; | 1700 | destinationItem.InvType = item.InvType; |
1700 | dsti.CreatorId = item.CreatorId; | 1701 | destinationItem.CreatorId = item.CreatorId; |
1701 | dsti.CreatorIdAsUuid = item.CreatorIdAsUuid; | 1702 | destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid; |
1702 | dsti.NextPermissions = item.NextPermissions; | 1703 | destinationItem.NextPermissions = item.NextPermissions; |
1703 | dsti.CurrentPermissions = item.CurrentPermissions; | 1704 | destinationItem.CurrentPermissions = item.CurrentPermissions; |
1704 | dsti.BasePermissions = item.BasePermissions; | 1705 | destinationItem.BasePermissions = item.BasePermissions; |
1705 | dsti.EveryOnePermissions = item.EveryOnePermissions; | 1706 | destinationItem.EveryOnePermissions = item.EveryOnePermissions; |
1706 | dsti.GroupPermissions = item.GroupPermissions; | 1707 | destinationItem.GroupPermissions = item.GroupPermissions; |
1707 | dsti.AssetType = item.AssetType; | 1708 | destinationItem.AssetType = item.AssetType; |
1708 | dsti.AssetID = item.AssetID; | 1709 | destinationItem.AssetID = item.AssetID; |
1709 | dsti.GroupID = item.GroupID; | 1710 | destinationItem.GroupID = item.GroupID; |
1710 | dsti.GroupOwned = item.GroupOwned; | 1711 | destinationItem.GroupOwned = item.GroupOwned; |
1711 | dsti.SalePrice = item.SalePrice; | 1712 | destinationItem.SalePrice = item.SalePrice; |
1712 | dsti.SaleType = item.SaleType; | 1713 | destinationItem.SaleType = item.SaleType; |
1713 | dsti.Flags = item.Flags; | 1714 | destinationItem.Flags = item.Flags; |
1714 | dsti.CreationDate = item.CreationDate; | 1715 | destinationItem.CreationDate = item.CreationDate; |
1715 | dsti.Folder = dstf.ID; | 1716 | destinationItem.Folder = destinationFolder.ID; |
1716 | 1717 | ||
1717 | iserv.AddItem(dsti); | 1718 | inventoryService.AddItem(destinationItem); |
1718 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, dstf.ID); | 1719 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); |
1719 | 1720 | ||
1720 | // Attach item | 1721 | // Attach item |
1721 | ava.SetAttachment(attachpoint, dsti.ID, dsti.AssetID); | 1722 | avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); |
1722 | m_log.DebugFormat("[RADMIN] Attached {0}", dsti.ID); | 1723 | m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); |
1723 | } | 1724 | } |
1724 | else | 1725 | else |
1725 | { | 1726 | { |
1726 | m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, dstf.ID); | 1727 | m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, destinationFolder.ID); |
1727 | } | 1728 | } |
1728 | } | 1729 | } |
1729 | } | 1730 | } |
@@ -1736,101 +1737,101 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1736 | /// copies of Clothing and Bodyparts inventory folders and attaches worn attachments | 1737 | /// copies of Clothing and Bodyparts inventory folders and attaches worn attachments |
1737 | /// </summary> | 1738 | /// </summary> |
1738 | 1739 | ||
1739 | private void copyInventoryFolders(UUID dest, UUID srca, AssetType assettype, Dictionary<UUID,UUID> imap, | 1740 | private void CopyInventoryFolders(UUID destination, UUID source, AssetType assetType, Dictionary<UUID,UUID> inventoryMap, |
1740 | AvatarAppearance ava) | 1741 | AvatarAppearance avatarAppearance) |
1741 | { | 1742 | { |
1742 | IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService; | 1743 | IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService; |
1743 | 1744 | ||
1744 | InventoryFolderBase srcf = iserv.GetFolderForType(srca, assettype); | 1745 | InventoryFolderBase sourceFolder = inventoryService.GetFolderForType(source, assetType); |
1745 | InventoryFolderBase dstf = iserv.GetFolderForType(dest, assettype); | 1746 | InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, assetType); |
1746 | 1747 | ||
1747 | if (srcf == null || dstf == null) | 1748 | if (sourceFolder == null || destinationFolder == null) |
1748 | throw new Exception("Cannot locate folder(s)"); | 1749 | throw new Exception("Cannot locate folder(s)"); |
1749 | 1750 | ||
1750 | // Missing source folder? This should *never* be the case | 1751 | // Missing source folder? This should *never* be the case |
1751 | if (srcf.Type != (short)assettype) | 1752 | if (sourceFolder.Type != (short)assetType) |
1752 | { | 1753 | { |
1753 | srcf = new InventoryFolderBase(); | 1754 | sourceFolder = new InventoryFolderBase(); |
1754 | srcf.ID = UUID.Random(); | 1755 | sourceFolder.ID = UUID.Random(); |
1755 | if (assettype == AssetType.Clothing) { | 1756 | if (assetType == AssetType.Clothing) { |
1756 | srcf.Name = "Clothing"; | 1757 | sourceFolder.Name = "Clothing"; |
1757 | } else { | 1758 | } else { |
1758 | srcf.Name = "Body Parts"; | 1759 | sourceFolder.Name = "Body Parts"; |
1759 | } | 1760 | } |
1760 | srcf.Owner = srca; | 1761 | sourceFolder.Owner = source; |
1761 | srcf.Type = (short)assettype; | 1762 | sourceFolder.Type = (short)assetType; |
1762 | srcf.ParentID = iserv.GetRootFolder(srca).ID; | 1763 | sourceFolder.ParentID = inventoryService.GetRootFolder(source).ID; |
1763 | srcf.Version = 1; | 1764 | sourceFolder.Version = 1; |
1764 | iserv.AddFolder(srcf); // store base record | 1765 | inventoryService.AddFolder(sourceFolder); // store base record |
1765 | m_log.ErrorFormat("[RADMIN] Created folder for source {0}", srca); | 1766 | m_log.ErrorFormat("[RADMIN] Created folder for source {0}", source); |
1766 | } | 1767 | } |
1767 | 1768 | ||
1768 | // Missing destination folder? This should *never* be the case | 1769 | // Missing destination folder? This should *never* be the case |
1769 | if (dstf.Type != (short)assettype) | 1770 | if (destinationFolder.Type != (short)assetType) |
1770 | { | 1771 | { |
1771 | dstf = new InventoryFolderBase(); | 1772 | destinationFolder = new InventoryFolderBase(); |
1772 | dstf.ID = UUID.Random(); | 1773 | destinationFolder.ID = UUID.Random(); |
1773 | dstf.Name = assettype.ToString(); | 1774 | destinationFolder.Name = assetType.ToString(); |
1774 | dstf.Owner = dest; | 1775 | destinationFolder.Owner = destination; |
1775 | dstf.Type = (short)assettype; | 1776 | destinationFolder.Type = (short)assetType; |
1776 | dstf.ParentID = iserv.GetRootFolder(dest).ID; | 1777 | destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID; |
1777 | dstf.Version = 1; | 1778 | destinationFolder.Version = 1; |
1778 | iserv.AddFolder(dstf); // store base record | 1779 | inventoryService.AddFolder(destinationFolder); // store base record |
1779 | m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", srca); | 1780 | m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source); |
1780 | } | 1781 | } |
1781 | 1782 | ||
1782 | InventoryFolderBase efolder; | 1783 | InventoryFolderBase extraFolder; |
1783 | List<InventoryFolderBase> folders = iserv.GetFolderContent(srca, srcf.ID).Folders; | 1784 | List<InventoryFolderBase> folders = inventoryService.GetFolderContent(source, sourceFolder.ID).Folders; |
1784 | 1785 | ||
1785 | foreach (InventoryFolderBase folder in folders) | 1786 | foreach (InventoryFolderBase folder in folders) |
1786 | { | 1787 | { |
1787 | 1788 | ||
1788 | efolder = new InventoryFolderBase(); | 1789 | extraFolder = new InventoryFolderBase(); |
1789 | efolder.ID = UUID.Random(); | 1790 | extraFolder.ID = UUID.Random(); |
1790 | efolder.Name = folder.Name; | 1791 | extraFolder.Name = folder.Name; |
1791 | efolder.Owner = dest; | 1792 | extraFolder.Owner = destination; |
1792 | efolder.Type = folder.Type; | 1793 | extraFolder.Type = folder.Type; |
1793 | efolder.Version = folder.Version; | 1794 | extraFolder.Version = folder.Version; |
1794 | efolder.ParentID = dstf.ID; | 1795 | extraFolder.ParentID = destinationFolder.ID; |
1795 | iserv.AddFolder(efolder); | 1796 | inventoryService.AddFolder(extraFolder); |
1796 | 1797 | ||
1797 | m_log.DebugFormat("[RADMIN] Added folder {0} to folder {1}", efolder.ID, srcf.ID); | 1798 | m_log.DebugFormat("[RADMIN] Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID); |
1798 | 1799 | ||
1799 | List<InventoryItemBase> items = iserv.GetFolderContent(srca, folder.ID).Items; | 1800 | List<InventoryItemBase> items = inventoryService.GetFolderContent(source, folder.ID).Items; |
1800 | 1801 | ||
1801 | foreach (InventoryItemBase item in items) | 1802 | foreach (InventoryItemBase item in items) |
1802 | { | 1803 | { |
1803 | InventoryItemBase dsti = new InventoryItemBase(UUID.Random(), dest); | 1804 | InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); |
1804 | dsti.Name = item.Name; | 1805 | destinationItem.Name = item.Name; |
1805 | dsti.Description = item.Description; | 1806 | destinationItem.Description = item.Description; |
1806 | dsti.InvType = item.InvType; | 1807 | destinationItem.InvType = item.InvType; |
1807 | dsti.CreatorId = item.CreatorId; | 1808 | destinationItem.CreatorId = item.CreatorId; |
1808 | dsti.CreatorIdAsUuid = item.CreatorIdAsUuid; | 1809 | destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid; |
1809 | dsti.NextPermissions = item.NextPermissions; | 1810 | destinationItem.NextPermissions = item.NextPermissions; |
1810 | dsti.CurrentPermissions = item.CurrentPermissions; | 1811 | destinationItem.CurrentPermissions = item.CurrentPermissions; |
1811 | dsti.BasePermissions = item.BasePermissions; | 1812 | destinationItem.BasePermissions = item.BasePermissions; |
1812 | dsti.EveryOnePermissions = item.EveryOnePermissions; | 1813 | destinationItem.EveryOnePermissions = item.EveryOnePermissions; |
1813 | dsti.GroupPermissions = item.GroupPermissions; | 1814 | destinationItem.GroupPermissions = item.GroupPermissions; |
1814 | dsti.AssetType = item.AssetType; | 1815 | destinationItem.AssetType = item.AssetType; |
1815 | dsti.AssetID = item.AssetID; | 1816 | destinationItem.AssetID = item.AssetID; |
1816 | dsti.GroupID = item.GroupID; | 1817 | destinationItem.GroupID = item.GroupID; |
1817 | dsti.GroupOwned = item.GroupOwned; | 1818 | destinationItem.GroupOwned = item.GroupOwned; |
1818 | dsti.SalePrice = item.SalePrice; | 1819 | destinationItem.SalePrice = item.SalePrice; |
1819 | dsti.SaleType = item.SaleType; | 1820 | destinationItem.SaleType = item.SaleType; |
1820 | dsti.Flags = item.Flags; | 1821 | destinationItem.Flags = item.Flags; |
1821 | dsti.CreationDate = item.CreationDate; | 1822 | destinationItem.CreationDate = item.CreationDate; |
1822 | dsti.Folder = efolder.ID; | 1823 | destinationItem.Folder = extraFolder.ID; |
1823 | 1824 | ||
1824 | iserv.AddItem(dsti); | 1825 | inventoryService.AddItem(destinationItem); |
1825 | imap.Add(item.ID, dsti.ID); | 1826 | inventoryMap.Add(item.ID, destinationItem.ID); |
1826 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, efolder.ID); | 1827 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID); |
1827 | 1828 | ||
1828 | // Attach item, if original is attached | 1829 | // Attach item, if original is attached |
1829 | int attachpoint = ava.GetAttachpoint(item.ID); | 1830 | int attachpoint = avatarAppearance.GetAttachpoint(item.ID); |
1830 | if (attachpoint != 0) | 1831 | if (attachpoint != 0) |
1831 | { | 1832 | { |
1832 | ava.SetAttachment(attachpoint, dsti.ID, dsti.AssetID); | 1833 | avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); |
1833 | m_log.DebugFormat("[RADMIN] Attached {0}", dsti.ID); | 1834 | m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); |
1834 | } | 1835 | } |
1835 | } | 1836 | } |
1836 | } | 1837 | } |
@@ -1846,63 +1847,63 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1846 | /// other outfits are provided to allow "real" avatars a way to easily change their outfits. | 1847 | /// other outfits are provided to allow "real" avatars a way to easily change their outfits. |
1847 | /// </summary> | 1848 | /// </summary> |
1848 | 1849 | ||
1849 | private bool createDefaultAvatars() | 1850 | private bool CreateDefaultAvatars() |
1850 | { | 1851 | { |
1851 | // Only load once | 1852 | // Only load once |
1852 | 1853 | ||
1853 | if (daload) | 1854 | if (m_defaultAvatarsLoaded) |
1854 | { | 1855 | { |
1855 | return false; | 1856 | return false; |
1856 | } | 1857 | } |
1857 | 1858 | ||
1858 | m_log.DebugFormat("[RADMIN] Creating default avatar entries"); | 1859 | m_log.DebugFormat("[RADMIN] Creating default avatar entries"); |
1859 | 1860 | ||
1860 | daload = true; | 1861 | m_defaultAvatarsLoaded = true; |
1861 | 1862 | ||
1862 | // Load processing starts here... | 1863 | // Load processing starts here... |
1863 | 1864 | ||
1864 | try | 1865 | try |
1865 | { | 1866 | { |
1866 | string dafn = null; | 1867 | string defaultAppearanceFileName = null; |
1867 | 1868 | ||
1868 | //m_config may be null if RemoteAdmin configuration secition is missing or disabled in OpenSim.ini | 1869 | //m_config may be null if RemoteAdmin configuration secition is missing or disabled in OpenSim.ini |
1869 | if (m_config != null) | 1870 | if (m_config != null) |
1870 | { | 1871 | { |
1871 | dafn = m_config.GetString("default_appearance", "default_appearance.xml"); | 1872 | defaultAppearanceFileName = m_config.GetString("default_appearance", "default_appearance.xml"); |
1872 | } | 1873 | } |
1873 | 1874 | ||
1874 | if (File.Exists(dafn)) | 1875 | if (File.Exists(defaultAppearanceFileName)) |
1875 | { | 1876 | { |
1876 | XmlDocument doc = new XmlDocument(); | 1877 | XmlDocument doc = new XmlDocument(); |
1877 | string name = "*unknown*"; | 1878 | string name = "*unknown*"; |
1878 | string email = "anon@anon"; | 1879 | string email = "anon@anon"; |
1879 | uint regX = 1000; | 1880 | uint regionXLocation = 1000; |
1880 | uint regY = 1000; | 1881 | uint regionYLocation = 1000; |
1881 | string passwd = UUID.Random().ToString(); // No requirement to sign-in. | 1882 | string password = UUID.Random().ToString(); // No requirement to sign-in. |
1882 | UUID ID = UUID.Zero; | 1883 | UUID ID = UUID.Zero; |
1883 | AvatarAppearance mava; | 1884 | AvatarAppearance avatarAppearance; |
1884 | XmlNodeList avatars; | 1885 | XmlNodeList avatars; |
1885 | XmlNodeList assets; | 1886 | XmlNodeList assets; |
1886 | XmlNode perms = null; | 1887 | XmlNode perms = null; |
1887 | bool include = false; | 1888 | bool include = false; |
1888 | bool select = false; | 1889 | bool select = false; |
1889 | 1890 | ||
1890 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 1891 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
1891 | IInventoryService iserv = scene.InventoryService; | 1892 | IInventoryService inventoryService = scene.InventoryService; |
1892 | IAssetService aserv = scene.AssetService; | 1893 | IAssetService assetService = scene.AssetService; |
1893 | 1894 | ||
1894 | doc.LoadXml(File.ReadAllText(dafn)); | 1895 | doc.LoadXml(File.ReadAllText(defaultAppearanceFileName)); |
1895 | 1896 | ||
1896 | // Load up any included assets. Duplicates will be ignored | 1897 | // Load up any included assets. Duplicates will be ignored |
1897 | assets = doc.GetElementsByTagName("RequiredAsset"); | 1898 | assets = doc.GetElementsByTagName("RequiredAsset"); |
1898 | foreach (XmlNode asset in assets) | 1899 | foreach (XmlNode assetNode in assets) |
1899 | { | 1900 | { |
1900 | AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset, "name", ""), SByte.Parse(GetStringAttribute(asset, "type", "")), UUID.Zero.ToString()); | 1901 | AssetBase asset = new AssetBase(UUID.Random(), GetStringAttribute(assetNode, "name", ""), SByte.Parse(GetStringAttribute(assetNode, "type", "")), UUID.Zero.ToString()); |
1901 | rass.Description = GetStringAttribute(asset,"desc",""); | 1902 | asset.Description = GetStringAttribute(assetNode,"desc",""); |
1902 | rass.Local = Boolean.Parse(GetStringAttribute(asset,"local","")); | 1903 | asset.Local = Boolean.Parse(GetStringAttribute(assetNode,"local","")); |
1903 | rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary","")); | 1904 | asset.Temporary = Boolean.Parse(GetStringAttribute(assetNode,"temporary","")); |
1904 | rass.Data = Convert.FromBase64String(asset.InnerText); | 1905 | asset.Data = Convert.FromBase64String(assetNode.InnerText); |
1905 | aserv.Store(rass); | 1906 | assetService.Store(asset); |
1906 | } | 1907 | } |
1907 | 1908 | ||
1908 | avatars = doc.GetElementsByTagName("Avatar"); | 1909 | avatars = doc.GetElementsByTagName("Avatar"); |
@@ -1921,19 +1922,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1921 | // Only the name value is mandatory | 1922 | // Only the name value is mandatory |
1922 | name = GetStringAttribute(avatar,"name",name); | 1923 | name = GetStringAttribute(avatar,"name",name); |
1923 | email = GetStringAttribute(avatar,"email",email); | 1924 | email = GetStringAttribute(avatar,"email",email); |
1924 | regX = GetUnsignedAttribute(avatar,"regx",regX); | 1925 | regionXLocation = GetUnsignedAttribute(avatar,"regx",regionXLocation); |
1925 | regY = GetUnsignedAttribute(avatar,"regy",regY); | 1926 | regionYLocation = GetUnsignedAttribute(avatar,"regy",regionYLocation); |
1926 | passwd = GetStringAttribute(avatar,"password",passwd); | 1927 | password = GetStringAttribute(avatar,"password",password); |
1927 | 1928 | ||
1928 | string[] nomens = name.Split(); | 1929 | string[] names = name.Split(); |
1929 | UUID scopeID = scene.RegionInfo.ScopeID; | 1930 | UUID scopeID = scene.RegionInfo.ScopeID; |
1930 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]); | 1931 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, names[0], names[1]); |
1931 | if (null == account) | 1932 | if (null == account) |
1932 | { | 1933 | { |
1933 | account = CreateUser(scopeID, nomens[0], nomens[1], passwd, email); | 1934 | account = CreateUser(scopeID, names[0], names[1], password, email); |
1934 | if (null == account) | 1935 | if (null == account) |
1935 | { | 1936 | { |
1936 | m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]); | 1937 | m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", names[0], names[1]); |
1937 | return false; | 1938 | return false; |
1938 | } | 1939 | } |
1939 | } | 1940 | } |
@@ -1941,12 +1942,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1941 | // Set home position | 1942 | // Set home position |
1942 | 1943 | ||
1943 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, | 1944 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, |
1944 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | 1945 | (int)(regionXLocation * Constants.RegionSize), (int)(regionYLocation * Constants.RegionSize)); |
1945 | if (null == home) { | 1946 | if (null == home) { |
1946 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", nomens[0], nomens[1]); | 1947 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", names[0], names[1]); |
1947 | } else { | 1948 | } else { |
1948 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | 1949 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); |
1949 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, nomens[0], nomens[1]); | 1950 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, names[0], names[1]); |
1950 | } | 1951 | } |
1951 | 1952 | ||
1952 | ID = account.PrincipalID; | 1953 | ID = account.PrincipalID; |
@@ -1968,13 +1969,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1968 | if (include) | 1969 | if (include) |
1969 | { | 1970 | { |
1970 | // Setup for appearance processing | 1971 | // Setup for appearance processing |
1971 | AvatarData adata = scene.AvatarService.GetAvatar(ID); | 1972 | AvatarData avatarData = scene.AvatarService.GetAvatar(ID); |
1972 | if (adata != null) | 1973 | if (avatarData != null) |
1973 | mava = adata.ToAvatarAppearance(ID); | 1974 | avatarAppearance = avatarData.ToAvatarAppearance(ID); |
1974 | else | 1975 | else |
1975 | mava = new AvatarAppearance(); | 1976 | avatarAppearance = new AvatarAppearance(); |
1976 | 1977 | ||
1977 | AvatarWearable[] wearables = mava.Wearables; | 1978 | AvatarWearable[] wearables = avatarAppearance.Wearables; |
1978 | for (int i=0; i<wearables.Length; i++) | 1979 | for (int i=0; i<wearables.Length; i++) |
1979 | { | 1980 | { |
1980 | wearables[i] = new AvatarWearable(); | 1981 | wearables[i] = new AvatarWearable(); |
@@ -1985,19 +1986,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1985 | // m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory", | 1986 | // m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory", |
1986 | // uic.folders.Count, uic.items.Count); | 1987 | // uic.folders.Count, uic.items.Count); |
1987 | 1988 | ||
1988 | InventoryFolderBase cfolder = iserv.GetFolderForType(ID, AssetType.Clothing); | 1989 | InventoryFolderBase clothingFolder = inventoryService.GetFolderForType(ID, AssetType.Clothing); |
1989 | 1990 | ||
1990 | // This should *never* be the case | 1991 | // This should *never* be the case |
1991 | if (cfolder == null || cfolder.Type != (short)AssetType.Clothing) | 1992 | if (clothingFolder == null || clothingFolder.Type != (short)AssetType.Clothing) |
1992 | { | 1993 | { |
1993 | cfolder = new InventoryFolderBase(); | 1994 | clothingFolder = new InventoryFolderBase(); |
1994 | cfolder.ID = UUID.Random(); | 1995 | clothingFolder.ID = UUID.Random(); |
1995 | cfolder.Name = "Clothing"; | 1996 | clothingFolder.Name = "Clothing"; |
1996 | cfolder.Owner = ID; | 1997 | clothingFolder.Owner = ID; |
1997 | cfolder.Type = (short)AssetType.Clothing; | 1998 | clothingFolder.Type = (short)AssetType.Clothing; |
1998 | cfolder.ParentID = iserv.GetRootFolder(ID).ID; | 1999 | clothingFolder.ParentID = inventoryService.GetRootFolder(ID).ID; |
1999 | cfolder.Version = 1; | 2000 | clothingFolder.Version = 1; |
2000 | iserv.AddFolder(cfolder); // store base record | 2001 | inventoryService.AddFolder(clothingFolder); // store base record |
2001 | m_log.ErrorFormat("[RADMIN] Created clothing folder for {0}/{1}", name, ID); | 2002 | m_log.ErrorFormat("[RADMIN] Created clothing folder for {0}/{1}", name, ID); |
2002 | } | 2003 | } |
2003 | 2004 | ||
@@ -2005,8 +2006,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2005 | // default appearance XMl file. | 2006 | // default appearance XMl file. |
2006 | 2007 | ||
2007 | XmlNodeList outfits = avatar.GetElementsByTagName("Ensemble"); | 2008 | XmlNodeList outfits = avatar.GetElementsByTagName("Ensemble"); |
2008 | InventoryFolderBase efolder; | 2009 | InventoryFolderBase extraFolder; |
2009 | string oname; | 2010 | string outfitName; |
2010 | UUID assetid; | 2011 | UUID assetid; |
2011 | 2012 | ||
2012 | foreach (XmlElement outfit in outfits) | 2013 | foreach (XmlElement outfit in outfits) |
@@ -2014,37 +2015,37 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2014 | m_log.DebugFormat("[RADMIN] Loading outfit {0} for {1}", | 2015 | m_log.DebugFormat("[RADMIN] Loading outfit {0} for {1}", |
2015 | GetStringAttribute(outfit,"name","?"), GetStringAttribute(avatar,"name","?")); | 2016 | GetStringAttribute(outfit,"name","?"), GetStringAttribute(avatar,"name","?")); |
2016 | 2017 | ||
2017 | oname = GetStringAttribute(outfit,"name",""); | 2018 | outfitName = GetStringAttribute(outfit,"name",""); |
2018 | select = (GetStringAttribute(outfit,"default","no") == "yes"); | 2019 | select = (GetStringAttribute(outfit,"default","no") == "yes"); |
2019 | 2020 | ||
2020 | // If the folder already exists, re-use it. The defaults may | 2021 | // If the folder already exists, re-use it. The defaults may |
2021 | // change over time. Augment only. | 2022 | // change over time. Augment only. |
2022 | 2023 | ||
2023 | List<InventoryFolderBase> folders = iserv.GetFolderContent(ID, cfolder.ID).Folders; | 2024 | List<InventoryFolderBase> folders = inventoryService.GetFolderContent(ID, clothingFolder.ID).Folders; |
2024 | efolder = null; | 2025 | extraFolder = null; |
2025 | 2026 | ||
2026 | foreach (InventoryFolderBase folder in folders) | 2027 | foreach (InventoryFolderBase folder in folders) |
2027 | { | 2028 | { |
2028 | if (folder.Name == oname) | 2029 | if (folder.Name == outfitName) |
2029 | { | 2030 | { |
2030 | efolder = folder; | 2031 | extraFolder = folder; |
2031 | break; | 2032 | break; |
2032 | } | 2033 | } |
2033 | } | 2034 | } |
2034 | 2035 | ||
2035 | // Otherwise, we must create the folder. | 2036 | // Otherwise, we must create the folder. |
2036 | if (efolder == null) | 2037 | if (extraFolder == null) |
2037 | { | 2038 | { |
2038 | m_log.DebugFormat("[RADMIN] Creating outfit folder {0} for {1}", oname, name); | 2039 | m_log.DebugFormat("[RADMIN] Creating outfit folder {0} for {1}", outfitName, name); |
2039 | efolder = new InventoryFolderBase(); | 2040 | extraFolder = new InventoryFolderBase(); |
2040 | efolder.ID = UUID.Random(); | 2041 | extraFolder.ID = UUID.Random(); |
2041 | efolder.Name = oname; | 2042 | extraFolder.Name = outfitName; |
2042 | efolder.Owner = ID; | 2043 | extraFolder.Owner = ID; |
2043 | efolder.Type = (short)AssetType.Clothing; | 2044 | extraFolder.Type = (short)AssetType.Clothing; |
2044 | efolder.Version = 1; | 2045 | extraFolder.Version = 1; |
2045 | efolder.ParentID = cfolder.ID; | 2046 | extraFolder.ParentID = clothingFolder.ID; |
2046 | iserv.AddFolder(efolder); | 2047 | inventoryService.AddFolder(extraFolder); |
2047 | m_log.DebugFormat("[RADMIN] Adding outfile folder {0} to folder {1}", efolder.ID, cfolder.ID); | 2048 | m_log.DebugFormat("[RADMIN] Adding outfile folder {0} to folder {1}", extraFolder.ID, clothingFolder.ID); |
2048 | } | 2049 | } |
2049 | 2050 | ||
2050 | // Now get the pieces that make up the outfit | 2051 | // Now get the pieces that make up the outfit |
@@ -2068,55 +2069,55 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2068 | } | 2069 | } |
2069 | } | 2070 | } |
2070 | 2071 | ||
2071 | InventoryItemBase iitem = null; | 2072 | InventoryItemBase inventoryItem = null; |
2072 | 2073 | ||
2073 | // Check if asset is in inventory already | 2074 | // Check if asset is in inventory already |
2074 | iitem = null; | 2075 | inventoryItem = null; |
2075 | List<InventoryItemBase> iitems = iserv.GetFolderContent(ID, efolder.ID).Items; | 2076 | List<InventoryItemBase> inventoryItems = inventoryService.GetFolderContent(ID, extraFolder.ID).Items; |
2076 | 2077 | ||
2077 | foreach (InventoryItemBase litem in iitems) | 2078 | foreach (InventoryItemBase listItem in inventoryItems) |
2078 | { | 2079 | { |
2079 | if (litem.AssetID == assetid) | 2080 | if (listItem.AssetID == assetid) |
2080 | { | 2081 | { |
2081 | iitem = litem; | 2082 | inventoryItem = listItem; |
2082 | break; | 2083 | break; |
2083 | } | 2084 | } |
2084 | } | 2085 | } |
2085 | 2086 | ||
2086 | // Create inventory item | 2087 | // Create inventory item |
2087 | if (iitem == null) | 2088 | if (inventoryItem == null) |
2088 | { | 2089 | { |
2089 | iitem = new InventoryItemBase(UUID.Random(), ID); | 2090 | inventoryItem = new InventoryItemBase(UUID.Random(), ID); |
2090 | iitem.Name = GetStringAttribute(item,"name",""); | 2091 | inventoryItem.Name = GetStringAttribute(item,"name",""); |
2091 | iitem.Description = GetStringAttribute(item,"desc",""); | 2092 | inventoryItem.Description = GetStringAttribute(item,"desc",""); |
2092 | iitem.InvType = GetIntegerAttribute(item,"invtype",-1); | 2093 | inventoryItem.InvType = GetIntegerAttribute(item,"invtype",-1); |
2093 | iitem.CreatorId = GetStringAttribute(item,"creatorid",""); | 2094 | inventoryItem.CreatorId = GetStringAttribute(item,"creatorid",""); |
2094 | iitem.CreatorIdAsUuid = (UUID)GetStringAttribute(item,"creatoruuid",""); | 2095 | inventoryItem.CreatorIdAsUuid = (UUID)GetStringAttribute(item,"creatoruuid",""); |
2095 | iitem.NextPermissions = GetUnsignedAttribute(perms,"next",0x7fffffff); | 2096 | inventoryItem.NextPermissions = GetUnsignedAttribute(perms,"next",0x7fffffff); |
2096 | iitem.CurrentPermissions = GetUnsignedAttribute(perms,"current",0x7fffffff); | 2097 | inventoryItem.CurrentPermissions = GetUnsignedAttribute(perms,"current",0x7fffffff); |
2097 | iitem.BasePermissions = GetUnsignedAttribute(perms,"base",0x7fffffff); | 2098 | inventoryItem.BasePermissions = GetUnsignedAttribute(perms,"base",0x7fffffff); |
2098 | iitem.EveryOnePermissions = GetUnsignedAttribute(perms,"everyone",0x7fffffff); | 2099 | inventoryItem.EveryOnePermissions = GetUnsignedAttribute(perms,"everyone",0x7fffffff); |
2099 | iitem.GroupPermissions = GetUnsignedAttribute(perms,"group",0x7fffffff); | 2100 | inventoryItem.GroupPermissions = GetUnsignedAttribute(perms,"group",0x7fffffff); |
2100 | iitem.AssetType = GetIntegerAttribute(item,"assettype",-1); | 2101 | inventoryItem.AssetType = GetIntegerAttribute(item,"assettype",-1); |
2101 | iitem.AssetID = assetid; // associated asset | 2102 | inventoryItem.AssetID = assetid; // associated asset |
2102 | iitem.GroupID = (UUID)GetStringAttribute(item,"groupid",""); | 2103 | inventoryItem.GroupID = (UUID)GetStringAttribute(item,"groupid",""); |
2103 | iitem.GroupOwned = (GetStringAttribute(item,"groupowned","false") == "true"); | 2104 | inventoryItem.GroupOwned = (GetStringAttribute(item,"groupowned","false") == "true"); |
2104 | iitem.SalePrice = GetIntegerAttribute(item,"saleprice",0); | 2105 | inventoryItem.SalePrice = GetIntegerAttribute(item,"saleprice",0); |
2105 | iitem.SaleType = (byte)GetIntegerAttribute(item,"saletype",0); | 2106 | inventoryItem.SaleType = (byte)GetIntegerAttribute(item,"saletype",0); |
2106 | iitem.Flags = GetUnsignedAttribute(item,"flags",0); | 2107 | inventoryItem.Flags = GetUnsignedAttribute(item,"flags",0); |
2107 | iitem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); | 2108 | inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); |
2108 | iitem.Folder = efolder.ID; // Parent folder | 2109 | inventoryItem.Folder = extraFolder.ID; // Parent folder |
2109 | 2110 | ||
2110 | iserv.AddItem(iitem); | 2111 | inventoryService.AddItem(inventoryItem); |
2111 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", iitem.ID, efolder.ID); | 2112 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID); |
2112 | } | 2113 | } |
2113 | 2114 | ||
2114 | // Attach item, if attachpoint is specified | 2115 | // Attach item, if attachpoint is specified |
2115 | int attachpoint = GetIntegerAttribute(item,"attachpoint",0); | 2116 | int attachpoint = GetIntegerAttribute(item,"attachpoint",0); |
2116 | if (attachpoint != 0) | 2117 | if (attachpoint != 0) |
2117 | { | 2118 | { |
2118 | mava.SetAttachment(attachpoint, iitem.ID, iitem.AssetID); | 2119 | avatarAppearance.SetAttachment(attachpoint, inventoryItem.ID, inventoryItem.AssetID); |
2119 | m_log.DebugFormat("[RADMIN] Attached {0}", iitem.ID); | 2120 | m_log.DebugFormat("[RADMIN] Attached {0}", inventoryItem.ID); |
2120 | } | 2121 | } |
2121 | 2122 | ||
2122 | // Record whether or not the item is to be initially worn | 2123 | // Record whether or not the item is to be initially worn |
@@ -2124,20 +2125,20 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2124 | { | 2125 | { |
2125 | if (select && (GetStringAttribute(item, "wear", "false") == "true")) | 2126 | if (select && (GetStringAttribute(item, "wear", "false") == "true")) |
2126 | { | 2127 | { |
2127 | mava.Wearables[iitem.Flags].ItemID = iitem.ID; | 2128 | avatarAppearance.Wearables[inventoryItem.Flags].ItemID = inventoryItem.ID; |
2128 | mava.Wearables[iitem.Flags].AssetID = iitem.AssetID; | 2129 | avatarAppearance.Wearables[inventoryItem.Flags].AssetID = inventoryItem.AssetID; |
2129 | } | 2130 | } |
2130 | } | 2131 | } |
2131 | catch (Exception e) | 2132 | catch (Exception e) |
2132 | { | 2133 | { |
2133 | m_log.WarnFormat("[RADMIN] Error wearing item {0} : {1}", iitem.ID, e.Message); | 2134 | m_log.WarnFormat("[RADMIN] Error wearing item {0} : {1}", inventoryItem.ID, e.Message); |
2134 | } | 2135 | } |
2135 | } // foreach item in outfit | 2136 | } // foreach item in outfit |
2136 | m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname); | 2137 | m_log.DebugFormat("[RADMIN] Outfit {0} load completed", outfitName); |
2137 | } // foreach outfit | 2138 | } // foreach outfit |
2138 | m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); | 2139 | m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); |
2139 | AvatarData adata2 = new AvatarData(mava); | 2140 | AvatarData avatarData2 = new AvatarData(avatarAppearance); |
2140 | scene.AvatarService.SetAvatar(ID, adata2); | 2141 | scene.AvatarService.SetAvatar(ID, avatarData2); |
2141 | } | 2142 | } |
2142 | catch (Exception e) | 2143 | catch (Exception e) |
2143 | { | 2144 | { |
@@ -2204,19 +2205,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2204 | XmlRpcResponse response = new XmlRpcResponse(); | 2205 | XmlRpcResponse response = new XmlRpcResponse(); |
2205 | Hashtable responseData = new Hashtable(); | 2206 | Hashtable responseData = new Hashtable(); |
2206 | 2207 | ||
2207 | lock (rslock) | 2208 | lock (m_requestLock) |
2208 | { | 2209 | { |
2209 | try | 2210 | try |
2210 | { | 2211 | { |
2211 | Hashtable requestData = (Hashtable) request.Params[0]; | 2212 | Hashtable requestData = (Hashtable) request.Params[0]; |
2212 | 2213 | ||
2213 | // check completeness | 2214 | // check completeness |
2214 | foreach (string p in new string[] {"password", "filename"}) | 2215 | foreach (string parameter in new string[] {"password", "filename"}) |
2215 | { | 2216 | { |
2216 | if (!requestData.Contains(p)) | 2217 | if (!requestData.Contains(parameter)) |
2217 | throw new Exception(String.Format("missing parameter {0}", p)); | 2218 | throw new Exception(String.Format("missing parameter {0}", parameter)); |
2218 | if (String.IsNullOrEmpty((string) requestData[p])) | 2219 | if (String.IsNullOrEmpty((string) requestData[parameter])) |
2219 | throw new Exception(String.Format("parameter {0} is empty")); | 2220 | throw new Exception(String.Format("parameter {0} is empty", parameter)); |
2220 | } | 2221 | } |
2221 | 2222 | ||
2222 | // check password | 2223 | // check password |
@@ -2228,13 +2229,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2228 | if (requestData.Contains("region_uuid")) | 2229 | if (requestData.Contains("region_uuid")) |
2229 | { | 2230 | { |
2230 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2231 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2231 | if (!m_app.SceneManager.TryGetScene(region_uuid, out scene)) | 2232 | if (!m_application.SceneManager.TryGetScene(region_uuid, out scene)) |
2232 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2233 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2233 | } | 2234 | } |
2234 | else if (requestData.Contains("region_name")) | 2235 | else if (requestData.Contains("region_name")) |
2235 | { | 2236 | { |
2236 | string region_name = (string) requestData["region_name"]; | 2237 | string region_name = (string) requestData["region_name"]; |
2237 | if (!m_app.SceneManager.TryGetScene(region_name, out scene)) | 2238 | if (!m_application.SceneManager.TryGetScene(region_name, out scene)) |
2238 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2239 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2239 | } | 2240 | } |
2240 | else throw new Exception("neither region_name nor region_uuid given"); | 2241 | else throw new Exception("neither region_name nor region_uuid given"); |
@@ -2328,13 +2329,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2328 | if (requestData.Contains("region_uuid")) | 2329 | if (requestData.Contains("region_uuid")) |
2329 | { | 2330 | { |
2330 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2331 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2331 | if (!m_app.SceneManager.TryGetScene(region_uuid, out scene)) | 2332 | if (!m_application.SceneManager.TryGetScene(region_uuid, out scene)) |
2332 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2333 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2333 | } | 2334 | } |
2334 | else if (requestData.Contains("region_name")) | 2335 | else if (requestData.Contains("region_name")) |
2335 | { | 2336 | { |
2336 | string region_name = (string) requestData["region_name"]; | 2337 | string region_name = (string) requestData["region_name"]; |
2337 | if (!m_app.SceneManager.TryGetScene(region_name, out scene)) | 2338 | if (!m_application.SceneManager.TryGetScene(region_name, out scene)) |
2338 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2339 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2339 | } | 2340 | } |
2340 | else throw new Exception("neither region_name nor region_uuid given"); | 2341 | else throw new Exception("neither region_name nor region_uuid given"); |
@@ -2345,7 +2346,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2345 | { | 2346 | { |
2346 | scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted; | 2347 | scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted; |
2347 | archiver.ArchiveRegion(filename); | 2348 | archiver.ArchiveRegion(filename); |
2348 | lock (SOLock) Monitor.Wait(SOLock,5000); | 2349 | lock (m_saveOarLock) Monitor.Wait(m_saveOarLock,5000); |
2349 | scene.EventManager.OnOarFileSaved -= RemoteAdminOarSaveCompleted; | 2350 | scene.EventManager.OnOarFileSaved -= RemoteAdminOarSaveCompleted; |
2350 | } | 2351 | } |
2351 | else | 2352 | else |
@@ -2373,7 +2374,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2373 | private void RemoteAdminOarSaveCompleted(Guid uuid, string name) | 2374 | private void RemoteAdminOarSaveCompleted(Guid uuid, string name) |
2374 | { | 2375 | { |
2375 | m_log.DebugFormat("[RADMIN] File processing complete for {0}", name); | 2376 | m_log.DebugFormat("[RADMIN] File processing complete for {0}", name); |
2376 | lock (SOLock) Monitor.Pulse(SOLock); | 2377 | lock (m_saveOarLock) Monitor.Pulse(m_saveOarLock); |
2377 | } | 2378 | } |
2378 | 2379 | ||
2379 | public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 2380 | public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
@@ -2385,7 +2386,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2385 | XmlRpcResponse response = new XmlRpcResponse(); | 2386 | XmlRpcResponse response = new XmlRpcResponse(); |
2386 | Hashtable responseData = new Hashtable(); | 2387 | Hashtable responseData = new Hashtable(); |
2387 | 2388 | ||
2388 | lock (rslock) | 2389 | lock (m_requestLock) |
2389 | { | 2390 | { |
2390 | try | 2391 | try |
2391 | { | 2392 | { |
@@ -2408,14 +2409,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2408 | if (requestData.Contains("region_uuid")) | 2409 | if (requestData.Contains("region_uuid")) |
2409 | { | 2410 | { |
2410 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2411 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2411 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2412 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2412 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2413 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2413 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2414 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2414 | } | 2415 | } |
2415 | else if (requestData.Contains("region_name")) | 2416 | else if (requestData.Contains("region_name")) |
2416 | { | 2417 | { |
2417 | string region_name = (string) requestData["region_name"]; | 2418 | string region_name = (string) requestData["region_name"]; |
2418 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2419 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2419 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2420 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2420 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2421 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2421 | } | 2422 | } |
@@ -2432,11 +2433,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2432 | switch (xml_version) | 2433 | switch (xml_version) |
2433 | { | 2434 | { |
2434 | case "1": | 2435 | case "1": |
2435 | m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new Vector3(0, 0, 0)); | 2436 | m_application.SceneManager.LoadCurrentSceneFromXml(filename, true, new Vector3(0, 0, 0)); |
2436 | break; | 2437 | break; |
2437 | 2438 | ||
2438 | case "2": | 2439 | case "2": |
2439 | m_app.SceneManager.LoadCurrentSceneFromXml2(filename); | 2440 | m_application.SceneManager.LoadCurrentSceneFromXml2(filename); |
2440 | break; | 2441 | break; |
2441 | 2442 | ||
2442 | default: | 2443 | default: |
@@ -2493,14 +2494,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2493 | if (requestData.Contains("region_uuid")) | 2494 | if (requestData.Contains("region_uuid")) |
2494 | { | 2495 | { |
2495 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2496 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2496 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2497 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2497 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2498 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2498 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2499 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2499 | } | 2500 | } |
2500 | else if (requestData.Contains("region_name")) | 2501 | else if (requestData.Contains("region_name")) |
2501 | { | 2502 | { |
2502 | string region_name = (string) requestData["region_name"]; | 2503 | string region_name = (string) requestData["region_name"]; |
2503 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2504 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2504 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2505 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2505 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2506 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2506 | } | 2507 | } |
@@ -2517,11 +2518,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2517 | switch (xml_version) | 2518 | switch (xml_version) |
2518 | { | 2519 | { |
2519 | case "1": | 2520 | case "1": |
2520 | m_app.SceneManager.SaveCurrentSceneToXml(filename); | 2521 | m_application.SceneManager.SaveCurrentSceneToXml(filename); |
2521 | break; | 2522 | break; |
2522 | 2523 | ||
2523 | case "2": | 2524 | case "2": |
2524 | m_app.SceneManager.SaveCurrentSceneToXml2(filename); | 2525 | m_application.SceneManager.SaveCurrentSceneToXml2(filename); |
2525 | break; | 2526 | break; |
2526 | 2527 | ||
2527 | default: | 2528 | default: |
@@ -2572,21 +2573,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2572 | if (requestData.Contains("region_uuid")) | 2573 | if (requestData.Contains("region_uuid")) |
2573 | { | 2574 | { |
2574 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2575 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2575 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2576 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2576 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2577 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2577 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2578 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2578 | } | 2579 | } |
2579 | else if (requestData.Contains("region_name")) | 2580 | else if (requestData.Contains("region_name")) |
2580 | { | 2581 | { |
2581 | string region_name = (string) requestData["region_name"]; | 2582 | string region_name = (string) requestData["region_name"]; |
2582 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2583 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2583 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2584 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2584 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2585 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2585 | } | 2586 | } |
2586 | else throw new Exception("neither region_name nor region_uuid given"); | 2587 | else throw new Exception("neither region_name nor region_uuid given"); |
2587 | 2588 | ||
2588 | Scene s = m_app.SceneManager.CurrentScene; | 2589 | Scene scene = m_application.SceneManager.CurrentScene; |
2589 | int health = s.GetHealth(); | 2590 | int health = scene.GetHealth(); |
2590 | responseData["health"] = health; | 2591 | responseData["health"] = health; |
2591 | 2592 | ||
2592 | response.Value = responseData; | 2593 | response.Value = responseData; |
@@ -2669,23 +2670,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2669 | if (requestData.Contains("region_uuid")) | 2670 | if (requestData.Contains("region_uuid")) |
2670 | { | 2671 | { |
2671 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2672 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2672 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2673 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2673 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2674 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2674 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2675 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2675 | } | 2676 | } |
2676 | else if (requestData.Contains("region_name")) | 2677 | else if (requestData.Contains("region_name")) |
2677 | { | 2678 | { |
2678 | string region_name = (string) requestData["region_name"]; | 2679 | string region_name = (string) requestData["region_name"]; |
2679 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2680 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2680 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2681 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2681 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2682 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2682 | } | 2683 | } |
2683 | else throw new Exception("neither region_name nor region_uuid given"); | 2684 | else throw new Exception("neither region_name nor region_uuid given"); |
2684 | 2685 | ||
2685 | Scene s = m_app.SceneManager.CurrentScene; | 2686 | Scene scene = m_application.SceneManager.CurrentScene; |
2686 | s.RegionInfo.EstateSettings.EstateAccess = new UUID[]{}; | 2687 | scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{}; |
2687 | if (s.RegionInfo.Persistent) | 2688 | if (scene.RegionInfo.Persistent) |
2688 | s.RegionInfo.EstateSettings.Save(); | 2689 | scene.RegionInfo.EstateSettings.Save(); |
2689 | } | 2690 | } |
2690 | catch (Exception e) | 2691 | catch (Exception e) |
2691 | { | 2692 | { |
@@ -2726,26 +2727,26 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2726 | if (requestData.Contains("region_uuid")) | 2727 | if (requestData.Contains("region_uuid")) |
2727 | { | 2728 | { |
2728 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2729 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2729 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2730 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2730 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2731 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2731 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2732 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2732 | } | 2733 | } |
2733 | else if (requestData.Contains("region_name")) | 2734 | else if (requestData.Contains("region_name")) |
2734 | { | 2735 | { |
2735 | string region_name = (string) requestData["region_name"]; | 2736 | string region_name = (string) requestData["region_name"]; |
2736 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2737 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2737 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2738 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2738 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2739 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2739 | } | 2740 | } |
2740 | else throw new Exception("neither region_name nor region_uuid given"); | 2741 | else throw new Exception("neither region_name nor region_uuid given"); |
2741 | 2742 | ||
2742 | int addk = 0; | 2743 | int addedUsers = 0; |
2743 | 2744 | ||
2744 | if (requestData.Contains("users")) | 2745 | if (requestData.Contains("users")) |
2745 | { | 2746 | { |
2746 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 2747 | UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
2747 | IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService; | 2748 | IUserAccountService userService = m_application.SceneManager.CurrentOrFirstScene.UserAccountService; |
2748 | Scene s = m_app.SceneManager.CurrentScene; | 2749 | Scene scene = m_application.SceneManager.CurrentScene; |
2749 | Hashtable users = (Hashtable) requestData["users"]; | 2750 | Hashtable users = (Hashtable) requestData["users"]; |
2750 | List<UUID> uuids = new List<UUID>(); | 2751 | List<UUID> uuids = new List<UUID>(); |
2751 | foreach (string name in users.Values) | 2752 | foreach (string name in users.Values) |
@@ -2755,24 +2756,24 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2755 | if (account != null) | 2756 | if (account != null) |
2756 | { | 2757 | { |
2757 | uuids.Add(account.PrincipalID); | 2758 | uuids.Add(account.PrincipalID); |
2758 | m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName); | 2759 | m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, scene.RegionInfo.RegionName); |
2759 | } | 2760 | } |
2760 | } | 2761 | } |
2761 | List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); | 2762 | List<UUID> accessControlList = new List<UUID>(scene.RegionInfo.EstateSettings.EstateAccess); |
2762 | foreach (UUID uuid in uuids) | 2763 | foreach (UUID uuid in uuids) |
2763 | { | 2764 | { |
2764 | if (!acl.Contains(uuid)) | 2765 | if (!accessControlList.Contains(uuid)) |
2765 | { | 2766 | { |
2766 | acl.Add(uuid); | 2767 | accessControlList.Add(uuid); |
2767 | addk++; | 2768 | addedUsers++; |
2768 | } | 2769 | } |
2769 | } | 2770 | } |
2770 | s.RegionInfo.EstateSettings.EstateAccess = acl.ToArray(); | 2771 | scene.RegionInfo.EstateSettings.EstateAccess = accessControlList.ToArray(); |
2771 | if (s.RegionInfo.Persistent) | 2772 | if (scene.RegionInfo.Persistent) |
2772 | s.RegionInfo.EstateSettings.Save(); | 2773 | scene.RegionInfo.EstateSettings.Save(); |
2773 | } | 2774 | } |
2774 | 2775 | ||
2775 | responseData["added"] = addk; | 2776 | responseData["added"] = addedUsers; |
2776 | } | 2777 | } |
2777 | catch (Exception e) | 2778 | catch (Exception e) |
2778 | { | 2779 | { |
@@ -2813,27 +2814,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2813 | if (requestData.Contains("region_uuid")) | 2814 | if (requestData.Contains("region_uuid")) |
2814 | { | 2815 | { |
2815 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2816 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2816 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2817 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2817 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2818 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2818 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2819 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2819 | } | 2820 | } |
2820 | else if (requestData.Contains("region_name")) | 2821 | else if (requestData.Contains("region_name")) |
2821 | { | 2822 | { |
2822 | string region_name = (string) requestData["region_name"]; | 2823 | string region_name = (string) requestData["region_name"]; |
2823 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2824 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2824 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2825 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2825 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2826 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2826 | } | 2827 | } |
2827 | else throw new Exception("neither region_name nor region_uuid given"); | 2828 | else throw new Exception("neither region_name nor region_uuid given"); |
2828 | 2829 | ||
2829 | int remk = 0; | 2830 | int removedUsers = 0; |
2830 | 2831 | ||
2831 | if (requestData.Contains("users")) | 2832 | if (requestData.Contains("users")) |
2832 | { | 2833 | { |
2833 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 2834 | UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
2834 | IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService; | 2835 | IUserAccountService userService = m_application.SceneManager.CurrentOrFirstScene.UserAccountService; |
2835 | //UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; | 2836 | //UserProfileCacheService ups = m_application.CommunicationsManager.UserProfileCacheService; |
2836 | Scene s = m_app.SceneManager.CurrentScene; | 2837 | Scene scene = m_application.SceneManager.CurrentScene; |
2837 | Hashtable users = (Hashtable) requestData["users"]; | 2838 | Hashtable users = (Hashtable) requestData["users"]; |
2838 | List<UUID> uuids = new List<UUID>(); | 2839 | List<UUID> uuids = new List<UUID>(); |
2839 | foreach (string name in users.Values) | 2840 | foreach (string name in users.Values) |
@@ -2845,21 +2846,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2845 | uuids.Add(account.PrincipalID); | 2846 | uuids.Add(account.PrincipalID); |
2846 | } | 2847 | } |
2847 | } | 2848 | } |
2848 | List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); | 2849 | List<UUID> accessControlList = new List<UUID>(scene.RegionInfo.EstateSettings.EstateAccess); |
2849 | foreach (UUID uuid in uuids) | 2850 | foreach (UUID uuid in uuids) |
2850 | { | 2851 | { |
2851 | if (acl.Contains(uuid)) | 2852 | if (accessControlList.Contains(uuid)) |
2852 | { | 2853 | { |
2853 | acl.Remove(uuid); | 2854 | accessControlList.Remove(uuid); |
2854 | remk++; | 2855 | removedUsers++; |
2855 | } | 2856 | } |
2856 | } | 2857 | } |
2857 | s.RegionInfo.EstateSettings.EstateAccess = acl.ToArray(); | 2858 | scene.RegionInfo.EstateSettings.EstateAccess = accessControlList.ToArray(); |
2858 | if (s.RegionInfo.Persistent) | 2859 | if (scene.RegionInfo.Persistent) |
2859 | s.RegionInfo.EstateSettings.Save(); | 2860 | scene.RegionInfo.EstateSettings.Save(); |
2860 | } | 2861 | } |
2861 | 2862 | ||
2862 | responseData["removed"] = remk; | 2863 | responseData["removed"] = removedUsers; |
2863 | } | 2864 | } |
2864 | catch (Exception e) | 2865 | catch (Exception e) |
2865 | { | 2866 | { |
@@ -2900,27 +2901,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2900 | if (requestData.Contains("region_uuid")) | 2901 | if (requestData.Contains("region_uuid")) |
2901 | { | 2902 | { |
2902 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2903 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2903 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2904 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2904 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2905 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2905 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2906 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2906 | } | 2907 | } |
2907 | else if (requestData.Contains("region_name")) | 2908 | else if (requestData.Contains("region_name")) |
2908 | { | 2909 | { |
2909 | string region_name = (string) requestData["region_name"]; | 2910 | string region_name = (string) requestData["region_name"]; |
2910 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2911 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2911 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2912 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2912 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2913 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2913 | } | 2914 | } |
2914 | else throw new Exception("neither region_name nor region_uuid given"); | 2915 | else throw new Exception("neither region_name nor region_uuid given"); |
2915 | 2916 | ||
2916 | Scene s = m_app.SceneManager.CurrentScene; | 2917 | Scene scene = m_application.SceneManager.CurrentScene; |
2917 | UUID[] acl = s.RegionInfo.EstateSettings.EstateAccess; | 2918 | UUID[] accessControlList = scene.RegionInfo.EstateSettings.EstateAccess; |
2918 | Hashtable users = new Hashtable(); | 2919 | Hashtable users = new Hashtable(); |
2919 | 2920 | ||
2920 | foreach (UUID user in acl) | 2921 | foreach (UUID user in accessControlList) |
2921 | { | 2922 | { |
2922 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 2923 | UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
2923 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user); | 2924 | UserAccount account = m_application.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user); |
2924 | if (account != null) | 2925 | if (account != null) |
2925 | { | 2926 | { |
2926 | users[user.ToString()] = account.FirstName + " " + account.LastName; | 2927 | users[user.ToString()] = account.FirstName + " " + account.LastName; |
@@ -2945,29 +2946,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2945 | return response; | 2946 | return response; |
2946 | } | 2947 | } |
2947 | 2948 | ||
2948 | private static void checkStringParameters(XmlRpcRequest request, string[] param) | 2949 | private static void CheckStringParameters(XmlRpcRequest request, string[] param) |
2949 | { | 2950 | { |
2950 | Hashtable requestData = (Hashtable) request.Params[0]; | 2951 | Hashtable requestData = (Hashtable) request.Params[0]; |
2951 | foreach (string p in param) | 2952 | foreach (string parameter in param) |
2952 | { | 2953 | { |
2953 | if (!requestData.Contains(p)) | 2954 | if (!requestData.Contains(parameter)) |
2954 | throw new Exception(String.Format("missing string parameter {0}", p)); | 2955 | throw new Exception(String.Format("missing string parameter {0}", parameter)); |
2955 | if (String.IsNullOrEmpty((string) requestData[p])) | 2956 | if (String.IsNullOrEmpty((string) requestData[parameter])) |
2956 | throw new Exception(String.Format("parameter {0} is empty", p)); | 2957 | throw new Exception(String.Format("parameter {0} is empty", parameter)); |
2957 | } | 2958 | } |
2958 | } | 2959 | } |
2959 | 2960 | ||
2960 | private static void checkIntegerParams(XmlRpcRequest request, string[] param) | 2961 | private static void CheckIntegerParams(XmlRpcRequest request, string[] param) |
2961 | { | 2962 | { |
2962 | Hashtable requestData = (Hashtable) request.Params[0]; | 2963 | Hashtable requestData = (Hashtable) request.Params[0]; |
2963 | foreach (string p in param) | 2964 | foreach (string parameter in param) |
2964 | { | 2965 | { |
2965 | if (!requestData.Contains(p)) | 2966 | if (!requestData.Contains(parameter)) |
2966 | throw new Exception(String.Format("missing integer parameter {0}", p)); | 2967 | throw new Exception(String.Format("missing integer parameter {0}", parameter)); |
2967 | } | 2968 | } |
2968 | } | 2969 | } |
2969 | 2970 | ||
2970 | private bool getBoolean(Hashtable requestData, string tag, bool defv) | 2971 | private bool GetBoolean(Hashtable requestData, string tag, bool defaultValue) |
2971 | { | 2972 | { |
2972 | // If an access value has been provided, apply it. | 2973 | // If an access value has been provided, apply it. |
2973 | if (requestData.Contains(tag)) | 2974 | if (requestData.Contains(tag)) |
@@ -2983,29 +2984,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2983 | case "0" : | 2984 | case "0" : |
2984 | return false; | 2985 | return false; |
2985 | default : | 2986 | default : |
2986 | return defv; | 2987 | return defaultValue; |
2987 | } | 2988 | } |
2988 | } | 2989 | } |
2989 | else | 2990 | else |
2990 | return defv; | 2991 | return defaultValue; |
2991 | } | 2992 | } |
2992 | 2993 | ||
2993 | private int GetIntegerAttribute(XmlNode node, string attr, int dv) | 2994 | private int GetIntegerAttribute(XmlNode node, string attribute, int defaultValue) |
2994 | { | 2995 | { |
2995 | try { return Convert.ToInt32(node.Attributes[attr].Value); } catch{} | 2996 | try { return Convert.ToInt32(node.Attributes[attribute].Value); } catch{} |
2996 | return dv; | 2997 | return defaultValue; |
2997 | } | 2998 | } |
2998 | 2999 | ||
2999 | private uint GetUnsignedAttribute(XmlNode node, string attr, uint dv) | 3000 | private uint GetUnsignedAttribute(XmlNode node, string attribute, uint defaultValue) |
3000 | { | 3001 | { |
3001 | try { return Convert.ToUInt32(node.Attributes[attr].Value); } catch{} | 3002 | try { return Convert.ToUInt32(node.Attributes[attribute].Value); } catch{} |
3002 | return dv; | 3003 | return defaultValue; |
3003 | } | 3004 | } |
3004 | 3005 | ||
3005 | private string GetStringAttribute(XmlNode node, string attr, string dv) | 3006 | private string GetStringAttribute(XmlNode node, string attribute, string defaultValue) |
3006 | { | 3007 | { |
3007 | try { return node.Attributes[attr].Value; } catch{} | 3008 | try { return node.Attributes[attribute].Value; } catch{} |
3008 | return dv; | 3009 | return defaultValue; |
3009 | } | 3010 | } |
3010 | 3011 | ||
3011 | public void Dispose() | 3012 | public void Dispose() |
@@ -3022,14 +3023,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
3022 | /// <param name="email"></param> | 3023 | /// <param name="email"></param> |
3023 | private UserAccount CreateUser(UUID scopeID, string firstName, string lastName, string password, string email) | 3024 | private UserAccount CreateUser(UUID scopeID, string firstName, string lastName, string password, string email) |
3024 | { | 3025 | { |
3025 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 3026 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
3026 | IUserAccountService m_UserAccountService = scene.UserAccountService; | 3027 | IUserAccountService userAccountService = scene.UserAccountService; |
3027 | IGridService m_GridService = scene.GridService; | 3028 | IGridService gridService = scene.GridService; |
3028 | IAuthenticationService m_AuthenticationService = scene.AuthenticationService; | 3029 | IAuthenticationService authenticationService = scene.AuthenticationService; |
3029 | IGridUserService m_GridUserService = scene.GridUserService; | 3030 | IGridUserService gridUserService = scene.GridUserService; |
3030 | IInventoryService m_InventoryService = scene.InventoryService; | 3031 | IInventoryService inventoryService = scene.InventoryService; |
3031 | 3032 | ||
3032 | UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName); | 3033 | UserAccount account = userAccountService.GetUserAccount(scopeID, firstName, lastName); |
3033 | if (null == account) | 3034 | if (null == account) |
3034 | { | 3035 | { |
3035 | account = new UserAccount(scopeID, firstName, lastName, email); | 3036 | account = new UserAccount(scopeID, firstName, lastName, email); |
@@ -3042,26 +3043,26 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
3042 | account.ServiceURLs["AssetServerURI"] = string.Empty; | 3043 | account.ServiceURLs["AssetServerURI"] = string.Empty; |
3043 | } | 3044 | } |
3044 | 3045 | ||
3045 | if (m_UserAccountService.StoreUserAccount(account)) | 3046 | if (userAccountService.StoreUserAccount(account)) |
3046 | { | 3047 | { |
3047 | bool success; | 3048 | bool success; |
3048 | if (m_AuthenticationService != null) | 3049 | if (authenticationService != null) |
3049 | { | 3050 | { |
3050 | success = m_AuthenticationService.SetPassword(account.PrincipalID, password); | 3051 | success = authenticationService.SetPassword(account.PrincipalID, password); |
3051 | if (!success) | 3052 | if (!success) |
3052 | m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", | 3053 | m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", |
3053 | firstName, lastName); | 3054 | firstName, lastName); |
3054 | } | 3055 | } |
3055 | 3056 | ||
3056 | GridRegion home = null; | 3057 | GridRegion home = null; |
3057 | if (m_GridService != null) | 3058 | if (gridService != null) |
3058 | { | 3059 | { |
3059 | List<GridRegion> defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero); | 3060 | List<GridRegion> defaultRegions = gridService.GetDefaultRegions(UUID.Zero); |
3060 | if (defaultRegions != null && defaultRegions.Count >= 1) | 3061 | if (defaultRegions != null && defaultRegions.Count >= 1) |
3061 | home = defaultRegions[0]; | 3062 | home = defaultRegions[0]; |
3062 | 3063 | ||
3063 | if (m_GridUserService != null && home != null) | 3064 | if (gridUserService != null && home != null) |
3064 | m_GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | 3065 | gridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); |
3065 | else | 3066 | else |
3066 | m_log.WarnFormat("[RADMIN]: Unable to set home for account {0} {1}.", | 3067 | m_log.WarnFormat("[RADMIN]: Unable to set home for account {0} {1}.", |
3067 | firstName, lastName); | 3068 | firstName, lastName); |
@@ -3070,9 +3071,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
3070 | m_log.WarnFormat("[RADMIN]: Unable to retrieve home region for account {0} {1}.", | 3071 | m_log.WarnFormat("[RADMIN]: Unable to retrieve home region for account {0} {1}.", |
3071 | firstName, lastName); | 3072 | firstName, lastName); |
3072 | 3073 | ||
3073 | if (m_InventoryService != null) | 3074 | if (inventoryService != null) |
3074 | { | 3075 | { |
3075 | success = m_InventoryService.CreateUserInventory(account.PrincipalID); | 3076 | success = inventoryService.CreateUserInventory(account.PrincipalID); |
3076 | if (!success) | 3077 | if (!success) |
3077 | m_log.WarnFormat("[RADMIN]: Unable to create inventory for account {0} {1}.", | 3078 | m_log.WarnFormat("[RADMIN]: Unable to create inventory for account {0} {1}.", |
3078 | firstName, lastName); | 3079 | firstName, lastName); |
@@ -3099,16 +3100,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
3099 | /// <param name="password"></param> | 3100 | /// <param name="password"></param> |
3100 | private bool ChangeUserPassword(string firstName, string lastName, string password) | 3101 | private bool ChangeUserPassword(string firstName, string lastName, string password) |
3101 | { | 3102 | { |
3102 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 3103 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
3103 | IUserAccountService m_UserAccountService = scene.UserAccountService; | 3104 | IUserAccountService userAccountService = scene.UserAccountService; |
3104 | IAuthenticationService m_AuthenticationService = scene.AuthenticationService; | 3105 | IAuthenticationService authenticationService = scene.AuthenticationService; |
3105 | 3106 | ||
3106 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName); | 3107 | UserAccount account = userAccountService.GetUserAccount(UUID.Zero, firstName, lastName); |
3107 | if (null != account) | 3108 | if (null != account) |
3108 | { | 3109 | { |
3109 | bool success = false; | 3110 | bool success = false; |
3110 | if (m_AuthenticationService != null) | 3111 | if (authenticationService != null) |
3111 | success = m_AuthenticationService.SetPassword(account.PrincipalID, password); | 3112 | success = authenticationService.SetPassword(account.PrincipalID, password); |
3112 | if (!success) { | 3113 | if (!success) { |
3113 | m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", | 3114 | m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", |
3114 | firstName, lastName); | 3115 | firstName, lastName); |