mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Merge branch 'master' into careminster
Conflicts: .gitignore OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs prebuild.xml runprebuild.bat
This commit is contained in:
@@ -366,7 +366,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UUID agentId = (sp.ControllingClient == null) ? (UUID)null : sp.ControllingClient.AgentId;
|
||||
UUID agentId = (sp.ControllingClient == null) ? default(UUID) : sp.ControllingClient.AgentId;
|
||||
m_log.ErrorFormat("[ATTACHMENTS MODULE]: Unable to rez attachment with itemID {0}, assetID {1}, point {2} for {3}: {4}\n{5}",
|
||||
attach.ItemID, attach.AssetID, attachmentPt, agentId, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
item.CreatorId = ospResolvedId.ToString();
|
||||
item.CreatorData = string.Empty;
|
||||
}
|
||||
else if (item.CreatorData == null || item.CreatorData == String.Empty)
|
||||
else if (string.IsNullOrEmpty(item.CreatorData))
|
||||
{
|
||||
item.CreatorId = m_userInfo.PrincipalID.ToString();
|
||||
// item.CreatorIdAsUuid = new UUID(item.CreatorId);
|
||||
@@ -522,7 +522,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
foreach (SceneObjectGroup sog in sceneObjects)
|
||||
foreach (SceneObjectPart sop in sog.Parts)
|
||||
if (sop.CreatorData == null || sop.CreatorData == "")
|
||||
if (string.IsNullOrEmpty(sop.CreatorData))
|
||||
sop.CreatorID = m_creatorIdForAssetId[assetId];
|
||||
|
||||
if (coa != null)
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
|
||||
private void AdjustIdentifiers(AssetMetadata meta)
|
||||
{
|
||||
if (meta.CreatorID != null && meta.CreatorID != string.Empty)
|
||||
if (!string.IsNullOrEmpty(meta.CreatorID))
|
||||
{
|
||||
UUID uuid = UUID.Zero;
|
||||
UUID.TryParse(meta.CreatorID, out uuid);
|
||||
|
||||
@@ -466,7 +466,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
return userdata.ServerURLs[serverType].ToString();
|
||||
}
|
||||
|
||||
if (userdata.HomeURL != null && userdata.HomeURL != string.Empty)
|
||||
if (!string.IsNullOrEmpty(userdata.HomeURL))
|
||||
{
|
||||
//m_log.DebugFormat(
|
||||
// "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}",
|
||||
@@ -552,7 +552,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
|
||||
if (oldUser != null)
|
||||
{
|
||||
if (creatorData == null || creatorData == String.Empty)
|
||||
if (string.IsNullOrEmpty(creatorData))
|
||||
{
|
||||
//ignore updates without creator data
|
||||
return;
|
||||
|
||||
@@ -500,9 +500,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||
Request.Headers.Add(HttpCustomHeaders[i],
|
||||
HttpCustomHeaders[i+1]);
|
||||
}
|
||||
if (proxyurl != null && proxyurl.Length > 0)
|
||||
if (!string.IsNullOrEmpty(proxyurl))
|
||||
{
|
||||
if (proxyexcepts != null && proxyexcepts.Length > 0)
|
||||
if (!string.IsNullOrEmpty(proxyexcepts))
|
||||
{
|
||||
string[] elist = proxyexcepts.Split(';');
|
||||
Request.Proxy = new WebProxy(proxyurl, true, elist);
|
||||
@@ -520,7 +520,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||
Request.Headers[entry.Key] = entry.Value;
|
||||
|
||||
// Encode outbound data
|
||||
if (OutboundBody.Length > 0)
|
||||
if (!string.IsNullOrEmpty(OutboundBody))
|
||||
{
|
||||
byte[] data = Util.UTF8.GetBytes(OutboundBody);
|
||||
|
||||
|
||||
@@ -161,9 +161,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
||||
{
|
||||
WebRequest request = HttpWebRequest.Create(url);
|
||||
|
||||
if (m_proxyurl != null && m_proxyurl.Length > 0)
|
||||
if (!string.IsNullOrEmpty(m_proxyurl))
|
||||
{
|
||||
if (m_proxyexcepts != null && m_proxyexcepts.Length > 0)
|
||||
if (!string.IsNullOrEmpty(m_proxyexcepts))
|
||||
{
|
||||
string[] elist = m_proxyexcepts.Split(';');
|
||||
request.Proxy = new WebProxy(m_proxyurl, true, elist);
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string dtText
|
||||
= "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://localhost/shouldnotexist.png";
|
||||
= "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://0.0.0.0/shouldnotexist.png";
|
||||
|
||||
SetupScene(false);
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
||||
@@ -307,7 +307,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string dtText
|
||||
= "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://localhost/shouldnotexist.png";
|
||||
= "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://0.0.0.0/shouldnotexist.png";
|
||||
|
||||
SetupScene(true);
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
||||
|
||||
@@ -677,7 +677,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
||||
// if not, use as method name
|
||||
UUID parseUID;
|
||||
string mName = "llRemoteData";
|
||||
if ((Channel != null) && (Channel != ""))
|
||||
if (!string.IsNullOrEmpty(Channel))
|
||||
if (!UUID.TryParse(Channel, out parseUID))
|
||||
mName = Channel;
|
||||
else
|
||||
|
||||
@@ -259,7 +259,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||
if (sp == null)
|
||||
{
|
||||
inventoryURL = UserManagementModule.GetUserServerURL(userID, "InventoryServerURI");
|
||||
if (inventoryURL != null && inventoryURL != string.Empty)
|
||||
if (!string.IsNullOrEmpty(inventoryURL))
|
||||
{
|
||||
inventoryURL = inventoryURL.Trim(new char[] { '/' });
|
||||
m_InventoryURLs.Add(userID, inventoryURL);
|
||||
|
||||
@@ -464,7 +464,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
// or creator data is present. Otherwise, use the estate owner instead.
|
||||
foreach (SceneObjectPart part in sceneObject.Parts)
|
||||
{
|
||||
if (part.CreatorData == null || part.CreatorData == string.Empty)
|
||||
if (string.IsNullOrEmpty(part.CreatorData))
|
||||
{
|
||||
if (!ResolveUserUuid(scene, part.CreatorID))
|
||||
part.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
|
||||
@@ -515,7 +515,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
|
||||
}
|
||||
|
||||
if (kvp.Value.CreatorData == null || kvp.Value.CreatorData == string.Empty)
|
||||
if (string.IsNullOrEmpty(kvp.Value.CreatorData))
|
||||
{
|
||||
if (!ResolveUserUuid(scene, kvp.Value.CreatorID))
|
||||
kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
|
||||
|
||||
@@ -42,7 +42,6 @@ using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
@@ -70,7 +69,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
private LandChannel landChannel;
|
||||
private Scene m_scene;
|
||||
protected Commander m_commander = new Commander("land");
|
||||
|
||||
protected IUserManagement m_userManager;
|
||||
protected IPrimCountModule m_primCountModule;
|
||||
@@ -148,14 +146,13 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
|
||||
m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan;
|
||||
m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
|
||||
m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
|
||||
|
||||
lock (m_scene)
|
||||
{
|
||||
m_scene.LandChannel = (ILandChannel)landChannel;
|
||||
}
|
||||
|
||||
InstallInterfaces();
|
||||
RegisterCommands();
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
@@ -167,34 +164,15 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
// TODO: Also release other event manager listeners here
|
||||
|
||||
m_scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole;
|
||||
m_scene.UnregisterModuleCommander(m_commander.Name);
|
||||
// TODO: Release event manager listeners here
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes commandline input. Do not call directly.
|
||||
/// </summary>
|
||||
/// <param name="args">Commandline arguments</param>
|
||||
protected void EventManagerOnPluginConsole(string[] args)
|
||||
{
|
||||
if (args[0] == "land")
|
||||
{
|
||||
if (args.Length == 1)
|
||||
{
|
||||
m_commander.ProcessConsoleCommand("help", new string[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
string[] tmpArgs = new string[args.Length - 2];
|
||||
int i;
|
||||
for (i = 2; i < args.Length; i++)
|
||||
tmpArgs[i - 2] = args[i];
|
||||
|
||||
m_commander.ProcessConsoleCommand(args[1], tmpArgs);
|
||||
}
|
||||
}
|
||||
// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason)
|
||||
// {
|
||||
// ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y);
|
||||
// reason = "You are not allowed to enter this sim.";
|
||||
// return nearestParcel != null;
|
||||
// }
|
||||
|
||||
void EventManagerOnNewClient(IClientAPI client)
|
||||
{
|
||||
@@ -1946,43 +1924,84 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel.");
|
||||
}
|
||||
|
||||
protected void InstallInterfaces()
|
||||
protected void RegisterCommands()
|
||||
{
|
||||
Command clearCommand
|
||||
= new Command("clear", CommandIntentions.COMMAND_HAZARDOUS, ClearCommand, "Clears all the parcels from the region.");
|
||||
Command showCommand
|
||||
= new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the region.");
|
||||
ICommands commands = MainConsole.Instance.Commands;
|
||||
|
||||
m_commander.RegisterCommand("clear", clearCommand);
|
||||
m_commander.RegisterCommand("show", showCommand);
|
||||
commands.AddCommand(
|
||||
"Land", false, "land clear",
|
||||
"land clear",
|
||||
"Clear all the parcels from the region.",
|
||||
"Command will ask for confirmation before proceeding.",
|
||||
HandleClearCommand);
|
||||
|
||||
// Add this to our scene so scripts can call these functions
|
||||
m_scene.RegisterModuleCommander(m_commander);
|
||||
commands.AddCommand(
|
||||
"Land", false, "land show",
|
||||
"land show [<local-land-id>]",
|
||||
"Show information about the parcels on the region.",
|
||||
"If no local land ID is given, then summary information about all the parcels is shown.\n"
|
||||
+ "If a local land ID is given then full information about that parcel is shown.",
|
||||
HandleShowCommand);
|
||||
}
|
||||
|
||||
protected void ClearCommand(Object[] args)
|
||||
protected void HandleClearCommand(string module, string[] args)
|
||||
{
|
||||
if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
|
||||
return;
|
||||
|
||||
string response = MainConsole.Instance.CmdPrompt(
|
||||
string.Format(
|
||||
"Are you sure that you want to clear all land parcels from {0} (y or n)",
|
||||
m_scene.RegionInfo.RegionName),
|
||||
"Are you sure that you want to clear all land parcels from {0} (y or n)", m_scene.Name),
|
||||
"n");
|
||||
|
||||
if (response.ToLower() == "y")
|
||||
{
|
||||
Clear(true);
|
||||
MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName);
|
||||
MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("Aborting clear of all parcels from {0}", m_scene.RegionInfo.RegionName);
|
||||
MainConsole.Instance.OutputFormat("Aborting clear of all parcels from {0}", m_scene.Name);
|
||||
}
|
||||
}
|
||||
|
||||
protected void ShowParcelsCommand(Object[] args)
|
||||
protected void HandleShowCommand(string module, string[] args)
|
||||
{
|
||||
StringBuilder report = new StringBuilder();
|
||||
|
||||
if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
|
||||
return;
|
||||
|
||||
StringBuilder report = new StringBuilder();
|
||||
|
||||
if (args.Length <= 2)
|
||||
{
|
||||
AppendParcelsSummaryReport(report);
|
||||
}
|
||||
else
|
||||
{
|
||||
int landLocalId;
|
||||
|
||||
if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[2], out landLocalId))
|
||||
return;
|
||||
|
||||
ILandObject lo;
|
||||
|
||||
lock (m_landList)
|
||||
{
|
||||
if (!m_landList.TryGetValue(landLocalId, out lo))
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("No parcel found with local ID {0}", landLocalId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AppendParcelReport(report, lo);
|
||||
}
|
||||
|
||||
MainConsole.Instance.Output(report.ToString());
|
||||
}
|
||||
|
||||
private void AppendParcelsSummaryReport(StringBuilder report)
|
||||
{
|
||||
report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName);
|
||||
report.AppendFormat(
|
||||
"{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
|
||||
@@ -2028,6 +2047,69 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AppendParcelReport(StringBuilder report, ILandObject lo)
|
||||
{
|
||||
LandData ld = lo.LandData;
|
||||
|
||||
ConsoleDisplayList cdl = new ConsoleDisplayList();
|
||||
cdl.AddRow("Parcel name", ld.Name);
|
||||
cdl.AddRow("Local ID", ld.LocalID);
|
||||
cdl.AddRow("Description", ld.Description);
|
||||
cdl.AddRow("Snapshot ID", ld.SnapshotID);
|
||||
cdl.AddRow("Area", ld.Area);
|
||||
cdl.AddRow("Starts", lo.StartPoint);
|
||||
cdl.AddRow("Ends", lo.EndPoint);
|
||||
cdl.AddRow("AABB Min", ld.AABBMin);
|
||||
cdl.AddRow("AABB Max", ld.AABBMax);
|
||||
|
||||
cdl.AddRow("Owner", m_userManager.GetUserName(ld.OwnerID));
|
||||
cdl.AddRow("Is group owned?", ld.IsGroupOwned);
|
||||
cdl.AddRow("GroupID", ld.GroupID);
|
||||
|
||||
cdl.AddRow("Status", ld.Status);
|
||||
cdl.AddRow("Flags", (ParcelFlags)ld.Flags);
|
||||
|
||||
cdl.AddRow("Landing Type", (LandingType)ld.LandingType);
|
||||
cdl.AddRow("User Location", ld.UserLocation);
|
||||
cdl.AddRow("User look at", ld.UserLookAt);
|
||||
|
||||
cdl.AddRow("Other clean time", ld.OtherCleanTime);
|
||||
|
||||
cdl.AddRow("Max Prims", lo.GetParcelMaxPrimCount());
|
||||
IPrimCounts pc = lo.PrimCounts;
|
||||
cdl.AddRow("Owner Prims", pc.Owner);
|
||||
cdl.AddRow("Group Prims", pc.Group);
|
||||
cdl.AddRow("Other Prims", pc.Others);
|
||||
cdl.AddRow("Selected Prims", pc.Selected);
|
||||
cdl.AddRow("Total Prims", pc.Total);
|
||||
|
||||
cdl.AddRow("Music URL", ld.MusicURL);
|
||||
cdl.AddRow("Obscure Music", ld.ObscureMusic);
|
||||
|
||||
cdl.AddRow("Media ID", ld.MediaID);
|
||||
cdl.AddRow("Media Autoscale", Convert.ToBoolean(ld.MediaAutoScale));
|
||||
cdl.AddRow("Media URL", ld.MediaURL);
|
||||
cdl.AddRow("Media Type", ld.MediaType);
|
||||
cdl.AddRow("Media Description", ld.MediaDescription);
|
||||
cdl.AddRow("Media Width", ld.MediaWidth);
|
||||
cdl.AddRow("Media Height", ld.MediaHeight);
|
||||
cdl.AddRow("Media Loop", ld.MediaLoop);
|
||||
cdl.AddRow("Obscure Media", ld.ObscureMedia);
|
||||
|
||||
cdl.AddRow("Parcel Category", ld.Category);
|
||||
|
||||
cdl.AddRow("Claim Date", ld.ClaimDate);
|
||||
cdl.AddRow("Claim Price", ld.ClaimPrice);
|
||||
cdl.AddRow("Pass Hours", ld.PassHours);
|
||||
cdl.AddRow("Pass Price", ld.PassPrice);
|
||||
|
||||
cdl.AddRow("Auction ID", ld.AuctionID);
|
||||
cdl.AddRow("Authorized Buyer ID", ld.AuthBuyerID);
|
||||
cdl.AddRow("Sale Price", ld.SalePrice);
|
||||
|
||||
cdl.AddToStringBuilder(report);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user