Intermediate commit. Sill errors.

Merge branch 'master' into careminster

Conflicts:
	OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
	OpenSim/Framework/RegionInfo.cs
	OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
	OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
	OpenSim/Services/UserProfilesService/UserProfilesService.cs
avinationmerge
Melanie 2014-01-05 20:12:32 +00:00
commit e79fab91db
36 changed files with 11432 additions and 9480 deletions

View File

@ -546,6 +546,10 @@ namespace OpenSim.Data.MySQL
reader.Read();
notes.Notes = OSD.FromString((string)reader["notes"]);
}
else
{
notes.Notes = OSD.FromString("");
}
}
}
}
@ -928,15 +932,19 @@ namespace OpenSim.Data.MySQL
}
else
{
dbcon.Close();
dbcon.Open();
query = "INSERT INTO usersettings VALUES ";
query += "(?uuid,'false','false', ?Email)";
using (MySqlCommand put = new MySqlCommand(query, dbcon))
{
query = "INSERT INTO usersettings VALUES ";
query += "(?Id,'false','false', '')";
lock(Lock)
{
put.ExecuteNonQuery();
}
put.Parameters.AddWithValue("?Email", pref.EMail);
put.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
put.ExecuteNonQuery();
}
}
}

View File

@ -747,6 +747,90 @@ namespace OpenSim.Data.SQLite
}
return true;
}
public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
{
string query = string.Empty;
query += "UPDATE usersettings SET ";
query += "imviaemail=:ImViaEmail, ";
query += "visible=:Visible ";
query += "WHERE useruuid=:uuid";
try
{
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
{
cmd.CommandText = query;
cmd.Parameters.AddWithValue(":ImViaEmail", pref.IMViaEmail);
cmd.Parameters.AddWithValue(":Visible", pref.Visible);
cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString());
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
m_log.DebugFormat("[PROFILES_DATA]" +
": AgentInterestsUpdate exception {0}", e.Message);
result = e.Message;
return false;
}
return true;
}
public bool GetUserPreferences(ref UserPreferences pref, ref string result)
{
IDataReader reader = null;
string query = string.Empty;
query += "SELECT imviaemail,visible,email FROM ";
query += "usersettings WHERE ";
query += "useruuid = :Id";
OSDArray data = new OSDArray();
try
{
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
{
cmd.CommandText = query;
cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if(reader.Read())
{
bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
bool.TryParse((string)reader["visible"], out pref.Visible);
pref.EMail = (string)reader["email"];
}
else
{
query = "INSERT INTO usersettings VALUES ";
query += "(:Id,'false','false', :Email)";
using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
{
put.Parameters.AddWithValue(":Id", pref.UserId.ToString());
put.Parameters.AddWithValue(":Email", pref.EMail);
put.ExecuteNonQuery();
}
}
}
}
}
catch (Exception e)
{
m_log.DebugFormat("[PROFILES_DATA]" +
": Get preferences exception {0}", e.Message);
result = e.Message;
return false;
}
return true;
}
public bool GetUserAppData(ref UserAppData props, ref string result)
{
IDataReader reader = null;

View File

@ -30,9 +30,18 @@ namespace OpenSim.Framework
{
public class Constants
{
// 'RegionSize' is the legacy region size.
// DO NOT USE THIS FOR ANY NEW CODE. Use Scene.RegionInfo.RegionSize[XYZ] as a region might not
// be the legacy region size.
public const uint RegionSize = 256;
public const uint RegionHeight = 4096;
public const byte TerrainPatchSize = 16;
// This could be a parameters but, really, a region of greater than this is pretty unmanageable
public const uint MaximumRegionSize = 8192;
// Since terrain is stored in 16x16 heights, regions must be a multiple of this number and that is the minimum
public const int MinRegionSize = 16;
public const int TerrainPatchSize = 16;
public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f";
public enum EstateAccessCodex : uint

View File

@ -100,6 +100,7 @@ namespace OpenSim.Framework
public class RegionInfo
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string LogHeader = "[REGION INFO]";
public bool commFailTF = false;
public ConfigurationMember configMember;
@ -139,16 +140,20 @@ namespace OpenSim.Framework
public bool m_allow_alternate_ports;
protected string m_externalHostName;
protected IPEndPoint m_internalEndPoint;
protected uint? m_regionLocX;
protected uint? m_regionLocY;
protected uint m_remotingPort;
public UUID RegionID = UUID.Zero;
public string RemotingAddress;
public UUID ScopeID = UUID.Zero;
private UUID m_maptileStaticUUID = UUID.Zero;
private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>();
public uint WorldLocX = 0;
public uint WorldLocY = 0;
public uint WorldLocZ = 0;
public uint RegionSizeX = Constants.RegionSize;
public uint RegionSizeY = Constants.RegionSize;
public uint RegionSizeZ = Constants.RegionHeight;
private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>();
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
@ -231,11 +236,12 @@ namespace OpenSim.Framework
m_serverURI = string.Empty;
}
public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
public RegionInfo(uint legacyRegionLocX, uint legacyRegionLocY, IPEndPoint internalEndPoint, string externalUri)
{
m_regionLocX = regionLocX;
m_regionLocY = regionLocY;
RegionLocX = legacyRegionLocX;
RegionLocY = legacyRegionLocY;
RegionSizeX = Constants.RegionSize;
RegionSizeY = Constants.RegionSize;
m_internalEndPoint = internalEndPoint;
m_externalHostName = externalUri;
m_serverURI = string.Empty;
@ -449,25 +455,42 @@ namespace OpenSim.Framework
/// <summary>
/// The x co-ordinate of this region in map tiles (e.g. 1000).
/// Coordinate is scaled as world coordinates divided by the legacy region size
/// and is thus is the number of legacy regions.
/// </summary>
public uint RegionLocX
{
get { return m_regionLocX.Value; }
set { m_regionLocX = value; }
get { return WorldLocX / Constants.RegionSize; }
set { WorldLocX = value * Constants.RegionSize; }
}
/// <summary>
/// The y co-ordinate of this region in map tiles (e.g. 1000).
/// Coordinate is scaled as world coordinates divided by the legacy region size
/// and is thus is the number of legacy regions.
/// </summary>
public uint RegionLocY
{
get { return m_regionLocY.Value; }
set { m_regionLocY = value; }
get { return WorldLocY / Constants.RegionSize; }
set { WorldLocY = value * Constants.RegionSize; }
}
public void SetDefaultRegionSize()
{
WorldLocX = 0;
WorldLocY = 0;
WorldLocZ = 0;
RegionSizeX = Constants.RegionSize;
RegionSizeY = Constants.RegionSize;
RegionSizeZ = Constants.RegionHeight;
}
// A unique region handle is created from the region's world coordinates.
// This cannot be changed because some code expects to receive the region handle and then
// compute the region coordinates from it.
public ulong RegionHandle
{
get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
get { return Util.UIntsToLong(WorldLocX, WorldLocY); }
}
public void SetEndPoint(string ipaddr, int port)
@ -574,8 +597,25 @@ namespace OpenSim.Framework
string[] locationElements = location.Split(new char[] {','});
m_regionLocX = Convert.ToUInt32(locationElements[0]);
m_regionLocY = Convert.ToUInt32(locationElements[1]);
RegionLocX = Convert.ToUInt32(locationElements[0]);
RegionLocY = Convert.ToUInt32(locationElements[1]);
// Region size
// Default to legacy region size if not specified.
allKeys.Remove("SizeX");
string configSizeX = config.GetString("SizeX", Constants.RegionSize.ToString());
config.Set("SizeX", configSizeX);
RegionSizeX = Convert.ToUInt32(configSizeX);
allKeys.Remove("SizeY");
string configSizeY = config.GetString("SizeY", Constants.RegionSize.ToString());
config.Set("SizeY", configSizeX);
RegionSizeY = Convert.ToUInt32(configSizeY);
allKeys.Remove("SizeZ");
string configSizeZ = config.GetString("SizeZ", Constants.RegionHeight.ToString());
config.Set("SizeZ", configSizeX);
RegionSizeZ = Convert.ToUInt32(configSizeZ);
DoRegionSizeSanityChecks();
// InternalAddress
//
@ -695,6 +735,57 @@ namespace OpenSim.Framework
}
}
// Make sure user specified region sizes are sane.
// Must be multiples of legacy region size (256).
private void DoRegionSizeSanityChecks()
{
if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize)
{
// Doing non-legacy region sizes.
// Enforce region size to be multiples of the legacy region size (256)
uint partial = RegionSizeX % Constants.RegionSize;
if (partial != 0)
{
RegionSizeX -= partial;
if (RegionSizeX == 0)
RegionSizeX = Constants.RegionSize;
m_log.ErrorFormat("{0} Region size must be multiple of {1}. Enforcing {2}.RegionSizeX={3} instead of specified {4}",
LogHeader, Constants.RegionSize, m_regionName, RegionSizeX, RegionSizeX + partial);
}
partial = RegionSizeY % Constants.RegionSize;
if (partial != 0)
{
RegionSizeY -= partial;
if (RegionSizeY == 0)
RegionSizeY = Constants.RegionSize;
m_log.ErrorFormat("{0} Region size must be multiple of {1}. Enforcing {2}.RegionSizeY={3} instead of specified {4}",
LogHeader, Constants.RegionSize, m_regionName, RegionSizeY, RegionSizeY + partial);
}
// Because of things in the viewer, regions MUST be square.
// Remove this check when viewers have been updated.
if (RegionSizeX != RegionSizeY)
{
uint minSize = Math.Min(RegionSizeX, RegionSizeY);
RegionSizeX = minSize;
RegionSizeY = minSize;
m_log.ErrorFormat("{0} Regions must be square until viewers are updated. Forcing region {1} size to <{2},{3}>",
LogHeader, m_regionName, RegionSizeX, RegionSizeY);
}
// There is a practical limit to region size.
if (RegionSizeX > Constants.MaximumRegionSize || RegionSizeY > Constants.MaximumRegionSize)
{
RegionSizeX = Util.Clamp<uint>(RegionSizeX, Constants.RegionSize, Constants.MaximumRegionSize);
RegionSizeY = Util.Clamp<uint>(RegionSizeY, Constants.RegionSize, Constants.MaximumRegionSize);
m_log.ErrorFormat("{0} Region dimensions must be less than {1}. Clamping {2}'s size to <{3},{4}>",
LogHeader, Constants.MaximumRegionSize, m_regionName, RegionSizeX, RegionSizeY);
}
m_log.InfoFormat("{0} Region {1} size set to <{2},{3}>", LogHeader, m_regionName, RegionSizeX, RegionSizeY);
}
}
private void WriteNiniConfig(IConfigSource source)
{
IConfig config = source.Configs[RegionName];
@ -706,11 +797,17 @@ namespace OpenSim.Framework
config.Set("RegionUUID", RegionID.ToString());
string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY);
string location = String.Format("{0},{1}", RegionLocX, RegionLocY);
config.Set("Location", location);
if (DataStore != String.Empty)
config.Set("Datastore", DataStore);
if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize)
{
config.Set("SizeX", RegionSizeX);
config.Set("SizeY", RegionSizeY);
config.Set("SizeZ", RegionSizeZ);
}
config.Set("InternalAddress", m_internalEndPoint.Address.ToString());
config.Set("InternalPort", m_internalEndPoint.Port);
@ -794,10 +891,18 @@ namespace OpenSim.Framework
RegionID.ToString(), true);
configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Region Name", RegionName, true);
configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Grid Location (X Axis)", m_regionLocX.ToString(), true);
"Grid Location (X Axis)", RegionLocX.ToString(), true);
configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Grid Location (Y Axis)", m_regionLocY.ToString(), true);
"Grid Location (Y Axis)", RegionLocY.ToString(), true);
configMember.addConfigurationOption("sim_size_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Size of region in X dimension", RegionSizeX.ToString(), true);
configMember.addConfigurationOption("sim_size_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Size of region in Y dimension", RegionSizeY.ToString(), true);
configMember.addConfigurationOption("sim_size_z", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Size of region in Z dimension", RegionSizeZ.ToString(), true);
//m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
configMember.addConfigurationOption("internal_ip_address",
ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
@ -860,10 +965,18 @@ namespace OpenSim.Framework
UUID.Random().ToString(), true);
configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Region Name", "OpenSim Test", false);
configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Grid Location (X Axis)", "1000", false);
configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Grid Location (Y Axis)", "1000", false);
configMember.addConfigurationOption("sim_size_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Size of region in X dimension", Constants.RegionSize.ToString(), false);
configMember.addConfigurationOption("sim_size_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Size of region in Y dimension", Constants.RegionSize.ToString(), false);
configMember.addConfigurationOption("sim_size_z", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Size of region in Z dimension", Constants.RegionHeight.ToString(), false);
//m_configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
configMember.addConfigurationOption("internal_ip_address",
ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
@ -921,10 +1034,19 @@ namespace OpenSim.Framework
RegionName = (string) configuration_result;
break;
case "sim_location_x":
m_regionLocX = (uint) configuration_result;
RegionLocX = (uint) configuration_result;
break;
case "sim_location_y":
m_regionLocY = (uint) configuration_result;
RegionLocY = (uint) configuration_result;
break;
case "sim_size_x":
RegionSizeX = (uint) configuration_result;
break;
case "sim_size_y":
RegionSizeY = (uint) configuration_result;
break;
case "sim_size_z":
RegionSizeZ = (uint) configuration_result;
break;
case "datastore":
DataStore = (string) configuration_result;
@ -1008,8 +1130,13 @@ namespace OpenSim.Framework
args["external_host_name"] = OSD.FromString(ExternalHostName);
args["http_port"] = OSD.FromString(HttpPort.ToString());
args["server_uri"] = OSD.FromString(ServerURI);
args["region_xloc"] = OSD.FromString(RegionLocX.ToString());
args["region_yloc"] = OSD.FromString(RegionLocY.ToString());
args["region_size_x"] = OSD.FromString(RegionSizeX.ToString());
args["region_size_y"] = OSD.FromString(RegionSizeY.ToString());
args["region_size_z"] = OSD.FromString(RegionSizeZ.ToString());
args["internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString());
args["internal_ep_port"] = OSD.FromString(InternalEndPoint.Port.ToString());
if ((RemotingAddress != null) && !RemotingAddress.Equals(""))
@ -1048,6 +1175,13 @@ namespace OpenSim.Framework
UInt32.TryParse(args["region_yloc"].AsString(), out locy);
RegionLocY = locy;
}
if (args.ContainsKey("region_size_x"))
RegionSizeX = (uint)args["region_size_x"].AsInteger();
if (args.ContainsKey("region_size_y"))
RegionSizeY = (uint)args["region_size_y"].AsInteger();
if (args.ContainsKey("region_size_z"))
RegionSizeZ = (uint)args["region_size_z"].AsInteger();
IPAddress ip_addr = null;
if (args["internal_ep_address"] != null)
{

View File

@ -247,12 +247,18 @@ namespace OpenSim.Framework
/// <returns></returns>
public static List<string> ParseNotecardToList(string rawInput)
{
string[] input = rawInput.Replace("\r", "").Split('\n');
string[] input;
int idx = 0;
int level = 0;
List<string> output = new List<string>();
string[] words;
//The Linden format always ends with a } after the input data.
//Strip off trailing } so there is nothing after the input data.
int i = rawInput.LastIndexOf("}");
rawInput = rawInput.Remove(i, rawInput.Length-i);
input = rawInput.Replace("\r", "").Split('\n');
while (idx < input.Length)
{
if (input[idx] == "{")
@ -287,24 +293,18 @@ namespace OpenSim.Framework
break;
if (words[0] == "Text")
{
int len = int.Parse(words[2]);
idx++;
idx++; //Now points to first line of notecard text
int count = -1;
//Number of lines in notecard.
int lines = input.Length - idx;
int line = 0;
while (count < len && idx < input.Length)
while (line < lines)
{
// int l = input[idx].Length;
string ln = input[idx];
int need = len-count-1;
if (ln.Length > need)
ln = ln.Substring(0, need);
// m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", ln);
output.Add(ln);
count += ln.Length + 1;
// m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", input[idx]);
output.Add(input[idx]);
idx++;
line++;
}
return output;

View File

@ -145,8 +145,8 @@ namespace OpenSim.Framework.Servers
TimeSpan timeTaken = DateTime.Now - m_startuptime;
m_log.InfoFormat(
"[STARTUP]: Non-script portion of startup took {0}m {1}s. PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED.",
MainConsole.Instance.OutputFormat(
"PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED. Non-script portion of startup took {0}m {1}s.",
timeTaken.Minutes, timeTaken.Seconds);
}

View File

@ -333,6 +333,49 @@ namespace OpenSim.Framework
return Utils.UIntsToLong(X, Y);
}
// Regions are identified with a 'handle' made up of its region coordinates packed into a ulong.
// Several places rely on the ability to extract a region's location from its handle.
// Note the location is in 'world coordinates' (see below).
// Region handles are based on the lowest coordinate of the region so trim the passed x,y to be the regions 0,0.
public static ulong RegionWorldLocToHandle(uint X, uint Y)
{
return Utils.UIntsToLong(X, Y);
}
public static ulong RegionLocToHandle(uint X, uint Y)
{
return Utils.UIntsToLong(Util.RegionToWorldLoc(X), Util.RegionToWorldLoc(Y));
}
public static void RegionHandleToWorldLoc(ulong handle, out uint X, out uint Y)
{
X = (uint)(handle >> 32);
Y = (uint)(handle & (ulong)uint.MaxValue);
}
public static void RegionHandleToRegionLoc(ulong handle, out uint X, out uint Y)
{
uint worldX, worldY;
RegionHandleToWorldLoc(handle, out worldX, out worldY);
X = WorldToRegionLoc(worldX);
Y = WorldToRegionLoc(worldY);
}
// A region location can be 'world coordinates' (meters from zero) or 'region coordinates'
// (number of regions from zero). This measurement of regions relies on the legacy 256 region size.
// These routines exist to make what is being converted explicit so the next person knows what was meant.
// Convert a region's 'world coordinate' to its 'region coordinate'.
public static uint WorldToRegionLoc(uint worldCoord)
{
return worldCoord / Constants.RegionSize;
}
// Convert a region's 'region coordinate' to its 'world coordinate'.
public static uint RegionToWorldLoc(uint regionCoord)
{
return regionCoord * Constants.RegionSize;
}
public static T Clamp<T>(T x, T min, T max)
where T : IComparable<T>
{

View File

@ -295,9 +295,9 @@ namespace OpenSim.Region.ClientStack.Linden
{
// Register an event queue for the client
//m_log.DebugFormat(
// "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
// agentID, caps, m_scene.RegionInfo.RegionName);
m_log.DebugFormat(
"[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
agentID, caps, m_scene.RegionInfo.RegionName);
// Let's instantiate a Queue for this agent right now
TryGetQueue(agentID);
@ -711,34 +711,46 @@ namespace OpenSim.Region.ClientStack.Linden
Enqueue(item, avatarID);
}
public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID)
public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY)
{
OSD item = EventQueueHelper.EnableSimulator(handle, endPoint);
m_log.DebugFormat("{0} EnableSimulator. handle={1}, avatarID={2}, regionSize={3},{4}>",
"[EVENT QUEUE GET MODULE]", handle, avatarID, regionSizeX, regionSizeY);
OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY);
Enqueue(item, avatarID);
}
public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath)
public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath,
ulong regionHandle, int regionSizeX, int regionSizeY)
{
OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath);
m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, avatarID={2}, regionSize={3},{4}>",
"[EVENT QUEUE GET MODULE]", regionHandle, avatarID, regionSizeX, regionSizeY);
OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY);
Enqueue(item, avatarID);
}
public virtual void TeleportFinishEvent(ulong regionHandle, byte simAccess,
IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL,
UUID avatarID)
UUID avatarID, int regionSizeX, int regionSizeY)
{
m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, avatarID={2}, regionSize={3},{4}>",
"[EVENT QUEUE GET MODULE]", regionHandle, avatarID, regionSizeX, regionSizeY);
OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint,
locationID, flags, capsURL, avatarID);
locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY);
Enqueue(item, avatarID);
}
public virtual void CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
IPEndPoint newRegionExternalEndPoint,
string capsURL, UUID avatarID, UUID sessionID)
string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY)
{
m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>",
"[EVENT QUEUE GET MODULE]", handle, avatarID, regionSizeX, regionSizeY);
OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint,
capsURL, avatarID, sessionID);
capsURL, avatarID, sessionID, regionSizeX, regionSizeY);
Enqueue(item, avatarID);
}

View File

@ -70,13 +70,15 @@ namespace OpenSim.Region.ClientStack.Linden
return llsdEvent;
}
public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint)
public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint, int regionSizeX, int regionSizeY)
{
OSDMap llsdSimInfo = new OSDMap(3);
OSDMap llsdSimInfo = new OSDMap(5);
llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle)));
llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes()));
llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port));
llsdSimInfo.Add("RegionSizeX", new OSDInteger(regionSizeX));
llsdSimInfo.Add("RegionSizeY", new OSDInteger(regionSizeY));
OSDArray arr = new OSDArray(1);
arr.Add(llsdSimInfo);
@ -104,7 +106,8 @@ namespace OpenSim.Region.ClientStack.Linden
public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
IPEndPoint newRegionExternalEndPoint,
string capsURL, UUID agentID, UUID sessionID)
string capsURL, UUID agentID, UUID sessionID,
int regionSizeX, int regionSizeY)
{
OSDArray lookAtArr = new OSDArray(3);
lookAtArr.Add(OSD.FromReal(lookAt.X));
@ -130,11 +133,13 @@ namespace OpenSim.Region.ClientStack.Linden
OSDArray agentDataArr = new OSDArray(1);
agentDataArr.Add(agentDataMap);
OSDMap regionDataMap = new OSDMap(4);
OSDMap regionDataMap = new OSDMap(6);
regionDataMap.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(handle)));
regionDataMap.Add("SeedCapability", OSD.FromString(capsURL));
regionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes()));
regionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port));
regionDataMap.Add("RegionSizeX", new OSDInteger(regionSizeX));
regionDataMap.Add("RegionSizeY", new OSDInteger(regionSizeY));
OSDArray regionDataArr = new OSDArray(1);
regionDataArr.Add(regionDataMap);
@ -148,8 +153,9 @@ namespace OpenSim.Region.ClientStack.Linden
}
public static OSD TeleportFinishEvent(
ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL, UUID agentID)
ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL, UUID agentID,
int regionSizeX, int regionSizeY)
{
// not sure why flags get overwritten here
if ((flags & (uint)TeleportFlags.IsFlying) != 0)
@ -167,6 +173,8 @@ namespace OpenSim.Region.ClientStack.Linden
info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port));
// info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
info.Add("TeleportFlags", OSD.FromUInteger(flags));
info.Add("RegionSizeX", new OSDInteger(regionSizeX));
info.Add("RegionSizeY", new OSDInteger(regionSizeY));
OSDArray infoArr = new OSDArray();
infoArr.Add(info);
@ -194,12 +202,18 @@ namespace OpenSim.Region.ClientStack.Linden
return BuildEvent("ScriptRunningReply", body);
}
public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap)
public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap,
ulong regionHandle, int regionSizeX, int regionSizeY)
{
OSDMap body = new OSDMap(3);
body.Add("agent-id", new OSDUUID(agentID));
body.Add("sim-ip-and-port", new OSDString(simIpAndPort));
body.Add("seed-capability", new OSDString(seedcap));
OSDMap body = new OSDMap(6)
{
{"agent-id", new OSDUUID(agentID)},
{"sim-ip-and-port", new OSDString(simIpAndPort)},
{"seed-capability", new OSDString(seedcap)},
{"region-handle", OSD.FromULong(regionHandle)},
{"region-size-x", OSD.FromInteger(regionSizeX)},
{"region-size-y", OSD.FromInteger(regionSizeY)}
};
return BuildEvent("EstablishAgentCommunication", body);
}

View File

@ -754,8 +754,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
IClientAPI remoteClient = (IClientAPI)sender;
string serverURI = string.Empty;
GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
note.TargetId = remoteClient.AgentId;
UUID.TryParse(args[0], out note.UserId);
note.UserId = remoteClient.AgentId;
UUID.TryParse(args[0], out note.TargetId);
object Note = (object)note;
if(!JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString()))

View File

@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public class EntityTransferModule : INonSharedRegionModule, IEntityTransferModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string LogHeader = "[ENTITY TRANSFER MODULE]";
public const int DefaultMaxTransferDistance = 4095;
public const bool WaitForAgentArrivedAtDestinationDefault = true;
@ -825,7 +826,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// The EnableSimulator message makes the client establish a connection with the destination
// simulator by sending the initial UseCircuitCode UDP packet to the destination containing the
// correct circuit code.
m_eqModule.EnableSimulator(destinationHandle, endPoint, sp.UUID);
m_eqModule.EnableSimulator(destinationHandle, endPoint, sp.UUID,
finalDestination.RegionSizeX, finalDestination.RegionSizeY);
m_log.DebugFormat("{0} Sent EnableSimulator. regName={1}, size=<{2},{3}>", LogHeader,
finalDestination.RegionName, finalDestination.RegionSizeX, finalDestination.RegionSizeY);
// XXX: Is this wait necessary? We will always end up waiting on UpdateAgent for the destination
// simulator to confirm that it has established communication with the viewer.
@ -835,7 +839,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// unnecessary - teleport will succeed and SEED caps will be requested without it (though possibly
// only on TeleportFinish). This is untested for region teleport between different simulators
// though this probably also works.
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath, finalDestination.RegionHandle,
finalDestination.RegionSizeX, finalDestination.RegionSizeY);
}
else
{
@ -921,7 +926,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// OK, send TPFinish to the client, so that it starts the process of contacting the destination region
if (m_eqModule != null)
{
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID);
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID,
finalDestination.RegionSizeX, finalDestination.RegionSizeY);
}
else
{
@ -1074,7 +1080,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// New protocol: send TP Finish directly, without prior ES or EAC. That's what happens in the Linden grid
if (m_eqModule != null)
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID);
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID,
finalDestination.RegionSizeX, finalDestination.RegionSizeY);
else
sp.ControllingClient.SendRegionTeleport(destinationHandle, 13, endPoint, 4,
teleportFlags, capsPath);
@ -1717,11 +1724,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (m_eqModule != null)
{
m_eqModule.CrossRegion(
neighbourRegion.RegionHandle, pos + agent.Velocity, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint,
capsPath, agent.UUID, agent.ControllingClient.SessionId);
neighbourRegion.RegionHandle, pos + agent.Velocity, vel2 /* agent.Velocity */,
neighbourRegion.ExternalEndPoint,
capsPath, agent.UUID, agent.ControllingClient.SessionId,
neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY);
}
else
{
m_log.ErrorFormat("{0} Using old CrossRegion packet. Varregion will not work!!", LogHeader);
agent.ControllingClient.CrossRegion(neighbourRegion.RegionHandle, pos + agent.Velocity, agent.Velocity, neighbourRegion.ExternalEndPoint,
capsPath);
}
@ -2087,12 +2097,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
#endregion
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} is sending {1} EnableSimulator for neighbour region {2} @ {3} " +
"and EstablishAgentCommunication with seed cap {4}",
scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath);
m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " +
"and EstablishAgentCommunication with seed cap {8}", LogHeader,
scene.RegionInfo.RegionName, sp.Name,
reg.RegionName, reg.RegionLocX, reg.RegionLocY, reg.RegionSizeX, reg.RegionSizeY , capsPath);
m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID);
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID, reg.RegionSizeX, reg.RegionSizeY);
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath, reg.RegionHandle, reg.RegionSizeX, reg.RegionSizeY);
}
else
{

View File

@ -216,13 +216,13 @@ namespace OpenSim.Region.CoreModules
// FIXME: If console region is root then this will be printed by every module. Currently, there is no
// way to prevent this, short of making the entire module shared (which is complete overkill).
// One possibility is to return a bool to signal whether the module has completely handled the command
m_log.InfoFormat("[WIND]: Please change to a specific region in order to set Sun parameters.");
MainConsole.Instance.Output("Please change to a specific region in order to set Sun parameters.");
return;
}
if (m_scene.ConsoleScene() != m_scene)
{
m_log.InfoFormat("[WIND]: Console Scene is not my scene.");
MainConsole.Instance.Output("Console Scene is not my scene.");
return;
}
}
@ -233,7 +233,9 @@ namespace OpenSim.Region.CoreModules
private void HandleConsoleCommand(string module, string[] cmdparams)
{
ValidateConsole();
m_log.Info("[WIND] The wind command can be used to change the currently active wind model plugin and update the parameters for wind plugins.");
MainConsole.Instance.Output(
"The wind command can be used to change the currently active wind model plugin and update the parameters for wind plugins.");
}
/// <summary>
@ -246,7 +248,9 @@ namespace OpenSim.Region.CoreModules
if ((cmdparams.Length != 4)
|| !cmdparams[1].Equals("base"))
{
m_log.Info("[WIND] Invalid parameters to change parameters for Wind module base, usage: wind base <parameter> <value>");
MainConsole.Instance.Output(
"Invalid parameters to change parameters for Wind module base, usage: wind base <parameter> <value>");
return;
}
@ -261,7 +265,9 @@ namespace OpenSim.Region.CoreModules
}
else
{
m_log.InfoFormat("[WIND] Invalid value {0} specified for {1}", cmdparams[3], cmdparams[2]);
MainConsole.Instance.OutputFormat(
"Invalid value {0} specified for {1}", cmdparams[3], cmdparams[2]);
return;
}
@ -271,22 +277,23 @@ namespace OpenSim.Region.CoreModules
if (desiredPlugin.Equals(m_activeWindPlugin.Name))
{
m_log.InfoFormat("[WIND] Wind model plugin {0} is already active", cmdparams[3]);
MainConsole.Instance.OutputFormat("Wind model plugin {0} is already active", cmdparams[3]);
return;
}
if (m_availableWindPlugins.ContainsKey(desiredPlugin))
{
m_activeWindPlugin = m_availableWindPlugins[cmdparams[3]];
m_log.InfoFormat("[WIND] {0} wind model plugin now active", m_activeWindPlugin.Name);
MainConsole.Instance.OutputFormat("{0} wind model plugin now active", m_activeWindPlugin.Name);
}
else
{
m_log.InfoFormat("[WIND] Could not find wind model plugin {0}", desiredPlugin);
MainConsole.Instance.OutputFormat("Could not find wind model plugin {0}", desiredPlugin);
}
break;
}
}
/// <summary>
@ -300,7 +307,7 @@ namespace OpenSim.Region.CoreModules
if ((cmdparams.Length != 4)
&& (cmdparams.Length != 3))
{
m_log.Info("[WIND] Usage: wind <plugin> <param> [value]");
MainConsole.Instance.Output("Usage: wind <plugin> <param> [value]");
return;
}
@ -311,16 +318,17 @@ namespace OpenSim.Region.CoreModules
{
if (!float.TryParse(cmdparams[3], out value))
{
m_log.InfoFormat("[WIND] Invalid value {0}", cmdparams[3]);
MainConsole.Instance.OutputFormat("Invalid value {0}", cmdparams[3]);
}
try
{
WindParamSet(plugin, param, value);
MainConsole.Instance.OutputFormat("{0} set to {1}", param, value);
}
catch (Exception e)
{
m_log.InfoFormat("[WIND] {0}", e.Message);
MainConsole.Instance.OutputFormat("{0}", e.Message);
}
}
else
@ -328,11 +336,11 @@ namespace OpenSim.Region.CoreModules
try
{
value = WindParamGet(plugin, param);
m_log.InfoFormat("[WIND] {0} : {1}", param, value);
MainConsole.Instance.OutputFormat("{0} : {1}", param, value);
}
catch (Exception e)
{
m_log.InfoFormat("[WIND] {0}", e.Message);
MainConsole.Instance.OutputFormat("{0}", e.Message);
}
}
@ -366,13 +374,11 @@ namespace OpenSim.Region.CoreModules
{
IWindModelPlugin windPlugin = m_availableWindPlugins[plugin];
windPlugin.WindParamSet(param, value);
m_log.InfoFormat("[WIND] {0} set to {1}", param, value);
}
else
{
throw new Exception(String.Format("Could not find plugin {0}", plugin));
}
}
public float WindParamGet(string plugin, string param)

View File

@ -1,9 +1,30 @@
////////////////////////////////////////////////////////////////
//
// (c) 2009, 2010 Careminster Limited and Melanie Thielker
//
// All rights reserved
//
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using Nini.Config;
using OpenSim.Framework;

View File

@ -39,16 +39,17 @@ namespace OpenSim.Region.Framework.Interfaces
// These are required to decouple Scenes from EventQueueHelper
void DisableSimulator(ulong handle, UUID avatarID);
void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID);
void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY);
void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint,
string capsPath);
string capsPath, ulong regionHandle, int regionSizeX, int regionSizeY);
void TeleportFinishEvent(ulong regionHandle, byte simAccess,
IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL,
UUID agentID);
UUID agentID, int regionSizeX, int regionSizeY);
void CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt,
IPEndPoint newRegionExternalEndPoint,
string capsURL, UUID avatarID, UUID sessionID);
string capsURL, UUID avatarID, UUID sessionID,
int regionSizeX, int regionSizeY);
void ChatterboxInvitation(UUID sessionID, string sessionName,
UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog,
uint timeStamp, bool offline, int parentEstateID, Vector3 position,

View File

@ -2016,6 +2016,11 @@ namespace OpenSim.Region.Framework.Scenes
GridRegion region = new GridRegion(RegionInfo);
string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
m_log.DebugFormat("{0} RegisterRegionWithGrid. name={1},id={2},loc=<{3},{4}>,size=<{5},{6}>",
LogHeader, m_regionName,
RegionInfo.RegionID,
RegionInfo.RegionLocX, RegionInfo.RegionLocY,
RegionInfo.RegionSizeX, RegionInfo.RegionSizeY);
if (error != String.Empty)
throw new Exception(error);
}

View File

@ -42,7 +42,8 @@ namespace OpenSim.Region.Framework.Scenes
{
public abstract class SceneBase : IScene
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected static readonly string LogHeader = "[SCENE]";
#region Events

View File

@ -507,8 +507,6 @@ namespace OpenSim.Region.Framework.Scenes
return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0));
}
private struct avtocrossInfo
{
public ScenePresence av;
@ -660,12 +658,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/* don't see the need but worse don't see where is restored to false if things stay in
foreach (SceneObjectPart part in m_parts.GetArray())
{
part.IgnoreUndoUpdate = true;
}
*/
if (RootPart.GetStatusSandbox())
{
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
@ -751,7 +743,6 @@ namespace OpenSim.Region.Framework.Scenes
}
agent.ParentUUID = UUID.Zero;
// agent.Reset();
// else // Not successful
// agent.RestoreInCurrentScene();

View File

@ -2863,16 +2863,33 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 up = new Vector3((float)x, (float)y, (float)z);
Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f;
m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT;
Vector3 newPos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT;
Quaternion newRot;
if (part.IsRoot)
{
newRot = sitTargetOrient;
}
else
{
newPos = newPos * part.RotationOffset;
newRot = part.RotationOffset * sitTargetOrient;
}
newPos += part.OffsetPosition;
m_pos = newPos;
Rotation = newRot;
// m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset;
Rotation = sitTargetOrient;
// ParentPosition = part.AbsolutePosition;
part.ParentGroup.AddAvatar(UUID);
}
else
{
m_pos -= part.AbsolutePosition;
// An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is
// being sat upon.
m_pos -= part.GroupPosition;
// ParentPosition = part.AbsolutePosition;
part.ParentGroup.AddAvatar(UUID);

View File

@ -111,15 +111,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
// We need to preserve this here because phys actor is removed by the sit.
Vector3 spPhysActorSize = m_sp.PhysicsActor.Size;
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
// FIXME: This is different for live avatars - z position is adjusted. This is half the height of the
// default avatar.
// Curiously, Vector3.ToString() will not display the last two places of the float. For example,
// printing out npc.AbsolutePosition will give <0, 0, 0.8454993> not <0, 0, 0.845499337>
Assert.That(
m_sp.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f)));
Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, spPhysActorSize.Z / 2)));
m_sp.StandUp();
@ -147,9 +145,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(part.SitTargetAvatar, Is.EqualTo(m_sp.UUID));
Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
Assert.That(
m_sp.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
// Assert.That(
// m_sp.AbsolutePosition,
// Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
Assert.That(m_sp.PhysicsActor, Is.Null);
Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));

View File

@ -177,9 +177,18 @@ namespace OpenSim.Region.Framework.Scenes
if (part.ParticleSystem.Length > 0)
{
Primitive.ParticleSystem ps = new Primitive.ParticleSystem(part.ParticleSystem, 0);
if (ps.Texture != UUID.Zero)
assetUuids[ps.Texture] = AssetType.Texture;
try
{
Primitive.ParticleSystem ps = new Primitive.ParticleSystem(part.ParticleSystem, 0);
if (ps.Texture != UUID.Zero)
assetUuids[ps.Texture] = AssetType.Texture;
}
catch (Exception e)
{
m_log.WarnFormat(
"[UUID GATHERER]: Could not check particle system for part {0} {1} in object {2} {3} since it is corrupt. Continuing.",
part.Name, part.UUID, sceneObject.Name, sceneObject.UUID);
}
}
TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();

View File

@ -26,13 +26,23 @@
*/
using System;
using System.Collections;
using System.Net;
using System.Reflection;
using Nini.Config;
using NUnit.Framework;
using OpenMetaverse;
using OpenMetaverse.Messages.Linden;
using OpenMetaverse.Packets;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.ClientStack.Linden;
using OpenSim.Region.CoreModules.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
@ -44,11 +54,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
[TestFixture]
public class GroupsModuleTests : OpenSimTestCase
{
[SetUp]
public override void SetUp()
{
base.SetUp();
uint port = 9999;
uint sslPort = 9998;
// This is an unfortunate bit of clean up we have to do because MainServer manages things through static
// variables and the VM is not restarted between tests.
MainServer.RemoveHttpServer(port);
BaseHttpServer server = new BaseHttpServer(port, false, sslPort, "");
MainServer.AddHttpServer(server);
MainServer.Instance = server;
}
[Test]
public void TestBasic()
public void TestSendAgentGroupDataUpdate()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
// TestHelpers.EnableLogging();
TestScene scene = new SceneHelpers().SetupScene();
IConfigSource configSource = new IniConfigSource();
@ -56,8 +83,40 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
config.Set("Enabled", true);
config.Set("Module", "GroupsModule");
config.Set("DebugEnabled", true);
GroupsModule gm = new GroupsModule();
EventQueueGetModule eqgm = new EventQueueGetModule();
// We need a capabilities module active so that adding the scene presence creates an event queue in the
// EventQueueGetModule
SceneHelpers.SetupSceneModules(
scene, configSource, new object[] { new MockGroupsServicesConnector() });
scene, configSource, gm, new MockGroupsServicesConnector(), new CapabilitiesModule(), eqgm);
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseStem("1"));
gm.SendAgentGroupDataUpdate(sp.ControllingClient);
Hashtable eventsResponse = eqgm.GetEvents(UUID.Zero, sp.UUID);
Assert.That((int)eventsResponse["int_response_code"], Is.EqualTo((int)HttpStatusCode.OK));
// Console.WriteLine("Response [{0}]", (string)eventsResponse["str_response_string"]);
OSDMap rawOsd = (OSDMap)OSDParser.DeserializeLLSDXml((string)eventsResponse["str_response_string"]);
OSDArray eventsOsd = (OSDArray)rawOsd["events"];
bool foundUpdate = false;
foreach (OSD osd in eventsOsd)
{
OSDMap eventOsd = (OSDMap)osd;
if (eventOsd["message"] == "AgentGroupDataUpdate")
foundUpdate = true;
}
Assert.That(foundUpdate, Is.True, "Did not find AgentGroupDataUpdate in response");
// TODO: More checking of more actual event data.
}
}
}

View File

@ -216,9 +216,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
// m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
// m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
// Warn level because the region cannot be used while logins are disabled
m_log.WarnFormat(
"[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name);
// Putting this out to console to make it eye-catching for people who are running OpenSimulator
// without info log messages enabled. Making this a warning is arguably misleading since it isn't a
// warning, and monitor scripts looking for warn/error/fatal messages will received false positives.
// Arguably, log4net needs a status log level (like Apache).
MainConsole.Instance.OutputFormat("INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name);
}
m_scene.SceneGridService.InformNeighborsThatRegionisUp(

View File

@ -321,9 +321,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
Assert.That(
npc.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
// Assert.That(
// npc.AbsolutePosition,
// Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
m_npcMod.Stand(npc.UUID, m_scene);
@ -335,7 +335,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
public void TestSitAndStandWithNoSitTarget()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
// TestHelpers.EnableLogging();
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
@ -353,13 +353,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
// FIXME: This is different for live avatars - z position is adjusted. This is half the height of the
// default avatar.
// Curiously, Vector3.ToString() will not display the last two places of the float. For example,
// printing out npc.AbsolutePosition will give <0, 0, 0.8454993> not <0, 0, 0.845499337>
// We should really be using the NPC size but this would mean preserving the physics actor since it is
// removed on sit.
Assert.That(
npc.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f)));
Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, sp.PhysicsActor.Size.Z / 2)));
m_npcMod.Stand(npc.UUID, m_scene);

View File

@ -118,14 +118,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
public override Vector3 Position { get; set; }
public override Vector3 Size
{
get { return _size; }
set {
_size = value;
_size.Z = _size.Z / 2.0f;
}
}
public override Vector3 Size { get; set; }
public override PrimitiveBaseShape Shape
{

View File

@ -47,6 +47,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
TestCompile("default { bad() {} }", true);
}
[Test]
public void TestAttachEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestKeyArgEvent("attach");
}
[Test]
public void TestObjectRezEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestKeyArgEvent("object_rez");
}
[Test]
public void TestMovingEndEvent()
{
@ -242,6 +260,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
TestVectorArgEvent("land_collision_end");
}
[Test]
public void TestAtRotTargetEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestIntRotRotArgEvent("at_rot_target");
}
[Test]
public void TestAtTargetEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestIntVecVecArgEvent("at_target");
}
[Test]
public void TestControlEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
TestKeyIntIntArgEvent("control");
}
private void TestIntArgEvent(string eventName)
{
@ -251,6 +295,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
TestCompile("default { " + eventName + "(integer n, integer o) {{}} }", true);
}
private void TestKeyArgEvent(string eventName)
{
TestCompile("default { " + eventName + "(key k) {} }", false);
TestCompile("default { " + eventName + "{{}} }", true);
TestCompile("default { " + eventName + "(string s) {{}} }", true);
TestCompile("default { " + eventName + "(key k, key l) {{}} }", true);
}
private void TestVectorArgEvent(string eventName)
{
TestCompile("default { " + eventName + "(vector v) {} }", false);
@ -259,6 +311,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
TestCompile("default { " + eventName + "(vector v, vector w) {{}} }", true);
}
private void TestIntRotRotArgEvent(string eventName)
{
TestCompile("default { " + eventName + "(integer n, rotation r, rotation s) {} }", false);
TestCompile("default { " + eventName + "{{}} }", true);
TestCompile("default { " + eventName + "(string s) {{}} }", true);
TestCompile("default { " + eventName + "(integer n, rotation r, rotation s, rotation t) {{}} }", true);
}
private void TestIntVecVecArgEvent(string eventName)
{
TestCompile("default { " + eventName + "(integer n, vector v, vector w) {} }", false);
TestCompile("default { " + eventName + "{{}} }", true);
TestCompile("default { " + eventName + "(string s) {{}} }", true);
TestCompile("default { " + eventName + "(integer n, vector v, vector w, vector x) {{}} }", true);
}
private void TestKeyIntIntArgEvent(string eventName)
{
TestCompile("default { " + eventName + "(key k, integer n, integer o) {} }", false);
TestCompile("default { " + eventName + "{{}} }", true);
TestCompile("default { " + eventName + "(string s) {{}} }", true);
TestCompile("default { " + eventName + "(key k, integer n, integer o, integer p) {{}} }", true);
}
private void TestCompile(string script, bool expectException)
{
bool gotException = false;

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
{
TestHelpers.InMethod();
string[] ncLines = { "One", "Two", "Three" };
string[] ncLines = { "One", "Twoè", "Three" };
TaskInventoryItem ncItem
= TaskInventoryHelpers.AddNotecard(m_scene, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines));

View File

@ -1827,9 +1827,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public bool GetScriptState(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
if (instance != null)
return instance.Running;
return false;
return instance != null && instance.Running;
}
[DebuggerNonUserCode]
@ -1874,9 +1872,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public DetectParams GetDetectParams(UUID itemID, int idx)
{
IScriptInstance instance = GetInstance(itemID);
if (instance != null)
return instance.GetDetectParams(idx);
return null;
return instance != null ? instance.GetDetectParams(idx) : null;
}
public void SetMinEventDelay(UUID itemID, double delay)
@ -1889,9 +1885,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public UUID GetDetectID(UUID itemID, int idx)
{
IScriptInstance instance = GetInstance(itemID);
if (instance != null)
return instance.GetDetectID(idx);
return UUID.Zero;
return instance != null ? instance.GetDetectID(idx) : UUID.Zero;
}
[DebuggerNonUserCode]
@ -1906,9 +1900,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public int GetStartParameter(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return 0;
return instance.StartParam;
return instance == null ? 0 : instance.StartParam;
}
public void OnShutdown()
@ -1941,9 +1933,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public IScriptApi GetApi(UUID itemID, string name)
{
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return null;
return instance.GetApi(name);
return instance == null ? null : instance.GetApi(name);
}
public void OnGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)

View File

@ -531,9 +531,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
region.RegionName = response["Name"].AsString();
Vector3d minPosition = response["MinPosition"].AsVector3d();
Vector3d maxPosition = response["MaxPosition"].AsVector3d();
region.RegionLocX = (int)minPosition.X;
region.RegionLocY = (int)minPosition.Y;
region.RegionSizeX = (int)maxPosition.X - (int)minPosition.X;
region.RegionSizeY = (int)maxPosition.Y - (int)minPosition.Y;
if ( ! extraData["HyperGrid"] ) {
Uri httpAddress = response["Address"].AsUri();
region.ExternalHostName = httpAddress.Host;

View File

@ -313,8 +313,9 @@ namespace OpenSim.Services.GridService
if (region != null)
{
// Not really? Maybe?
List<RegionData> rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize - 1, region.posY - (int)Constants.RegionSize - 1,
region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID);
List<RegionData> rdatas = m_Database.Get(
region.posX - region.sizeX - 1, region.posY - region.sizeY - 1,
region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID);
foreach (RegionData rdata in rdatas)
{
@ -347,6 +348,11 @@ namespace OpenSim.Services.GridService
return null;
}
// Get a region given its base coordinates.
// NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST
// be the base coordinate of the region.
// The snapping is technically unnecessary but is harmless because regions are always
// multiples of the legacy region size (256).
public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
{
int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize;
@ -441,6 +447,8 @@ namespace OpenSim.Services.GridService
RegionData rdata = new RegionData();
rdata.posX = (int)rinfo.RegionLocX;
rdata.posY = (int)rinfo.RegionLocY;
rdata.sizeX = rinfo.RegionSizeX;
rdata.sizeY = rinfo.RegionSizeY;
rdata.RegionID = rinfo.RegionID;
rdata.RegionName = rinfo.RegionName;
rdata.Data = rinfo.ToKeyValuePairs();
@ -454,6 +462,8 @@ namespace OpenSim.Services.GridService
GridRegion rinfo = new GridRegion(rdata.Data);
rinfo.RegionLocX = rdata.posX;
rinfo.RegionLocY = rdata.posY;
rinfo.RegionSizeX = rdata.sizeX;
rinfo.RegionSizeY = rdata.sizeY;
rinfo.RegionID = rdata.RegionID;
rinfo.RegionName = rdata.RegionName;
rinfo.ScopeID = rdata.ScopeID;

View File

@ -29,9 +29,13 @@ using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using OpenSim.Framework;
using OpenMetaverse;
using log4net;
namespace OpenSim.Services.Interfaces
{
public interface IGridService
@ -119,6 +123,9 @@ namespace OpenSim.Services.Interfaces
public class GridRegion
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string LogHeader = "[GRID REGION]";
/// <summary>
/// The port by which http communication occurs with the region
/// </summary>
@ -177,6 +184,7 @@ namespace OpenSim.Services.Interfaces
/// <summary>
/// The location of this region in meters.
/// DANGER DANGER! Note that this name means something different in RegionInfo.
/// </summary>
public int RegionLocX
{
@ -185,8 +193,12 @@ namespace OpenSim.Services.Interfaces
}
protected int m_regionLocX;
public int RegionSizeX { get; set; }
public int RegionSizeY { get; set; }
/// <summary>
/// The location of this region in meters.
/// DANGER DANGER! Note that this name means something different in RegionInfo.
/// </summary>
public int RegionLocY
{
@ -215,13 +227,18 @@ namespace OpenSim.Services.Interfaces
public GridRegion()
{
RegionSizeX = (int)Constants.RegionSize;
RegionSizeY = (int)Constants.RegionSize;
m_serverURI = string.Empty;
}
/*
public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)
{
m_regionLocX = regionLocX;
m_regionLocY = regionLocY;
RegionSizeX = (int)Constants.RegionSize;
RegionSizeY = (int)Constants.RegionSize;
m_internalEndPoint = internalEndPoint;
m_externalHostName = externalUri;
@ -231,16 +248,21 @@ namespace OpenSim.Services.Interfaces
{
m_regionLocX = regionLocX;
m_regionLocY = regionLocY;
RegionSizeX = (int)Constants.RegionSize;
RegionSizeY = (int)Constants.RegionSize;
m_externalHostName = externalUri;
m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port);
}
*/
public GridRegion(uint xcell, uint ycell)
{
m_regionLocX = (int)(xcell * Constants.RegionSize);
m_regionLocY = (int)(ycell * Constants.RegionSize);
RegionSizeX = (int)Constants.RegionSize;
RegionSizeY = (int)Constants.RegionSize;
}
public GridRegion(RegionInfo ConvertFrom)
@ -248,6 +270,8 @@ namespace OpenSim.Services.Interfaces
m_regionName = ConvertFrom.RegionName;
m_regionLocX = (int)(ConvertFrom.RegionLocX * Constants.RegionSize);
m_regionLocY = (int)(ConvertFrom.RegionLocY * Constants.RegionSize);
RegionSizeX = (int)ConvertFrom.RegionSizeX;
RegionSizeY = (int)ConvertFrom.RegionSizeY;
m_internalEndPoint = ConvertFrom.InternalEndPoint;
m_externalHostName = ConvertFrom.ExternalHostName;
m_httpPort = ConvertFrom.HttpPort;
@ -266,6 +290,8 @@ namespace OpenSim.Services.Interfaces
m_regionName = ConvertFrom.RegionName;
m_regionLocX = ConvertFrom.RegionLocX;
m_regionLocY = ConvertFrom.RegionLocY;
RegionSizeX = ConvertFrom.RegionSizeX;
RegionSizeY = ConvertFrom.RegionSizeY;
m_internalEndPoint = ConvertFrom.InternalEndPoint;
m_externalHostName = ConvertFrom.ExternalHostName;
m_httpPort = ConvertFrom.HttpPort;
@ -377,6 +403,8 @@ namespace OpenSim.Services.Interfaces
kvp["uuid"] = RegionID.ToString();
kvp["locX"] = RegionLocX.ToString();
kvp["locY"] = RegionLocY.ToString();
kvp["sizeX"] = RegionSizeX.ToString();
kvp["sizeY"] = RegionSizeY.ToString();
kvp["regionName"] = RegionName;
kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString();
kvp["serverHttpPort"] = HttpPort.ToString();
@ -403,6 +431,16 @@ namespace OpenSim.Services.Interfaces
if (kvp.ContainsKey("locY"))
RegionLocY = Convert.ToInt32((string)kvp["locY"]);
if (kvp.ContainsKey("sizeX"))
RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]);
else
RegionSizeX = (int)Constants.RegionSize;
if (kvp.ContainsKey("sizeY"))
RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]);
else
RegionSizeX = (int)Constants.RegionSize;
if (kvp.ContainsKey("regionName"))
RegionName = (string)kvp["regionName"];
@ -456,6 +494,9 @@ namespace OpenSim.Services.Interfaces
if (kvp.ContainsKey("Token"))
Token = kvp["Token"].ToString();
// m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>",
// LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY);
}
}
}

View File

@ -261,11 +261,11 @@ namespace OpenSim.Services.LLLoginService
Currency = currency;
ClassifiedFee = classifiedFee;
FillOutHomeData(pinfo, home);
LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z);
FillOutRegionData(destination);
// m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX=<{0},{1}>", RegionSizeX, RegionSizeY);
FillOutSeedCap(aCircuit, destination, clientIP);
@ -392,6 +392,8 @@ namespace OpenSim.Services.LLLoginService
SimPort = (uint)endPoint.Port;
RegionX = (uint)destination.RegionLocX;
RegionY = (uint)destination.RegionLocY;
RegionSizeX = destination.RegionSizeX;
RegionSizeY = destination.RegionSizeY;
}
private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient)
@ -539,6 +541,9 @@ namespace OpenSim.Services.LLLoginService
responseData["message"] = welcomeMessage;
responseData["region_x"] = (Int32)(RegionX);
responseData["region_y"] = (Int32)(RegionY);
responseData["region_size_x"] = (Int32)RegionSizeX;
responseData["region_size_y"] = (Int32)RegionSizeY;
// m_log.DebugFormat("[LOGIN RESPONSE] returning sizeX=<{0},{1}>", RegionSizeX, RegionSizeY);
if (searchURL != String.Empty)
responseData["search"] = searchURL;
@ -935,6 +940,9 @@ namespace OpenSim.Services.LLLoginService
set { regionY = value; }
}
public int RegionSizeX { get; private set; }
public int RegionSizeY { get; private set; }
public string SunTexture
{
get { return sunTexture; }

View File

@ -50,6 +50,8 @@ namespace OpenSim.Services.LLLoginService
public class LLLoginService : ILoginService
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string LogHeader = "[LLOGIN SERVICE]";
private static bool Initialized = false;
protected IUserAccountService m_UserAccountService;
@ -397,6 +399,7 @@ namespace OpenSim.Services.LLLoginService
if (guinfo == null)
{
// something went wrong, make something up, so that we don't have to test this anywhere else
m_log.DebugFormat("{0} Failed to fetch GridUserInfo. Creating empty GridUserInfo as home", LogHeader);
guinfo = new GridUserInfo();
guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30);
}

View File

@ -37,6 +37,7 @@ using OpenSim.Data;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Services.UserAccountService;
namespace OpenSim.Services.ProfilesService
{
@ -163,6 +164,78 @@ namespace OpenSim.Services.ProfilesService
}
#endregion Interests
#region User Preferences
public bool UserPreferencesUpdate(ref UserPreferences pref, ref string result)
{
if(string.IsNullOrEmpty(pref.EMail))
{
UserAccount account = new UserAccount();
if(userAccounts is UserAccountService.UserAccountService)
{
try
{
account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId);
if(string.IsNullOrEmpty(account.Email))
{
result = "No Email address on record!";
return false;
}
else
pref.EMail = account.Email;
}
catch
{
m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account");
result = "Missing Email address!";
return false;
}
}
else
{
m_log.Info ("[PROFILES]: UserAccountService: Could not get user account");
result = "Missing Email address!";
return false;
}
}
return ProfilesData.UpdateUserPreferences(ref pref, ref result);
}
public bool UserPreferencesRequest(ref UserPreferences pref, ref string result)
{
if(string.IsNullOrEmpty(pref.EMail))
{
UserAccount account = new UserAccount();
if(userAccounts is UserAccountService.UserAccountService)
{
try
{
account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId);
if(string.IsNullOrEmpty(account.Email))
{
result = "No Email address on record!";
return false;
}
else
pref.EMail = account.Email;
}
catch
{
m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account");
result = "Missing Email address!";
return false;
}
}
else
{
m_log.Info ("[PROFILES]: UserAccountService: Could not get user account");
result = "Missing Email address!";
return false;
}
}
return ProfilesData.GetUserPreferences(ref pref, ref result);
}
#endregion User Preferences
#region Utility
public OSD AvatarImageAssetsRequest(UUID avatarId)
{

View File

@ -38,6 +38,7 @@ using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
using OpenSim.Region.ClientStack.Linden;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
@ -113,22 +114,25 @@ namespace OpenSim.Tests.Common
AddEvent(avatarID, "DisableSimulator", handle);
}
public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID)
public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY)
{
AddEvent(avatarID, "EnableSimulator", handle);
}
public void EstablishAgentCommunication (UUID avatarID, IPEndPoint endPoint, string capsPath)
public void EstablishAgentCommunication (UUID avatarID, IPEndPoint endPoint, string capsPath,
ulong regionHandle, int regionSizeX, int regionSizeY)
{
AddEvent(avatarID, "EstablishAgentCommunication", endPoint, capsPath);
}
public void TeleportFinishEvent (ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL, UUID agentID)
public void TeleportFinishEvent (ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL, UUID agentID, int regionSizeX, int regionSizeY)
{
AddEvent(agentID, "TeleportFinishEvent", regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL);
}
public void CrossRegion (ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL, UUID avatarID, UUID sessionID)
public void CrossRegion (ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint,
string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY)
{
AddEvent(avatarID, "CrossRegion", handle, pos, lookAt, newRegionExternalEndPoint, capsURL, sessionID);
}
@ -164,7 +168,7 @@ namespace OpenSim.Tests.Common
throw new System.NotImplementedException ();
}
public OSD BuildEvent (string eventName, OSD eventBody)
public OSD BuildEvent(string eventName, OSD eventBody)
{
Console.WriteLine("TWO");
throw new System.NotImplementedException ();

View File

@ -2964,8 +2964,9 @@
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.ClientStack.LindenCaps"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.OptionalModules"/>
<Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="OpenSim.Region.ScriptEngine.Shared"/>
@ -3325,6 +3326,7 @@
<Reference name="System.Drawing"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Serialization"/>
@ -3333,6 +3335,7 @@
<Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Region.ClientStack.LindenCaps"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.Framework.Interfaces"/>
<Reference name="OpenSim.Region.CoreModules"/>