* Rolled back a few changes.

0.6.0-stable
Adam Frisby 2008-05-01 18:04:42 +00:00
parent 138e612300
commit 20a9bf08f5
117 changed files with 5079 additions and 4982 deletions

View File

@ -68,7 +68,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
for (int i = 0; i < regionsToLoad.Length; i++) for (int i = 0; i < regionsToLoad.Length; i++)
{ {
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId + m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() +
")"); ")");
openSim.CreateRegion(regionsToLoad[i], true); openSim.CreateRegion(regionsToLoad[i], true);
} }
@ -106,7 +106,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
if (regionhandle == regionsToLoad[i].RegionHandle) if (regionhandle == regionsToLoad[i].RegionHandle)
{ {
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
Thread.CurrentThread.ManagedThreadId + ")"); Thread.CurrentThread.ManagedThreadId.ToString() + ")");
openSim.CreateRegion(regionsToLoad[i], true); openSim.CreateRegion(regionsToLoad[i], true);
} }
} }

View File

@ -54,8 +54,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
private BaseHttpServer m_httpd; private BaseHttpServer m_httpd;
private string requiredPassword = String.Empty; private string requiredPassword = String.Empty;
#region IApplicationPlugin Members
public void Initialise(OpenSimMain openSim) public void Initialise(OpenSimMain openSim)
{ {
try try
@ -84,12 +82,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
} }
} }
public void Close()
{
}
#endregion
public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
@ -98,9 +90,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
m_log.Info("[RADMIN]: Request to restart Region."); m_log.Info("[RADMIN]: Request to restart Region.");
try try {
{ checkStringParameters(request, new string[] { "password", "regionID" });
checkStringParameters(request, new[] {"password", "regionID"});
if (requiredPassword != String.Empty && if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
@ -119,7 +110,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
responseData["rebooting"] = "true"; responseData["rebooting"] = "true";
rebootedScene.Restart(30); rebootedScene.Restart(30);
} }
catch (Exception e) catch(Exception e)
{ {
m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message); m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message);
m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString()); m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString());
@ -139,9 +130,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
try try {
{ checkStringParameters(request, new string[] { "password", "message" });
checkStringParameters(request, new[] {"password", "message"});
if (requiredPassword != String.Empty && if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
@ -155,7 +145,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
m_app.SceneManager.SendGeneralMessage(message); m_app.SceneManager.SendGeneralMessage(message);
} }
catch (Exception e) catch(Exception e)
{ {
m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message); m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString()); m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
@ -172,25 +162,24 @@ namespace OpenSim.ApplicationPlugins.RemoteController
public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request) public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString()); m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString());
foreach (string k in requestData.Keys) foreach (string k in requestData.Keys)
{ {
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}", m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}",
k, requestData[k], ((string) requestData[k]).Length); k, (string)requestData[k], ((string)requestData[k]).Length);
} }
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
try try {
{ checkStringParameters(request, new string[] { "password", "filename", "regionid"});
checkStringParameters(request, new[] {"password", "filename", "regionid"});
if (requiredPassword != String.Empty && if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword))
throw new Exception("wrong password"); throw new Exception("wrong password");
string file = (string) requestData["filename"]; string file = (string)requestData["filename"];
LLUUID regionID = (string) requestData["regionid"]; LLUUID regionID = (string) requestData["regionid"];
m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file); m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file);
@ -228,8 +217,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
try try {
{
if (requiredPassword != String.Empty && if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
throw new Exception("wrong password"); throw new Exception("wrong password");
@ -244,7 +232,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
requestData.ContainsKey("milliseconds")) requestData.ContainsKey("milliseconds"))
{ {
timeout = (Int32) requestData["milliseconds"]; timeout = (Int32) requestData["milliseconds"];
m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((timeout / 1000)) + m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() +
" second(s). Please save what you are doing and log out."); " second(s). Please save what you are doing and log out.");
} }
else else
@ -255,7 +243,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// Perform shutdown // Perform shutdown
Timer shutdownTimer = new Timer(timeout); // Wait before firing Timer shutdownTimer = new Timer(timeout); // Wait before firing
shutdownTimer.AutoReset = false; shutdownTimer.AutoReset = false;
shutdownTimer.Elapsed += shutdownTimer_Elapsed; shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
shutdownTimer.Start(); shutdownTimer.Start();
responseData["success"] = "true"; responseData["success"] = "true";
@ -286,7 +274,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
if (!requestData.Contains(p)) if (!requestData.Contains(p))
throw new Exception(String.Format("missing string parameter {0}", p)); throw new Exception(String.Format("missing string parameter {0}", p));
if (String.IsNullOrEmpty((string) requestData[p])) if (String.IsNullOrEmpty((string)requestData[p]))
throw new Exception(String.Format("parameter {0} is empty", p)); throw new Exception(String.Format("parameter {0} is empty", p));
} }
} }
@ -357,27 +345,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
try try {
{ checkStringParameters(request, new string[] { "password",
checkStringParameters(request, new[]
{
"password",
"region_name", "region_name",
"region_master_first", "region_master_last", "region_master_first", "region_master_last",
"region_master_password", "region_master_password",
"listen_ip", "external_address" "listen_ip", "external_address"});
}); checkIntegerParams(request, new string[] { "region_x", "region_y", "listen_port"});
checkIntegerParams(request, new[] {"region_x", "region_y", "listen_port"});
// check password // check password
if (!String.IsNullOrEmpty(requiredPassword) && if (!String.IsNullOrEmpty(requiredPassword) &&
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password"); (string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
// extract or generate region ID now // extract or generate region ID now
Scene scene = null; Scene scene = null;
LLUUID regionID = LLUUID.Zero; LLUUID regionID = LLUUID.Zero;
if (requestData.ContainsKey("region_id") && if (requestData.ContainsKey("region_id") &&
!String.IsNullOrEmpty((string) requestData["region_id"])) !String.IsNullOrEmpty((string)requestData["region_id"]))
{ {
regionID = (string) requestData["region_id"]; regionID = (string) requestData["region_id"];
if (m_app.SceneManager.TryGetScene(regionID, out scene)) if (m_app.SceneManager.TryGetScene(regionID, out scene))
@ -435,14 +419,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
region.MasterAvatarLastName = (string) requestData["region_master_last"]; region.MasterAvatarLastName = (string) requestData["region_master_last"];
region.MasterAvatarSandboxPassword = (string) requestData["region_master_password"]; region.MasterAvatarSandboxPassword = (string) requestData["region_master_password"];
bool persist = Convert.ToBoolean((string) requestData["persist"]); bool persist = Convert.ToBoolean((string)requestData["persist"]);
if (persist) if (persist)
{ {
string regionConfigPath = Path.Combine(Path.Combine(Util.configDir(), "Regions"), string regionConfigPath = Path.Combine(Path.Combine(Util.configDir(), "Regions"),
String.Format("{0}x{1}-{2}.xml", String.Format("{0}x{1}-{2}.xml",
region.RegionLocX, region.RegionLocX.ToString(),
region.RegionLocY, region.RegionLocY.ToString(),
regionID)); regionID.ToString()));
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
region.RegionID, regionConfigPath); region.RegionID, regionConfigPath);
region.SaveRegionToFile("dynamic region", regionConfigPath); region.SaveRegionToFile("dynamic region", regionConfigPath);
@ -516,23 +500,20 @@ namespace OpenSim.ApplicationPlugins.RemoteController
try try
{ {
// check completeness // check completeness
checkStringParameters(request, new[] checkStringParameters(request, new string[] { "password", "user_firstname",
{ "user_lastname", "user_password" });
"password", "user_firstname", checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" });
"user_lastname", "user_password"
});
checkIntegerParams(request, new[] {"start_region_x", "start_region_y"});
// check password // check password
if (!String.IsNullOrEmpty(requiredPassword) && if (!String.IsNullOrEmpty(requiredPassword) &&
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password"); (string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
// do the job // do the job
string firstname = (string) requestData["user_firstname"]; string firstname = (string) requestData["user_firstname"];
string lastname = (string) requestData["user_lastname"]; string lastname = (string) requestData["user_lastname"];
string passwd = (string) requestData["user_password"]; string passwd = (string) requestData["user_password"];
uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
if (null != userProfile) if (null != userProfile)
@ -540,8 +521,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
LLUUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY); LLUUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY);
if (userID == LLUUID.Zero) if (userID == LLUUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
throw new Exception(String.Format("failed to create new user {0} {1}",
firstname, lastname)); firstname, lastname));
responseData["success"] = "true"; responseData["success"] = "true";
@ -576,29 +556,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController
try try
{ {
// check completeness // check completeness
foreach (string p in new[] {"password", "filename"}) foreach (string p in new string[] { "password", "filename" })
{ {
if (!requestData.Contains(p)) if (!requestData.Contains(p))
throw new Exception(String.Format("missing parameter {0}", p)); throw new Exception(String.Format("missing parameter {0}", p));
if (String.IsNullOrEmpty((string) requestData[p])) if (String.IsNullOrEmpty((string)requestData[p]))
throw new Exception(String.Format("parameter {0} is empty")); throw new Exception(String.Format("parameter {0} is empty"));
} }
// check password // check password
if (!String.IsNullOrEmpty(requiredPassword) && if (!String.IsNullOrEmpty(requiredPassword) &&
(string) requestData["password"] != requiredPassword) throw new Exception("wrong password"); (string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
string filename = (string) requestData["filename"]; string filename = (string)requestData["filename"];
if (requestData.Contains("region_uuid")) if (requestData.Contains("region_uuid"))
{ {
LLUUID region_uuid = (string) requestData["region_uuid"]; LLUUID region_uuid = (string)requestData["region_uuid"];
if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) if (!m_app.SceneManager.TrySetCurrentScene(region_uuid))
throw new Exception(String.Format("failed to switch to region {0}", region_uuid)); throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
} }
else if (requestData.Contains("region_name")) else if (requestData.Contains("region_name"))
{ {
string region_name = (string) requestData["region_name"]; string region_name = (string)requestData["region_name"];
if (!m_app.SceneManager.TrySetCurrentScene(region_name)) if (!m_app.SceneManager.TrySetCurrentScene(region_name))
throw new Exception(String.Format("failed to switch to region {0}", region_name)); throw new Exception(String.Format("failed to switch to region {0}", region_name));
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
@ -626,5 +606,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
return response; return response;
} }
public void Close()
{
}
} }
} }

View File

@ -70,7 +70,7 @@ namespace OpenSim.Data.MSSQL
override public AssetBase FetchAsset(LLUUID assetID) override public AssetBase FetchAsset(LLUUID assetID)
{ {
AssetBase asset; AssetBase asset = null;
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
param["id"] = assetID.ToString(); param["id"] = assetID.ToString();

View File

@ -46,48 +46,14 @@ namespace OpenSim.Grid.AssetServer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public AssetConfig m_config;
public static OpenAsset_Main assetserver; public static OpenAsset_Main assetserver;
// Temporarily hardcoded - should be a plugin // Temporarily hardcoded - should be a plugin
protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
private IAssetProvider m_assetProvider; private IAssetProvider m_assetProvider;
public AssetConfig m_config;
public OpenAsset_Main()
{
m_console = new ConsoleBase("OpenAsset", this);
MainConsole.Instance = m_console;
}
#region conscmd_callback Members
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice(
@"shutdown - shutdown this asset server (USE CAUTION!)
stats - statistical information for this server");
break;
case "stats":
m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report());
break;
case "shutdown":
m_console.Close();
Environment.Exit(0);
break;
}
}
#endregion
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
@ -112,6 +78,13 @@ namespace OpenSim.Grid.AssetServer
} }
} }
public OpenAsset_Main()
{
m_console = new ConsoleBase("OpenAsset", this);
MainConsole.Instance = m_console;
}
public void Startup() public void Startup()
{ {
m_config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml"))); m_config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml")));
@ -187,7 +160,7 @@ namespace OpenSim.Grid.AssetServer
catch (Exception e) catch (Exception e)
{ {
m_log.Warn("[ASSET]: setupDB() - Exception occured"); m_log.Warn("[ASSET]: setupDB() - Exception occured");
m_log.Warn("[ASSET]: " + e); m_log.Warn("[ASSET]: " + e.ToString());
} }
} }
@ -200,5 +173,29 @@ namespace OpenSim.Grid.AssetServer
{ {
m_assetProvider.CreateAsset(asset); m_assetProvider.CreateAsset(asset);
} }
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice(
@"shutdown - shutdown this asset server (USE CAUTION!)
stats - statistical information for this server");
break;
case "stats":
m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report());
break;
case "shutdown":
m_console.Close();
Environment.Exit(0);
break;
}
}
} }
} }

View File

@ -43,8 +43,8 @@ namespace OpenSim.Grid.AssetServer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly IAssetProvider m_assetProvider;
private OpenAsset_Main m_assetManager; private OpenAsset_Main m_assetManager;
private IAssetProvider m_assetProvider;
/// <summary> /// <summary>
/// Constructor. /// Constructor.
@ -64,7 +64,7 @@ namespace OpenSim.Grid.AssetServer
string param = GetParam(path); string param = GetParam(path);
byte[] result = new byte[] {}; byte[] result = new byte[] {};
string[] p = param.Split(new[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
if (p.Length > 0) if (p.Length > 0)
{ {
@ -99,7 +99,7 @@ namespace OpenSim.Grid.AssetServer
"[REST]: GET:/asset found {0} with name {1}, size {2} bytes", "[REST]: GET:/asset found {0} with name {1}, size {2} bytes",
assetID, asset.Name, result.Length); assetID, asset.Name, result.Length);
Array.Resize(ref result, (int) ms.Length); Array.Resize<byte>(ref result, (int) ms.Length);
} }
else else
{ {
@ -118,15 +118,8 @@ namespace OpenSim.Grid.AssetServer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly IAssetProvider m_assetProvider;
private OpenAsset_Main m_assetManager; private OpenAsset_Main m_assetManager;
private IAssetProvider m_assetProvider;
public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider)
: base("POST", "/assets")
{
m_assetManager = assetManager;
m_assetProvider = assetProvider;
}
public override byte[] Handle(string path, Stream request) public override byte[] Handle(string path, Stream request)
{ {
@ -146,5 +139,12 @@ namespace OpenSim.Grid.AssetServer
return new byte[] {}; return new byte[] {};
} }
public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider)
: base("POST", "/assets")
{
m_assetManager = assetManager;
m_assetProvider = assetProvider;
}
} }
} }

View File

@ -44,11 +44,11 @@ namespace OpenSim.Grid.GridServer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
// This is here so that the grid server can hand out MessageServer settings to regions on registration // This is here so that the grid server can hand out MessageServer settings to regions on registration
private readonly List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>(); private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
private readonly Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
public GridConfig Config; public GridConfig Config;
@ -72,7 +72,7 @@ namespace OpenSim.Grid.GridServer
if (typeInterface != null) if (typeInterface != null)
{ {
IGridData plug = IGridData plug =
(IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise(); plug.Initialise();
_plugins.Add(plug.getName(), plug); _plugins.Add(plug.getName(), plug);
m_log.Info("[DATA]: Added IGridData Interface"); m_log.Info("[DATA]: Added IGridData Interface");
@ -84,7 +84,7 @@ namespace OpenSim.Grid.GridServer
if (typeInterface != null) if (typeInterface != null)
{ {
ILogData plug = ILogData plug =
(ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise(); plug.Initialise();
_logplugins.Add(plug.getName(), plug); _logplugins.Add(plug.getName(), plug);
m_log.Info("[DATA]: Added ILogData Interface"); m_log.Info("[DATA]: Added ILogData Interface");
@ -152,7 +152,7 @@ namespace OpenSim.Grid.GridServer
} }
catch catch
{ {
m_log.Warn("[storage]: Unable to find region " + handle + " via " + kvp.Key); m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + kvp.Key);
} }
} }
return null; return null;
@ -218,20 +218,20 @@ namespace OpenSim.Grid.GridServer
{ {
if ( if (
GetRegion( GetRegion(
Util.UIntsToLong((uint) ((central_region.regionLocX + x) * Constants.RegionSize), Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize),
(uint) (central_region.regionLocY + y) * Constants.RegionSize)) != null) (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null)
{ {
neighbour = neighbour =
GetRegion( GetRegion(
Util.UIntsToLong((uint) ((central_region.regionLocX + x) * Constants.RegionSize), Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize),
(uint) (central_region.regionLocY + y) * Constants.RegionSize)); (uint)(central_region.regionLocY + y) * Constants.RegionSize));
response += "<neighbour>"; response += "<neighbour>";
response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
response += "<sim_port>" + neighbour.serverPort + "</sim_port>"; response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
response += "<locx>" + neighbour.regionLocX + "</locx>"; response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>";
response += "<locy>" + neighbour.regionLocY + "</locy>"; response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>";
response += "<regionhandle>" + neighbour.regionHandle + "</regionhandle>"; response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>";
response += "</neighbour>"; response += "</neighbour>";
} }
} }
@ -287,10 +287,10 @@ namespace OpenSim.Grid.GridServer
RegionProfileData sim; RegionProfileData sim;
RegionProfileData existingSim; RegionProfileData existingSim;
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
LLUUID uuid; LLUUID uuid;
if (!requestData.ContainsKey("UUID") || !LLUUID.TryParse((string) requestData["UUID"], out uuid)) if (!requestData.ContainsKey("UUID") || !LLUUID.TryParse((string)requestData["UUID"], out uuid))
{ {
m_log.Info("[GRID]: Region connected without a UUID, ignoring."); m_log.Info("[GRID]: Region connected without a UUID, ignoring.");
return ErrorResponse("No UUID passed to grid server - unable to connect you"); return ErrorResponse("No UUID passed to grid server - unable to connect you");
@ -303,7 +303,7 @@ namespace OpenSim.Grid.GridServer
catch (FormatException e) catch (FormatException e)
{ {
m_log.Info("[GRID]: Invalid login parameters, ignoring."); m_log.Info("[GRID]: Invalid login parameters, ignoring.");
return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e); return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString() );
} }
existingSim = GetRegion(sim.regionHandle); existingSim = GetRegion(sim.regionHandle);
@ -329,7 +329,7 @@ namespace OpenSim.Grid.GridServer
{ {
DataResponse insertResponse; DataResponse insertResponse;
if (existingSim == null) if( existingSim == null )
{ {
insertResponse = kvp.Value.AddProfile(sim); insertResponse = kvp.Value.AddProfile(sim);
} }
@ -360,8 +360,8 @@ namespace OpenSim.Grid.GridServer
catch (Exception e) catch (Exception e)
{ {
m_log.Warn("[storage]: " + m_log.Warn("[storage]: " +
"Unable to add region " + sim.UUID + " via " + kvp.Key); "Unable to add region " + sim.UUID.ToString() + " via " + kvp.Key);
m_log.Warn("[storage]: " + e); m_log.Warn("[storage]: " + e.ToString());
} }
} }
@ -375,8 +375,7 @@ namespace OpenSim.Grid.GridServer
{ {
m_log.Warn("[grid]: Authentication failed when trying to add new region " + sim.regionName + m_log.Warn("[grid]: Authentication failed when trying to add new region " + sim.regionName +
" at location " + sim.regionLocX + " at location " + sim.regionLocX +
" " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + Config.SimSendKey + " " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + Config.SimSendKey + ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") ");
") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") ");
} }
else else
{ {
@ -390,8 +389,7 @@ namespace OpenSim.Grid.GridServer
} }
else else
{ {
m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName);
" currently occupied by " + existingSim.regionName);
return ErrorResponse("Another region already exists at that location. Try another"); return ErrorResponse("Another region already exists at that location. Try another");
} }
} }
@ -466,7 +464,7 @@ namespace OpenSim.Grid.GridServer
foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
{ {
NeighbourBlock = new Hashtable(); NeighbourBlock = new Hashtable();
NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP).ToString(); NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP.ToString()).ToString();
NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString();
NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
@ -487,13 +485,13 @@ namespace OpenSim.Grid.GridServer
{ {
if ( if (
GetRegion( GetRegion(
Helpers.UIntsToLong((uint) ((sim.regionLocX + x) * Constants.RegionSize), Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize),
(uint) (sim.regionLocY + y) * Constants.RegionSize)) != null) (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null)
{ {
neighbour = neighbour =
GetRegion( GetRegion(
Helpers.UIntsToLong((uint) ((sim.regionLocX + x) * Constants.RegionSize), Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize),
(uint) (sim.regionLocY + y) * Constants.RegionSize)); (uint)(sim.regionLocY + y) * Constants.RegionSize));
NeighbourBlock = new Hashtable(); NeighbourBlock = new Hashtable();
NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString(); NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
@ -521,19 +519,20 @@ namespace OpenSim.Grid.GridServer
RegionProfileData sim; RegionProfileData sim;
sim = new RegionProfileData(); sim = new RegionProfileData();
sim.UUID = new LLUUID((string) requestData["UUID"]); sim.UUID = new LLUUID((string)requestData["UUID"]);
sim.originUUID = new LLUUID((string) requestData["originUUID"]); sim.originUUID = new LLUUID((string)requestData["originUUID"]);
sim.regionRecvKey = String.Empty; sim.regionRecvKey = String.Empty;
sim.regionSendKey = String.Empty; sim.regionSendKey = String.Empty;
if (requestData.ContainsKey("region_secret")) if (requestData.ContainsKey("region_secret"))
{ {
string regionsecret = (string) requestData["region_secret"]; string regionsecret = (string)requestData["region_secret"];
if (regionsecret.Length > 0) if (regionsecret.Length > 0)
sim.regionSecret = regionsecret; sim.regionSecret = regionsecret;
else else
sim.regionSecret = Config.SimRecvKey; sim.regionSecret = Config.SimRecvKey;
} }
else else
{ {
@ -549,16 +548,16 @@ namespace OpenSim.Grid.GridServer
sim.regionUserSendKey = Config.UserSendKey; sim.regionUserSendKey = Config.UserSendKey;
sim.regionUserRecvKey = Config.UserRecvKey; sim.regionUserRecvKey = Config.UserRecvKey;
sim.serverIP = (string) requestData["sim_ip"]; sim.serverIP = (string)requestData["sim_ip"];
sim.serverPort = Convert.ToUInt32((string) requestData["sim_port"]); sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
sim.httpPort = Convert.ToUInt32((string) requestData["http_port"]); sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
sim.remotingPort = Convert.ToUInt32((string) requestData["remoting_port"]); sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
sim.regionLocX = Convert.ToUInt32((string) requestData["region_locx"]); sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
sim.regionLocY = Convert.ToUInt32((string) requestData["region_locy"]); sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
sim.regionLocZ = 0; sim.regionLocZ = 0;
LLUUID textureID; LLUUID textureID;
if (LLUUID.TryParse((string) requestData["map-image-id"], out textureID)) if (LLUUID.TryParse((string)requestData["map-image-id"], out textureID))
{ {
sim.regionMapTextureID = textureID; sim.regionMapTextureID = textureID;
} }
@ -571,23 +570,21 @@ namespace OpenSim.Grid.GridServer
// //
// this particular section of the mod attempts to receive a value from the region's xml file by way of // this particular section of the mod attempts to receive a value from the region's xml file by way of
// OSG1GridServices for the region's owner // OSG1GridServices for the region's owner
sim.owner_uuid = (string) requestData["master_avatar_uuid"]; sim.owner_uuid = (string)requestData["master_avatar_uuid"];
try try
{ {
sim.regionRecvKey = (string) requestData["recvkey"]; sim.regionRecvKey = (string)requestData["recvkey"];
sim.regionSendKey = (string) requestData["authkey"]; sim.regionSendKey = (string)requestData["authkey"];
}
catch (KeyNotFoundException)
{
} }
catch (KeyNotFoundException) { }
sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize)); sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize));
sim.serverURI = (string) requestData["server_uri"]; sim.serverURI = (string)requestData["server_uri"];
sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/"; sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/";
sim.regionName = (string) requestData["sim_name"]; sim.regionName = (string)requestData["sim_name"];
return sim; return sim;
} }
@ -607,7 +604,7 @@ namespace OpenSim.Grid.GridServer
//RegionProfileData TheSim = null; //RegionProfileData TheSim = null;
string uuid; string uuid;
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
if (requestData.ContainsKey("UUID")) if (requestData.ContainsKey("UUID"))
{ {
@ -627,7 +624,7 @@ namespace OpenSim.Grid.GridServer
//OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData(); //OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData();
try try
{ {
MySQLGridData mysqldata = (MySQLGridData) (kvp.Value); MySQLGridData mysqldata = (MySQLGridData)(kvp.Value);
//DataResponse insertResponse = mysqldata.DeleteProfile(TheSim); //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim);
DataResponse insertResponse = mysqldata.DeleteProfile(uuid); DataResponse insertResponse = mysqldata.DeleteProfile(uuid);
switch (insertResponse) switch (insertResponse)
@ -667,22 +664,22 @@ namespace OpenSim.Grid.GridServer
/// <returns></returns> /// <returns></returns>
public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
{ {
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
RegionProfileData simData = null; RegionProfileData simData = null;
if (requestData.ContainsKey("region_UUID")) if (requestData.ContainsKey("region_UUID"))
{ {
simData = GetRegion(new LLUUID((string) requestData["region_UUID"])); simData = GetRegion(new LLUUID((string)requestData["region_UUID"]));
} }
else if (requestData.ContainsKey("region_handle")) else if (requestData.ContainsKey("region_handle"))
{ {
//CFK: The if/else below this makes this message redundant. //CFK: The if/else below this makes this message redundant.
//CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]); //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]);
simData = GetRegion(Convert.ToUInt64((string) requestData["region_handle"])); simData = GetRegion(Convert.ToUInt64((string)requestData["region_handle"]));
} }
else if (requestData.ContainsKey("region_name_search")) else if (requestData.ContainsKey("region_name_search"))
{ {
simData = GetRegion((string) requestData["region_name_search"]); simData = GetRegion((string)requestData["region_name_search"]);
} }
if (simData == null) if (simData == null)
@ -693,8 +690,8 @@ namespace OpenSim.Grid.GridServer
} }
else else
{ {
m_log.Info("[DATA]: found " + simData.regionName + " regionHandle = " + m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " +
(string) requestData["region_handle"]); (string)requestData["region_handle"]);
responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString();
responseData["sim_port"] = simData.serverPort.ToString(); responseData["sim_port"] = simData.serverPort.ToString();
responseData["server_uri"] = simData.serverURI; responseData["server_uri"] = simData.serverURI;
@ -716,22 +713,22 @@ namespace OpenSim.Grid.GridServer
{ {
int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020; int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020;
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
if (requestData.ContainsKey("xmin")) if (requestData.ContainsKey("xmin"))
{ {
xmin = (Int32) requestData["xmin"]; xmin = (Int32)requestData["xmin"];
} }
if (requestData.ContainsKey("ymin")) if (requestData.ContainsKey("ymin"))
{ {
ymin = (Int32) requestData["ymin"]; ymin = (Int32)requestData["ymin"];
} }
if (requestData.ContainsKey("xmax")) if (requestData.ContainsKey("xmax"))
{ {
xmax = (Int32) requestData["xmax"]; xmax = (Int32)requestData["xmax"];
} }
if (requestData.ContainsKey("ymax")) if (requestData.ContainsKey("ymax"))
{ {
ymax = (Int32) requestData["ymax"]; ymax = (Int32)requestData["ymax"];
} }
//CFK: The second log is more meaningful and either standard or fast generally occurs. //CFK: The second log is more meaningful and either standard or fast generally occurs.
//CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
@ -746,15 +743,15 @@ namespace OpenSim.Grid.GridServer
if (fastMode) if (fastMode)
{ {
Dictionary<ulong, RegionProfileData> neighbours = Dictionary<ulong, RegionProfileData> neighbours =
GetRegions((uint) xmin, (uint) ymin, (uint) xmax, (uint) ymax); GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
{ {
Hashtable simProfileBlock = new Hashtable(); Hashtable simProfileBlock = new Hashtable();
simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); simProfileBlock["x"] = aSim.Value.regionLocX.ToString();
simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); simProfileBlock["y"] = aSim.Value.regionLocY.ToString();
Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX + " , " + Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " +
aSim.Value.regionLocY); aSim.Value.regionLocY.ToString());
simProfileBlock["name"] = aSim.Value.regionName; simProfileBlock["name"] = aSim.Value.regionName;
simProfileBlock["access"] = 21; simProfileBlock["access"] = 21;
simProfileBlock["region-flags"] = 512; simProfileBlock["region-flags"] = 512;
@ -764,15 +761,15 @@ namespace OpenSim.Grid.GridServer
// For Sugilite compatibility // For Sugilite compatibility
simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString();
simProfileBlock["sim_ip"] = aSim.Value.serverIP; simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString();
simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString();
simProfileBlock["sim_uri"] = aSim.Value.serverURI; simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString();
simProfileBlock["uuid"] = aSim.Value.UUID.ToString(); simProfileBlock["uuid"] = aSim.Value.UUID.ToString();
simProfileBlock["remoting_port"] = aSim.Value.remotingPort; simProfileBlock["remoting_port"] = aSim.Value.remotingPort;
simProfileList.Add(simProfileBlock); simProfileList.Add(simProfileBlock);
} }
m_log.Info("[MAP]: Fast map " + simProfileList.Count + m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() +
" regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
} }
else else
@ -782,7 +779,7 @@ namespace OpenSim.Grid.GridServer
{ {
for (int y = ymin; y < ymax + 1; y++) for (int y = ymin; y < ymax + 1; y++)
{ {
ulong regHandle = Helpers.UIntsToLong((uint) (x * Constants.RegionSize), (uint) (y * Constants.RegionSize)); ulong regHandle = Helpers.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize));
simProfile = GetRegion(regHandle); simProfile = GetRegion(regHandle);
if (simProfile != null) if (simProfile != null)
{ {
@ -798,16 +795,16 @@ namespace OpenSim.Grid.GridServer
// For Sugilite compatibility // For Sugilite compatibility
simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString();
simProfileBlock["sim_ip"] = simProfile.serverIP; simProfileBlock["sim_ip"] = simProfile.serverIP.ToString();
simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); simProfileBlock["sim_port"] = simProfile.serverPort.ToString();
simProfileBlock["sim_uri"] = simProfile.serverURI; simProfileBlock["sim_uri"] = simProfile.serverURI.ToString();
simProfileBlock["uuid"] = simProfile.UUID.ToString(); simProfileBlock["uuid"] = simProfile.UUID.ToString();
simProfileList.Add(simProfileBlock); simProfileList.Add(simProfileBlock);
} }
} }
} }
m_log.Info("[MAP]: Std map " + simProfileList.Count + m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() +
" regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
} }
@ -863,12 +860,12 @@ namespace OpenSim.Grid.GridServer
respstring = "<Root>"; respstring = "<Root>";
respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>";
respstring += "<sim>"; respstring += "<sim>";
respstring += "<uuid>" + TheSim.UUID + "</uuid>"; respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>";
respstring += "<regionname>" + TheSim.regionName + "</regionname>"; respstring += "<regionname>" + TheSim.regionName + "</regionname>";
respstring += "<sim_ip>" + Util.GetHostFromDNS(TheSim.serverIP) + "</sim_ip>"; respstring += "<sim_ip>" + Util.GetHostFromDNS(TheSim.serverIP).ToString() + "</sim_ip>";
respstring += "<sim_port>" + TheSim.serverPort + "</sim_port>"; respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>";
respstring += "<region_locx>" + TheSim.regionLocX + "</region_locx>"; respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>";
respstring += "<region_locy>" + TheSim.regionLocY + "</region_locy>"; respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>";
respstring += "<estate_id>1</estate_id>"; respstring += "<estate_id>1</estate_id>";
respstring += "</sim>"; respstring += "</sim>";
respstring += "</Root>"; respstring += "</Root>";
@ -949,12 +946,12 @@ namespace OpenSim.Grid.GridServer
break; break;
case "region_locx": case "region_locx":
theSim.regionLocX = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize));
break; break;
case "region_locy": case "region_locy":
theSim.regionLocY = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize));
break; break;
} }
@ -1008,28 +1005,28 @@ namespace OpenSim.Grid.GridServer
catch (Exception e) catch (Exception e)
{ {
m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " +
e); e.ToString());
} }
} }
return "OK"; return "OK";
} }
catch (Exception e) catch (Exception e)
{ {
return "ERROR! Could not save to database! (" + e + ")"; return "ERROR! Could not save to database! (" + e.ToString() + ")";
} }
} }
public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
if (requestData.Contains("uri")) if (requestData.Contains("uri"))
{ {
string URI = (string) requestData["URI"]; string URI = (string)requestData["URI"];
string sendkey = (string) requestData["sendkey"]; string sendkey = (string)requestData["sendkey"];
string recvkey = (string) requestData["recvkey"]; string recvkey = (string)requestData["recvkey"];
MessageServerInfo m = new MessageServerInfo(); MessageServerInfo m = new MessageServerInfo();
m.URI = URI; m.URI = URI;
m.sendkey = sendkey; m.sendkey = sendkey;
@ -1045,14 +1042,14 @@ namespace OpenSim.Grid.GridServer
public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
if (requestData.Contains("uri")) if (requestData.Contains("uri"))
{ {
string URI = (string) requestData["uri"]; string URI = (string)requestData["uri"];
string sendkey = (string) requestData["sendkey"]; string sendkey = (string)requestData["sendkey"];
string recvkey = (string) requestData["recvkey"]; string recvkey = (string)requestData["recvkey"];
MessageServerInfo m = new MessageServerInfo(); MessageServerInfo m = new MessageServerInfo();
m.URI = URI; m.URI = URI;
m.sendkey = sendkey; m.sendkey = sendkey;

View File

@ -44,34 +44,6 @@ namespace OpenSim.Grid.GridServer
protected GridManager m_gridManager; protected GridManager m_gridManager;
protected List<IGridPlugin> m_plugins = new List<IGridPlugin>(); protected List<IGridPlugin> m_plugins = new List<IGridPlugin>();
public GridServerBase()
{
m_console = new ConsoleBase("OpenGrid", this);
MainConsole.Instance = m_console;
}
#region conscmd_callback Members
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
break;
case "shutdown":
foreach (IGridPlugin plugin in m_plugins) plugin.Close();
m_console.Close();
Environment.Exit(0);
break;
}
}
#endregion
public void Work() public void Work()
{ {
m_console.Notice("Enter help for a list of commands\n"); m_console.Notice("Enter help for a list of commands\n");
@ -82,6 +54,12 @@ namespace OpenSim.Grid.GridServer
} }
} }
public GridServerBase()
{
m_console = new ConsoleBase("OpenGrid", this);
MainConsole.Instance = m_console;
}
public void managercallback(string cmd) public void managercallback(string cmd)
{ {
switch (cmd) switch (cmd)
@ -105,14 +83,14 @@ namespace OpenSim.Grid.GridServer
AddHttpHandlers(); AddHttpHandlers();
LoadGridPlugins(); LoadGridPlugins( );
m_httpServer.Start(); m_httpServer.Start();
m_console.Status("[GRID]: Starting sim status checker"); m_console.Status("[GRID]: Starting sim status checker");
Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
simCheckTimer.Elapsed += CheckSims; simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
simCheckTimer.Enabled = true; simCheckTimer.Enabled = true;
} }
@ -144,7 +122,7 @@ namespace OpenSim.Grid.GridServer
foreach (TypeExtensionNode node in nodes) foreach (TypeExtensionNode node in nodes)
{ {
m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin " + node.Path); m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin " + node.Path);
IGridPlugin plugin = (IGridPlugin) node.CreateInstance(); IGridPlugin plugin = (IGridPlugin)node.CreateInstance();
plugin.Initialise(this); plugin.Initialise(this);
m_plugins.Add(plugin); m_plugins.Add(plugin);
} }
@ -199,5 +177,23 @@ namespace OpenSim.Grid.GridServer
} }
*/ */
} }
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
break;
case "shutdown":
foreach (IGridPlugin plugin in m_plugins) plugin.Close();
m_console.Close();
Environment.Exit(0);
break;
}
}
} }
} }

View File

@ -136,12 +136,10 @@ namespace OpenSim.Grid.InventoryServer
return fixupFolder(inventory.root, null); return fixupFolder(inventory.root, null);
} }
#region Nested type: GetInventory
public class GetInventory : BaseStreamHandler public class GetInventory : BaseStreamHandler
{ {
private readonly SerializableInventory _inventory; private SerializableInventory _inventory;
private readonly InventoryManager _manager; private InventoryManager _manager;
public GetInventory(InventoryManager manager) public GetInventory(InventoryManager manager)
: base("GET", "/inventory") : base("GET", "/inventory")
@ -183,7 +181,7 @@ namespace OpenSim.Grid.InventoryServer
{ {
byte[] result = new byte[] {}; byte[] result = new byte[] {};
string[] parms = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); string[] parms = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if (parms.Length > 1) if (parms.Length > 1)
{ {
if (string.Compare(parms[1], "library", true) == 0) if (string.Compare(parms[1], "library", true) == 0)
@ -192,7 +190,7 @@ namespace OpenSim.Grid.InventoryServer
saveInventoryToStream(_inventory, ms); saveInventoryToStream(_inventory, ms);
result = ms.GetBuffer(); result = ms.GetBuffer();
Array.Resize(ref result, (int) ms.Length); Array.Resize<byte>(ref result, (int) ms.Length);
} }
else if (string.Compare(parms[1], "user", true) == 0) else if (string.Compare(parms[1], "user", true) == 0)
{ {
@ -205,7 +203,5 @@ namespace OpenSim.Grid.InventoryServer
return result; return result;
} }
} }
#endregion
} }
} }

View File

@ -40,38 +40,13 @@ namespace OpenSim.Grid.InventoryServer
{ {
public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback
{ {
public const string LogName = "INVENTORY";
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private InventoryConfig m_config;
private InventoryManager m_inventoryManager; private InventoryManager m_inventoryManager;
private InventoryConfig m_config;
private GridInventoryService m_inventoryService; private GridInventoryService m_inventoryService;
public OpenInventory_Main() public const string LogName = "INVENTORY";
{
m_console = new ConsoleBase(LogName, this);
MainConsole.Instance = m_console;
}
#region conscmd_callback Members
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "add-user":
m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID);
break;
case "shutdown":
m_console.Close();
Environment.Exit(0);
break;
}
}
#endregion
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
@ -84,6 +59,12 @@ namespace OpenSim.Grid.InventoryServer
theServer.Work(); theServer.Work();
} }
public OpenInventory_Main()
{
m_console = new ConsoleBase(LogName, this);
MainConsole.Instance = m_console;
}
public void Startup() public void Startup()
{ {
m_log.Info("Initialising inventory manager..."); m_log.Info("Initialising inventory manager...");
@ -153,5 +134,21 @@ namespace OpenSim.Grid.InventoryServer
m_console.Prompt(); m_console.Prompt();
} }
} }
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "add-user":
m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID);
break;
case "shutdown":
m_console.Close();
Environment.Exit(0);
break;
}
}
} }
} }

View File

@ -44,42 +44,9 @@ namespace OpenSim.Grid.MessagingServer
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private MessageServerConfig Cfg; private MessageServerConfig Cfg;
private LLUUID m_lastCreatedUser = LLUUID.Random();
private MessageService msgsvc; private MessageService msgsvc;
private OpenMessage_Main() private LLUUID m_lastCreatedUser = LLUUID.Random();
{
m_console = new ConsoleBase("OpenMessage", this);
MainConsole.Instance = m_console;
}
#region conscmd_callback Members
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)");
break;
case "shutdown":
msgsvc.deregisterWithUserServer();
m_console.Close();
Environment.Exit(0);
break;
}
}
public override void Show(string ShowWhat)
{
base.Show(ShowWhat);
}
#endregion
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
@ -89,12 +56,19 @@ namespace OpenSim.Grid.MessagingServer
m_log.Info("Launching MessagingServer..."); m_log.Info("Launching MessagingServer...");
OpenMessage_Main messageserver = new OpenMessage_Main(); OpenMessage_Main messageserver = new OpenMessage_Main();
messageserver.Startup(); messageserver.Startup();
messageserver.Work(); messageserver.Work();
} }
private OpenMessage_Main()
{
m_console = new ConsoleBase("OpenMessage", this);
MainConsole.Instance = m_console;
}
private void Work() private void Work()
{ {
m_console.Notice("Enter help for a list of commands\n"); m_console.Notice("Enter help for a list of commands\n");
@ -149,8 +123,7 @@ namespace OpenSim.Grid.MessagingServer
{ {
//userID = //userID =
//m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
} } catch (Exception ex)
catch (Exception ex)
{ {
m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString()); m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString());
} }
@ -168,5 +141,28 @@ namespace OpenSim.Grid.MessagingServer
break; break;
} }
} }
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)");
break;
case "shutdown":
msgsvc.deregisterWithUserServer();
m_console.Close();
Environment.Exit(0);
break;
}
}
public override void Show(string ShowWhat)
{
base.Show(ShowWhat);
}
} }
} }

View File

@ -45,16 +45,16 @@ namespace OpenSim.Grid.MessagingServer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly MessageServerConfig m_cfg; private MessageServerConfig m_cfg;
private readonly Hashtable m_presence_BackReferences = new Hashtable();
//A hashtable of all current presences this server knows about //A hashtable of all current presences this server knows about
private readonly Hashtable m_presences = new Hashtable(); private Hashtable m_presences = new Hashtable();
//a hashtable of all current regions this server knows about //a hashtable of all current regions this server knows about
private readonly Hashtable m_regionInfoCache = new Hashtable(); private Hashtable m_regionInfoCache = new Hashtable();
//A hashtable containing lists of UUIDs keyed by UUID for fast backreferencing //A hashtable containing lists of UUIDs keyed by UUID for fast backreferencing
private Hashtable m_presence_BackReferences = new Hashtable();
// Hashtable containing work units that need to be processed // Hashtable containing work units that need to be processed
private Hashtable m_unProcessedWorkUnits = new Hashtable(); private Hashtable m_unProcessedWorkUnits = new Hashtable();
@ -91,10 +91,10 @@ namespace OpenSim.Grid.MessagingServer
if (m_presences.Contains(uFriendList[i].Friend)) if (m_presences.Contains(uFriendList[i].Friend))
{ {
UserPresenceData friendup = (UserPresenceData) m_presences[uFriendList[i].Friend]; UserPresenceData friendup = (UserPresenceData)m_presences[uFriendList[i].Friend];
// Add backreference // Add backreference
SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i], i); SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i],i);
} }
} }
} }
@ -111,7 +111,7 @@ namespace OpenSim.Grid.MessagingServer
public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence, public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence,
FriendListItem uFriendListItem, int uFriendListIndex) FriendListItem uFriendListItem, int uFriendListIndex)
{ {
if ((uFriendListItem.FriendListOwnerPerms & (uint) FriendRights.CanSeeOnline) != 0) if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0)
{ {
// Subscribe and Send Out updates // Subscribe and Send Out updates
if (!friendpresence.subscriptionData.Contains(friendpresence.agentData.AgentID)) if (!friendpresence.subscriptionData.Contains(friendpresence.agentData.AgentID))
@ -126,13 +126,13 @@ namespace OpenSim.Grid.MessagingServer
PresenceInformer friendlistupdater = new PresenceInformer(); PresenceInformer friendlistupdater = new PresenceInformer();
friendlistupdater.presence1 = friendpresence; friendlistupdater.presence1 = friendpresence;
friendlistupdater.presence2 = userpresence; friendlistupdater.presence2 = userpresence;
WaitCallback cb = friendlistupdater.go; WaitCallback cb = new WaitCallback(friendlistupdater.go);
ThreadPool.QueueUserWorkItem(cb); ThreadPool.QueueUserWorkItem(cb);
//SendRegionPresenceUpdate(friendpresence, userpresence); //SendRegionPresenceUpdate(friendpresence, userpresence);
} }
if ((uFriendListItem.FriendPerms & (uint) FriendRights.CanSeeOnline) != 0) if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0)
{ {
if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID)) if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID))
{ {
@ -147,7 +147,7 @@ namespace OpenSim.Grid.MessagingServer
friendlistupdater.presence1 = userpresence; friendlistupdater.presence1 = userpresence;
friendlistupdater.presence2 = friendpresence; friendlistupdater.presence2 = friendpresence;
WaitCallback cb2 = friendlistupdater.go; WaitCallback cb2 = new WaitCallback(friendlistupdater.go);
ThreadPool.QueueUserWorkItem(cb2); ThreadPool.QueueUserWorkItem(cb2);
//SendRegionPresenceUpdate(userpresence, friendpresence); //SendRegionPresenceUpdate(userpresence, friendpresence);
@ -164,7 +164,7 @@ namespace OpenSim.Grid.MessagingServer
{ {
if (m_presence_BackReferences.Contains(friendID)) if (m_presence_BackReferences.Contains(friendID))
{ {
List<LLUUID> presenseBackReferences = (List<LLUUID>) m_presence_BackReferences[friendID]; List<LLUUID> presenseBackReferences = (List<LLUUID>)m_presence_BackReferences[friendID];
if (!presenseBackReferences.Contains(agentID)) if (!presenseBackReferences.Contains(agentID))
{ {
presenseBackReferences.Add(agentID); presenseBackReferences.Add(agentID);
@ -188,7 +188,7 @@ namespace OpenSim.Grid.MessagingServer
{ {
if (m_presence_BackReferences.Contains(friendID)) if (m_presence_BackReferences.Contains(friendID))
{ {
List<LLUUID> presenseBackReferences = (List<LLUUID>) m_presence_BackReferences[friendID]; List<LLUUID> presenseBackReferences = (List<LLUUID>)m_presence_BackReferences[friendID];
if (presenseBackReferences.Contains(agentID)) if (presenseBackReferences.Contains(agentID))
{ {
presenseBackReferences.Remove(agentID); presenseBackReferences.Remove(agentID);
@ -216,7 +216,7 @@ namespace OpenSim.Grid.MessagingServer
{ {
if (m_presences.Contains(AgentID)) if (m_presences.Contains(AgentID))
{ {
AgentData = (UserPresenceData) m_presences[AgentID]; AgentData = (UserPresenceData)m_presences[AgentID];
} }
} }
@ -234,11 +234,11 @@ namespace OpenSim.Grid.MessagingServer
for (int i = 0; i < AgentsNeedingNotification.Count; i++) for (int i = 0; i < AgentsNeedingNotification.Count; i++)
{ {
// TODO: Do Region Notifications // TODO: Do Region Notifications
lock (m_presences) lock(m_presences)
{ {
if (m_presences.Contains(AgentsNeedingNotification[i])) if (m_presences.Contains(AgentsNeedingNotification[i]))
{ {
friendd = (UserPresenceData) m_presences[AgentsNeedingNotification[i]]; friendd = (UserPresenceData)m_presences[AgentsNeedingNotification[i]];
} }
} }
@ -266,7 +266,7 @@ namespace OpenSim.Grid.MessagingServer
friendlistupdater.presence1 = AgentData; friendlistupdater.presence1 = AgentData;
friendlistupdater.presence2 = friendd; friendlistupdater.presence2 = friendd;
WaitCallback cb3 = friendlistupdater.go; WaitCallback cb3 = new WaitCallback(friendlistupdater.go);
ThreadPool.QueueUserWorkItem(cb3); ThreadPool.QueueUserWorkItem(cb3);
//SendRegionPresenceUpdate(AgentData, friendd); //SendRegionPresenceUpdate(AgentData, friendd);
@ -298,12 +298,13 @@ namespace OpenSim.Grid.MessagingServer
parameters.Add(param); parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters);
XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000); XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000);
Hashtable respData = (Hashtable) resp.Value; Hashtable respData = (Hashtable)resp.Value;
if (respData.Contains("avcount")) if (respData.Contains("avcount"))
{ {
buddylist = ConvertXMLRPCDataToFriendListItemList(respData); buddylist = ConvertXMLRPCDataToFriendListItemList(respData);
} }
} }
catch (WebException e) catch (WebException e)
{ {
@ -322,16 +323,16 @@ namespace OpenSim.Grid.MessagingServer
public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data)
{ {
List<FriendListItem> buddylist = new List<FriendListItem>(); List<FriendListItem> buddylist = new List<FriendListItem>();
int buddycount = Convert.ToInt32((string) data["avcount"]); int buddycount = Convert.ToInt32((string)data["avcount"]);
for (int i = 0; i < buddycount; i++) for (int i = 0; i < buddycount; i++)
{ {
FriendListItem buddylistitem = new FriendListItem(); FriendListItem buddylistitem = new FriendListItem();
buddylistitem.FriendListOwner = new LLUUID((string) data["ownerID" + i]); buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]);
buddylistitem.Friend = new LLUUID((string) data["friendID" + i]); buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]);
buddylistitem.FriendListOwnerPerms = (uint) Convert.ToInt32((string) data["ownerPerms" + i]); buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]);
buddylistitem.FriendPerms = (uint) Convert.ToInt32((string) data["friendPerms" + i]); buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]);
buddylist.Add(buddylistitem); buddylist.Add(buddylistitem);
} }
@ -349,7 +350,7 @@ namespace OpenSim.Grid.MessagingServer
public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) public XmlRpcResponse UserLoggedOn(XmlRpcRequest request)
{ {
m_log.Info("[LOGON]: User logged on, building indexes for user"); m_log.Info("[LOGON]: User logged on, building indexes for user");
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
//requestData["sendkey"] = serv.sendkey; //requestData["sendkey"] = serv.sendkey;
//requestData["agentid"] = agentID.ToString(); //requestData["agentid"] = agentID.ToString();
@ -363,13 +364,13 @@ namespace OpenSim.Grid.MessagingServer
//requestData["lastname"] = lastname; //requestData["lastname"] = lastname;
AgentCircuitData agentData = new AgentCircuitData(); AgentCircuitData agentData = new AgentCircuitData();
agentData.SessionID = new LLUUID((string) requestData["sessionid"]); agentData.SessionID = new LLUUID((string)requestData["sessionid"]);
agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]); agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]);
agentData.firstname = (string) requestData["firstname"]; agentData.firstname = (string)requestData["firstname"];
agentData.lastname = (string) requestData["lastname"]; agentData.lastname = (string)requestData["lastname"];
agentData.AgentID = new LLUUID((string) requestData["agentid"]); agentData.AgentID = new LLUUID((string)requestData["agentid"]);
agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
agentData.CapsPath = (string) requestData["caps_path"]; agentData.CapsPath = (string)requestData["caps_path"];
if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
{ {
@ -384,7 +385,7 @@ namespace OpenSim.Grid.MessagingServer
agentData.child = false; agentData.child = false;
} }
ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]); ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
UserPresenceData up = new UserPresenceData(); UserPresenceData up = new UserPresenceData();
up.agentData = agentData; up.agentData = agentData;
@ -406,9 +407,9 @@ namespace OpenSim.Grid.MessagingServer
/// <returns></returns> /// <returns></returns>
public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) public XmlRpcResponse UserLoggedOff(XmlRpcRequest request)
{ {
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
LLUUID AgentID = new LLUUID((string) requestData["agentid"]); LLUUID AgentID = new LLUUID((string)requestData["agentid"]);
ProcessLogOff(AgentID); ProcessLogOff(AgentID);
@ -430,7 +431,7 @@ namespace OpenSim.Grid.MessagingServer
RegionProfileData regionInfo = null; RegionProfileData regionInfo = null;
if (m_regionInfoCache.Contains(regionhandle)) if (m_regionInfoCache.Contains(regionhandle))
{ {
regionInfo = (RegionProfileData) m_regionInfoCache[regionhandle]; regionInfo = (RegionProfileData)m_regionInfoCache[regionhandle];
} }
else else
{ {
@ -446,8 +447,7 @@ namespace OpenSim.Grid.MessagingServer
/// <param name="regionHandle"></param> /// <param name="regionHandle"></param>
/// <returns></returns> /// <returns></returns>
public RegionProfileData RequestRegionInfo(ulong regionHandle) public RegionProfileData RequestRegionInfo(ulong regionHandle)
{ { RegionProfileData regionProfile = null;
RegionProfileData regionProfile = null;
try try
{ {
Hashtable requestData = new Hashtable(); Hashtable requestData = new Hashtable();
@ -458,7 +458,7 @@ namespace OpenSim.Grid.MessagingServer
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000); XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000);
Hashtable responseData = (Hashtable) GridResp.Value; Hashtable responseData = (Hashtable)GridResp.Value;
if (responseData.ContainsKey("error")) if (responseData.ContainsKey("error"))
{ {
@ -466,23 +466,23 @@ namespace OpenSim.Grid.MessagingServer
return null; return null;
} }
uint regX = Convert.ToUInt32((string) responseData["region_locx"]); uint regX = Convert.ToUInt32((string)responseData["region_locx"]);
uint regY = Convert.ToUInt32((string) responseData["region_locy"]); uint regY = Convert.ToUInt32((string)responseData["region_locy"]);
string internalIpStr = (string) responseData["sim_ip"]; string internalIpStr = (string)responseData["sim_ip"];
uint port = Convert.ToUInt32(responseData["sim_port"]); uint port = Convert.ToUInt32(responseData["sim_port"]);
string externalUri = (string) responseData["sim_uri"]; string externalUri = (string)responseData["sim_uri"];
string neighbourExternalUri = externalUri; string neighbourExternalUri = externalUri;
regionProfile = new RegionProfileData(); regionProfile = new RegionProfileData();
regionProfile.httpPort = (uint) Convert.ToInt32((string) responseData["http_port"]); regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]);
regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/"; regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/";
regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize)); regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize));
regionProfile.regionLocX = regX; regionProfile.regionLocX = regX;
regionProfile.regionLocY = regY; regionProfile.regionLocY = regY;
regionProfile.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
regionProfile.UUID = new LLUUID((string) responseData["region_UUID"]); regionProfile.UUID = new LLUUID((string)responseData["region_UUID"]);
regionProfile.regionName = (string) responseData["region_name"]; regionProfile.regionName = (string)responseData["region_name"];
lock (m_regionInfoCache) lock (m_regionInfoCache)
{ {
if (!m_regionInfoCache.Contains(regionHandle)) if (!m_regionInfoCache.Contains(regionHandle))
@ -494,7 +494,7 @@ namespace OpenSim.Grid.MessagingServer
catch (WebException) catch (WebException)
{ {
m_log.Error("[GRID]: " + m_log.Error("[GRID]: " +
"Region lookup failed for: " + regionHandle + "Region lookup failed for: " + regionHandle.ToString() +
" - Is the GridServer down?"); " - Is the GridServer down?");
return null; return null;
} }
@ -502,7 +502,7 @@ namespace OpenSim.Grid.MessagingServer
return regionProfile; return regionProfile;
} }
public bool registerWithUserServer() public bool registerWithUserServer ()
{ {
Hashtable UserParams = new Hashtable(); Hashtable UserParams = new Hashtable();
// Login / Authentication // Login / Authentication
@ -530,13 +530,12 @@ namespace OpenSim.Grid.MessagingServer
{ {
UserReq = new XmlRpcRequest("register_messageserver", SendParams); UserReq = new XmlRpcRequest("register_messageserver", SendParams);
UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); UserResp = UserReq.Send(m_cfg.UserServerURL, 16000);
} } catch (Exception ex)
catch (Exception ex)
{ {
m_log.Error("Unable to connect to grid. Grid server not running?"); m_log.Error("Unable to connect to grid. Grid server not running?");
throw (ex); throw(ex);
} }
Hashtable GridRespData = (Hashtable) UserResp.Value; Hashtable GridRespData = (Hashtable)UserResp.Value;
Hashtable griddatahash = GridRespData; Hashtable griddatahash = GridRespData;
// Process Response // Process Response
@ -584,7 +583,7 @@ namespace OpenSim.Grid.MessagingServer
m_log.Error("Unable to connect to grid. Grid server not running?"); m_log.Error("Unable to connect to grid. Grid server not running?");
throw (ex); throw (ex);
} }
Hashtable UserRespData = (Hashtable) UserResp.Value; Hashtable UserRespData = (Hashtable)UserResp.Value;
Hashtable userdatahash = UserRespData; Hashtable userdatahash = UserRespData;
// Process Response // Process Response

View File

@ -35,16 +35,21 @@ namespace OpenSim.Grid.MessagingServer
{ {
public class PresenceInformer public class PresenceInformer
{ {
public UserPresenceData presence1 = null;
public UserPresenceData presence2 = null;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public UserPresenceData presence1;
public UserPresenceData presence2;
public PresenceInformer()
{
}
public void go(object o) public void go(object o)
{ {
if (presence1 != null && presence2 != null) if (presence1 != null && presence2 != null)
{ {
SendRegionPresenceUpdate(presence1, presence2); SendRegionPresenceUpdate(presence1, presence2);
} }
} }
/// <summary> /// <summary>

View File

@ -36,9 +36,13 @@ namespace OpenSim.Grid.MessagingServer
public class UserPresenceData public class UserPresenceData
{ {
public AgentCircuitData agentData = new AgentCircuitData(); public AgentCircuitData agentData = new AgentCircuitData();
public List<FriendListItem> friendData = new List<FriendListItem>();
public string httpURI = String.Empty;
public RegionProfileData regionData = new RegionProfileData(); public RegionProfileData regionData = new RegionProfileData();
public string httpURI = String.Empty;
public List<FriendListItem> friendData = new List<FriendListItem> ();
public List<LLUUID> subscriptionData = new List<LLUUID>(); public List<LLUUID> subscriptionData = new List<LLUUID>();
public UserPresenceData()
{
}
} }
} }

View File

@ -48,6 +48,7 @@ namespace OpenSim.Grid.MessagingServer
: base("GET", "/presence") : base("GET", "/presence")
{ {
m_log.Info("[REST]: In Get Request"); m_log.Info("[REST]: In Get Request");
} }
public override byte[] Handle(string path, Stream request) public override byte[] Handle(string path, Stream request)
@ -56,7 +57,7 @@ namespace OpenSim.Grid.MessagingServer
byte[] result = new byte[] {}; byte[] result = new byte[] {};
try try
{ {
string[] p = param.Split(new[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
if (p.Length > 0) if (p.Length > 0)
{ {
@ -68,6 +69,7 @@ namespace OpenSim.Grid.MessagingServer
"[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]); "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]);
return result; return result;
} }
} }
} }
catch (Exception e) catch (Exception e)
@ -82,11 +84,6 @@ namespace OpenSim.Grid.MessagingServer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public PostXMPPStreamHandler()
: base("POST", "/presence")
{
}
public override byte[] Handle(string path, Stream request) public override byte[] Handle(string path, Stream request)
{ {
string param = GetParam(path); string param = GetParam(path);
@ -100,5 +97,12 @@ namespace OpenSim.Grid.MessagingServer
return new byte[] {}; return new byte[] {};
} }
public PostXMPPStreamHandler()
: base("POST", "/presence")
{
}
} }
} }

View File

@ -39,7 +39,7 @@ namespace OpenSim.Grid.ScriptServer
XmlConfigurator.Configure(); XmlConfigurator.Configure();
AppDomain.CurrentDomain.UnhandledException += AppDomain.CurrentDomain.UnhandledException +=
CurrentDomain_UnhandledException; new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
// Application is starting // Application is starting
SE = new ScriptServerMain(); SE = new ScriptServerMain();
@ -50,7 +50,7 @@ namespace OpenSim.Grid.ScriptServer
Console.WriteLine(String.Empty); Console.WriteLine(String.Empty);
Console.WriteLine("APPLICATION EXCEPTION DETECTED"); Console.WriteLine("APPLICATION EXCEPTION DETECTED");
Console.WriteLine(String.Empty); Console.WriteLine(String.Empty);
Console.WriteLine("Application is terminating: " + e.IsTerminating); Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString());
//Console.WriteLine("Exception:"); //Console.WriteLine("Exception:");
//Console.WriteLine(e.ExceptionObject.ToString()); //Console.WriteLine(e.ExceptionObject.ToString());
} }

View File

@ -34,7 +34,7 @@ using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Grid.ScriptServer namespace OpenSim.Grid.ScriptServer
{ {
public class FakeScene : Scene public class FakeScene: Scene
{ {
public FakeScene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager, public FakeScene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager,
CommunicationsManager commsMan, SceneCommunicationService sceneGridService, CommunicationsManager commsMan, SceneCommunicationService sceneGridService,

View File

@ -34,13 +34,9 @@ namespace OpenSim.Grid.ScriptServer
{ {
// This object will be exposed over remoting. It is a singleton, so it exists only in as one instance. // This object will be exposed over remoting. It is a singleton, so it exists only in as one instance.
#region ServerRemotingObject Members
ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events() ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events()
{ {
return ScriptServerMain.Engine.EventManager(); return ScriptServerMain.Engine.EventManager();
} }
#endregion
} }
} }

View File

@ -31,10 +31,9 @@ using System.Runtime.Remoting.Channels.Tcp;
namespace OpenSim.Grid.ScriptServer namespace OpenSim.Grid.ScriptServer
{ {
internal class RemotingServer class RemotingServer
{ {
private readonly TcpChannel channel; TcpChannel channel;
public RemotingServer(int port, string instanceName) public RemotingServer(int port, string instanceName)
{ {
// Create an instance of a channel // Create an instance of a channel
@ -43,7 +42,7 @@ namespace OpenSim.Grid.ScriptServer
// Register as an available service with the name HelloWorld // Register as an available service with the name HelloWorld
RemotingConfiguration.RegisterWellKnownServiceType( RemotingConfiguration.RegisterWellKnownServiceType(
typeof (RemotingObject), typeof(RemotingObject),
instanceName, instanceName,
WellKnownObjectMode.Singleton); WellKnownObjectMode.Singleton);
} }

View File

@ -32,13 +32,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer.Region
// These are events that the region needs to have // These are events that the region needs to have
// TEMP: Using System.Delegate -- needs replacing with a real delegate // TEMP: Using System.Delegate -- needs replacing with a real delegate
#region Delegates
public delegate void DefaultDelegate(); public delegate void DefaultDelegate();
#endregion
public event DefaultDelegate onScriptRez; public event DefaultDelegate onScriptRez;
public event DefaultDelegate onstate_entry; public event DefaultDelegate onstate_entry;
public event DefaultDelegate onstate_exit; public event DefaultDelegate onstate_exit;

View File

@ -29,8 +29,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer.Region
{ {
public class RegionConnectionManager : RegionBase public class RegionConnectionManager : RegionBase
{ {
private object m_Connection;
private ScriptServerMain m_ScriptServerMain; private ScriptServerMain m_ScriptServerMain;
private object m_Connection;
public RegionConnectionManager(ScriptServerMain scm, object Connection) public RegionConnectionManager(ScriptServerMain scm, object Connection)
{ {

View File

@ -34,10 +34,12 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
{ {
internal class RegionCommManager internal class RegionCommManager
{ {
private readonly ScriptServerMain m_ScriptServerMain;
private readonly List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
private Thread listenThread; private Thread listenThread;
private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
private ScriptServerMain m_ScriptServerMain;
public RegionCommManager(ScriptServerMain scm) public RegionCommManager(ScriptServerMain scm)
{ {
m_ScriptServerMain = scm; m_ScriptServerMain = scm;

View File

@ -51,7 +51,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
{ {
m_log.Error("[ScriptEngine]: " + m_log.Error("[ScriptEngine]: " +
"Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
e.StackTrace); e.StackTrace.ToString());
} }
return ret; return ret;
} }
@ -104,7 +104,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
ScriptServerInterfaces.ScriptEngine ret; ScriptServerInterfaces.ScriptEngine ret;
//try //try
//{ //{
ret = (ScriptServerInterfaces.ScriptEngine) Activator.CreateInstance(t); ret = (ScriptServerInterfaces.ScriptEngine)Activator.CreateInstance(t);
//} //}
//catch (Exception e) //catch (Exception e)
//{ //{

View File

@ -32,8 +32,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer
{ {
internal class ScriptEngineManager internal class ScriptEngineManager
{ {
private readonly ScriptEngineLoader ScriptEngineLoader; private ScriptEngineLoader ScriptEngineLoader;
private readonly List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>(); private List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>();
private ScriptServerMain m_ScriptServerMain; private ScriptServerMain m_ScriptServerMain;
// Initialize // Initialize

View File

@ -44,18 +44,18 @@ namespace OpenSim.Grid.ScriptServer
// //
// Root object. Creates objects used. // Root object. Creates objects used.
// //
private int listenPort = 8010;
// TEMP // TEMP
public static ScriptServerInterfaces.ScriptEngine Engine; public static ScriptServerInterfaces.ScriptEngine Engine;
private int listenPort = 8010;
//public static FakeScene m_Scene = new FakeScene(null,null,null,null,null,null,null,null,null,false, false, false); //public static FakeScene m_Scene = new FakeScene(null,null,null,null,null,null,null,null,null,false, false, false);
// Objects we use // Objects we use
internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
internal ScriptEngineManager ScriptEngines; // Loads scriptengines
//internal RemotingServer m_RemotingServer; //internal RemotingServer m_RemotingServer;
internal TCPServer m_TCPServer; internal TCPServer m_TCPServer;
internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
internal TRPC_Remote RPC; internal TRPC_Remote RPC;
internal ScriptEngineManager ScriptEngines; // Loads scriptengines
public ScriptServerMain() public ScriptServerMain()
{ {
@ -74,7 +74,7 @@ namespace OpenSim.Grid.ScriptServer
//m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine"); //m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine");
m_TCPServer = new TCPServer(listenPort); m_TCPServer = new TCPServer(listenPort);
RPC = new TRPC_Remote(m_TCPServer); RPC = new TRPC_Remote(m_TCPServer);
RPC.ReceiveCommand += RPC_ReceiveCommand; RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand);
m_TCPServer.StartListen(); m_TCPServer.StartListen();
Console.ReadLine(); Console.ReadLine();
@ -93,7 +93,7 @@ namespace OpenSim.Grid.ScriptServer
if (Command == "OnRezScript") if (Command == "OnRezScript")
{ {
Engine.EventManager().OnRezScript((uint) p[0], new LLUUID((string) p[1]), (string) p[2]); Engine.EventManager().OnRezScript((uint)p[0], new LLUUID((string)p[1]), (string)p[2]);
} }
} }

View File

@ -48,61 +48,12 @@ namespace OpenSim.Grid.UserServer
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private UserConfig Cfg; private UserConfig Cfg;
private LLUUID m_lastCreatedUser = LLUUID.Random();
public UserManager m_userManager;
public UserLoginService m_loginService; public UserLoginService m_loginService;
public MessageServersConnector m_messagesService; public MessageServersConnector m_messagesService;
public UserManager m_userManager;
private OpenUser_Main() private LLUUID m_lastCreatedUser = LLUUID.Random();
{
m_console = new ConsoleBase("OpenUser", this);
MainConsole.Instance = m_console;
}
#region conscmd_callback Members
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice("create user - create a new user");
m_console.Notice("stats - statistical information for this server");
m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
break;
case "create":
do_create(cmdparams[0]);
break;
case "shutdown":
m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
m_console.Close();
Environment.Exit(0);
break;
case "stats":
m_console.Notice(StatsManager.UserStats.Report());
break;
case "test-inventory":
// RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
// requester.ReturnResponseVal = TestResponse;
// requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST",
m_userManager.
_config.
InventoryUrl +
"RootFolders/",
m_lastCreatedUser);
break;
}
}
#endregion
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
@ -117,6 +68,12 @@ namespace OpenSim.Grid.UserServer
userserver.Work(); userserver.Work();
} }
private OpenUser_Main()
{
m_console = new ConsoleBase("OpenUser", this);
MainConsole.Instance = m_console;
}
private void Work() private void Work()
{ {
m_console.Notice("Enter help for a list of commands\n"); m_console.Notice("Enter help for a list of commands\n");
@ -236,6 +193,7 @@ namespace OpenSim.Grid.UserServer
+ " Please contact your inventory service provider for more information.", + " Please contact your inventory service provider for more information.",
userID)); userID));
} }
} }
catch (WebException e) catch (WebException e)
{ {
@ -253,6 +211,46 @@ namespace OpenSim.Grid.UserServer
} }
} }
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":
m_console.Notice("create user - create a new user");
m_console.Notice("stats - statistical information for this server");
m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
break;
case "create":
do_create(cmdparams[0]);
break;
case "shutdown":
m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
m_console.Close();
Environment.Exit(0);
break;
case "stats":
m_console.Notice(StatsManager.UserStats.Report());
break;
case "test-inventory":
// RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
// requester.ReturnResponseVal = TestResponse;
// requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST",
m_userManager.
_config.
InventoryUrl +
"RootFolders/",
m_lastCreatedUser);
break;
}
}
public void TestResponse(List<InventoryFolderBase> resp) public void TestResponse(List<InventoryFolderBase> resp)
{ {
m_console.Notice("response got"); m_console.Notice("response got");
@ -267,7 +265,8 @@ namespace OpenSim.Grid.UserServer
ulong regionhandle, float positionX, float positionY, ulong regionhandle, float positionX, float positionY,
float positionZ, string firstname, string lastname) float positionZ, string firstname, string lastname)
{ {
m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX,
m_messagesService.TellMessageServersAboutUser( agentID, sessionID, RegionID, regionhandle, positionX,
positionY, positionZ, firstname, lastname); positionY, positionZ, firstname, lastname);
} }
} }

View File

@ -78,7 +78,6 @@ namespace OpenSim.Grid.UserServer
MessageServers["URI"] = msginfo; MessageServers["URI"] = msginfo;
} }
} }
public void RemoveResponsibleRegion(string URI, ulong regionhandle) public void RemoveResponsibleRegion(string URI, ulong regionhandle)
{ {
if (!MessageServers.ContainsKey(URI)) if (!MessageServers.ContainsKey(URI))
@ -94,19 +93,19 @@ namespace OpenSim.Grid.UserServer
MessageServers["URI"] = msginfo; MessageServers["URI"] = msginfo;
} }
} }
}
}
public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
if (requestData.Contains("uri")) if (requestData.Contains("uri"))
{ {
string URI = (string) requestData["uri"]; string URI = (string)requestData["uri"];
string sendkey = (string) requestData["sendkey"]; string sendkey=(string)requestData["sendkey"];
string recvkey = (string) requestData["recvkey"]; string recvkey=(string)requestData["recvkey"];
MessageServerInfo m = new MessageServerInfo(); MessageServerInfo m = new MessageServerInfo();
m.URI = URI; m.URI = URI;
m.sendkey = sendkey; m.sendkey = sendkey;
@ -117,16 +116,15 @@ namespace OpenSim.Grid.UserServer
} }
return response; return response;
} }
public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
if (requestData.Contains("uri")) if (requestData.Contains("uri"))
{ {
string URI = (string) requestData["uri"]; string URI = (string)requestData["uri"];
DeRegisterMessageServer(URI); DeRegisterMessageServer(URI);
responseData["responsestring"] = "TRUE"; responseData["responsestring"] = "TRUE";
@ -134,21 +132,20 @@ namespace OpenSim.Grid.UserServer
} }
return response; return response;
} }
public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request) public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
if (requestData.Contains("fromuri")) if (requestData.Contains("fromuri"))
{ {
string sURI = (string) requestData["fromuri"]; string sURI = (string)requestData["fromuri"];
string sagentID = (string) requestData["agentid"]; string sagentID = (string)requestData["agentid"];
string ssessionID = (string) requestData["sessionid"]; string ssessionID = (string)requestData["sessionid"];
string scurrentRegionID = (string) requestData["regionid"]; string scurrentRegionID = (string)requestData["regionid"];
string sregionhandle = (string) requestData["regionhandle"]; string sregionhandle = (string)requestData["regionhandle"];
string scurrentpos = (string) requestData["currentpos"]; string scurrentpos = (string)requestData["currentpos"];
//LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); //LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos);
// TODO: Okay now raise event so the user server can pass this data to the Usermanager // TODO: Okay now raise event so the user server can pass this data to the Usermanager
@ -196,7 +193,7 @@ namespace OpenSim.Grid.UserServer
// } // }
foreach (MessageServerInfo serv in MessageServers.Values) foreach (MessageServerInfo serv in MessageServers.Values)
{ {
NotifyMessageServerAboutUserLogoff(serv, agentID); NotifyMessageServerAboutUserLogoff(serv,agentID);
} }
} }
} }
@ -253,6 +250,7 @@ namespace OpenSim.Grid.UserServer
{ {
m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user"); m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user");
} }
} }
} }
} }

View File

@ -47,7 +47,9 @@ namespace OpenSim.Grid.UserServer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private UserLoggedInAtLocation handlerUserLoggedInAtLocation; public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
private UserLoggedInAtLocation handlerUserLoggedInAtLocation = null;
public UserConfig m_config; public UserConfig m_config;
@ -59,8 +61,6 @@ namespace OpenSim.Grid.UserServer
m_config = config; m_config = config;
} }
public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
/// <summary> /// <summary>
/// Customises the login response and fills in missing values. /// Customises the login response and fills in missing values.
/// </summary> /// </summary>
@ -95,8 +95,7 @@ namespace OpenSim.Grid.UserServer
else else
{ {
string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest); string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest);
m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" + m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]);
startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]);
if (startLocationRequestParsed[0] == "last") if (startLocationRequestParsed[0] == "last")
{ {
// TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z' // TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z'
@ -120,9 +119,7 @@ namespace OpenSim.Grid.UserServer
RegionProfileData.RequestSimProfileData( RegionProfileData.RequestSimProfileData(
theUser.HomeRegion, m_config.GridServerURL, theUser.HomeRegion, m_config.GridServerURL,
m_config.GridSendKey, m_config.GridRecvKey); m_config.GridSendKey, m_config.GridRecvKey);
} } else {
else
{
start_x = Convert.ToInt32(startLocationRequestParsed[1]); start_x = Convert.ToInt32(startLocationRequestParsed[1]);
start_y = Convert.ToInt32(startLocationRequestParsed[2]); start_y = Convert.ToInt32(startLocationRequestParsed[2]);
start_z = Convert.ToInt32(startLocationRequestParsed[3]); start_z = Convert.ToInt32(startLocationRequestParsed[3]);
@ -133,20 +130,20 @@ namespace OpenSim.Grid.UserServer
// Customise the response // Customise the response
//CFK: This is redundant and the next message should always appear. //CFK: This is redundant and the next message should always appear.
//CFK: m_log.Info("[LOGIN]: Home Location"); //CFK: m_log.Info("[LOGIN]: Home Location");
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize) + ",r" + response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" +
(SimInfo.regionLocY * Constants.RegionSize) + "], " + (SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " +
"'position':[r" + theUser.HomeLocation.X + ",r" + "'position':[r" + theUser.HomeLocation.X.ToString() + ",r" +
theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "], " + theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " +
"'look_at':[r" + theUser.HomeLocation.X + ",r" + "'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" +
theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "]}"; theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}";
// Destination // Destination
//CFK: The "Notifying" message always seems to appear, so subsume the data from this message into //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into
//CFK: the next one for X & Y and comment this one. //CFK: the next one for X & Y and comment this one.
//CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX +
//CFK: "; Region Y: " + SimInfo.regionLocY); //CFK: "; Region Y: " + SimInfo.regionLocY);
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new[] {'/', ':'})[3]).ToString(); response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString();
response.SimPort = uint.Parse(SimInfo.serverURI.Split(new[] {'/', ':'})[4]); response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]);
response.RegionX = SimInfo.regionLocX; response.RegionX = SimInfo.regionLocX;
response.RegionY = SimInfo.regionLocY; response.RegionY = SimInfo.regionLocY;
@ -166,8 +163,7 @@ namespace OpenSim.Grid.UserServer
theUser.CurrentAgent.Region = SimInfo.UUID; theUser.CurrentAgent.Region = SimInfo.UUID;
theUser.CurrentAgent.Handle = SimInfo.regionHandle; theUser.CurrentAgent.Handle = SimInfo.regionHandle;
if (start_x >= 0 && start_y >= 0 && start_z >= 0) if (start_x >= 0 && start_y >= 0 && start_z >= 0) {
{
LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z); LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z);
theUser.CurrentAgent.Position = tmp_v; theUser.CurrentAgent.Position = tmp_v;
} }
@ -207,9 +203,8 @@ namespace OpenSim.Grid.UserServer
{ {
//m_log.Info("[LOGIN]: Letting other objects know about login"); //m_log.Info("[LOGIN]: Letting other objects know about login");
handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X,theUser.CurrentAgent.Position.Y,theUser.CurrentAgent.Position.Z,
theUser.CurrentAgent.Position.Z, theUser.FirstName,theUser.SurName);
theUser.FirstName, theUser.SurName);
} }
} }
catch (Exception) catch (Exception)
@ -223,10 +218,10 @@ namespace OpenSim.Grid.UserServer
// Send him to default region instead // Send him to default region instead
// Load information from the gridserver // Load information from the gridserver
ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong) m_config.DefaultY * Constants.RegionSize); ulong defaultHandle = (((ulong)m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong)m_config.DefaultY * Constants.RegionSize);
m_log.Warn( m_log.Warn(
"[LOGIN]: Home region not available: sending to default " + defaultHandle); "[LOGIN]: Home region not available: sending to default " + defaultHandle.ToString());
try try
{ {
@ -236,19 +231,19 @@ namespace OpenSim.Grid.UserServer
// Customise the response // Customise the response
m_log.Info("[LOGIN]: Home Location"); m_log.Info("[LOGIN]: Home Location");
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize) + ",r" + response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" +
(SimInfo.regionLocY * Constants.RegionSize) + "], " + (SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " +
"'position':[r" + theUser.HomeLocation.X + ",r" + "'position':[r" + theUser.HomeLocation.X.ToString() + ",r" +
theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "], " + theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " +
"'look_at':[r" + theUser.HomeLocation.X + ",r" + "'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" +
theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "]}"; theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}";
// Destination // Destination
m_log.Info("[LOGIN]: " + m_log.Info("[LOGIN]: " +
"CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
SimInfo.regionLocY); SimInfo.regionLocY);
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new[] {'/', ':'})[3]).ToString(); response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString();
response.SimPort = uint.Parse(SimInfo.serverURI.Split(new[] {'/', ':'})[4]); response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]);
response.RegionX = SimInfo.regionLocX; response.RegionX = SimInfo.regionLocX;
response.RegionY = SimInfo.regionLocY; response.RegionY = SimInfo.regionLocY;
@ -288,8 +283,7 @@ namespace OpenSim.Grid.UserServer
{ {
m_log.Info("[LOGIN]: Letting other objects know about login"); m_log.Info("[LOGIN]: Letting other objects know about login");
handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z,
theUser.CurrentAgent.Position.Z,
theUser.FirstName, theUser.SurName); theUser.FirstName, theUser.SurName);
} }
} }
@ -297,7 +291,7 @@ namespace OpenSim.Grid.UserServer
catch (Exception e) catch (Exception e)
{ {
m_log.Warn("[LOGIN]: Default region also not available"); m_log.Warn("[LOGIN]: Default region also not available");
m_log.Warn("[LOGIN]: " + e); m_log.Warn("[LOGIN]: " + e.ToString());
} }
} }
} }

View File

@ -44,8 +44,8 @@ namespace OpenSim.Grid.UserServer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private logOffUser handlerLogOffUser;
public event logOffUser OnLogOffUser; public event logOffUser OnLogOffUser;
private logOffUser handlerLogOffUser = null;
/// <summary> /// <summary>
/// Deletes an active agent session /// Deletes an active agent session
@ -81,14 +81,14 @@ namespace OpenSim.Grid.UserServer
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
// Query Result Information // Query Result Information
responseData["queryid"] = queryID.ToString(); responseData["queryid"] = (string) queryID.ToString();
responseData["avcount"] = returnUsers.Count.ToString(); responseData["avcount"] = (string) returnUsers.Count.ToString();
for (int i = 0; i < returnUsers.Count; i++) for (int i = 0; i < returnUsers.Count; i++)
{ {
responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString(); responseData["avatarid" + i.ToString()] = returnUsers[i].AvatarID.ToString();
responseData["firstname" + i] = returnUsers[i].firstName; responseData["firstname" + i.ToString()] = returnUsers[i].firstName;
responseData["lastname" + i] = returnUsers[i].lastName; responseData["lastname" + i.ToString()] = returnUsers[i].lastName;
} }
response.Value = responseData; response.Value = responseData;
@ -101,14 +101,14 @@ namespace OpenSim.Grid.UserServer
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
// Query Result Information // Query Result Information
responseData["avcount"] = returnUsers.Count.ToString(); responseData["avcount"] = (string)returnUsers.Count.ToString();
for (int i = 0; i < returnUsers.Count; i++) for (int i = 0; i < returnUsers.Count; i++)
{ {
responseData["ownerID" + i] = returnUsers[i].FriendListOwner.UUID.ToString(); responseData["ownerID" + i.ToString()] = returnUsers[i].FriendListOwner.UUID.ToString();
responseData["friendID" + i] = returnUsers[i].Friend.UUID.ToString(); responseData["friendID" + i.ToString()] = returnUsers[i].Friend.UUID.ToString();
responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString(); responseData["ownerPerms" + i.ToString()] = returnUsers[i].FriendListOwnerPerms.ToString();
responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString(); responseData["friendPerms" + i.ToString()] = returnUsers[i].FriendPerms.ToString();
} }
response.Value = responseData; response.Value = responseData;
@ -156,21 +156,6 @@ namespace OpenSim.Grid.UserServer
return response; return response;
} }
public override UserProfileData SetupMasterUser(string firstName, string lastName)
{
throw new Exception("The method or operation is not implemented.");
}
public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
{
throw new Exception("The method or operation is not implemented.");
}
public override UserProfileData SetupMasterUser(LLUUID uuid)
{
throw new Exception("The method or operation is not implemented.");
}
#region XMLRPC User Methods #region XMLRPC User Methods
public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request) public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request)
@ -193,7 +178,7 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request) public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
string returnString = "FALSE"; string returnString = "FALSE";
// Query Result Information // Query Result Information
@ -201,8 +186,7 @@ namespace OpenSim.Grid.UserServer
if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms")) if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
{ {
// UserManagerBase.AddNewuserFriend // UserManagerBase.AddNewuserFriend
AddNewUserFriend(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]), AddNewUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
(uint) Convert.ToInt32((string) requestData["friendPerms"]));
returnString = "TRUE"; returnString = "TRUE";
} }
responseData["returnString"] = returnString; responseData["returnString"] = returnString;
@ -213,7 +197,7 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request) public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
string returnString = "FALSE"; string returnString = "FALSE";
// Query Result Information // Query Result Information
@ -221,7 +205,7 @@ namespace OpenSim.Grid.UserServer
if (requestData.Contains("ownerID") && requestData.Contains("friendID")) if (requestData.Contains("ownerID") && requestData.Contains("friendID"))
{ {
// UserManagerBase.AddNewuserFriend // UserManagerBase.AddNewuserFriend
RemoveUserFriend(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"])); RemoveUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]));
returnString = "TRUE"; returnString = "TRUE";
} }
responseData["returnString"] = returnString; responseData["returnString"] = returnString;
@ -232,14 +216,13 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request) public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
string returnString = "FALSE"; string returnString = "FALSE";
if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms")) if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
{ {
UpdateUserFriendPerms(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]), UpdateUserFriendPerms(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
(uint) Convert.ToInt32((string) requestData["friendPerms"]));
// UserManagerBase. // UserManagerBase.
returnString = "TRUE"; returnString = "TRUE";
} }
@ -251,14 +234,14 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request) public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
List<FriendListItem> returndata = new List<FriendListItem>(); List<FriendListItem> returndata = new List<FriendListItem>();
if (requestData.Contains("ownerID")) if (requestData.Contains("ownerID"))
{ {
returndata = GetUserFriendList(new LLUUID((string) requestData["ownerID"])); returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"]));
} }
return FriendListItemListtoXmlRPCResponse(returndata); return FriendListItemListtoXmlRPCResponse(returndata);
@ -338,7 +321,7 @@ namespace OpenSim.Grid.UserServer
{ {
m_log.Debug("[UserManager]: Got request to update user profile"); m_log.Debug("[UserManager]: Got request to update user profile");
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
UserProfileData userProfile; UserProfileData userProfile;
@ -347,7 +330,7 @@ namespace OpenSim.Grid.UserServer
return CreateUnknownUserErrorResponse(); return CreateUnknownUserErrorResponse();
} }
LLUUID UserUUID = new LLUUID((string) requestData["avatar_uuid"]); LLUUID UserUUID = new LLUUID((string)requestData["avatar_uuid"]);
userProfile = GetUserProfile(UserUUID); userProfile = GetUserProfile(UserUUID);
if (null == userProfile) if (null == userProfile)
{ {
@ -359,11 +342,11 @@ namespace OpenSim.Grid.UserServer
} }
if (requestData.Contains("FLImageID")) if (requestData.Contains("FLImageID"))
{ {
userProfile.FirstLifeImage = new LLUUID((string) requestData["FLImageID"]); userProfile.FirstLifeImage = new LLUUID((string)requestData["FLImageID"]);
} }
if (requestData.Contains("ImageID")) if (requestData.Contains("ImageID"))
{ {
userProfile.Image = new LLUUID((string) requestData["ImageID"]); userProfile.Image = new LLUUID((string)requestData["ImageID"]);
} }
// dont' know how yet // dont' know how yet
if (requestData.Contains("MaturePublish")) if (requestData.Contains("MaturePublish"))
@ -371,11 +354,11 @@ namespace OpenSim.Grid.UserServer
} }
if (requestData.Contains("AboutText")) if (requestData.Contains("AboutText"))
{ {
userProfile.AboutText = (string) requestData["AboutText"]; userProfile.AboutText = (string)requestData["AboutText"];
} }
if (requestData.Contains("FLAboutText")) if (requestData.Contains("FLAboutText"))
{ {
userProfile.FirstLifeAboutText = (string) requestData["FLAboutText"]; userProfile.FirstLifeAboutText = (string)requestData["FLAboutText"];
} }
// not in DB yet. // not in DB yet.
if (requestData.Contains("ProfileURL")) if (requestData.Contains("ProfileURL"))
@ -385,7 +368,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.HomeRegion = Convert.ToUInt64((string) requestData["home_region"]); userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]);
} }
catch (ArgumentException) catch (ArgumentException)
{ {
@ -399,23 +382,25 @@ namespace OpenSim.Grid.UserServer
{ {
m_log.Error("[PROFILE]:Failed to set home region, Value was too large"); m_log.Error("[PROFILE]:Failed to set home region, Value was too large");
} }
} }
if (requestData.Contains("home_pos_x")) if (requestData.Contains("home_pos_x"))
{ {
try try
{ {
userProfile.HomeLocationX = (float) Convert.ToDecimal((string) requestData["home_pos_x"]); userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
m_log.Error("[PROFILE]:Failed to set home postion x"); m_log.Error("[PROFILE]:Failed to set home postion x");
} }
} }
if (requestData.Contains("home_pos_y")) if (requestData.Contains("home_pos_y"))
{ {
try try
{ {
userProfile.HomeLocationY = (float) Convert.ToDecimal((string) requestData["home_pos_y"]); userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -426,7 +411,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.HomeLocationZ = (float) Convert.ToDecimal((string) requestData["home_pos_z"]); userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -437,7 +422,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.HomeLookAtX = (float) Convert.ToDecimal((string) requestData["home_look_x"]); userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -448,7 +433,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.HomeLookAtY = (float) Convert.ToDecimal((string) requestData["home_look_y"]); userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -459,7 +444,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.HomeLookAtZ = (float) Convert.ToDecimal((string) requestData["home_look_z"]); userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -476,18 +461,18 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request) public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
if (requestData.Contains("avatar_uuid")) if (requestData.Contains("avatar_uuid"))
{ {
try try
{ {
LLUUID userUUID = new LLUUID((string) requestData["avatar_uuid"]); LLUUID userUUID = new LLUUID((string)requestData["avatar_uuid"]);
LLUUID RegionID = new LLUUID((string) requestData["region_uuid"]); LLUUID RegionID = new LLUUID((string)requestData["region_uuid"]);
ulong regionhandle = (ulong) Convert.ToInt64((string) requestData["region_handle"]); ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
float posx = (float) Convert.ToDecimal((string) requestData["region_pos_x"]); float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]);
float posy = (float) Convert.ToDecimal((string) requestData["region_pos_y"]); float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]);
float posz = (float) Convert.ToDecimal((string) requestData["region_pos_z"]); float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]);
handlerLogOffUser = OnLogOffUser; handlerLogOffUser = OnLogOffUser;
if (handlerLogOffUser != null) if (handlerLogOffUser != null)
@ -510,5 +495,20 @@ namespace OpenSim.Grid.UserServer
} }
#endregion #endregion
public override UserProfileData SetupMasterUser(string firstName, string lastName)
{
throw new Exception("The method or operation is not implemented.");
}
public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
{
throw new Exception("The method or operation is not implemented.");
}
public override UserProfileData SetupMasterUser(LLUUID uuid)
{
throw new Exception("The method or operation is not implemented.");
}
} }
} }

View File

@ -32,10 +32,13 @@ namespace OpenSim.Region.Environment
/// <summary> /// <summary>
/// Bit Vector for Which Modules to send an instant message to from the Scene or an Associated Module /// Bit Vector for Which Modules to send an instant message to from the Scene or an Associated Module
/// </summary> /// </summary>
// This prevents the Modules from sending Instant messages to other modules through the scene // This prevents the Modules from sending Instant messages to other modules through the scene
// and then receiving the same messages // and then receiving the same messages
// This is mostly here because on LLSL and the SecondLife Client, IMs,Groups and friends are linked // This is mostly here because on LLSL and the SecondLife Client, IMs,Groups and friends are linked
// inseparably // inseparably
[Flags] [Flags]
public enum InstantMessageReceiver : uint public enum InstantMessageReceiver : uint
{ {

View File

@ -70,8 +70,7 @@ namespace OpenSim.Region.Environment.Interfaces
void handleSignificantClientMovement(IClientAPI remote_client); void handleSignificantClientMovement(IClientAPI remote_client);
void handleAnyClientMovement(ScenePresence avatar); void handleAnyClientMovement(ScenePresence avatar);
void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client); void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client);
void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID, uint flags, int landLocalID, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client);
void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID, uint flags, int landLocalID, List<ParcelManager.ParcelAccessEntry> entries,
IClientAPI remote_client);
} }
} }

View File

@ -32,10 +32,10 @@ namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IRegionModule public interface IRegionModule
{ {
string Name { get; }
bool IsSharedModule { get; }
void Initialise(Scene scene, IConfigSource source); void Initialise(Scene scene, IConfigSource source);
void PostInitialise(); void PostInitialise();
void Close(); void Close();
string Name { get; }
bool IsSharedModule { get; }
} }
} }

View File

@ -47,11 +47,12 @@ namespace OpenSim.Region.Environment
public class ModuleLoader public class ModuleLoader
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly IConfigSource m_config;
public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
private readonly List<IRegionModule> m_loadedModules = new List<IRegionModule>(); private readonly List<IRegionModule> m_loadedModules = new List<IRegionModule>();
private readonly Dictionary<string, IRegionModule> m_loadedSharedModules = new Dictionary<string, IRegionModule>(); private readonly Dictionary<string, IRegionModule> m_loadedSharedModules = new Dictionary<string, IRegionModule>();
public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); private readonly IConfigSource m_config;
public ModuleLoader(IConfigSource config) public ModuleLoader(IConfigSource config)
{ {
@ -85,8 +86,7 @@ namespace OpenSim.Region.Environment
DynamicTextureModule dynamicModule = new DynamicTextureModule(); DynamicTextureModule dynamicModule = new DynamicTextureModule();
if (m_loadedSharedModules.ContainsKey(dynamicModule.Name)) if (m_loadedSharedModules.ContainsKey(dynamicModule.Name))
{ {
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", dynamicModule.Name, m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", dynamicModule.Name, "DynamicTextureModule");
"DynamicTextureModule");
} }
else else
{ {
@ -149,13 +149,13 @@ namespace OpenSim.Region.Environment
AssetTransactionModule transactionsModule = new AssetTransactionModule(); AssetTransactionModule transactionsModule = new AssetTransactionModule();
if (m_loadedSharedModules.ContainsKey(transactionsModule.Name)) if (m_loadedSharedModules.ContainsKey(transactionsModule.Name))
{ {
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", transactionsModule.Name, m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", transactionsModule.Name, "TransactionModule");
"TransactionModule");
} }
else else
{ {
m_loadedSharedModules.Add(transactionsModule.Name, transactionsModule); m_loadedSharedModules.Add(transactionsModule.Name, transactionsModule);
} }
} }
public void InitialiseSharedModules(Scene scene) public void InitialiseSharedModules(Scene scene)
@ -284,7 +284,7 @@ namespace OpenSim.Region.Environment
{ {
if (pluginType.GetInterface("IRegionModule") != null) if (pluginType.GetInterface("IRegionModule") != null)
{ {
modules.Add((IRegionModule) Activator.CreateInstance(pluginType)); modules.Add((IRegionModule)Activator.CreateInstance(pluginType));
} }
} }
} }

View File

@ -40,16 +40,15 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetDownload
/// <summary> /// <summary>
/// Asset requests with data which are ready to be sent back to requesters. This includes textures. /// Asset requests with data which are ready to be sent back to requesters. This includes textures.
/// </summary> /// </summary>
private readonly List<AssetRequest> AssetRequests; private List<AssetRequest> AssetRequests;
private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); private Scene m_scene;
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
/// ///
/// Assets requests (for each user) which are waiting for asset server data. This includes texture requests /// Assets requests (for each user) which are waiting for asset server data. This includes texture requests
/// </summary> /// </summary>
private readonly Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> RequestedAssets; private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> RequestedAssets;
private Scene m_scene;
public AssetDownloadModule() public AssetDownloadModule()
{ {
@ -206,18 +205,22 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetDownload
{ {
public AssetBase AssetInf; public AssetBase AssetInf;
public byte AssetRequestSource = 2; public byte AssetRequestSource = 2;
public long DataPointer; public long DataPointer = 0;
public int DiscardLevel = -1; public int DiscardLevel = -1;
public AssetBase ImageInfo; public AssetBase ImageInfo;
public bool IsTextureRequest; public bool IsTextureRequest;
public int NumPackets; public int NumPackets = 0;
public int PacketCounter; public int PacketCounter = 0;
public byte[] Params; public byte[] Params = null;
public LLUUID RequestAssetID; public LLUUID RequestAssetID;
public IClientAPI RequestUser; public IClientAPI RequestUser;
public LLUUID TransferRequestID; public LLUUID TransferRequestID;
//public bool AssetInCache; //public bool AssetInCache;
//public int TimeRequested; //public int TimeRequested;
public AssetRequest()
{
}
} }
#endregion #endregion

View File

@ -44,7 +44,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Fields // Fields
private readonly bool m_dumpAssetsToFile; private bool m_dumpAssetsToFile;
public AgentAssetTransactionsManager Manager; public AgentAssetTransactionsManager Manager;
public LLUUID UserID; public LLUUID UserID;
public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>(); public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>();
@ -141,23 +141,23 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
public class AssetXferUploader public class AssetXferUploader
{ {
// Fields // Fields
private readonly bool m_dumpAssetToFile;
private readonly AgentAssetTransactions m_userTransactions;
public bool AddToInventory; public bool AddToInventory;
public AssetBase Asset; public AssetBase Asset;
public LLUUID InventFolder = LLUUID.Zero; public LLUUID InventFolder = LLUUID.Zero;
private sbyte invType; private sbyte invType = 0;
private bool m_createItem; private bool m_createItem = false;
private string m_description = String.Empty; private string m_description = String.Empty;
private bool m_finished; private bool m_dumpAssetToFile;
private bool m_finished = false;
private string m_name = String.Empty; private string m_name = String.Empty;
private bool m_storeLocal; private bool m_storeLocal;
private uint nextPerm; private AgentAssetTransactions m_userTransactions;
private uint nextPerm = 0;
private IClientAPI ourClient; private IClientAPI ourClient;
public LLUUID TransactionID = LLUUID.Zero; public LLUUID TransactionID = LLUUID.Zero;
private sbyte type; private sbyte type = 0;
public bool UploadComplete; public bool UploadComplete;
private byte wearableType; private byte wearableType = 0;
public ulong XferID; public ulong XferID;
public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile) public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
@ -390,7 +390,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
item.BasePermissions = 2147483647; item.BasePermissions = 2147483647;
item.CurrentPermissions = 2147483647; item.CurrentPermissions = 2147483647;
item.NextPermissions = nextPerm; item.NextPermissions = nextPerm;
item.Flags = wearableType; item.Flags = (uint) wearableType;
userInfo.AddItem(ourClient.AgentId, item); userInfo.AddItem(ourClient.AgentId, item);
ourClient.SendInventoryItemCreateUpdate(item); ourClient.SendInventoryItemCreateUpdate(item);

View File

@ -40,11 +40,16 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions
{ {
private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private bool m_dumpAssetsToFile; private bool m_dumpAssetsToFile = false;
private Scene m_scene; private Scene m_scene = null;
private AgentAssetTransactionsManager m_transactionManager; private AgentAssetTransactionsManager m_transactionManager;
public AssetTransactionModule()
{
// System.Console.WriteLine("creating AgentAssetTransactionModule");
}
#region IAgentAssetTransactions Members #region IAgentAssetTransactions Members
public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
@ -140,13 +145,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
/// <summary> /// <summary>
/// Each agent has its own singleton collection of transactions /// Each agent has its own singleton collection of transactions
/// </summary> /// </summary>
private readonly Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions = private Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
new Dictionary<LLUUID, AgentAssetTransactions>(); new Dictionary<LLUUID, AgentAssetTransactions>();
/// <summary> /// <summary>
/// Should we dump uploaded assets to the filesystem? /// Should we dump uploaded assets to the filesystem?
/// </summary> /// </summary>
private readonly bool m_dumpAssetsToFile; private bool m_dumpAssetsToFile;
public Scene MyScene; public Scene MyScene;

View File

@ -47,8 +47,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
private readonly BlockingQueue<ITextureSender> m_queueSenders private readonly BlockingQueue<ITextureSender> m_queueSenders
= new BlockingQueue<ITextureSender>(); = new BlockingQueue<ITextureSender>();
private readonly List<Scene> m_scenes = new List<Scene>();
/// <summary> /// <summary>
/// Each user has their own texture download service. /// Each user has their own texture download service.
/// </summary> /// </summary>
@ -56,9 +54,14 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
new Dictionary<LLUUID, UserTextureDownloadService>(); new Dictionary<LLUUID, UserTextureDownloadService>();
private Scene m_scene; private Scene m_scene;
private List<Scene> m_scenes = new List<Scene>();
private Thread m_thread; private Thread m_thread;
public TextureDownloadModule()
{
}
#region IRegionModule Members #region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config) public void Initialise(Scene scene, IConfigSource config)
@ -66,7 +69,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
if (m_scene == null) if (m_scene == null)
{ {
//Console.WriteLine("Creating Texture download module"); //Console.WriteLine("Creating Texture download module");
m_thread = new Thread(ProcessTextureSenders); m_thread = new Thread(new ThreadStart(ProcessTextureSenders));
m_thread.Name = "ProcessTextureSenderThread"; m_thread.Name = "ProcessTextureSenderThread";
m_thread.IsBackground = true; m_thread.IsBackground = true;
m_thread.Start(); m_thread.Start();

View File

@ -40,13 +40,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
//private static readonly log4net.ILog m_log //private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private readonly LLUUID m_textureId; private bool m_cancel = false;
private bool m_cancel;
private IClientAPI m_client; private IClientAPI m_client;
// See ITextureSender // See ITextureSender
private bool m_sending; private bool m_sending = false;
private LLUUID m_textureId;
// See ITextureSender // See ITextureSender

View File

@ -43,14 +43,12 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly IClientAPI RequestUser;
/// <summary> /// <summary>
/// Records the number of times texture send has been called. /// Records the number of times texture send has been called.
/// </summary> /// </summary>
public int counter; public int counter = 0;
public bool ImageLoaded; public bool ImageLoaded = false;
/// <summary> /// <summary>
/// Holds the texture asset to send. /// Holds the texture asset to send.
@ -59,26 +57,27 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
//public LLUUID assetID { get { return m_asset.FullID; } } //public LLUUID assetID { get { return m_asset.FullID; } }
private bool m_cancel; private bool m_cancel = false;
// See ITextureSender // See ITextureSender
private bool m_sending; private bool m_sending = false;
/// <summary> /// <summary>
/// This is actually the number of extra packets required to send the texture data! We always assume /// This is actually the number of extra packets required to send the texture data! We always assume
/// at least one is required. /// at least one is required.
/// </summary> /// </summary>
private int NumPackets; private int NumPackets = 0;
/// <summary> /// <summary>
/// Holds the packet number to send next. In this case, each packet is 1000 bytes long and starts /// Holds the packet number to send next. In this case, each packet is 1000 bytes long and starts
/// at the 600th byte (0th indexed). /// at the 600th byte (0th indexed).
/// </summary> /// </summary>
private int PacketCounter; private int PacketCounter = 0;
private int RequestedDiscardLevel = -1; private int RequestedDiscardLevel = -1;
private uint StartPacketNumber; private IClientAPI RequestUser;
private uint StartPacketNumber = 0;
public TextureSender(IClientAPI client, int discardLevel, uint packetNumber) public TextureSender(IClientAPI client, int discardLevel, uint packetNumber)
{ {
@ -191,7 +190,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
catch (ArgumentOutOfRangeException) catch (ArgumentOutOfRangeException)
{ {
m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" + m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" +
m_asset.FullID); m_asset.FullID.ToString());
return; return;
} }
RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);

View File

@ -41,6 +41,10 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
public XferModule()
{
}
#region IRegionModule Members #region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config) public void Initialise(Scene scene, IConfigSource config)
@ -145,11 +149,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
public IClientAPI Client; public IClientAPI Client;
private bool complete; private bool complete;
public byte[] Data = new byte[0]; public byte[] Data = new byte[0];
public int DataPointer; public int DataPointer = 0;
public string FileName = String.Empty; public string FileName = String.Empty;
public uint Packet; public uint Packet = 0;
public uint Serial = 1; public uint Serial = 1;
public ulong XferID; public ulong XferID = 0;
public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
{ {
@ -213,7 +217,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
{ {
byte[] transferData = new byte[Data.Length - DataPointer]; byte[] transferData = new byte[Data.Length - DataPointer];
Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
uint endPacket = Packet |= 0x80000000; uint endPacket = Packet |= (uint) 0x80000000;
Client.SendXferPacket(XferID, endPacket, transferData); Client.SendXferPacket(XferID, endPacket, transferData);
Packet++; Packet++;
DataPointer += (Data.Length - DataPointer); DataPointer += (Data.Length - DataPointer);

View File

@ -44,15 +44,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
public class ChatModule : IRegionModule, ISimChat public class ChatModule : IRegionModule, ISimChat
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly List<Scene> m_scenes = new List<Scene>(); private string m_defaultzone = null;
private string m_defaultzone;
private IRCChatModule m_irc; private IRCChatModule m_irc = null;
private Thread m_irc_connector; private Thread m_irc_connector = null;
private string m_last_leaving_user; private string m_last_leaving_user = null;
private string m_last_new_user; private string m_last_new_user = null;
private int m_saydistance = 30; private int m_saydistance = 30;
private List<Scene> m_scenes = new List<Scene>();
private int m_shoutdistance = 100; private int m_shoutdistance = 100;
internal object m_syncInit = new object(); internal object m_syncInit = new object();
internal object m_syncLogout = new object(); internal object m_syncLogout = new object();
@ -257,7 +257,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
} }
catch (Exception ex) catch (Exception ex)
{ {
m_log.Error("[IRC]: NewClient exception trap:" + ex); m_log.Error("[IRC]: NewClient exception trap:" + ex.ToString());
} }
} }
@ -284,7 +284,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
} }
catch (Exception ex) catch (Exception ex)
{ {
m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex); m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex.ToString());
} }
} }
} }
@ -372,24 +372,24 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
#endregion #endregion
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly string m_basenick;
private readonly string m_channel;
private readonly bool m_enabled;
private readonly uint m_port = 6668;
private readonly string m_privmsgformat = "PRIVMSG {0} :<{1} in {2}>: {3}";
private readonly string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
private Thread listener; private Thread listener;
private bool m_connected;
private List<Scene> m_last_scenes; private string m_basenick = null;
private string m_nick; private string m_channel = null;
private bool m_connected = false;
private bool m_enabled = false;
private List<Scene> m_last_scenes = null;
private string m_nick = null;
private uint m_port = 6668;
private string m_privmsgformat = "PRIVMSG {0} :<{1} in {2}>: {3}";
private StreamReader m_reader; private StreamReader m_reader;
private List<Scene> m_scenes; private List<Scene> m_scenes = null;
private string m_server; private string m_server = null;
private NetworkStream m_stream; private NetworkStream m_stream;
internal object m_syncConnect = new object(); internal object m_syncConnect = new object();
private TcpClient m_tcp; private TcpClient m_tcp;
private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
private StreamWriter m_writer; private StreamWriter m_writer;
private Thread pingSender; private Thread pingSender;
@ -478,13 +478,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
m_reader = new StreamReader(m_stream); m_reader = new StreamReader(m_stream);
m_writer = new StreamWriter(m_stream); m_writer = new StreamWriter(m_stream);
pingSender = new Thread(PingRun); pingSender = new Thread(new ThreadStart(PingRun));
pingSender.Name = "PingSenderThread"; pingSender.Name = "PingSenderThread";
pingSender.IsBackground = true; pingSender.IsBackground = true;
pingSender.Start(); pingSender.Start();
ThreadTracker.Add(pingSender); ThreadTracker.Add(pingSender);
listener = new Thread(ListenerRun); listener = new Thread(new ThreadStart(ListenerRun));
listener.Name = "IRCChatModuleListenerThread"; listener.Name = "IRCChatModuleListenerThread";
listener.IsBackground = true; listener.IsBackground = true;
listener.Start(); listener.Start();
@ -545,7 +545,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
} }
catch (Exception ex) catch (Exception ex)
{ {
m_log.Error("[IRC]: PrivMsg exception trap:" + ex); m_log.Error("[IRC]: PrivMsg exception trap:" + ex.ToString());
} }
} }
@ -588,7 +588,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{ {
try try
{ {
if (m_connected) if (m_connected == true)
{ {
m_writer.WriteLine("PING :" + m_server); m_writer.WriteLine("PING :" + m_server);
m_writer.Flush(); m_writer.Flush();
@ -602,7 +602,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
} }
catch (Exception ex) catch (Exception ex)
{ {
m_log.Error("[IRC]: PingRun exception trap:" + ex + "\n" + ex.StackTrace); m_log.Error("[IRC]: PingRun exception trap:" + ex.ToString() + "\n" + ex.StackTrace);
} }
} }
} }
@ -615,7 +615,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{ {
try try
{ {
while (m_connected && ((inputLine = m_reader.ReadLine()) != null)) while ((m_connected == true) && ((inputLine = m_reader.ReadLine()) != null))
{ {
// Console.WriteLine(inputLine); // Console.WriteLine(inputLine);
if (inputLine.Contains(m_channel)) if (inputLine.Contains(m_channel))
@ -659,7 +659,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
} }
catch (Exception ex) catch (Exception ex)
{ {
m_log.Error("[IRC]: ListenerRun exception trap:" + ex + "\n" + ex.StackTrace); m_log.Error("[IRC]: ListenerRun exception trap:" + ex.ToString() + "\n" + ex.StackTrace);
} }
} }
} }
@ -685,7 +685,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
} }
catch (Exception ex) // IRC gate should not crash Sim catch (Exception ex) // IRC gate should not crash Sim
{ {
m_log.Error("[IRC]: BroadcastSim Exception Trap:" + ex + "\n" + ex.StackTrace); m_log.Error("[IRC]: BroadcastSim Exception Trap:" + ex.ToString() + "\n" + ex.StackTrace);
} }
} }

View File

@ -65,55 +65,55 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
public class SampleMoneyModule : IMoneyModule public class SampleMoneyModule : IMoneyModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Dictionary<LLUUID, int> m_KnownClientFunds = new Dictionary<LLUUID, int>();
/// <summary>
/// Region UUIDS indexed by AgentID
/// </summary>
private readonly Dictionary<LLUUID, LLUUID> m_rootAgents = new Dictionary<LLUUID, LLUUID>();
/// <summary>
/// Scenes by Region Handle
/// </summary>
private readonly Dictionary<ulong, Scene> m_scenel = new Dictionary<ulong, Scene>();
/// <summary> /// <summary>
/// Where Stipends come from and Fees go to. /// Where Stipends come from and Fees go to.
/// </summary> /// </summary>
private LLUUID EconomyBaseAccount = LLUUID.Zero; private LLUUID EconomyBaseAccount = LLUUID.Zero;
private float EnergyEfficiency; private float EnergyEfficiency = 0f;
private bool gridmode; private bool gridmode = false;
private ObjectPaid handerOnObjectPaid; private ObjectPaid handerOnObjectPaid;
private bool m_enabled = true; private bool m_enabled = true;
private IConfigSource m_gConfig; private IConfigSource m_gConfig;
private bool m_keepMoneyAcrossLogins = true; private bool m_keepMoneyAcrossLogins = true;
private Dictionary<LLUUID, int> m_KnownClientFunds = new Dictionary<LLUUID, int>();
private string m_LandAddress = String.Empty; private string m_LandAddress = String.Empty;
private int m_minFundsBeforeRefresh = 100; private int m_minFundsBeforeRefresh = 100;
private string m_MoneyAddress = String.Empty; private string m_MoneyAddress = String.Empty;
/// <summary>
/// Region UUIDS indexed by AgentID
/// </summary>
private Dictionary<LLUUID, LLUUID> m_rootAgents = new Dictionary<LLUUID, LLUUID>();
/// <summary>
/// Scenes by Region Handle
/// </summary>
private Dictionary<ulong, Scene> m_scenel = new Dictionary<ulong, Scene>();
private int m_stipend = 1000; private int m_stipend = 1000;
private int ObjectCapacity = 45000; private int ObjectCapacity = 45000;
private int ObjectCount; private int ObjectCount = 0;
private int PriceEnergyUnit; private int PriceEnergyUnit = 0;
private int PriceGroupCreate; private int PriceGroupCreate = 0;
private int PriceObjectClaim; private int PriceObjectClaim = 0;
private float PriceObjectRent; private float PriceObjectRent = 0f;
private float PriceObjectScaleFactor; private float PriceObjectScaleFactor = 0f;
private int PriceParcelClaim; private int PriceParcelClaim = 0;
private float PriceParcelClaimFactor; private float PriceParcelClaimFactor = 0f;
private int PriceParcelRent; private int PriceParcelRent = 0;
private int PricePublicObjectDecay; private int PricePublicObjectDecay = 0;
private int PricePublicObjectDelete; private int PricePublicObjectDelete = 0;
private int PriceRentLight; private int PriceRentLight = 0;
private int PriceUpload; private int PriceUpload = 0;
private int TeleportMinPrice; private int TeleportMinPrice = 0;
private float TeleportPriceExponent; private float TeleportPriceExponent = 0f;
private int UserLevelPaysFees = 2; private int UserLevelPaysFees = 2;
private Scene XMLRPCHandler; private Scene XMLRPCHandler;
@ -305,7 +305,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
Hashtable hbinfo = Hashtable hbinfo =
GetBalanceForUserFromMoneyServer(client.AgentId, client.SecureSessionId, s.RegionInfo.originRegionID.ToString(), GetBalanceForUserFromMoneyServer(client.AgentId, client.SecureSessionId, s.RegionInfo.originRegionID.ToString(),
s.RegionInfo.regionSecret); s.RegionInfo.regionSecret);
if ((bool) hbinfo["success"]) if ((bool) hbinfo["success"] == true)
{ {
Helpers.TryParse((string) hbinfo["agentId"], out agentID); Helpers.TryParse((string) hbinfo["agentId"], out agentID);
try try
@ -333,7 +333,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
else else
{ {
m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentID, m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentID,
hbinfo["errorMessage"]); (string) hbinfo["errorMessage"]);
client.SendAlertMessage((string) hbinfo["errorMessage"]); client.SendAlertMessage((string) hbinfo["errorMessage"]);
} }
SendMoneyBalance(client, agentID, client.SessionId, LLUUID.Zero); SendMoneyBalance(client, agentID, client.SessionId, LLUUID.Zero);
@ -660,7 +660,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
Hashtable hresult = genericCurrencyXMLRPCRequest(ht, "regionMoveMoney"); Hashtable hresult = genericCurrencyXMLRPCRequest(ht, "regionMoveMoney");
if ((bool) hresult["success"]) if ((bool) hresult["success"] == true)
{ {
int funds1 = 0; int funds1 = 0;
int funds2 = 0; int funds2 = 0;
@ -718,7 +718,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
Hashtable hbinfo = Hashtable hbinfo =
GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(),
s.RegionInfo.regionSecret); s.RegionInfo.regionSecret);
if ((bool) hbinfo["success"]) if ((bool) hbinfo["success"] == true)
{ {
try try
{ {
@ -743,7 +743,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
else else
{ {
m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId,
hbinfo["errorMessage"]); (string) hbinfo["errorMessage"]);
aClient.SendAlertMessage((string) hbinfo["errorMessage"]); aClient.SendAlertMessage((string) hbinfo["errorMessage"]);
} }
} }
@ -812,7 +812,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
string secret = (string) requestData["secret"]; string secret = (string) requestData["secret"];
Scene userScene = GetRandomScene(); Scene userScene = GetRandomScene();
if (userScene.RegionInfo.regionSecret == secret) if (userScene.RegionInfo.regionSecret.ToString() == secret)
{ {
IClientAPI client = LocateClientObject(agentId); IClientAPI client = LocateClientObject(agentId);
@ -1238,7 +1238,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
{ {
lock (e) lock (e)
{ {
if (e.economyValidated && e.transactionID == 0) if (e.economyValidated == true && e.transactionID == 0)
{ {
e.transactionID = Util.UnixTimeSinceEpoch(); e.transactionID = Util.UnixTimeSinceEpoch();
@ -1328,7 +1328,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
else else
{ {
m_log.Warn("[MONEY]: Potential Fraud Warning, got money transfer request for avatar that isn't in this simulator - Details; Sender:" + m_log.Warn("[MONEY]: Potential Fraud Warning, got money transfer request for avatar that isn't in this simulator - Details; Sender:" +
e.sender + " Receiver: " + e.receiver + " Amount: " + e.amount); e.sender.ToString() + " Receiver: " + e.receiver.ToString() + " Amount: " + e.amount.ToString());
} }
} }
@ -1400,7 +1400,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
{ {
Hashtable hresult = Hashtable hresult =
claim_user(avatar.UUID, avatar.ControllingClient.SecureSessionId, regionID, RegionItem.RegionInfo.regionSecret); claim_user(avatar.UUID, avatar.ControllingClient.SecureSessionId, regionID, RegionItem.RegionInfo.regionSecret);
if ((bool) hresult["success"]) if ((bool) hresult["success"] == true)
{ {
int funds = 0; int funds = 0;
try try
@ -1432,7 +1432,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
if (RegionItem != null) if (RegionItem != null)
{ {
Hashtable hresult = claim_user(avatar.UUID, avatar.ControllingClient.SecureSessionId, regionID, RegionItem.RegionInfo.regionSecret); Hashtable hresult = claim_user(avatar.UUID, avatar.ControllingClient.SecureSessionId, regionID, RegionItem.RegionInfo.regionSecret);
if ((bool) hresult["success"]) if ((bool) hresult["success"] == true)
{ {
int funds = 0; int funds = 0;
try try
@ -1460,7 +1460,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
#endregion #endregion
} }
public enum TransactionType public enum TransactionType : int
{ {
SystemGenerated = 0, SystemGenerated = 0,
RegionMoneyRequest = 1, RegionMoneyRequest = 1,

View File

@ -42,10 +42,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Dictionary<LLUUID, List<FriendListItem>> FriendLists = new Dictionary<LLUUID, List<FriendListItem>>(); private Dictionary<LLUUID, List<FriendListItem>> FriendLists = new Dictionary<LLUUID, List<FriendListItem>>();
private readonly Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>(); private Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>();
private readonly Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>(); private Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>();
private readonly List<Scene> m_scene = new List<Scene>(); private List<Scene> m_scene = new List<Scene>();
#region IRegionModule Members #region IRegionModule Members
@ -213,7 +213,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
List<LLUUID> updateUsers = new List<LLUUID>(); List<LLUUID> updateUsers = new List<LLUUID>();
foreach (FriendListItem fli in lfli) foreach (FriendListItem fli in lfli)
{ {
if (fli.onlinestatus) if (fli.onlinestatus == true)
{ {
updateUsers.Add(fli.Friend); updateUsers.Add(fli.Friend);
} }
@ -357,20 +357,20 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
// https://wiki.secondlife.com/wiki/ImprovedInstantMessage // https://wiki.secondlife.com/wiki/ImprovedInstantMessage
// 38 == Offer friendship // 38 == Offer friendship
if (dialog == 38) if (dialog == (byte) 38)
{ {
LLUUID friendTransactionID = LLUUID.Random(); LLUUID friendTransactionID = LLUUID.Random();
m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); m_pendingFriendRequests.Add(friendTransactionID, fromAgentID);
m_log.Info("[FRIEND]: 38 - From:" + fromAgentID + " To: " + toAgentID + " Session:" + imSessionID + " Message:" + m_log.Info("[FRIEND]: 38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
message); message);
GridInstantMessage msg = new GridInstantMessage(); GridInstantMessage msg = new GridInstantMessage();
msg.fromAgentID = fromAgentID.UUID; msg.fromAgentID = fromAgentID.UUID;
msg.fromAgentSession = fromAgentSession.UUID; msg.fromAgentSession = fromAgentSession.UUID;
msg.toAgentID = toAgentID.UUID; msg.toAgentID = toAgentID.UUID;
msg.imSessionID = friendTransactionID.UUID; // This is the item we're mucking with here msg.imSessionID = friendTransactionID.UUID; // This is the item we're mucking with here
m_log.Info("[FRIEND]: Filling Session: " + msg.imSessionID); m_log.Info("[FRIEND]: Filling Session: " + msg.imSessionID.ToString());
msg.timestamp = timestamp; msg.timestamp = timestamp;
if (client != null) if (client != null)
{ {
@ -393,16 +393,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
} }
// 39 == Accept Friendship // 39 == Accept Friendship
if (dialog == 39) if (dialog == (byte) 39)
{ {
m_log.Info("[FRIEND]: 39 - From:" + fromAgentID + " To: " + toAgentID + " Session:" + imSessionID + " Message:" + m_log.Info("[FRIEND]: 39 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
message); message);
} }
// 40 == Decline Friendship // 40 == Decline Friendship
if (dialog == 40) if (dialog == (byte) 40)
{ {
m_log.Info("[FRIEND]: 40 - From:" + fromAgentID + " To: " + toAgentID + " Session:" + imSessionID + " Message:" + m_log.Info("[FRIEND]: 40 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
message); message);
} }
} }
@ -433,14 +433,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
msg.ParentEstateID = 0; msg.ParentEstateID = 0;
msg.timestamp = (uint) Util.UnixTimeSinceEpoch(); msg.timestamp = (uint) Util.UnixTimeSinceEpoch();
msg.RegionID = SceneAgentIn.RegionInfo.RegionID.UUID; msg.RegionID = SceneAgentIn.RegionInfo.RegionID.UUID;
msg.dialog = 39; // Approved friend request msg.dialog = (byte) 39; // Approved friend request
msg.Position = new sLLVector3(); msg.Position = new sLLVector3();
msg.offline = 0; msg.offline = (byte) 0;
msg.binaryBucket = new byte[0]; msg.binaryBucket = new byte[0];
// We don't really care which scene we pipe it through, it goes to the shared IM Module and/or the database // We don't really care which scene we pipe it through, it goes to the shared IM Module and/or the database
SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
SceneAgentIn.StoreAddFriendship(m_pendingFriendRequests[transactionID], agentID, 1); SceneAgentIn.StoreAddFriendship(m_pendingFriendRequests[transactionID], agentID, (uint) 1);
m_pendingFriendRequests.Remove(transactionID); m_pendingFriendRequests.Remove(transactionID);
// TODO: Inform agent that the friend is online // TODO: Inform agent that the friend is online
@ -471,9 +471,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
msg.ParentEstateID = 0; msg.ParentEstateID = 0;
msg.timestamp = (uint) Util.UnixTimeSinceEpoch(); msg.timestamp = (uint) Util.UnixTimeSinceEpoch();
msg.RegionID = SceneAgentIn.RegionInfo.RegionID.UUID; msg.RegionID = SceneAgentIn.RegionInfo.RegionID.UUID;
msg.dialog = 40; // Deny friend request msg.dialog = (byte) 40; // Deny friend request
msg.Position = new sLLVector3(); msg.Position = new sLLVector3();
msg.offline = 0; msg.offline = (byte) 0;
msg.binaryBucket = new byte[0]; msg.binaryBucket = new byte[0];
SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
m_pendingFriendRequests.Remove(transactionID); m_pendingFriendRequests.Remove(transactionID);

View File

@ -41,10 +41,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Dictionary<LLUUID, GroupList> m_grouplistmap = new Dictionary<LLUUID, GroupList>(); private Dictionary<LLUUID, GroupList> m_grouplistmap = new Dictionary<LLUUID, GroupList>();
private readonly Dictionary<LLUUID, GroupData> m_groupmap = new Dictionary<LLUUID, GroupData>(); private Dictionary<LLUUID, GroupData> m_groupmap = new Dictionary<LLUUID, GroupData>();
private readonly Dictionary<LLUUID, IClientAPI> m_iclientmap = new Dictionary<LLUUID, IClientAPI>(); private Dictionary<LLUUID, IClientAPI> m_iclientmap = new Dictionary<LLUUID, IClientAPI>();
private readonly List<Scene> m_scene = new List<Scene>(); private List<Scene> m_scene = new List<Scene>();
#region IRegionModule Members #region IRegionModule Members
@ -214,7 +214,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
} }
else else
{ {
m_log.Info("[GROUP]: Removing all reference to groups for " + agentID); m_log.Info("[GROUP]: Removing all reference to groups for " + agentID.ToString());
} }
m_iclientmap.Remove(agentID); m_iclientmap.Remove(agentID);
} }

View File

@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
/// occurs in the initial offer message, not the accept message. So this dictionary links /// occurs in the initial offer message, not the accept message. So this dictionary links
/// IM Session Ids to ItemIds /// IM Session Ids to ItemIds
/// </summary> /// </summary>
private readonly IDictionary<LLUUID, LLUUID> m_pendingOffers = new Dictionary<LLUUID, LLUUID>(); private IDictionary<LLUUID, LLUUID> m_pendingOffers = new Dictionary<LLUUID, LLUUID>();
private Scene m_scene; private Scene m_scene;

View File

@ -41,6 +41,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Profiles
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene; private Scene m_scene;
public AvatarProfilesModule()
{
}
#region IRegionModule Members #region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config) public void Initialise(Scene scene, IConfigSource config)
@ -100,7 +104,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Profiles
} }
else else
{ {
m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID); m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString());
} }
} }

View File

@ -42,11 +42,11 @@ namespace OpenSim.Region.Environment.Modules.Framework
public class Command : ICommand public class Command : ICommand
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly List<CommandArgument> m_args = new List<CommandArgument>(); private List<CommandArgument> m_args = new List<CommandArgument>();
private readonly Action<object[]> m_command; private Action<object[]> m_command;
private readonly string m_help; private string m_help;
private readonly string m_name; private string m_name;
public Command(string name, Action<Object[]> command, string help) public Command(string name, Action<Object[]> command, string help)
{ {
@ -164,9 +164,9 @@ namespace OpenSim.Region.Environment.Modules.Framework
/// </summary> /// </summary>
public class CommandArgument public class CommandArgument
{ {
private readonly string m_help; private string m_help;
private readonly string m_name; private string m_name;
private readonly string m_type; private string m_type;
private Object m_val; private Object m_val;
public CommandArgument(string name, string help, string type) public CommandArgument(string name, string help, string type)
@ -204,8 +204,8 @@ namespace OpenSim.Region.Environment.Modules.Framework
public class Commander : ICommander public class Commander : ICommander
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Dictionary<string, ICommand> m_commands = new Dictionary<string, ICommand>(); private Dictionary<string, ICommand> m_commands = new Dictionary<string, ICommand>();
private readonly string m_name; private string m_name;
public Commander(string name) public Commander(string name)
{ {
@ -235,11 +235,11 @@ namespace OpenSim.Region.Environment.Modules.Framework
} }
classSrc = classSrc.Remove(classSrc.Length - 1); // Delete the last comma classSrc = classSrc.Remove(classSrc.Length - 1); // Delete the last comma
classSrc += " )\n\t{\n"; classSrc += " )\n\t{\n";
classSrc += "\t\tObject[] args = new Object[" + com.Arguments.Count + "];\n"; classSrc += "\t\tObject[] args = new Object[" + com.Arguments.Count.ToString() + "];\n";
int i = 0; int i = 0;
foreach (KeyValuePair<string, string> arg in com.Arguments) foreach (KeyValuePair<string, string> arg in com.Arguments)
{ {
classSrc += "\t\targs[" + i + "] = " + Util.Md5Hash(arg.Key) + " " + ";\n"; classSrc += "\t\targs[" + i.ToString() + "] = " + Util.Md5Hash(arg.Key) + " " + ";\n";
i++; i++;
} }
classSrc += "\t\tGetCommander(\"" + m_name + "\").Run(\"" + com.Name + "\", args);\n"; classSrc += "\t\tGetCommander(\"" + m_name + "\").Run(\"" + com.Name + "\", args);\n";

View File

@ -34,7 +34,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
{ {
public class CommanderTestModule : IRegionModule, ICommandableModule public class CommanderTestModule : IRegionModule, ICommandableModule
{ {
private readonly Commander m_commander = new Commander("CommanderTest"); private Commander m_commander = new Commander("CommanderTest");
private Scene m_scene; private Scene m_scene;
#region ICommandableModule Members #region ICommandableModule Members

View File

@ -29,14 +29,14 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
#endregion #endregion
private readonly Dictionary<Type, Object> m_interfaces = new Dictionary<Type, object>(); private readonly Dictionary<Type, Object> m_interfaces = new Dictionary<Type, object>();
private readonly Object m_lockObject = new object();
private readonly List<Location> m_myLocations = new List<Location>(); private readonly List<Location> m_myLocations = new List<Location>();
private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>(); private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>();
private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>(); private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>();
private IConfigSource m_config; private IConfigSource m_config;
private bool m_enabled; private bool m_enabled = false;
private Object m_lockObject = new object();
private RemotingObject m_myRemote; private RemotingObject m_myRemote;
private TcpChannel m_tcpChannel; private TcpChannel m_tcpChannel;
private int m_tcpPort = 10101; private int m_tcpPort = 10101;

View File

@ -40,12 +40,12 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
{ {
public class DynamicTextureModule : IRegionModule, IDynamicTextureManager public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
{ {
private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private readonly Dictionary<string, IDynamicTextureRender> RenderPlugins = private Dictionary<string, IDynamicTextureRender> RenderPlugins =
new Dictionary<string, IDynamicTextureRender>(); new Dictionary<string, IDynamicTextureRender>();
private readonly Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
#region IDynamicTextureManager Members #region IDynamicTextureManager Members
@ -176,14 +176,14 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
public class DynamicTextureUpdater public class DynamicTextureUpdater
{ {
public bool BlendWithOldTexture; public bool BlendWithOldTexture = false;
public string BodyData; public string BodyData;
public string ContentType; public string ContentType;
public byte FrontAlpha = 255; public byte FrontAlpha = 255;
public LLUUID LastAssetID; public LLUUID LastAssetID;
public string Params; public string Params;
public LLUUID PrimID; public LLUUID PrimID;
public bool SetNewFrontAlpha; public bool SetNewFrontAlpha = false;
public LLUUID SimUUID; public LLUUID SimUUID;
public LLUUID UpdaterID; public LLUUID UpdaterID;
public int UpdateTimer; public int UpdateTimer;

View File

@ -84,7 +84,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
{ {
public class HttpRequestModule : IRegionModule, IHttpRequests public class HttpRequestModule : IRegionModule, IHttpRequests
{ {
private readonly object HttpListLock = new object(); private object HttpListLock = new object();
private int httpTimeout = 30000; private int httpTimeout = 30000;
private string m_name = "HttpScriptRequests"; private string m_name = "HttpScriptRequests";
@ -93,6 +93,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
private Scene m_scene; private Scene m_scene;
private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>(); private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>();
public HttpRequestModule()
{
}
#region IHttpRequests Members #region IHttpRequests Members
public LLUUID MakeHttpRequest(string url, string parameters, string body) public LLUUID MakeHttpRequest(string url, string parameters, string body)

View File

@ -120,9 +120,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
private void MakeHttpRequest(string url, LLUUID requestID) private void MakeHttpRequest(string url, LLUUID requestID)
{ {
WebRequest request = WebRequest.Create(url); WebRequest request = HttpWebRequest.Create(url);
RequestState state = new RequestState((HttpWebRequest) request, requestID); RequestState state = new RequestState((HttpWebRequest) request, requestID);
IAsyncResult result = request.BeginGetResponse(HttpRequestReturn, state); IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
state.TimeOfRequest = (int) t.TotalSeconds; state.TimeOfRequest = (int) t.TotalSeconds;
@ -131,7 +131,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
private void HttpRequestReturn(IAsyncResult result) private void HttpRequestReturn(IAsyncResult result)
{ {
RequestState state = (RequestState) result.AsyncState; RequestState state = (RequestState) result.AsyncState;
WebRequest request = state.Request; WebRequest request = (WebRequest) state.Request;
HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result); HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result);
if (response.StatusCode == HttpStatusCode.OK) if (response.StatusCode == HttpStatusCode.OK)
{ {
@ -175,9 +175,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
public class RequestState public class RequestState
{ {
public HttpWebRequest Request; public HttpWebRequest Request = null;
public LLUUID RequestID = LLUUID.Zero; public LLUUID RequestID = LLUUID.Zero;
public int TimeOfRequest; public int TimeOfRequest = 0;
public RequestState(HttpWebRequest request, LLUUID requestID) public RequestState(HttpWebRequest request, LLUUID requestID)
{ {

View File

@ -48,6 +48,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
private Scene m_scene; private Scene m_scene;
private IDynamicTextureManager m_textureManager; private IDynamicTextureManager m_textureManager;
public VectorRenderModule()
{
}
#region IDynamicTextureRender Members #region IDynamicTextureRender Members
public string GetContentType() public string GetContentType()
@ -134,7 +138,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
catch (Exception e) catch (Exception e)
{ {
//Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used //Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used
Console.WriteLine("Problem with Draw. Please verify parameters." + e); Console.WriteLine("Problem with Draw. Please verify parameters." + e.ToString());
} }
if ((size < 128) || (size > 1024)) if ((size < 128) || (size > 1024))
@ -256,7 +260,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
endPoint.X = (int) x; endPoint.X = (int) x;
endPoint.Y = (int) y; endPoint.Y = (int) y;
Image image = ImageHttpRequest(nextLine); Image image = ImageHttpRequest(nextLine);
graph.DrawImage(image, startPoint.X, startPoint.Y, x, y); graph.DrawImage(image, (float) startPoint.X, (float) startPoint.Y, x, y);
startPoint.X += endPoint.X; startPoint.X += endPoint.X;
startPoint.Y += endPoint.Y; startPoint.Y += endPoint.Y;
} }
@ -349,7 +353,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
private Bitmap ImageHttpRequest(string url) private Bitmap ImageHttpRequest(string url)
{ {
WebRequest request = WebRequest.Create(url); WebRequest request = HttpWebRequest.Create(url);
//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. //Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used.
//Ckrinke Stream str = null; //Ckrinke Stream str = null;
HttpWebResponse response = (HttpWebResponse) (request).GetResponse(); HttpWebResponse response = (HttpWebResponse) (request).GetResponse();

View File

@ -75,6 +75,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
private Queue m_pendingQ; private Queue m_pendingQ;
private Scene m_scene; private Scene m_scene;
public WorldCommModule()
{
}
#region IRegionModule Members #region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config) public void Initialise(Scene scene, IConfigSource config)
@ -320,8 +324,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
public class ListenerManager public class ListenerManager
{ {
//private Dictionary<int, ListenerInfo> m_listeners; //private Dictionary<int, ListenerInfo> m_listeners;
private readonly Hashtable m_listeners = Hashtable.Synchronized(new Hashtable());
private object ListenersLock = new object(); private object ListenersLock = new object();
private Hashtable m_listeners = Hashtable.Synchronized(new Hashtable());
private int m_MaxListeners = 100; private int m_MaxListeners = 100;
public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg)
@ -481,7 +485,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
public class ListenerInfo public class ListenerInfo
{ {
private readonly LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
private bool m_active; // Listener is active or not private bool m_active; // Listener is active or not
private int m_channel; // Channel private int m_channel; // Channel
private int m_handle; // Assigned handle of this listener private int m_handle; // Assigned handle of this listener
@ -491,6 +494,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
private uint m_localID; // Local ID from script engine private uint m_localID; // Local ID from script engine
private string m_message; // The message private string m_message; // The message
private string m_name; // Object name to filter messages from private string m_name; // Object name to filter messages from
private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message)
{ {

View File

@ -78,20 +78,20 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
public class XMLRPCModule : IRegionModule, IXMLRPC public class XMLRPCModule : IRegionModule, IXMLRPC
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly List<Scene> m_scenes = new List<Scene>();
private readonly object XMLRPCListLock = new object();
private string m_name = "XMLRPCModule"; private string m_name = "XMLRPCModule";
// <channel id, RPCChannelInfo> // <channel id, RPCChannelInfo>
private Dictionary<LLUUID, RPCChannelInfo> m_openChannels; private Dictionary<LLUUID, RPCChannelInfo> m_openChannels;
private Dictionary<LLUUID, SendRemoteDataRequest> m_pendingSRDResponses; private Dictionary<LLUUID, SendRemoteDataRequest> m_pendingSRDResponses;
private int m_remoteDataPort; private int m_remoteDataPort = 0;
private Dictionary<LLUUID, RPCRequestInfo> m_rpcPending; private Dictionary<LLUUID, RPCRequestInfo> m_rpcPending;
private Dictionary<LLUUID, RPCRequestInfo> m_rpcPendingResponses; private Dictionary<LLUUID, RPCRequestInfo> m_rpcPendingResponses;
private List<Scene> m_scenes = new List<Scene>();
private int RemoteReplyScriptTimeout = 9000; private int RemoteReplyScriptTimeout = 9000;
private int RemoteReplyScriptWait = 300; private int RemoteReplyScriptWait = 300;
private object XMLRPCListLock = new object();
#region IRegionModule Members #region IRegionModule Members
@ -428,15 +428,15 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
public class RPCRequestInfo public class RPCRequestInfo
{ {
private readonly LLUUID m_ChannelKey; private LLUUID m_ChannelKey;
private readonly string m_IntVal; private string m_IntVal;
private readonly LLUUID m_ItemID; private LLUUID m_ItemID;
private readonly uint m_localID; private uint m_localID;
private readonly LLUUID m_MessageID; private LLUUID m_MessageID;
private readonly string m_StrVal;
private bool m_processed; private bool m_processed;
private int m_respInt; private int m_respInt;
private string m_respStr; private string m_respStr;
private string m_StrVal;
public RPCRequestInfo(uint localID, LLUUID itemID, LLUUID channelKey, string strVal, string intVal) public RPCRequestInfo(uint localID, LLUUID itemID, LLUUID channelKey, string strVal, string intVal)
{ {
@ -514,9 +514,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
public class RPCChannelInfo public class RPCChannelInfo
{ {
private readonly LLUUID m_ChannelKey; private LLUUID m_ChannelKey;
private readonly LLUUID m_itemID; private LLUUID m_itemID;
private readonly uint m_localID; private uint m_localID;
public RPCChannelInfo(uint localID, LLUUID itemID, LLUUID channelID) public RPCChannelInfo(uint localID, LLUUID itemID, LLUUID channelID)
{ {

View File

@ -44,8 +44,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land
//Land types set with flags in ParcelOverlay. //Land types set with flags in ParcelOverlay.
//Only one of these can be used. //Only one of these can be used.
public const float BAN_LINE_SAFETY_HIEGHT = 100; public const float BAN_LINE_SAFETY_HIEGHT = 100;
public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = 128; //Equals 10000000 public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte) 128; //Equals 10000000
public const byte LAND_FLAG_PROPERTY_BORDER_WEST = 64; //Equals 01000000 public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte) 64; //Equals 01000000
//RequestResults (I think these are right, they seem to work): //RequestResults (I think these are right, they seem to work):
public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land
@ -55,26 +55,26 @@ namespace OpenSim.Region.Environment.Modules.World.Land
public const int LAND_SELECT_OBJECTS_GROUP = 4; public const int LAND_SELECT_OBJECTS_GROUP = 4;
public const int LAND_SELECT_OBJECTS_OTHER = 8; public const int LAND_SELECT_OBJECTS_OTHER = 8;
public const int LAND_SELECT_OBJECTS_OWNER = 2; public const int LAND_SELECT_OBJECTS_OWNER = 2;
public const byte LAND_TYPE_IS_BEING_AUCTIONED = 5; //Equals 00000101 public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte) 5; //Equals 00000101
public const byte LAND_TYPE_IS_FOR_SALE = 4; //Equals 00000100 public const byte LAND_TYPE_IS_FOR_SALE = (byte) 4; //Equals 00000100
public const byte LAND_TYPE_OWNED_BY_GROUP = 2; //Equals 00000010 public const byte LAND_TYPE_OWNED_BY_GROUP = (byte) 2; //Equals 00000010
public const byte LAND_TYPE_OWNED_BY_OTHER = 1; //Equals 00000001 public const byte LAND_TYPE_OWNED_BY_OTHER = (byte) 1; //Equals 00000001
public const byte LAND_TYPE_OWNED_BY_REQUESTER = 3; //Equals 00000011 public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte) 3; //Equals 00000011
public const byte LAND_TYPE_PUBLIC = 0; //Equals 00000000 public const byte LAND_TYPE_PUBLIC = (byte) 0; //Equals 00000000
//These are other constants. Yay! //These are other constants. Yay!
public const int START_LAND_LOCAL_ID = 1; public const int START_LAND_LOCAL_ID = 1;
#endregion #endregion
private readonly int[,] landIDList = new int[64,64]; private int[,] landIDList = new int[64,64];
private readonly Dictionary<int, ILandObject> landList = new Dictionary<int, ILandObject>(); private Dictionary<int, ILandObject> landList = new Dictionary<int, ILandObject>();
private readonly Scene m_scene;
private bool landPrimCountTainted; private bool landPrimCountTainted = false;
private int lastLandLocalID = START_LAND_LOCAL_ID - 1; private int lastLandLocalID = START_LAND_LOCAL_ID - 1;
private bool m_allowedForcefulBans = true; private bool m_allowedForcefulBans = true;
private Scene m_scene;
public LandChannel(Scene scene) public LandChannel(Scene scene)
{ {
@ -192,7 +192,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{ {
lastLandLocalID++; lastLandLocalID++;
new_land.landData.localID = lastLandLocalID; new_land.landData.localID = lastLandLocalID;
landList.Add(lastLandLocalID, new_land.Copy()); landList.Add(lastLandLocalID, (LandObject) new_land.Copy());
bool[,] landBitmap = new_land.getLandBitmap(); bool[,] landBitmap = new_land.getLandBitmap();
@ -532,7 +532,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{ {
for (x = 0; x < 64; x++) for (x = 0; x < 64; x++)
{ {
byte tempByte = 0; //This represents the byte for the current 4x4 byte tempByte = (byte) 0; //This represents the byte for the current 4x4
ILandObject currentParcelBlock = null; ILandObject currentParcelBlock = null;
try try
@ -611,7 +611,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay); packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay);
packet.ParcelData.Data = byteArray; packet.ParcelData.Data = byteArray;
packet.ParcelData.SequenceID = sequenceID; packet.ParcelData.SequenceID = sequenceID;
remote_client.OutPacket(packet, ThrottleOutPacketType.Task); remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task);
sequenceID++; sequenceID++;
byteArray = new byte[LAND_BLOCKS_PER_PACKET]; byteArray = new byte[LAND_BLOCKS_PER_PACKET];
} }

View File

@ -45,14 +45,14 @@ namespace OpenSim.Region.Environment.Modules.World.Land
m_scene.EventManager.OnParcelPrimCountAdd += landChannel.addPrimToLandPrimCounts; m_scene.EventManager.OnParcelPrimCountAdd += landChannel.addPrimToLandPrimCounts;
m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts; m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts;
m_scene.EventManager.OnAvatarEnteringNewParcel += landChannel.handleAvatarChangingParcel; m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel);
m_scene.EventManager.OnClientMovement += landChannel.handleAnyClientMovement; m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement);
m_scene.EventManager.OnValidateLandBuy += landChannel.handleLandValidationRequest; m_scene.EventManager.OnValidateLandBuy += landChannel.handleLandValidationRequest;
m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest; m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest;
lock (m_scene) lock (m_scene)
{ {
m_scene.LandChannel = landChannel; m_scene.LandChannel = (ILandChannel) landChannel;
} }
} }

View File

@ -73,8 +73,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
get { return m_scene.RegionInfo.RegionID; } get { return m_scene.RegionInfo.RegionID; }
} }
#endregion
#region Constructors #region Constructors
public LandObject(LLUUID owner_id, bool is_group_owned, Scene scene) public LandObject(LLUUID owner_id, bool is_group_owned, Scene scene)
@ -100,7 +98,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{ {
if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize) if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize)
{ {
return landBitmap[x / 4, y / 4]; return (landBitmap[x / 4, y / 4] == true);
} }
else else
{ {
@ -150,7 +148,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
updatePacket.ParcelData.GroupID = landData.groupID; updatePacket.ParcelData.GroupID = landData.groupID;
updatePacket.ParcelData.GroupPrims = landData.groupPrims; updatePacket.ParcelData.GroupPrims = landData.groupPrims;
updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned; updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned;
updatePacket.ParcelData.LandingType = landData.landingType; updatePacket.ParcelData.LandingType = (byte) landData.landingType;
updatePacket.ParcelData.LocalID = landData.localID; updatePacket.ParcelData.LocalID = landData.localID;
if (landData.area > 0) if (landData.area > 0)
{ {
@ -214,7 +212,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
landData.selectedPrims; landData.selectedPrims;
updatePacket.ParcelData.UserLocation = landData.userLocation; updatePacket.ParcelData.UserLocation = landData.userLocation;
updatePacket.ParcelData.UserLookAt = landData.userLookAt; updatePacket.ParcelData.UserLookAt = landData.userLookAt;
remote_client.OutPacket(updatePacket, ThrottleOutPacketType.Task); remote_client.OutPacket((Packet) updatePacket, ThrottleOutPacketType.Task);
} }
public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
@ -357,7 +355,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{ {
ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock();
listBlock.Flags = 0; listBlock.Flags = (uint) 0;
listBlock.ID = entry.AgentID; listBlock.ID = entry.AgentID;
listBlock.Time = 0; listBlock.Time = 0;
@ -369,7 +367,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{ {
ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock();
listBlock.Flags = 0; listBlock.Flags = (uint) 0;
listBlock.ID = LLUUID.Zero; listBlock.ID = LLUUID.Zero;
listBlock.Time = 0; listBlock.Time = 0;
@ -392,7 +390,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
replyPacket.Data.SequenceID = 0; replyPacket.Data.SequenceID = 0;
replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access); replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access);
remote_client.OutPacket(replyPacket, ThrottleOutPacketType.Task); remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task);
} }
if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both)
@ -404,7 +402,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
replyPacket.Data.SequenceID = 0; replyPacket.Data.SequenceID = 0;
replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban); replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban);
remote_client.OutPacket(replyPacket, ThrottleOutPacketType.Task); remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task);
} }
} }
@ -484,7 +482,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{ {
for (y = 0; y < 64; y++) for (y = 0; y < 64; y++)
{ {
if (landBitmap[x, y]) if (landBitmap[x, y] == true)
{ {
if (min_x > x) min_x = x; if (min_x > x) min_x = x;
if (min_y > y) min_y = y; if (min_y > y) min_y = y;
@ -501,7 +499,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
if (ty > 255) if (ty > 255)
ty = 255; ty = 255;
landData.AABBMin = landData.AABBMin =
new LLVector3((min_x * 4), (min_y * 4), new LLVector3((float) (min_x * 4), (float) (min_y * 4),
(float) m_scene.Heightmap[tx, ty]); (float) m_scene.Heightmap[tx, ty]);
tx = max_x * 4; tx = max_x * 4;
@ -511,7 +509,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
if (ty > 255) if (ty > 255)
ty = 255; ty = 255;
landData.AABBMax = landData.AABBMax =
new LLVector3((max_x * 4), (max_y * 4), new LLVector3((float) (max_x * 4), (float) (max_y * 4),
(float) m_scene.Heightmap[tx, ty]); (float) m_scene.Heightmap[tx, ty]);
landData.area = tempArea; landData.area = tempArea;
} }
@ -659,7 +657,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
if (i % 8 == 0) if (i % 8 == 0)
{ {
tempConvertArr[byteNum] = tempByte; tempConvertArr[byteNum] = tempByte;
tempByte = 0; tempByte = (byte) 0;
i = 0; i = 0;
byteNum++; byteNum++;
} }
@ -679,7 +677,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
tempByte = landData.landBitmapByteArray[i]; tempByte = landData.landBitmapByteArray[i];
for (bitNum = 0; bitNum < 8; bitNum++) for (bitNum = 0; bitNum < 8; bitNum++)
{ {
bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & 1); bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1);
tempConvertMap[x, y] = bit; tempConvertMap[x, y] = bit;
x++; x++;
if (x > 63) if (x > 63)
@ -753,7 +751,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
resultLocalIDs.RemoveAt(0); resultLocalIDs.RemoveAt(0);
} }
pack.Data = data; pack.Data = data;
remote_client.OutPacket(pack, ThrottleOutPacketType.Task); remote_client.OutPacket((Packet) pack, ThrottleOutPacketType.Task);
} }
} }
@ -924,5 +922,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
#endregion #endregion
#endregion #endregion
#endregion
} }
} }

View File

@ -37,10 +37,10 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
{ {
public class SerialiserModule : IRegionModule, IRegionSerialiser public class SerialiserModule : IRegionModule, IRegionSerialiser
{ {
private readonly Commander m_commander = new Commander("Export"); private Commander m_commander = new Commander("Export");
private readonly List<Scene> m_regions = new List<Scene>(); private List<Scene> m_regions = new List<Scene>();
private readonly List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
private string m_savedir = "exports" + "/"; private string m_savedir = "exports" + "/";
private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
#region IRegionModule Members #region IRegionModule Members
@ -105,8 +105,8 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
TextWriter regionInfoWriter = new StreamWriter(saveDir + "README.TXT"); TextWriter regionInfoWriter = new StreamWriter(saveDir + "README.TXT");
regionInfoWriter.WriteLine("Region Name: " + scene.RegionInfo.RegionName); regionInfoWriter.WriteLine("Region Name: " + scene.RegionInfo.RegionName);
regionInfoWriter.WriteLine("Region ID: " + scene.RegionInfo.RegionID); regionInfoWriter.WriteLine("Region ID: " + scene.RegionInfo.RegionID.ToString());
regionInfoWriter.WriteLine("Backup Time: UTC " + DateTime.UtcNow); regionInfoWriter.WriteLine("Backup Time: UTC " + DateTime.UtcNow.ToString());
regionInfoWriter.WriteLine("Serialise Version: 0.1"); regionInfoWriter.WriteLine("Serialise Version: 0.1");
regionInfoWriter.Close(); regionInfoWriter.Close();
@ -141,7 +141,7 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
{ {
if (region.RegionInfo.RegionName == (string) args[0]) if (region.RegionInfo.RegionName == (string) args[0])
{ {
List<string> results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID + "/"); List<string> results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/");
} }
} }
} }
@ -150,7 +150,7 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
{ {
foreach (Scene region in m_regions) foreach (Scene region in m_regions)
{ {
List<string> results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID + "/"); List<string> results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/");
} }
} }

View File

@ -127,7 +127,7 @@ namespace OpenSim.Region.Environment.Modules.World.Sun
{ {
long m_addticks = (DateTime.Now.Ticks - m_start) * m_dilation; long m_addticks = (DateTime.Now.Ticks - m_start) * m_dilation;
DateTime dt = new DateTime(m_start + m_addticks); DateTime dt = new DateTime(m_start + m_addticks);
return dt.Hour + (dt.Minute / 60.0); return (double) dt.Hour + ((double) dt.Minute / 60.0);
} }
private LLVector3 SunPos(double hour) private LLVector3 SunPos(double hour)

View File

@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Effects
{ {
for (y = 0; y < map.Height; y++) for (y = 0; y < map.Height; y++)
{ {
if (cliffMask[x, y]) if (cliffMask[x, y] == true)
eroder.PaintEffect(map, x, y, 4, 0.1); eroder.PaintEffect(map, x, y, 4, 0.1);
} }
} }

View File

@ -47,7 +47,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
{ {
for (x = 0; x < retval.Width; x++) for (x = 0; x < retval.Width; x++)
{ {
retval[x, y] = bs.ReadByte() * (bs.ReadByte() / 127.0); retval[x, y] = (double) bs.ReadByte() * ((double) bs.ReadByte() / 127.0);
bs.ReadBytes(11); // Advance the stream to next bytes. bs.ReadBytes(11); // Advance the stream to next bytes.
} }
} }
@ -76,7 +76,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
{ {
for (j = 0; j < 256; j++) for (j = 0; j < 256; j++)
{ {
lookupHeightTable[i + (j * 256)] = (i * (j / 127.0)); lookupHeightTable[i + (j * 256)] = ((double) i * ((double) j / 127.0));
} }
} }

View File

@ -50,14 +50,14 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
BinaryReader bs = new BinaryReader(s); BinaryReader bs = new BinaryReader(s);
bool eof = false; bool eof = false;
if (Encoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ") if (ASCIIEncoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ")
{ {
// Terragen file // Terragen file
while (eof == false) while (eof == false)
{ {
int w = 256; int w = 256;
int h = 256; int h = 256;
string tmp = Encoding.ASCII.GetString(bs.ReadBytes(4)); string tmp = ASCIIEncoding.ASCII.GetString(bs.ReadBytes(4));
switch (tmp) switch (tmp)
{ {
case "SIZE": case "SIZE":
@ -84,7 +84,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
{ {
for (y = 0; y < h; y++) for (y = 0; y < h; y++)
{ {
retval[x, y] = baseHeight + bs.ReadInt16() * (double) heightScale / 65536.0; retval[x, y] = (double) baseHeight + (double) bs.ReadInt16() * (double) heightScale / 65536.0;
} }
} }
break; break;

View File

@ -31,6 +31,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
{ {
public class FlattenSphere : ITerrainPaintableEffect public class FlattenSphere : ITerrainPaintableEffect
{ {
#region ITerrainPaintableEffect Members #region ITerrainPaintableEffect Members
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration) public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)

View File

@ -57,7 +57,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
z *= z; z *= z;
z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
double noise = TerrainUtil.PerlinNoise2D(x / (double) Constants.RegionSize, y / (double) Constants.RegionSize, 8, 1.0); double noise = TerrainUtil.PerlinNoise2D((double) x / (double) Constants.RegionSize, (double) y / (double) Constants.RegionSize, 8, 1.0);
if (z > 0.0) if (z > 0.0)
map[x, y] += noise * z * duration; map[x, y] += noise * z * duration;

View File

@ -32,7 +32,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
{ {
public class RevertSphere : ITerrainPaintableEffect public class RevertSphere : ITerrainPaintableEffect
{ {
private readonly ITerrainChannel m_revertmap; private ITerrainChannel m_revertmap;
public RevertSphere(ITerrainChannel revertmap) public RevertSphere(ITerrainChannel revertmap)
{ {

View File

@ -31,7 +31,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
{ {
public class TerrainException : Exception public class TerrainException : Exception
{ {
public TerrainException() public TerrainException() : base()
{ {
} }

View File

@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
private Dictionary<string, ITerrainEffect> m_plugineffects; private Dictionary<string, ITerrainEffect> m_plugineffects;
private ITerrainChannel m_revert; private ITerrainChannel m_revert;
private Scene m_scene; private Scene m_scene;
private bool m_tainted; private bool m_tainted = false;
#region ICommandableModule Members #region ICommandableModule Members
@ -223,8 +223,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
} }
} }
#endregion
#region Plugin Loading Methods #region Plugin Loading Methods
private void LoadPlugins() private void LoadPlugins()
@ -278,6 +276,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
#endregion #endregion
#endregion
/// <summary> /// <summary>
/// Installs into terrain module the standard suite of brushes /// Installs into terrain module the standard suite of brushes
/// </summary> /// </summary>

View File

@ -66,10 +66,10 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
m_trees = new List<LLUUID>(); m_trees = new List<LLUUID>();
m_scene = scene; m_scene = scene;
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; m_scene.EventManager.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(EventManager_OnPluginConsole);
Timer CalculateTrees = new Timer(m_tree_updates); Timer CalculateTrees = new Timer(m_tree_updates);
CalculateTrees.Elapsed += CalculateTrees_Elapsed; CalculateTrees.Elapsed += new ElapsedEventHandler(CalculateTrees_Elapsed);
CalculateTrees.Start(); CalculateTrees.Start();
m_log.Debug("[TREES]: Initialised tree module"); m_log.Debug("[TREES]: Initialised tree module");
} }

View File

@ -33,21 +33,27 @@ namespace OpenSim.Region.Environment
{ {
public class PermissionManager public class PermissionManager
{ {
protected Scene m_scene;
// These are here for testing. They will be taken out
//private uint PERM_ALL = (uint)2147483647;
private uint PERM_COPY = (uint)32768;
//private uint PERM_MODIFY = (uint)16384;
private uint PERM_MOVE = (uint)524288;
//private uint PERM_TRANS = (uint)8192;
private uint PERM_LOCKED = (uint)540672;
// Bypasses the permissions engine (always returns OK) // Bypasses the permissions engine (always returns OK)
// disable in any production environment // disable in any production environment
// TODO: Change this to false when permissions are a desired default // TODO: Change this to false when permissions are a desired default
// TODO: Move to configuration option. // TODO: Move to configuration option.
private bool m_bypassPermissions = true; private bool m_bypassPermissions = true;
protected Scene m_scene;
// These are here for testing. They will be taken out
//private uint PERM_ALL = (uint)2147483647;
private uint PERM_COPY = 32768;
//private uint PERM_MODIFY = (uint)16384;
//private uint PERM_TRANS = (uint)8192;
private uint PERM_LOCKED = 540672;
private uint PERM_MOVE = 524288;
public bool BypassPermissions
{
get { return m_bypassPermissions; }
set { m_bypassPermissions = value; }
}
public PermissionManager() public PermissionManager()
{ {
@ -58,12 +64,6 @@ namespace OpenSim.Region.Environment
m_scene = scene; m_scene = scene;
} }
public bool BypassPermissions
{
get { return m_bypassPermissions; }
set { m_bypassPermissions = value; }
}
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
m_scene = scene; m_scene = scene;
@ -129,8 +129,8 @@ namespace OpenSim.Region.Environment
ILandObject land = m_scene.LandChannel.getLandObject(position.X, position.Y); ILandObject land = m_scene.LandChannel.getLandObject(position.X, position.Y);
if (land == null) return false; if (land == null) return false;
if ((land.landData.landFlags & ((int) Parcel.ParcelFlags.CreateObjects)) == if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) ==
(int) Parcel.ParcelFlags.CreateObjects) (int)Parcel.ParcelFlags.CreateObjects)
permission = true; permission = true;
//TODO: check for group rights //TODO: check for group rights
@ -168,6 +168,8 @@ namespace OpenSim.Region.Environment
/// <returns>Has permission?</returns> /// <returns>Has permission?</returns>
public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos) public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos)
{ {
if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f)) if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f))
{ {
return true; return true;
@ -191,7 +193,7 @@ namespace OpenSim.Region.Environment
return true; return true;
} }
if ((land2.landData.landFlags & ((int) Parcel.ParcelFlags.AllowAllObjectEntry)) != 0) if ((land2.landData.landFlags & ((int)Parcel.ParcelFlags.AllowAllObjectEntry)) != 0)
{ {
return true; return true;
} }
@ -208,6 +210,355 @@ namespace OpenSim.Region.Environment
return false; return false;
} }
#region Object Permissions
public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID)
{
// Here's the way this works,
// ObjectFlags and Permission flags are two different enumerations
// ObjectFlags, however, tells the client to change what it will allow the user to do.
// So, that means that all of the permissions type ObjectFlags are /temporary/ and only
// supposed to be set when customizing the objectflags for the client.
// These temporary objectflags get computed and added in this function based on the
// Permission mask that's appropriate!
// Outside of this method, they should never be added to objectflags!
// -teravus
SceneObjectPart task=m_scene.GetSceneObjectPart(objID);
// this shouldn't ever happen.. return no permissions/objectflags.
if (task == null)
return (uint)0;
uint objflags = task.GetEffectiveObjectFlags();
LLUUID objectOwner = task.OwnerID;
// Remove any of the objectFlags that are temporary. These will get added back if appropriate
// in the next bit of code
objflags &= (uint)
~(LLObject.ObjectFlags.ObjectCopy | // Tells client you can copy the object
LLObject.ObjectFlags.ObjectModify | // tells client you can modify the object
LLObject.ObjectFlags.ObjectMove | // tells client that you can move the object (only, no mod)
LLObject.ObjectFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
LLObject.ObjectFlags.ObjectYouOwner | // Tells client that you're the owner of the object
LLObject.ObjectFlags.ObjectYouOfficer // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
);
// Creating the three ObjectFlags options for this method to choose from.
// Customize the OwnerMask
uint objectOwnerMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner;
// Customize the GroupMask
uint objectGroupMask = ApplyObjectModifyMasks(task.GroupMask, objflags);
// Customize the EveryoneMask
uint objectEveryoneMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
// Hack to allow collaboration until Groups and Group Permissions are implemented
if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0)
objectEveryoneMask |= (uint)LLObject.ObjectFlags.ObjectModify;
if (m_bypassPermissions)
return objectOwnerMask;
// Object owners should be able to edit their own content
if (user == objectOwner)
{
return objectOwnerMask;
}
// Users should be able to edit what is over their land.
ILandObject parcel = m_scene.LandChannel.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
if (parcel != null && parcel.landData.ownerID == user)
return objectOwnerMask;
// Admin objects should not be editable by the above
if (IsAdministrator(objectOwner))
return objectEveryoneMask;
// Estate users should be able to edit anything in the sim
if (IsEstateManager(user))
return objectOwnerMask;
// Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(user))
return objectOwnerMask;
return objectEveryoneMask;
}
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
{
// We are adding the temporary objectflags to the object's objectflags based on the
// permission flag given. These change the F flags on the client.
if ((setPermissionMask & (uint)PermissionMask.Copy) != 0)
{
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
}
if ((setPermissionMask & (uint)PermissionMask.Move) != 0)
{
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectMove;
}
if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
{
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectModify;
}
if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
{
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
}
return objectFlagsMask;
}
protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
{
// Default: deny
bool permission = false;
bool locked = false;
if (!m_scene.Entities.ContainsKey(objId))
{
return false;
}
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[objId] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId];
LLUUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
// People shouldn't be able to do anything with locked objects, except the Administrator
// The 'set permissions' runs through a different permission check, so when an object owner
// sets an object locked, the only thing that they can do is unlock it.
//
// Nobody but the object owner can set permissions on an object
//
if (locked && (!IsAdministrator(currentUser)))
{
return false;
}
// Object owners should be able to edit their own content
if (currentUser == objectOwner)
{
permission = true;
}
// Users should be able to edit what is over their land.
ILandObject parcel = m_scene.LandChannel.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
if ((parcel != null) && (parcel.landData.ownerID == currentUser))
{
permission = true;
}
// Estate users should be able to edit anything in the sim
if (IsEstateManager(currentUser))
{
permission = true;
}
// Admin objects should not be editable by the above
if (IsAdministrator(objectOwner))
{
permission = false;
}
// Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(currentUser))
{
permission = true;
}
return permission;
}
/// <summary>
/// Permissions check - can user delete an object?
/// </summary>
/// <param name="user">User attempting the delete</param>
/// <param name="obj">Target object</param>
/// <returns>Has permission?</returns>
public virtual bool CanDeRezObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
}
public virtual bool CanEditObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
}
public virtual bool CanEditObjectPosition(LLUUID user, LLUUID obj)
{
bool permission = GenericObjectPermission(user, obj);
if (!permission)
{
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// The client
// may request to edit linked parts, and therefore, it needs
// to also check for SceneObjectPart
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj];
LLUUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
LLUUID objectOwner = task.OwnerID;
// Anyone can move
if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0)
permission = true;
// Locked
if ((task.RootPart.OwnerMask & PERM_LOCKED) == 0)
permission = false;
}
else
{
bool locked = false;
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[obj];
LLUUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
// This is an exception to the generic object permission.
// Administrators who lock their objects should not be able to move them,
// however generic object permission should return true.
// This keeps locked objects from being affected by random click + drag actions by accident
// and allows the administrator to grab or delete a locked object.
// Administrators and estate managers are still able to click+grab locked objects not
// owned by them in the scene
// This is by design.
if (locked && (user == objectOwner))
return false;
}
return permission;
}
public virtual bool CanCopyObject(LLUUID user, LLUUID obj)
{
bool permission = GenericObjectPermission(user, obj);
if (!permission)
{
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// If it's not an object, we cant edit it.
if (!(m_scene.Entities[obj] is SceneObjectGroup))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj];
LLUUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
LLUUID objectOwner = task.OwnerID;
if ((task.RootPart.EveryoneMask & PERM_COPY) != 0)
permission = true;
}
return permission;
}
public virtual bool CanReturnObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
}
#endregion
#region Communication Permissions
public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target)
{
bool permission = false;
string reason = "Only registered users may communicate with another account.";
if (IsGridUser(user))
permission = true;
if (!IsGridUser(user))
{
permission = false;
reason = "The person that you are messaging is not a registered user.";
}
if (IsAdministrator(user))
permission = true;
if (IsEstateManager(user))
permission = true;
if (!permission)
SendPermissionError(user, reason);
return permission;
}
public virtual bool CanInstantMessage(LLUUID user, LLUUID target)
{
return GenericCommunicationPermission(user, target);
}
public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target)
{
return GenericCommunicationPermission(user, target);
}
#endregion
public virtual bool CanEditScript(LLUUID user, LLUUID script) public virtual bool CanEditScript(LLUUID user, LLUUID script)
{ {
return IsAdministrator(user); return IsAdministrator(user);
@ -339,351 +690,5 @@ namespace OpenSim.Region.Environment
} }
#endregion #endregion
#region Object Permissions
public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID)
{
// Here's the way this works,
// ObjectFlags and Permission flags are two different enumerations
// ObjectFlags, however, tells the client to change what it will allow the user to do.
// So, that means that all of the permissions type ObjectFlags are /temporary/ and only
// supposed to be set when customizing the objectflags for the client.
// These temporary objectflags get computed and added in this function based on the
// Permission mask that's appropriate!
// Outside of this method, they should never be added to objectflags!
// -teravus
SceneObjectPart task = m_scene.GetSceneObjectPart(objID);
// this shouldn't ever happen.. return no permissions/objectflags.
if (task == null)
return 0;
uint objflags = task.GetEffectiveObjectFlags();
LLUUID objectOwner = task.OwnerID;
// Remove any of the objectFlags that are temporary. These will get added back if appropriate
// in the next bit of code
objflags &= (uint)
~(LLObject.ObjectFlags.ObjectCopy | // Tells client you can copy the object
LLObject.ObjectFlags.ObjectModify | // tells client you can modify the object
LLObject.ObjectFlags.ObjectMove | // tells client that you can move the object (only, no mod)
LLObject.ObjectFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
LLObject.ObjectFlags.ObjectYouOwner | // Tells client that you're the owner of the object
LLObject.ObjectFlags.ObjectYouOfficer
// Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
);
// Creating the three ObjectFlags options for this method to choose from.
// Customize the OwnerMask
uint objectOwnerMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
objectOwnerMask |= (uint) LLObject.ObjectFlags.ObjectYouOwner;
// Customize the GroupMask
uint objectGroupMask = ApplyObjectModifyMasks(task.GroupMask, objflags);
// Customize the EveryoneMask
uint objectEveryoneMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
// Hack to allow collaboration until Groups and Group Permissions are implemented
if ((objectEveryoneMask & (uint) LLObject.ObjectFlags.ObjectMove) != 0)
objectEveryoneMask |= (uint) LLObject.ObjectFlags.ObjectModify;
if (m_bypassPermissions)
return objectOwnerMask;
// Object owners should be able to edit their own content
if (user == objectOwner)
{
return objectOwnerMask;
}
// Users should be able to edit what is over their land.
ILandObject parcel = m_scene.LandChannel.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
if (parcel != null && parcel.landData.ownerID == user)
return objectOwnerMask;
// Admin objects should not be editable by the above
if (IsAdministrator(objectOwner))
return objectEveryoneMask;
// Estate users should be able to edit anything in the sim
if (IsEstateManager(user))
return objectOwnerMask;
// Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(user))
return objectOwnerMask;
return objectEveryoneMask;
}
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
{
// We are adding the temporary objectflags to the object's objectflags based on the
// permission flag given. These change the F flags on the client.
if ((setPermissionMask & (uint) PermissionMask.Copy) != 0)
{
objectFlagsMask |= (uint) LLObject.ObjectFlags.ObjectCopy;
}
if ((setPermissionMask & (uint) PermissionMask.Move) != 0)
{
objectFlagsMask |= (uint) LLObject.ObjectFlags.ObjectMove;
}
if ((setPermissionMask & (uint) PermissionMask.Modify) != 0)
{
objectFlagsMask |= (uint) LLObject.ObjectFlags.ObjectModify;
}
if ((setPermissionMask & (uint) PermissionMask.Transfer) != 0)
{
objectFlagsMask |= (uint) LLObject.ObjectFlags.ObjectTransfer;
}
return objectFlagsMask;
}
protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
{
// Default: deny
bool permission = false;
bool locked = false;
if (!m_scene.Entities.ContainsKey(objId))
{
return false;
}
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[objId] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup group = (SceneObjectGroup) m_scene.Entities[objId];
LLUUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
// People shouldn't be able to do anything with locked objects, except the Administrator
// The 'set permissions' runs through a different permission check, so when an object owner
// sets an object locked, the only thing that they can do is unlock it.
//
// Nobody but the object owner can set permissions on an object
//
if (locked && (!IsAdministrator(currentUser)))
{
return false;
}
// Object owners should be able to edit their own content
if (currentUser == objectOwner)
{
permission = true;
}
// Users should be able to edit what is over their land.
ILandObject parcel = m_scene.LandChannel.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
if ((parcel != null) && (parcel.landData.ownerID == currentUser))
{
permission = true;
}
// Estate users should be able to edit anything in the sim
if (IsEstateManager(currentUser))
{
permission = true;
}
// Admin objects should not be editable by the above
if (IsAdministrator(objectOwner))
{
permission = false;
}
// Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(currentUser))
{
permission = true;
}
return permission;
}
/// <summary>
/// Permissions check - can user delete an object?
/// </summary>
/// <param name="user">User attempting the delete</param>
/// <param name="obj">Target object</param>
/// <returns>Has permission?</returns>
public virtual bool CanDeRezObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
}
public virtual bool CanEditObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
}
public virtual bool CanEditObjectPosition(LLUUID user, LLUUID obj)
{
bool permission = GenericObjectPermission(user, obj);
if (!permission)
{
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// The client
// may request to edit linked parts, and therefore, it needs
// to also check for SceneObjectPart
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[obj];
LLUUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
LLUUID objectOwner = task.OwnerID;
// Anyone can move
if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0)
permission = true;
// Locked
if ((task.RootPart.OwnerMask & PERM_LOCKED) == 0)
permission = false;
}
else
{
bool locked = false;
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup group = (SceneObjectGroup) m_scene.Entities[obj];
LLUUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
// This is an exception to the generic object permission.
// Administrators who lock their objects should not be able to move them,
// however generic object permission should return true.
// This keeps locked objects from being affected by random click + drag actions by accident
// and allows the administrator to grab or delete a locked object.
// Administrators and estate managers are still able to click+grab locked objects not
// owned by them in the scene
// This is by design.
if (locked && (user == objectOwner))
return false;
}
return permission;
}
public virtual bool CanCopyObject(LLUUID user, LLUUID obj)
{
bool permission = GenericObjectPermission(user, obj);
if (!permission)
{
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// If it's not an object, we cant edit it.
if (!(m_scene.Entities[obj] is SceneObjectGroup))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[obj];
LLUUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
LLUUID objectOwner = task.OwnerID;
if ((task.RootPart.EveryoneMask & PERM_COPY) != 0)
permission = true;
}
return permission;
}
public virtual bool CanReturnObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
}
#endregion
#region Communication Permissions
public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target)
{
bool permission = false;
string reason = "Only registered users may communicate with another account.";
if (IsGridUser(user))
permission = true;
if (!IsGridUser(user))
{
permission = false;
reason = "The person that you are messaging is not a registered user.";
}
if (IsAdministrator(user))
permission = true;
if (IsEstateManager(user))
permission = true;
if (!permission)
SendPermissionError(user, reason);
return permission;
}
public virtual bool CanInstantMessage(LLUUID user, LLUUID target)
{
return GenericCommunicationPermission(user, target);
}
public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target)
{
return GenericCommunicationPermission(user, target);
}
#endregion
} }
} }

View File

@ -46,8 +46,8 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (nod.Attributes["name"] != null) if (nod.Attributes["name"] != null)
{ {
string name = nod.Attributes["name"].Value; string name = (string)nod.Attributes["name"].Value;
LLUUID id = (LLUUID) nod.InnerText; LLUUID id = (LLUUID)nod.InnerText;
AnimsLLUUID.Add(name, id); AnimsLLUUID.Add(name, id);
AnimsNames.Add(id, name); AnimsNames.Add(id, name);

View File

@ -37,13 +37,52 @@ namespace OpenSim.Region.Environment.Scenes
[Serializable] [Serializable]
public class AvatarAppearance : ISerializable public class AvatarAppearance : ISerializable
{ {
protected float m_avatarHeight;
protected LLUUID m_scenePresenceID; protected LLUUID m_scenePresenceID;
protected LLObject.TextureEntry m_textureEntry;
public LLUUID ScenePresenceID
{
get { return m_scenePresenceID; }
set { m_scenePresenceID = value; }
}
protected int m_wearablesSerial = 1;
public int WearablesSerial
{
get { return m_wearablesSerial; }
set { m_wearablesSerial = value; }
}
protected byte[] m_visualParams; protected byte[] m_visualParams;
public byte[] VisualParams
{
get { return m_visualParams; }
set { m_visualParams = value; }
}
protected AvatarWearable[] m_wearables; protected AvatarWearable[] m_wearables;
protected int m_wearablesSerial = 1; public AvatarWearable[] Wearables
{
get { return m_wearables; }
set { m_wearables = value; }
}
protected LLObject.TextureEntry m_textureEntry;
public LLObject.TextureEntry TextureEntry
{
get { return m_textureEntry; }
set { m_textureEntry = value; }
}
protected float m_avatarHeight = 0;
public float AvatarHeight
{
get { return m_avatarHeight; }
set { m_avatarHeight = value; }
}
public AvatarAppearance() public AvatarAppearance()
{ {
@ -58,86 +97,6 @@ namespace OpenSim.Region.Environment.Scenes
m_textureEntry = GetDefaultTextureEntry(); m_textureEntry = GetDefaultTextureEntry();
} }
protected AvatarAppearance(SerializationInfo info, StreamingContext context)
{
//System.Console.WriteLine("AvatarAppearance Deserialize BGN");
if (info == null)
{
throw new ArgumentNullException("info");
}
m_scenePresenceID = new LLUUID((Guid) info.GetValue("m_scenePresenceID", typeof (Guid)));
m_wearablesSerial = (int) info.GetValue("m_wearablesSerial", typeof (int));
m_visualParams = (byte[]) info.GetValue("m_visualParams", typeof (byte[]));
m_wearables = (AvatarWearable[]) info.GetValue("m_wearables", typeof (AvatarWearable[]));
byte[] m_textureEntry_work = (byte[]) info.GetValue("m_textureEntry", typeof (byte[]));
m_textureEntry = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length);
m_avatarHeight = (float) info.GetValue("m_avatarHeight", typeof (float));
//System.Console.WriteLine("AvatarAppearance Deserialize END");
}
public LLUUID ScenePresenceID
{
get { return m_scenePresenceID; }
set { m_scenePresenceID = value; }
}
public int WearablesSerial
{
get { return m_wearablesSerial; }
set { m_wearablesSerial = value; }
}
public byte[] VisualParams
{
get { return m_visualParams; }
set { m_visualParams = value; }
}
public AvatarWearable[] Wearables
{
get { return m_wearables; }
set { m_wearables = value; }
}
public LLObject.TextureEntry TextureEntry
{
get { return m_textureEntry; }
set { m_textureEntry = value; }
}
public float AvatarHeight
{
get { return m_avatarHeight; }
set { m_avatarHeight = value; }
}
#region ISerializable Members
[SecurityPermission(SecurityAction.LinkDemand,
Flags = SecurityPermissionFlag.SerializationFormatter)]
public virtual void GetObjectData(
SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
info.AddValue("m_scenePresenceID", m_scenePresenceID.UUID);
info.AddValue("m_wearablesSerial", m_wearablesSerial);
info.AddValue("m_visualParams", m_visualParams);
info.AddValue("m_wearables", m_wearables);
info.AddValue("m_textureEntry", m_textureEntry.ToBytes());
info.AddValue("m_avatarHeight", m_avatarHeight);
}
#endregion
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -156,8 +115,8 @@ namespace OpenSim.Region.Environment.Scenes
// Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters. // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters.
// (float)m_visualParams[25] = Height // (float)m_visualParams[25] = Height
// (float)m_visualParams[125] = LegLength // (float)m_visualParams[125] = LegLength
m_avatarHeight = (1.50856f + ((m_visualParams[25] / 255.0f) * (2.525506f - 1.50856f))) m_avatarHeight = (1.50856f + (((float) m_visualParams[25]/255.0f)*(2.525506f - 1.50856f)))
+ ((m_visualParams[125] / 255.0f) / 1.5f); + (((float) m_visualParams[125]/255.0f)/1.5f);
} }
/// <summary> /// <summary>
@ -193,5 +152,45 @@ namespace OpenSim.Region.Environment.Scenes
textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011"); textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011");
return textu; return textu;
} }
protected AvatarAppearance(SerializationInfo info, StreamingContext context)
{
//System.Console.WriteLine("AvatarAppearance Deserialize BGN");
if (info == null)
{
throw new ArgumentNullException("info");
}
m_scenePresenceID = new LLUUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid)));
m_wearablesSerial = (int)info.GetValue("m_wearablesSerial", typeof(int));
m_visualParams = (byte[])info.GetValue("m_visualParams", typeof(byte[]));
m_wearables = (AvatarWearable[])info.GetValue("m_wearables", typeof(AvatarWearable[]));
byte[] m_textureEntry_work = (byte[])info.GetValue("m_textureEntry", typeof(byte[]));
m_textureEntry = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length);
m_avatarHeight = (float)info.GetValue("m_avatarHeight", typeof(float));
//System.Console.WriteLine("AvatarAppearance Deserialize END");
}
[SecurityPermission(SecurityAction.LinkDemand,
Flags = SecurityPermissionFlag.SerializationFormatter)]
public virtual void GetObjectData(
SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
info.AddValue("m_scenePresenceID", m_scenePresenceID.UUID);
info.AddValue("m_wearablesSerial", m_wearablesSerial);
info.AddValue("m_visualParams", m_visualParams);
info.AddValue("m_wearables", m_wearables);
info.AddValue("m_textureEntry", m_textureEntry.ToBytes());
info.AddValue("m_avatarHeight", m_avatarHeight);
}
} }
} }

View File

@ -36,15 +36,70 @@ namespace OpenSim.Region.Environment.Scenes
[Serializable] [Serializable]
public abstract class EntityBase : ISerializable public abstract class EntityBase : ISerializable
{ {
protected uint m_localId;
protected string m_name;
protected LLVector3 m_pos;
protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
protected LLVector3 m_rotationalvelocity;
protected Scene m_scene; protected Scene m_scene;
public Scene Scene
{
get { return m_scene; }
}
protected LLUUID m_uuid; protected LLUUID m_uuid;
public virtual LLUUID UUID
{
get { return m_uuid; }
set { m_uuid = value; }
}
protected string m_name;
/// <summary>
///
/// </summary>
public virtual string Name
{
get { return m_name; }
set { m_name = value; }
}
protected LLVector3 m_pos;
/// <summary>
///
/// </summary>
public virtual LLVector3 AbsolutePosition
{
get { return m_pos; }
set { m_pos = value; }
}
protected LLVector3 m_velocity; protected LLVector3 m_velocity;
protected LLVector3 m_rotationalvelocity;
/// <summary>
///
/// </summary>
public virtual LLVector3 Velocity
{
get { return m_velocity; }
set { m_velocity = value; }
}
protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
public virtual Quaternion Rotation
{
get { return m_rotation; }
set { m_rotation = value; }
}
protected uint m_localId;
public virtual uint LocalId
{
get { return m_localId; }
set { m_localId = value; }
}
/// <summary> /// <summary>
/// Creates a new Entity (should not occur on it's own) /// Creates a new Entity (should not occur on it's own)
@ -60,6 +115,28 @@ namespace OpenSim.Region.Environment.Scenes
m_rotationalvelocity = new LLVector3(0, 0, 0); m_rotationalvelocity = new LLVector3(0, 0, 0);
} }
/// <summary>
///
/// </summary>
public abstract void UpdateMovement();
/// <summary>
/// Performs any updates that need to be done at each frame.
/// </summary>
public abstract void Update();
/// <summary>
/// Copies the entity
/// </summary>
/// <returns></returns>
public virtual EntityBase Copy()
{
return (EntityBase) MemberwiseClone();
}
public abstract void SetText(string text, Vector3 color, double alpha);
protected EntityBase(SerializationInfo info, StreamingContext context) protected EntityBase(SerializationInfo info, StreamingContext context)
{ {
//System.Console.WriteLine("EntityBase Deserialize BGN"); //System.Console.WriteLine("EntityBase Deserialize BGN");
@ -69,91 +146,39 @@ namespace OpenSim.Region.Environment.Scenes
throw new ArgumentNullException("info"); throw new ArgumentNullException("info");
} }
m_uuid = new LLUUID((Guid) info.GetValue("m_uuid", typeof (Guid))); m_uuid = new LLUUID((Guid)info.GetValue("m_uuid", typeof(Guid)));
m_name = (string) info.GetValue("m_name", typeof (string)); m_name = (string)info.GetValue("m_name", typeof(string));
m_pos m_pos
= new LLVector3( = new LLVector3(
(float) info.GetValue("m_pos.X", typeof (float)), (float)info.GetValue("m_pos.X", typeof(float)),
(float) info.GetValue("m_pos.Y", typeof (float)), (float)info.GetValue("m_pos.Y", typeof(float)),
(float) info.GetValue("m_pos.Z", typeof (float))); (float)info.GetValue("m_pos.Z", typeof(float)));
m_velocity m_velocity
= new LLVector3( = new LLVector3(
(float) info.GetValue("m_velocity.X", typeof (float)), (float)info.GetValue("m_velocity.X", typeof(float)),
(float) info.GetValue("m_velocity.Y", typeof (float)), (float)info.GetValue("m_velocity.Y", typeof(float)),
(float) info.GetValue("m_velocity.Z", typeof (float))); (float)info.GetValue("m_velocity.Z", typeof(float)));
m_rotationalvelocity m_rotationalvelocity
= new LLVector3( = new LLVector3(
(float) info.GetValue("m_rotationalvelocity.X", typeof (float)), (float)info.GetValue("m_rotationalvelocity.X", typeof(float)),
(float) info.GetValue("m_rotationalvelocity.Y", typeof (float)), (float)info.GetValue("m_rotationalvelocity.Y", typeof(float)),
(float) info.GetValue("m_rotationalvelocity.Z", typeof (float))); (float)info.GetValue("m_rotationalvelocity.Z", typeof(float)));
m_rotation m_rotation
= new Quaternion( = new Quaternion(
(float) info.GetValue("m_rotation.w", typeof (float)), (float)info.GetValue("m_rotation.w", typeof(float)),
(float) info.GetValue("m_rotation.x", typeof (float)), (float)info.GetValue("m_rotation.x", typeof(float)),
(float) info.GetValue("m_rotation.y", typeof (float)), (float)info.GetValue("m_rotation.y", typeof(float)),
(float) info.GetValue("m_rotation.z", typeof (float))); (float)info.GetValue("m_rotation.z", typeof(float)));
m_localId = (uint) info.GetValue("m_localId", typeof (uint)); m_localId = (uint)info.GetValue("m_localId", typeof(uint));
//System.Console.WriteLine("EntityBase Deserialize END"); //System.Console.WriteLine("EntityBase Deserialize END");
} }
public Scene Scene
{
get { return m_scene; }
}
public virtual LLUUID UUID
{
get { return m_uuid; }
set { m_uuid = value; }
}
/// <summary>
///
/// </summary>
public virtual string Name
{
get { return m_name; }
set { m_name = value; }
}
/// <summary>
///
/// </summary>
public virtual LLVector3 AbsolutePosition
{
get { return m_pos; }
set { m_pos = value; }
}
/// <summary>
///
/// </summary>
public virtual LLVector3 Velocity
{
get { return m_velocity; }
set { m_velocity = value; }
}
public virtual Quaternion Rotation
{
get { return m_rotation; }
set { m_rotation = value; }
}
public virtual uint LocalId
{
get { return m_localId; }
set { m_localId = value; }
}
#region ISerializable Members
[SecurityPermission(SecurityAction.LinkDemand, [SecurityPermission(SecurityAction.LinkDemand,
Flags = SecurityPermissionFlag.SerializationFormatter)] Flags = SecurityPermissionFlag.SerializationFormatter)]
public virtual void GetObjectData( public virtual void GetObjectData(
@ -190,42 +215,18 @@ namespace OpenSim.Region.Environment.Scenes
info.AddValue("m_localId", m_localId); info.AddValue("m_localId", m_localId);
} }
#endregion
/// <summary>
///
/// </summary>
public abstract void UpdateMovement();
/// <summary>
/// Performs any updates that need to be done at each frame.
/// </summary>
public abstract void Update();
/// <summary>
/// Copies the entity
/// </summary>
/// <returns></returns>
public virtual EntityBase Copy()
{
return (EntityBase) MemberwiseClone();
}
public abstract void SetText(string text, Vector3 color, double alpha);
} }
//Nested Classes //Nested Classes
public class EntityIntersection public class EntityIntersection
{ {
public Vector3 AAfaceNormal = new Vector3(0, 0, 0);
public float distance;
public int face = -1;
public bool HitTF;
public Vector3 ipoint = new Vector3(0, 0, 0); public Vector3 ipoint = new Vector3(0, 0, 0);
public Vector3 normal = new Vector3(0, 0, 0); public Vector3 normal = new Vector3(0, 0, 0);
public Vector3 AAfaceNormal = new Vector3(0, 0, 0);
public int face = -1;
public bool HitTF = false;
public SceneObjectPart obj; public SceneObjectPart obj;
public float distance = 0;
public EntityIntersection() public EntityIntersection()
{ {

View File

@ -46,33 +46,36 @@ namespace OpenSim.Region.Environment.Scenes
#region Events #region Events
private PhysicsCrash handlerPhysicsCrash;
public event PhysicsCrash UnRecoverableError; public event PhysicsCrash UnRecoverableError;
private PhysicsCrash handlerPhysicsCrash = null;
#endregion #endregion
#region Fields #region Fields
public Dictionary<LLUUID, ScenePresence> ScenePresences;
// SceneObjects is not currently populated or used. // SceneObjects is not currently populated or used.
//public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; //public Dictionary<LLUUID, SceneObjectGroup> SceneObjects;
public PhysicsScene _PhyScene;
public Dictionary<LLUUID, EntityBase> Entities; public Dictionary<LLUUID, EntityBase> Entities;
protected int m_activeScripts; public Dictionary<LLUUID, ScenePresence> RestorePresences;
protected int m_numChildAgents;
protected int m_numPrim;
protected int m_numRootAgents;
protected Scene m_parentScene;
protected int m_physicalPrim;
protected RegionInfo m_regInfo;
protected int m_scriptLPS; public BasicQuadTreeNode QuadTree;
protected RegionInfo m_regInfo;
protected Scene m_parentScene;
protected PermissionManager PermissionsMngr;
protected List<EntityBase> m_updateList = new List<EntityBase>();
protected int m_numRootAgents = 0;
protected int m_numPrim = 0;
protected int m_numChildAgents = 0;
protected int m_physicalPrim = 0;
protected int m_activeScripts = 0;
protected int m_scriptLPS = 0;
internal object m_syncRoot = new object(); internal object m_syncRoot = new object();
protected List<EntityBase> m_updateList = new List<EntityBase>();
protected PermissionManager PermissionsMngr; public PhysicsScene _PhyScene;
public BasicQuadTreeNode QuadTree;
public Dictionary<LLUUID, ScenePresence> RestorePresences;
public Dictionary<LLUUID, ScenePresence> ScenePresences;
#endregion #endregion
@ -81,7 +84,7 @@ namespace OpenSim.Region.Environment.Scenes
m_parentScene = parent; m_parentScene = parent;
m_regInfo = regInfo; m_regInfo = regInfo;
PermissionsMngr = permissionsMngr; PermissionsMngr = permissionsMngr;
QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, (short) Constants.RegionSize, (short) Constants.RegionSize); QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, (short)Constants.RegionSize, (short)Constants.RegionSize);
QuadTree.Subdivide(); QuadTree.Subdivide();
QuadTree.Subdivide(); QuadTree.Subdivide();
} }
@ -159,7 +162,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
lock (m_syncRoot) lock (m_syncRoot)
{ {
return _PhyScene.Simulate((float) elapsed); return _PhyScene.Simulate((float)elapsed);
} }
} }
@ -184,6 +187,7 @@ namespace OpenSim.Region.Environment.Scenes
foreach (SceneObjectPart part in sceneObject.Children.Values) foreach (SceneObjectPart part in sceneObject.Children.Values)
{ {
part.LocalId = m_parentScene.PrimIDAllocate(); part.LocalId = m_parentScene.PrimIDAllocate();
} }
sceneObject.UpdateParentIDs(); sceneObject.UpdateParentIDs();
AddEntity(sceneObject); AddEntity(sceneObject);
@ -245,7 +249,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INNER SCENE]: Failed to update {0}, - {1}", entity.Name, e); //entity.m_uuid m_log.ErrorFormat("[INNER SCENE]: Failed to update {0}, - {1}", entity.Name, e);//entity.m_uuid
} }
} }
m_updateList.Clear(); m_updateList.Clear();
@ -280,16 +284,15 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (obj is SceneObjectGroup) if (obj is SceneObjectGroup)
{ {
if ((obj).LocalId == localID) if (((SceneObjectGroup)obj).LocalId == localID)
{ {
m_parentScene.RemoveEntity((SceneObjectGroup) obj); m_parentScene.RemoveEntity((SceneObjectGroup)obj);
m_numPrim--; m_numPrim--;
return; return;
} }
} }
} }
} }
public void DetachObject(uint objectLocalID, IClientAPI remoteClient) public void DetachObject(uint objectLocalID, IClientAPI remoteClient)
{ {
List<EntityBase> EntityList = GetEntities(); List<EntityBase> EntityList = GetEntities();
@ -298,15 +301,16 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (obj is SceneObjectGroup) if (obj is SceneObjectGroup)
{ {
if ((obj).LocalId == objectLocalID) if (((SceneObjectGroup)obj).LocalId == objectLocalID)
{ {
SceneObjectGroup group = (SceneObjectGroup) obj; SceneObjectGroup group = (SceneObjectGroup)obj;
//group.DetachToGround(); //group.DetachToGround();
DetachSingleAttachmentToInv(group.GetFromAssetID(), remoteClient); DetachSingleAttachmentToInv(group.GetFromAssetID(),remoteClient);
} }
} }
} }
} }
public void HandleUndo(IClientAPI remoteClient, LLUUID primId) public void HandleUndo(IClientAPI remoteClient, LLUUID primId)
@ -316,7 +320,10 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId); SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId);
if (part != null) if (part != null)
part.Undo(); part.Undo();
} }
} }
/// <summary> /// <summary>
@ -331,29 +338,27 @@ namespace OpenSim.Region.Environment.Scenes
// Calls attach with a Zero position // Calls attach with a Zero position
AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero); AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero);
} }
public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,uint ItemFlags, uint NextOwnerMask)
public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, uint ItemFlags, uint NextOwnerMask)
{ {
SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, 1, true, SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, (byte)1, true,
(uint) (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
(uint) (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
(uint)
(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
ItemFlags, false, false, remoteClient.AgentId, true); ItemFlags, false, false, remoteClient.AgentId, true);
if (objatt != null) if (objatt != null)
{ {
AttachObject(remoteClient, objatt.LocalId, AttachmentPt, new LLQuaternion(0, 0, 0, 1), objatt.AbsolutePosition); AttachObject(remoteClient,objatt.LocalId,AttachmentPt,new LLQuaternion(0,0,0,1),objatt.AbsolutePosition);
objatt.ScheduleGroupForFullUpdate(); objatt.ScheduleGroupForFullUpdate();
} }
} }
// What makes this method odd and unique is it tries to detach using an LLUUID.... Yay for standards. // What makes this method odd and unique is it tries to detach using an LLUUID.... Yay for standards.
// To LocalId or LLUUID, *THAT* is the question. How now Brown LLUUID?? // To LocalId or LLUUID, *THAT* is the question. How now Brown LLUUID??
public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient) public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient)
{ {
if (itemID == LLUUID.Zero) // If this happened, someone made a mistake.... if (itemID == LLUUID.Zero) // If this happened, someone made a mistake....
return; return;
@ -363,16 +368,17 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (obj is SceneObjectGroup) if (obj is SceneObjectGroup)
{ {
if (((SceneObjectGroup) obj).GetFromAssetID() == itemID) if (((SceneObjectGroup)obj).GetFromAssetID() == itemID)
{ {
SceneObjectGroup group = (SceneObjectGroup) obj; SceneObjectGroup group = (SceneObjectGroup)obj;
group.DetachToInventoryPrep(); group.DetachToInventoryPrep();
m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint) group.GetAttachmentPoint())); m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(), group.OwnerID); m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(),group.OwnerID);
m_parentScene.DeleteSceneObjectGroup(group); m_parentScene.DeleteSceneObjectGroup(group);
} }
} }
} }
} }
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, LLVector3 attachPos) public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, LLVector3 attachPos)
@ -382,33 +388,38 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (obj is SceneObjectGroup) if (obj is SceneObjectGroup)
{ {
if ((obj).LocalId == objectLocalID) if (((SceneObjectGroup)obj).LocalId == objectLocalID)
{ {
SceneObjectGroup group = (SceneObjectGroup) obj; SceneObjectGroup group = (SceneObjectGroup)obj;
// If the attachment point isn't the same as the one previously used // If the attachment point isn't the same as the one previously used
// set it's offset position = 0 so that it appears on the attachment point // set it's offset position = 0 so that it appears on the attachment point
// and not in a weird location somewhere unknown. // and not in a weird location somewhere unknown.
if (AttachmentPt != 0 && AttachmentPt != group.GetAttachmentPoint()) if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
{ {
attachPos = LLVector3.Zero; attachPos = LLVector3.Zero;
} }
// AttachmentPt 0 means the client chose to 'wear' the attachment. // AttachmentPt 0 means the client chose to 'wear' the attachment.
if (AttachmentPt == 0) if (AttachmentPt == 0)
{ {
// Check object for stored attachment point // Check object for stored attachment point
AttachmentPt = group.GetAttachmentPoint(); AttachmentPt = (uint)group.GetAttachmentPoint();
} }
// if we still didn't find a suitable attachment point....... // if we still didn't find a suitable attachment point.......
if (AttachmentPt == 0) if (AttachmentPt == 0)
{ {
// Stick it on left hand with Zero Offset from the attachment point. // Stick it on left hand with Zero Offset from the attachment point.
AttachmentPt = (uint) AttachmentPoint.LeftHand; AttachmentPt = (uint)AttachmentPoint.LeftHand;
attachPos = LLVector3.Zero; attachPos = LLVector3.Zero;
} }
m_log.Debug("[ATTACH]: Using attachpoint: " + AttachmentPt); m_log.Debug("[ATTACH]: Using attachpoint: " + AttachmentPt.ToString());
// Saves and gets assetID // Saves and gets assetID
@ -420,11 +431,13 @@ namespace OpenSim.Region.Environment.Scenes
group.SetFromAssetID(newAssetID); group.SetFromAssetID(newAssetID);
} }
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos); group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos);
} }
}
} }
} }
}
// Use the above method. // Use the above method.
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot,
bool deadMethod) bool deadMethod)
@ -476,7 +489,7 @@ namespace OpenSim.Region.Environment.Scenes
objupdate.ObjectData[0].ParentID = 0; objupdate.ObjectData[0].ParentID = 0;
objupdate.ObjectData[0].OwnerID = LLUUID.Zero; objupdate.ObjectData[0].OwnerID = LLUUID.Zero;
objupdate.ObjectData[0].Scale = new LLVector3(1, 1, 1); objupdate.ObjectData[0].Scale = new LLVector3(1, 1, 1);
objupdate.ObjectData[0].PCode = (byte) PCode.Avatar; objupdate.ObjectData[0].PCode = (byte)PCode.Avatar;
objupdate.ObjectData[0].TextureEntry = ScenePresence.DefaultTexture; objupdate.ObjectData[0].TextureEntry = ScenePresence.DefaultTexture;
objupdate.ObjectData[0].ID = av.LocalId; objupdate.ObjectData[0].ID = av.LocalId;
@ -516,7 +529,7 @@ namespace OpenSim.Region.Environment.Scenes
objupdate.ObjectData[1].TextureEntry = primData.TextureEntry; objupdate.ObjectData[1].TextureEntry = primData.TextureEntry;
objupdate.ObjectData[1].PCode = primData.PCode; objupdate.ObjectData[1].PCode = primData.PCode;
objupdate.ObjectData[1].State = (byte) (((byte) AttachmentPt) << 4); objupdate.ObjectData[1].State = (byte)(((byte)AttachmentPt) << 4);
objupdate.ObjectData[1].PathBegin = primData.PathBegin; objupdate.ObjectData[1].PathBegin = primData.PathBegin;
objupdate.ObjectData[1].PathEnd = primData.PathEnd; objupdate.ObjectData[1].PathEnd = primData.PathEnd;
objupdate.ObjectData[1].PathScaleX = primData.PathScaleX; objupdate.ObjectData[1].PathScaleX = primData.PathScaleX;
@ -554,7 +567,7 @@ namespace OpenSim.Region.Environment.Scenes
objupdate.ObjectData[1].Radius = 20; objupdate.ObjectData[1].Radius = 20;
objupdate.ObjectData[1].NameValue = objupdate.ObjectData[1].NameValue =
Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID); Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID);
LLVector3 pos = new LLVector3((float) 0.0, (float) 0.0, (float) 0.0); LLVector3 pos = new LLVector3((float)0.0, (float)0.0, (float)0.0);
pb = pos.GetBytes(); pb = pos.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length); Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length);
@ -725,7 +738,6 @@ namespace OpenSim.Region.Environment.Scenes
m_scriptLPS = 0; m_scriptLPS = 0;
return returnval; return returnval;
} }
#endregion #endregion
#region Get Methods #region Get Methods
@ -819,8 +831,8 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if (((SceneObjectGroup) ent).HasChildPrim(localID)) if (((SceneObjectGroup)ent).HasChildPrim(localID))
return (SceneObjectGroup) ent; return (SceneObjectGroup)ent;
} }
} }
return null; return null;
@ -834,8 +846,8 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if (((SceneObjectGroup) ent).HasChildPrim(fullID)) if (((SceneObjectGroup)ent).HasChildPrim(fullID))
return (SceneObjectGroup) ent; return (SceneObjectGroup)ent;
} }
} }
return null; return null;
@ -850,7 +862,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
SceneObjectGroup reportingG = (SceneObjectGroup) ent; SceneObjectGroup reportingG = (SceneObjectGroup)ent;
EntityIntersection result = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters); EntityIntersection result = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters);
if (result.HitTF) if (result.HitTF)
{ {
@ -975,8 +987,8 @@ namespace OpenSim.Region.Environment.Scenes
if (presence.IsChildAgent && m_parentScene.m_seeIntoRegionFromNeighbor) if (presence.IsChildAgent && m_parentScene.m_seeIntoRegionFromNeighbor)
{ {
LLVector3 oLoc = (ent).AbsolutePosition; LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition;
float distResult = (float) Util.GetDistanceTo(presence.AbsolutePosition, oLoc); float distResult = (float)Util.GetDistanceTo(presence.AbsolutePosition, oLoc);
//m_log.Info("[DISTANCE]: " + distResult.ToString()); //m_log.Info("[DISTANCE]: " + distResult.ToString());
@ -984,13 +996,13 @@ namespace OpenSim.Region.Environment.Scenes
{ {
// Send Only if we don't already know about it. // Send Only if we don't already know about it.
// KnownPrim also makes the prim known when called. // KnownPrim also makes the prim known when called.
if (!presence.KnownPrim((ent).UUID)) if (!presence.KnownPrim(((SceneObjectGroup)ent).UUID))
((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
} }
} }
else else
{ {
((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
} }
} }
} }
@ -1025,7 +1037,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
} }
public void UpdatePrimGroupScale(uint localID, LLVector3 scale, IClientAPI remoteClient) public void UpdatePrimGroupScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
{ {
SceneObjectGroup group = GetGroupByPrim(localID); SceneObjectGroup group = GetGroupByPrim(localID);
@ -1140,6 +1151,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(localID); SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null) if (group != null)
{ {
LLVector3 oldPos = group.AbsolutePosition; LLVector3 oldPos = group.AbsolutePosition;
if (group.RootPart.m_IsAttachment) if (group.RootPart.m_IsAttachment)
{ {
@ -1191,7 +1203,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID))
{ {
group.UpdatePrimFlags(localID, (ushort) packet.Type, true, packet.ToBytes()); group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes());
} }
} }
} }
@ -1201,7 +1213,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(objectID); SceneObjectGroup group = GetGroupByPrim(objectID);
if (group != null) if (group != null)
{ {
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) // && PermissionsMngr.) if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))// && PermissionsMngr.)
{ {
group.GrabMovement(offset, pos, remoteClient); group.GrabMovement(offset, pos, remoteClient);
} }
@ -1292,9 +1304,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if ((ent).LocalId == parentPrim) if (((SceneObjectGroup)ent).LocalId == parentPrim)
{ {
parenPrim = (SceneObjectGroup) ent; parenPrim = (SceneObjectGroup)ent;
break; break;
} }
} }
@ -1309,9 +1321,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if ((ent).LocalId == childPrims[i]) if (((SceneObjectGroup)ent).LocalId == childPrims[i])
{ {
children.Add((SceneObjectGroup) ent); children.Add((SceneObjectGroup)ent);
} }
} }
} }
@ -1348,16 +1360,19 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
SceneObjectGroup obj = (SceneObjectGroup) ent; SceneObjectGroup obj = (SceneObjectGroup)ent;
sceneObjects.Add(obj.LocalId, obj); sceneObjects.Add(obj.LocalId, obj);
} }
} }
// Find the root prim among the prim ids we've been given // Find the root prim among the prim ids we've been given
for (int i = 0; i < primIds.Count; i++) for (int i = 0; i < primIds.Count; i++)
{ {
if (sceneObjects.ContainsKey(primIds[i])) if (sceneObjects.ContainsKey(primIds[i]))
{ {
parenPrim = sceneObjects[primIds[i]]; parenPrim = sceneObjects[primIds[i]];
primIds.RemoveAt(i); primIds.RemoveAt(i);
break; break;
@ -1387,6 +1402,7 @@ namespace OpenSim.Region.Environment.Scenes
grp.DelinkFromGroup(primIds[i]); grp.DelinkFromGroup(primIds[i]);
delinkedSomething = true; delinkedSomething = true;
} }
} }
} }
if (!delinkedSomething) if (!delinkedSomething)
@ -1409,7 +1425,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
foreach (KeyValuePair<LLUUID, SceneObjectPart> subent in ((SceneObjectGroup) ent).Children) foreach (KeyValuePair<LLUUID, SceneObjectPart> subent in ((SceneObjectGroup)ent).Children)
{ {
if (subent.Value.LocalId == localID) if (subent.Value.LocalId == localID)
{ {
@ -1459,9 +1475,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if ((ent).LocalId == originalPrim) if (((SceneObjectGroup)ent).LocalId == originalPrim)
{ {
originPrim = (SceneObjectGroup) ent; originPrim = (SceneObjectGroup)ent;
break; break;
} }
} }

View File

@ -298,7 +298,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
IAgentAssetTransactions agentTransactions = RequestModuleInterface<IAgentAssetTransactions>(); IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
if (agentTransactions != null) if (agentTransactions != null)
{ {
agentTransactions.HandleItemUpdateFromTransaction( agentTransactions.HandleItemUpdateFromTransaction(
@ -395,7 +395,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId + ", no root folder"); m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder");
return; return;
} }
} }
@ -413,7 +413,7 @@ namespace OpenSim.Region.Environment.Scenes
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID); CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID);
if (userInfo == null) if (userInfo == null)
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find user " + oldAgentID); m_log.Error("[AGENT INVENTORY]: Failed to find user " + oldAgentID.ToString());
return; return;
} }
@ -422,20 +422,20 @@ namespace OpenSim.Region.Environment.Scenes
item = userInfo.RootFolder.HasItem(oldItemID); item = userInfo.RootFolder.HasItem(oldItemID);
if (item == null) if (item == null)
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID); m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
return; return;
} }
} }
else else
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID); m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
return; return;
} }
} }
AssetBase asset AssetBase asset
= AssetCache.GetAsset( = AssetCache.GetAsset(
item.AssetID, (item.AssetType == (int) AssetType.Texture ? true : false)); item.AssetID, (item.AssetType == (int)AssetType.Texture ? true : false));
if (asset != null) if (asset != null)
{ {
@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.Scenes
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo == null) if (userInfo == null)
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId); m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
return; return;
} }
@ -493,13 +493,13 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID); m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString());
return; return;
} }
} }
else else
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID + ", no root folder"); m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString() + ", no root folder");
return; return;
} }
} }
@ -575,14 +575,14 @@ namespace OpenSim.Region.Environment.Scenes
ScenePresence presence; ScenePresence presence;
TryGetAvatar(remoteClient.AgentId, out presence); TryGetAvatar(remoteClient.AgentId, out presence);
byte[] data = null; byte[] data = null;
if (invType == 3 && presence != null) // libsecondlife.asset.assettype.landmark = 3 - needs to be turned into an enum if(invType == 3 && presence != null) // libsecondlife.asset.assettype.landmark = 3 - needs to be turned into an enum
{ {
LLVector3 pos = presence.AbsolutePosition; LLVector3 pos=presence.AbsolutePosition;
string strdata = String.Format("Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n", string strdata=String.Format("Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n",
presence.Scene.RegionInfo.RegionID, presence.Scene.RegionInfo.RegionID,
pos.X, pos.Y, pos.Z, pos.X, pos.Y, pos.Z,
presence.RegionHandle); presence.RegionHandle);
data = Encoding.ASCII.GetBytes(strdata); data=Encoding.ASCII.GetBytes(strdata);
} }
AssetBase asset = CreateAsset(name, description, invType, assetType, data); AssetBase asset = CreateAsset(name, description, invType, assetType, data);
@ -599,13 +599,15 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
IAgentAssetTransactions agentTransactions = RequestModuleInterface<IAgentAssetTransactions>(); IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
if (agentTransactions != null) if (agentTransactions != null)
{ {
agentTransactions.HandleItemCreationFromTransaction( agentTransactions.HandleItemCreationFromTransaction(
remoteClient, transactionID, folderID, callbackID, description, remoteClient, transactionID, folderID, callbackID, description,
name, invType, assetType, wearableType, nextOwnerMask); name, invType, assetType, wearableType, nextOwnerMask);
} }
} }
} }
@ -615,7 +617,7 @@ namespace OpenSim.Region.Environment.Scenes
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo == null) if (userInfo == null)
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId); m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
return; return;
} }
@ -639,7 +641,7 @@ namespace OpenSim.Region.Environment.Scenes
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo == null) if (userInfo == null)
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId); m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
return; return;
} }
@ -782,8 +784,7 @@ namespace OpenSim.Region.Environment.Scenes
agentItem.Folder = folderId; agentItem.Folder = folderId;
agentItem.EveryOnePermissions = taskItem.EveryoneMask; agentItem.EveryOnePermissions = taskItem.EveryoneMask;
if (remoteClient.AgentId != taskItem.OwnerID) if (remoteClient.AgentId != taskItem.OwnerID) {
{
agentItem.BasePermissions = taskItem.NextOwnerMask; agentItem.BasePermissions = taskItem.NextOwnerMask;
agentItem.CurrentPermissions = taskItem.NextOwnerMask; agentItem.CurrentPermissions = taskItem.NextOwnerMask;
agentItem.NextPermissions = taskItem.NextOwnerMask; agentItem.NextPermissions = taskItem.NextOwnerMask;
@ -958,16 +959,14 @@ namespace OpenSim.Region.Environment.Scenes
{ {
bool permission; bool permission;
if (DeRezPacket.AgentBlock.Destination == 1) if (DeRezPacket.AgentBlock.Destination == 1)
{ { // Take Copy
// Take Copy
permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId, permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId,
(selectedEnt).UUID); ((SceneObjectGroup) selectedEnt).UUID);
} }
else else
{ { // Take
// Take
permission = PermissionsMngr.CanDeRezObject(remoteClient.AgentId, permission = PermissionsMngr.CanDeRezObject(remoteClient.AgentId,
(selectedEnt).UUID); ((SceneObjectGroup) selectedEnt).UUID);
} }
if (permission) if (permission)
@ -998,8 +997,7 @@ namespace OpenSim.Region.Environment.Scenes
item.InvType = asset.InvType; item.InvType = asset.InvType;
item.Folder = DeRezPacket.AgentBlock.DestinationID; item.Folder = DeRezPacket.AgentBlock.DestinationID;
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
if (remoteClient.AgentId != objectGroup.RootPart.OwnerID) if (remoteClient.AgentId != objectGroup.RootPart.OwnerID) {
{
item.BasePermissions = objectGroup.RootPart.NextOwnerMask; item.BasePermissions = objectGroup.RootPart.NextOwnerMask;
item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask;
item.NextPermissions = objectGroup.RootPart.NextOwnerMask; item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
@ -1027,7 +1025,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
} }
public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID assetID, LLUUID agentID) public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID assetID, LLUUID agentID)
{ {
SceneObjectGroup objectGroup = grp; SceneObjectGroup objectGroup = grp;
@ -1047,6 +1044,7 @@ namespace OpenSim.Region.Environment.Scenes
// search through folders to find the asset. // search through folders to find the asset.
while (searchfolders.Count > 0) while (searchfolders.Count > 0)
{ {
InventoryFolderImpl fld = searchfolders.Dequeue(); InventoryFolderImpl fld = searchfolders.Dequeue();
lock (fld) lock (fld)
{ {
@ -1071,8 +1069,8 @@ namespace OpenSim.Region.Environment.Scenes
AssetBase asset = CreateAsset( AssetBase asset = CreateAsset(
objectGroup.GetPartName(objectGroup.LocalId), objectGroup.GetPartName(objectGroup.LocalId),
objectGroup.GetPartDescription(objectGroup.LocalId), objectGroup.GetPartDescription(objectGroup.LocalId),
(sbyte) InventoryType.Object, (sbyte)InventoryType.Object,
(sbyte) AssetType.Object, (sbyte)AssetType.Object,
Helpers.StringToField(sceneObjectXml)); Helpers.StringToField(sceneObjectXml));
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
@ -1088,7 +1086,7 @@ namespace OpenSim.Region.Environment.Scenes
// Sticking it in root folder for now.. objects folder later? // Sticking it in root folder for now.. objects folder later?
item.Folder = foundFolder; // DeRezPacket.AgentBlock.DestinationID; item.Folder = foundFolder;// DeRezPacket.AgentBlock.DestinationID;
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
if (agentID != objectGroup.RootPart.OwnerID) if (agentID != objectGroup.RootPart.OwnerID)
{ {
@ -1110,10 +1108,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
remoteClient.SendInventoryItemCreateUpdate(item); remoteClient.SendInventoryItemCreateUpdate(item);
} }
}
}
}
}
}
}
public LLUUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID AgentId) public LLUUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID AgentId)
{ {
SceneObjectGroup objectGroup = grp; SceneObjectGroup objectGroup = grp;
@ -1128,8 +1126,8 @@ namespace OpenSim.Region.Environment.Scenes
AssetBase asset = CreateAsset( AssetBase asset = CreateAsset(
objectGroup.GetPartName(objectGroup.LocalId), objectGroup.GetPartName(objectGroup.LocalId),
objectGroup.GetPartDescription(objectGroup.LocalId), objectGroup.GetPartDescription(objectGroup.LocalId),
(sbyte) InventoryType.Object, (sbyte)InventoryType.Object,
(sbyte) AssetType.Object, (sbyte)AssetType.Object,
Helpers.StringToField(sceneObjectXml)); Helpers.StringToField(sceneObjectXml));
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
@ -1145,7 +1143,7 @@ namespace OpenSim.Region.Environment.Scenes
// Sticking it in root folder for now.. objects folder later? // Sticking it in root folder for now.. objects folder later?
item.Folder = userInfo.RootFolder.ID; // DeRezPacket.AgentBlock.DestinationID; item.Folder = userInfo.RootFolder.ID;// DeRezPacket.AgentBlock.DestinationID;
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
if (remoteClient.AgentId != objectGroup.RootPart.OwnerID) if (remoteClient.AgentId != objectGroup.RootPart.OwnerID)
{ {
@ -1167,6 +1165,7 @@ namespace OpenSim.Region.Environment.Scenes
return LLUUID.Zero; return LLUUID.Zero;
} }
return LLUUID.Zero; return LLUUID.Zero;
} }
/// <summary> /// <summary>
@ -1199,6 +1198,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// Returns SceneObjectGroup or null from asset request. /// Returns SceneObjectGroup or null from asset request.
/// </summary> /// </summary>
@ -1224,15 +1224,15 @@ namespace OpenSim.Region.Environment.Scenes
bool RezSelected, bool RemoveItem, LLUUID fromTaskID, bool attachment) bool RezSelected, bool RemoveItem, LLUUID fromTaskID, bool attachment)
{ {
// Work out position details // Work out position details
byte bRayEndIsIntersection = 0; byte bRayEndIsIntersection = (byte)0;
if (RayEndIsIntersection) if (RayEndIsIntersection)
{ {
bRayEndIsIntersection = 1; bRayEndIsIntersection = (byte)1;
} }
else else
{ {
bRayEndIsIntersection = 0; bRayEndIsIntersection = (byte)0;
} }
LLVector3 scale = new LLVector3(0.5f, 0.5f, 0.5f); LLVector3 scale = new LLVector3(0.5f, 0.5f, 0.5f);
@ -1240,7 +1240,7 @@ namespace OpenSim.Region.Environment.Scenes
LLVector3 pos = GetNewRezLocation( LLVector3 pos = GetNewRezLocation(
RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1),
BypassRayCast, bRayEndIsIntersection, true, scale, false); BypassRayCast, bRayEndIsIntersection,true,scale, false);
if (!PermissionsMngr.CanRezObject(remoteClient.AgentId, pos) && !attachment) if (!PermissionsMngr.CanRezObject(remoteClient.AgentId, pos) && !attachment)
{ {
@ -1306,7 +1306,7 @@ namespace OpenSim.Region.Environment.Scenes
if (!attachment) if (!attachment)
{ {
if (group.RootPart.Shape.PCode == (byte) PCode.Prim) if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
{ {
group.ClearPartAttachmentData(); group.ClearPartAttachmentData();
} }
@ -1327,5 +1327,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
return null; return null;
} }
} }
} }

View File

@ -79,11 +79,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if ((ent).LocalId == primLocalID) if (((SceneObjectGroup) ent).LocalId == primLocalID)
{ {
// A prim is only tainted if it's allowed to be edited by the person clicking it. // A prim is only tainted if it's allowed to be edited by the person clicking it.
if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, (ent).UUID) || if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
m_permissionManager.CanEditObject(remoteClient.AgentId, (ent).UUID))
{ {
((SceneObjectGroup) ent).GetProperties(remoteClient); ((SceneObjectGroup) ent).GetProperties(remoteClient);
((SceneObjectGroup) ent).IsSelected = true; ((SceneObjectGroup) ent).IsSelected = true;
@ -108,10 +107,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
if ((ent).LocalId == primLocalID) if (((SceneObjectGroup) ent).LocalId == primLocalID)
{ {
if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, (ent).UUID) || if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
m_permissionManager.CanEditObject(remoteClient.AgentId, (ent).UUID))
{ {
((SceneObjectGroup) ent).IsSelected = false; ((SceneObjectGroup) ent).IsSelected = false;
LandChannel.setPrimsTainted(); LandChannel.setPrimsTainted();
@ -145,6 +143,7 @@ namespace OpenSim.Region.Environment.Scenes
public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
{ {
List<EntityBase> EntitieList = GetEntities(); List<EntityBase> EntitieList = GetEntities();
foreach (EntityBase ent in EntitieList) foreach (EntityBase ent in EntitieList)
@ -179,6 +178,7 @@ namespace OpenSim.Region.Environment.Scenes
public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient) public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient)
{ {
List<EntityBase> EntitieList = GetEntities(); List<EntityBase> EntitieList = GetEntities();
foreach (EntityBase ent in EntitieList) foreach (EntityBase ent in EntitieList)
@ -190,7 +190,7 @@ namespace OpenSim.Region.Environment.Scenes
// Is this prim part of the group // Is this prim part of the group
if (obj.HasChildPrim(localID)) if (obj.HasChildPrim(localID))
{ {
SceneObjectPart part = obj.GetChildPart(localID); SceneObjectPart part=obj.GetChildPart(localID);
if (part != null) if (part != null)
{ {
// If the touched prim handles touches, deliver it // If the touched prim handles touches, deliver it
@ -233,8 +233,8 @@ namespace OpenSim.Region.Environment.Scenes
LLUUID translatedIDtem = item.AvatarID; LLUUID translatedIDtem = item.AvatarID;
searchData[i] = new AvatarPickerReplyPacket.DataBlock(); searchData[i] = new AvatarPickerReplyPacket.DataBlock();
searchData[i].AvatarID = translatedIDtem; searchData[i].AvatarID = translatedIDtem;
searchData[i].FirstName = Helpers.StringToField(item.firstName); searchData[i].FirstName = Helpers.StringToField((string) item.firstName);
searchData[i].LastName = Helpers.StringToField(item.lastName); searchData[i].LastName = Helpers.StringToField((string) item.lastName);
i++; i++;
} }
if (AvatarResponses.Count == 0) if (AvatarResponses.Count == 0)

View File

@ -53,99 +53,107 @@ namespace OpenSim.Region.Environment.Scenes
public partial class Scene : SceneBase public partial class Scene : SceneBase
{ {
#region Delegates
public delegate void SynchronizeSceneHandler(Scene scene); public delegate void SynchronizeSceneHandler(Scene scene);
public SynchronizeSceneHandler SynchronizeScene = null;
#endregion public int splitID = 0;
public int splitID;
public SynchronizeSceneHandler SynchronizeScene;
#region Fields #region Fields
protected Timer m_heartbeatTimer = new Timer();
protected Timer m_restartWaitTimer = new Timer();
protected SimStatsReporter m_statsReporter;
protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
public InnerScene m_innerScene;
private Random Rand = new Random();
private uint _primCount = 720000;
private readonly Mutex _primAllocateMutex = new Mutex(false); private readonly Mutex _primAllocateMutex = new Mutex(false);
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing private int m_timePhase = 24;
private readonly Mutex updateLock; private readonly Mutex updateLock;
private uint _primCount = 720000; public bool m_physicalPrim;
public CommunicationsManager CommsManager; public bool m_seeIntoRegionFromNeighbor;
private int frameMS; public int MaxUndoCount = 5;
private int m_RestartTimerCounter;
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
private int m_incrementsof15seconds = 0;
public string m_simulatorVersion = "OpenSimulator 0.5";
protected ModuleLoader m_moduleLoader;
protected StorageManager m_storageManager;
protected AgentCircuitManager m_authenticateHandler; protected AgentCircuitManager m_authenticateHandler;
public CommunicationsManager CommsManager;
// protected XferManager xferManager; // protected XferManager xferManager;
protected IAvatarFactory m_AvatarFactory; protected SceneCommunicationService m_sceneGridService;
protected SceneXmlLoader m_sceneXmlLoader;
/// <summary> /// <summary>
/// Each agent has its own capabilities handler. /// Each agent has its own capabilities handler.
/// </summary> /// </summary>
protected Dictionary<LLUUID, Caps> m_capsHandlers = new Dictionary<LLUUID, Caps>(); protected Dictionary<LLUUID, Caps> m_capsHandlers = new Dictionary<LLUUID, Caps>();
protected BaseHttpServer m_httpListener;
protected Dictionary<string, IRegionModule> Modules = new Dictionary<string, IRegionModule>();
public Dictionary<Type, object> ModuleInterfaces = new Dictionary<Type, object>();
protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
public Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
//API module interfaces
public IXfer XferManager;
protected IHttpRequests m_httpRequestModule;
protected ISimChat m_simChatModule;
protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule;
protected IAvatarFactory m_AvatarFactory;
// Central Update Loop // Central Update Loop
protected int m_fps = 10; protected int m_fps = 10;
protected int m_frame; protected int m_frame = 0;
protected Timer m_heartbeatTimer = new Timer(); protected float m_timespan = 0.089f;
protected BaseHttpServer m_httpListener;
protected IHttpRequests m_httpRequestModule;
private int m_incrementsof15seconds;
public InnerScene m_innerScene;
protected DateTime m_lastupdate = DateTime.Now; protected DateTime m_lastupdate = DateTime.Now;
public Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
protected ModuleLoader m_moduleLoader;
protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
public bool m_physicalPrim;
private bool m_physics_enabled = true;
protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
private int m_RestartTimerCounter;
protected Timer m_restartWaitTimer = new Timer();
protected SceneCommunicationService m_sceneGridService;
protected SceneXmlLoader m_sceneXmlLoader;
private bool m_scripts_enabled = true;
public bool m_seeIntoRegionFromNeighbor;
protected ISimChat m_simChatModule;
public string m_simulatorVersion = "OpenSimulator 0.5";
protected SimStatsReporter m_statsReporter;
protected StorageManager m_storageManager;
protected float m_timedilation = 1.0f; protected float m_timedilation = 1.0f;
private int m_timePhase = 24;
protected float m_timespan = 0.089f;
private int m_update_backup = 200;
private int m_update_physics = 1;
private int m_update_entitymovement = 1;
private int m_update_entities = 1; // Run through all objects checking for updates private int m_update_entities = 1; // Run through all objects checking for updates
private int m_update_entitiesquick = 200; // Run through objects that have scheduled updates checking for updates private int m_update_entitiesquick = 200; // Run through objects that have scheduled updates checking for updates
private int m_update_entitymovement = 1;
private int m_update_events = 1;
private int m_update_land = 1;
private int m_update_physics = 1;
private int m_update_presences = 1; // Update scene presence movements private int m_update_presences = 1; // Update scene presence movements
private int m_update_events = 1;
private int m_update_backup = 200;
private int m_update_terrain = 50; private int m_update_terrain = 50;
protected IWorldComm m_worldCommModule; private int m_update_land = 1;
protected IXMLRPC m_xmlrpcModule;
public int MaxUndoCount = 5; private int frameMS = 0;
protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); private int physicsMS2 = 0;
public Dictionary<Type, object> ModuleInterfaces = new Dictionary<Type, object>(); private int physicsMS = 0;
protected Dictionary<string, IRegionModule> Modules = new Dictionary<string, IRegionModule>(); private int otherMS = 0;
private bool m_physics_enabled = true;
private bool m_scripts_enabled = true;
private int otherMS;
private int physicsMS;
private int physicsMS2;
private Random Rand = new Random();
public IXfer XferManager;
#endregion #endregion
#region Properties #region Properties
protected readonly EstateManager m_estateManager;
protected readonly PermissionManager m_permissionManager;
public int objectCapacity = 45000;
public AgentCircuitManager AuthenticateHandler public AgentCircuitManager AuthenticateHandler
{ {
get { return m_authenticateHandler; } get { return m_authenticateHandler; }
} }
protected readonly EstateManager m_estateManager;
// an instance to the physics plugin's Scene object. // an instance to the physics plugin's Scene object.
public PhysicsScene PhysicsScene public PhysicsScene PhysicsScene
{ {
@ -169,6 +177,7 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_timedilation; } get { return m_timedilation; }
} }
protected readonly PermissionManager m_permissionManager;
// This is the instance to the permissions manager. // This is the instance to the permissions manager.
// This manages permissions to clients on in world objects // This manages permissions to clients on in world objects
@ -206,13 +215,14 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_innerScene.Entities; } get { return m_innerScene.Entities; }
set { m_innerScene.Entities = value; } set { m_innerScene.Entities = value; }
} }
public Dictionary<LLUUID, ScenePresence> m_restorePresences public Dictionary<LLUUID, ScenePresence> m_restorePresences
{ {
get { return m_innerScene.RestorePresences; } get { return m_innerScene.RestorePresences; }
set { m_innerScene.RestorePresences = value; } set { m_innerScene.RestorePresences = value; }
} }
public int objectCapacity = 45000;
#endregion #endregion
#region Constructors #region Constructors
@ -242,9 +252,9 @@ namespace OpenSim.Region.Environment.Scenes
//Bind Storage Manager functions to some land manager functions for this scene //Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded += EventManager.OnLandObjectAdded +=
m_storageManager.DataStore.StoreLandObject; new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject);
EventManager.OnLandObjectRemoved += EventManager.OnLandObjectRemoved +=
m_storageManager.DataStore.RemoveLandObject; new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject);
m_estateManager = new EstateManager(this, m_regInfo); m_estateManager = new EstateManager(this, m_regInfo);
@ -311,7 +321,7 @@ namespace OpenSim.Region.Environment.Scenes
OSString = OSString.Substring(0, 45); OSString = OSString.Substring(0, 45);
} }
m_simulatorVersion = "OpenSimulator v0.5-SVN on " + OSString + " ChilTasks:" + m_seeIntoRegionFromNeighbor + " PhysPrim:" + m_physicalPrim; m_simulatorVersion = "OpenSimulator v0.5-SVN on " + OSString + " ChilTasks:" + m_seeIntoRegionFromNeighbor.ToString() + " PhysPrim:" + m_physicalPrim.ToString();
} }
#endregion #endregion
@ -372,8 +382,8 @@ namespace OpenSim.Region.Environment.Scenes
} }
// If these are cast to INT because long + negative values + abs returns invalid data // If these are cast to INT because long + negative values + abs returns invalid data
int resultX = Math.Abs((int) otherRegion.RegionLocX - (int) RegionInfo.RegionLocX); int resultX = Math.Abs((int)otherRegion.RegionLocX - (int)RegionInfo.RegionLocX);
int resultY = Math.Abs((int) otherRegion.RegionLocY - (int) RegionInfo.RegionLocY); int resultY = Math.Abs((int)otherRegion.RegionLocY - (int)RegionInfo.RegionLocY);
if ((resultX <= 1) && if ((resultX <= 1) &&
(resultY <= 1)) (resultY <= 1))
{ {
@ -400,9 +410,9 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
m_log.Info("[INTERGRID]: Got notice about far away Region: " + otherRegion.RegionName + m_log.Info("[INTERGRID]: Got notice about far away Region: " + otherRegion.RegionName.ToString() +
" at (" + otherRegion.RegionLocX + ", " + " at (" + otherRegion.RegionLocX.ToString() + ", " +
otherRegion.RegionLocY + ")"); otherRegion.RegionLocY.ToString() + ")");
} }
} }
return true; return true;
@ -426,10 +436,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
// Now we figure out what to set the timer to that does the notifications and calls, RestartNow() // Now we figure out what to set the timer to that does the notifications and calls, RestartNow()
m_restartTimer.Interval = 15000; m_restartTimer.Interval = 15000;
m_incrementsof15seconds = (int) seconds / 15; m_incrementsof15seconds = (int)seconds / 15;
m_RestartTimerCounter = 0; m_RestartTimerCounter = 0;
m_restartTimer.AutoReset = true; m_restartTimer.AutoReset = true;
m_restartTimer.Elapsed += RestartTimer_Elapsed; m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
m_log.Error("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); m_log.Error("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
m_restartTimer.Start(); m_restartTimer.Start();
SendRegionMessageFromEstateTools(LLUUID.Random(), LLUUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes"); SendRegionMessageFromEstateTools(LLUUID.Random(), LLUUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes");
@ -527,7 +537,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
((SceneObjectGroup) ent).StopScripts(); ((SceneObjectGroup)ent).StopScripts();
} }
} }
} }
@ -541,10 +551,12 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
((SceneObjectGroup) ent).StartScripts(); ((SceneObjectGroup)ent).StartScripts();
} }
} }
} }
} }
m_scripts_enabled = !ScriptEngine; m_scripts_enabled = !ScriptEngine;
m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine");
@ -552,7 +564,9 @@ namespace OpenSim.Region.Environment.Scenes
if (m_physics_enabled != !PhysicsEngine) if (m_physics_enabled != !PhysicsEngine)
{ {
m_physics_enabled = !PhysicsEngine; m_physics_enabled = !PhysicsEngine;
} }
} }
// This is the method that shuts down the scene. // This is the method that shuts down the scene.
@ -605,8 +619,8 @@ namespace OpenSim.Region.Environment.Scenes
{ {
m_log.Debug("[SCENE]: Starting timer"); m_log.Debug("[SCENE]: Starting timer");
m_heartbeatTimer.Enabled = true; m_heartbeatTimer.Enabled = true;
m_heartbeatTimer.Interval = (int) (m_timespan * 1000); m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
m_heartbeatTimer.Elapsed += Heartbeat; m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
} }
public void SetModuleInterfaces() public void SetModuleInterfaces()
@ -742,25 +756,28 @@ namespace OpenSim.Region.Environment.Scenes
} }
catch (AccessViolationException e) catch (AccessViolationException e)
{ {
m_log.Error("[Scene]: Failed with exception " + e + " On Region: " + RegionInfo.RegionName); m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
} }
catch (NullReferenceException e) catch (NullReferenceException e)
{ {
m_log.Error("[Scene]: Failed with exception " + e + " On Region: " + RegionInfo.RegionName); m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
} }
catch (InvalidOperationException e) catch (InvalidOperationException e)
{ {
m_log.Error("[Scene]: Failed with exception " + e + " On Region: " + RegionInfo.RegionName); m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[Scene]: Failed with exception " + e + " On Region: " + RegionInfo.RegionName); m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
} }
finally finally
{ {
updateLock.ReleaseMutex(); updateLock.ReleaseMutex();
// Get actual time dilation // Get actual time dilation
float tmpval = (m_timespan / (float) SinceLastFrame.TotalSeconds); float tmpval = (m_timespan / (float)SinceLastFrame.TotalSeconds);
// If actual time dilation is greater then one, we're catching up, so subtract // If actual time dilation is greater then one, we're catching up, so subtract
// the amount that's greater then 1 from the time dilation // the amount that's greater then 1 from the time dilation
@ -839,10 +856,10 @@ namespace OpenSim.Region.Environment.Scenes
public void ExportWorldMap(string fileName) public void ExportWorldMap(string fileName)
{ {
List<MapBlockData> mapBlocks = List<MapBlockData> mapBlocks =
m_sceneGridService.RequestNeighbourMapBlocks((int) (RegionInfo.RegionLocX - 9), m_sceneGridService.RequestNeighbourMapBlocks((int)(RegionInfo.RegionLocX - 9),
(int) (RegionInfo.RegionLocY - 9), (int)(RegionInfo.RegionLocY - 9),
(int) (RegionInfo.RegionLocX + 9), (int)(RegionInfo.RegionLocX + 9),
(int) (RegionInfo.RegionLocY + 9)); (int)(RegionInfo.RegionLocY + 9));
List<AssetBase> textures = new List<AssetBase>(); List<AssetBase> textures = new List<AssetBase>();
List<Image> bitImages = new List<Image>(); List<Image> bitImages = new List<Image>();
@ -877,8 +894,8 @@ namespace OpenSim.Region.Environment.Scenes
for (int i = 0; i < mapBlocks.Count; i++) for (int i = 0; i < mapBlocks.Count; i++)
{ {
ushort x = (ushort) ((mapBlocks[i].X - RegionInfo.RegionLocX) + 10); ushort x = (ushort)((mapBlocks[i].X - RegionInfo.RegionLocX) + 10);
ushort y = (ushort) ((mapBlocks[i].Y - RegionInfo.RegionLocY) + 10); ushort y = (ushort)((mapBlocks[i].Y - RegionInfo.RegionLocY) + 10);
g.DrawImage(bitImages[i], (x * 128), (y * 128), 128, 128); g.DrawImage(bitImages[i], (x * 128), (y * 128), 128, 128);
} }
mapTexture.Save(fileName, ImageFormat.Jpeg); mapTexture.Save(fileName, ImageFormat.Jpeg);
@ -909,10 +926,11 @@ namespace OpenSim.Region.Environment.Scenes
{ {
Heightmap = new TerrainChannel(map); Heightmap = new TerrainChannel(map);
} }
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Warn("[terrain]: Scene.cs: LoadWorldMap() - Failed with exception " + e); m_log.Warn("[terrain]: Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString());
} }
} }
@ -973,7 +991,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
for (int y = 0; y < 256; y++) for (int y = 0; y < 256; y++)
{ {
float hmval = (float) hm[x, y]; float hmval = (float)hm[x, y];
if (hmval < low) if (hmval < low)
low = hmval; low = hmval;
if (hmval > high) if (hmval > high)
@ -1003,10 +1021,10 @@ namespace OpenSim.Region.Environment.Scenes
//} //}
//else //else
//{ //{
float tmpval = (float) hm[x, y]; float tmpval = (float)hm[x, y];
heightvalue = (float) hm[x, y]; heightvalue = (float)hm[x, y];
if (heightvalue > m_regInfo.EstateSettings.waterHeight) if ((float)heightvalue > m_regInfo.EstateSettings.waterHeight)
{ {
// scale height value // scale height value
heightvalue = low + mid * (heightvalue - low) / mid; heightvalue = low + mid * (heightvalue - low) / mid;
@ -1018,7 +1036,7 @@ namespace OpenSim.Region.Environment.Scenes
heightvalue = 0; heightvalue = 0;
Color green = Color.FromArgb((int) heightvalue, 100, (int) heightvalue); Color green = Color.FromArgb((int)heightvalue, 100, (int)heightvalue);
// Y flip the cordinates // Y flip the cordinates
mapbmp.SetPixel(x, (256 - y) - 1, green); mapbmp.SetPixel(x, (256 - y) - 1, green);
@ -1040,10 +1058,12 @@ namespace OpenSim.Region.Environment.Scenes
if (heightvalue < 0) if (heightvalue < 0)
heightvalue = 0; heightvalue = 0;
Color water = Color.FromArgb((int) heightvalue, (int) heightvalue, 255); Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255);
mapbmp.SetPixel(x, (256 - y) - 1, water); mapbmp.SetPixel(x, (256 - y) - 1, water);
} }
//} //}
} }
//tc = System.Environment.TickCount - tc; //tc = System.Environment.TickCount - tc;
//m_log.Info("[MAPTILE]: Completed One row in " + tc + " ms"); //m_log.Info("[MAPTILE]: Completed One row in " + tc + " ms");
@ -1067,6 +1087,7 @@ namespace OpenSim.Region.Environment.Scenes
asset.Type = 0; asset.Type = 0;
asset.Temporary = temporary; asset.Temporary = temporary;
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
} }
else else
{ {
@ -1084,6 +1105,7 @@ namespace OpenSim.Region.Environment.Scenes
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
} }
} }
} }
#endregion #endregion
@ -1121,14 +1143,14 @@ namespace OpenSim.Region.Environment.Scenes
{ {
AddEntityFromStorage(group); AddEntityFromStorage(group);
SceneObjectPart rootPart = group.GetChildPart(group.UUID); SceneObjectPart rootPart = group.GetChildPart(group.UUID);
rootPart.ObjectFlags &= ~(uint) LLObject.ObjectFlags.Scripted; rootPart.ObjectFlags &= ~(uint)LLObject.ObjectFlags.Scripted;
rootPart.TrimPermissions(); rootPart.TrimPermissions();
group.ApplyPhysics(m_physicalPrim); group.ApplyPhysics(m_physicalPrim);
//rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
} }
m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " SceneObject(s)"); m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
} }
/// <summary> /// <summary>
@ -1147,11 +1169,10 @@ namespace OpenSim.Region.Environment.Scenes
return myID; return myID;
} }
public LLVector3 GetNewRezLocation(LLVector3 RayStart, LLVector3 RayEnd, LLUUID RayTargetID, LLQuaternion rot, byte bypassRayCast, public LLVector3 GetNewRezLocation(LLVector3 RayStart, LLVector3 RayEnd, LLUUID RayTargetID, LLQuaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, LLVector3 scale, bool FaceCenter)
byte RayEndIsIntersection, bool frontFacesOnly, LLVector3 scale, bool FaceCenter)
{ {
LLVector3 pos = LLVector3.Zero; LLVector3 pos = LLVector3.Zero;
if (RayEndIsIntersection == 1) if (RayEndIsIntersection == (byte)1)
{ {
pos = RayEnd; pos = RayEnd;
return pos; return pos;
@ -1175,7 +1196,7 @@ namespace OpenSim.Region.Environment.Scenes
Ray NewRay = new Ray(AXOrigin, AXdirection); Ray NewRay = new Ray(AXOrigin, AXdirection);
// Ray Trace against target here // Ray Trace against target here
EntityIntersection ei = target.TestIntersectionOBB(NewRay, new Quaternion(1, 0, 0, 0), frontFacesOnly, FaceCenter); EntityIntersection ei = target.TestIntersectionOBB(NewRay, new Quaternion(1,0,0,0), frontFacesOnly, FaceCenter);
// Un-comment out the following line to Get Raytrace results printed to the console. // Un-comment out the following line to Get Raytrace results printed to the console.
// m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
@ -1197,6 +1218,7 @@ namespace OpenSim.Region.Environment.Scenes
// Un-offset the prim (it gets offset later by the consumer method) // Un-offset the prim (it gets offset later by the consumer method)
pos.Z -= 0.25F; pos.Z -= 0.25F;
} }
@ -1231,8 +1253,8 @@ namespace OpenSim.Region.Environment.Scenes
byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID, byte bypassRaycast, LLVector3 RayStart, LLUUID RayTargetID,
byte RayEndIsIntersection) byte RayEndIsIntersection)
{ {
LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f, 0.5f, 0.5f),
false); LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f,0.5f,0.5f), false);
if (PermissionsMngr.CanRezObject(ownerID, pos)) if (PermissionsMngr.CanRezObject(ownerID, pos))
{ {
@ -1252,7 +1274,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
// if grass or tree, make phantom // if grass or tree, make phantom
//rootPart.TrimPermissions(); //rootPart.TrimPermissions();
if ((rootPart.Shape.PCode == (byte) PCode.Grass) || (rootPart.Shape.PCode == (byte) PCode.Tree) || (rootPart.Shape.PCode == (byte) PCode.NewTree)) if ((rootPart.Shape.PCode == (byte)PCode.Grass) || (rootPart.Shape.PCode == (byte)PCode.Tree) || (rootPart.Shape.PCode == (byte)PCode.NewTree))
{ {
rootPart.AddFlag(LLObject.ObjectFlags.Phantom); rootPart.AddFlag(LLObject.ObjectFlags.Phantom);
//rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
@ -1267,13 +1289,13 @@ namespace OpenSim.Region.Environment.Scenes
public SceneObjectGroup AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position, public SceneObjectGroup AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position,
Tree treeType, bool newTree) Tree treeType, bool newTree)
{ {
LLUUID uuid = RegionInfo.MasterAvatarAssignedUUID; LLUUID uuid = this.RegionInfo.MasterAvatarAssignedUUID;
PrimitiveBaseShape treeShape = new PrimitiveBaseShape(); PrimitiveBaseShape treeShape = new PrimitiveBaseShape();
treeShape.PathCurve = 16; treeShape.PathCurve = 16;
treeShape.PathEnd = 49900; treeShape.PathEnd = 49900;
treeShape.PCode = newTree ? (byte) PCode.NewTree : (byte) PCode.Tree; treeShape.PCode = newTree ? (byte)PCode.NewTree : (byte)PCode.Tree;
treeShape.Scale = scale; treeShape.Scale = scale;
treeShape.State = (byte) treeType; treeShape.State = (byte)treeType;
return AddNewPrim(uuid, position, rotation, treeShape); return AddNewPrim(uuid, position, rotation, treeShape);
} }
@ -1338,11 +1360,12 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
/// <param name="position">current position of Group</param> /// <param name="position">current position of Group</param>
/// <param name="grp">Scene Object Group that we're crossing</param> /// <param name="grp">Scene Object Group that we're crossing</param>
public void CrossPrimGroupIntoNewRegion(LLVector3 position, SceneObjectGroup grp) public void CrossPrimGroupIntoNewRegion(LLVector3 position, SceneObjectGroup grp)
{ {
m_log.Warn("Prim crossing: " + grp.UUID); m_log.Warn("Prim crossing: " + grp.UUID.ToString());
int thisx = (int) RegionInfo.RegionLocX; int thisx = (int)RegionInfo.RegionLocX;
int thisy = (int) RegionInfo.RegionLocY; int thisy = (int)RegionInfo.RegionLocY;
ulong newRegionHandle = 0; ulong newRegionHandle = 0;
LLVector3 pos = position; LLVector3 pos = position;
@ -1351,27 +1374,27 @@ namespace OpenSim.Region.Environment.Scenes
{ {
pos.X = ((pos.X - Constants.RegionSize)); pos.X = ((pos.X - Constants.RegionSize));
newRegionHandle = Util.UIntsToLong((uint) ((thisx + 1) * Constants.RegionSize), (uint) (thisy * Constants.RegionSize)); newRegionHandle = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize));
// x + 1 // x + 1
} }
else if (position.X < -0.1f) else if (position.X < -0.1f)
{ {
pos.X = ((pos.X + Constants.RegionSize)); pos.X = ((pos.X + Constants.RegionSize));
newRegionHandle = Util.UIntsToLong((uint) ((thisx - 1) * Constants.RegionSize), (uint) (thisy * Constants.RegionSize)); newRegionHandle = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize));
// x - 1 // x - 1
} }
if (position.Y > Constants.RegionSize + 0.1f) if (position.Y > Constants.RegionSize + 0.1f)
{ {
pos.Y = ((pos.Y - Constants.RegionSize)); pos.Y = ((pos.Y - Constants.RegionSize));
newRegionHandle = Util.UIntsToLong((uint) (thisx * Constants.RegionSize), (uint) ((thisy + 1) * Constants.RegionSize)); newRegionHandle = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize));
// y + 1 // y + 1
} }
else if (position.Y < -1f) else if (position.Y < -1f)
{ {
pos.Y = ((pos.Y + Constants.RegionSize)); pos.Y = ((pos.Y + Constants.RegionSize));
newRegionHandle = Util.UIntsToLong((uint) (thisx * Constants.RegionSize), (uint) ((thisy - 1) * Constants.RegionSize)); newRegionHandle = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
// y - 1 // y - 1
} }
@ -1379,16 +1402,15 @@ namespace OpenSim.Region.Environment.Scenes
grp.OffsetForNewRegion(pos); grp.OffsetForNewRegion(pos);
CrossPrimGroupIntoNewRegion(newRegionHandle, grp); CrossPrimGroupIntoNewRegion(newRegionHandle, grp);
}
}
public void CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp) public void CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp)
{ {
int primcrossingXMLmethod = 0; int primcrossingXMLmethod = 0;
if (newRegionHandle != 0) if (newRegionHandle != 0)
{ {
bool successYN = false; bool successYN = false;
successYN = m_sceneGridService.PrimCrossToNeighboringRegion(newRegionHandle, grp.UUID, m_sceneXmlLoader.SavePrimGroupToXML2String(grp), successYN = m_sceneGridService.PrimCrossToNeighboringRegion(newRegionHandle, grp.UUID, m_sceneXmlLoader.SavePrimGroupToXML2String(grp), primcrossingXMLmethod);
primcrossingXMLmethod);
if (successYN) if (successYN)
{ {
// We remove the object here // We remove the object here
@ -1424,7 +1446,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart RootPrim = GetSceneObjectPart(primID); SceneObjectPart RootPrim = GetSceneObjectPart(primID);
if (RootPrim != null) if (RootPrim != null)
{ {
if (RootPrim.Shape.PCode == (byte) PCode.Prim) if (RootPrim.Shape.PCode == (byte)PCode.Prim)
{ {
SceneObjectGroup grp = RootPrim.ParentGroup; SceneObjectGroup grp = RootPrim.ParentGroup;
if (grp != null) if (grp != null)
@ -1440,10 +1462,12 @@ namespace OpenSim.Region.Environment.Scenes
// with the deeded object, it goes back to them // with the deeded object, it goes back to them
grp.SetFromAssetID(grp.RootPart.LastOwnerID); grp.SetFromAssetID(grp.RootPart.LastOwnerID);
m_innerScene.AttachObject(sp.ControllingClient, grp.LocalId, 0, grp.GroupRotation, grp.AbsolutePosition); m_innerScene.AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition);
} }
} }
} }
} }
} }
return true; return true;
@ -1452,6 +1476,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
return false; return false;
} }
} }
#endregion #endregion
@ -1538,19 +1563,19 @@ namespace OpenSim.Region.Environment.Scenes
client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay;
client.OnUpdatePrimFlags += m_innerScene.UpdatePrimFlags; client.OnUpdatePrimFlags += m_innerScene.UpdatePrimFlags;
client.OnRequestObjectPropertiesFamily += m_innerScene.RequestObjectPropertiesFamily; client.OnRequestObjectPropertiesFamily += m_innerScene.RequestObjectPropertiesFamily;
client.OnParcelPropertiesRequest += LandChannel.handleParcelPropertiesRequest; client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(LandChannel.handleParcelPropertiesRequest);
client.OnParcelDivideRequest += LandChannel.handleParcelDivideRequest; client.OnParcelDivideRequest += new ParcelDivideRequest(LandChannel.handleParcelDivideRequest);
client.OnParcelJoinRequest += LandChannel.handleParcelJoinRequest; client.OnParcelJoinRequest += new ParcelJoinRequest(LandChannel.handleParcelJoinRequest);
client.OnParcelPropertiesUpdateRequest += client.OnParcelPropertiesUpdateRequest +=
LandChannel.handleParcelPropertiesUpdateRequest; new ParcelPropertiesUpdateRequest(LandChannel.handleParcelPropertiesUpdateRequest);
client.OnParcelSelectObjects += LandChannel.handleParcelSelectObjectsRequest; client.OnParcelSelectObjects += new ParcelSelectObjects(LandChannel.handleParcelSelectObjectsRequest);
client.OnParcelObjectOwnerRequest += client.OnParcelObjectOwnerRequest +=
LandChannel.handleParcelObjectOwnersRequest; new ParcelObjectOwnerRequest(LandChannel.handleParcelObjectOwnersRequest);
client.OnParcelAccessListRequest += LandChannel.handleParcelAccessRequest; client.OnParcelAccessListRequest += new ParcelAccessListRequest(LandChannel.handleParcelAccessRequest);
client.OnParcelAccessListUpdateRequest += client.OnParcelAccessListUpdateRequest +=
LandChannel.handleParcelAccessUpdateRequest; new ParcelAccessListUpdateRequest(LandChannel.handleParcelAccessUpdateRequest);
client.OnEstateOwnerMessage += m_estateManager.handleEstateOwnerMessage; client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
client.OnRegionInfoRequest += m_estateManager.HandleRegionInfoRequest; client.OnRegionInfoRequest += m_estateManager.HandleRegionInfoRequest;
client.OnEstateCovenantRequest += m_estateManager.HandleEstateCovenantRequest; client.OnEstateCovenantRequest += m_estateManager.HandleEstateCovenantRequest;
client.OnRequestGodlikePowers += handleRequestGodlikePowers; client.OnRequestGodlikePowers += handleRequestGodlikePowers;
@ -1594,23 +1619,25 @@ namespace OpenSim.Region.Environment.Scenes
EventManager.TriggerOnNewClient(client); EventManager.TriggerOnNewClient(client);
} }
public virtual void TeleportClientHome(LLUUID AgentId, IClientAPI client) public virtual void TeleportClientHome(LLUUID AgentId, IClientAPI client)
{ {
UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(AgentId); UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(AgentId);
if (UserProfile != null) if (UserProfile != null)
{ {
ulong homeRegion = UserProfile.HomeRegion; ulong homeRegion = UserProfile.HomeRegion;
LLVector3 homePostion = new LLVector3(UserProfile.HomeLocationX, UserProfile.HomeLocationY, UserProfile.HomeLocationZ); LLVector3 homePostion = new LLVector3(UserProfile.HomeLocationX,UserProfile.HomeLocationY,UserProfile.HomeLocationZ);
LLVector3 homeLookat = new LLVector3(UserProfile.HomeLookAt); LLVector3 homeLookat = new LLVector3(UserProfile.HomeLookAt);
RequestTeleportLocation(client, homeRegion, homePostion, homeLookat, 0); RequestTeleportLocation(client, homeRegion, homePostion,homeLookat,(uint)0);
}
} }
}
public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, LLUUID AgentID, LLUUID GroupID, public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, LLUUID AgentID, LLUUID GroupID,
LLUUID RayTargetObj, LLVector3 RayEnd, LLVector3 RayStart, LLUUID RayTargetObj, LLVector3 RayEnd, LLVector3 RayStart,
bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates)
{ {
LLVector3 pos = LLVector3.Zero; LLVector3 pos = LLVector3.Zero;
bool frontFacesOnly = true; bool frontFacesOnly = true;
@ -1618,6 +1645,7 @@ namespace OpenSim.Region.Environment.Scenes
if (target != null) if (target != null)
{ {
LLVector3 direction = LLVector3.Norm(RayEnd - RayStart); LLVector3 direction = LLVector3.Norm(RayEnd - RayStart);
Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z);
Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z);
@ -1654,6 +1682,7 @@ namespace OpenSim.Region.Environment.Scenes
LLVector3 intersectionpoint = new LLVector3(ei.ipoint.x, ei.ipoint.y, ei.ipoint.z); LLVector3 intersectionpoint = new LLVector3(ei.ipoint.x, ei.ipoint.y, ei.ipoint.z);
if (CopyCenters) if (CopyCenters)
{ {
// now we cast a ray from inside the prim(absolute position) to one of it's faces along the face normal. // now we cast a ray from inside the prim(absolute position) to one of it's faces along the face normal.
@ -1665,7 +1694,7 @@ namespace OpenSim.Region.Environment.Scenes
if (ei2.HitTF) if (ei2.HitTF)
{ {
//m_log.Info("[RAYTRACERESULTS]: Hit:" + ei2.HitTF.ToString() + " Point: " + ei2.ipoint.ToString() + " Normal: " + ei2.normal.ToString()); //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei2.HitTF.ToString() + " Point: " + ei2.ipoint.ToString() + " Normal: " + ei2.normal.ToString());
pos = new LLVector3(ei2.ipoint.x, ei2.ipoint.y, ei2.ipoint.z); pos = new LLVector3(ei2.ipoint.x,ei2.ipoint.y,ei2.ipoint.z);
} }
} }
LLVector3 normal = new LLVector3(ei.normal.x, ei.normal.y, ei.normal.z); LLVector3 normal = new LLVector3(ei.normal.x, ei.normal.y, ei.normal.z);
@ -1683,9 +1712,13 @@ namespace OpenSim.Region.Environment.Scenes
} }
return; return;
} }
}
} }
}
public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags)
{ {
UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId);
@ -1698,22 +1731,22 @@ namespace OpenSim.Region.Environment.Scenes
// We cast these to an int so as not to cause a breaking change with old regions // We cast these to an int so as not to cause a breaking change with old regions
// Newer regions treat this as a float on the ExpectUser method.. so we need to wait a few // Newer regions treat this as a float on the ExpectUser method.. so we need to wait a few
// releases before setting these to floats. (r4257) // releases before setting these to floats. (r4257)
UserProfile.HomeLocationX = (int) position.X; UserProfile.HomeLocationX = (int)position.X;
UserProfile.HomeLocationY = (int) position.Y; UserProfile.HomeLocationY = (int)position.Y;
UserProfile.HomeLocationZ = (int) position.Z; UserProfile.HomeLocationZ = (int)position.Z;
UserProfile.HomeLookAtX = (int) lookAt.X; UserProfile.HomeLookAtX = (int)lookAt.X;
UserProfile.HomeLookAtY = (int) lookAt.Y; UserProfile.HomeLookAtY = (int)lookAt.Y;
UserProfile.HomeLookAtZ = (int) lookAt.Z; UserProfile.HomeLookAtZ = (int)lookAt.Z;
CommsManager.UserService.UpdateUserProfileProperties(UserProfile); CommsManager.UserService.UpdateUserProfileProperties(UserProfile);
remoteClient.SendAgentAlertMessage("Set home to here if supported by login service", false); remoteClient.SendAgentAlertMessage("Set home to here if supported by login service",false);
} }
else else
{ {
remoteClient.SendAgentAlertMessage("Set Home request Failed", false); remoteClient.SendAgentAlertMessage("Set Home request Failed",false);
}
} }
}
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
{ {
ScenePresence avatar = null; ScenePresence avatar = null;
@ -1806,7 +1839,7 @@ namespace OpenSim.Region.Environment.Scenes
ForEachScenePresence( ForEachScenePresence(
delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
IAgentAssetTransactions agentTransactions = RequestModuleInterface<IAgentAssetTransactions>(); IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
if (agentTransactions != null) if (agentTransactions != null)
{ {
agentTransactions.RemoveAgentAssetTransactions(agentID); agentTransactions.RemoveAgentAssetTransactions(agentID);
@ -1846,7 +1879,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e); m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString());
} }
// Remove client agent from profile, so new logins will work // Remove client agent from profile, so new logins will work
@ -1866,12 +1899,14 @@ namespace OpenSim.Region.Environment.Scenes
{ {
lock (av) lock (av)
{ {
for (int i = 0; i < regionslst.Count; i++) for (int i = 0; i < regionslst.Count; i++)
{ {
av.KnownChildRegions.Remove(regionslst[i]); av.KnownChildRegions.Remove(regionslst[i]);
} }
} }
} }
} }
public override void CloseAllAgents(uint circuitcode) public override void CloseAllAgents(uint circuitcode)
@ -1968,7 +2003,7 @@ namespace OpenSim.Region.Environment.Scenes
ILandObject land = LandChannel.getLandObject(agent.startpos.X, agent.startpos.Y); ILandObject land = LandChannel.getLandObject(agent.startpos.X, agent.startpos.Y);
if (land != null) if (land != null)
{ {
if (land.landData.landingType == 1 && land.landData.userLocation != LLVector3.Zero) if (land.landData.landingType == (byte)1 && land.landData.userLocation != LLVector3.Zero)
{ {
agent.startpos = land.landData.userLocation; agent.startpos = land.landData.userLocation;
} }
@ -2070,7 +2105,7 @@ namespace OpenSim.Region.Environment.Scenes
catch (Exception e) catch (Exception e)
{ {
m_log.Info("[SCENE]: Unable to do Agent Crossing."); m_log.Info("[SCENE]: Unable to do Agent Crossing.");
m_log.Debug("[SCENE]: " + e); m_log.Debug("[SCENE]: " + e.ToString());
} }
//m_innerScene.SwapRootChildAgent(false); //m_innerScene.SwapRootChildAgent(false);
} }
@ -2086,14 +2121,15 @@ namespace OpenSim.Region.Environment.Scenes
// however to avoid a race condition crossing borders.. // however to avoid a race condition crossing borders..
if (childAgentUpdate.IsChildAgent) if (childAgentUpdate.IsChildAgent)
{ {
uint rRegionX = (uint) (cAgentData.regionHandle >> 40); uint rRegionX = (uint)(cAgentData.regionHandle >> 40);
uint rRegionY = (((uint) (cAgentData.regionHandle)) >> 8); uint rRegionY = (((uint)(cAgentData.regionHandle)) >> 8);
uint tRegionX = RegionInfo.RegionLocX; uint tRegionX = RegionInfo.RegionLocX;
uint tRegionY = RegionInfo.RegionLocY; uint tRegionY = RegionInfo.RegionLocY;
//Send Data to ScenePresence //Send Data to ScenePresence
childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY); childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY);
// Not Implemented: // Not Implemented:
//TODO: Do we need to pass the message on to one of our neighbors? //TODO: Do we need to pass the message on to one of our neighbors?
} }
return true; return true;
} }
@ -2121,7 +2157,7 @@ namespace OpenSim.Region.Environment.Scenes
m_innerScene.removeUserCount(true); m_innerScene.removeUserCount(true);
} }
// Tell a single agent to disconnect from the region. // Tell a single agent to disconnect from the region.
DisableSimulatorPacket disable = (DisableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.DisableSimulator); DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Unknown); presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Unknown);
presence.ControllingClient.Close(true); presence.ControllingClient.Close(true);
} }
@ -2271,9 +2307,9 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="mod"></param> /// <param name="mod"></param>
public void RegisterModuleInterface<M>(M mod) public void RegisterModuleInterface<M>(M mod)
{ {
if (!ModuleInterfaces.ContainsKey(typeof (M))) if (!ModuleInterfaces.ContainsKey(typeof(M)))
{ {
ModuleInterfaces.Add(typeof (M), mod); ModuleInterfaces.Add(typeof(M), mod);
} }
} }
@ -2283,9 +2319,9 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns> /// <returns></returns>
public T RequestModuleInterface<T>() public T RequestModuleInterface<T>()
{ {
if (ModuleInterfaces.ContainsKey(typeof (T))) if (ModuleInterfaces.ContainsKey(typeof(T)))
{ {
return (T) ModuleInterfaces[typeof (T)]; return (T)ModuleInterfaces[typeof(T)];
} }
else else
{ {
@ -2300,6 +2336,7 @@ namespace OpenSim.Region.Environment.Scenes
m_statsReporter.SetObjectCapacity(objects); m_statsReporter.SetObjectCapacity(objects);
} }
objectCapacity = objects; objectCapacity = objects;
} }
public List<FriendListItem> GetFriendList(LLUUID avatarID) public List<FriendListItem> GetFriendList(LLUUID avatarID)
@ -2307,6 +2344,7 @@ namespace OpenSim.Region.Environment.Scenes
return CommsManager.GetUserFriendList(avatarID); return CommsManager.GetUserFriendList(avatarID);
} }
#endregion #endregion
#region Other Methods #region Other Methods
@ -2340,8 +2378,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public void SendDialogToUser(LLUUID avatarID, string objectName, LLUUID objectID, LLUUID ownerID, string message, LLUUID TextureID, int ch, public void SendDialogToUser(LLUUID avatarID, string objectName, LLUUID objectID, LLUUID ownerID, string message, LLUUID TextureID, int ch, string[] buttonlabels)
string[] buttonlabels)
{ {
if (m_scenePresences.ContainsKey(avatarID)) if (m_scenePresences.ContainsKey(avatarID))
{ {
@ -2399,7 +2436,6 @@ namespace OpenSim.Region.Environment.Scenes
// TODO: m_sceneGridService.DoStuff; // TODO: m_sceneGridService.DoStuff;
m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID); m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID);
} }
public virtual List<FriendListItem> StoreGetFriendsForUser(LLUUID ownerID) public virtual List<FriendListItem> StoreGetFriendsForUser(LLUUID ownerID)
{ {
// TODO: m_sceneGridService.DoStuff; // TODO: m_sceneGridService.DoStuff;
@ -2412,13 +2448,11 @@ namespace OpenSim.Region.Environment.Scenes
m_statsReporter.AddOutPackets(outPackets); m_statsReporter.AddOutPackets(outPackets);
m_statsReporter.AddunAckedBytes(unAckedBytes); m_statsReporter.AddunAckedBytes(unAckedBytes);
} }
public void AddAgentTime(int ms) public void AddAgentTime(int ms)
{ {
m_statsReporter.addFrameMS(ms); m_statsReporter.addFrameMS(ms);
m_statsReporter.addAgentMS(ms); m_statsReporter.addAgentMS(ms);
} }
public void AddAgentUpdates(int count) public void AddAgentUpdates(int count)
{ {
m_statsReporter.AddAgentUpdates(count); m_statsReporter.AddAgentUpdates(count);
@ -2512,6 +2546,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="Message">The Message being sent to the user</param> /// <param name="Message">The Message being sent to the user</param>
public void SendRegionMessageFromEstateTools(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message) public void SendRegionMessageFromEstateTools(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message)
{ {
List<ScenePresence> presenceList = GetScenePresences(); List<ScenePresence> presenceList = GetScenePresences();
foreach (ScenePresence presence in presenceList) foreach (ScenePresence presence in presenceList)
@ -2531,7 +2566,11 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="Message">The Message being sent to the user</param> /// <param name="Message">The Message being sent to the user</param>
public void SendEstateMessageFromEstateTools(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message) public void SendEstateMessageFromEstateTools(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message)
{ {
ClientManager.ForEachClient(delegate(IClientAPI controller) { controller.SendBlueBoxMessage(FromAvatarID, fromSessionID, FromAvatarName, Message); }
ClientManager.ForEachClient(delegate(IClientAPI controller)
{
controller.SendBlueBoxMessage(FromAvatarID, fromSessionID, FromAvatarName, Message);
}
); );
} }
@ -2560,6 +2599,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (controller.AgentId != godID) if (controller.AgentId != godID)
controller.Kick(Helpers.FieldToUTF8String(reason)); controller.Kick(Helpers.FieldToUTF8String(reason));
} }
); );
// This is a bit crude. It seems the client will be null before it actually stops the thread // This is a bit crude. It seems the client will be null before it actually stops the thread
@ -2605,6 +2647,7 @@ namespace OpenSim.Region.Environment.Scenes
// Check for spoofing.. since this is permissions we're talking about here! // Check for spoofing.. since this is permissions we're talking about here!
if ((controller.SessionId == sessionID) && (controller.AgentId == agentID)) if ((controller.SessionId == sessionID) && (controller.AgentId == agentID))
{ {
// Tell the object to do permission update // Tell the object to do permission update
if (localId != 0) if (localId != 0)
{ {
@ -2614,6 +2657,7 @@ namespace OpenSim.Region.Environment.Scenes
chObjectGroup.UpdatePermissions(agentID, field, localId, mask, set); chObjectGroup.UpdatePermissions(agentID, field, localId, mask, set);
} }
} }
} }
} }
@ -2679,7 +2723,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
((SceneObjectGroup) ent).ScheduleGroupForFullUpdate(); ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate();
} }
} }
} }
@ -2699,7 +2743,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart((ent).UUID); SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID);
if (part != null) if (part != null)
{ {
if (part.Name == cmdparams[0]) if (part.Name == cmdparams[0])
@ -2823,8 +2867,8 @@ namespace OpenSim.Region.Environment.Scenes
#region Script Engine #region Script Engine
private readonly bool m_dumpAssetsToFile; private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>();
private readonly List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>(); private bool m_dumpAssetsToFile;
/// <summary> /// <summary>
/// ///
@ -2838,11 +2882,13 @@ namespace OpenSim.Region.Environment.Scenes
public void TriggerObjectChanged(uint localID, uint change) public void TriggerObjectChanged(uint localID, uint change)
{ {
m_eventManager.TriggerOnScriptChangedEvent(localID, change); m_eventManager.TriggerOnScriptChangedEvent(localID, change);
} }
public void TriggerAtTargetEvent(uint localID, uint handle, LLVector3 targetpos, LLVector3 currentpos) public void TriggerAtTargetEvent(uint localID, uint handle, LLVector3 targetpos, LLVector3 currentpos)
{ {
m_eventManager.TriggerAtTargetEvent(localID, handle, targetpos, currentpos); m_eventManager.TriggerAtTargetEvent(localID, handle, targetpos, currentpos);
} }
@ -2851,21 +2897,20 @@ namespace OpenSim.Region.Environment.Scenes
m_eventManager.TriggerNotAtTargetEvent(localID); m_eventManager.TriggerNotAtTargetEvent(localID);
} }
private bool scriptDanger(SceneObjectPart part, LLVector3 pos) private bool scriptDanger(SceneObjectPart part,LLVector3 pos)
{ {
ILandObject parcel = LandChannel.getLandObject(pos.X, pos.Y); ILandObject parcel = LandChannel.getLandObject(pos.X, pos.Y);
if (part != null) if (part != null)
{ {
if (parcel != null) if (parcel != null)
{ {
if ((parcel.landData.landFlags & (uint) Parcel.ParcelFlags.AllowOtherScripts) != 0) if ((parcel.landData.landFlags & (uint)Parcel.ParcelFlags.AllowOtherScripts) != 0)
{ {
return true; return true;
} }
else if ((parcel.landData.landFlags & (uint) Parcel.ParcelFlags.AllowGroupScripts) != 0) else if ((parcel.landData.landFlags & (uint)Parcel.ParcelFlags.AllowGroupScripts) != 0)
{ {
if (part.OwnerID == parcel.landData.ownerID || (parcel.landData.isGroupOwned && part.GroupID == parcel.landData.groupID) || if (part.OwnerID == parcel.landData.ownerID || (parcel.landData.isGroupOwned && part.GroupID == parcel.landData.groupID) || PermissionsMngr.GenericEstatePermission(part.OwnerID))
PermissionsMngr.GenericEstatePermission(part.OwnerID))
{ {
return true; return true;
} }
@ -2888,6 +2933,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
if (pos.X > 0f && pos.X < Constants.RegionSize && pos.Y > 0f && pos.Y < Constants.RegionSize) if (pos.X > 0f && pos.X < Constants.RegionSize && pos.Y > 0f && pos.Y < Constants.RegionSize)
{ {
// The only time parcel != null when an object is inside a region is when // The only time parcel != null when an object is inside a region is when
@ -2906,7 +2952,6 @@ namespace OpenSim.Region.Environment.Scenes
return false; return false;
} }
} }
public bool scriptDanger(uint localID, LLVector3 pos) public bool scriptDanger(uint localID, LLVector3 pos)
{ {
SceneObjectPart part = GetSceneObjectPart(localID); SceneObjectPart part = GetSceneObjectPart(localID);
@ -2922,11 +2967,13 @@ namespace OpenSim.Region.Environment.Scenes
public bool pipeEventsForScript(uint localID) public bool pipeEventsForScript(uint localID)
{ {
SceneObjectPart part = GetSceneObjectPart(localID); SceneObjectPart part = GetSceneObjectPart(localID);
if (part != null) if (part != null)
{ {
LLVector3 pos = part.GetWorldPosition(); LLVector3 pos = part.GetWorldPosition();
return scriptDanger(part, pos); return scriptDanger(part, pos);
} }
else else
{ {
@ -3043,7 +3090,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Info("[BUG]: " + e); m_log.Info("[BUG]: " + e.ToString());
} }
} }
} }
@ -3098,6 +3145,7 @@ namespace OpenSim.Region.Environment.Scenes
// action(presence); // action(presence);
// } // }
// } // }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -3187,7 +3235,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
return visualParams; return visualParams;
} }
#endregion #endregion
} }
} }

View File

@ -40,11 +40,6 @@ namespace OpenSim.Region.Environment.Scenes
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// XXX These two methods are very temporary
/// </summary>
protected Dictionary<LLUUID, string> capsPaths = new Dictionary<LLUUID, string>();
#region Events #region Events
public event restart OnRestart; public event restart OnRestart;
@ -55,38 +50,41 @@ namespace OpenSim.Region.Environment.Scenes
private readonly ClientManager m_clientManager = new ClientManager(); private readonly ClientManager m_clientManager = new ClientManager();
public ClientManager ClientManager
{
get { return m_clientManager; }
}
protected ulong m_regionHandle;
protected string m_regionName;
protected RegionInfo m_regInfo;
//public TerrainEngine Terrain; //public TerrainEngine Terrain;
public ITerrainChannel Heightmap; public ITerrainChannel Heightmap;
public ILandChannel LandChannel; public ILandChannel LandChannel;
private AssetCache m_assetCache;
protected string m_datastore;
protected EventManager m_eventManager; protected EventManager m_eventManager;
private uint m_nextLocalId = 8880000;
protected RegionInfo m_regInfo;
protected ulong m_regionHandle;
protected string m_regionName;
protected RegionStatus m_regStatus;
public EventManager EventManager public EventManager EventManager
{ {
get { return m_eventManager; } get { return m_eventManager; }
} }
protected string m_datastore;
private uint m_nextLocalId = 8880000;
private AssetCache m_assetCache;
public AssetCache AssetCache public AssetCache AssetCache
{ {
get { return m_assetCache; } get { return m_assetCache; }
set { m_assetCache = value; } set { m_assetCache = value; }
} }
public ClientManager ClientManager protected RegionStatus m_regStatus;
{
get { return m_clientManager; }
}
public RegionStatus Region_Status public RegionStatus Region_Status
{ {
@ -143,8 +141,6 @@ namespace OpenSim.Region.Environment.Scenes
#endregion #endregion
#region IScene Members
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -159,18 +155,6 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_nextLocalId++; } get { return m_nextLocalId++; }
} }
public string GetCapsPath(LLUUID agentId)
{
if (capsPaths.ContainsKey(agentId))
{
return capsPaths[agentId];
}
return null;
}
#endregion
#region admin stuff #region admin stuff
/// <summary> /// <summary>
@ -189,7 +173,6 @@ namespace OpenSim.Region.Environment.Scenes
{ {
return false; return false;
} }
public abstract bool OtherRegionUp(RegionInfo thisRegion); public abstract bool OtherRegionUp(RegionInfo thisRegion);
public virtual string GetSimulatorVersion() public virtual string GetSimulatorVersion()
@ -212,10 +195,24 @@ namespace OpenSim.Region.Environment.Scenes
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[SCENE]: SceneBase.cs: Close() - Failed with exception " + e); m_log.Error("[SCENE]: SceneBase.cs: Close() - Failed with exception " + e.ToString());
} }
} }
#endregion #endregion
/// <summary>
/// XXX These two methods are very temporary
/// </summary>
protected Dictionary<LLUUID, string> capsPaths = new Dictionary<LLUUID, string>();
public string GetCapsPath(LLUUID agentId)
{
if (capsPaths.ContainsKey(agentId))
{
return capsPaths[agentId];
}
return null;
}
} }
} }

View File

@ -43,47 +43,13 @@ namespace OpenSim.Region.Environment.Scenes
public class SceneCommunicationService //one instance per region public class SceneCommunicationService //one instance per region
{ {
#region Delegates
public delegate void InformNeighbourThatRegionUpDelegate(RegionInfo region, ulong regionhandle);
public delegate void SendChildAgentDataUpdateDelegate(ChildAgentDataUpdate cAgentData, ScenePresence presence);
public delegate void SendCloseChildAgentDelegate(LLUUID agentID, List<ulong> regionlst);
#endregion
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string _debugRegionName = String.Empty;
private AgentCrossing handlerAvatarCrossingIntoRegion; // OnAvatarCrossingIntoRegion;
private ChildAgentUpdate handlerChildAgentUpdate; // OnChildAgentUpdate;
private CloseAgentConnection handlerCloseAgentConnection; // OnCloseAgentConnection;
private ExpectPrimDelegate handlerExpectPrim; // OnExpectPrim;
private ExpectUserDelegate handlerExpectUser; // OnExpectUser;
private PrimCrossing handlerPrimCrossingIntoRegion; // OnPrimCrossingIntoRegion;
private RegionUp handlerRegionUp; // OnRegionUp;
private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar; // OnRemoveKnownRegionFromAvatar;
public KillObjectDelegate KillObject;
protected CommunicationsManager m_commsProvider; protected CommunicationsManager m_commsProvider;
protected RegionInfo m_regionInfo; protected RegionInfo m_regionInfo;
protected RegionCommsListener regionCommsHost; protected RegionCommsListener regionCommsHost;
public SceneCommunicationService(CommunicationsManager commsMan)
{
m_commsProvider = commsMan;
m_commsProvider.GridService.gdebugRegionName = _debugRegionName;
m_commsProvider.InterRegion.rdebugRegionName = _debugRegionName;
}
public string debugRegionName
{
get { return _debugRegionName; }
set { _debugRegionName = value; }
}
public event AgentCrossing OnAvatarCrossingIntoRegion; public event AgentCrossing OnAvatarCrossingIntoRegion;
public event ExpectUserDelegate OnExpectUser; public event ExpectUserDelegate OnExpectUser;
public event ExpectPrimDelegate OnExpectPrim; public event ExpectPrimDelegate OnExpectPrim;
@ -93,6 +59,31 @@ namespace OpenSim.Region.Environment.Scenes
public event ChildAgentUpdate OnChildAgentUpdate; public event ChildAgentUpdate OnChildAgentUpdate;
public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
private RegionUp handlerRegionUp = null; // OnRegionUp;
private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar;
public KillObjectDelegate KillObject;
public string _debugRegionName = String.Empty;
public string debugRegionName
{
get { return _debugRegionName; }
set { _debugRegionName = value; }
}
public SceneCommunicationService(CommunicationsManager commsMan)
{
m_commsProvider = commsMan;
m_commsProvider.GridService.gdebugRegionName = _debugRegionName;
m_commsProvider.InterRegion.rdebugRegionName = _debugRegionName;
}
public void RegisterRegion(RegionInfo regionInfos) public void RegisterRegion(RegionInfo regionInfos)
{ {
m_regionInfo = regionInfos; m_regionInfo = regionInfos;
@ -131,329 +122,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar)
{
InformNeighbourThatRegionUpDelegate icon = (InformNeighbourThatRegionUpDelegate) iar.AsyncState;
icon.EndInvoke(iar);
}
/// <summary>
/// Asynchronous call to information neighbouring regions that this region is up
/// </summary>
/// <param name="region"></param>
/// <param name="regionhandle"></param>
private void InformNeighboursThatRegionIsUpAsync(RegionInfo region, ulong regionhandle)
{
m_log.Info("[INTERGRID]: Starting to inform neighbors that I'm here");
//RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port);
bool regionAccepted =
m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region), regionhandle);
if (regionAccepted)
{
m_log.Info("[INTERGRID]: Completed informing neighbors that I'm here");
}
else
{
m_log.Warn("[INTERGRID]: Failed to inform neighbors that I'm here.");
}
}
/// <summary>
/// Called by scene when region is initialized (not always when it's listening for agents)
/// This is an inter-region message that informs the surrounding neighbors that the sim is up.
/// </summary>
public void InformNeighborsThatRegionisUp(RegionInfo region)
{
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
// This stays uncached because we don't already know about our neighbors at this point.
neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
if (neighbours != null)
{
for (int i = 0; i < neighbours.Count; i++)
{
InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
d.BeginInvoke(region, neighbours[i].RegionHandle,
InformNeighborsThatRegionisUpCompleted,
d);
}
}
//bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
}
/// <summary>
/// This informs all neighboring regions about the settings of it's child agent.
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
///
/// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
///
/// </summary>
private void SendChildAgentDataUpdateAsync(ChildAgentDataUpdate cAgentData, ScenePresence presence)
{
//m_log.Info("[INTERGRID]: Informing neighbors about my agent.");
try
{
foreach (ulong regionHandle in presence.KnownChildRegions)
{
bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
if (regionAccepted)
{
//m_log.Info("[INTERGRID]: Completed sending a neighbor an update about my agent");
}
else
{
//m_log.Info("[INTERGRID]: Failed sending a neighbor an update about my agent");
}
}
}
catch (InvalidOperationException)
{
// We're ignoring a collection was modified error because this data gets old and outdated fast.
}
}
private void SendChildAgentDataUpdateCompleted(IAsyncResult iar)
{
SendChildAgentDataUpdateDelegate icon = (SendChildAgentDataUpdateDelegate) iar.AsyncState;
icon.EndInvoke(iar);
}
public void SendChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, ScenePresence presence)
{
// This assumes that we know what our neighbors are.
SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
d.BeginInvoke(cAgentData, presence,
SendChildAgentDataUpdateCompleted,
d);
}
/// <summary>
/// This Closes child agents on neighboring regions
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
/// </summary>
private void SendCloseChildAgentAsync(LLUUID agentID, List<ulong> regionlst)
{
foreach (ulong regionHandle in regionlst)
{
bool regionAccepted = m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
if (regionAccepted)
{
m_log.Info("[INTERGRID]: Completed sending agent Close agent Request to neighbor");
}
else
{
m_log.Info("[INTERGRID]: Failed sending agent Close agent Request to neighbor");
}
}
// We remove the list of known regions from the agent's known region list through an event
// to scene, because, if an agent logged of, it's likely that there will be no scene presence
// by the time we get to this part of the method.
handlerRemoveKnownRegionFromAvatar = OnRemoveKnownRegionFromAvatar;
if (handlerRemoveKnownRegionFromAvatar != null)
{
handlerRemoveKnownRegionFromAvatar(agentID, regionlst);
}
}
private void SendCloseChildAgentCompleted(IAsyncResult iar)
{
SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate) iar.AsyncState;
icon.EndInvoke(iar);
}
public void SendCloseChildAgentConnections(LLUUID agentID, List<ulong> regionslst)
{
// This assumes that we know what our neighbors are.
SendCloseChildAgentDelegate d = SendCloseChildAgentAsync;
d.BeginInvoke(agentID, regionslst,
SendCloseChildAgentCompleted,
d);
}
/// <summary>
/// Helper function to request neighbors from grid-comms
/// </summary>
/// <param name="regionHandle"></param>
/// <returns></returns>
public virtual RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
{
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionHandle.ToString());
return m_commsProvider.GridService.RequestNeighbourInfo(regionHandle);
}
/// <summary>
/// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates
/// </summary>
/// <param name="minX"></param>
/// <param name="minY"></param>
/// <param name="maxX"></param>
/// <param name="maxY"></param>
public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY)
{
List<MapBlockData> mapBlocks;
mapBlocks = m_commsProvider.GridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, minX + 4, minY + 4);
remoteClient.SendMapBlock(mapBlocks);
}
/// <summary>
/// Try to teleport an agent to a new region.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="RegionHandle"></param>
/// <param name="position"></param>
/// <param name="lookAt"></param>
/// <param name="flags"></param>
public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position,
LLVector3 lookAt, uint flags)
{
bool destRegionUp = false;
if (regionHandle == m_regionInfo.RegionHandle)
{
avatar.ControllingClient.SendTeleportLocationStart();
avatar.ControllingClient.SendLocalTeleport(position, lookAt, flags);
avatar.Teleport(position);
}
else
{
RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle);
if (reg != null)
{
avatar.ControllingClient.SendTeleportLocationStart();
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero;
agent.InventoryFolder = LLUUID.Zero;
agent.startpos = position;
agent.child = true;
if (reg.RemotingAddress != "" && reg.RemotingPort != 0)
{
// region is remote. see if it is up
m_commsProvider.InterRegion.CheckRegion(reg.RemotingAddress, reg.RemotingPort);
destRegionUp = m_commsProvider.InterRegion.Available;
}
else
{
// assume local regions are always up
destRegionUp = true;
}
if (destRegionUp)
{
avatar.Close();
// Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport
// failure at this point (unlike a border crossing failure). So perhaps this can never fail
// once we reach here...
avatar.Scene.RemoveCapsHandler(avatar.UUID);
m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
position, false);
AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo();
// TODO Should construct this behind a method
string capsPath =
"http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + circuitdata.CapsPath + "0000/";
m_log.DebugFormat(
"[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
capsPath);
avatar.MakeChildAgent();
Thread.Sleep(5000);
avatar.CrossAttachmentsIntoNewRegion(regionHandle);
if (KillObject != null)
{
KillObject(avatar.LocalId);
}
uint newRegionX = (uint) (regionHandle >> 40);
uint newRegionY = (((uint) (regionHandle)) >> 8);
uint oldRegionX = (uint) (m_regionInfo.RegionHandle >> 40);
uint oldRegionY = (((uint) (m_regionInfo.RegionHandle)) >> 8);
if (Util.fast_distance2d((int) (newRegionX - oldRegionX), (int) (newRegionY - oldRegionY)) > 3)
{
SendCloseChildAgentConnections(avatar.UUID, avatar.GetKnownRegionList());
}
}
else
{
avatar.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
}
}
}
}
/// <summary>
///
/// </summary>
/// <param name="regionhandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
public bool CrossToNeighbouringRegion(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying);
}
public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, string objData, int XMLMethod)
{
return m_commsProvider.InterRegion.InformRegionOfPrimCrossing(regionhandle, primID, objData, XMLMethod);
}
public Dictionary<string, string> GetGridSettings()
{
return m_commsProvider.GridService.GetGridSettings();
}
public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz)
{
m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
}
public void ClearUserAgent(LLUUID avatarID)
{
m_commsProvider.UserService.clearUserAgent(avatarID);
}
public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
{
m_commsProvider.AddNewUserFriend(friendlistowner, friend, perms);
}
public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
{
m_commsProvider.UpdateUserFriendPerms(friendlistowner, friend, perms);
}
public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
{
m_commsProvider.RemoveUserFriend(friendlistowner, friend);
}
public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
{
return m_commsProvider.GetUserFriendList(friendlistowner);
}
public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
{
return m_commsProvider.GridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
}
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
{
return m_commsProvider.GenerateAgentPickerRequestResponse(queryID, query);
}
#region CommsManager Event handlers #region CommsManager Event handlers
/// <summary> /// <summary>
@ -513,6 +181,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
return false; return false;
} }
} }
protected void PrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) protected void PrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
@ -526,7 +195,7 @@ namespace OpenSim.Region.Environment.Scenes
protected bool CloseConnection(ulong regionHandle, LLUUID agentID) protected bool CloseConnection(ulong regionHandle, LLUUID agentID)
{ {
m_log.Info("[INTERREGION]: Incoming Agent Close Request for agent: " + agentID); m_log.Info("[INTERREGION]: Incoming Agent Close Request for agent: " + agentID.ToString());
handlerCloseAgentConnection = OnCloseAgentConnection; handlerCloseAgentConnection = OnCloseAgentConnection;
if (handlerCloseAgentConnection != null) if (handlerCloseAgentConnection != null)
{ {
@ -539,6 +208,9 @@ namespace OpenSim.Region.Environment.Scenes
#region Inform Client of Neighbours #region Inform Client of Neighbours
private delegate void InformClientOfNeighbourDelegate(
ScenePresence avatar, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint);
private void InformClientOfNeighbourCompleted(IAsyncResult iar) private void InformClientOfNeighbourCompleted(IAsyncResult iar)
{ {
InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState; InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState;
@ -634,6 +306,7 @@ namespace OpenSim.Region.Environment.Scenes
// XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes.
// throw e; // throw e;
} }
} }
} }
@ -657,9 +330,340 @@ namespace OpenSim.Region.Environment.Scenes
d); d);
} }
private delegate void InformClientOfNeighbourDelegate(
ScenePresence avatar, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint);
#endregion #endregion
public delegate void InformNeighbourThatRegionUpDelegate(RegionInfo region, ulong regionhandle);
private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar)
{
InformNeighbourThatRegionUpDelegate icon = (InformNeighbourThatRegionUpDelegate) iar.AsyncState;
icon.EndInvoke(iar);
}
/// <summary>
/// Asynchronous call to information neighbouring regions that this region is up
/// </summary>
/// <param name="region"></param>
/// <param name="regionhandle"></param>
private void InformNeighboursThatRegionIsUpAsync(RegionInfo region, ulong regionhandle)
{
m_log.Info("[INTERGRID]: Starting to inform neighbors that I'm here");
//RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port);
bool regionAccepted =
m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region), regionhandle);
if (regionAccepted)
{
m_log.Info("[INTERGRID]: Completed informing neighbors that I'm here");
}
else
{
m_log.Warn("[INTERGRID]: Failed to inform neighbors that I'm here.");
}
}
/// <summary>
/// Called by scene when region is initialized (not always when it's listening for agents)
/// This is an inter-region message that informs the surrounding neighbors that the sim is up.
/// </summary>
public void InformNeighborsThatRegionisUp(RegionInfo region)
{
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
// This stays uncached because we don't already know about our neighbors at this point.
neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
if (neighbours != null)
{
for (int i = 0; i < neighbours.Count; i++)
{
InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
d.BeginInvoke(region, neighbours[i].RegionHandle,
InformNeighborsThatRegionisUpCompleted,
d);
}
}
//bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
}
public delegate void SendChildAgentDataUpdateDelegate(ChildAgentDataUpdate cAgentData, ScenePresence presence);
/// <summary>
/// This informs all neighboring regions about the settings of it's child agent.
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
///
/// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
///
/// </summary>
private void SendChildAgentDataUpdateAsync(ChildAgentDataUpdate cAgentData, ScenePresence presence)
{
//m_log.Info("[INTERGRID]: Informing neighbors about my agent.");
try
{
foreach (ulong regionHandle in presence.KnownChildRegions)
{
bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
if (regionAccepted)
{
//m_log.Info("[INTERGRID]: Completed sending a neighbor an update about my agent");
}
else
{
//m_log.Info("[INTERGRID]: Failed sending a neighbor an update about my agent");
}
}
}
catch (InvalidOperationException)
{
// We're ignoring a collection was modified error because this data gets old and outdated fast.
}
}
private void SendChildAgentDataUpdateCompleted(IAsyncResult iar)
{
SendChildAgentDataUpdateDelegate icon = (SendChildAgentDataUpdateDelegate) iar.AsyncState;
icon.EndInvoke(iar);
}
public void SendChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, ScenePresence presence)
{
// This assumes that we know what our neighbors are.
SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
d.BeginInvoke(cAgentData,presence,
SendChildAgentDataUpdateCompleted,
d);
}
public delegate void SendCloseChildAgentDelegate( LLUUID agentID, List<ulong> regionlst);
/// <summary>
/// This Closes child agents on neighboring regions
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
/// </summary>
private void SendCloseChildAgentAsync(LLUUID agentID, List<ulong> regionlst)
{
foreach (ulong regionHandle in regionlst)
{
bool regionAccepted = m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
if (regionAccepted)
{
m_log.Info("[INTERGRID]: Completed sending agent Close agent Request to neighbor");
}
else
{
m_log.Info("[INTERGRID]: Failed sending agent Close agent Request to neighbor");
}
}
// We remove the list of known regions from the agent's known region list through an event
// to scene, because, if an agent logged of, it's likely that there will be no scene presence
// by the time we get to this part of the method.
handlerRemoveKnownRegionFromAvatar = OnRemoveKnownRegionFromAvatar;
if (handlerRemoveKnownRegionFromAvatar != null)
{
handlerRemoveKnownRegionFromAvatar(agentID, regionlst);
}
}
private void SendCloseChildAgentCompleted(IAsyncResult iar)
{
SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState;
icon.EndInvoke(iar);
}
public void SendCloseChildAgentConnections(LLUUID agentID, List<ulong> regionslst)
{
// This assumes that we know what our neighbors are.
SendCloseChildAgentDelegate d = SendCloseChildAgentAsync;
d.BeginInvoke(agentID, regionslst,
SendCloseChildAgentCompleted,
d);
}
/// <summary>
/// Helper function to request neighbors from grid-comms
/// </summary>
/// <param name="regionHandle"></param>
/// <returns></returns>
public virtual RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
{
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionHandle.ToString());
return m_commsProvider.GridService.RequestNeighbourInfo(regionHandle);
}
/// <summary>
/// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates
/// </summary>
/// <param name="minX"></param>
/// <param name="minY"></param>
/// <param name="maxX"></param>
/// <param name="maxY"></param>
public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY)
{
List<MapBlockData> mapBlocks;
mapBlocks = m_commsProvider.GridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, minX + 4, minY + 4);
remoteClient.SendMapBlock(mapBlocks);
}
/// <summary>
/// Try to teleport an agent to a new region.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="RegionHandle"></param>
/// <param name="position"></param>
/// <param name="lookAt"></param>
/// <param name="flags"></param>
public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position,
LLVector3 lookAt, uint flags)
{
bool destRegionUp = false;
if (regionHandle == m_regionInfo.RegionHandle)
{
avatar.ControllingClient.SendTeleportLocationStart();
avatar.ControllingClient.SendLocalTeleport(position, lookAt, flags);
avatar.Teleport(position);
}
else
{
RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle);
if (reg != null)
{
avatar.ControllingClient.SendTeleportLocationStart();
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero;
agent.InventoryFolder = LLUUID.Zero;
agent.startpos = position;
agent.child = true;
if (reg.RemotingAddress != "" && reg.RemotingPort != 0)
{
// region is remote. see if it is up
m_commsProvider.InterRegion.CheckRegion(reg.RemotingAddress, reg.RemotingPort);
destRegionUp = m_commsProvider.InterRegion.Available;
}
else
{
// assume local regions are always up
destRegionUp = true;
}
if(destRegionUp)
{
avatar.Close();
// Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport
// failure at this point (unlike a border crossing failure). So perhaps this can never fail
// once we reach here...
avatar.Scene.RemoveCapsHandler(avatar.UUID);
m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
position, false);
AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo();
// TODO Should construct this behind a method
string capsPath =
"http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + circuitdata.CapsPath + "0000/";
m_log.DebugFormat(
"[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
capsPath);
avatar.MakeChildAgent();
Thread.Sleep(5000);
avatar.CrossAttachmentsIntoNewRegion(regionHandle);
if (KillObject != null)
{
KillObject(avatar.LocalId);
}
uint newRegionX = (uint)(regionHandle >> 40);
uint newRegionY = (((uint)(regionHandle)) >> 8);
uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40);
uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8);
if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3)
{
SendCloseChildAgentConnections(avatar.UUID,avatar.GetKnownRegionList());
}
}
else
{
avatar.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
}
}
}
}
/// <summary>
///
/// </summary>
/// <param name="regionhandle"></param>
/// <param name="agentID"></param>
/// <param name="position"></param>
public bool CrossToNeighbouringRegion(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying);
}
public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, string objData, int XMLMethod)
{
return m_commsProvider.InterRegion.InformRegionOfPrimCrossing(regionhandle, primID, objData, XMLMethod);
}
public Dictionary<string, string> GetGridSettings()
{
return m_commsProvider.GridService.GetGridSettings();
}
public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz)
{
m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
}
public void ClearUserAgent(LLUUID avatarID)
{
m_commsProvider.UserService.clearUserAgent(avatarID);
}
public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
{
m_commsProvider.AddNewUserFriend(friendlistowner, friend, perms);
}
public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
{
m_commsProvider.UpdateUserFriendPerms(friendlistowner, friend, perms);
}
public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
{
m_commsProvider.RemoveUserFriend(friendlistowner, friend);
}
public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
{
return m_commsProvider.GetUserFriendList(friendlistowner);
}
public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
{
return m_commsProvider.GridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
}
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
{
return m_commsProvider.GenerateAgentPickerRequestResponse(queryID, query);
}
} }
} }

View File

@ -38,186 +38,236 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public class EventManager public class EventManager
{ {
#region Delegates
public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, LLUUID regionID);
public delegate void ClientClosed(LLUUID clientID);
public delegate void ClientMovement(ScenePresence client);
/// <summary>
/// DeregisterCapsEvent is called by Scene when the caps
/// handler for an agent are removed.
/// </summary>
public delegate void DeregisterCapsEvent(LLUUID agentID, Caps caps);
public delegate void LandBuy(Object sender, LandBuyArgs e);
public delegate void LandObjectAdded(ILandObject newParcel);
public delegate void LandObjectRemoved(LLUUID globalID);
public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e);
public delegate void NewGridInstantMessage(GridInstantMessage message);
public delegate void NewInventoryItemUploadComplete(LLUUID avatarID, LLUUID assetID, string name, int userlevel);
public delegate void NewRezScript(uint localID, LLUUID itemID, string script);
public delegate void ObjectDeGrabDelegate(uint localID, IClientAPI remoteClient);
public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
public delegate void OnBackupDelegate(IRegionDataStore datastore);
public delegate void OnFrameDelegate(); public delegate void OnFrameDelegate();
public delegate void OnNewClientDelegate(IClientAPI client);
public delegate void OnNewPresenceDelegate(ScenePresence presence);
public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
public delegate void OnParcelPrimCountUpdateDelegate();
public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
public delegate void OnPluginConsoleDelegate(string[] args);
public delegate void OnRemovePresenceDelegate(LLUUID agentId);
public delegate void OnShutdownDelegate();
public delegate void OnTerrainTickDelegate();
/// <summary>
/// RegisterCapsEvent is called by Scene after the Caps object
/// has been instantiated and before it is return to the
/// client and provides region modules to add their caps.
/// </summary>
public delegate void RegisterCapsEvent(LLUUID agentID, Caps caps);
public delegate void RemoveScript(uint localID, LLUUID itemID);
public delegate void SceneGroupGrabed(LLUUID groupID, LLVector3 offset, LLUUID userID);
public delegate bool SceneGroupMoved(LLUUID groupID, LLVector3 delta);
public delegate void ScriptAtTargetEvent(uint localID, uint handle, LLVector3 targetpos, LLVector3 atpos);
public delegate void ScriptChangedEvent(uint localID, uint change);
public delegate void ScriptNotAtTargetEvent(uint localID);
#endregion
private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel; //OnAvatarEnteringNewParcel;
private OnBackupDelegate handlerBackup; //OnBackup;
private ClientClosed handlerClientClosed; //OnClientClosed;
private ClientMovement handlerClientMovement; //OnClientMovement;
private DeregisterCapsEvent handlerDeregisterCaps; // OnDeregisterCaps;
private OnFrameDelegate handlerFrame; //OnFrame;
private NewGridInstantMessage handlerGridInstantMessageToFriends; //OnGridInstantMessageToFriendsModule;
private NewGridInstantMessage handlerGridInstantMessageToIM; //OnGridInstantMessageToIMModule;
private LandBuy handlerLandBuy;
private LandObjectAdded handlerLandObjectAdded; //OnLandObjectAdded;
private LandObjectRemoved handlerLandObjectRemoved; //OnLandObjectRemoved;
private OnNewPresenceDelegate handlerMakeChildAgent; //OnMakeChildAgent;
private MoneyTransferEvent handlerMoneyTransfer; //OnMoneyTransfer;
private OnNewClientDelegate handlerNewClient; //OnNewClient;
private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete;
private OnNewPresenceDelegate handlerNewPresence; //OnNewPresence;
private ObjectDeGrabDelegate handlerObjectDeGrab; //OnObjectDeGrab;
private ObjectGrabDelegate handlerObjectGrab; //OnObjectGrab;
private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd; //OnParcelPrimCountAdd;
private OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate; //OnParcelPrimCountUpdate;
private OnPermissionErrorDelegate handlerPermissionError; //OnPermissionError;
private OnPluginConsoleDelegate handlerPluginConsole; //OnPluginConsole;
private RegisterCapsEvent handlerRegisterCaps; // OnRegisterCaps;
private OnRemovePresenceDelegate handlerRemovePresence; //OnRemovePresence;
private RemoveScript handlerRemoveScript; //OnRemoveScript;
private NewRezScript handlerRezScript; //OnRezScript;
private SceneGroupGrabed handlerSceneGroupGrab; //OnSceneGroupGrab;
private SceneGroupMoved handlerSceneGroupMove; //OnSceneGroupMove;
private ScriptAtTargetEvent handlerScriptAtTargetEvent;
private ScriptChangedEvent handlerScriptChangedEvent; //OnScriptChangedEvent;
private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent;
private OnShutdownDelegate handlerShutdown; //OnShutdown;
private OnTerrainTickDelegate handlerTerrainTick; // OnTerainTick;
private LandBuy handlerValidateLandBuy;
public event OnFrameDelegate OnFrame; public event OnFrameDelegate OnFrame;
public delegate void ClientMovement(ScenePresence client);
public event ClientMovement OnClientMovement; public event ClientMovement OnClientMovement;
public delegate void OnTerrainTickDelegate();
public event OnTerrainTickDelegate OnTerrainTick; public event OnTerrainTickDelegate OnTerrainTick;
public delegate void OnBackupDelegate(IRegionDataStore datastore);
public event OnBackupDelegate OnBackup; public event OnBackupDelegate OnBackup;
public delegate void OnNewClientDelegate(IClientAPI client);
public event OnNewClientDelegate OnNewClient; public event OnNewClientDelegate OnNewClient;
public delegate void OnNewPresenceDelegate(ScenePresence presence);
public event OnNewPresenceDelegate OnNewPresence; public event OnNewPresenceDelegate OnNewPresence;
public delegate void OnRemovePresenceDelegate(LLUUID agentId);
public event OnRemovePresenceDelegate OnRemovePresence; public event OnRemovePresenceDelegate OnRemovePresence;
public delegate void OnParcelPrimCountUpdateDelegate();
public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate; public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd; public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
public delegate void OnPluginConsoleDelegate(string[] args);
public event OnPluginConsoleDelegate OnPluginConsole; public event OnPluginConsoleDelegate OnPluginConsole;
public delegate void OnShutdownDelegate();
public event OnShutdownDelegate OnShutdown; public event OnShutdownDelegate OnShutdown;
public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
public delegate void ObjectDeGrabDelegate(uint localID, IClientAPI remoteClient);
public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
public event ObjectGrabDelegate OnObjectGrab; public event ObjectGrabDelegate OnObjectGrab;
public event ObjectDeGrabDelegate OnObjectDeGrab; public event ObjectDeGrabDelegate OnObjectDeGrab;
public event OnPermissionErrorDelegate OnPermissionError; public event OnPermissionErrorDelegate OnPermissionError;
public delegate void NewRezScript(uint localID, LLUUID itemID, string script);
public event NewRezScript OnRezScript; public event NewRezScript OnRezScript;
public delegate void RemoveScript(uint localID, LLUUID itemID);
public event RemoveScript OnRemoveScript; public event RemoveScript OnRemoveScript;
public delegate bool SceneGroupMoved(LLUUID groupID, LLVector3 delta);
public event SceneGroupMoved OnSceneGroupMove; public event SceneGroupMoved OnSceneGroupMove;
public delegate void SceneGroupGrabed(LLUUID groupID, LLVector3 offset, LLUUID userID);
public event SceneGroupGrabed OnSceneGroupGrab; public event SceneGroupGrabed OnSceneGroupGrab;
public delegate void LandObjectAdded(ILandObject newParcel);
public event LandObjectAdded OnLandObjectAdded; public event LandObjectAdded OnLandObjectAdded;
public delegate void LandObjectRemoved(LLUUID globalID);
public event LandObjectRemoved OnLandObjectRemoved; public event LandObjectRemoved OnLandObjectRemoved;
public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, LLUUID regionID);
public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
public delegate void NewGridInstantMessage(GridInstantMessage message);
public event NewGridInstantMessage OnGridInstantMessageToIMModule; public event NewGridInstantMessage OnGridInstantMessageToIMModule;
public event NewGridInstantMessage OnGridInstantMessageToFriendsModule; public event NewGridInstantMessage OnGridInstantMessageToFriendsModule;
public event NewGridInstantMessage OnGridInstantMessageToGroupsModule; public event NewGridInstantMessage OnGridInstantMessageToGroupsModule;
public delegate void ClientClosed(LLUUID clientID);
public event ClientClosed OnClientClosed; public event ClientClosed OnClientClosed;
public delegate void ScriptChangedEvent(uint localID, uint change);
public event ScriptChangedEvent OnScriptChangedEvent; public event ScriptChangedEvent OnScriptChangedEvent;
public delegate void ScriptAtTargetEvent(uint localID, uint handle, LLVector3 targetpos, LLVector3 atpos);
public event ScriptAtTargetEvent OnScriptAtTargetEvent; public event ScriptAtTargetEvent OnScriptAtTargetEvent;
public delegate void ScriptNotAtTargetEvent(uint localID);
public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent; public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
public event OnNewPresenceDelegate OnMakeChildAgent; public event OnNewPresenceDelegate OnMakeChildAgent;
public delegate void NewInventoryItemUploadComplete(LLUUID avatarID, LLUUID assetID, string name, int userlevel);
public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete; public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete;
/// <summary>
/// RegisterCapsEvent is called by Scene after the Caps object
/// has been instantiated and before it is return to the
/// client and provides region modules to add their caps.
/// </summary>
public delegate void RegisterCapsEvent(LLUUID agentID, Caps caps);
public event RegisterCapsEvent OnRegisterCaps; public event RegisterCapsEvent OnRegisterCaps;
/// <summary>
/// DeregisterCapsEvent is called by Scene when the caps
/// handler for an agent are removed.
/// </summary>
public delegate void DeregisterCapsEvent(LLUUID agentID, Caps caps);
public event DeregisterCapsEvent OnDeregisterCaps; public event DeregisterCapsEvent OnDeregisterCaps;
public class MoneyTransferArgs : EventArgs
{
public LLUUID sender;
public LLUUID receiver;
// Always false. The SL protocol sucks.
public bool authenticated = false;
public int amount;
public int transactiontype;
public string description;
public MoneyTransferArgs(LLUUID asender, LLUUID areceiver, int aamount, int atransactiontype, string adescription) {
sender = asender;
receiver = areceiver;
amount = aamount;
transactiontype = atransactiontype;
description = adescription;
}
}
public class LandBuyArgs : EventArgs
{
public LLUUID agentId = LLUUID.Zero;
public LLUUID groupId = LLUUID.Zero;
public LLUUID parcelOwnerID = LLUUID.Zero;
public bool final = false;
public bool groupOwned = false;
public bool removeContribution = false;
public int parcelLocalID = 0;
public int parcelArea = 0;
public int parcelPrice = 0;
public bool authenticated = false;
public bool landValidated = false;
public bool economyValidated = false;
public int transactionID = 0;
public int amountDebited = 0;
public LandBuyArgs(LLUUID pagentId, LLUUID pgroupId, bool pfinal, bool pgroupOwned,
bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice,
bool pauthenticated)
{
agentId = pagentId;
groupId = pgroupId;
final = pfinal;
groupOwned = pgroupOwned;
removeContribution = premoveContribution;
parcelLocalID = pparcelLocalID;
parcelArea = pparcelArea;
parcelPrice = pparcelPrice;
authenticated = pauthenticated;
}
}
public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e);
public delegate void LandBuy(Object sender, LandBuyArgs e);
public event MoneyTransferEvent OnMoneyTransfer; public event MoneyTransferEvent OnMoneyTransfer;
public event LandBuy OnLandBuy; public event LandBuy OnLandBuy;
public event LandBuy OnValidateLandBuy; public event LandBuy OnValidateLandBuy;
/* Designated Event Deletage Instances */ /* Designated Event Deletage Instances */
private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent;
private ScriptAtTargetEvent handlerScriptAtTargetEvent = null;
private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null;
private ClientMovement handlerClientMovement = null; //OnClientMovement;
private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError;
private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole;
private OnFrameDelegate handlerFrame = null; //OnFrame;
private OnNewClientDelegate handlerNewClient = null; //OnNewClient;
private OnNewPresenceDelegate handlerNewPresence = null; //OnNewPresence;
private OnRemovePresenceDelegate handlerRemovePresence = null; //OnRemovePresence;
private OnBackupDelegate handlerBackup = null; //OnBackup;
private OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = null; //OnParcelPrimCountUpdate;
private MoneyTransferEvent handlerMoneyTransfer = null; //OnMoneyTransfer;
private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd;
private OnShutdownDelegate handlerShutdown = null; //OnShutdown;
private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab;
private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab;
private NewRezScript handlerRezScript = null; //OnRezScript;
private RemoveScript handlerRemoveScript = null; //OnRemoveScript;
private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove;
private SceneGroupGrabed handlerSceneGroupGrab = null; //OnSceneGroupGrab;
private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded;
private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved;
private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel;
private NewGridInstantMessage handlerGridInstantMessageToIM = null; //OnGridInstantMessageToIMModule;
private NewGridInstantMessage handlerGridInstantMessageToFriends = null; //OnGridInstantMessageToFriendsModule;
private ClientClosed handlerClientClosed = null; //OnClientClosed;
private OnNewPresenceDelegate handlerMakeChildAgent = null; //OnMakeChildAgent;
private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick;
private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps;
private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps;
private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null;
private LandBuy handlerLandBuy = null;
private LandBuy handlerValidateLandBuy = null;
public void TriggerOnScriptChangedEvent(uint localID, uint change) public void TriggerOnScriptChangedEvent(uint localID, uint change)
{ {
handlerScriptChangedEvent = OnScriptChangedEvent; handlerScriptChangedEvent = OnScriptChangedEvent;
@ -442,6 +492,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
handlerGridInstantMessageToFriends(message); handlerGridInstantMessageToFriends(message);
} }
} }
} }
@ -489,8 +540,7 @@ namespace OpenSim.Region.Environment.Scenes
handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel); handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel);
} }
} }
public void TriggerLandBuy (Object sender, LandBuyArgs e)
public void TriggerLandBuy(Object sender, LandBuyArgs e)
{ {
handlerLandBuy = OnLandBuy; handlerLandBuy = OnLandBuy;
if (handlerLandBuy != null) if (handlerLandBuy != null)
@ -498,7 +548,6 @@ namespace OpenSim.Region.Environment.Scenes
handlerLandBuy(sender, e); handlerLandBuy(sender, e);
} }
} }
public void TriggerValidateLandBuy(Object sender, LandBuyArgs e) public void TriggerValidateLandBuy(Object sender, LandBuyArgs e)
{ {
handlerValidateLandBuy = OnValidateLandBuy; handlerValidateLandBuy = OnValidateLandBuy;
@ -525,67 +574,5 @@ namespace OpenSim.Region.Environment.Scenes
handlerScriptNotAtTargetEvent(localID); handlerScriptNotAtTargetEvent(localID);
} }
} }
#region Nested type: LandBuyArgs
public class LandBuyArgs : EventArgs
{
public LLUUID agentId = LLUUID.Zero;
public int amountDebited;
public bool authenticated;
public bool economyValidated;
public bool final;
public LLUUID groupId = LLUUID.Zero;
public bool groupOwned;
public bool landValidated;
public int parcelArea;
public int parcelLocalID;
public LLUUID parcelOwnerID = LLUUID.Zero;
public int parcelPrice;
public bool removeContribution;
public int transactionID;
public LandBuyArgs(LLUUID pagentId, LLUUID pgroupId, bool pfinal, bool pgroupOwned,
bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice,
bool pauthenticated)
{
agentId = pagentId;
groupId = pgroupId;
final = pfinal;
groupOwned = pgroupOwned;
removeContribution = premoveContribution;
parcelLocalID = pparcelLocalID;
parcelArea = pparcelArea;
parcelPrice = pparcelPrice;
authenticated = pauthenticated;
}
}
#endregion
#region Nested type: MoneyTransferArgs
public class MoneyTransferArgs : EventArgs
{
public int amount;
public bool authenticated;
public string description;
public LLUUID receiver;
public LLUUID sender;
public int transactiontype;
public MoneyTransferArgs(LLUUID asender, LLUUID areceiver, int aamount, int atransactiontype, string adescription)
{
sender = asender;
receiver = areceiver;
amount = aamount;
transactiontype = atransactiontype;
description = adescription;
}
}
#endregion
} }
} }

View File

@ -41,13 +41,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly List<Scene> m_localScenes; public event RestartSim OnRestartSim;
private Scene m_currentScene;
public SceneManager() private readonly List<Scene> m_localScenes;
{ private Scene m_currentScene = null;
m_localScenes = new List<Scene>();
}
public List<Scene> Scenes public List<Scene> Scenes
{ {
@ -74,7 +71,10 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public event RestartSim OnRestartSim; public SceneManager()
{
m_localScenes = new List<Scene>();
}
public void Close() public void Close()
{ {
@ -252,7 +252,7 @@ namespace OpenSim.Region.Environment.Scenes
public bool TrySetCurrentScene(LLUUID regionID) public bool TrySetCurrentScene(LLUUID regionID)
{ {
Console.WriteLine("Searching for Region: '{0}'", regionID); Console.WriteLine("Searching for Region: '{0}'", regionID.ToString());
foreach (Scene scene in m_localScenes) foreach (Scene scene in m_localScenes)
{ {
@ -313,7 +313,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
foreach (Scene mscene in m_localScenes) foreach (Scene mscene in m_localScenes)
{ {
if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) && if((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) &&
(mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port)) (mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port))
{ {
scene = mscene; scene = mscene;

View File

@ -49,6 +49,7 @@ namespace OpenSim.Region.Environment.Scenes
if (part != null) if (part != null)
{ {
part.StartScript(itemID); part.StartScript(itemID);
} }
else else
{ {

View File

@ -72,7 +72,7 @@ namespace OpenSim.Region.Environment.Scenes
object_rez = 4194304 object_rez = 4194304
} }
internal struct scriptPosTarget struct scriptPosTarget
{ {
public LLVector3 targetPos; public LLVector3 targetPos;
public float tolerance; public float tolerance;
@ -82,14 +82,14 @@ namespace OpenSim.Region.Environment.Scenes
public partial class SceneObjectGroup : EntityBase public partial class SceneObjectGroup : EntityBase
{ {
private readonly Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>(); private PrimCountTaintedDelegate handlerPrimCountTainted = null;
private PrimCountTaintedDelegate handlerPrimCountTainted;
/// <summary> /// <summary>
/// Signal whether the non-inventory attributes of any prims in the group have changed /// Signal whether the non-inventory attributes of any prims in the group have changed
/// since the group's last persistent backup /// since the group's last persistent backup
/// </summary> /// </summary>
public bool HasGroupChanged; public bool HasGroupChanged = false;
private LLVector3 lastPhysGroupPos; private LLVector3 lastPhysGroupPos;
@ -104,8 +104,11 @@ namespace OpenSim.Region.Environment.Scenes
protected SceneObjectPart m_rootPart; protected SceneObjectPart m_rootPart;
private Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>(); private Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>();
private bool m_scriptListens_atTarget; private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>();
private bool m_scriptListens_notAtTarget;
private bool m_scriptListens_atTarget = false;
private bool m_scriptListens_notAtTarget = false;
#region Properties #region Properties
@ -116,7 +119,7 @@ namespace OpenSim.Region.Environment.Scenes
/// think really there should be a list (or whatever) in each scenepresence /// think really there should be a list (or whatever) in each scenepresence
/// saying what prim(s) that user has selected. /// saying what prim(s) that user has selected.
/// </summary> /// </summary>
protected bool m_isSelected; protected bool m_isSelected = false;
/// <summary> /// <summary>
/// ///
@ -184,6 +187,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
return m_rootPart.GroupPosition; return m_rootPart.GroupPosition;
} }
set set
@ -511,11 +515,10 @@ namespace OpenSim.Region.Environment.Scenes
m_scene.EventManager.OnBackup += ProcessBackup; m_scene.EventManager.OnBackup += ProcessBackup;
} }
} }
public LLVector3 GroupScale() public LLVector3 GroupScale()
{ {
LLVector3 minScale = new LLVector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); LLVector3 minScale = new LLVector3(Constants.RegionSize,Constants.RegionSize,Constants.RegionSize);
LLVector3 maxScale = new LLVector3(0f, 0f, 0f); LLVector3 maxScale = new LLVector3(0f,0f,0f);
LLVector3 finalScale = new LLVector3(0.5f, 0.5f, 0.5f); LLVector3 finalScale = new LLVector3(0.5f, 0.5f, 0.5f);
lock (m_parts) lock (m_parts)
@ -538,8 +541,8 @@ namespace OpenSim.Region.Environment.Scenes
finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y; finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y;
finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z; finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z;
return finalScale; return finalScale;
}
}
public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters) public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters)
{ {
// We got a request from the inner_scene to raytrace along the Ray hRay // We got a request from the inner_scene to raytrace along the Ray hRay
@ -562,7 +565,7 @@ namespace OpenSim.Region.Environment.Scenes
// Telling the prim to raytrace. // Telling the prim to raytrace.
//EntityIntersection inter = part.TestIntersection(hRay, parentrotation); //EntityIntersection inter = part.TestIntersection(hRay, parentrotation);
EntityIntersection inter = part.TestIntersectionOBB(hRay, parentrotation, frontFacesOnly, faceCenters); EntityIntersection inter = part.TestIntersectionOBB(hRay, parentrotation,frontFacesOnly, faceCenters);
// This may need to be updated to the maximum draw distance possible.. // This may need to be updated to the maximum draw distance possible..
// We might (and probably will) be checking for prim creation from other sims // We might (and probably will) be checking for prim creation from other sims
@ -686,6 +689,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor); m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor);
m_rootPart.PhysActor = null; m_rootPart.PhysActor = null;
} }
AbsolutePosition = AttachOffset; AbsolutePosition = AttachOffset;
@ -705,28 +709,27 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.ScheduleFullUpdate(); m_rootPart.ScheduleFullUpdate();
} }
} }
public byte GetAttachmentPoint() public byte GetAttachmentPoint()
{ {
if (m_rootPart != null) if (m_rootPart != null)
{ {
return m_rootPart.Shape.State; return m_rootPart.Shape.State;
} }
return 0; return (byte)0;
} }
public void ClearPartAttachmentData() public void ClearPartAttachmentData()
{ {
foreach (SceneObjectPart part in m_parts.Values) foreach (SceneObjectPart part in m_parts.Values)
{ {
part.SetAttachmentPoint(0); part.SetAttachmentPoint((Byte)0);
} }
} }
public void DetachToGround() public void DetachToGround()
{ {
ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.m_attachedAvatar); ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.m_attachedAvatar);
LLVector3 detachedpos = new LLVector3(127f, 127f, 127f); LLVector3 detachedpos = new LLVector3(127f,127f,127f);
if (avatar != null) if (avatar != null)
{ {
detachedpos = avatar.AbsolutePosition; detachedpos = avatar.AbsolutePosition;
@ -735,14 +738,14 @@ namespace OpenSim.Region.Environment.Scenes
AbsolutePosition = detachedpos; AbsolutePosition = detachedpos;
m_rootPart.m_attachedAvatar = LLUUID.Zero; m_rootPart.m_attachedAvatar = LLUUID.Zero;
m_rootPart.SetParentLocalId(0); m_rootPart.SetParentLocalId(0);
m_rootPart.SetAttachmentPoint(0); m_rootPart.SetAttachmentPoint((byte)0);
m_rootPart.m_IsAttachment = false; m_rootPart.m_IsAttachment = false;
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
AttachToBackup(); AttachToBackup();
m_rootPart.ScheduleFullUpdate(); m_rootPart.ScheduleFullUpdate();
m_rootPart.ClearUndoState(); m_rootPart.ClearUndoState();
}
}
public void DetachToInventoryPrep() public void DetachToInventoryPrep()
{ {
ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.m_attachedAvatar); ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.m_attachedAvatar);
@ -761,8 +764,8 @@ namespace OpenSim.Region.Environment.Scenes
//m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
//AttachToBackup(); //AttachToBackup();
//m_rootPart.ScheduleFullUpdate(); //m_rootPart.ScheduleFullUpdate();
}
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -823,6 +826,7 @@ namespace OpenSim.Region.Environment.Scenes
try try
{ {
m_parts.Add(part.UUID, part); m_parts.Add(part.UUID, part);
} }
catch (Exception e) catch (Exception e)
{ {
@ -843,6 +847,7 @@ namespace OpenSim.Region.Environment.Scenes
if (part.UUID != m_rootPart.UUID) if (part.UUID != m_rootPart.UUID)
{ {
part.ParentID = m_rootPart.LocalId; part.ParentID = m_rootPart.LocalId;
} }
} }
} }
@ -855,10 +860,10 @@ namespace OpenSim.Region.Environment.Scenes
foreach (SceneObjectPart part in m_parts.Values) foreach (SceneObjectPart part in m_parts.Values)
{ {
part.UUID = LLUUID.Random(); part.UUID = LLUUID.Random();
}
}
}
}
}
}
// helper provided for parts. // helper provided for parts.
public int GetSceneMaxUndo() public int GetSceneMaxUndo()
{ {
@ -866,7 +871,6 @@ namespace OpenSim.Region.Environment.Scenes
return m_scene.MaxUndoCount; return m_scene.MaxUndoCount;
return 5; return 5;
} }
public void ResetChildPrimPhysicsPositions() public void ResetChildPrimPhysicsPositions()
{ {
AbsolutePosition = AbsolutePosition; AbsolutePosition = AbsolutePosition;
@ -893,6 +897,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
SceneObjectPart part = GetChildPart(localId); SceneObjectPart part = GetChildPart(localId);
OnGrabPart(part, offsetPos, remoteClient); OnGrabPart(part, offsetPos, remoteClient);
} }
} }
@ -900,6 +905,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
part.StoreUndoState(); part.StoreUndoState();
part.OnGrab(offsetPos, remoteClient); part.OnGrab(offsetPos, remoteClient);
} }
public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient)
@ -963,17 +969,17 @@ namespace OpenSim.Region.Environment.Scenes
public void aggregateScriptEvents() public void aggregateScriptEvents()
{ {
uint objectflagupdate = RootPart.GetEffectiveObjectFlags(); uint objectflagupdate=(uint)RootPart.GetEffectiveObjectFlags();
scriptEvents aggregateScriptEvents = 0; scriptEvents aggregateScriptEvents=0;
lock (m_parts) lock (m_parts)
{ {
foreach (SceneObjectPart part in m_parts.Values) foreach (SceneObjectPart part in m_parts.Values)
{ {
if (part == null) if(part == null)
continue; continue;
if (part != RootPart) if(part != RootPart)
part.ObjectFlags = objectflagupdate; part.ObjectFlags = objectflagupdate;
aggregateScriptEvents |= part.m_aggregateScriptEvents; aggregateScriptEvents |= part.m_aggregateScriptEvents;
} }
@ -1059,139 +1065,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
internal void SetAxisRotation(int axis, int rotate10)
{
bool setX = false;
bool setY = false;
bool setZ = false;
int xaxis = 2;
int yaxis = 4;
int zaxis = 8;
if (m_rootPart != null)
{
setX = ((axis & xaxis) != 0) ? true : false;
setY = ((axis & yaxis) != 0) ? true : false;
setZ = ((axis & zaxis) != 0) ? true : false;
float setval = (rotate10 > 0) ? 1f : 0f;
if (setX)
m_rootPart.m_rotationAxis.X = setval;
if (setY)
m_rootPart.m_rotationAxis.Y = setval;
if (setZ)
m_rootPart.m_rotationAxis.Z = setval;
if (setX || setY || setZ)
{
m_rootPart.SetPhysicsAxisRotation();
}
}
}
public int registerTargetWaypoint(LLVector3 target, float tolerance)
{
scriptPosTarget waypoint = new scriptPosTarget();
waypoint.targetPos = target;
waypoint.tolerance = tolerance;
uint handle = m_scene.PrimIDAllocate();
lock (m_targets)
{
m_targets.Add(handle, waypoint);
}
return (int) handle;
}
public void unregisterTargetWaypoint(int handle)
{
lock (m_targets)
{
if (m_targets.ContainsKey((uint) handle))
m_targets.Remove((uint) handle);
}
}
private void checkAtTargets()
{
if (m_scriptListens_atTarget || m_scriptListens_notAtTarget)
{
if (m_targets.Count > 0)
{
bool at_target = false;
//LLVector3 targetPos;
//uint targetHandle;
Dictionary<uint, scriptPosTarget> atTargets = new Dictionary<uint, scriptPosTarget>();
lock (m_targets)
{
foreach (uint idx in m_targets.Keys)
{
scriptPosTarget target = m_targets[idx];
if (Util.GetDistanceTo(target.targetPos, m_rootPart.GroupPosition) <= target.tolerance)
{
// trigger at_target
if (m_scriptListens_atTarget)
{
// Reusing att.tolerance to hold the index of the target in the targets dictionary
// to avoid deadlocking the sim.
at_target = true;
scriptPosTarget att = new scriptPosTarget();
att.targetPos = target.targetPos;
att.tolerance = idx;
atTargets.Add(idx, att);
}
}
}
}
if (atTargets.Count > 0)
{
uint[] localids = new uint[0];
lock (m_parts)
{
localids = new uint[m_parts.Count];
int cntr = 0;
foreach (SceneObjectPart part in m_parts.Values)
{
localids[cntr] = part.LocalId;
cntr++;
}
}
for (int ctr = 0; ctr < localids.Length; ctr++)
{
foreach (uint target in atTargets.Keys)
{
scriptPosTarget att = atTargets[target];
// Reusing att.tolerance to hold the index of the target in the targets dictionary
// to avoid deadlocking the sim.
m_scene.TriggerAtTargetEvent(localids[ctr], (uint) att.tolerance, att.targetPos, m_rootPart.GroupPosition);
}
}
return;
}
if (m_scriptListens_notAtTarget && !at_target)
{
//trigger not_at_target
uint[] localids = new uint[0];
lock (m_parts)
{
localids = new uint[m_parts.Count];
int cntr = 0;
foreach (SceneObjectPart part in m_parts.Values)
{
localids[cntr] = part.LocalId;
cntr++;
}
}
for (int ctr = 0; ctr < localids.Length; ctr++)
{
m_scene.TriggerNotAtTargetEvent(localids[ctr]);
}
}
}
}
}
#region Events #region Events
/// <summary> /// <summary>
@ -1491,6 +1364,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
SetPartAsNonRoot(newPart); SetPartAsNonRoot(newPart);
} }
/// <summary> /// <summary>
@ -1560,6 +1434,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public override void Update() public override void Update()
{ {
lock (m_parts) lock (m_parts)
{ {
//if (m_rootPart.m_IsAttachment) //if (m_rootPart.m_IsAttachment)
@ -1582,6 +1457,7 @@ namespace OpenSim.Region.Environment.Scenes
//} //}
checkAtTargets(); checkAtTargets();
@ -2515,5 +2391,140 @@ namespace OpenSim.Region.Environment.Scenes
} }
#endregion #endregion
internal void SetAxisRotation(int axis, int rotate10)
{
bool setX = false;
bool setY = false;
bool setZ = false;
int xaxis = 2;
int yaxis = 4;
int zaxis = 8;
if (m_rootPart != null)
{
setX = ((axis & xaxis) != 0) ? true : false;
setY = ((axis & yaxis) != 0) ? true : false;
setZ = ((axis & zaxis) != 0) ? true : false;
float setval = (rotate10 > 0) ? 1f : 0f;
if (setX)
m_rootPart.m_rotationAxis.X = setval;
if (setY)
m_rootPart.m_rotationAxis.Y = setval;
if (setZ)
m_rootPart.m_rotationAxis.Z = setval;
if (setX || setY || setZ)
{
m_rootPart.SetPhysicsAxisRotation();
}
}
}
public int registerTargetWaypoint(LLVector3 target, float tolerance)
{
scriptPosTarget waypoint = new scriptPosTarget();
waypoint.targetPos = target;
waypoint.tolerance = tolerance;
uint handle = m_scene.PrimIDAllocate();
lock (m_targets)
{
m_targets.Add(handle, waypoint);
}
return (int)handle;
}
public void unregisterTargetWaypoint(int handle)
{
lock (m_targets)
{
if (m_targets.ContainsKey((uint)handle))
m_targets.Remove((uint)handle);
}
}
private void checkAtTargets()
{
if (m_scriptListens_atTarget || m_scriptListens_notAtTarget)
{
if (m_targets.Count > 0)
{
bool at_target = false;
//LLVector3 targetPos;
//uint targetHandle;
Dictionary<uint, scriptPosTarget> atTargets = new Dictionary<uint, scriptPosTarget>();
lock (m_targets)
{
foreach (uint idx in m_targets.Keys)
{
scriptPosTarget target = m_targets[idx];
if (Util.GetDistanceTo(target.targetPos, m_rootPart.GroupPosition) <= target.tolerance)
{
// trigger at_target
if (m_scriptListens_atTarget)
{
// Reusing att.tolerance to hold the index of the target in the targets dictionary
// to avoid deadlocking the sim.
at_target = true;
scriptPosTarget att = new scriptPosTarget();
att.targetPos = target.targetPos;
att.tolerance = (float)idx;
atTargets.Add(idx, att);
}
}
}
}
if (atTargets.Count > 0)
{
uint[] localids = new uint[0];
lock (m_parts)
{
localids = new uint[m_parts.Count];
int cntr = 0;
foreach (SceneObjectPart part in m_parts.Values)
{
localids[cntr] = part.LocalId;
cntr++;
}
}
for (int ctr = 0; ctr < localids.Length; ctr++)
{
foreach (uint target in atTargets.Keys)
{
scriptPosTarget att = atTargets[target];
// Reusing att.tolerance to hold the index of the target in the targets dictionary
// to avoid deadlocking the sim.
m_scene.TriggerAtTargetEvent(localids[ctr], (uint)att.tolerance, att.targetPos, m_rootPart.GroupPosition);
}
}
return;
}
if (m_scriptListens_notAtTarget && !at_target)
{
//trigger not_at_target
uint[] localids = new uint[0];
lock (m_parts)
{
localids = new uint[m_parts.Count];
int cntr = 0;
foreach (SceneObjectPart part in m_parts.Values)
{
localids[cntr] = part.LocalId;
cntr++;
}
}
for (int ctr = 0; ctr < localids.Length; ctr++)
{
m_scene.TriggerNotAtTargetEvent(localids[ctr]);
}
}
}
}
}
} }
} }

View File

@ -41,29 +41,13 @@ namespace OpenSim.Region.Environment.Scenes
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly string m_inventoryFileName = String.Empty; private string m_inventoryFileName = String.Empty;
/// <summary>
/// Tracks whether inventory has changed since the last persistent backup
/// </summary>
private bool HasInventoryChanged;
/// <summary> /// <summary>
/// The inventory folder for this prim /// The inventory folder for this prim
/// </summary> /// </summary>
private LLUUID m_folderID = LLUUID.Zero; private LLUUID m_folderID = LLUUID.Zero;
/// <summary>
/// Serial count for inventory file , used to tell if inventory has changed
/// no need for this to be part of Database backup
/// </summary>
protected uint m_inventorySerial;
/// <summary>
/// Holds in memory prim inventory
/// </summary>
protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary();
/// <summary> /// <summary>
/// Exposing this is not particularly good, but it's one of the least evils at the moment to see /// Exposing this is not particularly good, but it's one of the least evils at the moment to see
/// folder id from prim inventory item data, since it's not (yet) actually stored with the prim. /// folder id from prim inventory item data, since it's not (yet) actually stored with the prim.
@ -74,18 +58,34 @@ namespace OpenSim.Region.Environment.Scenes
set { m_folderID = value; } set { m_folderID = value; }
} }
/// <summary>
/// Serial count for inventory file , used to tell if inventory has changed
/// no need for this to be part of Database backup
/// </summary>
protected uint m_inventorySerial = 0;
public uint InventorySerial public uint InventorySerial
{ {
get { return m_inventorySerial; } get { return m_inventorySerial; }
set { m_inventorySerial = value; } set { m_inventorySerial = value; }
} }
/// <summary>
/// Holds in memory prim inventory
/// </summary>
protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary();
public TaskInventoryDictionary TaskInventory public TaskInventoryDictionary TaskInventory
{ {
get { return m_taskInventory; } get { return m_taskInventory; }
set { m_taskInventory = value; } set { m_taskInventory = value; }
} }
/// <summary>
/// Tracks whether inventory has changed since the last persistent backup
/// </summary>
private bool HasInventoryChanged;
/// <summary> /// <summary>
/// Reset LLUUIDs for all the items in the prim's inventory. This involves either generating /// Reset LLUUIDs for all the items in the prim's inventory. This involves either generating
/// new ones or setting existing UUIDs to the correct parent UUIDs. /// new ones or setting existing UUIDs to the correct parent UUIDs.
@ -133,8 +133,8 @@ namespace OpenSim.Region.Environment.Scenes
{ {
item.LastOwnerID = item.OwnerID; item.LastOwnerID = item.OwnerID;
item.OwnerID = ownerId; item.OwnerID = ownerId;
item.BaseMask = item.NextOwnerMask & (uint) PermissionMask.All; item.BaseMask = item.NextOwnerMask & (uint)PermissionMask.All;
item.OwnerMask = item.NextOwnerMask & (uint) PermissionMask.All; item.OwnerMask = item.NextOwnerMask & (uint)PermissionMask.All;
} }
} }
} }
@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Scenes
else else
{ {
string script = Helpers.FieldToUTF8String(asset.Data); string script = Helpers.FieldToUTF8String(asset.Data);
m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId, item.ItemID, script); m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId,item.ItemID,script);
m_parentGroup.AddActiveScriptCount(1); m_parentGroup.AddActiveScriptCount(1);
ScheduleFullUpdate(); ScheduleFullUpdate();
} }
@ -226,6 +226,7 @@ namespace OpenSim.Region.Environment.Scenes
if (m_taskInventory.ContainsKey(itemId)) if (m_taskInventory.ContainsKey(itemId))
{ {
StartScript(m_taskInventory[itemId]); StartScript(m_taskInventory[itemId]);
} }
else else
{ {
@ -262,7 +263,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
foreach (TaskInventoryItem item in m_taskInventory.Values) foreach (TaskInventoryItem item in m_taskInventory.Values)
{ {
if (item.Name == name) if(item.Name == name)
return true; return true;
} }
return false; return false;
@ -270,14 +271,14 @@ namespace OpenSim.Region.Environment.Scenes
private string FindAvailableInventoryName(string name) private string FindAvailableInventoryName(string name)
{ {
if (!InventoryContainsName(name)) if(!InventoryContainsName(name))
return name; return name;
int suffix = 1; int suffix=1;
while (suffix < 256) while(suffix < 256)
{ {
string tryName = String.Format("{0} {1}", name, suffix); string tryName=String.Format("{0} {1}", name, suffix);
if (!InventoryContainsName(tryName)) if(!InventoryContainsName(tryName))
return tryName; return tryName;
suffix++; suffix++;
} }
@ -294,11 +295,11 @@ namespace OpenSim.Region.Environment.Scenes
item.CreationDate = 1000; item.CreationDate = 1000;
item.ParentPartID = UUID; item.ParentPartID = UUID;
string name = FindAvailableInventoryName(item.Name); string name=FindAvailableInventoryName(item.Name);
if (name == String.Empty) if(name == String.Empty)
return; return;
item.Name = name; item.Name=name;
lock (m_taskInventory) lock (m_taskInventory)
{ {
@ -427,6 +428,7 @@ namespace OpenSim.Region.Environment.Scenes
scriptcount++; scriptcount++;
} }
} }
} }
if (scriptcount <= 0) if (scriptcount <= 0)
{ {
@ -462,7 +464,7 @@ namespace OpenSim.Region.Environment.Scenes
if (m_inventorySerial > 0) if (m_inventorySerial > 0)
{ {
client.SendTaskInventory(m_uuid, (short) m_inventorySerial, client.SendTaskInventory(m_uuid, (short)m_inventorySerial,
Helpers.StringToField(m_inventoryFileName)); Helpers.StringToField(m_inventoryFileName));
return true; return true;
} }
@ -569,8 +571,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
#region Nested type: InventoryStringBuilder
public class InventoryStringBuilder public class InventoryStringBuilder
{ {
public string BuildString = String.Empty; public string BuildString = String.Empty;
@ -629,7 +629,5 @@ namespace OpenSim.Region.Environment.Scenes
{ {
} }
} }
#endregion
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -39,8 +39,8 @@ namespace OpenSim.Region.Environment.Scenes
public class SceneXmlLoader // can move to a module? public class SceneXmlLoader // can move to a module?
{ {
protected InnerScene m_innerScene; protected InnerScene m_innerScene;
protected Scene m_parentScene;
protected RegionInfo m_regInfo; protected RegionInfo m_regInfo;
protected Scene m_parentScene;
public SceneXmlLoader(Scene parentScene, InnerScene innerScene, RegionInfo regionInfo) public SceneXmlLoader(Scene parentScene, InnerScene innerScene, RegionInfo regionInfo)
{ {
@ -136,6 +136,7 @@ namespace OpenSim.Region.Environment.Scenes
returnstring += grp.ToXmlString2(); returnstring += grp.ToXmlString2();
returnstring += "</scene>\n"; returnstring += "</scene>\n";
return returnstring; return returnstring;
} }
public void LoadGroupFromXml2String(string xmlString) public void LoadGroupFromXml2String(string xmlString)
@ -152,6 +153,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
CreatePrimFromXml(aPrimNode.OuterXml); CreatePrimFromXml(aPrimNode.OuterXml);
} }
} }
public void LoadPrimsFromXml2(string fileName) public void LoadPrimsFromXml2(string fileName)

View File

@ -33,9 +33,7 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
public class NullScriptHost : IScriptHost public class NullScriptHost : IScriptHost
{ {
private readonly LLVector3 m_pos = new LLVector3(128, 128, 30); private LLVector3 m_pos = new LLVector3(128, 128, 30);
#region IScriptHost Members
public string Name public string Name
{ {
@ -85,7 +83,5 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text);
} }
#endregion
} }
} }

View File

@ -51,7 +51,7 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
m_log.Error("[ScriptEngine]: " + m_log.Error("[ScriptEngine]: " +
"Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
e.StackTrace); e.StackTrace.ToString());
} }
return ret; return ret;
} }

View File

@ -34,68 +34,105 @@ namespace OpenSim.Region.Environment.Scenes
{ {
public class SimStatsReporter public class SimStatsReporter
{ {
#region Delegates
public delegate void SendStatResult(SimStatsPacket pack); public delegate void SendStatResult(SimStatsPacket pack);
#endregion public event SendStatResult OnSendStatsResult;
private readonly Timer m_report = new Timer(); private SendStatResult handlerSendStatResult = null;
private readonly SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
private readonly RegionInfo ReportingRegion;
private readonly SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21];
private readonly SimStatsPacket statpack = (SimStatsPacket) PacketPool.Instance.GetPacket(PacketType.SimStats);
private SendStatResult handlerSendStatResult; private enum Stats : uint
private int m_activePrim; {
private int m_activeScripts; TimeDilation = 0,
private int m_agentMS; SimFPS = 1,
PhysicsFPS = 2,
AgentUpdates = 3,
FrameMS = 4,
NetMS = 5,
OtherMS = 6,
PhysicsMS = 7,
AgentMS = 8,
ImageMS = 9,
ScriptMS = 10,
TotalPrim = 11,
ActivePrim = 12,
Agents = 13,
ChildAgents = 14,
ActiveScripts = 15,
ScriptLinesPerSecond = 16,
InPacketsPerSecond = 17,
OutPacketsPerSecond = 18,
PendingDownloads = 19,
PendingUploads = 20,
UnAckedBytes = 24,
private int m_agentUpdates; // Havok4 related... May or may not be in upcoming LLclients
private int m_childAgents; // (kelly added them sometime late in January 2008)
private int m_fps; NumRCCSLODReduced = 25,
NumRCCSFixed = 26
}
private int m_frameMS; // Sending a stats update every 3 seconds
private int m_imageMS; private int statsUpdatesEveryMS = 3000;
private int m_inPacketsPerSecond; private float statsUpdateFactor = 0;
private int m_netMS; private float m_timeDilation = 0;
private int m_numPrim; private int m_fps = 0;
private int m_otherMS; private float m_pfps = 0;
private int m_outPacketsPerSecond; private int m_agentUpdates = 0;
private int m_pendingDownloads;
private int m_pendingUploads; private int m_frameMS = 0;
private float m_pfps; private int m_netMS = 0;
private int m_physicsMS; private int m_agentMS = 0;
private int m_rootAgents; private int m_physicsMS = 0;
private int m_scriptLinesPerSecond; private int m_imageMS = 0;
private float m_timeDilation; private int m_otherMS = 0;
private int m_unAckedBytes;
//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed.
//Ckrinke private int m_scriptMS = 0;
private int m_rootAgents = 0;
private int m_childAgents = 0;
private int m_numPrim = 0;
private int m_inPacketsPerSecond = 0;
private int m_outPacketsPerSecond = 0;
private int m_activePrim = 0;
private int m_unAckedBytes = 0;
private int m_pendingDownloads = 0;
private int m_pendingUploads = 0;
private int m_activeScripts = 0;
private int m_scriptLinesPerSecond = 0;
private int objectCapacity = 45000; private int objectCapacity = 45000;
private float statsUpdateFactor;
private int statsUpdatesEveryMS = 3000;
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21];
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
SimStatsPacket statpack = (SimStatsPacket)PacketPool.Instance.GetPacket(PacketType.SimStats);
private RegionInfo ReportingRegion;
private Timer m_report = new Timer();
public SimStatsReporter(RegionInfo regionData) public SimStatsReporter(RegionInfo regionData)
{ {
statsUpdateFactor = (statsUpdatesEveryMS / 1000);
statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
ReportingRegion = regionData; ReportingRegion = regionData;
for (int i = 0; i < 21; i++) for (int i = 0; i<21;i++)
{ {
sb[i] = new SimStatsPacket.StatBlock(); sb[i] = new SimStatsPacket.StatBlock();
} }
m_report.AutoReset = true; m_report.AutoReset = true;
m_report.Interval = statsUpdatesEveryMS; m_report.Interval = statsUpdatesEveryMS;
m_report.Elapsed += statsHeartBeat; m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat);
m_report.Enabled = true; m_report.Enabled = true;
} }
public event SendStatResult OnSendStatsResult;
public void SetUpdateMS(int ms) public void SetUpdateMS(int ms)
{ {
statsUpdatesEveryMS = ms; statsUpdatesEveryMS = ms;
statsUpdateFactor = (statsUpdatesEveryMS / 1000); statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
m_report.Interval = statsUpdatesEveryMS; m_report.Interval = statsUpdatesEveryMS;
} }
@ -117,15 +154,15 @@ namespace OpenSim.Region.Environment.Scenes
} }
catch (Exception) catch (Exception)
{ {
statpack.Region.RegionFlags = 0; statpack.Region.RegionFlags = (uint) 0;
} }
statpack.Region.ObjectCapacity = (uint) objectCapacity; statpack.Region.ObjectCapacity = (uint) objectCapacity;
#region various statistic googly moogly #region various statistic googly moogly
// Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there // Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there
// 0-50 is pretty close to 0-45 // 0-50 is pretty close to 0-45
float simfps = ((m_fps * 5)); float simfps = (int) ((m_fps * 5));
//if (simfps > 45) //if (simfps > 45)
//simfps = simfps - (simfps - 45); //simfps = simfps - (simfps - 45);
@ -141,7 +178,7 @@ namespace OpenSim.Region.Environment.Scenes
if (physfps < 0) if (physfps < 0)
physfps = 0; physfps = 0;
#endregion #endregion
//Our time dilation is 0.91 when we're running a full speed, //Our time dilation is 0.91 when we're running a full speed,
// therefore to make sure we get an appropriate range, // therefore to make sure we get an appropriate range,
@ -151,10 +188,10 @@ namespace OpenSim.Region.Environment.Scenes
// Then we divide the whole amount by the amount of seconds pass in between stats updates. // Then we divide the whole amount by the amount of seconds pass in between stats updates.
sb[0].StatID = (uint) Stats.TimeDilation; sb[0].StatID = (uint) Stats.TimeDilation;
sb[0].StatValue = m_timeDilation; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); sb[0].StatValue = m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
sb[1].StatID = (uint) Stats.SimFPS; sb[1].StatID = (uint) Stats.SimFPS;
sb[1].StatValue = simfps / statsUpdateFactor; sb[1].StatValue = simfps/statsUpdateFactor;
sb[2].StatID = (uint) Stats.PhysicsFPS; sb[2].StatID = (uint) Stats.PhysicsFPS;
sb[2].StatValue = physfps / statsUpdateFactor; sb[2].StatValue = physfps / statsUpdateFactor;
@ -174,43 +211,43 @@ namespace OpenSim.Region.Environment.Scenes
sb[7].StatID = (uint) Stats.ActivePrim; sb[7].StatID = (uint) Stats.ActivePrim;
sb[7].StatValue = m_activePrim; sb[7].StatValue = m_activePrim;
sb[8].StatID = (uint) Stats.FrameMS; sb[8].StatID = (uint)Stats.FrameMS;
sb[8].StatValue = m_frameMS / statsUpdateFactor; sb[8].StatValue = m_frameMS / statsUpdateFactor;
sb[9].StatID = (uint) Stats.NetMS; sb[9].StatID = (uint)Stats.NetMS;
sb[9].StatValue = m_netMS / statsUpdateFactor; sb[9].StatValue = m_netMS / statsUpdateFactor;
sb[10].StatID = (uint) Stats.PhysicsMS; sb[10].StatID = (uint)Stats.PhysicsMS;
sb[10].StatValue = m_physicsMS / statsUpdateFactor; sb[10].StatValue = m_physicsMS / statsUpdateFactor;
sb[11].StatID = (uint) Stats.ImageMS; sb[11].StatID = (uint)Stats.ImageMS ;
sb[11].StatValue = m_imageMS / statsUpdateFactor; sb[11].StatValue = m_imageMS / statsUpdateFactor;
sb[12].StatID = (uint) Stats.OtherMS; sb[12].StatID = (uint)Stats.OtherMS;
sb[12].StatValue = m_otherMS / statsUpdateFactor; sb[12].StatValue = m_otherMS / statsUpdateFactor;
sb[13].StatID = (uint) Stats.InPacketsPerSecond; sb[13].StatID = (uint)Stats.InPacketsPerSecond;
sb[13].StatValue = (m_inPacketsPerSecond); sb[13].StatValue = (m_inPacketsPerSecond);
sb[14].StatID = (uint) Stats.OutPacketsPerSecond; sb[14].StatID = (uint)Stats.OutPacketsPerSecond;
sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor); sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor);
sb[15].StatID = (uint) Stats.UnAckedBytes; sb[15].StatID = (uint)Stats.UnAckedBytes;
sb[15].StatValue = m_unAckedBytes; sb[15].StatValue = m_unAckedBytes;
sb[16].StatID = (uint) Stats.AgentMS; sb[16].StatID = (uint)Stats.AgentMS;
sb[16].StatValue = m_agentMS / statsUpdateFactor; sb[16].StatValue = m_agentMS / statsUpdateFactor;
sb[17].StatID = (uint) Stats.PendingDownloads; sb[17].StatID = (uint)Stats.PendingDownloads;
sb[17].StatValue = m_pendingDownloads; sb[17].StatValue = m_pendingDownloads;
sb[18].StatID = (uint) Stats.PendingUploads; sb[18].StatID = (uint)Stats.PendingUploads;
sb[18].StatValue = m_pendingUploads; sb[18].StatValue = m_pendingUploads;
sb[19].StatID = (uint) Stats.ActiveScripts; sb[19].StatID = (uint)Stats.ActiveScripts;
sb[19].StatValue = m_activeScripts; sb[19].StatValue = m_activeScripts;
sb[20].StatID = (uint) Stats.ScriptLinesPerSecond; sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
statpack.Stat = sb; statpack.Stat = sb;
@ -247,7 +284,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
# region methods called from Scene # region methods called from Scene
// The majority of these functions are additive // The majority of these functions are additive
// so that you can easily change the amount of // so that you can easily change the amount of
// seconds in between sim stats updates // seconds in between sim stats updates
@ -317,27 +353,22 @@ namespace OpenSim.Region.Environment.Scenes
{ {
m_frameMS += ms; m_frameMS += ms;
} }
public void addNetMS(int ms) public void addNetMS(int ms)
{ {
m_netMS += ms; m_netMS += ms;
} }
public void addAgentMS(int ms) public void addAgentMS(int ms)
{ {
m_agentMS += ms; m_agentMS += ms;
} }
public void addPhysicsMS(int ms) public void addPhysicsMS(int ms)
{ {
m_physicsMS += ms; m_physicsMS += ms;
} }
public void addImageMS(int ms) public void addImageMS(int ms)
{ {
m_imageMS += ms; m_imageMS += ms;
} }
public void addOtherMS(int ms) public void addOtherMS(int ms)
{ {
m_otherMS += ms; m_otherMS += ms;
@ -368,40 +399,5 @@ namespace OpenSim.Region.Environment.Scenes
} }
#endregion #endregion
#region Nested type: Stats
private enum Stats : uint
{
TimeDilation = 0,
SimFPS = 1,
PhysicsFPS = 2,
AgentUpdates = 3,
FrameMS = 4,
NetMS = 5,
OtherMS = 6,
PhysicsMS = 7,
AgentMS = 8,
ImageMS = 9,
ScriptMS = 10,
TotalPrim = 11,
ActivePrim = 12,
Agents = 13,
ChildAgents = 14,
ActiveScripts = 15,
ScriptLinesPerSecond = 16,
InPacketsPerSecond = 17,
OutPacketsPerSecond = 18,
PendingDownloads = 19,
PendingUploads = 20,
UnAckedBytes = 24,
// Havok4 related... May or may not be in upcoming LLclients
// (kelly added them sometime late in January 2008)
NumRCCSLODReduced = 25,
NumRCCSFixed = 26
}
#endregion
} }
} }

View File

@ -32,8 +32,8 @@ namespace OpenSim.Region.Environment.Scenes
public class UndoState public class UndoState
{ {
public LLVector3 Position = LLVector3.Zero; public LLVector3 Position = LLVector3.Zero;
public LLQuaternion Rotation = LLQuaternion.Identity;
public LLVector3 Scale = LLVector3.Zero; public LLVector3 Scale = LLVector3.Zero;
public LLQuaternion Rotation = LLQuaternion.Identity;
public UndoState(LLVector3 pos, LLQuaternion rot, LLVector3 scale) public UndoState(LLVector3 pos, LLQuaternion rot, LLVector3 scale)
{ {
@ -50,18 +50,16 @@ namespace OpenSim.Region.Environment.Scenes
{ {
Position = part.AbsolutePosition; Position = part.AbsolutePosition;
Rotation = part.RotationOffset; Rotation = part.RotationOffset;
} }
else else
{ {
Position = part.GroupPosition; Position = part.GroupPosition;
Rotation = part.RotationOffset; Rotation = part.RotationOffset;
Scale = part.Shape.Scale; Scale = part.Shape.Scale;
}
}
}
public UndoState() }
{ }
} }
public bool Compare(SceneObjectPart part) public bool Compare(SceneObjectPart part)
@ -81,6 +79,7 @@ namespace OpenSim.Region.Environment.Scenes
return true; return true;
else else
return false; return false;
} }
} }
return false; return false;
@ -106,7 +105,12 @@ namespace OpenSim.Region.Environment.Scenes
part.ScheduleTerseUpdate(); part.ScheduleTerseUpdate();
} }
part.m_undoing = false; part.m_undoing = false;
} }
} }
public UndoState()
{
}
} }
} }

View File

@ -36,7 +36,12 @@ namespace OpenSim.Region.Environment
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly IRegionDataStore m_dataStore; private IRegionDataStore m_dataStore;
public IRegionDataStore DataStore
{
get { return m_dataStore; }
}
public StorageManager(IRegionDataStore storage) public StorageManager(IRegionDataStore storage)
{ {
@ -69,10 +74,5 @@ namespace OpenSim.Region.Environment
//TODO: Add checking and warning to make sure it initialised. //TODO: Add checking and warning to make sure it initialised.
} }
public IRegionDataStore DataStore
{
get { return m_dataStore; }
}
} }
} }

View File

@ -33,15 +33,16 @@ namespace OpenSim.Region.Environment.Types
{ {
public class BasicQuadTreeNode public class BasicQuadTreeNode
{ {
private readonly short m_height; private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>();
private readonly short m_leftX; private BasicQuadTreeNode[] m_childNodes = null;
private readonly short m_leftY; private BasicQuadTreeNode m_parent = null;
private readonly List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>();
private readonly BasicQuadTreeNode m_parent; private short m_leftX;
private short m_leftY;
private short m_width;
private short m_height;
//private int m_quadNumber; //private int m_quadNumber;
private readonly string m_quadID; private string m_quadID;
private readonly short m_width;
private BasicQuadTreeNode[] m_childNodes;
public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width,
short height) short height)
@ -66,9 +67,9 @@ namespace OpenSim.Region.Environment.Types
} }
else else
{ {
if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) if (obj.AbsolutePosition.X < (m_leftX + (m_width/2)))
{ {
if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
{ {
m_childNodes[0].AddObject(obj); m_childNodes[0].AddObject(obj);
} }
@ -79,7 +80,7 @@ namespace OpenSim.Region.Environment.Types
} }
else else
{ {
if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
{ {
m_childNodes[1].AddObject(obj); m_childNodes[1].AddObject(obj);
} }
@ -97,17 +98,17 @@ namespace OpenSim.Region.Environment.Types
{ {
m_childNodes = new BasicQuadTreeNode[4]; m_childNodes = new BasicQuadTreeNode[4];
m_childNodes[0] = m_childNodes[0] =
new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short) (m_width / 2), new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short) (m_width/2),
(short) (m_height / 2)); (short) (m_height/2));
m_childNodes[1] = m_childNodes[1] =
new BasicQuadTreeNode(this, m_quadID + "2/", (short) (m_leftX + (m_width / 2)), m_leftY, new BasicQuadTreeNode(this, m_quadID + "2/", (short) (m_leftX + (m_width/2)), m_leftY,
(short) (m_width / 2), (short) (m_height / 2)); (short) (m_width/2), (short) (m_height/2));
m_childNodes[2] = m_childNodes[2] =
new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short) (m_leftY + (m_height / 2)), new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short) (m_leftY + (m_height/2)),
(short) (m_width / 2), (short) (m_height / 2)); (short) (m_width/2), (short) (m_height/2));
m_childNodes[3] = m_childNodes[3] =
new BasicQuadTreeNode(this, m_quadID + "4/", (short) (m_leftX + (m_width / 2)), new BasicQuadTreeNode(this, m_quadID + "4/", (short) (m_leftX + (m_width/2)),
(short) (m_height + (m_height / 2)), (short) (m_width / 2), (short) (m_height / 2)); (short) (m_height + (m_height/2)), (short) (m_width/2), (short) (m_height/2));
} }
else else
{ {
@ -126,9 +127,9 @@ namespace OpenSim.Region.Environment.Types
} }
else else
{ {
if (x < m_leftX + (m_width / 2)) if (x < m_leftX + (m_width/2))
{ {
if (y < m_leftY + (m_height / 2)) if (y < m_leftY + (m_height/2))
{ {
return m_childNodes[0].GetObjectsFrom(x, y); return m_childNodes[0].GetObjectsFrom(x, y);
} }
@ -139,7 +140,7 @@ namespace OpenSim.Region.Environment.Types
} }
else else
{ {
if (y < m_leftY + (m_height / 2)) if (y < m_leftY + (m_height/2))
{ {
return m_childNodes[1].GetObjectsFrom(x, y); return m_childNodes[1].GetObjectsFrom(x, y);
} }
@ -180,9 +181,9 @@ namespace OpenSim.Region.Environment.Types
} }
else else
{ {
if (x < m_leftX + (m_width / 2)) if (x < m_leftX + (m_width/2))
{ {
if (y < m_leftY + (m_height / 2)) if (y < m_leftY + (m_height/2))
{ {
return m_childNodes[0].GetNodeID(x, y); return m_childNodes[0].GetNodeID(x, y);
} }
@ -193,7 +194,7 @@ namespace OpenSim.Region.Environment.Types
} }
else else
{ {
if (y < m_leftY + (m_height / 2)) if (y < m_leftY + (m_height/2))
{ {
return m_childNodes[1].GetNodeID(x, y); return m_childNodes[1].GetNodeID(x, y);
} }

View File

@ -37,67 +37,23 @@ namespace OpenSim.Region.Environment.Types
[Serializable] [Serializable]
public class UpdateQueue : ISerializable public class UpdateQueue : ISerializable
{ {
private readonly List<LLUUID> m_ids; private Queue<SceneObjectPart> m_queue;
private readonly Queue<SceneObjectPart> m_queue;
private readonly object m_syncObject = new object(); private List<LLUUID> m_ids;
public UpdateQueue() private object m_syncObject = new object();
{
m_queue = new Queue<SceneObjectPart>();
m_ids = new List<LLUUID>();
}
protected UpdateQueue(SerializationInfo info, StreamingContext context)
{
//System.Console.WriteLine("UpdateQueue Deserialize BGN");
if (info == null)
{
throw new ArgumentNullException("info");
}
m_queue = (Queue<SceneObjectPart>) info.GetValue("m_queue", typeof (Queue<SceneObjectPart>));
List<Guid> ids_work = (List<Guid>) info.GetValue("m_ids", typeof (List<Guid>));
foreach (Guid guid in ids_work)
{
m_ids.Add(new LLUUID(guid));
}
//System.Console.WriteLine("UpdateQueue Deserialize END");
}
public int Count public int Count
{ {
get { return m_queue.Count; } get { return m_queue.Count; }
} }
#region ISerializable Members public UpdateQueue()
[SecurityPermission(SecurityAction.LinkDemand,
Flags = SecurityPermissionFlag.SerializationFormatter)]
public virtual void GetObjectData(
SerializationInfo info, StreamingContext context)
{ {
if (info == null) m_queue = new Queue<SceneObjectPart>();
{ m_ids = new List<LLUUID>();
throw new ArgumentNullException("info");
} }
List<Guid> ids_work = new List<Guid>();
foreach (LLUUID uuid in m_ids)
{
ids_work.Add(uuid.UUID);
}
info.AddValue("m_queue", m_queue);
info.AddValue("m_ids", ids_work);
}
#endregion
public void Clear() public void Clear()
{ {
lock (m_syncObject) lock (m_syncObject)
@ -133,5 +89,46 @@ namespace OpenSim.Region.Environment.Types
return part; return part;
} }
protected UpdateQueue(SerializationInfo info, StreamingContext context)
{
//System.Console.WriteLine("UpdateQueue Deserialize BGN");
if (info == null)
{
throw new ArgumentNullException("info");
}
m_queue = (Queue<SceneObjectPart>)info.GetValue("m_queue", typeof(Queue<SceneObjectPart>));
List<Guid> ids_work = (List<Guid>)info.GetValue("m_ids", typeof(List<Guid>));
foreach (Guid guid in ids_work)
{
m_ids.Add(new LLUUID(guid));
}
//System.Console.WriteLine("UpdateQueue Deserialize END");
}
[SecurityPermission(SecurityAction.LinkDemand,
Flags = SecurityPermissionFlag.SerializationFormatter)]
public virtual void GetObjectData(
SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
List<Guid> ids_work = new List<Guid>();
foreach (LLUUID uuid in m_ids)
{
ids_work.Add(uuid.UUID);
}
info.AddValue("m_queue", m_queue);
info.AddValue("m_ids", ids_work);
}
} }
} }

View File

@ -52,12 +52,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
public class LoadBalancerPlugin : IApplicationPlugin public class LoadBalancerPlugin : IApplicationPlugin
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly object padlock = new object();
private BaseHttpServer commandServer; private BaseHttpServer commandServer;
private bool[] isLocalNeighbour; private bool[] isLocalNeighbour;
private bool isSplit; private bool isSplit = false;
private TcpServer mTcpServer; private TcpServer mTcpServer;
private object padlock = new object();
private int proxyOffset; private int proxyOffset;
private string proxyURL; private string proxyURL;
@ -80,8 +80,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
if (proxyURL.Length == 0) return; if (proxyURL.Length == 0) return;
StartTcpServer(); StartTcpServer();
ClientView.SynchronizeClient = SynchronizePackets; ClientView.SynchronizeClient = new ClientView.SynchronizeClientHandler(SynchronizePackets);
AsynchronousSocketListener.PacketHandler = SynchronizePacketRecieve; AsynchronousSocketListener.PacketHandler = new AsynchronousSocketListener.PacketRecieveHandler(SynchronizePacketRecieve);
sceneManager = openSim.SceneManager; sceneManager = openSim.SceneManager;
udpServers = openSim.UdpServers; udpServers = openSim.UdpServers;
@ -146,7 +146,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{ {
ClientView client = (ClientView) pre.ControllingClient; ClientView client = (ClientView) pre.ControllingClient;
//if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) { //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) {
if (client.PacketProcessingEnabled) if (client.PacketProcessingEnabled == true)
{ {
get_scene_presence_filter++; get_scene_presence_filter++;
} }
@ -159,7 +159,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{ {
ClientView client = (ClientView) pre.ControllingClient; ClientView client = (ClientView) pre.ControllingClient;
//if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) { //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) {
if (client.PacketProcessingEnabled) if (client.PacketProcessingEnabled == true)
{ {
get_avatar_filter++; get_avatar_filter++;
avatar_names += pre.Firstname + " " + pre.Lastname + "; "; avatar_names += pre.Firstname + " " + pre.Lastname + "; ";
@ -178,7 +178,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[BALANCER] " + e); m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e.StackTrace); m_log.Error("[BALANCER] " + e.StackTrace);
} }
return response; return response;
@ -199,7 +199,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[BALANCER] " + e); m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e.StackTrace); m_log.Error("[BALANCER] " + e.StackTrace);
} }
@ -223,7 +223,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[BALANCER] " + e); m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e.StackTrace); m_log.Error("[BALANCER] " + e.StackTrace);
} }
@ -247,7 +247,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[BALANCER] " + e); m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e.StackTrace); m_log.Error("[BALANCER] " + e.StackTrace);
throw e; throw e;
} }
@ -264,14 +264,14 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
int src_port = (int) request.Params[0]; int src_port = (int) request.Params[0];
// backgroud // backgroud
WaitCallback callback = TerminateRegion; WaitCallback callback = new WaitCallback(TerminateRegion);
ThreadPool.QueueUserWorkItem(callback, src_port); ThreadPool.QueueUserWorkItem(callback, src_port);
m_log.Info("[BALANCER] " + "Exiting TerminateRegion()"); m_log.Info("[BALANCER] " + "Exiting TerminateRegion()");
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[BALANCER] " + e); m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e.StackTrace); m_log.Error("[BALANCER] " + e.StackTrace);
} }
@ -330,8 +330,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
dst_region = DeserializeRegion(dst_port, false, serializeDir); dst_region = DeserializeRegion(dst_port, false, serializeDir);
// Decide who is in charge for each section // Decide who is in charge for each section
int[] port = new[] {src_port, dst_port}; int[] port = new int[] {src_port, dst_port};
string[] url = new[] {"http://" + src_url + ":" + commandServer.Port, "http://" + dst_url + ":" + commandServer.Port}; string[] url = new string[] {"http://" + src_url + ":" + commandServer.Port, "http://" + dst_url + ":" + commandServer.Port};
for (int i = 0; i < 2; i++) Util.XmlRpcCommand(url[i], "SplitRegion", i, 2, port[0], port[1], url[0], url[1]); for (int i = 0; i < 2; i++) Util.XmlRpcCommand(url[i], "SplitRegion", i, 2, port[0], port[1], url[0], url[1]);
// Enable the proxy // Enable the proxy
@ -424,7 +424,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
// serialization of region data // serialization of region data
SearializableRegionInfo dst_region = new SearializableRegionInfo(src_region); SearializableRegionInfo dst_region = new SearializableRegionInfo(src_region);
filename = export_dir + "RegionInfo_" + src_region.RegionID + ".bin"; filename = export_dir + "RegionInfo_" + src_region.RegionID.ToString() + ".bin";
Util.SerializeToFile(filename, dst_region); Util.SerializeToFile(filename, dst_region);
// backup current scene's entities // backup current scene's entities
@ -451,7 +451,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{ {
ClientInfo info = controller.GetClientInfo(); ClientInfo info = controller.GetClientInfo();
filename = export_dir + "ClientInfo-" + String.Format("{0:0000}", idx) + "_" + controller.CircuitCode + ".bin"; filename = export_dir + "ClientInfo-" + String.Format("{0:0000}", idx) + "_" + controller.CircuitCode.ToString() + ".bin";
Util.SerializeToFile(filename, info); Util.SerializeToFile(filename, info);
@ -469,12 +469,13 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
private RegionInfo DeserializeRegion(int dst_port, bool move_flag, string import_dir) private RegionInfo DeserializeRegion(int dst_port, bool move_flag, string import_dir)
{ {
string[] files = null;
RegionInfo dst_region = null; RegionInfo dst_region = null;
try try
{ {
// deserialization of region data // deserialization of region data
string[] files = Directory.GetFiles(import_dir, "RegionInfo_*.bin"); files = Directory.GetFiles(import_dir, "RegionInfo_*.bin");
foreach (string filename in files) foreach (string filename in files)
{ {
@ -502,7 +503,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[BALANCER] " + e); m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e.StackTrace); m_log.Error("[BALANCER] " + e.StackTrace);
throw e; throw e;
} }
@ -592,7 +593,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
// change RegionInfo (memory only) // change RegionInfo (memory only)
dst_region.InternalEndPoint.Port = dst_port; dst_region.InternalEndPoint.Port = dst_port;
dst_region.ExternalHostName = proxyURL.Split(new[] {'/', ':'})[3]; dst_region.ExternalHostName = proxyURL.Split(new char[] {'/', ':'})[3];
// Create new region // Create new region
simMain.CreateRegion(dst_region, false); simMain.CreateRegion(dst_region, false);
@ -694,7 +695,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
for (int i = 0; i < numRegions; i++) for (int i = 0; i < numRegions; i++)
{ {
hostname = sceneURL[i].Split(new[] {'/', ':'})[3]; hostname = sceneURL[i].Split(new char[] {'/', ':'})[3];
m_log.InfoFormat("[SPLITSCENE] " + "creating tcp client host:{0}", hostname); m_log.InfoFormat("[SPLITSCENE] " + "creating tcp client host:{0}", hostname);
tcpClientList[i] = new TcpClient(hostname, 10001); tcpClientList[i] = new TcpClient(hostname, 10001);
} }
@ -730,11 +731,12 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
List<uint> circuits = scene.ClientManager.GetAllCircuitCodes(); List<uint> circuits = scene.ClientManager.GetAllCircuitCodes();
circuits.Sort(); circuits.Sort();
IClientAPI controller = null;
foreach (uint code in circuits) foreach (uint code in circuits)
{ {
m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code); m_log.InfoFormat("[BALANCER] " + "circuit code : {0}", code);
IClientAPI controller;
if (scene.ClientManager.TryGetClient(code, out controller)) if (scene.ClientManager.TryGetClient(code, out controller))
{ {
// Divide the presences evenly over the set of subscenes // Divide the presences evenly over the set of subscenes
@ -754,7 +756,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
} }
scene.splitID = myID; scene.splitID = myID;
scene.SynchronizeScene = SynchronizeScenes; scene.SynchronizeScene = new Scene.SynchronizeSceneHandler(SynchronizeScenes);
isSplit = true; isSplit = true;
} }
else else
@ -764,7 +766,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[SPLITSCENE] " + e); m_log.Error("[SPLITSCENE] " + e.ToString());
m_log.Error("[SPLITSCENE] " + e.StackTrace); m_log.Error("[SPLITSCENE] " + e.StackTrace);
} }
@ -818,7 +820,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[BALANCER] " + e); m_log.Error("[BALANCER] " + e.ToString());
m_log.Error("[BALANCER] " + e.StackTrace); m_log.Error("[BALANCER] " + e.StackTrace);
throw e; throw e;
} }
@ -891,7 +893,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
// Because data changes by the physics simulation when the client doesn't move, // Because data changes by the physics simulation when the client doesn't move,
// if MovementFlag is false, It is necessary to synchronize. // if MovementFlag is false, It is necessary to synchronize.
//if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true) //if(pre.MovementFlag!=0 && client.PacketProcessingEnabled==true)
if (client.PacketProcessingEnabled) if (client.PacketProcessingEnabled == true)
{ {
//m_log.Info("[SPLITSCENE] "+String.Format("Client moving in {0} {1}", scene.RegionInfo.RegionID, pre.AbsolutePosition)); //m_log.Info("[SPLITSCENE] "+String.Format("Client moving in {0} {1}", scene.RegionInfo.RegionID, pre.AbsolutePosition));
@ -1014,7 +1016,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
return; return;
} }
if (((ClientView) pre.ControllingClient).PacketProcessingEnabled) if (((ClientView) pre.ControllingClient).PacketProcessingEnabled == true)
{ {
pre.ControllingClient.OutPacket(packet, throttlePacketType); pre.ControllingClient.OutPacket(packet, throttlePacketType);
} }
@ -1058,7 +1060,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[SPLITSCENE] " + e); m_log.Error("[SPLITSCENE] " + e.ToString());
m_log.Error("[SPLITSCENE] " + e.StackTrace); m_log.Error("[SPLITSCENE] " + e.StackTrace);
} }
@ -1070,7 +1072,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
LLUUID scenePresenceID = new LLUUID(header.agent_id); LLUUID scenePresenceID = new LLUUID(header.agent_id);
LLVector3 position = new LLVector3(buff, 0); LLVector3 position = new LLVector3(buff, 0);
LLVector3 velocity = new LLVector3(buff, 12); LLVector3 velocity = new LLVector3(buff, 12);
bool flying = ((buff[24] == 1) ? true : false); bool flying = ((buff[24] == (byte) 1) ? true : false);
LocalUpdatePhysics(regionPort, scenePresenceID, position, velocity, flying); LocalUpdatePhysics(regionPort, scenePresenceID, position, velocity, flying);

View File

@ -34,8 +34,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{ {
public class AsynchronousClient public class AsynchronousClient
{ {
private static readonly ManualResetEvent connectDone = new ManualResetEvent(false); private static ManualResetEvent connectDone = new ManualResetEvent(false);
private static readonly ManualResetEvent sendDone = new ManualResetEvent(false); private static ManualResetEvent sendDone = new ManualResetEvent(false);
public static Socket StartClient(string hostname, int port) public static Socket StartClient(string hostname, int port)
{ {
@ -46,7 +46,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
IPEndPoint remoteEP = new IPEndPoint(ipAddress, port); IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);
Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
client.BeginConnect(remoteEP, ConnectCallback, client); client.BeginConnect(remoteEP, new AsyncCallback(ConnectCallback), client);
connectDone.WaitOne(); connectDone.WaitOne();
/* /*
Send(client,"This is a test<EOF>"); Send(client,"This is a test<EOF>");
@ -71,7 +71,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{ {
Socket client = (Socket) ar.AsyncState; Socket client = (Socket) ar.AsyncState;
client.EndConnect(ar); client.EndConnect(ar);
Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint); Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint.ToString());
connectDone.Set(); connectDone.Set();
} }
catch (Exception e) catch (Exception e)
@ -138,8 +138,8 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
public class InternalPacketHeader public class InternalPacketHeader
{ {
private readonly byte[] buffer = new byte[32];
public Guid agent_id; public Guid agent_id;
private byte[] buffer = new byte[32];
public int numbytes; public int numbytes;
public int region_port; public int region_port;
public int throttlePacketType; public int throttlePacketType;
@ -150,16 +150,16 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
int i = 0; // offset int i = 0; // offset
try try
{ {
type = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); type = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
throttlePacketType = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); throttlePacketType = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
numbytes = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); numbytes = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
agent_id = new Guid( agent_id = new Guid(
bytes[i++] | (bytes[i++] << 8) | (bytes[i++] << 16) | bytes[i++] << 24, bytes[i++] | (bytes[i++] << 8) | (bytes[i++] << 16) | bytes[i++] << 24,
(short) (bytes[i++] | (bytes[i++] << 8)), (short) (bytes[i++] | (bytes[i++] << 8)),
(short) (bytes[i++] | (bytes[i++] << 8)), (short) (bytes[i++] | (bytes[i++] << 8)),
bytes[i++], bytes[i++], bytes[i++], bytes[i++], bytes[i++], bytes[i++], bytes[i++], bytes[i++],
bytes[i++], bytes[i++], bytes[i++], bytes[i++]); bytes[i++], bytes[i++], bytes[i++], bytes[i++]);
region_port = (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); region_port = (int) (bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));
} }
catch (Exception) catch (Exception)
{ {
@ -201,11 +201,11 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
public class TcpClient public class TcpClient
{ {
public static int internalPacketHeaderSize = 4 * 4 + 16 * 1; public static int internalPacketHeaderSize = 4 * 4 + 16 * 1;
private readonly string mHostname;
private readonly int mPort;
private Socket mConnection; private Socket mConnection;
private string mHostname;
private int mPort;
public TcpClient(string hostname, int port) public TcpClient(string hostname, int port)
{ {
mHostname = hostname; mHostname = hostname;

View File

@ -37,15 +37,15 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
{ {
public const int BufferSize = 2048; public const int BufferSize = 2048;
public byte[] buffer = new byte[BufferSize]; public byte[] buffer = new byte[BufferSize];
public InternalPacketHeader header; public InternalPacketHeader header = null;
public MemoryStream ms_ptr = new MemoryStream(); public MemoryStream ms_ptr = new MemoryStream();
public Socket workSocket; public Socket workSocket = null;
} }
public class AsynchronousSocketListener public class AsynchronousSocketListener
{ {
public static ManualResetEvent allDone = new ManualResetEvent(false); public static ManualResetEvent allDone = new ManualResetEvent(false);
public static string data; public static string data = null;
#region KIRYU #region KIRYU
@ -55,10 +55,14 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
#endregion #endregion
public static PacketRecieveHandler PacketHandler; public static PacketRecieveHandler PacketHandler = null;
#endregion #endregion
public AsynchronousSocketListener()
{
}
public static void StartListening(int port) public static void StartListening(int port)
{ {
IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());
@ -195,7 +199,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
public class TcpServer public class TcpServer
{ {
private readonly int mPort = 11000; private int mPort = 11000;
public TcpServer() public TcpServer()
{ {

View File

@ -75,7 +75,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
string proxyURL = openSim.ConfigSource.Configs["Network"].GetString("proxy_url", ""); string proxyURL = openSim.ConfigSource.Configs["Network"].GetString("proxy_url", "");
if (proxyURL.Length == 0) return; if (proxyURL.Length == 0) return;
uint port = (uint) Int32.Parse(proxyURL.Split(new[] {':'})[2]); uint port = (uint) Int32.Parse(proxyURL.Split(new char[] {':'})[2]);
command_server = new BaseHttpServer(port); command_server = new BaseHttpServer(port);
command_server.Start(); command_server.Start();
command_server.AddXmlRPCHandler("AddPort", AddPort); command_server.AddXmlRPCHandler("AddPort", AddPort);
@ -223,7 +223,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
{ {
m_log = log; m_log = log;
running = false; running = false;
receivedData = OnReceivedData; receivedData = new AsyncCallback(OnReceivedData);
} }
public void BlockClientMessages(string regionUrl, int regionPort) public void BlockClientMessages(string regionUrl, int regionPort)
@ -452,7 +452,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
protected class ProxyMap protected class ProxyMap
{ {
private readonly Dictionary<EndPoint, RegionData> map; private Dictionary<EndPoint, RegionData> map;
public ProxyMap() public ProxyMap()
{ {
@ -494,7 +494,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
public class RegionData public class RegionData
{ {
public bool isBlocked; public bool isBlocked = false;
public List<EndPoint> regions = new List<EndPoint>(); public List<EndPoint> regions = new List<EndPoint>();
public Queue storedMessages = new Queue(); public Queue storedMessages = new Queue();
} }