Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2011-02-16 02:41:49 +00:00
commit ccd6e5d071
12 changed files with 116 additions and 42 deletions

View File

@ -122,9 +122,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
Thread.CurrentThread.ManagedThreadId.ToString() + Thread.CurrentThread.ManagedThreadId.ToString() +
")"); ")");
m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]); m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]);
m_openSim.CreateRegion(regionsToLoad[i], true, out scene); m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
regionsToLoad[i].EstateSettings.Save(); regionsToLoad[i].EstateSettings.Save();
if (scene != null) if (scene != null)
{ {
m_newRegionCreatedHandler = OnNewRegionCreated; m_newRegionCreatedHandler = OnNewRegionCreated;

View File

@ -29,6 +29,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Globalization;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Net.Security; using System.Net.Security;
@ -557,34 +558,27 @@ namespace OpenSim.Framework
{ {
float qx = GetQ(x); float qx = GetQ(x);
float qy = GetQ(y); float qy = GetQ(y);
if (qx < qy) return qy.CompareTo(qx); // descending order
return -1;
if (qx == qy)
return 0;
return 1;
} }
private float GetQ(Object o) private float GetQ(Object o)
{ {
// Example: image/png;q=0.9 // Example: image/png;q=0.9
float qvalue = 1F;
if (o is String) if (o is String)
{ {
string mime = (string)o; string mime = (string)o;
string[] parts = mime.Split(new char[] { ';' }); string[] parts = mime.Split(';');
if (parts.Length > 1) if (parts.Length > 1)
{ {
string[] kvp = parts[1].Split(new char[] { '=' }); string[] kvp = parts[1].Split('=');
if (kvp.Length == 2 && kvp[0] == "q") if (kvp.Length == 2 && kvp[0] == "q")
{ float.TryParse(kvp[1], NumberStyles.Number, CultureInfo.InvariantCulture, out qvalue);
float qvalue = 1F;
float.TryParse(kvp[1], out qvalue);
return qvalue;
}
} }
} }
return 1F; return qvalue;
} }
} }

View File

@ -877,9 +877,7 @@ namespace OpenSim
/// <summary> /// <summary>
/// Load the estate information for the provided RegionInfo object. /// Load the estate information for the provided RegionInfo object.
/// </summary> /// </summary>
/// <param name="regInfo"> /// <param name="regInfo"></param>
/// A <see cref="RegionInfo"/>
/// </param>
public void PopulateRegionEstateInfo(RegionInfo regInfo) public void PopulateRegionEstateInfo(RegionInfo regInfo)
{ {
IEstateDataService estateDataService = EstateDataService; IEstateDataService estateDataService = EstateDataService;
@ -901,7 +899,13 @@ namespace OpenSim
regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true); regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true);
regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
//regInfo.EstateSettings.Save();
// FIXME: Later on, the scene constructor will reload the estate settings no matter what.
// Therefore, we need to do an initial save here otherwise the new estate name will be reset
// back to the default. The reloading of estate settings by scene could be eliminated if it
// knows that the passed in settings in RegionInfo are already valid. Also, it might be
// possible to eliminate some additional later saves made by callers of this method.
regInfo.EstateSettings.Save();
break; break;
} }
else else

View File

@ -244,7 +244,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
catch (Exception e) catch (Exception e)
{ {
m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0}\n{1}", e.Message, e.StackTrace); m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0} {1}", e.Message, e.StackTrace);
sp.ControllingClient.SendTeleportFailed("Internal error"); sp.ControllingClient.SendTeleportFailed("Internal error");
} }
} }

View File

@ -30,21 +30,29 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Security; using System.Security;
using System.Text;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.World.Estate namespace OpenSim.Region.CoreModules.World.Estate
{ {
/// <summary>
/// Estate management console commands.
/// </summary>
public class EstateManagementCommands public class EstateManagementCommands
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected EstateManagementModule m_module; protected EstateManagementModule m_module;
protected Commander m_commander = new Commander("estate");
public EstateManagementCommands(EstateManagementModule module) public EstateManagementCommands(EstateManagementModule module)
{ {
m_module = module; m_module = module;
@ -52,19 +60,59 @@ namespace OpenSim.Region.CoreModules.World.Estate
public void Initialise() public void Initialise()
{ {
m_module.Scene.AddCommand(this, "set terrain texture", m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName);
m_module.Scene.AddCommand(m_module, "set terrain texture",
"set terrain texture <number> <uuid> [<x>] [<y>]", "set terrain texture <number> <uuid> [<x>] [<y>]",
"Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " + "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " +
"set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
" that coordinate.", " that coordinate.",
consoleSetTerrainTexture); consoleSetTerrainTexture);
m_module.Scene.AddCommand(this, "set terrain heights", m_module.Scene.AddCommand(m_module, "set terrain heights",
"set terrain heights <corner> <min> <max> [<x>] [<y>]", "set terrain heights <corner> <min> <max> [<x>] [<y>]",
"Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " + "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " +
"set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
" that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.",
consoleSetTerrainHeights); consoleSetTerrainHeights);
Command showCommand
= new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowEstatesCommand, "Shows all estates on the simulator.");
m_commander.RegisterCommand("show", showCommand);
m_module.Scene.RegisterModuleCommander(m_commander);
m_module.Scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
}
public void Close()
{
m_module.Scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole;
m_module.Scene.UnregisterModuleCommander(m_commander.Name);
}
/// <summary>
/// Processes commandline input. Do not call directly.
/// </summary>
/// <param name="args">Commandline arguments</param>
protected void EventManagerOnPluginConsole(string[] args)
{
if (args[0] == "estate")
{
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);
}
} }
protected void consoleSetTerrainTexture(string module, string[] args) protected void consoleSetTerrainTexture(string module, string[] args)
@ -152,5 +200,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
} }
} }
} }
protected void ShowEstatesCommand(Object[] args)
{
StringBuilder report = new StringBuilder();
RegionInfo ri = m_module.Scene.RegionInfo;
EstateSettings es = ri.EstateSettings;
report.AppendFormat("Estate information for region {0}\n", ri.RegionName);
report.AppendFormat(
"{0,-20} {1,-7} {2,-20}\n",
"Estate Name",
"ID",
"Owner");
report.AppendFormat(
"{0,-20} {1,-7} {2,-20}\n",
es.EstateName, es.EstateID, m_module.UserManager.GetUserName(es.EstateOwner));
MainConsole.Instance.Output(report.ToString());
}
} }
} }

View File

@ -32,6 +32,7 @@ using System.Reflection;
using System.Security; using System.Security;
using System.Timers; using System.Timers;
using log4net; using log4net;
using Mono.Addins;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
@ -40,7 +41,8 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.World.Estate namespace OpenSim.Region.CoreModules.World.Estate
{ {
public class EstateManagementModule : IEstateModule [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EstateManagementModule")]
public class EstateManagementModule : IEstateModule, INonSharedRegionModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -48,6 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
private Timer m_regionChangeTimer = new Timer(); private Timer m_regionChangeTimer = new Timer();
public Scene Scene { get; private set; } public Scene Scene { get; private set; }
public IUserManagement UserManager { get; private set; }
protected EstateManagementCommands m_commands; protected EstateManagementCommands m_commands;
@ -910,7 +913,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
#region IRegionModule Members #region IRegionModule Members
public void Initialise(Scene scene, IConfigSource source) public string Name { get { return "EstateManagementModule"; } }
public Type ReplaceableInterface { get { return null; } }
public void Initialise(IConfigSource source) {}
public void AddRegion(Scene scene)
{ {
m_regionChangeTimer.AutoReset = false; m_regionChangeTimer.AutoReset = false;
m_regionChangeTimer.Interval = 2000; m_regionChangeTimer.Interval = 2000;
@ -925,25 +934,20 @@ namespace OpenSim.Region.CoreModules.World.Estate
m_commands.Initialise(); m_commands.Initialise();
} }
public void PostInitialise() public void RemoveRegion(Scene scene) {}
public void RegionLoaded(Scene scene)
{ {
// Sets up the sun module based no the saved Estate and Region Settings // Sets up the sun module based no the saved Estate and Region Settings
// DO NOT REMOVE or the sun will stop working // DO NOT REMOVE or the sun will stop working
Scene.TriggerEstateSunUpdate(); scene.TriggerEstateSunUpdate();
UserManager = scene.RequestModuleInterface<IUserManagement>();
} }
public void Close() public void Close()
{ {
} m_commands.Close();
public string Name
{
get { return "EstateManagementModule"; }
}
public bool IsSharedModule
{
get { return false; }
} }
#endregion #endregion

View File

@ -32,7 +32,7 @@ namespace OpenSim.Region.Framework.Interfaces
public delegate void ChangeDelegate(UUID regionID); public delegate void ChangeDelegate(UUID regionID);
public delegate void MessageDelegate(UUID regionID, UUID fromID, string fromName, string message); public delegate void MessageDelegate(UUID regionID, UUID fromID, string fromName, string message);
public interface IEstateModule : IRegionModule public interface IEstateModule
{ {
event ChangeDelegate OnRegionInfoChange; event ChangeDelegate OnRegionInfoChange;
event ChangeDelegate OnEstateInfoChange; event ChangeDelegate OnEstateInfoChange;

View File

@ -2142,7 +2142,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
Quaternion newRot; Quaternion newRot;
if (this.LinkNum < 2) //KF Single or root prim if (this.LinkNum == 0 || this.LinkNum == 1)
{ {
newRot = RotationOffset; newRot = RotationOffset;
} }

View File

@ -711,6 +711,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// and convert the regionName to the target region // and convert the regionName to the target region
if (regionName.Contains(".") && regionName.Contains(":")) if (regionName.Contains(".") && regionName.Contains(":"))
{ {
// Even though we use none of the results, we need to perform this call because it appears
// to have some the side effect of setting up hypergrid teleport locations.
World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1);
// List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); // List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1);

View File

@ -93,7 +93,7 @@ namespace OpenSim.Services.AssetService
if (!UUID.TryParse(id, out assetID)) if (!UUID.TryParse(id, out assetID))
{ {
m_log.WarnFormat("[ASSET SERVICE]: Could not parse requested sset id {0}", id); m_log.WarnFormat("[ASSET SERVICE]: Could not parse requested asset id {0}", id);
return null; return null;
} }

Binary file not shown.

Binary file not shown.