From cfcfa8f3d70f8de714daa06912b1c6f86b2689e2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 6 Sep 2015 21:46:30 +0100 Subject: add lost admin_reset_land method --- .../RemoteController/RemoteAdminPlugin.cs | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 0c582e1..9664433 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -144,6 +144,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController availableMethods["admin_load_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadHeightmapMethod); availableMethods["admin_save_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveHeightmapMethod); + availableMethods["admin_reset_land"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcResetLand); + // Agent management availableMethods["admin_get_agents"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetAgentsMethod); availableMethods["admin_teleport_agent"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcTeleportAgentMethod); @@ -2210,6 +2212,51 @@ namespace OpenSim.ApplicationPlugins.RemoteController responseData["success"] = true; } + private void XmlRpcResetLand(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) + { + Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable responseData = (Hashtable)response.Value; + string musicURL = string.Empty; + UUID groupID = UUID.Zero; + uint flags = 0; + bool set_group = false, set_music = false, set_flags = false; + + if (requestData.Contains("group") && requestData["group"] != null) + set_group = UUID.TryParse(requestData["group"].ToString(), out groupID); + if (requestData.Contains("music") && requestData["music"] != null) + { + + musicURL = requestData["music"].ToString(); + set_music = true; + } + + if (requestData.Contains("flags") && requestData["flags"] != null) + set_flags = UInt32.TryParse(requestData["flags"].ToString(), out flags); + + m_log.InfoFormat("[RADMIN]: Received Reset Land Request group={0} musicURL={1} flags={2}", + (set_group ? groupID.ToString() : "unchanged"), + (set_music ? musicURL : "unchanged"), + (set_flags ? flags.ToString() : "unchanged")); + + m_application.SceneManager.ForEachScene(delegate (Scene s) + { + List parcels = s.LandChannel.AllParcels(); + foreach (ILandObject p in parcels) + { + if (set_music) + p.LandData.MusicURL = musicURL; + if (set_group) + p.LandData.GroupID = groupID; + if (set_flags) + p.LandData.Flags = flags; + s.LandChannel.UpdateLandObject(p.LandData.LocalID, p.LandData); + } + } + ); + responseData["success"] = true; + m_log.Info("[RADMIN]: Reset Land Request complete"); + } + private void XmlRpcRefreshSearch(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) { m_log.Info("[RADMIN]: Received Refresh Search Request"); -- cgit v1.1