From d541f150d083b076668fe58051da40f4e1a10871 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 2 Jun 2014 08:45:39 -0700 Subject: Added a ResetLand method to RemoteAdmin, whereby all land is reset with the given parameters. --- .../RemoteController/RemoteAdminPlugin.cs | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'OpenSim/ApplicationPlugins/RemoteController') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index e011232..b5346e1 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -162,6 +162,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList); availableMethods["admin_estate_reload"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcEstateReload); + // Land management + availableMethods["admin_reset_land"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcResetLand); + // Either enable full remote functionality or just selected features string enabledMethods = m_config.GetString("enabled_methods", "all"); @@ -2063,6 +2066,56 @@ 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"); + } + + /// /// Parse a float with the given parameter name from a request data hash table. /// -- cgit v1.1