diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs | 10 | ||||
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 386 |
2 files changed, 331 insertions, 65 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs b/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs index ce87400..590a6a9 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs | |||
@@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; | |||
3 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
4 | using Mono.Addins; | 4 | using Mono.Addins; |
5 | 5 | ||
6 | // General Information about an assembly is controlled through the following | 6 | // General Information about an assembly is controlled through the following |
7 | // set of attributes. Change these attribute values to modify the information | 7 | // set of attributes. Change these attribute values to modify the information |
8 | // associated with an assembly. | 8 | // associated with an assembly. |
9 | [assembly: AssemblyTitle("OpenSim.ApplicationPlugins.RemoteController")] | 9 | [assembly: AssemblyTitle("OpenSim.ApplicationPlugins.RemoteController")] |
@@ -15,8 +15,8 @@ using Mono.Addins; | |||
15 | [assembly: AssemblyTrademark("")] | 15 | [assembly: AssemblyTrademark("")] |
16 | [assembly: AssemblyCulture("")] | 16 | [assembly: AssemblyCulture("")] |
17 | 17 | ||
18 | // Setting ComVisible to false makes the types in this assembly not visible | 18 | // Setting ComVisible to false makes the types in this assembly not visible |
19 | // to COM components. If you need to access a type in this assembly from | 19 | // to COM components. If you need to access a type in this assembly from |
20 | // COM, set the ComVisible attribute to true on that type. | 20 | // COM, set the ComVisible attribute to true on that type. |
21 | [assembly: ComVisible(false)] | 21 | [assembly: ComVisible(false)] |
22 | 22 | ||
@@ -26,11 +26,11 @@ using Mono.Addins; | |||
26 | // Version information for an assembly consists of the following four values: | 26 | // Version information for an assembly consists of the following four values: |
27 | // | 27 | // |
28 | // Major Version | 28 | // Major Version |
29 | // Minor Version | 29 | // Minor Version |
30 | // Build Number | 30 | // Build Number |
31 | // Revision | 31 | // Revision |
32 | // | 32 | // |
33 | [assembly: AssemblyVersion("0.8.3.*")] | 33 | [assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)] |
34 | 34 | ||
35 | [assembly: Addin("OpenSim.ApplicationPlugins.RemoteController", OpenSim.VersionInfo.VersionNumber)] | 35 | [assembly: Addin("OpenSim.ApplicationPlugins.RemoteController", OpenSim.VersionInfo.VersionNumber)] |
36 | [assembly: AddinDependency("OpenSim", OpenSim.VersionInfo.VersionNumber)] | 36 | [assembly: AddinDependency("OpenSim", OpenSim.VersionInfo.VersionNumber)] |
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 808d9e4..84d87f1 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -74,6 +74,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
74 | 74 | ||
75 | private string m_name = "RemoteAdminPlugin"; | 75 | private string m_name = "RemoteAdminPlugin"; |
76 | private string m_version = "0.0"; | 76 | private string m_version = "0.0"; |
77 | private string m_openSimVersion; | ||
77 | 78 | ||
78 | public string Version | 79 | public string Version |
79 | { | 80 | { |
@@ -93,6 +94,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
93 | 94 | ||
94 | public void Initialise(OpenSimBase openSim) | 95 | public void Initialise(OpenSimBase openSim) |
95 | { | 96 | { |
97 | m_openSimVersion = openSim.GetVersionText(); | ||
98 | |||
96 | m_configSource = openSim.ConfigSource.Source; | 99 | m_configSource = openSim.ConfigSource.Source; |
97 | try | 100 | try |
98 | { | 101 | { |
@@ -135,10 +138,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
135 | availableMethods["admin_region_query"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRegionQueryMethod); | 138 | availableMethods["admin_region_query"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRegionQueryMethod); |
136 | availableMethods["admin_shutdown"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcShutdownMethod); | 139 | availableMethods["admin_shutdown"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcShutdownMethod); |
137 | availableMethods["admin_broadcast"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAlertMethod); | 140 | availableMethods["admin_broadcast"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAlertMethod); |
141 | availableMethods["admin_dialog"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcDialogMethod); | ||
138 | availableMethods["admin_restart"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRestartMethod); | 142 | availableMethods["admin_restart"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRestartMethod); |
139 | availableMethods["admin_load_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadHeightmapMethod); | 143 | availableMethods["admin_load_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadHeightmapMethod); |
140 | availableMethods["admin_save_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveHeightmapMethod); | 144 | availableMethods["admin_save_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveHeightmapMethod); |
141 | 145 | ||
146 | availableMethods["admin_reset_land"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcResetLand); | ||
147 | |||
142 | // Agent management | 148 | // Agent management |
143 | availableMethods["admin_get_agents"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetAgentsMethod); | 149 | availableMethods["admin_get_agents"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetAgentsMethod); |
144 | availableMethods["admin_teleport_agent"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcTeleportAgentMethod); | 150 | availableMethods["admin_teleport_agent"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcTeleportAgentMethod); |
@@ -163,8 +169,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
163 | availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList); | 169 | availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList); |
164 | availableMethods["admin_estate_reload"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcEstateReload); | 170 | availableMethods["admin_estate_reload"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcEstateReload); |
165 | 171 | ||
166 | // Land management | 172 | // Misc |
167 | availableMethods["admin_reset_land"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcResetLand); | 173 | availableMethods["admin_refresh_search"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshSearch); |
174 | availableMethods["admin_refresh_map"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshMap); | ||
175 | availableMethods["admin_get_opensim_version"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetOpenSimVersion); | ||
176 | availableMethods["admin_get_agent_count"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetAgentCount); | ||
168 | 177 | ||
169 | // Either enable full remote functionality or just selected features | 178 | // Either enable full remote functionality or just selected features |
170 | string enabledMethods = m_config.GetString("enabled_methods", "all"); | 179 | string enabledMethods = m_config.GetString("enabled_methods", "all"); |
@@ -265,32 +274,148 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
265 | 274 | ||
266 | try | 275 | try |
267 | { | 276 | { |
268 | m_log.Info("[RADMIN]: Request to restart Region."); | 277 | Scene rebootedScene = null; |
278 | bool restartAll = false; | ||
269 | 279 | ||
270 | CheckRegionParams(requestData, responseData); | 280 | IConfig startupConfig = m_configSource.Configs["Startup"]; |
281 | if (startupConfig != null) | ||
282 | { | ||
283 | if (startupConfig.GetBoolean("InworldRestartShutsDown", false)) | ||
284 | { | ||
285 | rebootedScene = m_application.SceneManager.CurrentOrFirstScene; | ||
286 | restartAll = true; | ||
287 | } | ||
288 | } | ||
271 | 289 | ||
272 | Scene rebootedScene = null; | 290 | if (rebootedScene == null) |
273 | GetSceneFromRegionParams(requestData, responseData, out rebootedScene); | 291 | { |
292 | CheckRegionParams(requestData, responseData); | ||
293 | |||
294 | GetSceneFromRegionParams(requestData, responseData, out rebootedScene); | ||
295 | } | ||
296 | |||
297 | IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>(); | ||
274 | 298 | ||
275 | responseData["success"] = false; | 299 | responseData["success"] = false; |
276 | responseData["accepted"] = true; | 300 | responseData["accepted"] = true; |
277 | responseData["rebooting"] = true; | 301 | responseData["rebooting"] = true; |
278 | 302 | ||
279 | IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>(); | 303 | string message; |
280 | if (restartModule != null) | 304 | List<int> times = new List<int>(); |
305 | |||
306 | if (requestData.ContainsKey("alerts")) | ||
281 | { | 307 | { |
282 | List<int> times = new List<int> { 30, 15 }; | 308 | string[] alertTimes = requestData["alerts"].ToString().Split( new char[] {','}); |
309 | if (alertTimes.Length == 1 && Convert.ToInt32(alertTimes[0]) == -1) | ||
310 | { | ||
311 | m_log.Info("[RADMIN]: Request to cancel restart."); | ||
283 | 312 | ||
284 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); | 313 | if (restartModule != null) |
285 | responseData["success"] = true; | 314 | { |
315 | message = "Restart has been cancelled"; | ||
316 | |||
317 | if (requestData.ContainsKey("message")) | ||
318 | message = requestData["message"].ToString(); | ||
319 | |||
320 | restartModule.AbortRestart(message); | ||
321 | |||
322 | responseData["success"] = true; | ||
323 | responseData["rebooting"] = false; | ||
324 | |||
325 | return; | ||
326 | } | ||
327 | } | ||
328 | foreach (string a in alertTimes) | ||
329 | times.Add(Convert.ToInt32(a)); | ||
330 | } | ||
331 | else | ||
332 | { | ||
333 | int timeout = 30; | ||
334 | if (requestData.ContainsKey("milliseconds")) | ||
335 | timeout = Int32.Parse(requestData["milliseconds"].ToString()) / 1000; | ||
336 | while (timeout > 0) | ||
337 | { | ||
338 | times.Add(timeout); | ||
339 | if (timeout > 300) | ||
340 | timeout -= 120; | ||
341 | else if (timeout > 30) | ||
342 | timeout -= 30; | ||
343 | else | ||
344 | timeout -= 15; | ||
345 | } | ||
346 | } | ||
347 | |||
348 | m_log.Info("[RADMIN]: Request to restart Region."); | ||
349 | |||
350 | message = "Region is restarting in {0}. Please save what you are doing and log out."; | ||
351 | |||
352 | if (requestData.ContainsKey("message")) | ||
353 | message = requestData["message"].ToString(); | ||
354 | |||
355 | bool notice = true; | ||
356 | if (requestData.ContainsKey("noticetype") | ||
357 | && ((string)requestData["noticetype"] == "dialog")) | ||
358 | { | ||
359 | notice = false; | ||
360 | } | ||
361 | |||
362 | if (startupConfig.GetBoolean("SkipDelayOnEmptyRegion", false)) | ||
363 | { | ||
364 | m_log.Info("[RADMIN]: Counting affected avatars"); | ||
365 | int agents = 0; | ||
366 | |||
367 | if (restartAll) | ||
368 | { | ||
369 | foreach (Scene s in m_application.SceneManager.Scenes) | ||
370 | { | ||
371 | foreach (ScenePresence sp in s.GetScenePresences()) | ||
372 | { | ||
373 | if (!sp.IsChildAgent && !sp.IsNPC) | ||
374 | agents++; | ||
375 | } | ||
376 | } | ||
377 | } | ||
378 | else | ||
379 | { | ||
380 | foreach (ScenePresence sp in rebootedScene.GetScenePresences()) | ||
381 | { | ||
382 | if (!sp.IsChildAgent && !sp.IsNPC) | ||
383 | agents++; | ||
384 | } | ||
385 | } | ||
386 | |||
387 | m_log.InfoFormat("[RADMIN]: Avatars in region: {0}", agents); | ||
388 | |||
389 | if (agents == 0) | ||
390 | { | ||
391 | m_log.Info("[RADMIN]: No avatars detected, shutting down without delay"); | ||
392 | |||
393 | times.Clear(); | ||
394 | times.Add(0); | ||
395 | } | ||
396 | } | ||
397 | |||
398 | List<Scene> restartList; | ||
399 | |||
400 | if (restartAll) | ||
401 | restartList = m_application.SceneManager.Scenes; | ||
402 | else | ||
403 | restartList = new List<Scene>() { rebootedScene }; | ||
404 | |||
405 | foreach (Scene s in m_application.SceneManager.Scenes) | ||
406 | { | ||
407 | restartModule = s.RequestModuleInterface<IRestartModule>(); | ||
408 | if (restartModule != null) | ||
409 | restartModule.ScheduleRestart(UUID.Zero, message, times.ToArray(), notice); | ||
286 | } | 410 | } |
411 | responseData["success"] = true; | ||
287 | } | 412 | } |
288 | catch (Exception e) | 413 | catch (Exception e) |
289 | { | 414 | { |
290 | // m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0} {1}", e.Message, e.StackTrace); | 415 | m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0} {1}", e.Message, e.StackTrace); |
291 | responseData["rebooting"] = false; | 416 | responseData["rebooting"] = false; |
292 | 417 | ||
293 | throw e; | 418 | throw; |
294 | } | 419 | } |
295 | 420 | ||
296 | m_log.Info("[RADMIN]: Restart Region request complete"); | 421 | m_log.Info("[RADMIN]: Restart Region request complete"); |
@@ -320,6 +445,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
320 | m_log.Info("[RADMIN]: Alert request complete"); | 445 | m_log.Info("[RADMIN]: Alert request complete"); |
321 | } | 446 | } |
322 | 447 | ||
448 | public void XmlRpcDialogMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) | ||
449 | { | ||
450 | Hashtable responseData = (Hashtable)response.Value; | ||
451 | |||
452 | m_log.Info("[RADMIN]: Dialog request started"); | ||
453 | |||
454 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
455 | |||
456 | string message = (string)requestData["message"]; | ||
457 | string fromuuid = (string)requestData["from"]; | ||
458 | m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); | ||
459 | |||
460 | responseData["accepted"] = true; | ||
461 | responseData["success"] = true; | ||
462 | |||
463 | m_application.SceneManager.ForEachScene( | ||
464 | delegate(Scene scene) | ||
465 | { | ||
466 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
467 | if (dialogModule != null) | ||
468 | dialogModule.SendNotificationToUsersInRegion(UUID.Zero, fromuuid, message); | ||
469 | }); | ||
470 | |||
471 | m_log.Info("[RADMIN]: Dialog request complete"); | ||
472 | } | ||
473 | |||
323 | private void XmlRpcLoadHeightmapMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) | 474 | private void XmlRpcLoadHeightmapMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) |
324 | { | 475 | { |
325 | m_log.Info("[RADMIN]: Load height maps request started"); | 476 | m_log.Info("[RADMIN]: Load height maps request started"); |
@@ -423,13 +574,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
423 | message = "Region is going down now."; | 574 | message = "Region is going down now."; |
424 | } | 575 | } |
425 | 576 | ||
426 | m_application.SceneManager.ForEachScene( | 577 | if (requestData.ContainsKey("noticetype") |
578 | && ((string) requestData["noticetype"] == "dialog")) | ||
579 | { | ||
580 | m_application.SceneManager.ForEachScene( | ||
581 | |||
427 | delegate(Scene scene) | 582 | delegate(Scene scene) |
583 | { | ||
584 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
585 | if (dialogModule != null) | ||
586 | dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message); | ||
587 | }); | ||
588 | } | ||
589 | else | ||
590 | { | ||
591 | if (!requestData.ContainsKey("noticetype") | ||
592 | || ((string)requestData["noticetype"] != "none")) | ||
593 | { | ||
594 | m_application.SceneManager.ForEachScene( | ||
595 | delegate(Scene scene) | ||
428 | { | 596 | { |
429 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | 597 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); |
430 | if (dialogModule != null) | 598 | if (dialogModule != null) |
431 | dialogModule.SendGeneralAlert(message); | 599 | dialogModule.SendGeneralAlert(message); |
432 | }); | 600 | }); |
601 | } | ||
602 | } | ||
433 | 603 | ||
434 | // Perform shutdown | 604 | // Perform shutdown |
435 | System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing | 605 | System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing |
@@ -441,7 +611,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
441 | } | 611 | } |
442 | 612 | ||
443 | responseData["success"] = true; | 613 | responseData["success"] = true; |
444 | 614 | ||
445 | m_log.Info("[RADMIN]: Shutdown Administrator Request complete"); | 615 | m_log.Info("[RADMIN]: Shutdown Administrator Request complete"); |
446 | } | 616 | } |
447 | 617 | ||
@@ -613,9 +783,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
613 | { | 783 | { |
614 | // No INI setting recorded. | 784 | // No INI setting recorded. |
615 | } | 785 | } |
616 | 786 | ||
617 | string regionIniPath; | 787 | string regionIniPath; |
618 | 788 | ||
619 | if (requestData.Contains("region_file")) | 789 | if (requestData.Contains("region_file")) |
620 | { | 790 | { |
621 | // Make sure that the file to be created is in a subdirectory of the region storage directory. | 791 | // Make sure that the file to be created is in a subdirectory of the region storage directory. |
@@ -639,7 +809,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
639 | region.RegionName.Replace(" ", "_").Replace(":", "_"). | 809 | region.RegionName.Replace(" ", "_").Replace(":", "_"). |
640 | Replace("/", "_"))); | 810 | Replace("/", "_"))); |
641 | } | 811 | } |
642 | 812 | ||
643 | m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", | 813 | m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", |
644 | region.RegionID, regionIniPath); | 814 | region.RegionID, regionIniPath); |
645 | region.SaveRegionToFile("dynamic region", regionIniPath); | 815 | region.SaveRegionToFile("dynamic region", regionIniPath); |
@@ -648,9 +818,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
648 | { | 818 | { |
649 | region.Persistent = false; | 819 | region.Persistent = false; |
650 | } | 820 | } |
651 | 821 | ||
652 | // Set the estate | 822 | // Set the estate |
653 | 823 | ||
654 | // Check for an existing estate | 824 | // Check for an existing estate |
655 | List<int> estateIDs = m_application.EstateDataService.GetEstates((string) requestData["estate_name"]); | 825 | List<int> estateIDs = m_application.EstateDataService.GetEstates((string) requestData["estate_name"]); |
656 | if (estateIDs.Count < 1) | 826 | if (estateIDs.Count < 1) |
@@ -661,12 +831,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
661 | // ok, client wants us to use an explicit UUID | 831 | // ok, client wants us to use an explicit UUID |
662 | // regardless of what the avatar name provided | 832 | // regardless of what the avatar name provided |
663 | userID = new UUID((string) requestData["estate_owner_uuid"]); | 833 | userID = new UUID((string) requestData["estate_owner_uuid"]); |
664 | 834 | ||
665 | // Check that the specified user exists | 835 | // Check that the specified user exists |
666 | Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene; | 836 | Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene; |
667 | IUserAccountService accountService = currentOrFirst.UserAccountService; | 837 | IUserAccountService accountService = currentOrFirst.UserAccountService; |
668 | UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, userID); | 838 | UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, userID); |
669 | 839 | ||
670 | if (user == null) | 840 | if (user == null) |
671 | throw new Exception("Specified user was not found."); | 841 | throw new Exception("Specified user was not found."); |
672 | } | 842 | } |
@@ -675,23 +845,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
675 | // We need to look up the UUID for the avatar with the provided name. | 845 | // We need to look up the UUID for the avatar with the provided name. |
676 | string ownerFirst = (string) requestData["estate_owner_first"]; | 846 | string ownerFirst = (string) requestData["estate_owner_first"]; |
677 | string ownerLast = (string) requestData["estate_owner_last"]; | 847 | string ownerLast = (string) requestData["estate_owner_last"]; |
678 | 848 | ||
679 | Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene; | 849 | Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene; |
680 | IUserAccountService accountService = currentOrFirst.UserAccountService; | 850 | IUserAccountService accountService = currentOrFirst.UserAccountService; |
681 | UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, | 851 | UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, |
682 | ownerFirst, ownerLast); | 852 | ownerFirst, ownerLast); |
683 | 853 | ||
684 | // Check that the specified user exists | 854 | // Check that the specified user exists |
685 | if (user == null) | 855 | if (user == null) |
686 | throw new Exception("Specified user was not found."); | 856 | throw new Exception("Specified user was not found."); |
687 | 857 | ||
688 | userID = user.PrincipalID; | 858 | userID = user.PrincipalID; |
689 | } | 859 | } |
690 | else | 860 | else |
691 | { | 861 | { |
692 | throw new Exception("Estate owner details not provided."); | 862 | throw new Exception("Estate owner details not provided."); |
693 | } | 863 | } |
694 | 864 | ||
695 | // Create a new estate with the name provided | 865 | // Create a new estate with the name provided |
696 | region.EstateSettings = m_application.EstateDataService.CreateNewEstate(); | 866 | region.EstateSettings = m_application.EstateDataService.CreateNewEstate(); |
697 | 867 | ||
@@ -718,7 +888,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
718 | throw new Exception("Failed to join estate."); | 888 | throw new Exception("Failed to join estate."); |
719 | } | 889 | } |
720 | } | 890 | } |
721 | 891 | ||
722 | // Create the region and perform any initial initialization | 892 | // Create the region and perform any initial initialization |
723 | 893 | ||
724 | IScene newScene; | 894 | IScene newScene; |
@@ -1025,7 +1195,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1025 | 1195 | ||
1026 | // Set home position | 1196 | // Set home position |
1027 | 1197 | ||
1028 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, | 1198 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, |
1029 | (int)Util.RegionToWorldLoc(regionXLocation), (int)Util.RegionToWorldLoc(regionYLocation)); | 1199 | (int)Util.RegionToWorldLoc(regionXLocation), (int)Util.RegionToWorldLoc(regionYLocation)); |
1030 | if (null == home) | 1200 | if (null == home) |
1031 | { | 1201 | { |
@@ -1255,7 +1425,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1255 | 1425 | ||
1256 | if ((null != regionXLocation) && (null != regionYLocation)) | 1426 | if ((null != regionXLocation) && (null != regionYLocation)) |
1257 | { | 1427 | { |
1258 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, | 1428 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, |
1259 | (int)Util.RegionToWorldLoc((uint)regionXLocation), (int)Util.RegionToWorldLoc((uint)regionYLocation)); | 1429 | (int)Util.RegionToWorldLoc((uint)regionXLocation), (int)Util.RegionToWorldLoc((uint)regionYLocation)); |
1260 | if (null == home) { | 1430 | if (null == home) { |
1261 | m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstName, lastName); | 1431 | m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstName, lastName); |
@@ -1282,7 +1452,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1282 | 1452 | ||
1283 | throw e; | 1453 | throw e; |
1284 | } | 1454 | } |
1285 | 1455 | ||
1286 | m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); | 1456 | m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); |
1287 | } | 1457 | } |
1288 | } | 1458 | } |
@@ -1474,7 +1644,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1474 | GetSceneFromRegionParams(requestData, responseData, out scene); | 1644 | GetSceneFromRegionParams(requestData, responseData, out scene); |
1475 | 1645 | ||
1476 | string filename = (string) requestData["filename"]; | 1646 | string filename = (string) requestData["filename"]; |
1477 | 1647 | ||
1478 | bool mergeOar = false; | 1648 | bool mergeOar = false; |
1479 | bool skipAssets = false; | 1649 | bool skipAssets = false; |
1480 | 1650 | ||
@@ -1488,7 +1658,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1488 | } | 1658 | } |
1489 | 1659 | ||
1490 | IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>(); | 1660 | IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>(); |
1491 | Dictionary<string, object> archiveOptions = new Dictionary<string,object>(); | 1661 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); |
1492 | if (mergeOar) archiveOptions.Add("merge", null); | 1662 | if (mergeOar) archiveOptions.Add("merge", null); |
1493 | if (skipAssets) archiveOptions.Add("skipAssets", null); | 1663 | if (skipAssets) archiveOptions.Add("skipAssets", null); |
1494 | if (archiver != null) | 1664 | if (archiver != null) |
@@ -1601,7 +1771,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1601 | scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted; | 1771 | scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted; |
1602 | 1772 | ||
1603 | m_log.InfoFormat( | 1773 | m_log.InfoFormat( |
1604 | "[RADMIN]: Submitting save OAR request for {0} to file {1}, request ID {2}", | 1774 | "[RADMIN]: Submitting save OAR request for {0} to file {1}, request ID {2}", |
1605 | scene.Name, filename, requestId); | 1775 | scene.Name, filename, requestId); |
1606 | 1776 | ||
1607 | archiver.ArchiveRegion(filename, requestId, options); | 1777 | archiver.ArchiveRegion(filename, requestId, options); |
@@ -1748,21 +1918,31 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1748 | 1918 | ||
1749 | private void XmlRpcRegionQueryMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) | 1919 | private void XmlRpcRegionQueryMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) |
1750 | { | 1920 | { |
1751 | m_log.Info("[RADMIN]: Received Query XML Administrator Request"); | ||
1752 | |||
1753 | Hashtable responseData = (Hashtable)response.Value; | 1921 | Hashtable responseData = (Hashtable)response.Value; |
1754 | Hashtable requestData = (Hashtable)request.Params[0]; | 1922 | Hashtable requestData = (Hashtable)request.Params[0]; |
1755 | 1923 | ||
1924 | int flags = 0; | ||
1925 | string text = String.Empty; | ||
1926 | int health = 0; | ||
1927 | responseData["success"] = true; | ||
1928 | |||
1756 | CheckRegionParams(requestData, responseData); | 1929 | CheckRegionParams(requestData, responseData); |
1757 | 1930 | ||
1758 | Scene scene = null; | 1931 | Scene scene = null; |
1759 | GetSceneFromRegionParams(requestData, responseData, out scene); | 1932 | try |
1760 | 1933 | { | |
1761 | int health = scene.GetHealth(); | 1934 | GetSceneFromRegionParams(requestData, responseData, out scene); |
1762 | responseData["health"] = health; | 1935 | health = scene.GetHealth(out flags, out text); |
1936 | } | ||
1937 | catch (Exception e) | ||
1938 | { | ||
1939 | responseData["error"] = null; | ||
1940 | } | ||
1763 | 1941 | ||
1764 | responseData["success"] = true; | 1942 | responseData["success"] = true; |
1765 | m_log.Info("[RADMIN]: Query XML Administrator Request complete"); | 1943 | responseData["health"] = health; |
1944 | responseData["flags"] = flags; | ||
1945 | responseData["message"] = text; | ||
1766 | } | 1946 | } |
1767 | 1947 | ||
1768 | private void XmlRpcConsoleCommandMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) | 1948 | private void XmlRpcConsoleCommandMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) |
@@ -1938,8 +2118,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1938 | Hashtable responseData = (Hashtable)response.Value; | 2118 | Hashtable responseData = (Hashtable)response.Value; |
1939 | // Hashtable requestData = (Hashtable)request.Params[0]; | 2119 | // Hashtable requestData = (Hashtable)request.Params[0]; |
1940 | 2120 | ||
1941 | m_application.SceneManager.ForEachScene(s => | 2121 | m_application.SceneManager.ForEachScene(s => |
1942 | s.RegionInfo.EstateSettings = m_application.EstateDataService.LoadEstateSettings(s.RegionInfo.RegionID, false) | 2122 | s.RegionInfo.EstateSettings = m_application.EstateDataService.LoadEstateSettings(s.RegionInfo.RegionID, false) |
1943 | ); | 2123 | ); |
1944 | 2124 | ||
1945 | responseData["success"] = true; | 2125 | responseData["success"] = true; |
@@ -2071,7 +2251,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2071 | { | 2251 | { |
2072 | Hashtable requestData = (Hashtable)request.Params[0]; | 2252 | Hashtable requestData = (Hashtable)request.Params[0]; |
2073 | Hashtable responseData = (Hashtable)response.Value; | 2253 | Hashtable responseData = (Hashtable)response.Value; |
2074 | |||
2075 | string musicURL = string.Empty; | 2254 | string musicURL = string.Empty; |
2076 | UUID groupID = UUID.Zero; | 2255 | UUID groupID = UUID.Zero; |
2077 | uint flags = 0; | 2256 | uint flags = 0; |
@@ -2081,41 +2260,129 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2081 | set_group = UUID.TryParse(requestData["group"].ToString(), out groupID); | 2260 | set_group = UUID.TryParse(requestData["group"].ToString(), out groupID); |
2082 | if (requestData.Contains("music") && requestData["music"] != null) | 2261 | if (requestData.Contains("music") && requestData["music"] != null) |
2083 | { | 2262 | { |
2263 | |||
2084 | musicURL = requestData["music"].ToString(); | 2264 | musicURL = requestData["music"].ToString(); |
2085 | set_music = true; | 2265 | set_music = true; |
2086 | } | 2266 | } |
2267 | |||
2087 | if (requestData.Contains("flags") && requestData["flags"] != null) | 2268 | if (requestData.Contains("flags") && requestData["flags"] != null) |
2088 | set_flags = UInt32.TryParse(requestData["flags"].ToString(), out flags); | 2269 | set_flags = UInt32.TryParse(requestData["flags"].ToString(), out flags); |
2089 | 2270 | ||
2090 | m_log.InfoFormat("[RADMIN]: Received Reset Land Request group={0} musicURL={1} flags={2}", | 2271 | m_log.InfoFormat("[RADMIN]: Received Reset Land Request group={0} musicURL={1} flags={2}", |
2091 | (set_group ? groupID.ToString() : "unchanged"), | 2272 | (set_group ? groupID.ToString() : "unchanged"), |
2092 | (set_music ? musicURL : "unchanged"), | 2273 | (set_music ? musicURL : "unchanged"), |
2093 | (set_flags ? flags.ToString() : "unchanged")); | 2274 | (set_flags ? flags.ToString() : "unchanged")); |
2094 | 2275 | ||
2095 | m_application.SceneManager.ForEachScene(delegate(Scene s) | 2276 | m_application.SceneManager.ForEachScene(delegate (Scene s) |
2096 | { | 2277 | { |
2097 | List<ILandObject> parcels = s.LandChannel.AllParcels(); | 2278 | List<ILandObject> parcels = s.LandChannel.AllParcels(); |
2098 | foreach (ILandObject p in parcels) | 2279 | foreach (ILandObject p in parcels) |
2099 | { | 2280 | { |
2100 | if (set_music) | 2281 | if (set_music) |
2101 | p.LandData.MusicURL = musicURL; | 2282 | p.LandData.MusicURL = musicURL; |
2102 | |||
2103 | if (set_group) | 2283 | if (set_group) |
2104 | p.LandData.GroupID = groupID; | 2284 | p.LandData.GroupID = groupID; |
2105 | |||
2106 | if (set_flags) | 2285 | if (set_flags) |
2107 | p.LandData.Flags = flags; | 2286 | p.LandData.Flags = flags; |
2108 | |||
2109 | s.LandChannel.UpdateLandObject(p.LandData.LocalID, p.LandData); | 2287 | s.LandChannel.UpdateLandObject(p.LandData.LocalID, p.LandData); |
2110 | } | 2288 | } |
2111 | } | 2289 | } |
2112 | ); | 2290 | ); |
2291 | responseData["success"] = true; | ||
2292 | m_log.Info("[RADMIN]: Reset Land Request complete"); | ||
2293 | } | ||
2294 | |||
2295 | private void XmlRpcRefreshSearch(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) | ||
2296 | { | ||
2297 | m_log.Info("[RADMIN]: Received Refresh Search Request"); | ||
2298 | |||
2299 | Hashtable responseData = (Hashtable)response.Value; | ||
2300 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
2301 | |||
2302 | CheckRegionParams(requestData, responseData); | ||
2303 | |||
2304 | Scene scene = null; | ||
2305 | GetSceneFromRegionParams(requestData, responseData, out scene); | ||
2306 | |||
2307 | ISearchModule searchModule = scene.RequestModuleInterface<ISearchModule>(); | ||
2308 | if (searchModule != null) | ||
2309 | { | ||
2310 | searchModule.Refresh(); | ||
2311 | responseData["success"] = true; | ||
2312 | } | ||
2313 | else | ||
2314 | { | ||
2315 | responseData["success"] = false; | ||
2316 | } | ||
2113 | 2317 | ||
2318 | m_log.Info("[RADMIN]: Refresh Search Request complete"); | ||
2319 | } | ||
2320 | |||
2321 | private void XmlRpcRefreshMap(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) | ||
2322 | { | ||
2323 | m_log.Info("[RADMIN]: Received Refresh Map Request"); | ||
2324 | |||
2325 | Hashtable responseData = (Hashtable)response.Value; | ||
2326 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
2327 | |||
2328 | CheckRegionParams(requestData, responseData); | ||
2329 | |||
2330 | Scene scene = null; | ||
2331 | GetSceneFromRegionParams(requestData, responseData, out scene); | ||
2332 | |||
2333 | IMapImageUploadModule mapTileModule = scene.RequestModuleInterface<IMapImageUploadModule>(); | ||
2334 | if (mapTileModule != null) | ||
2335 | { | ||
2336 | Util.FireAndForget((x) => | ||
2337 | { | ||
2338 | mapTileModule.UploadMapTile(scene); | ||
2339 | }); | ||
2340 | responseData["success"] = true; | ||
2341 | } | ||
2342 | else | ||
2343 | { | ||
2344 | responseData["success"] = false; | ||
2345 | } | ||
2346 | |||
2347 | m_log.Info("[RADMIN]: Refresh Map Request complete"); | ||
2348 | } | ||
2349 | |||
2350 | private void XmlRpcGetOpenSimVersion(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) | ||
2351 | { | ||
2352 | m_log.Info("[RADMIN]: Received Get OpenSim Version Request"); | ||
2353 | |||
2354 | Hashtable responseData = (Hashtable)response.Value; | ||
2355 | |||
2356 | responseData["version"] = m_openSimVersion; | ||
2114 | responseData["success"] = true; | 2357 | responseData["success"] = true; |
2115 | 2358 | ||
2116 | m_log.Info("[RADMIN]: Reset Land Request complete"); | 2359 | m_log.Info("[RADMIN]: Get OpenSim Version Request complete"); |
2117 | } | 2360 | } |
2118 | 2361 | ||
2362 | private void XmlRpcGetAgentCount(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) | ||
2363 | { | ||
2364 | m_log.Info("[RADMIN]: Received Get Agent Count Request"); | ||
2365 | |||
2366 | Hashtable responseData = (Hashtable)response.Value; | ||
2367 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
2368 | |||
2369 | CheckRegionParams(requestData, responseData); | ||
2370 | |||
2371 | Scene scene = null; | ||
2372 | GetSceneFromRegionParams(requestData, responseData, out scene); | ||
2373 | |||
2374 | if (scene == null) | ||
2375 | { | ||
2376 | responseData["success"] = false; | ||
2377 | } | ||
2378 | else | ||
2379 | { | ||
2380 | responseData["count"] = scene.GetRootAgentCount(); | ||
2381 | responseData["success"] = true; | ||
2382 | } | ||
2383 | |||
2384 | m_log.Info("[RADMIN]: Get Agent Count Request complete"); | ||
2385 | } | ||
2119 | 2386 | ||
2120 | /// <summary> | 2387 | /// <summary> |
2121 | /// Parse a float with the given parameter name from a request data hash table. | 2388 | /// Parse a float with the given parameter name from a request data hash table. |
@@ -2584,7 +2851,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2584 | if (destinationFolder.Type != (short)FolderType.Clothing) | 2851 | if (destinationFolder.Type != (short)FolderType.Clothing) |
2585 | { | 2852 | { |
2586 | destinationFolder = new InventoryFolderBase(); | 2853 | destinationFolder = new InventoryFolderBase(); |
2587 | 2854 | ||
2588 | destinationFolder.ID = UUID.Random(); | 2855 | destinationFolder.ID = UUID.Random(); |
2589 | destinationFolder.Name = "Clothing"; | 2856 | destinationFolder.Name = "Clothing"; |
2590 | destinationFolder.Owner = destination; | 2857 | destinationFolder.Owner = destination; |
@@ -2605,8 +2872,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2605 | if (wearable[0].ItemID != UUID.Zero) | 2872 | if (wearable[0].ItemID != UUID.Zero) |
2606 | { | 2873 | { |
2607 | // Get inventory item and copy it | 2874 | // Get inventory item and copy it |
2608 | InventoryItemBase item = new InventoryItemBase(wearable[0].ItemID, source); | 2875 | InventoryItemBase item = inventoryService.GetItem(source, wearable[0].ItemID); |
2609 | item = inventoryService.GetItem(item); | ||
2610 | 2876 | ||
2611 | if (item != null) | 2877 | if (item != null) |
2612 | { | 2878 | { |
@@ -2659,8 +2925,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2659 | if (itemID != UUID.Zero) | 2925 | if (itemID != UUID.Zero) |
2660 | { | 2926 | { |
2661 | // Get inventory item and copy it | 2927 | // Get inventory item and copy it |
2662 | InventoryItemBase item = new InventoryItemBase(itemID, source); | 2928 | InventoryItemBase item = inventoryService.GetItem(source, itemID); |
2663 | item = inventoryService.GetItem(item); | ||
2664 | 2929 | ||
2665 | if (item != null) | 2930 | if (item != null) |
2666 | { | 2931 | { |
@@ -2722,11 +2987,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2722 | { | 2987 | { |
2723 | sourceFolder = new InventoryFolderBase(); | 2988 | sourceFolder = new InventoryFolderBase(); |
2724 | sourceFolder.ID = UUID.Random(); | 2989 | sourceFolder.ID = UUID.Random(); |
2725 | if (assetType == FolderType.Clothing) | 2990 | if (assetType == FolderType.Clothing) |
2726 | { | 2991 | { |
2727 | sourceFolder.Name = "Clothing"; | 2992 | sourceFolder.Name = "Clothing"; |
2728 | } | 2993 | } |
2729 | else | 2994 | else |
2730 | { | 2995 | { |
2731 | sourceFolder.Name = "Body Parts"; | 2996 | sourceFolder.Name = "Body Parts"; |
2732 | } | 2997 | } |
@@ -2873,6 +3138,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2873 | if (File.Exists(defaultAppearanceFileName)) | 3138 | if (File.Exists(defaultAppearanceFileName)) |
2874 | { | 3139 | { |
2875 | XmlDocument doc = new XmlDocument(); | 3140 | XmlDocument doc = new XmlDocument(); |
3141 | doc.XmlResolver=null; | ||
2876 | string name = "*unknown*"; | 3142 | string name = "*unknown*"; |
2877 | string email = "anon@anon"; | 3143 | string email = "anon@anon"; |
2878 | uint regionXLocation = 1000; | 3144 | uint regionXLocation = 1000; |
@@ -2939,7 +3205,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2939 | 3205 | ||
2940 | // Set home position | 3206 | // Set home position |
2941 | 3207 | ||
2942 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, | 3208 | GridRegion home = scene.GridService.GetRegionByPosition(scopeID, |
2943 | (int)Util.RegionToWorldLoc(regionXLocation), (int)Util.RegionToWorldLoc(regionYLocation)); | 3209 | (int)Util.RegionToWorldLoc(regionXLocation), (int)Util.RegionToWorldLoc(regionYLocation)); |
2944 | if (null == home) { | 3210 | if (null == home) { |
2945 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", names[0], names[1]); | 3211 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", names[0], names[1]); |