diff options
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 945 |
1 files changed, 473 insertions, 472 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index db662e1..7e4a8e8 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; |
@@ -160,14 +160,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
160 | { | 160 | { |
161 | foreach (string method in availableMethods.Keys) | 161 | foreach (string method in availableMethods.Keys) |
162 | { | 162 | { |
163 | m_httpd.AddXmlRPCHandler(method, availableMethods[method], false); | 163 | m_httpServer.AddXmlRPCHandler(method, availableMethods[method], false); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | else | 166 | else |
167 | { | 167 | { |
168 | foreach (string enabledMethod in enabledMethods.Split('|')) | 168 | foreach (string enabledMethod in enabledMethods.Split('|')) |
169 | { | 169 | { |
170 | m_httpd.AddXmlRPCHandler(enabledMethod, availableMethods[enabledMethod]); | 170 | m_httpServer.AddXmlRPCHandler(enabledMethod, availableMethods[enabledMethod]); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | } | 173 | } |
@@ -180,7 +180,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
180 | 180 | ||
181 | public void PostInitialise() | 181 | public void PostInitialise() |
182 | { | 182 | { |
183 | if (!createDefaultAvatars()) | 183 | if (!CreateDefaultAvatars()) |
184 | { | 184 | { |
185 | m_log.Info("[RADMIN]: Default avatars not loaded"); | 185 | m_log.Info("[RADMIN]: Default avatars not loaded"); |
186 | } | 186 | } |
@@ -212,7 +212,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
212 | 212 | ||
213 | Scene rebootedScene; | 213 | Scene rebootedScene; |
214 | 214 | ||
215 | if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) | 215 | if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene)) |
216 | throw new Exception("region not found"); | 216 | throw new Exception("region not found"); |
217 | 217 | ||
218 | responseData["rebooting"] = true; | 218 | responseData["rebooting"] = true; |
@@ -258,7 +258,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
258 | responseData["success"] = true; | 258 | responseData["success"] = true; |
259 | response.Value = responseData; | 259 | response.Value = responseData; |
260 | 260 | ||
261 | m_app.SceneManager.ForEachScene( | 261 | m_application.SceneManager.ForEachScene( |
262 | delegate(Scene scene) | 262 | delegate(Scene scene) |
263 | { | 263 | { |
264 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 264 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
@@ -313,7 +313,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
313 | 313 | ||
314 | Scene region = null; | 314 | Scene region = null; |
315 | 315 | ||
316 | if (!m_app.SceneManager.TryGetScene(regionID, out region)) | 316 | if (!m_application.SceneManager.TryGetScene(regionID, out region)) |
317 | throw new Exception("1: unable to get a scene with that name"); | 317 | throw new Exception("1: unable to get a scene with that name"); |
318 | 318 | ||
319 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); | 319 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); |
@@ -387,7 +387,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
387 | message = "Region is going down now."; | 387 | message = "Region is going down now."; |
388 | } | 388 | } |
389 | 389 | ||
390 | m_app.SceneManager.ForEachScene( | 390 | m_application.SceneManager.ForEachScene( |
391 | delegate(Scene scene) | 391 | delegate(Scene scene) |
392 | { | 392 | { |
393 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 393 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
@@ -422,7 +422,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
422 | 422 | ||
423 | private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e) | 423 | private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e) |
424 | { | 424 | { |
425 | m_app.Shutdown(); | 425 | m_application.Shutdown(); |
426 | } | 426 | } |
427 | 427 | ||
428 | /// <summary> | 428 | /// <summary> |
@@ -489,7 +489,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
489 | XmlRpcResponse response = new XmlRpcResponse(); | 489 | XmlRpcResponse response = new XmlRpcResponse(); |
490 | Hashtable responseData = new Hashtable(); | 490 | Hashtable responseData = new Hashtable(); |
491 | 491 | ||
492 | lock (rslock) | 492 | lock (m_requestLock) |
493 | { | 493 | { |
494 | int m_regionLimit = m_config.GetInt("region_limit", 0); | 494 | int m_regionLimit = m_config.GetInt("region_limit", 0); |
495 | bool m_enableVoiceForNewRegions = m_config.GetBoolean("create_region_enable_voice", false); | 495 | bool m_enableVoiceForNewRegions = m_config.GetBoolean("create_region_enable_voice", false); |
@@ -514,7 +514,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
514 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 514 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); |
515 | 515 | ||
516 | // check whether we still have space left (iff we are using limits) | 516 | // check whether we still have space left (iff we are using limits) |
517 | if (m_regionLimit != 0 && m_app.SceneManager.Scenes.Count >= m_regionLimit) | 517 | if (m_regionLimit != 0 && m_application.SceneManager.Scenes.Count >= m_regionLimit) |
518 | throw new Exception(String.Format("cannot instantiate new region, server capacity {0} already reached; delete regions first", | 518 | throw new Exception(String.Format("cannot instantiate new region, server capacity {0} already reached; delete regions first", |
519 | m_regionLimit)); | 519 | m_regionLimit)); |
520 | // extract or generate region ID now | 520 | // extract or generate region ID now |
@@ -524,7 +524,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
524 | !String.IsNullOrEmpty((string) requestData["region_id"])) | 524 | !String.IsNullOrEmpty((string) requestData["region_id"])) |
525 | { | 525 | { |
526 | regionID = (UUID) (string) requestData["region_id"]; | 526 | regionID = (UUID) (string) requestData["region_id"]; |
527 | if (m_app.SceneManager.TryGetScene(regionID, out scene)) | 527 | if (m_application.SceneManager.TryGetScene(regionID, out scene)) |
528 | throw new Exception( | 528 | throw new Exception( |
529 | String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", | 529 | String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", |
530 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, | 530 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, |
@@ -547,13 +547,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
547 | 547 | ||
548 | // check for collisions: region name, region UUID, | 548 | // check for collisions: region name, region UUID, |
549 | // region location | 549 | // region location |
550 | if (m_app.SceneManager.TryGetScene(region.RegionName, out scene)) | 550 | if (m_application.SceneManager.TryGetScene(region.RegionName, out scene)) |
551 | throw new Exception( | 551 | throw new Exception( |
552 | String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>", | 552 | String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>", |
553 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, | 553 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, |
554 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); | 554 | scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); |
555 | 555 | ||
556 | if (m_app.SceneManager.TryGetScene(region.RegionLocX, region.RegionLocY, out scene)) | 556 | if (m_application.SceneManager.TryGetScene(region.RegionLocX, region.RegionLocY, out scene)) |
557 | throw new Exception( | 557 | throw new Exception( |
558 | String.Format("region location <{0},{1}> already in use by region {2}, UUID {3}, <{4},{5}>", | 558 | String.Format("region location <{0},{1}> already in use by region {2}, UUID {3}, <{4},{5}>", |
559 | region.RegionLocX, region.RegionLocY, | 559 | region.RegionLocX, region.RegionLocY, |
@@ -565,7 +565,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
565 | 565 | ||
566 | region.InternalEndPoint.Port = Convert.ToInt32(requestData["listen_port"]); | 566 | region.InternalEndPoint.Port = Convert.ToInt32(requestData["listen_port"]); |
567 | if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0"); | 567 | if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0"); |
568 | if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene)) | 568 | if (m_application.SceneManager.TryGetScene(region.InternalEndPoint, out scene)) |
569 | throw new Exception( | 569 | throw new Exception( |
570 | String.Format( | 570 | String.Format( |
571 | "region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>", | 571 | "region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>", |
@@ -625,28 +625,28 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
625 | 625 | ||
626 | // Create the region and perform any initial initialization | 626 | // Create the region and perform any initial initialization |
627 | 627 | ||
628 | IScene newscene; | 628 | IScene newScene; |
629 | m_app.CreateRegion(region, out newscene); | 629 | m_application.CreateRegion(region, out newScene); |
630 | 630 | ||
631 | // If an access specification was provided, use it. | 631 | // If an access specification was provided, use it. |
632 | // Otherwise accept the default. | 632 | // Otherwise accept the default. |
633 | newscene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess); | 633 | newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess); |
634 | newscene.RegionInfo.EstateSettings.EstateOwner = userID; | 634 | newScene.RegionInfo.EstateSettings.EstateOwner = userID; |
635 | if (persist) | 635 | if (persist) |
636 | newscene.RegionInfo.EstateSettings.Save(); | 636 | newScene.RegionInfo.EstateSettings.Save(); |
637 | 637 | ||
638 | // enable voice on newly created region if | 638 | // enable voice on newly created region if |
639 | // requested by either the XmlRpc request or the | 639 | // requested by either the XmlRpc request or the |
640 | // configuration | 640 | // configuration |
641 | if (GetBoolean(requestData, "enable_voice", m_enableVoiceForNewRegions)) | 641 | if (GetBoolean(requestData, "enable_voice", m_enableVoiceForNewRegions)) |
642 | { | 642 | { |
643 | List<ILandObject> parcels = ((Scene)newscene).LandChannel.AllParcels(); | 643 | List<ILandObject> parcels = ((Scene)newScene).LandChannel.AllParcels(); |
644 | 644 | ||
645 | foreach (ILandObject parcel in parcels) | 645 | foreach (ILandObject parcel in parcels) |
646 | { | 646 | { |
647 | parcel.LandData.Flags |= (uint) ParcelFlags.AllowVoiceChat; | 647 | parcel.LandData.Flags |= (uint) ParcelFlags.AllowVoiceChat; |
648 | parcel.LandData.Flags |= (uint) ParcelFlags.UseEstateVoiceChan; | 648 | parcel.LandData.Flags |= (uint) ParcelFlags.UseEstateVoiceChan; |
649 | ((Scene)newscene).LandChannel.UpdateLandObject(parcel.LandData.LocalID, parcel.LandData); | 649 | ((Scene)newScene).LandChannel.UpdateLandObject(parcel.LandData.LocalID, parcel.LandData); |
650 | } | 650 | } |
651 | } | 651 | } |
652 | 652 | ||
@@ -704,7 +704,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
704 | XmlRpcResponse response = new XmlRpcResponse(); | 704 | XmlRpcResponse response = new XmlRpcResponse(); |
705 | Hashtable responseData = new Hashtable(); | 705 | Hashtable responseData = new Hashtable(); |
706 | 706 | ||
707 | lock (rslock) | 707 | lock (m_requestLock) |
708 | { | 708 | { |
709 | try | 709 | try |
710 | { | 710 | { |
@@ -713,10 +713,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
713 | 713 | ||
714 | Scene scene = null; | 714 | Scene scene = null; |
715 | string regionName = (string) requestData["region_name"]; | 715 | string regionName = (string) requestData["region_name"]; |
716 | if (!m_app.SceneManager.TryGetScene(regionName, out scene)) | 716 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) |
717 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); | 717 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); |
718 | 718 | ||
719 | m_app.RemoveRegion(scene, true); | 719 | m_application.RemoveRegion(scene, true); |
720 | 720 | ||
721 | responseData["success"] = true; | 721 | responseData["success"] = true; |
722 | responseData["region_name"] = regionName; | 722 | responseData["region_name"] = regionName; |
@@ -774,7 +774,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
774 | Hashtable responseData = new Hashtable(); | 774 | Hashtable responseData = new Hashtable(); |
775 | Scene scene = null; | 775 | Scene scene = null; |
776 | 776 | ||
777 | lock (rslock) | 777 | lock (m_requestLock) |
778 | { | 778 | { |
779 | try | 779 | try |
780 | { | 780 | { |
@@ -786,10 +786,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
786 | { | 786 | { |
787 | // Region specified by UUID | 787 | // Region specified by UUID |
788 | UUID regionID = (UUID) (string) requestData["region_id"]; | 788 | UUID regionID = (UUID) (string) requestData["region_id"]; |
789 | if (!m_app.SceneManager.TryGetScene(regionID, out scene)) | 789 | if (!m_application.SceneManager.TryGetScene(regionID, out scene)) |
790 | throw new Exception(String.Format("region \"{0}\" does not exist", regionID)); | 790 | throw new Exception(String.Format("region \"{0}\" does not exist", regionID)); |
791 | 791 | ||
792 | m_app.CloseRegion(scene); | 792 | m_application.CloseRegion(scene); |
793 | 793 | ||
794 | responseData["success"] = true; | 794 | responseData["success"] = true; |
795 | responseData["region_id"] = regionID; | 795 | responseData["region_id"] = regionID; |
@@ -802,10 +802,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
802 | // Region specified by name | 802 | // Region specified by name |
803 | 803 | ||
804 | string regionName = (string) requestData["region_name"]; | 804 | string regionName = (string) requestData["region_name"]; |
805 | if (!m_app.SceneManager.TryGetScene(regionName, out scene)) | 805 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) |
806 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); | 806 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); |
807 | 807 | ||
808 | m_app.CloseRegion(scene); | 808 | m_application.CloseRegion(scene); |
809 | 809 | ||
810 | responseData["success"] = true; | 810 | responseData["success"] = true; |
811 | responseData["region_name"] = regionName; | 811 | responseData["region_name"] = regionName; |
@@ -869,7 +869,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
869 | XmlRpcResponse response = new XmlRpcResponse(); | 869 | XmlRpcResponse response = new XmlRpcResponse(); |
870 | Hashtable responseData = new Hashtable(); | 870 | Hashtable responseData = new Hashtable(); |
871 | 871 | ||
872 | lock (rslock) | 872 | lock (m_requestLock) |
873 | { | 873 | { |
874 | try | 874 | try |
875 | { | 875 | { |
@@ -878,7 +878,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
878 | 878 | ||
879 | Scene scene = null; | 879 | Scene scene = null; |
880 | string regionName = (string) requestData["region_name"]; | 880 | string regionName = (string) requestData["region_name"]; |
881 | if (!m_app.SceneManager.TryGetScene(regionName, out scene)) | 881 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) |
882 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); | 882 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); |
883 | 883 | ||
884 | // Modify access | 884 | // Modify access |
@@ -976,7 +976,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
976 | XmlRpcResponse response = new XmlRpcResponse(); | 976 | XmlRpcResponse response = new XmlRpcResponse(); |
977 | Hashtable responseData = new Hashtable(); | 977 | Hashtable responseData = new Hashtable(); |
978 | 978 | ||
979 | lock (rslock) | 979 | lock (m_requestLock) |
980 | { | 980 | { |
981 | try | 981 | try |
982 | { | 982 | { |
@@ -995,35 +995,35 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
995 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 995 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); |
996 | 996 | ||
997 | // do the job | 997 | // do the job |
998 | string firstname = (string) requestData["user_firstname"]; | 998 | string firstName = (string) requestData["user_firstname"]; |
999 | string lastname = (string) requestData["user_lastname"]; | 999 | string lastName = (string) requestData["user_lastname"]; |
1000 | string passwd = (string) requestData["user_password"]; | 1000 | string password = (string) requestData["user_password"]; |
1001 | 1001 | ||
1002 | uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); | 1002 | uint regionXLocation = Convert.ToUInt32((Int32) requestData["start_region_x"]); |
1003 | uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); | 1003 | uint regionYLocation = Convert.ToUInt32((Int32) requestData["start_region_y"]); |
1004 | 1004 | ||
1005 | string email = ""; // empty string for email | 1005 | string email = ""; // empty string for email |
1006 | if (requestData.Contains("user_email")) | 1006 | if (requestData.Contains("user_email")) |
1007 | email = (string)requestData["user_email"]; | 1007 | email = (string)requestData["user_email"]; |
1008 | 1008 | ||
1009 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 1009 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
1010 | UUID scopeID = scene.RegionInfo.ScopeID; | 1010 | UUID scopeID = scene.RegionInfo.ScopeID; |
1011 | 1011 | ||
1012 | UserAccount account = CreateUser(scopeID, firstname, lastname, passwd, email); | 1012 | UserAccount account = CreateUser(scopeID, firstName, lastName, password, email); |
1013 | 1013 | ||
1014 | if (null == account) | 1014 | if (null == account) |
1015 | throw new Exception(String.Format("failed to create new user {0} {1}", | 1015 | throw new Exception(String.Format("failed to create new user {0} {1}", |
1016 | firstname, lastname)); | 1016 | firstName, lastName)); |
1017 | 1017 | ||
1018 | // Set home position | 1018 | // Set home position |
1019 | 1019 | ||
1020 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, | 1020 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, |
1021 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | 1021 | (int)(regionXLocation * Constants.RegionSize), (int)(regionYLocation * Constants.RegionSize)); |
1022 | if (null == home) { | 1022 | if (null == home) { |
1023 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstname, lastname); | 1023 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstName, lastName); |
1024 | } else { | 1024 | } else { |
1025 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | 1025 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); |
1026 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstname, lastname); | 1026 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstName, lastName); |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | // Establish the avatar's initial appearance | 1029 | // Establish the avatar's initial appearance |
@@ -1035,7 +1035,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1035 | 1035 | ||
1036 | response.Value = responseData; | 1036 | response.Value = responseData; |
1037 | 1037 | ||
1038 | m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, account.PrincipalID); | 1038 | m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstName, lastName, account.PrincipalID); |
1039 | } | 1039 | } |
1040 | catch (Exception e) | 1040 | catch (Exception e) |
1041 | { | 1041 | { |
@@ -1101,15 +1101,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1101 | // check completeness | 1101 | // check completeness |
1102 | CheckStringParameters(request, new string[] {"password", "user_firstname", "user_lastname"}); | 1102 | CheckStringParameters(request, new string[] {"password", "user_firstname", "user_lastname"}); |
1103 | 1103 | ||
1104 | string firstname = (string) requestData["user_firstname"]; | 1104 | string firstName = (string) requestData["user_firstname"]; |
1105 | string lastname = (string) requestData["user_lastname"]; | 1105 | string lastName = (string) requestData["user_lastname"]; |
1106 | 1106 | ||
1107 | responseData["user_firstname"] = firstname; | 1107 | responseData["user_firstname"] = firstName; |
1108 | responseData["user_lastname"] = lastname; | 1108 | responseData["user_lastname"] = lastName; |
1109 | 1109 | ||
1110 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 1110 | UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
1111 | 1111 | ||
1112 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname); | 1112 | UserAccount account = m_application.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstName, lastName); |
1113 | 1113 | ||
1114 | if (null == account) | 1114 | if (null == account) |
1115 | { | 1115 | { |
@@ -1118,9 +1118,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1118 | } | 1118 | } |
1119 | else | 1119 | else |
1120 | { | 1120 | { |
1121 | GridUserInfo guinfo = m_app.SceneManager.CurrentOrFirstScene.GridUserService.GetGridUserInfo(account.PrincipalID.ToString()); | 1121 | GridUserInfo userInfo = m_application.SceneManager.CurrentOrFirstScene.GridUserService.GetGridUserInfo(account.PrincipalID.ToString()); |
1122 | if (guinfo != null) | 1122 | if (userInfo != null) |
1123 | responseData["lastlogin"] = guinfo.Login; | 1123 | responseData["lastlogin"] = userInfo.Login; |
1124 | else | 1124 | else |
1125 | responseData["lastlogin"] = 0; | 1125 | responseData["lastlogin"] = 0; |
1126 | 1126 | ||
@@ -1197,7 +1197,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1197 | XmlRpcResponse response = new XmlRpcResponse(); | 1197 | XmlRpcResponse response = new XmlRpcResponse(); |
1198 | Hashtable responseData = new Hashtable(); | 1198 | Hashtable responseData = new Hashtable(); |
1199 | 1199 | ||
1200 | lock (rslock) | 1200 | lock (m_requestLock) |
1201 | { | 1201 | { |
1202 | try | 1202 | try |
1203 | { | 1203 | { |
@@ -1213,12 +1213,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1213 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 1213 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); |
1214 | 1214 | ||
1215 | // do the job | 1215 | // do the job |
1216 | string firstname = (string) requestData["user_firstname"]; | 1216 | string firstName = (string) requestData["user_firstname"]; |
1217 | string lastname = (string) requestData["user_lastname"]; | 1217 | string lastName = (string) requestData["user_lastname"]; |
1218 | 1218 | ||
1219 | string passwd = String.Empty; | 1219 | string password = String.Empty; |
1220 | uint? regX = null; | 1220 | uint? regionXLocation = null; |
1221 | uint? regY = null; | 1221 | uint? regionYLocation = null; |
1222 | // uint? ulaX = null; | 1222 | // uint? ulaX = null; |
1223 | // uint? ulaY = null; | 1223 | // uint? ulaY = null; |
1224 | // uint? ulaZ = null; | 1224 | // uint? ulaZ = null; |
@@ -1228,11 +1228,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1228 | // string aboutFirstLive = String.Empty; | 1228 | // string aboutFirstLive = String.Empty; |
1229 | // string aboutAvatar = String.Empty; | 1229 | // string aboutAvatar = String.Empty; |
1230 | 1230 | ||
1231 | if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; | 1231 | if (requestData.ContainsKey("user_password")) password = (string) requestData["user_password"]; |
1232 | if (requestData.ContainsKey("start_region_x")) | 1232 | if (requestData.ContainsKey("start_region_x")) |
1233 | regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); | 1233 | regionXLocation = Convert.ToUInt32((Int32) requestData["start_region_x"]); |
1234 | if (requestData.ContainsKey("start_region_y")) | 1234 | if (requestData.ContainsKey("start_region_y")) |
1235 | regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); | 1235 | regionYLocation = Convert.ToUInt32((Int32) requestData["start_region_y"]); |
1236 | 1236 | ||
1237 | // if (requestData.ContainsKey("start_lookat_x")) | 1237 | // if (requestData.ContainsKey("start_lookat_x")) |
1238 | // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); | 1238 | // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); |
@@ -1252,17 +1252,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1252 | // if (requestData.ContainsKey("about_virtual_world")) | 1252 | // if (requestData.ContainsKey("about_virtual_world")) |
1253 | // aboutAvatar = (string)requestData["about_virtual_world"]; | 1253 | // aboutAvatar = (string)requestData["about_virtual_world"]; |
1254 | 1254 | ||
1255 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 1255 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
1256 | UUID scopeID = scene.RegionInfo.ScopeID; | 1256 | UUID scopeID = scene.RegionInfo.ScopeID; |
1257 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, firstname, lastname); | 1257 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, firstName, lastName); |
1258 | 1258 | ||
1259 | if (null == account) | 1259 | if (null == account) |
1260 | throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); | 1260 | throw new Exception(String.Format("avatar {0} {1} does not exist", firstName, lastName)); |
1261 | 1261 | ||
1262 | if (!String.IsNullOrEmpty(passwd)) | 1262 | if (!String.IsNullOrEmpty(password)) |
1263 | { | 1263 | { |
1264 | m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname); | 1264 | m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstName, lastName); |
1265 | ChangeUserPassword(firstname, lastname, passwd); | 1265 | ChangeUserPassword(firstName, lastName, password); |
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | // if (null != usaX) userProfile.HomeLocationX = (uint) usaX; | 1268 | // if (null != usaX) userProfile.HomeLocationX = (uint) usaX; |
@@ -1278,15 +1278,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1278 | 1278 | ||
1279 | // Set home position | 1279 | // Set home position |
1280 | 1280 | ||
1281 | if ((null != regX) && (null != regY)) | 1281 | if ((null != regionXLocation) && (null != regionYLocation)) |
1282 | { | 1282 | { |
1283 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, | 1283 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, |
1284 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | 1284 | (int)(regionXLocation * Constants.RegionSize), (int)(regionYLocation * Constants.RegionSize)); |
1285 | if (null == home) { | 1285 | if (null == home) { |
1286 | m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstname, lastname); | 1286 | m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstName, lastName); |
1287 | } else { | 1287 | } else { |
1288 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | 1288 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); |
1289 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstname, lastname); | 1289 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstName, lastName); |
1290 | } | 1290 | } |
1291 | } | 1291 | } |
1292 | 1292 | ||
@@ -1300,7 +1300,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1300 | response.Value = responseData; | 1300 | response.Value = responseData; |
1301 | 1301 | ||
1302 | m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", | 1302 | m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", |
1303 | firstname, lastname, | 1303 | firstName, lastName, |
1304 | account.PrincipalID); | 1304 | account.PrincipalID); |
1305 | } | 1305 | } |
1306 | catch (Exception e) | 1306 | catch (Exception e) |
@@ -1332,9 +1332,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1332 | { | 1332 | { |
1333 | m_log.DebugFormat("[RADMIN] updateUserAppearance"); | 1333 | m_log.DebugFormat("[RADMIN] updateUserAppearance"); |
1334 | 1334 | ||
1335 | string dmale = m_config.GetString("default_male", "Default Male"); | 1335 | string defaultMale = m_config.GetString("default_male", "Default Male"); |
1336 | string dfemale = m_config.GetString("default_female", "Default Female"); | 1336 | string defaultFemale = m_config.GetString("default_female", "Default Female"); |
1337 | string dneut = m_config.GetString("default_female", "Default Default"); | 1337 | string defaultNeutral = m_config.GetString("default_female", "Default Default"); |
1338 | string model = String.Empty; | 1338 | string model = String.Empty; |
1339 | 1339 | ||
1340 | // Has a gender preference been supplied? | 1340 | // Has a gender preference been supplied? |
@@ -1345,16 +1345,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1345 | { | 1345 | { |
1346 | case "m" : | 1346 | case "m" : |
1347 | case "male" : | 1347 | case "male" : |
1348 | model = dmale; | 1348 | model = defaultMale; |
1349 | break; | 1349 | break; |
1350 | case "f" : | 1350 | case "f" : |
1351 | case "female" : | 1351 | case "female" : |
1352 | model = dfemale; | 1352 | model = defaultFemale; |
1353 | break; | 1353 | break; |
1354 | case "n" : | 1354 | case "n" : |
1355 | case "neutral" : | 1355 | case "neutral" : |
1356 | default : | 1356 | default : |
1357 | model = dneut; | 1357 | model = defaultNeutral; |
1358 | break; | 1358 | break; |
1359 | } | 1359 | } |
1360 | } | 1360 | } |
@@ -1376,19 +1376,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1376 | 1376 | ||
1377 | m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model <{1}>", userid, model); | 1377 | m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model <{1}>", userid, model); |
1378 | 1378 | ||
1379 | string[] nomens = model.Split(); | 1379 | string[] modelSpecifiers = model.Split(); |
1380 | if (nomens.Length != 2) | 1380 | if (modelSpecifiers.Length != 2) |
1381 | { | 1381 | { |
1382 | m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); | 1382 | m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); |
1383 | // nomens = dmodel.Split(); | 1383 | // modelSpecifiers = dmodel.Split(); |
1384 | return; | 1384 | return; |
1385 | } | 1385 | } |
1386 | 1386 | ||
1387 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 1387 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
1388 | UUID scopeID = scene.RegionInfo.ScopeID; | 1388 | UUID scopeID = scene.RegionInfo.ScopeID; |
1389 | UserAccount mprof = scene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]); | 1389 | UserAccount modelProfile = scene.UserAccountService.GetUserAccount(scopeID, modelSpecifiers[0], modelSpecifiers[1]); |
1390 | 1390 | ||
1391 | if (mprof == null) | 1391 | if (modelProfile == null) |
1392 | { | 1392 | { |
1393 | m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); | 1393 | m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); |
1394 | return; | 1394 | return; |
@@ -1398,7 +1398,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1398 | // actual asset ids, however to complete the magic we need to populate the inventory with the | 1398 | // actual asset ids, however to complete the magic we need to populate the inventory with the |
1399 | // assets in question. | 1399 | // assets in question. |
1400 | 1400 | ||
1401 | EstablishAppearance(userid, mprof.PrincipalID); | 1401 | EstablishAppearance(userid, modelProfile.PrincipalID); |
1402 | 1402 | ||
1403 | m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", | 1403 | m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", |
1404 | userid, model); | 1404 | userid, model); |
@@ -1410,17 +1410,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1410 | /// is known to exist, as is the target avatar. | 1410 | /// is known to exist, as is the target avatar. |
1411 | /// </summary> | 1411 | /// </summary> |
1412 | 1412 | ||
1413 | private void EstablishAppearance(UUID dest, UUID srca) | 1413 | private void EstablishAppearance(UUID destination, UUID source) |
1414 | { | 1414 | { |
1415 | m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca); | 1415 | m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", destination, source); |
1416 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 1416 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
1417 | AvatarAppearance ava = null; | 1417 | AvatarAppearance avatarAppearance = null; |
1418 | AvatarData avatar = scene.AvatarService.GetAvatar(srca); | 1418 | AvatarData avatar = scene.AvatarService.GetAvatar(source); |
1419 | if (avatar != null) | 1419 | if (avatar != null) |
1420 | ava = avatar.ToAvatarAppearance(srca); | 1420 | avatarAppearance = avatar.ToAvatarAppearance(source); |
1421 | 1421 | ||
1422 | // If the model has no associated appearance we're done. | 1422 | // If the model has no associated appearance we're done. |
1423 | if (ava == null) | 1423 | if (avatarAppearance == null) |
1424 | return; | 1424 | return; |
1425 | 1425 | ||
1426 | // Simple appearance copy or copy Clothing and Bodyparts folders? | 1426 | // Simple appearance copy or copy Clothing and Bodyparts folders? |
@@ -1431,15 +1431,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1431 | // Simple copy of wearables and appearance update | 1431 | // Simple copy of wearables and appearance update |
1432 | try | 1432 | try |
1433 | { | 1433 | { |
1434 | CopyWearablesAndAttachments(dest, srca, ava); | 1434 | CopyWearablesAndAttachments(destination, source, avatarAppearance); |
1435 | 1435 | ||
1436 | AvatarData adata = new AvatarData(ava); | 1436 | AvatarData avatarData = new AvatarData(avatarAppearance); |
1437 | scene.AvatarService.SetAvatar(dest, adata); | 1437 | scene.AvatarService.SetAvatar(destination, avatarData); |
1438 | } | 1438 | } |
1439 | catch (Exception e) | 1439 | catch (Exception e) |
1440 | { | 1440 | { |
1441 | m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", | 1441 | m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", |
1442 | dest, e.Message); | 1442 | destination, e.Message); |
1443 | } | 1443 | } |
1444 | 1444 | ||
1445 | return; | 1445 | return; |
@@ -1448,30 +1448,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1448 | // Copy Clothing and Bodypart folders and appearance update | 1448 | // Copy Clothing and Bodypart folders and appearance update |
1449 | try | 1449 | try |
1450 | { | 1450 | { |
1451 | Dictionary<UUID,UUID> imap = new Dictionary<UUID,UUID>(); | 1451 | Dictionary<UUID,UUID> inventoryMap = new Dictionary<UUID,UUID>(); |
1452 | CopyInventoryFolders(dest, srca, AssetType.Clothing, imap, ava); | 1452 | CopyInventoryFolders(destination, source, AssetType.Clothing, inventoryMap, avatarAppearance); |
1453 | CopyInventoryFolders(dest, srca, AssetType.Bodypart, imap, ava); | 1453 | CopyInventoryFolders(destination, source, AssetType.Bodypart, inventoryMap, avatarAppearance); |
1454 | 1454 | ||
1455 | AvatarWearable[] wearables = ava.Wearables; | 1455 | AvatarWearable[] wearables = avatarAppearance.Wearables; |
1456 | 1456 | ||
1457 | for (int i=0; i<wearables.Length; i++) | 1457 | for (int i=0; i<wearables.Length; i++) |
1458 | { | 1458 | { |
1459 | if (imap.ContainsKey(wearables[i].ItemID)) | 1459 | if (inventoryMap.ContainsKey(wearables[i].ItemID)) |
1460 | { | 1460 | { |
1461 | AvatarWearable dw = new AvatarWearable(); | 1461 | AvatarWearable wearable = new AvatarWearable(); |
1462 | dw.AssetID = wearables[i].AssetID; | 1462 | wearable.AssetID = wearables[i].AssetID; |
1463 | dw.ItemID = imap[wearables[i].ItemID]; | 1463 | wearable.ItemID = inventoryMap[wearables[i].ItemID]; |
1464 | ava.SetWearable(i, dw); | 1464 | avatarAppearance.SetWearable(i, wearable); |
1465 | } | 1465 | } |
1466 | } | 1466 | } |
1467 | 1467 | ||
1468 | AvatarData adata = new AvatarData(ava); | 1468 | AvatarData avatarData = new AvatarData(avatarAppearance); |
1469 | scene.AvatarService.SetAvatar(dest, adata); | 1469 | scene.AvatarService.SetAvatar(destination, avatarData); |
1470 | } | 1470 | } |
1471 | catch (Exception e) | 1471 | catch (Exception e) |
1472 | { | 1472 | { |
1473 | m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", | 1473 | m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", |
1474 | dest, e.Message); | 1474 | destination, e.Message); |
1475 | } | 1475 | } |
1476 | 1476 | ||
1477 | return; | 1477 | return; |
@@ -1483,32 +1483,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1483 | /// In parallel the avatar wearables and attachments are updated. | 1483 | /// In parallel the avatar wearables and attachments are updated. |
1484 | /// </summary> | 1484 | /// </summary> |
1485 | 1485 | ||
1486 | private void CopyWearablesAndAttachments(UUID dest, UUID srca, AvatarAppearance ava) | 1486 | private void CopyWearablesAndAttachments(UUID destination, UUID source, AvatarAppearance avatarAppearance) |
1487 | { | 1487 | { |
1488 | IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService; | 1488 | IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService; |
1489 | 1489 | ||
1490 | // Get Clothing folder of receiver | 1490 | // Get Clothing folder of receiver |
1491 | InventoryFolderBase dstf = iserv.GetFolderForType(dest, AssetType.Clothing); | 1491 | InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, AssetType.Clothing); |
1492 | 1492 | ||
1493 | if (dstf == null) | 1493 | if (destinationFolder == null) |
1494 | throw new Exception("Cannot locate folder(s)"); | 1494 | throw new Exception("Cannot locate folder(s)"); |
1495 | 1495 | ||
1496 | // Missing destination folder? This should *never* be the case | 1496 | // Missing destination folder? This should *never* be the case |
1497 | if (dstf.Type != (short)AssetType.Clothing) | 1497 | if (destinationFolder.Type != (short)AssetType.Clothing) |
1498 | { | 1498 | { |
1499 | dstf = new InventoryFolderBase(); | 1499 | destinationFolder = new InventoryFolderBase(); |
1500 | dstf.ID = UUID.Random(); | 1500 | |
1501 | dstf.Name = "Clothing"; | 1501 | destinationFolder.ID = UUID.Random(); |
1502 | dstf.Owner = dest; | 1502 | destinationFolder.Name = "Clothing"; |
1503 | dstf.Type = (short)AssetType.Clothing; | 1503 | destinationFolder.Owner = destination; |
1504 | dstf.ParentID = iserv.GetRootFolder(dest).ID; | 1504 | destinationFolder.Type = (short)AssetType.Clothing; |
1505 | dstf.Version = 1; | 1505 | destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID; |
1506 | iserv.AddFolder(dstf); // store base record | 1506 | destinationFolder.Version = 1; |
1507 | m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", srca); | 1507 | inventoryService.AddFolder(destinationFolder); // store base record |
1508 | m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source); | ||
1508 | } | 1509 | } |
1509 | 1510 | ||
1510 | // Wearables | 1511 | // Wearables |
1511 | AvatarWearable[] wearables = ava.Wearables; | 1512 | AvatarWearable[] wearables = avatarAppearance.Wearables; |
1512 | AvatarWearable wearable; | 1513 | AvatarWearable wearable; |
1513 | 1514 | ||
1514 | for (int i=0; i<wearables.Length; i++) | 1515 | for (int i=0; i<wearables.Length; i++) |
@@ -1517,95 +1518,95 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1517 | if (wearable.ItemID != UUID.Zero) | 1518 | if (wearable.ItemID != UUID.Zero) |
1518 | { | 1519 | { |
1519 | // Get inventory item and copy it | 1520 | // Get inventory item and copy it |
1520 | InventoryItemBase item = new InventoryItemBase(wearable.ItemID, srca); | 1521 | InventoryItemBase item = new InventoryItemBase(wearable.ItemID, source); |
1521 | item = iserv.GetItem(item); | 1522 | item = inventoryService.GetItem(item); |
1522 | 1523 | ||
1523 | if (item != null) | 1524 | if (item != null) |
1524 | { | 1525 | { |
1525 | InventoryItemBase dsti = new InventoryItemBase(UUID.Random(), dest); | 1526 | InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); |
1526 | dsti.Name = item.Name; | 1527 | destinationItem.Name = item.Name; |
1527 | dsti.Description = item.Description; | 1528 | destinationItem.Description = item.Description; |
1528 | dsti.InvType = item.InvType; | 1529 | destinationItem.InvType = item.InvType; |
1529 | dsti.CreatorId = item.CreatorId; | 1530 | destinationItem.CreatorId = item.CreatorId; |
1530 | dsti.CreatorIdAsUuid = item.CreatorIdAsUuid; | 1531 | destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid; |
1531 | dsti.NextPermissions = item.NextPermissions; | 1532 | destinationItem.NextPermissions = item.NextPermissions; |
1532 | dsti.CurrentPermissions = item.CurrentPermissions; | 1533 | destinationItem.CurrentPermissions = item.CurrentPermissions; |
1533 | dsti.BasePermissions = item.BasePermissions; | 1534 | destinationItem.BasePermissions = item.BasePermissions; |
1534 | dsti.EveryOnePermissions = item.EveryOnePermissions; | 1535 | destinationItem.EveryOnePermissions = item.EveryOnePermissions; |
1535 | dsti.GroupPermissions = item.GroupPermissions; | 1536 | destinationItem.GroupPermissions = item.GroupPermissions; |
1536 | dsti.AssetType = item.AssetType; | 1537 | destinationItem.AssetType = item.AssetType; |
1537 | dsti.AssetID = item.AssetID; | 1538 | destinationItem.AssetID = item.AssetID; |
1538 | dsti.GroupID = item.GroupID; | 1539 | destinationItem.GroupID = item.GroupID; |
1539 | dsti.GroupOwned = item.GroupOwned; | 1540 | destinationItem.GroupOwned = item.GroupOwned; |
1540 | dsti.SalePrice = item.SalePrice; | 1541 | destinationItem.SalePrice = item.SalePrice; |
1541 | dsti.SaleType = item.SaleType; | 1542 | destinationItem.SaleType = item.SaleType; |
1542 | dsti.Flags = item.Flags; | 1543 | destinationItem.Flags = item.Flags; |
1543 | dsti.CreationDate = item.CreationDate; | 1544 | destinationItem.CreationDate = item.CreationDate; |
1544 | dsti.Folder = dstf.ID; | 1545 | destinationItem.Folder = destinationFolder.ID; |
1545 | 1546 | ||
1546 | iserv.AddItem(dsti); | 1547 | inventoryService.AddItem(destinationItem); |
1547 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, dstf.ID); | 1548 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); |
1548 | 1549 | ||
1549 | // Wear item | 1550 | // Wear item |
1550 | AvatarWearable dw = new AvatarWearable(); | 1551 | AvatarWearable newWearable = new AvatarWearable(); |
1551 | dw.AssetID = wearable.AssetID; | 1552 | newWearable.AssetID = wearable.AssetID; |
1552 | dw.ItemID = dsti.ID; | 1553 | newWearable.ItemID = destinationItem.ID; |
1553 | ava.SetWearable(i, dw); | 1554 | avatarAppearance.SetWearable(i, newWearable); |
1554 | } | 1555 | } |
1555 | else | 1556 | else |
1556 | { | 1557 | { |
1557 | m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, dstf.ID); | 1558 | m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); |
1558 | } | 1559 | } |
1559 | } | 1560 | } |
1560 | } | 1561 | } |
1561 | 1562 | ||
1562 | // Attachments | 1563 | // Attachments |
1563 | Dictionary<int, UUID[]> attachments = ava.GetAttachmentDictionary(); | 1564 | Dictionary<int, UUID[]> attachments = avatarAppearance.GetAttachmentDictionary(); |
1564 | 1565 | ||
1565 | foreach (KeyValuePair<int, UUID[]> kvp in attachments) | 1566 | foreach (KeyValuePair<int, UUID[]> attachment in attachments) |
1566 | { | 1567 | { |
1567 | int attachpoint = kvp.Key; | 1568 | int attachpoint = attachment.Key; |
1568 | UUID itemID = kvp.Value[0]; | 1569 | UUID itemID = attachment.Value[0]; |
1569 | 1570 | ||
1570 | if (itemID != UUID.Zero) | 1571 | if (itemID != UUID.Zero) |
1571 | { | 1572 | { |
1572 | // Get inventory item and copy it | 1573 | // Get inventory item and copy it |
1573 | InventoryItemBase item = new InventoryItemBase(itemID, srca); | 1574 | InventoryItemBase item = new InventoryItemBase(itemID, source); |
1574 | item = iserv.GetItem(item); | 1575 | item = inventoryService.GetItem(item); |
1575 | 1576 | ||
1576 | if (item != null) | 1577 | if (item != null) |
1577 | { | 1578 | { |
1578 | InventoryItemBase dsti = new InventoryItemBase(UUID.Random(), dest); | 1579 | InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); |
1579 | dsti.Name = item.Name; | 1580 | destinationItem.Name = item.Name; |
1580 | dsti.Description = item.Description; | 1581 | destinationItem.Description = item.Description; |
1581 | dsti.InvType = item.InvType; | 1582 | destinationItem.InvType = item.InvType; |
1582 | dsti.CreatorId = item.CreatorId; | 1583 | destinationItem.CreatorId = item.CreatorId; |
1583 | dsti.CreatorIdAsUuid = item.CreatorIdAsUuid; | 1584 | destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid; |
1584 | dsti.NextPermissions = item.NextPermissions; | 1585 | destinationItem.NextPermissions = item.NextPermissions; |
1585 | dsti.CurrentPermissions = item.CurrentPermissions; | 1586 | destinationItem.CurrentPermissions = item.CurrentPermissions; |
1586 | dsti.BasePermissions = item.BasePermissions; | 1587 | destinationItem.BasePermissions = item.BasePermissions; |
1587 | dsti.EveryOnePermissions = item.EveryOnePermissions; | 1588 | destinationItem.EveryOnePermissions = item.EveryOnePermissions; |
1588 | dsti.GroupPermissions = item.GroupPermissions; | 1589 | destinationItem.GroupPermissions = item.GroupPermissions; |
1589 | dsti.AssetType = item.AssetType; | 1590 | destinationItem.AssetType = item.AssetType; |
1590 | dsti.AssetID = item.AssetID; | 1591 | destinationItem.AssetID = item.AssetID; |
1591 | dsti.GroupID = item.GroupID; | 1592 | destinationItem.GroupID = item.GroupID; |
1592 | dsti.GroupOwned = item.GroupOwned; | 1593 | destinationItem.GroupOwned = item.GroupOwned; |
1593 | dsti.SalePrice = item.SalePrice; | 1594 | destinationItem.SalePrice = item.SalePrice; |
1594 | dsti.SaleType = item.SaleType; | 1595 | destinationItem.SaleType = item.SaleType; |
1595 | dsti.Flags = item.Flags; | 1596 | destinationItem.Flags = item.Flags; |
1596 | dsti.CreationDate = item.CreationDate; | 1597 | destinationItem.CreationDate = item.CreationDate; |
1597 | dsti.Folder = dstf.ID; | 1598 | destinationItem.Folder = destinationFolder.ID; |
1598 | 1599 | ||
1599 | iserv.AddItem(dsti); | 1600 | inventoryService.AddItem(destinationItem); |
1600 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, dstf.ID); | 1601 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); |
1601 | 1602 | ||
1602 | // Attach item | 1603 | // Attach item |
1603 | ava.SetAttachment(attachpoint, dsti.ID, dsti.AssetID); | 1604 | avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); |
1604 | m_log.DebugFormat("[RADMIN] Attached {0}", dsti.ID); | 1605 | m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); |
1605 | } | 1606 | } |
1606 | else | 1607 | else |
1607 | { | 1608 | { |
1608 | m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, dstf.ID); | 1609 | m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, destinationFolder.ID); |
1609 | } | 1610 | } |
1610 | } | 1611 | } |
1611 | } | 1612 | } |
@@ -1618,101 +1619,101 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1618 | /// copies of Clothing and Bodyparts inventory folders and attaches worn attachments | 1619 | /// copies of Clothing and Bodyparts inventory folders and attaches worn attachments |
1619 | /// </summary> | 1620 | /// </summary> |
1620 | 1621 | ||
1621 | private void CopyInventoryFolders(UUID dest, UUID srca, AssetType assettype, Dictionary<UUID,UUID> imap, | 1622 | private void CopyInventoryFolders(UUID destination, UUID source, AssetType assetType, Dictionary<UUID,UUID> inventoryMap, |
1622 | AvatarAppearance ava) | 1623 | AvatarAppearance avatarAppearance) |
1623 | { | 1624 | { |
1624 | IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService; | 1625 | IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService; |
1625 | 1626 | ||
1626 | InventoryFolderBase srcf = iserv.GetFolderForType(srca, assettype); | 1627 | InventoryFolderBase sourceFolder = inventoryService.GetFolderForType(source, assetType); |
1627 | InventoryFolderBase dstf = iserv.GetFolderForType(dest, assettype); | 1628 | InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, assetType); |
1628 | 1629 | ||
1629 | if (srcf == null || dstf == null) | 1630 | if (sourceFolder == null || destinationFolder == null) |
1630 | throw new Exception("Cannot locate folder(s)"); | 1631 | throw new Exception("Cannot locate folder(s)"); |
1631 | 1632 | ||
1632 | // Missing source folder? This should *never* be the case | 1633 | // Missing source folder? This should *never* be the case |
1633 | if (srcf.Type != (short)assettype) | 1634 | if (sourceFolder.Type != (short)assetType) |
1634 | { | 1635 | { |
1635 | srcf = new InventoryFolderBase(); | 1636 | sourceFolder = new InventoryFolderBase(); |
1636 | srcf.ID = UUID.Random(); | 1637 | sourceFolder.ID = UUID.Random(); |
1637 | if (assettype == AssetType.Clothing) { | 1638 | if (assetType == AssetType.Clothing) { |
1638 | srcf.Name = "Clothing"; | 1639 | sourceFolder.Name = "Clothing"; |
1639 | } else { | 1640 | } else { |
1640 | srcf.Name = "Body Parts"; | 1641 | sourceFolder.Name = "Body Parts"; |
1641 | } | 1642 | } |
1642 | srcf.Owner = srca; | 1643 | sourceFolder.Owner = source; |
1643 | srcf.Type = (short)assettype; | 1644 | sourceFolder.Type = (short)assetType; |
1644 | srcf.ParentID = iserv.GetRootFolder(srca).ID; | 1645 | sourceFolder.ParentID = inventoryService.GetRootFolder(source).ID; |
1645 | srcf.Version = 1; | 1646 | sourceFolder.Version = 1; |
1646 | iserv.AddFolder(srcf); // store base record | 1647 | inventoryService.AddFolder(sourceFolder); // store base record |
1647 | m_log.ErrorFormat("[RADMIN] Created folder for source {0}", srca); | 1648 | m_log.ErrorFormat("[RADMIN] Created folder for source {0}", source); |
1648 | } | 1649 | } |
1649 | 1650 | ||
1650 | // Missing destination folder? This should *never* be the case | 1651 | // Missing destination folder? This should *never* be the case |
1651 | if (dstf.Type != (short)assettype) | 1652 | if (destinationFolder.Type != (short)assetType) |
1652 | { | 1653 | { |
1653 | dstf = new InventoryFolderBase(); | 1654 | destinationFolder = new InventoryFolderBase(); |
1654 | dstf.ID = UUID.Random(); | 1655 | destinationFolder.ID = UUID.Random(); |
1655 | dstf.Name = assettype.ToString(); | 1656 | destinationFolder.Name = assetType.ToString(); |
1656 | dstf.Owner = dest; | 1657 | destinationFolder.Owner = destination; |
1657 | dstf.Type = (short)assettype; | 1658 | destinationFolder.Type = (short)assetType; |
1658 | dstf.ParentID = iserv.GetRootFolder(dest).ID; | 1659 | destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID; |
1659 | dstf.Version = 1; | 1660 | destinationFolder.Version = 1; |
1660 | iserv.AddFolder(dstf); // store base record | 1661 | inventoryService.AddFolder(destinationFolder); // store base record |
1661 | m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", srca); | 1662 | m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source); |
1662 | } | 1663 | } |
1663 | 1664 | ||
1664 | InventoryFolderBase efolder; | 1665 | InventoryFolderBase extraFolder; |
1665 | List<InventoryFolderBase> folders = iserv.GetFolderContent(srca, srcf.ID).Folders; | 1666 | List<InventoryFolderBase> folders = inventoryService.GetFolderContent(source, sourceFolder.ID).Folders; |
1666 | 1667 | ||
1667 | foreach (InventoryFolderBase folder in folders) | 1668 | foreach (InventoryFolderBase folder in folders) |
1668 | { | 1669 | { |
1669 | 1670 | ||
1670 | efolder = new InventoryFolderBase(); | 1671 | extraFolder = new InventoryFolderBase(); |
1671 | efolder.ID = UUID.Random(); | 1672 | extraFolder.ID = UUID.Random(); |
1672 | efolder.Name = folder.Name; | 1673 | extraFolder.Name = folder.Name; |
1673 | efolder.Owner = dest; | 1674 | extraFolder.Owner = destination; |
1674 | efolder.Type = folder.Type; | 1675 | extraFolder.Type = folder.Type; |
1675 | efolder.Version = folder.Version; | 1676 | extraFolder.Version = folder.Version; |
1676 | efolder.ParentID = dstf.ID; | 1677 | extraFolder.ParentID = destinationFolder.ID; |
1677 | iserv.AddFolder(efolder); | 1678 | inventoryService.AddFolder(extraFolder); |
1678 | 1679 | ||
1679 | m_log.DebugFormat("[RADMIN] Added folder {0} to folder {1}", efolder.ID, srcf.ID); | 1680 | m_log.DebugFormat("[RADMIN] Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID); |
1680 | 1681 | ||
1681 | List<InventoryItemBase> items = iserv.GetFolderContent(srca, folder.ID).Items; | 1682 | List<InventoryItemBase> items = inventoryService.GetFolderContent(source, folder.ID).Items; |
1682 | 1683 | ||
1683 | foreach (InventoryItemBase item in items) | 1684 | foreach (InventoryItemBase item in items) |
1684 | { | 1685 | { |
1685 | InventoryItemBase dsti = new InventoryItemBase(UUID.Random(), dest); | 1686 | InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination); |
1686 | dsti.Name = item.Name; | 1687 | destinationItem.Name = item.Name; |
1687 | dsti.Description = item.Description; | 1688 | destinationItem.Description = item.Description; |
1688 | dsti.InvType = item.InvType; | 1689 | destinationItem.InvType = item.InvType; |
1689 | dsti.CreatorId = item.CreatorId; | 1690 | destinationItem.CreatorId = item.CreatorId; |
1690 | dsti.CreatorIdAsUuid = item.CreatorIdAsUuid; | 1691 | destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid; |
1691 | dsti.NextPermissions = item.NextPermissions; | 1692 | destinationItem.NextPermissions = item.NextPermissions; |
1692 | dsti.CurrentPermissions = item.CurrentPermissions; | 1693 | destinationItem.CurrentPermissions = item.CurrentPermissions; |
1693 | dsti.BasePermissions = item.BasePermissions; | 1694 | destinationItem.BasePermissions = item.BasePermissions; |
1694 | dsti.EveryOnePermissions = item.EveryOnePermissions; | 1695 | destinationItem.EveryOnePermissions = item.EveryOnePermissions; |
1695 | dsti.GroupPermissions = item.GroupPermissions; | 1696 | destinationItem.GroupPermissions = item.GroupPermissions; |
1696 | dsti.AssetType = item.AssetType; | 1697 | destinationItem.AssetType = item.AssetType; |
1697 | dsti.AssetID = item.AssetID; | 1698 | destinationItem.AssetID = item.AssetID; |
1698 | dsti.GroupID = item.GroupID; | 1699 | destinationItem.GroupID = item.GroupID; |
1699 | dsti.GroupOwned = item.GroupOwned; | 1700 | destinationItem.GroupOwned = item.GroupOwned; |
1700 | dsti.SalePrice = item.SalePrice; | 1701 | destinationItem.SalePrice = item.SalePrice; |
1701 | dsti.SaleType = item.SaleType; | 1702 | destinationItem.SaleType = item.SaleType; |
1702 | dsti.Flags = item.Flags; | 1703 | destinationItem.Flags = item.Flags; |
1703 | dsti.CreationDate = item.CreationDate; | 1704 | destinationItem.CreationDate = item.CreationDate; |
1704 | dsti.Folder = efolder.ID; | 1705 | destinationItem.Folder = extraFolder.ID; |
1705 | 1706 | ||
1706 | iserv.AddItem(dsti); | 1707 | inventoryService.AddItem(destinationItem); |
1707 | imap.Add(item.ID, dsti.ID); | 1708 | inventoryMap.Add(item.ID, destinationItem.ID); |
1708 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, efolder.ID); | 1709 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID); |
1709 | 1710 | ||
1710 | // Attach item, if original is attached | 1711 | // Attach item, if original is attached |
1711 | int attachpoint = ava.GetAttachpoint(item.ID); | 1712 | int attachpoint = avatarAppearance.GetAttachpoint(item.ID); |
1712 | if (attachpoint != 0) | 1713 | if (attachpoint != 0) |
1713 | { | 1714 | { |
1714 | ava.SetAttachment(attachpoint, dsti.ID, dsti.AssetID); | 1715 | avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); |
1715 | m_log.DebugFormat("[RADMIN] Attached {0}", dsti.ID); | 1716 | m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); |
1716 | } | 1717 | } |
1717 | } | 1718 | } |
1718 | } | 1719 | } |
@@ -1732,59 +1733,59 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1732 | { | 1733 | { |
1733 | // Only load once | 1734 | // Only load once |
1734 | 1735 | ||
1735 | if (daload) | 1736 | if (m_defaultAvatarsLoaded) |
1736 | { | 1737 | { |
1737 | return false; | 1738 | return false; |
1738 | } | 1739 | } |
1739 | 1740 | ||
1740 | m_log.DebugFormat("[RADMIN] Creating default avatar entries"); | 1741 | m_log.DebugFormat("[RADMIN] Creating default avatar entries"); |
1741 | 1742 | ||
1742 | daload = true; | 1743 | m_defaultAvatarsLoaded = true; |
1743 | 1744 | ||
1744 | // Load processing starts here... | 1745 | // Load processing starts here... |
1745 | 1746 | ||
1746 | try | 1747 | try |
1747 | { | 1748 | { |
1748 | string dafn = null; | 1749 | string defaultAppearanceFileName = null; |
1749 | 1750 | ||
1750 | //m_config may be null if RemoteAdmin configuration secition is missing or disabled in OpenSim.ini | 1751 | //m_config may be null if RemoteAdmin configuration secition is missing or disabled in OpenSim.ini |
1751 | if (m_config != null) | 1752 | if (m_config != null) |
1752 | { | 1753 | { |
1753 | dafn = m_config.GetString("default_appearance", "default_appearance.xml"); | 1754 | defaultAppearanceFileName = m_config.GetString("default_appearance", "default_appearance.xml"); |
1754 | } | 1755 | } |
1755 | 1756 | ||
1756 | if (File.Exists(dafn)) | 1757 | if (File.Exists(defaultAppearanceFileName)) |
1757 | { | 1758 | { |
1758 | XmlDocument doc = new XmlDocument(); | 1759 | XmlDocument doc = new XmlDocument(); |
1759 | string name = "*unknown*"; | 1760 | string name = "*unknown*"; |
1760 | string email = "anon@anon"; | 1761 | string email = "anon@anon"; |
1761 | uint regX = 1000; | 1762 | uint regionXLocation = 1000; |
1762 | uint regY = 1000; | 1763 | uint regionYLocation = 1000; |
1763 | string passwd = UUID.Random().ToString(); // No requirement to sign-in. | 1764 | string password = UUID.Random().ToString(); // No requirement to sign-in. |
1764 | UUID ID = UUID.Zero; | 1765 | UUID ID = UUID.Zero; |
1765 | AvatarAppearance mava; | 1766 | AvatarAppearance avatarAppearance; |
1766 | XmlNodeList avatars; | 1767 | XmlNodeList avatars; |
1767 | XmlNodeList assets; | 1768 | XmlNodeList assets; |
1768 | XmlNode perms = null; | 1769 | XmlNode perms = null; |
1769 | bool include = false; | 1770 | bool include = false; |
1770 | bool select = false; | 1771 | bool select = false; |
1771 | 1772 | ||
1772 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 1773 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
1773 | IInventoryService iserv = scene.InventoryService; | 1774 | IInventoryService inventoryService = scene.InventoryService; |
1774 | IAssetService aserv = scene.AssetService; | 1775 | IAssetService assetService = scene.AssetService; |
1775 | 1776 | ||
1776 | doc.LoadXml(File.ReadAllText(dafn)); | 1777 | doc.LoadXml(File.ReadAllText(defaultAppearanceFileName)); |
1777 | 1778 | ||
1778 | // Load up any included assets. Duplicates will be ignored | 1779 | // Load up any included assets. Duplicates will be ignored |
1779 | assets = doc.GetElementsByTagName("RequiredAsset"); | 1780 | assets = doc.GetElementsByTagName("RequiredAsset"); |
1780 | foreach (XmlNode asset in assets) | 1781 | foreach (XmlNode assetNode in assets) |
1781 | { | 1782 | { |
1782 | AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset, "name", ""), SByte.Parse(GetStringAttribute(asset, "type", "")), UUID.Zero.ToString()); | 1783 | AssetBase asset = new AssetBase(UUID.Random(), GetStringAttribute(assetNode, "name", ""), SByte.Parse(GetStringAttribute(assetNode, "type", "")), UUID.Zero.ToString()); |
1783 | rass.Description = GetStringAttribute(asset,"desc",""); | 1784 | asset.Description = GetStringAttribute(assetNode,"desc",""); |
1784 | rass.Local = Boolean.Parse(GetStringAttribute(asset,"local","")); | 1785 | asset.Local = Boolean.Parse(GetStringAttribute(assetNode,"local","")); |
1785 | rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary","")); | 1786 | asset.Temporary = Boolean.Parse(GetStringAttribute(assetNode,"temporary","")); |
1786 | rass.Data = Convert.FromBase64String(asset.InnerText); | 1787 | asset.Data = Convert.FromBase64String(assetNode.InnerText); |
1787 | aserv.Store(rass); | 1788 | assetService.Store(asset); |
1788 | } | 1789 | } |
1789 | 1790 | ||
1790 | avatars = doc.GetElementsByTagName("Avatar"); | 1791 | avatars = doc.GetElementsByTagName("Avatar"); |
@@ -1803,19 +1804,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1803 | // Only the name value is mandatory | 1804 | // Only the name value is mandatory |
1804 | name = GetStringAttribute(avatar,"name",name); | 1805 | name = GetStringAttribute(avatar,"name",name); |
1805 | email = GetStringAttribute(avatar,"email",email); | 1806 | email = GetStringAttribute(avatar,"email",email); |
1806 | regX = GetUnsignedAttribute(avatar,"regx",regX); | 1807 | regionXLocation = GetUnsignedAttribute(avatar,"regx",regionXLocation); |
1807 | regY = GetUnsignedAttribute(avatar,"regy",regY); | 1808 | regionYLocation = GetUnsignedAttribute(avatar,"regy",regionYLocation); |
1808 | passwd = GetStringAttribute(avatar,"password",passwd); | 1809 | password = GetStringAttribute(avatar,"password",password); |
1809 | 1810 | ||
1810 | string[] nomens = name.Split(); | 1811 | string[] names = name.Split(); |
1811 | UUID scopeID = scene.RegionInfo.ScopeID; | 1812 | UUID scopeID = scene.RegionInfo.ScopeID; |
1812 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]); | 1813 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, names[0], names[1]); |
1813 | if (null == account) | 1814 | if (null == account) |
1814 | { | 1815 | { |
1815 | account = CreateUser(scopeID, nomens[0], nomens[1], passwd, email); | 1816 | account = CreateUser(scopeID, names[0], names[1], password, email); |
1816 | if (null == account) | 1817 | if (null == account) |
1817 | { | 1818 | { |
1818 | m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]); | 1819 | m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", names[0], names[1]); |
1819 | return false; | 1820 | return false; |
1820 | } | 1821 | } |
1821 | } | 1822 | } |
@@ -1823,12 +1824,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1823 | // Set home position | 1824 | // Set home position |
1824 | 1825 | ||
1825 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, | 1826 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, |
1826 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | 1827 | (int)(regionXLocation * Constants.RegionSize), (int)(regionYLocation * Constants.RegionSize)); |
1827 | if (null == home) { | 1828 | if (null == home) { |
1828 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", nomens[0], nomens[1]); | 1829 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", names[0], names[1]); |
1829 | } else { | 1830 | } else { |
1830 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | 1831 | scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); |
1831 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, nomens[0], nomens[1]); | 1832 | m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, names[0], names[1]); |
1832 | } | 1833 | } |
1833 | 1834 | ||
1834 | ID = account.PrincipalID; | 1835 | ID = account.PrincipalID; |
@@ -1850,13 +1851,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1850 | if (include) | 1851 | if (include) |
1851 | { | 1852 | { |
1852 | // Setup for appearance processing | 1853 | // Setup for appearance processing |
1853 | AvatarData adata = scene.AvatarService.GetAvatar(ID); | 1854 | AvatarData avatarData = scene.AvatarService.GetAvatar(ID); |
1854 | if (adata != null) | 1855 | if (avatarData != null) |
1855 | mava = adata.ToAvatarAppearance(ID); | 1856 | avatarAppearance = avatarData.ToAvatarAppearance(ID); |
1856 | else | 1857 | else |
1857 | mava = new AvatarAppearance(); | 1858 | avatarAppearance = new AvatarAppearance(); |
1858 | 1859 | ||
1859 | AvatarWearable[] wearables = mava.Wearables; | 1860 | AvatarWearable[] wearables = avatarAppearance.Wearables; |
1860 | for (int i=0; i<wearables.Length; i++) | 1861 | for (int i=0; i<wearables.Length; i++) |
1861 | { | 1862 | { |
1862 | wearables[i] = new AvatarWearable(); | 1863 | wearables[i] = new AvatarWearable(); |
@@ -1867,19 +1868,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1867 | // m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory", | 1868 | // m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory", |
1868 | // uic.folders.Count, uic.items.Count); | 1869 | // uic.folders.Count, uic.items.Count); |
1869 | 1870 | ||
1870 | InventoryFolderBase cfolder = iserv.GetFolderForType(ID, AssetType.Clothing); | 1871 | InventoryFolderBase clothingFolder = inventoryService.GetFolderForType(ID, AssetType.Clothing); |
1871 | 1872 | ||
1872 | // This should *never* be the case | 1873 | // This should *never* be the case |
1873 | if (cfolder == null || cfolder.Type != (short)AssetType.Clothing) | 1874 | if (clothingFolder == null || clothingFolder.Type != (short)AssetType.Clothing) |
1874 | { | 1875 | { |
1875 | cfolder = new InventoryFolderBase(); | 1876 | clothingFolder = new InventoryFolderBase(); |
1876 | cfolder.ID = UUID.Random(); | 1877 | clothingFolder.ID = UUID.Random(); |
1877 | cfolder.Name = "Clothing"; | 1878 | clothingFolder.Name = "Clothing"; |
1878 | cfolder.Owner = ID; | 1879 | clothingFolder.Owner = ID; |
1879 | cfolder.Type = (short)AssetType.Clothing; | 1880 | clothingFolder.Type = (short)AssetType.Clothing; |
1880 | cfolder.ParentID = iserv.GetRootFolder(ID).ID; | 1881 | clothingFolder.ParentID = inventoryService.GetRootFolder(ID).ID; |
1881 | cfolder.Version = 1; | 1882 | clothingFolder.Version = 1; |
1882 | iserv.AddFolder(cfolder); // store base record | 1883 | inventoryService.AddFolder(clothingFolder); // store base record |
1883 | m_log.ErrorFormat("[RADMIN] Created clothing folder for {0}/{1}", name, ID); | 1884 | m_log.ErrorFormat("[RADMIN] Created clothing folder for {0}/{1}", name, ID); |
1884 | } | 1885 | } |
1885 | 1886 | ||
@@ -1887,8 +1888,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1887 | // default appearance XMl file. | 1888 | // default appearance XMl file. |
1888 | 1889 | ||
1889 | XmlNodeList outfits = avatar.GetElementsByTagName("Ensemble"); | 1890 | XmlNodeList outfits = avatar.GetElementsByTagName("Ensemble"); |
1890 | InventoryFolderBase efolder; | 1891 | InventoryFolderBase extraFolder; |
1891 | string oname; | 1892 | string outfitName; |
1892 | UUID assetid; | 1893 | UUID assetid; |
1893 | 1894 | ||
1894 | foreach (XmlElement outfit in outfits) | 1895 | foreach (XmlElement outfit in outfits) |
@@ -1896,37 +1897,37 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1896 | m_log.DebugFormat("[RADMIN] Loading outfit {0} for {1}", | 1897 | m_log.DebugFormat("[RADMIN] Loading outfit {0} for {1}", |
1897 | GetStringAttribute(outfit,"name","?"), GetStringAttribute(avatar,"name","?")); | 1898 | GetStringAttribute(outfit,"name","?"), GetStringAttribute(avatar,"name","?")); |
1898 | 1899 | ||
1899 | oname = GetStringAttribute(outfit,"name",""); | 1900 | outfitName = GetStringAttribute(outfit,"name",""); |
1900 | select = (GetStringAttribute(outfit,"default","no") == "yes"); | 1901 | select = (GetStringAttribute(outfit,"default","no") == "yes"); |
1901 | 1902 | ||
1902 | // If the folder already exists, re-use it. The defaults may | 1903 | // If the folder already exists, re-use it. The defaults may |
1903 | // change over time. Augment only. | 1904 | // change over time. Augment only. |
1904 | 1905 | ||
1905 | List<InventoryFolderBase> folders = iserv.GetFolderContent(ID, cfolder.ID).Folders; | 1906 | List<InventoryFolderBase> folders = inventoryService.GetFolderContent(ID, clothingFolder.ID).Folders; |
1906 | efolder = null; | 1907 | extraFolder = null; |
1907 | 1908 | ||
1908 | foreach (InventoryFolderBase folder in folders) | 1909 | foreach (InventoryFolderBase folder in folders) |
1909 | { | 1910 | { |
1910 | if (folder.Name == oname) | 1911 | if (folder.Name == outfitName) |
1911 | { | 1912 | { |
1912 | efolder = folder; | 1913 | extraFolder = folder; |
1913 | break; | 1914 | break; |
1914 | } | 1915 | } |
1915 | } | 1916 | } |
1916 | 1917 | ||
1917 | // Otherwise, we must create the folder. | 1918 | // Otherwise, we must create the folder. |
1918 | if (efolder == null) | 1919 | if (extraFolder == null) |
1919 | { | 1920 | { |
1920 | m_log.DebugFormat("[RADMIN] Creating outfit folder {0} for {1}", oname, name); | 1921 | m_log.DebugFormat("[RADMIN] Creating outfit folder {0} for {1}", outfitName, name); |
1921 | efolder = new InventoryFolderBase(); | 1922 | extraFolder = new InventoryFolderBase(); |
1922 | efolder.ID = UUID.Random(); | 1923 | extraFolder.ID = UUID.Random(); |
1923 | efolder.Name = oname; | 1924 | extraFolder.Name = outfitName; |
1924 | efolder.Owner = ID; | 1925 | extraFolder.Owner = ID; |
1925 | efolder.Type = (short)AssetType.Clothing; | 1926 | extraFolder.Type = (short)AssetType.Clothing; |
1926 | efolder.Version = 1; | 1927 | extraFolder.Version = 1; |
1927 | efolder.ParentID = cfolder.ID; | 1928 | extraFolder.ParentID = clothingFolder.ID; |
1928 | iserv.AddFolder(efolder); | 1929 | inventoryService.AddFolder(extraFolder); |
1929 | m_log.DebugFormat("[RADMIN] Adding outfile folder {0} to folder {1}", efolder.ID, cfolder.ID); | 1930 | m_log.DebugFormat("[RADMIN] Adding outfile folder {0} to folder {1}", extraFolder.ID, clothingFolder.ID); |
1930 | } | 1931 | } |
1931 | 1932 | ||
1932 | // Now get the pieces that make up the outfit | 1933 | // Now get the pieces that make up the outfit |
@@ -1950,55 +1951,55 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1950 | } | 1951 | } |
1951 | } | 1952 | } |
1952 | 1953 | ||
1953 | InventoryItemBase iitem = null; | 1954 | InventoryItemBase inventoryItem = null; |
1954 | 1955 | ||
1955 | // Check if asset is in inventory already | 1956 | // Check if asset is in inventory already |
1956 | iitem = null; | 1957 | inventoryItem = null; |
1957 | List<InventoryItemBase> iitems = iserv.GetFolderContent(ID, efolder.ID).Items; | 1958 | List<InventoryItemBase> inventoryItems = inventoryService.GetFolderContent(ID, extraFolder.ID).Items; |
1958 | 1959 | ||
1959 | foreach (InventoryItemBase litem in iitems) | 1960 | foreach (InventoryItemBase listItem in inventoryItems) |
1960 | { | 1961 | { |
1961 | if (litem.AssetID == assetid) | 1962 | if (listItem.AssetID == assetid) |
1962 | { | 1963 | { |
1963 | iitem = litem; | 1964 | inventoryItem = listItem; |
1964 | break; | 1965 | break; |
1965 | } | 1966 | } |
1966 | } | 1967 | } |
1967 | 1968 | ||
1968 | // Create inventory item | 1969 | // Create inventory item |
1969 | if (iitem == null) | 1970 | if (inventoryItem == null) |
1970 | { | 1971 | { |
1971 | iitem = new InventoryItemBase(UUID.Random(), ID); | 1972 | inventoryItem = new InventoryItemBase(UUID.Random(), ID); |
1972 | iitem.Name = GetStringAttribute(item,"name",""); | 1973 | inventoryItem.Name = GetStringAttribute(item,"name",""); |
1973 | iitem.Description = GetStringAttribute(item,"desc",""); | 1974 | inventoryItem.Description = GetStringAttribute(item,"desc",""); |
1974 | iitem.InvType = GetIntegerAttribute(item,"invtype",-1); | 1975 | inventoryItem.InvType = GetIntegerAttribute(item,"invtype",-1); |
1975 | iitem.CreatorId = GetStringAttribute(item,"creatorid",""); | 1976 | inventoryItem.CreatorId = GetStringAttribute(item,"creatorid",""); |
1976 | iitem.CreatorIdAsUuid = (UUID)GetStringAttribute(item,"creatoruuid",""); | 1977 | inventoryItem.CreatorIdAsUuid = (UUID)GetStringAttribute(item,"creatoruuid",""); |
1977 | iitem.NextPermissions = GetUnsignedAttribute(perms,"next",0x7fffffff); | 1978 | inventoryItem.NextPermissions = GetUnsignedAttribute(perms,"next",0x7fffffff); |
1978 | iitem.CurrentPermissions = GetUnsignedAttribute(perms,"current",0x7fffffff); | 1979 | inventoryItem.CurrentPermissions = GetUnsignedAttribute(perms,"current",0x7fffffff); |
1979 | iitem.BasePermissions = GetUnsignedAttribute(perms,"base",0x7fffffff); | 1980 | inventoryItem.BasePermissions = GetUnsignedAttribute(perms,"base",0x7fffffff); |
1980 | iitem.EveryOnePermissions = GetUnsignedAttribute(perms,"everyone",0x7fffffff); | 1981 | inventoryItem.EveryOnePermissions = GetUnsignedAttribute(perms,"everyone",0x7fffffff); |
1981 | iitem.GroupPermissions = GetUnsignedAttribute(perms,"group",0x7fffffff); | 1982 | inventoryItem.GroupPermissions = GetUnsignedAttribute(perms,"group",0x7fffffff); |
1982 | iitem.AssetType = GetIntegerAttribute(item,"assettype",-1); | 1983 | inventoryItem.AssetType = GetIntegerAttribute(item,"assettype",-1); |
1983 | iitem.AssetID = assetid; // associated asset | 1984 | inventoryItem.AssetID = assetid; // associated asset |
1984 | iitem.GroupID = (UUID)GetStringAttribute(item,"groupid",""); | 1985 | inventoryItem.GroupID = (UUID)GetStringAttribute(item,"groupid",""); |
1985 | iitem.GroupOwned = (GetStringAttribute(item,"groupowned","false") == "true"); | 1986 | inventoryItem.GroupOwned = (GetStringAttribute(item,"groupowned","false") == "true"); |
1986 | iitem.SalePrice = GetIntegerAttribute(item,"saleprice",0); | 1987 | inventoryItem.SalePrice = GetIntegerAttribute(item,"saleprice",0); |
1987 | iitem.SaleType = (byte)GetIntegerAttribute(item,"saletype",0); | 1988 | inventoryItem.SaleType = (byte)GetIntegerAttribute(item,"saletype",0); |
1988 | iitem.Flags = GetUnsignedAttribute(item,"flags",0); | 1989 | inventoryItem.Flags = GetUnsignedAttribute(item,"flags",0); |
1989 | iitem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); | 1990 | inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); |
1990 | iitem.Folder = efolder.ID; // Parent folder | 1991 | inventoryItem.Folder = extraFolder.ID; // Parent folder |
1991 | 1992 | ||
1992 | iserv.AddItem(iitem); | 1993 | inventoryService.AddItem(inventoryItem); |
1993 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", iitem.ID, efolder.ID); | 1994 | m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID); |
1994 | } | 1995 | } |
1995 | 1996 | ||
1996 | // Attach item, if attachpoint is specified | 1997 | // Attach item, if attachpoint is specified |
1997 | int attachpoint = GetIntegerAttribute(item,"attachpoint",0); | 1998 | int attachpoint = GetIntegerAttribute(item,"attachpoint",0); |
1998 | if (attachpoint != 0) | 1999 | if (attachpoint != 0) |
1999 | { | 2000 | { |
2000 | mava.SetAttachment(attachpoint, iitem.ID, iitem.AssetID); | 2001 | avatarAppearance.SetAttachment(attachpoint, inventoryItem.ID, inventoryItem.AssetID); |
2001 | m_log.DebugFormat("[RADMIN] Attached {0}", iitem.ID); | 2002 | m_log.DebugFormat("[RADMIN] Attached {0}", inventoryItem.ID); |
2002 | } | 2003 | } |
2003 | 2004 | ||
2004 | // Record whether or not the item is to be initially worn | 2005 | // Record whether or not the item is to be initially worn |
@@ -2006,20 +2007,20 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2006 | { | 2007 | { |
2007 | if (select && (GetStringAttribute(item, "wear", "false") == "true")) | 2008 | if (select && (GetStringAttribute(item, "wear", "false") == "true")) |
2008 | { | 2009 | { |
2009 | mava.Wearables[iitem.Flags].ItemID = iitem.ID; | 2010 | avatarAppearance.Wearables[inventoryItem.Flags].ItemID = inventoryItem.ID; |
2010 | mava.Wearables[iitem.Flags].AssetID = iitem.AssetID; | 2011 | avatarAppearance.Wearables[inventoryItem.Flags].AssetID = inventoryItem.AssetID; |
2011 | } | 2012 | } |
2012 | } | 2013 | } |
2013 | catch (Exception e) | 2014 | catch (Exception e) |
2014 | { | 2015 | { |
2015 | m_log.WarnFormat("[RADMIN] Error wearing item {0} : {1}", iitem.ID, e.Message); | 2016 | m_log.WarnFormat("[RADMIN] Error wearing item {0} : {1}", inventoryItem.ID, e.Message); |
2016 | } | 2017 | } |
2017 | } // foreach item in outfit | 2018 | } // foreach item in outfit |
2018 | m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname); | 2019 | m_log.DebugFormat("[RADMIN] Outfit {0} load completed", outfitName); |
2019 | } // foreach outfit | 2020 | } // foreach outfit |
2020 | m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); | 2021 | m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); |
2021 | AvatarData adata2 = new AvatarData(mava); | 2022 | AvatarData avatarData2 = new AvatarData(avatarAppearance); |
2022 | scene.AvatarService.SetAvatar(ID, adata2); | 2023 | scene.AvatarService.SetAvatar(ID, avatarData2); |
2023 | } | 2024 | } |
2024 | catch (Exception e) | 2025 | catch (Exception e) |
2025 | { | 2026 | { |
@@ -2086,19 +2087,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2086 | XmlRpcResponse response = new XmlRpcResponse(); | 2087 | XmlRpcResponse response = new XmlRpcResponse(); |
2087 | Hashtable responseData = new Hashtable(); | 2088 | Hashtable responseData = new Hashtable(); |
2088 | 2089 | ||
2089 | lock (rslock) | 2090 | lock (m_requestLock) |
2090 | { | 2091 | { |
2091 | try | 2092 | try |
2092 | { | 2093 | { |
2093 | Hashtable requestData = (Hashtable) request.Params[0]; | 2094 | Hashtable requestData = (Hashtable) request.Params[0]; |
2094 | 2095 | ||
2095 | // check completeness | 2096 | // check completeness |
2096 | foreach (string p in new string[] {"password", "filename"}) | 2097 | foreach (string parameter in new string[] {"password", "filename"}) |
2097 | { | 2098 | { |
2098 | if (!requestData.Contains(p)) | 2099 | if (!requestData.Contains(parameter)) |
2099 | throw new Exception(String.Format("missing parameter {0}", p)); | 2100 | throw new Exception(String.Format("missing parameter {0}", parameter)); |
2100 | if (String.IsNullOrEmpty((string) requestData[p])) | 2101 | if (String.IsNullOrEmpty((string) requestData[parameter])) |
2101 | throw new Exception(String.Format("parameter {0} is empty")); | 2102 | throw new Exception(String.Format("parameter {0} is empty", parameter)); |
2102 | } | 2103 | } |
2103 | 2104 | ||
2104 | // check password | 2105 | // check password |
@@ -2110,13 +2111,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2110 | if (requestData.Contains("region_uuid")) | 2111 | if (requestData.Contains("region_uuid")) |
2111 | { | 2112 | { |
2112 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2113 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2113 | if (!m_app.SceneManager.TryGetScene(region_uuid, out scene)) | 2114 | if (!m_application.SceneManager.TryGetScene(region_uuid, out scene)) |
2114 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2115 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2115 | } | 2116 | } |
2116 | else if (requestData.Contains("region_name")) | 2117 | else if (requestData.Contains("region_name")) |
2117 | { | 2118 | { |
2118 | string region_name = (string) requestData["region_name"]; | 2119 | string region_name = (string) requestData["region_name"]; |
2119 | if (!m_app.SceneManager.TryGetScene(region_name, out scene)) | 2120 | if (!m_application.SceneManager.TryGetScene(region_name, out scene)) |
2120 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2121 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2121 | } | 2122 | } |
2122 | else throw new Exception("neither region_name nor region_uuid given"); | 2123 | else throw new Exception("neither region_name nor region_uuid given"); |
@@ -2210,13 +2211,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2210 | if (requestData.Contains("region_uuid")) | 2211 | if (requestData.Contains("region_uuid")) |
2211 | { | 2212 | { |
2212 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2213 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2213 | if (!m_app.SceneManager.TryGetScene(region_uuid, out scene)) | 2214 | if (!m_application.SceneManager.TryGetScene(region_uuid, out scene)) |
2214 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2215 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2215 | } | 2216 | } |
2216 | else if (requestData.Contains("region_name")) | 2217 | else if (requestData.Contains("region_name")) |
2217 | { | 2218 | { |
2218 | string region_name = (string) requestData["region_name"]; | 2219 | string region_name = (string) requestData["region_name"]; |
2219 | if (!m_app.SceneManager.TryGetScene(region_name, out scene)) | 2220 | if (!m_application.SceneManager.TryGetScene(region_name, out scene)) |
2220 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2221 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2221 | } | 2222 | } |
2222 | else throw new Exception("neither region_name nor region_uuid given"); | 2223 | else throw new Exception("neither region_name nor region_uuid given"); |
@@ -2227,7 +2228,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2227 | { | 2228 | { |
2228 | scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted; | 2229 | scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted; |
2229 | archiver.ArchiveRegion(filename); | 2230 | archiver.ArchiveRegion(filename); |
2230 | lock (SOLock) Monitor.Wait(SOLock,5000); | 2231 | lock (m_saveOarLock) Monitor.Wait(m_saveOarLock,5000); |
2231 | scene.EventManager.OnOarFileSaved -= RemoteAdminOarSaveCompleted; | 2232 | scene.EventManager.OnOarFileSaved -= RemoteAdminOarSaveCompleted; |
2232 | } | 2233 | } |
2233 | else | 2234 | else |
@@ -2255,7 +2256,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2255 | private void RemoteAdminOarSaveCompleted(Guid uuid, string name) | 2256 | private void RemoteAdminOarSaveCompleted(Guid uuid, string name) |
2256 | { | 2257 | { |
2257 | m_log.DebugFormat("[RADMIN] File processing complete for {0}", name); | 2258 | m_log.DebugFormat("[RADMIN] File processing complete for {0}", name); |
2258 | lock (SOLock) Monitor.Pulse(SOLock); | 2259 | lock (m_saveOarLock) Monitor.Pulse(m_saveOarLock); |
2259 | } | 2260 | } |
2260 | 2261 | ||
2261 | public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 2262 | public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
@@ -2267,7 +2268,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2267 | XmlRpcResponse response = new XmlRpcResponse(); | 2268 | XmlRpcResponse response = new XmlRpcResponse(); |
2268 | Hashtable responseData = new Hashtable(); | 2269 | Hashtable responseData = new Hashtable(); |
2269 | 2270 | ||
2270 | lock (rslock) | 2271 | lock (m_requestLock) |
2271 | { | 2272 | { |
2272 | try | 2273 | try |
2273 | { | 2274 | { |
@@ -2290,14 +2291,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2290 | if (requestData.Contains("region_uuid")) | 2291 | if (requestData.Contains("region_uuid")) |
2291 | { | 2292 | { |
2292 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2293 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2293 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2294 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2294 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2295 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2295 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2296 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2296 | } | 2297 | } |
2297 | else if (requestData.Contains("region_name")) | 2298 | else if (requestData.Contains("region_name")) |
2298 | { | 2299 | { |
2299 | string region_name = (string) requestData["region_name"]; | 2300 | string region_name = (string) requestData["region_name"]; |
2300 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2301 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2301 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2302 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2302 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2303 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2303 | } | 2304 | } |
@@ -2314,11 +2315,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2314 | switch (xml_version) | 2315 | switch (xml_version) |
2315 | { | 2316 | { |
2316 | case "1": | 2317 | case "1": |
2317 | m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new Vector3(0, 0, 0)); | 2318 | m_application.SceneManager.LoadCurrentSceneFromXml(filename, true, new Vector3(0, 0, 0)); |
2318 | break; | 2319 | break; |
2319 | 2320 | ||
2320 | case "2": | 2321 | case "2": |
2321 | m_app.SceneManager.LoadCurrentSceneFromXml2(filename); | 2322 | m_application.SceneManager.LoadCurrentSceneFromXml2(filename); |
2322 | break; | 2323 | break; |
2323 | 2324 | ||
2324 | default: | 2325 | default: |
@@ -2375,14 +2376,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2375 | if (requestData.Contains("region_uuid")) | 2376 | if (requestData.Contains("region_uuid")) |
2376 | { | 2377 | { |
2377 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2378 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2378 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2379 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2379 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2380 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2380 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2381 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2381 | } | 2382 | } |
2382 | else if (requestData.Contains("region_name")) | 2383 | else if (requestData.Contains("region_name")) |
2383 | { | 2384 | { |
2384 | string region_name = (string) requestData["region_name"]; | 2385 | string region_name = (string) requestData["region_name"]; |
2385 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2386 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2386 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2387 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2387 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2388 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2388 | } | 2389 | } |
@@ -2399,11 +2400,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2399 | switch (xml_version) | 2400 | switch (xml_version) |
2400 | { | 2401 | { |
2401 | case "1": | 2402 | case "1": |
2402 | m_app.SceneManager.SaveCurrentSceneToXml(filename); | 2403 | m_application.SceneManager.SaveCurrentSceneToXml(filename); |
2403 | break; | 2404 | break; |
2404 | 2405 | ||
2405 | case "2": | 2406 | case "2": |
2406 | m_app.SceneManager.SaveCurrentSceneToXml2(filename); | 2407 | m_application.SceneManager.SaveCurrentSceneToXml2(filename); |
2407 | break; | 2408 | break; |
2408 | 2409 | ||
2409 | default: | 2410 | default: |
@@ -2454,21 +2455,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2454 | if (requestData.Contains("region_uuid")) | 2455 | if (requestData.Contains("region_uuid")) |
2455 | { | 2456 | { |
2456 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2457 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2457 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2458 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2458 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2459 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2459 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2460 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2460 | } | 2461 | } |
2461 | else if (requestData.Contains("region_name")) | 2462 | else if (requestData.Contains("region_name")) |
2462 | { | 2463 | { |
2463 | string region_name = (string) requestData["region_name"]; | 2464 | string region_name = (string) requestData["region_name"]; |
2464 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2465 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2465 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2466 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2466 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2467 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2467 | } | 2468 | } |
2468 | else throw new Exception("neither region_name nor region_uuid given"); | 2469 | else throw new Exception("neither region_name nor region_uuid given"); |
2469 | 2470 | ||
2470 | Scene s = m_app.SceneManager.CurrentScene; | 2471 | Scene scene = m_application.SceneManager.CurrentScene; |
2471 | int health = s.GetHealth(); | 2472 | int health = scene.GetHealth(); |
2472 | responseData["health"] = health; | 2473 | responseData["health"] = health; |
2473 | 2474 | ||
2474 | response.Value = responseData; | 2475 | response.Value = responseData; |
@@ -2551,23 +2552,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2551 | if (requestData.Contains("region_uuid")) | 2552 | if (requestData.Contains("region_uuid")) |
2552 | { | 2553 | { |
2553 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2554 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2554 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2555 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2555 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2556 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2556 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2557 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2557 | } | 2558 | } |
2558 | else if (requestData.Contains("region_name")) | 2559 | else if (requestData.Contains("region_name")) |
2559 | { | 2560 | { |
2560 | string region_name = (string) requestData["region_name"]; | 2561 | string region_name = (string) requestData["region_name"]; |
2561 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2562 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2562 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2563 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2563 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2564 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2564 | } | 2565 | } |
2565 | else throw new Exception("neither region_name nor region_uuid given"); | 2566 | else throw new Exception("neither region_name nor region_uuid given"); |
2566 | 2567 | ||
2567 | Scene s = m_app.SceneManager.CurrentScene; | 2568 | Scene scene = m_application.SceneManager.CurrentScene; |
2568 | s.RegionInfo.EstateSettings.EstateAccess = new UUID[]{}; | 2569 | scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{}; |
2569 | if (s.RegionInfo.Persistent) | 2570 | if (scene.RegionInfo.Persistent) |
2570 | s.RegionInfo.EstateSettings.Save(); | 2571 | scene.RegionInfo.EstateSettings.Save(); |
2571 | } | 2572 | } |
2572 | catch (Exception e) | 2573 | catch (Exception e) |
2573 | { | 2574 | { |
@@ -2608,26 +2609,26 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2608 | if (requestData.Contains("region_uuid")) | 2609 | if (requestData.Contains("region_uuid")) |
2609 | { | 2610 | { |
2610 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2611 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2611 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2612 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2612 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2613 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2613 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2614 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2614 | } | 2615 | } |
2615 | else if (requestData.Contains("region_name")) | 2616 | else if (requestData.Contains("region_name")) |
2616 | { | 2617 | { |
2617 | string region_name = (string) requestData["region_name"]; | 2618 | string region_name = (string) requestData["region_name"]; |
2618 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2619 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2619 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2620 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2620 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2621 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2621 | } | 2622 | } |
2622 | else throw new Exception("neither region_name nor region_uuid given"); | 2623 | else throw new Exception("neither region_name nor region_uuid given"); |
2623 | 2624 | ||
2624 | int addk = 0; | 2625 | int addedUsers = 0; |
2625 | 2626 | ||
2626 | if (requestData.Contains("users")) | 2627 | if (requestData.Contains("users")) |
2627 | { | 2628 | { |
2628 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 2629 | UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
2629 | IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService; | 2630 | IUserAccountService userService = m_application.SceneManager.CurrentOrFirstScene.UserAccountService; |
2630 | Scene s = m_app.SceneManager.CurrentScene; | 2631 | Scene scene = m_application.SceneManager.CurrentScene; |
2631 | Hashtable users = (Hashtable) requestData["users"]; | 2632 | Hashtable users = (Hashtable) requestData["users"]; |
2632 | List<UUID> uuids = new List<UUID>(); | 2633 | List<UUID> uuids = new List<UUID>(); |
2633 | foreach (string name in users.Values) | 2634 | foreach (string name in users.Values) |
@@ -2637,24 +2638,24 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2637 | if (account != null) | 2638 | if (account != null) |
2638 | { | 2639 | { |
2639 | uuids.Add(account.PrincipalID); | 2640 | uuids.Add(account.PrincipalID); |
2640 | m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName); | 2641 | m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, scene.RegionInfo.RegionName); |
2641 | } | 2642 | } |
2642 | } | 2643 | } |
2643 | List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); | 2644 | List<UUID> accessControlList = new List<UUID>(scene.RegionInfo.EstateSettings.EstateAccess); |
2644 | foreach (UUID uuid in uuids) | 2645 | foreach (UUID uuid in uuids) |
2645 | { | 2646 | { |
2646 | if (!acl.Contains(uuid)) | 2647 | if (!accessControlList.Contains(uuid)) |
2647 | { | 2648 | { |
2648 | acl.Add(uuid); | 2649 | accessControlList.Add(uuid); |
2649 | addk++; | 2650 | addedUsers++; |
2650 | } | 2651 | } |
2651 | } | 2652 | } |
2652 | s.RegionInfo.EstateSettings.EstateAccess = acl.ToArray(); | 2653 | scene.RegionInfo.EstateSettings.EstateAccess = accessControlList.ToArray(); |
2653 | if (s.RegionInfo.Persistent) | 2654 | if (scene.RegionInfo.Persistent) |
2654 | s.RegionInfo.EstateSettings.Save(); | 2655 | scene.RegionInfo.EstateSettings.Save(); |
2655 | } | 2656 | } |
2656 | 2657 | ||
2657 | responseData["added"] = addk; | 2658 | responseData["added"] = addedUsers; |
2658 | } | 2659 | } |
2659 | catch (Exception e) | 2660 | catch (Exception e) |
2660 | { | 2661 | { |
@@ -2695,27 +2696,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2695 | if (requestData.Contains("region_uuid")) | 2696 | if (requestData.Contains("region_uuid")) |
2696 | { | 2697 | { |
2697 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2698 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2698 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2699 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2699 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2700 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2700 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2701 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2701 | } | 2702 | } |
2702 | else if (requestData.Contains("region_name")) | 2703 | else if (requestData.Contains("region_name")) |
2703 | { | 2704 | { |
2704 | string region_name = (string) requestData["region_name"]; | 2705 | string region_name = (string) requestData["region_name"]; |
2705 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2706 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2706 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2707 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2707 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2708 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2708 | } | 2709 | } |
2709 | else throw new Exception("neither region_name nor region_uuid given"); | 2710 | else throw new Exception("neither region_name nor region_uuid given"); |
2710 | 2711 | ||
2711 | int remk = 0; | 2712 | int removedUsers = 0; |
2712 | 2713 | ||
2713 | if (requestData.Contains("users")) | 2714 | if (requestData.Contains("users")) |
2714 | { | 2715 | { |
2715 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 2716 | UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
2716 | IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService; | 2717 | IUserAccountService userService = m_application.SceneManager.CurrentOrFirstScene.UserAccountService; |
2717 | //UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; | 2718 | //UserProfileCacheService ups = m_application.CommunicationsManager.UserProfileCacheService; |
2718 | Scene s = m_app.SceneManager.CurrentScene; | 2719 | Scene scene = m_application.SceneManager.CurrentScene; |
2719 | Hashtable users = (Hashtable) requestData["users"]; | 2720 | Hashtable users = (Hashtable) requestData["users"]; |
2720 | List<UUID> uuids = new List<UUID>(); | 2721 | List<UUID> uuids = new List<UUID>(); |
2721 | foreach (string name in users.Values) | 2722 | foreach (string name in users.Values) |
@@ -2727,21 +2728,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2727 | uuids.Add(account.PrincipalID); | 2728 | uuids.Add(account.PrincipalID); |
2728 | } | 2729 | } |
2729 | } | 2730 | } |
2730 | List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); | 2731 | List<UUID> accessControlList = new List<UUID>(scene.RegionInfo.EstateSettings.EstateAccess); |
2731 | foreach (UUID uuid in uuids) | 2732 | foreach (UUID uuid in uuids) |
2732 | { | 2733 | { |
2733 | if (acl.Contains(uuid)) | 2734 | if (accessControlList.Contains(uuid)) |
2734 | { | 2735 | { |
2735 | acl.Remove(uuid); | 2736 | accessControlList.Remove(uuid); |
2736 | remk++; | 2737 | removedUsers++; |
2737 | } | 2738 | } |
2738 | } | 2739 | } |
2739 | s.RegionInfo.EstateSettings.EstateAccess = acl.ToArray(); | 2740 | scene.RegionInfo.EstateSettings.EstateAccess = accessControlList.ToArray(); |
2740 | if (s.RegionInfo.Persistent) | 2741 | if (scene.RegionInfo.Persistent) |
2741 | s.RegionInfo.EstateSettings.Save(); | 2742 | scene.RegionInfo.EstateSettings.Save(); |
2742 | } | 2743 | } |
2743 | 2744 | ||
2744 | responseData["removed"] = remk; | 2745 | responseData["removed"] = removedUsers; |
2745 | } | 2746 | } |
2746 | catch (Exception e) | 2747 | catch (Exception e) |
2747 | { | 2748 | { |
@@ -2782,27 +2783,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2782 | if (requestData.Contains("region_uuid")) | 2783 | if (requestData.Contains("region_uuid")) |
2783 | { | 2784 | { |
2784 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 2785 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; |
2785 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) | 2786 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) |
2786 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | 2787 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
2787 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | 2788 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); |
2788 | } | 2789 | } |
2789 | else if (requestData.Contains("region_name")) | 2790 | else if (requestData.Contains("region_name")) |
2790 | { | 2791 | { |
2791 | string region_name = (string) requestData["region_name"]; | 2792 | string region_name = (string) requestData["region_name"]; |
2792 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 2793 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) |
2793 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 2794 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); |
2794 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | 2795 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); |
2795 | } | 2796 | } |
2796 | else throw new Exception("neither region_name nor region_uuid given"); | 2797 | else throw new Exception("neither region_name nor region_uuid given"); |
2797 | 2798 | ||
2798 | Scene s = m_app.SceneManager.CurrentScene; | 2799 | Scene scene = m_application.SceneManager.CurrentScene; |
2799 | UUID[] acl = s.RegionInfo.EstateSettings.EstateAccess; | 2800 | UUID[] accessControlList = scene.RegionInfo.EstateSettings.EstateAccess; |
2800 | Hashtable users = new Hashtable(); | 2801 | Hashtable users = new Hashtable(); |
2801 | 2802 | ||
2802 | foreach (UUID user in acl) | 2803 | foreach (UUID user in accessControlList) |
2803 | { | 2804 | { |
2804 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 2805 | UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
2805 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user); | 2806 | UserAccount account = m_application.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user); |
2806 | if (account != null) | 2807 | if (account != null) |
2807 | { | 2808 | { |
2808 | users[user.ToString()] = account.FirstName + " " + account.LastName; | 2809 | users[user.ToString()] = account.FirstName + " " + account.LastName; |
@@ -2830,26 +2831,26 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2830 | private static void CheckStringParameters(XmlRpcRequest request, string[] param) | 2831 | private static void CheckStringParameters(XmlRpcRequest request, string[] param) |
2831 | { | 2832 | { |
2832 | Hashtable requestData = (Hashtable) request.Params[0]; | 2833 | Hashtable requestData = (Hashtable) request.Params[0]; |
2833 | foreach (string p in param) | 2834 | foreach (string parameter in param) |
2834 | { | 2835 | { |
2835 | if (!requestData.Contains(p)) | 2836 | if (!requestData.Contains(parameter)) |
2836 | throw new Exception(String.Format("missing string parameter {0}", p)); | 2837 | throw new Exception(String.Format("missing string parameter {0}", parameter)); |
2837 | if (String.IsNullOrEmpty((string) requestData[p])) | 2838 | if (String.IsNullOrEmpty((string) requestData[parameter])) |
2838 | throw new Exception(String.Format("parameter {0} is empty", p)); | 2839 | throw new Exception(String.Format("parameter {0} is empty", parameter)); |
2839 | } | 2840 | } |
2840 | } | 2841 | } |
2841 | 2842 | ||
2842 | private static void CheckIntegerParams(XmlRpcRequest request, string[] param) | 2843 | private static void CheckIntegerParams(XmlRpcRequest request, string[] param) |
2843 | { | 2844 | { |
2844 | Hashtable requestData = (Hashtable) request.Params[0]; | 2845 | Hashtable requestData = (Hashtable) request.Params[0]; |
2845 | foreach (string p in param) | 2846 | foreach (string parameter in param) |
2846 | { | 2847 | { |
2847 | if (!requestData.Contains(p)) | 2848 | if (!requestData.Contains(parameter)) |
2848 | throw new Exception(String.Format("missing integer parameter {0}", p)); | 2849 | throw new Exception(String.Format("missing integer parameter {0}", parameter)); |
2849 | } | 2850 | } |
2850 | } | 2851 | } |
2851 | 2852 | ||
2852 | private bool GetBoolean(Hashtable requestData, string tag, bool defv) | 2853 | private bool GetBoolean(Hashtable requestData, string tag, bool defaultValue) |
2853 | { | 2854 | { |
2854 | // If an access value has been provided, apply it. | 2855 | // If an access value has been provided, apply it. |
2855 | if (requestData.Contains(tag)) | 2856 | if (requestData.Contains(tag)) |
@@ -2865,29 +2866,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2865 | case "0" : | 2866 | case "0" : |
2866 | return false; | 2867 | return false; |
2867 | default : | 2868 | default : |
2868 | return defv; | 2869 | return defaultValue; |
2869 | } | 2870 | } |
2870 | } | 2871 | } |
2871 | else | 2872 | else |
2872 | return defv; | 2873 | return defaultValue; |
2873 | } | 2874 | } |
2874 | 2875 | ||
2875 | private int GetIntegerAttribute(XmlNode node, string attr, int dv) | 2876 | private int GetIntegerAttribute(XmlNode node, string attribute, int defaultValue) |
2876 | { | 2877 | { |
2877 | try { return Convert.ToInt32(node.Attributes[attr].Value); } catch{} | 2878 | try { return Convert.ToInt32(node.Attributes[attribute].Value); } catch{} |
2878 | return dv; | 2879 | return defaultValue; |
2879 | } | 2880 | } |
2880 | 2881 | ||
2881 | private uint GetUnsignedAttribute(XmlNode node, string attr, uint dv) | 2882 | private uint GetUnsignedAttribute(XmlNode node, string attribute, uint defaultValue) |
2882 | { | 2883 | { |
2883 | try { return Convert.ToUInt32(node.Attributes[attr].Value); } catch{} | 2884 | try { return Convert.ToUInt32(node.Attributes[attribute].Value); } catch{} |
2884 | return dv; | 2885 | return defaultValue; |
2885 | } | 2886 | } |
2886 | 2887 | ||
2887 | private string GetStringAttribute(XmlNode node, string attr, string dv) | 2888 | private string GetStringAttribute(XmlNode node, string attribute, string defaultValue) |
2888 | { | 2889 | { |
2889 | try { return node.Attributes[attr].Value; } catch{} | 2890 | try { return node.Attributes[attribute].Value; } catch{} |
2890 | return dv; | 2891 | return defaultValue; |
2891 | } | 2892 | } |
2892 | 2893 | ||
2893 | public void Dispose() | 2894 | public void Dispose() |
@@ -2904,14 +2905,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2904 | /// <param name="email"></param> | 2905 | /// <param name="email"></param> |
2905 | private UserAccount CreateUser(UUID scopeID, string firstName, string lastName, string password, string email) | 2906 | private UserAccount CreateUser(UUID scopeID, string firstName, string lastName, string password, string email) |
2906 | { | 2907 | { |
2907 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 2908 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
2908 | IUserAccountService m_UserAccountService = scene.UserAccountService; | 2909 | IUserAccountService userAccountService = scene.UserAccountService; |
2909 | IGridService m_GridService = scene.GridService; | 2910 | IGridService gridService = scene.GridService; |
2910 | IAuthenticationService m_AuthenticationService = scene.AuthenticationService; | 2911 | IAuthenticationService authenticationService = scene.AuthenticationService; |
2911 | IGridUserService m_GridUserService = scene.GridUserService; | 2912 | IGridUserService gridUserService = scene.GridUserService; |
2912 | IInventoryService m_InventoryService = scene.InventoryService; | 2913 | IInventoryService inventoryService = scene.InventoryService; |
2913 | 2914 | ||
2914 | UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName); | 2915 | UserAccount account = userAccountService.GetUserAccount(scopeID, firstName, lastName); |
2915 | if (null == account) | 2916 | if (null == account) |
2916 | { | 2917 | { |
2917 | account = new UserAccount(scopeID, firstName, lastName, email); | 2918 | account = new UserAccount(scopeID, firstName, lastName, email); |
@@ -2924,26 +2925,26 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2924 | account.ServiceURLs["AssetServerURI"] = string.Empty; | 2925 | account.ServiceURLs["AssetServerURI"] = string.Empty; |
2925 | } | 2926 | } |
2926 | 2927 | ||
2927 | if (m_UserAccountService.StoreUserAccount(account)) | 2928 | if (userAccountService.StoreUserAccount(account)) |
2928 | { | 2929 | { |
2929 | bool success; | 2930 | bool success; |
2930 | if (m_AuthenticationService != null) | 2931 | if (authenticationService != null) |
2931 | { | 2932 | { |
2932 | success = m_AuthenticationService.SetPassword(account.PrincipalID, password); | 2933 | success = authenticationService.SetPassword(account.PrincipalID, password); |
2933 | if (!success) | 2934 | if (!success) |
2934 | m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", | 2935 | m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", |
2935 | firstName, lastName); | 2936 | firstName, lastName); |
2936 | } | 2937 | } |
2937 | 2938 | ||
2938 | GridRegion home = null; | 2939 | GridRegion home = null; |
2939 | if (m_GridService != null) | 2940 | if (gridService != null) |
2940 | { | 2941 | { |
2941 | List<GridRegion> defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero); | 2942 | List<GridRegion> defaultRegions = gridService.GetDefaultRegions(UUID.Zero); |
2942 | if (defaultRegions != null && defaultRegions.Count >= 1) | 2943 | if (defaultRegions != null && defaultRegions.Count >= 1) |
2943 | home = defaultRegions[0]; | 2944 | home = defaultRegions[0]; |
2944 | 2945 | ||
2945 | if (m_GridUserService != null && home != null) | 2946 | if (gridUserService != null && home != null) |
2946 | m_GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | 2947 | gridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); |
2947 | else | 2948 | else |
2948 | m_log.WarnFormat("[RADMIN]: Unable to set home for account {0} {1}.", | 2949 | m_log.WarnFormat("[RADMIN]: Unable to set home for account {0} {1}.", |
2949 | firstName, lastName); | 2950 | firstName, lastName); |
@@ -2952,9 +2953,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2952 | m_log.WarnFormat("[RADMIN]: Unable to retrieve home region for account {0} {1}.", | 2953 | m_log.WarnFormat("[RADMIN]: Unable to retrieve home region for account {0} {1}.", |
2953 | firstName, lastName); | 2954 | firstName, lastName); |
2954 | 2955 | ||
2955 | if (m_InventoryService != null) | 2956 | if (inventoryService != null) |
2956 | { | 2957 | { |
2957 | success = m_InventoryService.CreateUserInventory(account.PrincipalID); | 2958 | success = inventoryService.CreateUserInventory(account.PrincipalID); |
2958 | if (!success) | 2959 | if (!success) |
2959 | m_log.WarnFormat("[RADMIN]: Unable to create inventory for account {0} {1}.", | 2960 | m_log.WarnFormat("[RADMIN]: Unable to create inventory for account {0} {1}.", |
2960 | firstName, lastName); | 2961 | firstName, lastName); |
@@ -2981,16 +2982,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2981 | /// <param name="password"></param> | 2982 | /// <param name="password"></param> |
2982 | private bool ChangeUserPassword(string firstName, string lastName, string password) | 2983 | private bool ChangeUserPassword(string firstName, string lastName, string password) |
2983 | { | 2984 | { |
2984 | Scene scene = m_app.SceneManager.CurrentOrFirstScene; | 2985 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
2985 | IUserAccountService m_UserAccountService = scene.UserAccountService; | 2986 | IUserAccountService userAccountService = scene.UserAccountService; |
2986 | IAuthenticationService m_AuthenticationService = scene.AuthenticationService; | 2987 | IAuthenticationService authenticationService = scene.AuthenticationService; |
2987 | 2988 | ||
2988 | UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName); | 2989 | UserAccount account = userAccountService.GetUserAccount(UUID.Zero, firstName, lastName); |
2989 | if (null != account) | 2990 | if (null != account) |
2990 | { | 2991 | { |
2991 | bool success = false; | 2992 | bool success = false; |
2992 | if (m_AuthenticationService != null) | 2993 | if (authenticationService != null) |
2993 | success = m_AuthenticationService.SetPassword(account.PrincipalID, password); | 2994 | success = authenticationService.SetPassword(account.PrincipalID, password); |
2994 | if (!success) { | 2995 | if (!success) { |
2995 | m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", | 2996 | m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", |
2996 | firstName, lastName); | 2997 | firstName, lastName); |