Merge branch 'master' into careminster

Conflicts:
	OpenSim/Data/MySQL/MySQLSimulationData.cs
	OpenSim/Data/MySQL/Resources/RegionStore.migrations
	OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
	OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
	OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
	OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
	OpenSim/Region/Framework/Scenes/Scene.cs
	OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
avinationmerge
Melanie 2012-05-27 19:24:30 +01:00
commit 884c0e7bb1
55 changed files with 2382 additions and 984 deletions

View File

@ -146,6 +146,7 @@ what it is today.
* Stefan_Boom / stoehr
* Strawberry Fride
* Talun
* TechplexEngineer (Blake Bourque)
* TBG Renfold
* tglion
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)

View File

@ -0,0 +1,68 @@
/*
* 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 System.Collections.Generic;
using OpenMetaverse;
namespace OpenSim.Framework.Capabilities
{
[OSDMap]
public class LLSDEnvironmentRequest
{
public UUID messageID;
public UUID regionID;
}
[OSDMap]
public class LLSDEnvironmentSetResponse
{
public UUID regionID;
public UUID messageID;
public Boolean success;
public String fail_reason;
}
public class EnvironmentSettings
{
/// <summary>
/// generates a empty llsd settings response for viewer
/// </summary>
/// <param name="messageID">the message UUID</param>
/// <param name="regionID">the region UUID</param>
public static string EmptySettings(UUID messageID, UUID regionID)
{
OSDArray arr = new OSDArray();
LLSDEnvironmentRequest msg = new LLSDEnvironmentRequest();
msg.messageID = messageID;
msg.regionID = regionID;
arr.Array.Add(msg);
return LLSDHelpers.SerialiseLLSDReply(arr);
}
}
}

View File

@ -1181,6 +1181,72 @@ VALUES
// }
#endregion
}
#region Environment Settings
public string LoadRegionEnvironmentSettings(UUID regionUUID)
{
string sql = "select * from [regionenvironment] where region_id = @region_id";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID));
conn.Open();
using (SqlDataReader result = cmd.ExecuteReader())
{
if (!result.Read())
{
return String.Empty;
}
else
{
return Convert.ToString(result["llsd_settings"]);
}
}
}
}
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
{
{
string sql = "DELETE FROM [regionenvironment] WHERE region_id = @region_id";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID));
conn.Open();
cmd.ExecuteNonQuery();
}
sql = "INSERT INTO [regionenvironment] (region_id, llsd_settings) VALUES (@region_id, @llsd_settings)";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID));
cmd.Parameters.Add(_Database.CreateParameter("@llsd_settings", settings));
conn.Open();
cmd.ExecuteNonQuery();
}
}
}
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
{
string sql = "delete from [regionenvironment] where region_id = @region_id";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID));
conn.Open();
cmd.ExecuteNonQuery();
}
}
#endregion
/// <summary>
/// Loads the settings of a region.
/// </summary>

View File

@ -1134,3 +1134,17 @@ ALTER TABLE landaccesslist ADD Expires integer NOT NULL DEFAULT 0;
COMMIT
:VERSION 37 #---------------- Environment Settings
BEGIN TRANSACTION
CREATE TABLE [dbo].[regionenvironment](
[region_id] [uniqueidentifier] NOT NULL,
[llsd_settings] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
PRIMARY KEY CLUSTERED
(
[region_id] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
COMMIT

View File

@ -994,6 +994,68 @@ namespace OpenSim.Data.MySQL
}
}
#region RegionEnvironmentSettings
public string LoadRegionEnvironmentSettings(UUID regionUUID)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
string command = "select * from `regionenvironment` where region_id = ?region_id";
using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Connection = dbcon;
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
IDataReader result = ExecuteReader(cmd);
if (!result.Read())
{
return String.Empty;
}
else
{
return Convert.ToString(result["llsd_settings"]);
}
}
}
}
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
cmd.Parameters.AddWithValue("region_id", regionUUID);
cmd.Parameters.AddWithValue("llsd_settings", settings);
ExecuteNonQuery(cmd);
}
}
}
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
ExecuteNonQuery(cmd);
}
}
}
#endregion
public virtual void StoreRegionSettings(RegionSettings rs)
{
lock (m_dbLock)

View File

@ -883,3 +883,15 @@ ALTER TABLE `regionsettings` MODIFY COLUMN `TelehubObject` VARCHAR(36) NOT NULL
COMMIT;
:VERSION 44 #--------------------- Environment Settings
BEGIN;
CREATE TABLE `regionenvironment` (
`region_id` varchar(36) NOT NULL,
`llsd_settings` TEXT NOT NULL,
PRIMARY KEY (`region_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT;

View File

@ -76,9 +76,27 @@ namespace OpenSim.Data.Null
//This connector doesn't support the windlight module yet
}
#region Environment Settings
public string LoadRegionEnvironmentSettings(UUID regionUUID)
{
//This connector doesn't support the Environment module yet
return string.Empty;
}
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
{
//This connector doesn't support the Environment module yet
}
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
{
//This connector doesn't support the Environment module yet
}
#endregion
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
RegionSettings rs = new RegionSettings();
{
RegionSettings rs = new RegionSettings();
rs.RegionUUID = regionUUID;
return rs;
}

View File

@ -564,3 +564,14 @@ COMMIT;
BEGIN;
ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT;
:VERSION 26
BEGIN;
CREATE TABLE `regionenvironment` (
`region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000' PRIMARY KEY,
`llsd_settings` TEXT NOT NULL
);
COMMIT;

View File

@ -61,6 +61,7 @@ namespace OpenSim.Data.SQLite
private const string regionbanListSelect = "select * from regionban";
private const string regionSettingsSelect = "select * from regionsettings";
private const string regionWindlightSelect = "select * from regionwindlight";
private const string regionEnvironmentSelect = "select * from regionenvironment";
private const string regionSpawnPointsSelect = "select * from spawn_points";
private DataSet ds;
@ -72,6 +73,7 @@ namespace OpenSim.Data.SQLite
private SqliteDataAdapter landAccessListDa;
private SqliteDataAdapter regionSettingsDa;
private SqliteDataAdapter regionWindlightDa;
private SqliteDataAdapter regionEnvironmentDa;
private SqliteDataAdapter regionSpawnPointsDa;
private SqliteConnection m_conn;
@ -146,6 +148,9 @@ namespace OpenSim.Data.SQLite
SqliteCommand regionWindlightSelectCmd = new SqliteCommand(regionWindlightSelect, m_conn);
regionWindlightDa = new SqliteDataAdapter(regionWindlightSelectCmd);
SqliteCommand regionEnvironmentSelectCmd = new SqliteCommand(regionEnvironmentSelect, m_conn);
regionEnvironmentDa = new SqliteDataAdapter(regionEnvironmentSelectCmd);
SqliteCommand regionSpawnPointsSelectCmd = new SqliteCommand(regionSpawnPointsSelect, m_conn);
regionSpawnPointsDa = new SqliteDataAdapter(regionSpawnPointsSelectCmd);
@ -179,6 +184,9 @@ namespace OpenSim.Data.SQLite
ds.Tables.Add(createRegionWindlightTable());
setupRegionWindlightCommands(regionWindlightDa, m_conn);
ds.Tables.Add(createRegionEnvironmentTable());
setupRegionEnvironmentCommands(regionEnvironmentDa, m_conn);
ds.Tables.Add(createRegionSpawnPointsTable());
setupRegionSpawnPointsCommands(regionSpawnPointsDa, m_conn);
@ -258,6 +266,15 @@ namespace OpenSim.Data.SQLite
m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionwindlight table :{0}", e.Message);
}
try
{
regionEnvironmentDa.Fill(ds.Tables["regionenvironment"]);
}
catch (Exception e)
{
m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionenvironment table :{0}", e.Message);
}
try
{
regionSpawnPointsDa.Fill(ds.Tables["spawn_points"]);
@ -278,12 +295,13 @@ namespace OpenSim.Data.SQLite
CreateDataSetMapping(landAccessListDa, "landaccesslist");
CreateDataSetMapping(regionSettingsDa, "regionsettings");
CreateDataSetMapping(regionWindlightDa, "regionwindlight");
CreateDataSetMapping(regionEnvironmentDa, "regionenvironment");
CreateDataSetMapping(regionSpawnPointsDa, "spawn_points");
}
}
catch (Exception e)
{
m_log.ErrorFormat("[SQLITE REGION DB]: ", e);
m_log.ErrorFormat("[SQLITE REGION DB]: {0} - {1}", e.Message, e.StackTrace);
Environment.Exit(23);
}
return;
@ -341,6 +359,11 @@ namespace OpenSim.Data.SQLite
regionWindlightDa.Dispose();
regionWindlightDa = null;
}
if (regionEnvironmentDa != null)
{
regionEnvironmentDa.Dispose();
regionEnvironmentDa = null;
}
if (regionSpawnPointsDa != null)
{
regionSpawnPointsDa.Dispose();
@ -474,6 +497,63 @@ namespace OpenSim.Data.SQLite
}
}
#region Region Environment Settings
public string LoadRegionEnvironmentSettings(UUID regionUUID)
{
lock (ds)
{
DataTable environmentTable = ds.Tables["regionenvironment"];
DataRow row = environmentTable.Rows.Find(regionUUID.ToString());
if (row == null)
{
return String.Empty;
}
return (String)row["llsd_settings"];
}
}
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
{
lock (ds)
{
DataTable environmentTable = ds.Tables["regionenvironment"];
DataRow row = environmentTable.Rows.Find(regionUUID.ToString());
if (row == null)
{
row = environmentTable.NewRow();
row["region_id"] = regionUUID.ToString();
row["llsd_settings"] = settings;
environmentTable.Rows.Add(row);
}
else
{
row["llsd_settings"] = settings;
}
regionEnvironmentDa.Update(ds, "regionenvironment");
}
}
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
{
lock (ds)
{
DataTable environmentTable = ds.Tables["regionenvironment"];
DataRow row = environmentTable.Rows.Find(regionUUID.ToString());
if (row != null)
{
row.Delete();
}
regionEnvironmentDa.Update(ds, "regionenvironment");
}
}
#endregion
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
lock (ds)
@ -1430,6 +1510,17 @@ namespace OpenSim.Data.SQLite
return regionwindlight;
}
private static DataTable createRegionEnvironmentTable()
{
DataTable regionEnvironment = new DataTable("regionenvironment");
createCol(regionEnvironment, "region_id", typeof(String));
createCol(regionEnvironment, "llsd_settings", typeof(String));
regionEnvironment.PrimaryKey = new DataColumn[] { regionEnvironment.Columns["region_id"] };
return regionEnvironment;
}
private static DataTable createRegionSpawnPointsTable()
{
DataTable spawn_points = new DataTable("spawn_points");
@ -2691,6 +2782,14 @@ namespace OpenSim.Data.SQLite
da.UpdateCommand.Connection = conn;
}
private void setupRegionEnvironmentCommands(SqliteDataAdapter da, SqliteConnection conn)
{
da.InsertCommand = createInsertCommand("regionenvironment", ds.Tables["regionenvironment"]);
da.InsertCommand.Connection = conn;
da.UpdateCommand = createUpdateCommand("regionenvironment", "region_id=:region_id", ds.Tables["regionenvironment"]);
da.UpdateCommand.Connection = conn;
}
private void setupRegionSpawnPointsCommands(SqliteDataAdapter da, SqliteConnection conn)
{
da.InsertCommand = createInsertCommand("spawn_points", ds.Tables["spawn_points"]);

View File

@ -0,0 +1,112 @@
/*
* 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 System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenSim.Framework.Console
{
/// <summary>
/// Used to generated a formatted table for the console.
/// </summary>
/// <remarks>
/// Currently subject to change. If you use this, be prepared to change your code when this class changes.
/// </remarks>
public class ConsoleDisplayList
{
/// <summary>
/// The default divider between key and value for a list item.
/// </summary>
public const string DefaultKeyValueDivider = " : ";
/// <summary>
/// The divider used between key and value for a list item.
/// </summary>
public string KeyValueDivider { get; set; }
/// <summary>
/// Table rows
/// </summary>
public List<KeyValuePair<string, string>> Rows { get; private set; }
/// <summary>
/// Number of spaces to indent the list.
/// </summary>
public int Indent { get; set; }
public ConsoleDisplayList()
{
Rows = new List<KeyValuePair<string, string>>();
KeyValueDivider = DefaultKeyValueDivider;
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
AddToStringBuilder(sb);
return sb.ToString();
}
public void AddToStringBuilder(StringBuilder sb)
{
string formatString = GetFormatString();
// System.Console.WriteLine("FORMAT STRING [{0}]", formatString);
// rows
foreach (KeyValuePair<string, string> row in Rows)
sb.AppendFormat(formatString, row.Key, row.Value);
}
/// <summary>
/// Gets the format string for the table.
/// </summary>
private string GetFormatString()
{
StringBuilder formatSb = new StringBuilder();
int longestKey = -1;
foreach (KeyValuePair<string, string> row in Rows)
if (row.Key.Length > longestKey)
longestKey = row.Key.Length;
formatSb.Append(' ', Indent);
// Can only do left formatting for now
formatSb.AppendFormat("{{0,-{0}}}{1}{{1}}\n", longestKey, KeyValueDivider);
return formatSb.ToString();
}
public void AddRow(object key, object value)
{
Rows.Add(new KeyValuePair<string, string>(key.ToString(), value.ToString()));
}
}
}

View File

@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console
/// <remarks>
/// Currently subject to change. If you use this, be prepared to change your code when this class changes.
/// </remarks>
public class ConsoleTable
public class ConsoleDisplayTable
{
/// <summary>
/// Default number of spaces between table columns.
@ -48,12 +48,12 @@ namespace OpenSim.Framework.Console
/// <summary>
/// Table columns.
/// </summary>
public List<ConsoleTableColumn> Columns { get; private set; }
public List<ConsoleDisplayTableColumn> Columns { get; private set; }
/// <summary>
/// Table rows
/// </summary>
public List<ConsoleTableRow> Rows { get; private set; }
public List<ConsoleDisplayTableRow> Rows { get; private set; }
/// <summary>
/// Number of spaces to indent the table.
@ -65,11 +65,11 @@ namespace OpenSim.Framework.Console
/// </summary>
public int TableSpacing { get; set; }
public ConsoleTable()
public ConsoleDisplayTable()
{
TableSpacing = DefaultTableSpacing;
Columns = new List<ConsoleTableColumn>();
Rows = new List<ConsoleTableRow>();
Columns = new List<ConsoleDisplayTableColumn>();
Rows = new List<ConsoleDisplayTableRow>();
}
public override string ToString()
@ -88,7 +88,7 @@ namespace OpenSim.Framework.Console
sb.AppendFormat(formatString, Columns.ConvertAll(c => c.Header).ToArray());
// rows
foreach (ConsoleTableRow row in Rows)
foreach (ConsoleDisplayTableRow row in Rows)
sb.AppendFormat(formatString, row.Cells.ToArray());
}
@ -115,23 +115,23 @@ namespace OpenSim.Framework.Console
}
}
public struct ConsoleTableColumn
public struct ConsoleDisplayTableColumn
{
public string Header { get; set; }
public int Width { get; set; }
public ConsoleTableColumn(string header, int width) : this()
public ConsoleDisplayTableColumn(string header, int width) : this()
{
Header = header;
Width = width;
}
}
public struct ConsoleTableRow
public struct ConsoleDisplayTableRow
{
public List<string> Cells { get; private set; }
public ConsoleTableRow(List<string> cells) : this()
public ConsoleDisplayTableRow(List<string> cells) : this()
{
Cells = cells;
}

View File

@ -28,143 +28,252 @@
namespace OpenSim.Framework.Servers.HttpServer
{
/// <summary>
/// HTTP status codes (almost) as defined by W3C in
/// http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
/// HTTP status codes (almost) as defined by W3C in http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html and IETF in http://tools.ietf.org/html/rfc6585
/// </summary>
public enum OSHttpStatusCode: int
public enum OSHttpStatusCode : int
{
// 1xx Informational status codes providing a provisional
// response.
// 100 Tells client that to keep on going sending its request
InfoContinue = 100,
// 101 Server understands request, proposes to switch to different
// application level protocol
InfoSwitchingProtocols = 101,
#region 1xx Informational status codes providing a provisional response.
/// <summary>
/// 100 Tells client that to keep on going sending its request
/// </summary>
InfoContinue = 100,
// 2xx Success codes
// 200 Request successful
SuccessOk = 200,
// 201 Request successful, new resource created
SuccessOkCreated = 201,
// 202 Request accepted, processing still on-going
SuccessOkAccepted = 202,
// 203 Request successful, meta information not authoritative
SuccessOkNonAuthoritativeInformation = 203,
// 204 Request successful, nothing to return in the body
SuccessOkNoContent = 204,
// 205 Request successful, reset displayed content
SuccessOkResetContent = 205,
// 206 Request successful, partial content returned
SuccessOkPartialContent = 206,
/// <summary>
/// 101 Server understands request, proposes to switch to different application level protocol
/// </summary>
InfoSwitchingProtocols = 101,
// 3xx Redirect code: user agent needs to go somewhere else
// 300 Redirect: different presentation forms available, take
// a pick
RedirectMultipleChoices = 300,
// 301 Redirect: requested resource has moved and now lives
// somewhere else
RedirectMovedPermanently = 301,
// 302 Redirect: Resource temporarily somewhere else, location
// might change
RedirectFound = 302,
// 303 Redirect: See other as result of a POST
RedirectSeeOther = 303,
// 304 Redirect: Resource still the same as before
RedirectNotModified = 304,
// 305 Redirect: Resource must be accessed via proxy provided
// in location field
RedirectUseProxy = 305,
// 307 Redirect: Resource temporarily somewhere else, location
// might change
RedirectMovedTemporarily = 307,
#endregion
// 4xx Client error: the client borked the request
// 400 Client error: bad request, server does not grok what
// the client wants
ClientErrorBadRequest = 400,
// 401 Client error: the client is not authorized, response
// provides WWW-Authenticate header field with a challenge
ClientErrorUnauthorized = 401,
// 402 Client error: Payment required (reserved for future use)
ClientErrorPaymentRequired = 402,
// 403 Client error: Server understood request, will not
// deliver, do not try again.
ClientErrorForbidden = 403,
// 404 Client error: Server cannot find anything matching the
// client request.
ClientErrorNotFound = 404,
// 405 Client error: The method specified by the client in the
// request is not allowed for the resource requested
ClientErrorMethodNotAllowed = 405,
// 406 Client error: Server cannot generate suitable response
// for the resource and content characteristics requested by
// the client
ClientErrorNotAcceptable = 406,
// 407 Client error: Similar to 401, Server requests that
// client authenticate itself with the proxy first
ClientErrorProxyAuthRequired = 407,
// 408 Client error: Server got impatient with client and
// decided to give up waiting for the client's request to
// arrive
ClientErrorRequestTimeout = 408,
// 409 Client error: Server could not fulfill the request for
// a resource as there is a conflict with the current state of
// the resource but thinks client can do something about this
ClientErrorConflict = 409,
// 410 Client error: The resource has moved somewhere else,
// but server has no clue where.
ClientErrorGone = 410,
// 411 Client error: The server is picky again and insists on
// having a content-length header field in the request
ClientErrorLengthRequired = 411,
// 412 Client error: one or more preconditions supplied in the
// client's request is false
ClientErrorPreconditionFailed = 412,
// 413 Client error: For fear of reflux, the server refuses to
// swallow that much data.
ClientErrorRequestEntityToLarge = 413,
// 414 Client error: The server considers the Request-URI to
// be indecently long and refuses to even look at it.
ClientErrorRequestURITooLong = 414,
// 415 Client error: The server has no clue about the media
// type requested by the client (contrary to popular belief it
// is not a warez server)
ClientErrorUnsupportedMediaType = 415,
// 416 Client error: The requested range cannot be delivered
// by the server.
#region 2xx Success codes
/// <summary>
/// 200 Request successful
/// </summary>
SuccessOk = 200,
/// <summary>
/// 201 Request successful, new resource created
/// </summary>
SuccessOkCreated = 201,
/// <summary>
/// 202 Request accepted, processing still on-going
/// </summary>
SuccessOkAccepted = 202,
/// <summary>
/// 203 Request successful, meta information not authoritative
/// </summary>
SuccessOkNonAuthoritativeInformation = 203,
/// <summary>
/// 204 Request successful, nothing to return in the body
/// </summary>
SuccessOkNoContent = 204,
/// <summary>
/// 205 Request successful, reset displayed content
/// </summary>
SuccessOkResetContent = 205,
/// <summary>
/// 206 Request successful, partial content returned
/// </summary>
SuccessOkPartialContent = 206,
#endregion
#region 3xx Redirect code: user agent needs to go somewhere else
/// <summary>
/// 300 Redirect: different presentation forms available, take a pick
/// </summary>
RedirectMultipleChoices = 300,
/// <summary>
/// 301 Redirect: requested resource has moved and now lives somewhere else
/// </summary>
RedirectMovedPermanently = 301,
/// <summary>
/// 302 Redirect: Resource temporarily somewhere else, location might change
/// </summary>
RedirectFound = 302,
/// <summary>
/// 303 Redirect: See other as result of a POST
/// </summary>
RedirectSeeOther = 303,
/// <summary>
/// 304 Redirect: Resource still the same as before
/// </summary>
RedirectNotModified = 304,
/// <summary>
/// 305 Redirect: Resource must be accessed via proxy provided in location field
/// </summary>
RedirectUseProxy = 305,
/// <summary>
/// 307 Redirect: Resource temporarily somewhere else, location might change
/// </summary>
RedirectMovedTemporarily = 307,
#endregion
#region 4xx Client error: the client borked the request
/// <summary>
/// 400 Client error: bad request, server does not grok what the client wants
/// </summary>
ClientErrorBadRequest = 400,
/// <summary>
/// 401 Client error: the client is not authorized, response provides WWW-Authenticate header field with a challenge
/// </summary>
ClientErrorUnauthorized = 401,
/// <summary>
/// 402 Client error: Payment required (reserved for future use)
/// </summary>
ClientErrorPaymentRequired = 402,
/// <summary>
/// 403 Client error: Server understood request, will not deliver, do not try again.
ClientErrorForbidden = 403,
/// <summary>
/// 404 Client error: Server cannot find anything matching the client request.
/// </summary>
ClientErrorNotFound = 404,
/// <summary>
/// 405 Client error: The method specified by the client in the request is not allowed for the resource requested
/// </summary>
ClientErrorMethodNotAllowed = 405,
/// <summary>
/// 406 Client error: Server cannot generate suitable response for the resource and content characteristics requested by the client
/// </summary>
ClientErrorNotAcceptable = 406,
/// <summary>
/// 407 Client error: Similar to 401, Server requests that client authenticate itself with the proxy first
/// </summary>
ClientErrorProxyAuthRequired = 407,
/// <summary>
/// 408 Client error: Server got impatient with client and decided to give up waiting for the client's request to arrive
/// </summary>
ClientErrorRequestTimeout = 408,
/// <summary>
/// 409 Client error: Server could not fulfill the request for a resource as there is a conflict with the current state of the resource but thinks client can do something about this
/// </summary>
ClientErrorConflict = 409,
/// <summary>
/// 410 Client error: The resource has moved somewhere else, but server has no clue where.
/// </summary>
ClientErrorGone = 410,
/// <summary>
/// 411 Client error: The server is picky again and insists on having a content-length header field in the request
/// </summary>
ClientErrorLengthRequired = 411,
/// <summary>
/// 412 Client error: one or more preconditions supplied in the client's request is false
/// </summary>
ClientErrorPreconditionFailed = 412,
/// <summary>
/// 413 Client error: For fear of reflux, the server refuses to swallow that much data.
/// </summary>
ClientErrorRequestEntityToLarge = 413,
/// <summary>
/// 414 Client error: The server considers the Request-URI to be indecently long and refuses to even look at it.
/// </summary>
ClientErrorRequestURITooLong = 414,
/// <summary>
/// 415 Client error: The server has no clue about the media type requested by the client (contrary to popular belief it is not a warez server)
/// </summary>
ClientErrorUnsupportedMediaType = 415,
/// <summary>
/// 416 Client error: The requested range cannot be delivered by the server.
/// </summary>
ClientErrorRequestRangeNotSatisfiable = 416,
// 417 Client error: The expectations of the client as
// expressed in one or more Expect header fields cannot be met
// by the server, the server is awfully sorry about this.
ClientErrorExpectationFailed = 417,
// 499 Client error: Wildcard error.
ClientErrorJoker = 499,
// 5xx Server errors (rare)
// 500 Server error: something really strange and unexpected
// happened
ServerErrorInternalError = 500,
// 501 Server error: The server does not do the functionality
// required to carry out the client request. not at
// all. certainly not before breakfast. but also not after
// breakfast.
ServerErrorNotImplemented = 501,
// 502 Server error: While acting as a proxy or a gateway, the
// server got ditched by the upstream server and as a
// consequence regretfully cannot fulfill the client's request
ServerErrorBadGateway = 502,
// 503 Server error: Due to unforseen circumstances the server
// cannot currently deliver the service requested. Retry-After
// header might indicate when to try again.
ServerErrorServiceUnavailable = 503,
// 504 Server error: The server blames the upstream server
// for not being able to deliver the service requested and
// claims that the upstream server is too slow delivering the
// goods.
ServerErrorGatewayTimeout = 504,
// 505 Server error: The server does not support the HTTP
// version conveyed in the client's request.
ServerErrorHttpVersionNotSupported = 505,
/// <summary>
/// 417 Client error: The expectations of the client as expressed in one or more Expect header fields cannot be met by the server, the server is awfully sorry about this.
/// </summary>
ClientErrorExpectationFailed = 417,
/// <summary>
/// 428 Client error :The 428 status code indicates that the origin server requires the request to be conditional.
/// </summary>
ClientErrorPreconditionRequired = 428,
/// <summary>
/// 429 Client error: The 429 status code indicates that the user has sent too many requests in a given amount of time ("rate limiting").
/// </summary>
ClientErrorTooManyRequests = 429,
/// <summary>
/// 431 Client error: The 431 status code indicates that the server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields.
/// </summary>
ClientErrorRequestHeaderFieldsTooLarge = 431,
/// <summary>
/// 499 Client error: Wildcard error.
/// </summary>
ClientErrorJoker = 499,
#endregion
#region 5xx Server errors (rare)
/// <summary>
/// 500 Server error: something really strange and unexpected happened
/// </summary>
ServerErrorInternalError = 500,
/// <summary>
/// 501 Server error: The server does not do the functionality required to carry out the client request. not at all. certainly not before breakfast. but also not after breakfast.
/// </summary>
ServerErrorNotImplemented = 501,
/// <summary>
/// 502 Server error: While acting as a proxy or a gateway, the server got ditched by the upstream server and as a consequence regretfully cannot fulfill the client's request
/// </summary>
ServerErrorBadGateway = 502,
/// <summary>
/// 503 Server error: Due to unforseen circumstances the server cannot currently deliver the service requested. Retry-After header might indicate when to try again.
/// </summary>
ServerErrorServiceUnavailable = 503,
/// <summary>
/// 504 Server error: The server blames the upstream server for not being able to deliver the service requested and claims that the upstream server is too slow delivering the goods.
/// </summary>
ServerErrorGatewayTimeout = 504,
/// <summary>
/// 505 Server error: The server does not support the HTTP version conveyed in the client's request.
/// </summary>
ServerErrorHttpVersionNotSupported = 505,
/// <summary>
/// 511 Server error: The 511 status code indicates that the client needs to authenticate to gain network access.
/// </summary>
ServerErrorNetworkAuthenticationRequired = 511,
#endregion
}
}

View File

@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene;
private IDialogModule m_dialogModule;
private IInventoryAccessModule m_invAccessModule;
/// <summary>
/// Are attachments enabled?
@ -72,7 +72,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public void AddRegion(Scene scene)
{
m_scene = scene;
m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
if (Enabled)
@ -89,7 +88,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
}
public void RegionLoaded(Scene scene) {}
public void RegionLoaded(Scene scene)
{
m_invAccessModule = m_scene.RequestModuleInterface<IInventoryAccessModule>();
}
public void Close()
{
@ -629,6 +631,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
/// <returns>The user inventory item created that holds the attachment.</returns>
private InventoryItemBase AddSceneObjectAsNewAttachmentInInv(IScenePresence sp, SceneObjectGroup grp)
{
if (m_invAccessModule == null)
return null;
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}",
// grp.Name, grp.LocalId, remoteClient.Name);
@ -702,16 +707,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// sets itemID so client can show item as 'attached' in inventory
grp.FromItemID = item.ID;
if (m_scene.AddInventoryItem(item))
{
sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
}
else
{
if (m_dialogModule != null)
m_dialogModule.SendAlertToUser(sp.ControllingClient, "Operation failed");
}
return item;
}
@ -760,76 +755,75 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc)
{
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null)
if (m_invAccessModule == null)
return null;
lock (sp.AttachmentsSyncLock)
{
lock (sp.AttachmentsSyncLock)
SceneObjectGroup objatt;
if (itemID != UUID.Zero)
objatt = m_invAccessModule.RezObject(sp.ControllingClient,
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
false, false, sp.UUID, true);
else
objatt = m_invAccessModule.RezObject(sp.ControllingClient,
null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
false, false, sp.UUID, true);
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}",
// objatt.Name, remoteClient.Name, AttachmentPt);
if (objatt != null)
{
SceneObjectGroup objatt;
if (itemID != UUID.Zero)
objatt = invAccess.RezObject(sp.ControllingClient,
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
false, false, sp.UUID, true);
else
objatt = invAccess.RezObject(sp.ControllingClient,
null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
false, false, sp.UUID, true);
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}",
// objatt.Name, remoteClient.Name, AttachmentPt);
if (objatt != null)
{
// HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller.
objatt.HasGroupChanged = false;
bool tainted = false;
if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint)
tainted = true;
// This will throw if the attachment fails
try
{
AttachObject(sp, objatt, attachmentPt, false);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}",
objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace);
// Make sure the object doesn't stick around and bail
sp.RemoveAttachment(objatt);
m_scene.DeleteSceneObject(objatt, false);
return null;
}
if (tainted)
objatt.HasGroupChanged = true;
if (doc != null)
{
objatt.LoadScriptState(doc);
objatt.ResetOwnerChangeFlag();
}
// HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller.
objatt.HasGroupChanged = false;
bool tainted = false;
if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint)
tainted = true;
// Fire after attach, so we don't get messy perms dialogs
// 4 == AttachedRez
objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4);
objatt.ResumeScripts();
// Do this last so that event listeners have access to all the effects of the attachment
m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID);
return objatt;
}
else
// This will throw if the attachment fails
try
{
m_log.WarnFormat(
"[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
itemID, sp.Name, attachmentPt);
AttachObject(sp, objatt, attachmentPt, false);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}",
objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace);
// Make sure the object doesn't stick around and bail
sp.RemoveAttachment(objatt);
m_scene.DeleteSceneObject(objatt, false);
return null;
}
if (doc != null)
{
objatt.LoadScriptState(doc);
objatt.ResetOwnerChangeFlag();
}
if (tainted)
objatt.HasGroupChanged = true;
// Fire after attach, so we don't get messy perms dialogs
// 4 == AttachedRez
objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4);
objatt.ResumeScripts();
// Do this last so that event listeners have access to all the effects of the attachment
m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID);
return objatt;
}
else
{
m_log.WarnFormat(
"[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
itemID, sp.Name, attachmentPt);
}
}

View File

@ -99,12 +99,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
public void TestAddAttachmentFromGround()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
// TestHelpers.EnableLogging();
AddPresence();
string attName = "att";
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup;
m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false);
@ -123,6 +123,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(
m_presence.Appearance.GetAttachpoint(attSo.FromItemID),
Is.EqualTo((int)AttachmentPoint.Chest));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID));
Assert.That(attachmentItem, Is.Not.Null);
Assert.That(attachmentItem.Name, Is.EqualTo(attName));
InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(m_presence.UUID, AssetType.Object);
Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID));
// TestHelpers.DisableLogging();
}
[Test]

View File

@ -415,12 +415,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override void StoreBackwards(UUID friendID, UUID agentID)
{
Boolean agentIsLocal = true;
Boolean friendIsLocal = true;
bool agentIsLocal = true;
// bool friendIsLocal = true;
if (UserManagementModule != null)
{
agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
// friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
}
// Is the requester a local user?
@ -507,7 +508,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
{
friendUUI = finfo.Friend;
theFriendUUID = friendUUI;
UUID utmp = UUID.Zero; String url = String.Empty; String first = String.Empty, last = String.Empty, tmp = String.Empty;
UUID utmp = UUID.Zero;
string url = String.Empty;
string first = String.Empty;
string last = String.Empty;
// If it's confirming the friendship, we already have the full UUI with the secret
if (Util.ParseUniversalUserIdentifier(theFriendUUID, out utmp, out url, out first, out last, out secret))
{

View File

@ -45,11 +45,11 @@ using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
public class HGEntityTransferModule : EntityTransferModule, ISharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule
public class HGEntityTransferModule
: EntityTransferModule, INonSharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_Initialized = false;
private int m_levelHGTeleport = 0;
private GatekeeperServiceConnector m_GatekeeperConnector;
@ -64,6 +64,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public override void Initialise(IConfigSource source)
{
IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
{
string name = moduleConfig.GetString("EntityTransferModule", "");
@ -82,10 +83,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public override void AddRegion(Scene scene)
{
base.AddRegion(scene);
if (m_Enabled)
{
scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
}
}
protected override void OnNewClient(IClientAPI client)
@ -98,24 +98,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public override void RegionLoaded(Scene scene)
{
base.RegionLoaded(scene);
if (m_Enabled)
if (!m_Initialized)
{
m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
m_Initialized = true;
}
m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
}
public override void RemoveRegion(Scene scene)
{
base.AddRegion(scene);
if (m_Enabled)
{
scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this);
}
}
if (m_Enabled)
scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this);
}
#endregion
@ -123,8 +117,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected override GridRegion GetFinalDestination(GridRegion region)
{
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, region.RegionID);
int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, region.RegionID);
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags);
if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
{
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
@ -135,6 +130,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion to Gatekeeper {0} failed", region.ServerURI);
return real_destination;
}
return region;
}
@ -143,7 +139,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
return true;
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, reg.RegionID);
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
return true;
@ -156,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (logout)
{
// Log them out of this grid
m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
m_scene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
}
}
@ -165,7 +161,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI);
reason = string.Empty;
logout = false;
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, reg.RegionID);
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
{
// this user is going to another grid
@ -210,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
// Let's find out if this is a foreign user or a local user
IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>();
IUserManagement uMan = m_scene.RequestModuleInterface<IUserManagement>();
if (uMan != null && uMan.IsLocalGridUser(id))
{
// local grid user
@ -265,19 +261,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}",
(lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position);
if (lm.Gatekeeper == string.Empty)
{
base.RequestTeleportLandmark(remoteClient, lm);
return;
}
GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
// Local region?
if (info != null)
{
((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
return;
}
else
@ -288,6 +286,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
GridRegion gatekeeper = new GridRegion();
gatekeeper.ServerURI = lm.Gatekeeper;
GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID));
if (finalDestination != null)
{
ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId);
@ -317,8 +316,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
IUserAgentService security = new UserAgentServiceConnector(url);
return security.VerifyClient(aCircuit.SessionID, token);
}
else
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!", aCircuit.firstname, aCircuit.lastname);
else
{
m_log.DebugFormat(
"[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!",
aCircuit.firstname, aCircuit.lastname);
}
return false;
}
@ -335,8 +338,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
// Let's find out if this is a foreign user or a local user
IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>();
UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId);
IUserManagement uMan = m_scene.RequestModuleInterface<IUserManagement>();
// UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, obj.AgentId);
if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
{
// local grid user
@ -359,7 +362,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
#endregion
private GridRegion MakeRegion(AgentCircuitData aCircuit)
{
GridRegion region = new GridRegion();
@ -376,6 +378,5 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
return region;
}
}
}
}

View File

@ -364,8 +364,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
m_log.DebugFormat("[HG INVENTORY ACCESS MODULE]: Changing root inventory for user {0}", client.Name);
InventoryCollection content = m_Scene.InventoryService.GetFolderContent(client.AgentId, root.ID);
List<UUID> fids = new List<UUID>();
List<UUID> iids = new List<UUID>();
List<InventoryFolderBase> keep = new List<InventoryFolderBase>();
foreach (InventoryFolderBase f in content.Folders)
@ -395,4 +394,4 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
#endregion
}
}
}

View File

@ -175,7 +175,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
sbyte assetType,
byte wearableType, uint nextOwnerMask, int creationDate)
{
m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item {0} in folder {1}", name, folderID);
m_log.DebugFormat("[INVENTORY ACCESS MODULE]: Received request to create inventory item {0} in folder {1}", name, folderID);
if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
return;
@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
else
{
m_log.ErrorFormat(
"ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem",
"[INVENTORY ACCESS MODULE]: ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem",
remoteClient.AgentId);
}
}
@ -288,16 +288,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
else
{
m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not find item {0} for caps inventory update",
"[INVENTORY ACCESS MODULE]: Could not find item {0} for caps inventory update",
itemID);
}
return UUID.Zero;
}
public virtual UUID CopyToInventory(DeRezAction action, UUID folderID,
List<SceneObjectGroup> objectGroups, IClientAPI remoteClient)
public virtual List<InventoryItemBase> CopyToInventory(
DeRezAction action, UUID folderID,
List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment)
{
List<InventoryItemBase> copiedItems = new List<InventoryItemBase>();
Dictionary<UUID, List<SceneObjectGroup>> bundlesToCopy = new Dictionary<UUID, List<SceneObjectGroup>>();
if (CoalesceMultipleObjectsToInventory)
@ -324,16 +327,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
}
}
// This is method scoped and will be returned. It will be the
// last created asset id
UUID assetID = UUID.Zero;
// m_log.DebugFormat(
// "[INVENTORY ACCESS MODULE]: Copying {0} object bundles to folder {1} action {2} for {3}",
// bundlesToCopy.Count, folderID, action, remoteClient.Name);
// Each iteration is really a separate asset being created,
// with distinct destinations as well.
foreach (List<SceneObjectGroup> bundle in bundlesToCopy.Values)
assetID = CopyBundleToInventory(action, folderID, bundle, remoteClient);
copiedItems.Add(CopyBundleToInventory(action, folderID, bundle, remoteClient, asAttachment));
return assetID;
return copiedItems;
}
/// <summary>
@ -344,12 +347,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
/// <param name="folderID"></param>
/// <param name="objlist"></param>
/// <param name="remoteClient"></param>
/// <returns></returns>
protected UUID CopyBundleToInventory(
DeRezAction action, UUID folderID, List<SceneObjectGroup> objlist, IClientAPI remoteClient)
/// <param name="asAttachment">Should be true if the bundle is being copied as an attachment. This prevents
/// attempted serialization of any script state which would abort any operating scripts.</param>
/// <returns>The inventory item created by the copy</returns>
protected InventoryItemBase CopyBundleToInventory(
DeRezAction action, UUID folderID, List<SceneObjectGroup> objlist, IClientAPI remoteClient,
bool asAttachment)
{
UUID assetID = UUID.Zero;
CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero);
Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();
@ -401,18 +405,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
string itemXml;
// If we're being called from a script, then trying to serialize that same script's state will not complete
// in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if
// the client/server crashes rather than logging out normally, the attachment's scripts will resume
// without state on relog. Arguably, this is what we want anyway.
if (objlist.Count > 1)
itemXml = CoalescedSceneObjectsSerializer.ToXml(coa);
itemXml = CoalescedSceneObjectsSerializer.ToXml(coa, !asAttachment);
else
itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]);
itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0], !asAttachment);
// Restore the position of each group now that it has been stored to inventory.
foreach (SceneObjectGroup objectGroup in objlist)
objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID];
InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID);
// m_log.DebugFormat(
// "[INVENTORY ACCESS MODULE]: Created item is {0}",
// item != null ? item.ID.ToString() : "NULL");
if (item == null)
return UUID.Zero;
return null;
// Can't know creator is the same, so null it in inventory
if (objlist.Count > 1)
@ -422,7 +435,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
}
else
{
item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
item.CreatorData = objlist[0].RootPart.CreatorData;
item.SaleType = objlist[0].RootPart.ObjectSaleType;
item.SalePrice = objlist[0].RootPart.SalePrice;
}
@ -435,8 +449,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
objlist[0].OwnerID.ToString());
m_Scene.AssetService.Store(asset);
item.AssetID = asset.FullID;
assetID = asset.FullID;
item.AssetID = asset.FullID;
if (DeRezAction.SaveToExistingUserInventoryItem == action)
{
@ -469,9 +482,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// This is a hook to do some per-asset post-processing for subclasses that need that
if (remoteClient != null)
ExportAsset(remoteClient.AgentId, assetID);
ExportAsset(remoteClient.AgentId, asset.FullID);
return assetID;
return item;
}
protected virtual void ExportAsset(UUID agentID, UUID assetID)
@ -617,7 +630,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (null == item)
{
m_log.DebugFormat(
"[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.",
"[INVENTORY ACCESS MODULE]: Object {0} {1} scheduled for save to inventory has already been deleted.",
so.Name, so.UUID);
return null;
@ -668,7 +681,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
// Catch all. Use lost & found
//
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
}
}
@ -718,7 +730,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (item == null)
{
return null;
}
@ -748,7 +759,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
else
{
m_log.WarnFormat(
"[InventoryAccessModule]: Could not find asset {0} for {1} in RezObject()",
"[INVENTORY ACCESS MODULE]: Could not find asset {0} for {1} in RezObject()",
assetID, remoteClient.Name);
}
@ -859,7 +870,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
SceneObjectPart rootPart = group.RootPart;
// m_log.DebugFormat(
// "[InventoryAccessModule]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
// "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
// group.Name, group.LocalId, group.UUID,
// group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask,
// remoteClient.Name);
@ -867,7 +878,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// Vector3 storedPosition = group.AbsolutePosition;
if (group.UUID == UUID.Zero)
{
m_log.Debug("[InventoryAccessModule]: Object has UUID.Zero! Position 3");
m_log.Debug("[INVENTORY ACCESS MODULE]: Object has UUID.Zero! Position 3");
}
foreach (SceneObjectPart part in group.Parts)
@ -928,7 +939,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
}
// m_log.DebugFormat(
// "[InventoryAccessModule]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
// "[INVENTORY ACCESS MODULE]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
// group.Name, group.LocalId, group.UUID,
// group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask,
// remoteClient.Name);
@ -1023,8 +1034,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
so.FromFolderID = item.Folder;
// Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
// m_log.DebugFormat(
// "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
if ((rootPart.OwnerID != item.Owner) ||
(item.CurrentPermissions & 16) != 0 ||
@ -1160,7 +1172,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (assetRequestItem.AssetID != requestID)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
"[INVENTORY ACCESS MODULE]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
Name, requestID, itemID, assetRequestItem.AssetID);
return false;

View File

@ -0,0 +1,224 @@
/*
* 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 System.Reflection;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using log4net;
using Nini.Config;
using Mono.Addins;
using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Region.CoreModules.World.LightShare
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EnvironmentModule")]
public class EnvironmentModule : INonSharedRegionModule, IEnvironmentModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene = null;
private UUID regionID = UUID.Zero;
private static bool Enabled = false;
private static readonly string capsName = "EnvironmentSettings";
private static readonly string capsBase = "/CAPS/0020/";
private LLSDEnvironmentSetResponse setResponse = null;
#region INonSharedRegionModule
public void Initialise(IConfigSource source)
{
IConfig config = source.Configs["ClientStack.LindenCaps"];
if (null == config)
return;
if (config.GetString("Cap_EnvironmentSettings", String.Empty) != "localhost")
{
m_log.InfoFormat("[{0}]: Module is disabled.", Name);
return;
}
Enabled = true;
m_log.InfoFormat("[{0}]: Module is enabled.", Name);
}
public void Close()
{
}
public string Name
{
get { return "EnvironmentModule"; }
}
public Type ReplaceableInterface
{
get { return null; }
}
public void AddRegion(Scene scene)
{
if (!Enabled)
return;
scene.RegisterModuleInterface<IEnvironmentModule>(this);
m_scene = scene;
regionID = scene.RegionInfo.RegionID;
}
public void RegionLoaded(Scene scene)
{
if (!Enabled)
return;
setResponse = new LLSDEnvironmentSetResponse();
scene.EventManager.OnRegisterCaps += OnRegisterCaps;
}
public void RemoveRegion(Scene scene)
{
if (Enabled)
return;
scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
m_scene = null;
}
#endregion
#region IEnvironmentModule
public void ResetEnvironmentSettings(UUID regionUUID)
{
if (!Enabled)
return;
m_scene.SimulationDataService.RemoveRegionEnvironmentSettings(regionUUID);
}
#endregion
#region Events
private void OnRegisterCaps(UUID agentID, Caps caps)
{
// m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}",
// Name, agentID, caps.RegionName);
string capsPath = capsBase + UUID.Random();
// Get handler
caps.RegisterHandler(
capsName,
new RestStreamHandler(
"GET",
capsPath,
(request, path, param, httpRequest, httpResponse)
=> GetEnvironmentSettings(request, path, param, agentID, caps),
capsName,
agentID.ToString()));
// Set handler
caps.HttpListener.AddStreamHandler(
new RestStreamHandler(
"POST",
capsPath,
(request, path, param, httpRequest, httpResponse)
=> SetEnvironmentSettings(request, path, param, agentID, caps),
capsName,
agentID.ToString()));
}
#endregion
private string GetEnvironmentSettings(string request, string path, string param,
UUID agentID, Caps caps)
{
// m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}",
// Name, agentID, caps.RegionName);
string env = String.Empty;
try
{
env = m_scene.SimulationDataService.LoadRegionEnvironmentSettings(regionID);
}
catch (Exception e)
{
m_log.ErrorFormat("[{0}]: Unable to load environment settings for region {1}, Exception: {2} - {3}",
Name, caps.RegionName, e.Message, e.StackTrace);
}
if (String.IsNullOrEmpty(env))
env = EnvironmentSettings.EmptySettings(UUID.Zero, regionID);
return env;
}
private string SetEnvironmentSettings(string request, string path, string param,
UUID agentID, Caps caps)
{
// m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}",
// Name, agentID, caps.RegionName);
setResponse.regionID = regionID;
setResponse.success = false;
if (!m_scene.Permissions.CanIssueEstateCommand(agentID, false))
{
setResponse.fail_reason = "Insufficient estate permissions, settings has not been saved.";
return LLSDHelpers.SerialiseLLSDReply(setResponse);
}
try
{
m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, request);
setResponse.success = true;
m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}",
Name, agentID, caps.RegionName);
}
catch (Exception e)
{
m_log.ErrorFormat("[{0}]: Environment settings has not been saved for region {1}, Exception: {2} - {3}",
Name, caps.RegionName, e.Message, e.StackTrace);
setResponse.success = false;
setResponse.fail_reason = String.Format("Environment Set for region {0} has failed, settings has not been saved.", caps.RegionName);
}
return LLSDHelpers.SerialiseLLSDReply(setResponse);
}
}
}

View File

@ -85,6 +85,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
private IHttpServer m_HttpsServer = null;
private string m_ExternalHostNameForLSL = "";
public string ExternalHostNameForLSL
{
get { return m_ExternalHostNameForLSL; }
}
public Type ReplaceableInterface
{

View File

@ -122,7 +122,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
ISimulationService simService = scene.RequestModuleInterface<ISimulationService>();
IFriendsSimConnector friendsConn = scene.RequestModuleInterface<IFriendsSimConnector>();
Object[] args = new Object[] { m_Config };
IFriendsService friendsService = ServerUtils.LoadPlugin<IFriendsService>(m_LocalServiceDll, args);
// IFriendsService friendsService = ServerUtils.LoadPlugin<IFriendsService>(m_LocalServiceDll, args)
ServerUtils.LoadPlugin<IFriendsService>(m_LocalServiceDll, args);
m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService);

View File

@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
m_aScene = scene;
scene.RegisterModuleInterface<IAssetService>(this);
m_aScene.RegisterModuleInterface<IAssetService>(this);
}
public void RemoveRegion(Scene scene)

View File

@ -26,6 +26,7 @@
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using log4net;
using Nini.Config;
@ -41,22 +42,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// Version of this service
/// <summary>
/// Version of this service
/// </summary>
private const string m_Version = "SIMULATION/0.1";
private List<Scene> m_sceneList = new List<Scene>();
private IEntityTransferModule m_AgentTransferModule;
protected IEntityTransferModule AgentTransferModule
{
get
{
if (m_AgentTransferModule == null)
m_AgentTransferModule = m_sceneList[0].RequestModuleInterface<IEntityTransferModule>();
return m_AgentTransferModule;
}
}
/// <summary>
/// Map region ID to scene.
/// </summary>
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
/// <summary>
/// Is this module enabled?
/// </summary>
private bool m_ModuleEnabled = false;
#region IRegionModule
@ -129,12 +128,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
/// <param name="scene"></param>
public void RemoveScene(Scene scene)
{
lock (m_sceneList)
lock (m_scenes)
{
if (m_sceneList.Contains(scene))
{
m_sceneList.Remove(scene);
}
if (m_scenes.ContainsKey(scene.RegionInfo.RegionID))
m_scenes.Remove(scene.RegionInfo.RegionID);
else
m_log.WarnFormat(
"[LOCAL SIMULATION CONNECTOR]: Tried to remove region {0} but it was not present",
scene.RegionInfo.RegionName);
}
}
@ -144,13 +145,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
/// <param name="scene"></param>
public void Init(Scene scene)
{
if (!m_sceneList.Contains(scene))
lock (m_scenes)
{
lock (m_sceneList)
{
m_sceneList.Add(scene);
}
if (!m_scenes.ContainsKey(scene.RegionInfo.RegionID))
m_scenes[scene.RegionInfo.RegionID] = scene;
else
m_log.WarnFormat(
"[LOCAL SIMULATION CONNECTOR]: Tried to add region {0} but it is already present",
scene.RegionInfo.RegionName);
}
}
@ -158,15 +160,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
#region ISimulation
public IScene GetScene(ulong regionhandle)
public IScene GetScene(UUID regionId)
{
foreach (Scene s in m_sceneList)
if (m_scenes.ContainsKey(regionId))
{
if (s.RegionInfo.RegionHandle == regionhandle)
return s;
return m_scenes[regionId];
}
else
{
// FIXME: This was pre-existing behaviour but possibly not a good idea, since it hides an error rather
// than making it obvious and fixable. Need to see if the error message comes up in practice.
Scene s = m_scenes.Values.ToArray()[0];
m_log.ErrorFormat(
"[LOCAL SIMULATION CONNECTOR]: Region with id {0} not found. Returning {1} {2} instead",
regionId, s.RegionInfo.RegionName, s.RegionInfo.RegionID);
return s;
}
// ? weird. should not happen
return m_sceneList[0];
}
public ISimulationService GetInnerService()
@ -187,13 +198,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false;
}
foreach (Scene s in m_sceneList)
if (m_scenes.ContainsKey(destination.RegionID))
{
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
{
// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
return s.NewUserConnection(aCircuit, teleportFlags, out reason);
}
return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, out reason);
}
reason = "Did not find region " + destination.RegionName;
@ -205,17 +213,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
if (destination == null)
return false;
foreach (Scene s in m_sceneList)
if (m_scenes.ContainsKey(destination.RegionID))
{
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
{
// m_log.DebugFormat(
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
// s.RegionInfo.RegionName, destination.RegionHandle);
s.IncomingChildAgentDataUpdate(cAgentData);
return true;
}
return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData);
}
// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle);
@ -231,11 +235,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
// simulator so when we receive the update we need to hand it to each of the
// scenes; scenes each check to see if the is a scene presence for the avatar
// note that we really don't need the GridRegion for this call
foreach (Scene s in m_sceneList)
foreach (Scene s in m_scenes.Values)
{
//m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
s.IncomingChildAgentDataUpdate(cAgentData);
}
//m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
return true;
}
@ -247,14 +252,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
if (destination == null)
return false;
foreach (Scene s in m_sceneList)
if (m_scenes.ContainsKey(destination.RegionID))
{
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
{
//m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
return s.IncomingRetrieveRootAgent(id, out agent);
}
// m_log.DebugFormat(
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
// s.RegionInfo.RegionName, destination.RegionHandle);
return m_scenes[destination.RegionID].IncomingRetrieveRootAgent(id, out agent);
}
//m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
return false;
}
@ -266,59 +272,49 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
if (destination == null)
return false;
foreach (Scene s in m_sceneList)
if (m_scenes.ContainsKey(destination.RegionID))
{
if (s.RegionInfo.RegionID == destination.RegionID)
return s.QueryAccess(id, position, out reason);
// m_log.DebugFormat(
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
// s.RegionInfo.RegionName, destination.RegionHandle);
return m_scenes[destination.RegionID].QueryAccess(id, position, out reason);
}
//m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
return false;
}
public bool ReleaseAgent(UUID origin, UUID id, string uri)
public bool ReleaseAgent(UUID originId, UUID agentId, string uri)
{
foreach (Scene s in m_sceneList)
if (m_scenes.ContainsKey(originId))
{
if (s.RegionInfo.RegionID == origin)
{
// m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent");
AgentTransferModule.AgentArrivedAtDestination(id);
return true;
// return s.IncomingReleaseAgent(id);
}
// m_log.DebugFormat(
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
// s.RegionInfo.RegionName, destination.RegionHandle);
m_scenes[originId].EntityTransferModule.AgentArrivedAtDestination(agentId);
return true;
}
//m_log.Debug("[LOCAL COMMS]: region not found in SendReleaseAgent " + origin);
return false;
}
public bool CloseChildAgent(GridRegion destination, UUID id)
{
return CloseAgent(destination, id);
}
public bool CloseAgent(GridRegion destination, UUID id)
{
if (destination == null)
return false;
foreach (Scene s in m_sceneList)
if (m_scenes.ContainsKey(destination.RegionID))
{
if (s.RegionInfo.RegionID == destination.RegionID)
{
//m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent");
return s.IncomingCloseAgent(id);
}
}
//m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent");
return false;
}
public bool CloseChildAgent(GridRegion destination, UUID id)
{
if (destination == null)
return false;
foreach (Scene s in m_sceneList)
{
if (s.RegionInfo.RegionID == destination.RegionID)
{
//m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent");
return s.IncomingCloseChildAgent(id);
}
Util.FireAndForget(delegate { m_scenes[destination.RegionID].IncomingCloseAgent(id); });
return true;
}
//m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent");
return false;
@ -333,25 +329,28 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
if (destination == null)
return false;
foreach (Scene s in m_sceneList)
if (m_scenes.ContainsKey(destination.RegionID))
{
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
// m_log.DebugFormat(
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
// s.RegionInfo.RegionName, destination.RegionHandle);
Scene s = m_scenes[destination.RegionID];
if (isLocalCall)
{
//m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject");
if (isLocalCall)
{
// We need to make a local copy of the object
ISceneObject sogClone = sog.CloneForNewScene();
sogClone.SetState(sog.GetStateSnapshot(), s);
return s.IncomingCreateObject(newPosition, sogClone);
}
else
{
// Use the object as it came through the wire
return s.IncomingCreateObject(newPosition, sog);
}
// We need to make a local copy of the object
ISceneObject sogClone = sog.CloneForNewScene();
sogClone.SetState(sog.GetStateSnapshot(), s);
return s.IncomingCreateObject(newPosition, sogClone);
}
else
{
// Use the object as it came through the wire
return s.IncomingCreateObject(newPosition, sog);
}
}
return false;
}
@ -360,13 +359,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
if (destination == null)
return false;
foreach (Scene s in m_sceneList)
if (m_scenes.ContainsKey(destination.RegionID))
{
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
{
return s.IncomingCreateObject(userID, itemID);
}
// m_log.DebugFormat(
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
// s.RegionInfo.RegionName, destination.RegionHandle);
return m_scenes[destination.RegionID].IncomingCreateObject(userID, itemID);
}
return false;
}
@ -377,18 +378,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
public bool IsLocalRegion(ulong regionhandle)
{
foreach (Scene s in m_sceneList)
foreach (Scene s in m_scenes.Values)
if (s.RegionInfo.RegionHandle == regionhandle)
return true;
return false;
}
public bool IsLocalRegion(UUID id)
{
foreach (Scene s in m_sceneList)
if (s.RegionInfo.RegionID == id)
return true;
return false;
return m_scenes.ContainsKey(id);
}
#endregion

View File

@ -151,9 +151,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
#region IInterregionComms
public IScene GetScene(ulong handle)
public IScene GetScene(UUID regionId)
{
return m_localBackend.GetScene(handle);
return m_localBackend.GetScene(regionId);
}
public ISimulationService GetInnerService()
@ -226,13 +226,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return m_remoteConnector.RetrieveAgent(destination, id, out agent);
return false;
}
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
{
reason = "Communications failure";
version = "Unknown";
if (destination == null)
return false;
@ -245,7 +245,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason);
return false;
}
public bool ReleaseAgent(UUID origin, UUID id, string uri)

View File

@ -428,9 +428,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
s = sw.ToString();
}
if (m_scene != null)
Console.WriteLine(
"[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s);
// if (m_scene != null)
// Console.WriteLine(
// "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s);
return s;
}

View File

@ -0,0 +1,155 @@
/*
* 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 System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using log4net;
using Mono.Addins;
using NDesk.Options;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.World.Objects.Commands
{
/// <summary>
/// A module that holds commands for manipulating objects in the scene.
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RegionCommandsModule")]
public class RegionCommandsModule : INonSharedRegionModule
{
private Scene m_scene;
private ICommandConsole m_console;
public string Name { get { return "Region Commands Module"; } }
public Type ReplaceableInterface { get { return null; } }
public void Initialise(IConfigSource source)
{
// m_log.DebugFormat("[REGION COMMANDS MODULE]: INITIALIZED MODULE");
}
public void PostInitialise()
{
// m_log.DebugFormat("[REGION COMMANDS MODULE]: POST INITIALIZED MODULE");
}
public void Close()
{
// m_log.DebugFormat("[REGION COMMANDS MODULE]: CLOSED MODULE");
}
public void AddRegion(Scene scene)
{
// m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
m_scene = scene;
m_console = MainConsole.Instance;
m_console.Commands.AddCommand(
"Regions", false, "show scene",
"show scene",
"Show live scene information for the currently selected region.", HandleShowScene);
}
public void RemoveRegion(Scene scene)
{
// m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
}
public void RegionLoaded(Scene scene)
{
// m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
}
private void HandleShowScene(string module, string[] cmd)
{
if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
return;
SimStatsReporter r = m_scene.StatsReporter;
float[] stats = r.LastReportedSimStats;
float timeDilation = stats[0];
float simFps = stats[1];
float physicsFps = stats[2];
float agentUpdates = stats[3];
float rootAgents = stats[4];
float childAgents = stats[5];
float totalPrims = stats[6];
float activePrims = stats[7];
float totalFrameTime = stats[8];
// float netFrameTime = stats.StatsBlock[9].StatValue; // Ignored - not used by OpenSimulator
float physicsFrameTime = stats[10];
float otherFrameTime = stats[11];
// float imageFrameTime = stats.StatsBlock[12].StatValue; // Ignored
float inPacketsPerSecond = stats[13];
float outPacketsPerSecond = stats[14];
float unackedBytes = stats[15];
// float agentFrameTime = stats.StatsBlock[16].StatValue; // Not really used
float pendingDownloads = stats[17];
float pendingUploads = stats[18];
float activeScripts = stats[19];
float scriptLinesPerSecond = stats[20];
StringBuilder sb = new StringBuilder();
sb.AppendFormat("Scene statistics for {0}\n", m_scene.RegionInfo.RegionName);
ConsoleDisplayList dispList = new ConsoleDisplayList();
dispList.AddRow("Time Dilation", timeDilation);
dispList.AddRow("Sim FPS", simFps);
dispList.AddRow("Physics FPS", physicsFps);
dispList.AddRow("Avatars", rootAgents);
dispList.AddRow("Child agents", childAgents);
dispList.AddRow("Total prims", totalPrims);
dispList.AddRow("Scripts", activeScripts);
dispList.AddRow("Script lines processed per second", scriptLinesPerSecond);
dispList.AddRow("Physics enabled prims", activePrims);
dispList.AddRow("Total frame time", totalFrameTime);
dispList.AddRow("Physics frame time", physicsFrameTime);
dispList.AddRow("Other frame time", otherFrameTime);
dispList.AddRow("Agent Updates per second", agentUpdates);
dispList.AddRow("Packets processed from clients per second", inPacketsPerSecond);
dispList.AddRow("Packets sent to clients per second", outPacketsPerSecond);
dispList.AddRow("Bytes unacknowledged by clients", unackedBytes);
dispList.AddRow("Pending asset downloads to clients", pendingDownloads);
dispList.AddRow("Pending asset uploads from clients", pendingUploads);
dispList.AddToStringBuilder(sb);
MainConsole.Instance.Output(sb.ToString());
}
}
}

View File

@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
}
//Returns true if this extension is supported for terrain save-tile
public bool SupportsTileSave()
public override bool SupportsTileSave()
{
return false;
}

View File

@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
bool eof = false;
int fileXPoints = 0;
int fileYPoints = 0;
// int fileYPoints = 0;
// Terragen file
while (eof == false)
@ -75,7 +75,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
{
case "SIZE":
fileXPoints = bs.ReadInt16() + 1;
fileYPoints = fileXPoints;
// fileYPoints = fileXPoints;
bs.ReadInt16();
break;
case "XPTS":
@ -83,7 +83,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
bs.ReadInt16();
break;
case "YPTS":
fileYPoints = bs.ReadInt16();
// fileYPoints = bs.ReadInt16();
bs.ReadInt16();
bs.ReadInt16();
break;
case "ALTW":
@ -164,10 +165,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
bool eof = false;
if (Encoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ")
{
int fileWidth = w;
int fileHeight = h;
// int fileWidth = w;
// int fileHeight = h;
// Terragen file
while (eof == false)
@ -176,17 +175,22 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
switch (tmp)
{
case "SIZE":
int sztmp = bs.ReadInt16() + 1;
fileWidth = sztmp;
fileHeight = sztmp;
// int sztmp = bs.ReadInt16() + 1;
// fileWidth = sztmp;
// fileHeight = sztmp;
bs.ReadInt16();
bs.ReadInt16();
bs.ReadInt16();
bs.ReadInt16();
break;
case "XPTS":
fileWidth = bs.ReadInt16();
// fileWidth = bs.ReadInt16();
bs.ReadInt16();
bs.ReadInt16();
break;
case "YPTS":
fileHeight = bs.ReadInt16();
// fileHeight = bs.ReadInt16();
bs.ReadInt16();
bs.ReadInt16();
break;
case "ALTW":

View File

@ -165,6 +165,19 @@ namespace OpenSim.Region.Framework.Interfaces
/// </returns>
List<TaskInventoryItem> GetInventoryItems();
/// <summary>
/// Gets an inventory item by name
/// </summary>
/// <remarks>
/// This method returns the first inventory item that matches the given name. In SL this is all you need
/// since each item in a prim inventory must have a unique name.
/// </remarks>
/// <param name='name'></param>
/// <returns>
/// The inventory item. Null if no such item was found.
/// </returns>
TaskInventoryItem GetInventoryItem(string name);
/// <summary>
/// Get inventory items by name.
/// </summary>

View File

@ -57,6 +57,13 @@ namespace OpenSim.Region.Framework.Interfaces
void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination,
Vector3 position, Vector3 lookAt, uint teleportFlags);
/// <summary>
/// Show whether the given agent is being teleported.
/// </summary>
/// <param name='id'>The agent ID</para></param>
/// <returns>true if the agent is in the process of being teleported, false otherwise.</returns>
bool IsInTransit(UUID id);
bool Cross(ScenePresence agent, bool isFlying);
void AgentArrivedAtDestination(UUID agent);

View File

@ -0,0 +1,36 @@
/*
* 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 OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces
{
public interface IEnvironmentModule
{
void ResetEnvironmentSettings(UUID regionUUID);
}
}

View File

@ -49,11 +49,15 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="folderID"></param>
/// <param name="objectGroups"></param>
/// <param name="remoteClient"></param>
/// <param name="asAttachment">
/// Should be true if the object(s) are begin taken as attachments. False otherwise.
/// </param>
/// <returns>
/// Returns the UUID of the newly created item asset (not the item itself).
/// FIXME: This is not very useful. It would be far more useful to return a list of items instead.
/// A list of the items created. If there was more than one object and objects are not being coaleseced in
/// inventory, then the order of items is in the same order as the input objects.
/// </returns>
UUID CopyToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient);
List<InventoryItemBase> CopyToInventory(
DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment);
/// <summary>
/// Rez an object into the scene from the user's inventory

View File

@ -95,5 +95,26 @@ namespace OpenSim.Region.Framework.Interfaces
RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
void StoreRegionWindlightSettings(RegionLightShareData wl);
void RemoveRegionWindlightSettings(UUID regionID);
/// <summary>
/// Load Environment settings from region storage
/// </summary>
/// <param name="regionUUID">the region UUID</param>
/// <returns>LLSD string for viewer</returns>
string LoadRegionEnvironmentSettings(UUID regionUUID);
/// <summary>
/// Store Environment settings into region storage
/// </summary>
/// <param name="regionUUID">the region UUID</param>
/// <param name="settings">LLSD string from viewer</param>
void StoreRegionEnvironmentSettings(UUID regionUUID, string settings);
/// <summary>
/// Delete Environment settings from region storage
/// </summary>
/// <param name="regionUUID">the region UUID</param>
void RemoveRegionEnvironmentSettings(UUID regionUUID);
}
}

View File

@ -107,6 +107,26 @@ namespace OpenSim.Region.Framework.Interfaces
void StoreRegionWindlightSettings(RegionLightShareData wl);
void RemoveRegionWindlightSettings(UUID regionID);
/// <summary>
/// Load Environment settings from region storage
/// </summary>
/// <param name="regionUUID">the region UUID</param>
/// <returns>LLSD string for viewer</returns>
string LoadRegionEnvironmentSettings(UUID regionUUID);
/// <summary>
/// Store Environment settings into region storage
/// </summary>
/// <param name="regionUUID">the region UUID</param>
/// <param name="settings">LLSD string from viewer</param>
void StoreRegionEnvironmentSettings(UUID regionUUID, string settings);
/// <summary>
/// Delete Environment settings from region storage
/// </summary>
/// <param name="regionUUID">the region UUID</param>
void RemoveRegionEnvironmentSettings(UUID regionUUID);
void Shutdown();
}
}

View File

@ -34,6 +34,7 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface IUrlModule
{
string ExternalHostNameForLSL { get; }
UUID RequestURL(IScriptModule engine, SceneObjectPart host, UUID itemID);
UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID);
void ReleaseURL(string url);

View File

@ -155,7 +155,7 @@ namespace OpenSim.Region.Framework.Scenes
{
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null)
invAccess.CopyToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient);
invAccess.CopyToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient, false);
if (x.permissionToDelete)
{

View File

@ -954,8 +954,8 @@ namespace OpenSim.Region.Framework.Scenes
sbyte invType, sbyte type, UUID olditemID)
{
// m_log.DebugFormat(
// "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}",
// remoteClient.Name, name, folderID, olditemID);
// "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}, assetType {4}, inventoryType {5}",
// remoteClient.Name, name, folderID, olditemID, (AssetType)type, (InventoryType)invType);
if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
return;
@ -988,10 +988,10 @@ namespace OpenSim.Region.Framework.Scenes
asset.Type = type;
asset.Name = name;
asset.Description = description;
CreateNewInventoryItem(
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType,
(uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All,
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType,
(uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All,
(uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch());
}
else

View File

@ -77,7 +77,12 @@ namespace OpenSim.Region.Framework.Scenes
public bool DebugUpdates { get; private set; }
public SynchronizeSceneHandler SynchronizeScene;
public SimStatsReporter StatsReporter;
/// <summary>
/// Statistical information for this scene.
/// </summary>
public SimStatsReporter StatsReporter { get; private set; }
public List<Border> NorthBorders = new List<Border>();
public List<Border> EastBorders = new List<Border>();
public List<Border> SouthBorders = new List<Border>();
@ -164,7 +169,6 @@ namespace OpenSim.Region.Framework.Scenes
protected IConfigSource m_config;
protected IRegionSerialiserModule m_serialiser;
protected IDialogModule m_dialogModule;
protected IEntityTransferModule m_teleportModule;
protected ICapabilitiesModule m_capsModule;
protected IGroupsModule m_groupsModule;
@ -515,6 +519,7 @@ namespace OpenSim.Region.Framework.Scenes
}
public IAttachmentsModule AttachmentsModule { get; set; }
public IEntityTransferModule EntityTransferModule { get; private set; }
public IAvatarFactoryModule AvatarFactory
{
@ -952,8 +957,8 @@ namespace OpenSim.Region.Framework.Scenes
List<ulong> old = new List<ulong>();
old.Add(otherRegion.RegionHandle);
agent.DropOldNeighbours(old);
if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc)
m_teleportModule.EnableChildAgent(agent, otherRegion);
if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc)
EntityTransferModule.EnableChildAgent(agent, otherRegion);
});
}
catch (NullReferenceException)
@ -1060,13 +1065,13 @@ namespace OpenSim.Region.Framework.Scenes
}
}
m_log.Error("[REGION]: Closing");
Close();
if (PhysicsScene != null)
{
PhysicsScene.Dispose();
}
m_log.Error("[REGION]: Closing");
Close();
}
m_log.Error("[REGION]: Firing Region Restart Message");
@ -1090,8 +1095,8 @@ namespace OpenSim.Region.Framework.Scenes
{
ForEachRootScenePresence(delegate(ScenePresence agent)
{
if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc)
m_teleportModule.EnableChildAgent(agent, r);
if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc)
EntityTransferModule.EnableChildAgent(agent, r);
});
}
catch (NullReferenceException)
@ -1281,7 +1286,7 @@ namespace OpenSim.Region.Framework.Scenes
m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
m_dialogModule = RequestModuleInterface<IDialogModule>();
m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
m_teleportModule = RequestModuleInterface<IEntityTransferModule>();
EntityTransferModule = RequestModuleInterface<IEntityTransferModule>();
m_groupsModule = RequestModuleInterface<IGroupsModule>();
}
@ -2380,8 +2385,8 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
if (m_teleportModule != null)
m_teleportModule.Cross(grp, attemptedPosition, silent);
if (EntityTransferModule != null)
EntityTransferModule.Cross(grp, attemptedPosition, silent);
}
public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
@ -3225,8 +3230,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="client">The IClientAPI for the client</param>
public virtual bool TeleportClientHome(UUID agentId, IClientAPI client)
{
if (m_teleportModule != null)
return m_teleportModule.TeleportHome(agentId, client);
if (EntityTransferModule != null)
{
EntityTransferModule.TeleportHome(agentId, client);
}
else
{
m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active");
@ -4332,8 +4339,10 @@ namespace OpenSim.Region.Framework.Scenes
position.Y -= shifty;
}
if (m_teleportModule != null)
m_teleportModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags);
if (EntityTransferModule != null)
{
EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags);
}
else
{
m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active");
@ -4344,8 +4353,10 @@ namespace OpenSim.Region.Framework.Scenes
public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying)
{
if (m_teleportModule != null)
return m_teleportModule.Cross(agent, isFlying);
if (EntityTransferModule != null)
{
return EntityTransferModule.Cross(agent, isFlying);
}
else
{
m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule");
@ -5493,16 +5504,36 @@ Environment.Exit(1);
throw new Exception(error);
}
// This method is called across the simulation connector to
// determine if a given agent is allowed in this region
// AS A ROOT AGENT. Returning false here will prevent them
// from logging into the region, teleporting into the region
// or corssing the broder walking, but will NOT prevent
// child agent creation, thereby emulating the SL behavior.
/// <summary>
/// This method is called across the simulation connector to
/// determine if a given agent is allowed in this region
/// AS A ROOT AGENT
/// </summary>
/// <remarks>
/// Returning false here will prevent them
/// from logging into the region, teleporting into the region
/// or corssing the broder walking, but will NOT prevent
/// child agent creation, thereby emulating the SL behavior.
/// </remarks>
/// <param name='agentID'></param>
/// <param name='position'></param>
/// <param name='reason'></param>
/// <returns></returns>
public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
{
reason = "You are banned from the region";
if (EntityTransferModule.IsInTransit(agentID))
{
reason = "Agent is still in transit from this region";
m_log.WarnFormat(
"[SCENE]: Denying agent {0} entry into {1} since region still has them registered as in transit",
agentID, RegionInfo.RegionName);
return false;
}
if (Permissions.IsGod(agentID))
{
reason = String.Empty;

View File

@ -759,14 +759,22 @@ namespace OpenSim.Region.Framework.Scenes
return item;
}
/// <summary>
/// Get inventory items by name.
/// </summary>
/// <param name="name"></param>
/// <returns>
/// A list of inventory items with that name.
/// If no inventory item has that name then an empty list is returned.
/// </returns>
public TaskInventoryItem GetInventoryItem(string name)
{
m_items.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_items.Values)
{
if (item.Name == name)
{
return item;
m_items.LockItemsForRead(false);
}
}
m_items.LockItemsForRead(false);
return null;
}
public List<TaskInventoryItem> GetInventoryItems(string name)
{
List<TaskInventoryItem> items = new List<TaskInventoryItem>();
@ -1236,10 +1244,10 @@ namespace OpenSim.Region.Framework.Scenes
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
}
item.OwnerChanged = true;
item.CurrentPermissions &= item.NextPermissions;
item.BasePermissions &= item.NextPermissions;
item.EveryonePermissions &= item.NextPermissions;
item.OwnerChanged = true;
item.PermsMask = 0;
item.PermsGranter = UUID.Zero;
}
@ -1432,4 +1440,4 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
}
}

View File

@ -47,14 +47,30 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
/// </remarks>
public class CoalescedSceneObjectsSerializer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Serialize coalesced objects to Xml
/// </summary>
/// <param name="coa"></param>
/// <param name="doScriptStates">
/// If true then serialize script states. This will halt any running scripts
/// </param>
/// <returns></returns>
public static string ToXml(CoalescedSceneObjects coa)
{
return ToXml(coa, true);
}
/// <summary>
/// Serialize coalesced objects to Xml
/// </summary>
/// <param name="coa"></param>
/// <param name="doScriptStates">
/// If true then serialize script states. This will halt any running scripts
/// </param>
/// <returns></returns>
public static string ToXml(CoalescedSceneObjects coa, bool doScriptStates)
{
using (StringWriter sw = new StringWriter())
{
@ -91,7 +107,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteAttributeString("offsety", offsets[i].Y.ToString());
writer.WriteAttributeString("offsetz", offsets[i].Z.ToString());
SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, true);
SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates);
writer.WriteEndElement(); // SceneObjectGroup
}

View File

@ -110,12 +110,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
UUID userId = TestHelpers.ParseTail(0x1);
EntityTransferModule etm = new EntityTransferModule();
EntityTransferModule etmA = new EntityTransferModule();
EntityTransferModule etmB = new EntityTransferModule();
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
IConfigSource config = new IniConfigSource();
IConfig modulesConfig = config.AddConfig("Modules");
modulesConfig.Set("EntityTransferModule", etm.Name);
modulesConfig.Set("EntityTransferModule", etmA.Name);
modulesConfig.Set("SimulationServices", lscm.Name);
IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
@ -127,7 +128,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
SceneHelpers.SetupSceneModules(sceneA, config, etmA);
SceneHelpers.SetupSceneModules(sceneB, config, etmB);
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
Vector3 teleportPosition = new Vector3(10, 11, 12);
Vector3 teleportLookAt = new Vector3(20, 21, 22);
@ -174,12 +177,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
UUID userId = TestHelpers.ParseTail(0x1);
Vector3 preTeleportPosition = new Vector3(30, 31, 32);
EntityTransferModule etm = new EntityTransferModule();
EntityTransferModule etmA = new EntityTransferModule();
EntityTransferModule etmB = new EntityTransferModule();
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
config.Configs["Modules"].Set("EntityTransferModule", etmA.Name);
config.Configs["Modules"].Set("SimulationServices", lscm.Name);
config.AddConfig("EntityTransfer");
@ -195,13 +200,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
SceneHelpers.SetupSceneModules(sceneA, config, etmA );
// We need to set up the permisions module on scene B so that our later use of agent limit to deny
// QueryAccess won't succeed anyway because administrators are always allowed in and the default
// IsAdministrator if no permissions module is present is true.
SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule() });
SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB });
// Shared scene modules
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
Vector3 teleportPosition = new Vector3(10, 11, 12);
Vector3 teleportLookAt = new Vector3(20, 21, 22);
@ -249,12 +256,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
UUID userId = TestHelpers.ParseTail(0x1);
Vector3 preTeleportPosition = new Vector3(30, 31, 32);
EntityTransferModule etm = new EntityTransferModule();
EntityTransferModule etmA = new EntityTransferModule();
EntityTransferModule etmB = new EntityTransferModule();
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
config.Configs["Modules"].Set("EntityTransferModule", etmA.Name);
config.Configs["Modules"].Set("SimulationServices", lscm.Name);
config.AddConfig("EntityTransfer");
@ -267,8 +275,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
SceneHelpers.SetupSceneModules(sceneA, config, etmA);
SceneHelpers.SetupSceneModules(sceneB, config, etmB);
// Shared scene modules
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
Vector3 teleportPosition = new Vector3(10, 11, 12);
Vector3 teleportLookAt = new Vector3(20, 21, 22);
@ -312,12 +323,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
UUID userId = TestHelpers.ParseTail(0x1);
EntityTransferModule etm = new EntityTransferModule();
EntityTransferModule etmA = new EntityTransferModule();
EntityTransferModule etmB = new EntityTransferModule();
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
IConfigSource config = new IniConfigSource();
IConfig modulesConfig = config.AddConfig("Modules");
modulesConfig.Set("EntityTransferModule", etm.Name);
modulesConfig.Set("EntityTransferModule", etmA.Name);
modulesConfig.Set("SimulationServices", lscm.Name);
IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
@ -329,9 +341,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
SceneHelpers.SetupSceneModules(sceneA, new CapabilitiesModule());
SceneHelpers.SetupSceneModules(sceneB, new CapabilitiesModule());
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA);
SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB);
Vector3 teleportPosition = new Vector3(10, 11, 12);
Vector3 teleportLookAt = new Vector3(20, 21, 22);

View File

@ -145,12 +145,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
{
sb.AppendFormat("Attachments for {0}\n", sp.Name);
ConsoleTable ct = new ConsoleTable() { Indent = 2 };
ct.Columns.Add(new ConsoleTableColumn("Attachment Name", 36));
ct.Columns.Add(new ConsoleTableColumn("Local ID", 10));
ct.Columns.Add(new ConsoleTableColumn("Item ID", 36));
ct.Columns.Add(new ConsoleTableColumn("Attach Point", 14));
ct.Columns.Add(new ConsoleTableColumn("Position", 15));
ConsoleDisplayTable ct = new ConsoleDisplayTable() { Indent = 2 };
ct.Columns.Add(new ConsoleDisplayTableColumn("Attachment Name", 36));
ct.Columns.Add(new ConsoleDisplayTableColumn("Local ID", 10));
ct.Columns.Add(new ConsoleDisplayTableColumn("Item ID", 36));
ct.Columns.Add(new ConsoleDisplayTableColumn("Attach Point", 14));
ct.Columns.Add(new ConsoleDisplayTableColumn("Position", 15));
// sb.AppendFormat(
// " {0,-36} {1,-10} {2,-36} {3,-14} {4,-15}\n",
@ -176,7 +176,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
// attachmentObject.Name, attachmentObject.LocalId, attachmentObject.FromItemID,
// (AttachmentPoint)attachmentObject.AttachmentPoint, attachmentObject.RootPart.AttachedPos);
ct.Rows.Add(
new ConsoleTableRow(
new ConsoleDisplayTableRow(
new List<string>()
{
attachmentObject.Name,

View File

@ -354,51 +354,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected UUID InventoryKey(string name, int type)
{
m_host.AddScriptLPS(1);
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
if (inv.Value.Name == name)
{
m_host.TaskInventory.LockItemsForRead(false);
if (inv.Value.Type != type)
{
return UUID.Zero;
}
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
return inv.Value.AssetID;
}
}
m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero;
if (item != null && item.Type == type)
return item.AssetID;
else
return UUID.Zero;
}
protected UUID InventoryKey(string name)
{
m_host.AddScriptLPS(1);
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
if (inv.Value.Name == name)
{
m_host.TaskInventory.LockItemsForRead(false);
return inv.Value.AssetID;
}
}
m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero;
}
/// <summary>
/// accepts a valid UUID, -or- a name of an inventory item.
/// Returns a valid UUID or UUID.Zero if key invalid and item not found
@ -408,19 +371,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <returns></returns>
protected UUID KeyOrName(string k)
{
UUID key = UUID.Zero;
UUID key;
// if we can parse the string as a key, use it.
if (UUID.TryParse(k, out key))
{
return key;
}
// else try to locate the name in inventory of object. found returns key,
// not found returns UUID.Zero which will translate to the default particle texture
else
// not found returns UUID.Zero
if (!UUID.TryParse(k, out key))
{
return InventoryKey(k);
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
if (item != null)
key = item.AssetID;
else
key = UUID.Zero;
}
return key;
}
// convert a LSL_Rotation to a Quaternion
@ -1897,14 +1863,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return rgb;
}
if (face >= 0 && face < GetNumberOfSides(part))
{
texcolor = tex.GetFace((uint)face).RGBA;
rgb.x = texcolor.R;
rgb.y = texcolor.G;
rgb.z = texcolor.B;
return rgb;
}
else
{
@ -3598,17 +3565,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
{
UUID animID = new UUID();
if (!UUID.TryParse(anim, out animID))
{
animID = InventoryKey(anim);
}
ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
if (presence != null)
{
UUID animID = KeyOrName(anim);
if (animID == UUID.Zero)
presence.Animator.RemoveAnimation(anim);
else
@ -3737,9 +3699,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
ScenePresence presence = World.GetScenePresence(agentID);
if (presence != null)
{
// If permissions are being requested from an NPC and were not implicitly granted above then
// auto grant all reuqested permissions if the script is owned by the NPC or the NPCs owner
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
if (npcModule != null && npcModule.IsNPC(agentID, World))
{
if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID)
{
lock (m_host.TaskInventory)
{
m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
}
m_ScriptEngine.PostScriptEvent(
m_item.ItemID,
new EventParams(
"run_time_permissions", new Object[] { new LSL_Integer(perm) }, new DetectParams[0]));
}
// it is an NPC, exit even if the permissions werent granted above, they are not going to answer
// the question!
return;
}
string ownerName = resolveName(m_host.ParentGroup.RootPart.OwnerID);
if (ownerName == String.Empty)
ownerName = "(hippos)";
@ -3762,10 +3747,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
// Requested agent is not in range, refuse perms
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
"run_time_permissions", new Object[] {
new LSL_Integer(0) },
new DetectParams[0]));
m_ScriptEngine.PostScriptEvent(
m_item.ItemID,
new EventParams("run_time_permissions", new Object[] { new LSL_Integer(0) }, new DetectParams[0]));
}
void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer)
@ -9456,7 +9440,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetSimulatorHostname()
{
m_host.AddScriptLPS(1);
return System.Environment.MachineName;
IUrlModule UrlModule = World.RequestModuleInterface<IUrlModule>();
return UrlModule.ExternalHostNameForLSL;
}
// <summary>
@ -9811,7 +9796,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
GridRegion info;
if (m_ScriptEngine.World.RegionInfo.RegionName == simulator)
if (m_ScriptEngine.World.RegionInfo.RegionName == simulator) //Det data for this simulator?
info = new GridRegion(m_ScriptEngine.World.RegionInfo);
else
info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator);
@ -9824,10 +9810,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(1000);
return UUID.Zero.ToString();
}
reply = new LSL_Vector(
info.RegionLocX,
info.RegionLocY,
0).ToString();
if (m_ScriptEngine.World.RegionInfo.RegionName != simulator)
{
//Hypergrid Region co-ordinates
uint rx = 0, ry = 0;
Utils.LongToUInts(Convert.ToUInt64(info.RegionSecret), out rx, out ry);
reply = new LSL_Vector(
rx,
ry,
0).ToString();
}
else
{
//Local-cooridnates
reply = new LSL_Vector(
info.RegionLocX,
info.RegionLocY,
0).ToString();
}
break;
case ScriptBaseClass.DATA_SIM_STATUS:
if (info != null)

View File

@ -960,21 +960,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarID = (UUID)avatar;
m_host.AddScriptLPS(1);
// FIXME: What we really want to do here is factor out the similar code in llStopAnimation() to a common
// method (though see that doesn't do the is animation check, which is probably a bug) and have both
// these functions call that common code. However, this does mean navigating the brain-dead requirement
// of calling InitLSL()
if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence)
{
ScenePresence target = (ScenePresence)World.Entities[avatarID];
if (target != null)
{
UUID animID = UUID.Zero;
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
UUID animID;
if (!UUID.TryParse(animation, out animID))
{
if (inv.Value.Name == animation)
{
if (inv.Value.Type == (int)AssetType.Animation)
animID = inv.Value.AssetID;
continue;
}
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(animation);
if (item != null && item.Type == (int)AssetType.Animation)
animID = item.AssetID;
else
animID = UUID.Zero;
}
m_host.TaskInventory.LockItemsForRead(false);

View File

@ -149,13 +149,16 @@ namespace OpenSim.Server.Handlers.Simulation
responsedata["int_response_code"] = HttpStatusCode.OK;
OSDMap resp = new OSDMap(2);
OSDMap resp = new OSDMap(3);
resp["success"] = OSD.FromBoolean(result);
resp["reason"] = OSD.FromString(reason);
resp["version"] = OSD.FromString(version);
responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
// We must preserve defaults here, otherwise a false "success" will not be put into the JSON map!
responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true);
// Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]);
}
protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
@ -569,7 +572,7 @@ namespace OpenSim.Server.Handlers.Simulation
AgentData agent = new AgentData();
try
{
agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle));
agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID));
}
catch (Exception ex)
{
@ -589,7 +592,7 @@ namespace OpenSim.Server.Handlers.Simulation
AgentPosition agent = new AgentPosition();
try
{
agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle));
agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID));
}
catch (Exception ex)
{

View File

@ -161,7 +161,7 @@ namespace OpenSim.Server.Handlers.Simulation
if (args.ContainsKey("extra") && args["extra"] != null)
extraStr = args["extra"].AsString();
IScene s = m_SimulationService.GetScene(destination.RegionHandle);
IScene s = m_SimulationService.GetScene(destination.RegionID);
ISceneObject sog = null;
try
{

View File

@ -148,5 +148,21 @@ namespace OpenSim.Services.Connectors
{
m_database.RemoveRegionWindlightSettings(regionID);
}
public string LoadRegionEnvironmentSettings(UUID regionUUID)
{
return m_database.LoadRegionEnvironmentSettings(regionUUID);
}
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
{
m_database.StoreRegionEnvironmentSettings(regionUUID, settings);
}
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
{
m_database.RemoveRegionEnvironmentSettings(regionUUID);
}
}
}

View File

@ -62,7 +62,7 @@ namespace OpenSim.Services.Connectors.Simulation
//m_Region = region;
}
public IScene GetScene(ulong regionHandle)
public IScene GetScene(UUID regionId)
{
return null;
}
@ -320,29 +320,40 @@ namespace OpenSim.Services.Connectors.Simulation
{
OSDMap data = (OSDMap)result["_Result"];
// FIXME: If there is a _Result map then it's the success key here that indicates the true success
// or failure, not the sibling result node.
success = data["success"];
reason = data["reason"].AsString();
if (data["version"] != null && data["version"].AsString() != string.Empty)
version = data["version"].AsString();
m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1} version {2} ({3})", uri, success, version, data["version"].AsString());
m_log.DebugFormat(
"[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version {3} ({4})",
uri, success, reason, version, data["version"].AsString());
}
if (!success)
{
if (result.ContainsKey("Message"))
// If we don't check this then OpenSimulator 0.7.3.1 and some period before will never see the
// actual failure message
if (!result.ContainsKey("_Result"))
{
string message = result["Message"].AsString();
if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region
if (result.ContainsKey("Message"))
{
m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored");
return true;
string message = result["Message"].AsString();
if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region
{
m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored");
return true;
}
reason = result["Message"];
}
else
{
reason = "Communications failure";
}
reason = result["Message"];
}
else
{
reason = "Communications failure";
}
return false;
@ -356,7 +367,7 @@ namespace OpenSim.Services.Connectors.Simulation
}
catch (Exception e)
{
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] QueryAcess failed with exception; {0}",e.ToString());
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] QueryAcesss failed with exception; {0}",e.ToString());
}
return false;

View File

@ -509,19 +509,21 @@ namespace OpenSim.Services.GridService
return;
}
MainConsole.Instance.Output("Region Name Region UUID");
MainConsole.Instance.Output("Location URI");
MainConsole.Instance.Output("Owner ID Flags");
MainConsole.Instance.Output("-------------------------------------------------------------------------------");
foreach (RegionData r in regions)
{
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n",
r.RegionName, r.RegionID,
String.Format("{0},{1}", r.posX / Constants.RegionSize, r.posY / Constants.RegionSize),
r.Data["serverURI"],
r.Data["owner_uuid"], flags));
ConsoleDisplayList dispList = new ConsoleDisplayList();
dispList.AddRow("Region Name", r.RegionName);
dispList.AddRow("Region ID", r.RegionID);
dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY));
dispList.AddRow("URI", r.Data["serverURI"]);
dispList.AddRow("Owner ID", r.Data["owner_uuid"]);
dispList.AddRow("Flags", flags);
MainConsole.Instance.Output(dispList.ToString());
}
return;
}

View File

@ -35,7 +35,17 @@ namespace OpenSim.Services.Interfaces
{
public interface ISimulationService
{
IScene GetScene(ulong regionHandle);
/// <summary>
/// Retrieve the scene with the given region ID.
/// </summary>
/// <param name='regionId'>
/// Region identifier.
/// </param>
/// <returns>
/// The scene.
/// </returns>
IScene GetScene(UUID regionId);
ISimulationService GetInnerService();
#region Agents

View File

@ -302,7 +302,8 @@ namespace OpenSim.Services.InventoryService
public virtual bool AddFolder(InventoryFolderBase folder)
{
//m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID);
// m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID);
InventoryFolderBase check = GetFolder(folder);
if (check != null)
return false;
@ -327,27 +328,36 @@ namespace OpenSim.Services.InventoryService
public virtual bool UpdateFolder(InventoryFolderBase folder)
{
//m_log.DebugFormat("[XINVENTORY]: Update folder {0} {1} ({2})", folder.Name, folder.Type, folder.ID);
// m_log.DebugFormat("[XINVENTORY]: Update folder {0} {1} ({2})", folder.Name, folder.Type, folder.ID);
XInventoryFolder xFolder = ConvertFromOpenSim(folder);
InventoryFolderBase check = GetFolder(folder);
if (check == null)
return AddFolder(folder);
if (check.Type != -1 || xFolder.type != -1)
if ((check.Type != (short)AssetType.Unknown || xFolder.type != (short)AssetType.Unknown)
&& (check.Type != (short)AssetType.OutfitFolder || xFolder.type != (short)AssetType.OutfitFolder))
{
if (xFolder.version < check.Version)
{
//m_log.DebugFormat("[XINVENTORY]: {0} < {1} can't do", xFolder.version, check.Version);
// m_log.DebugFormat("[XINVENTORY]: {0} < {1} can't do", xFolder.version, check.Version);
return false;
}
check.Version = (ushort)xFolder.version;
xFolder = ConvertFromOpenSim(check);
//m_log.DebugFormat("[XINVENTORY]: Storing {0} {1} {2}", xFolder.folderName, xFolder.version, xFolder.type);
// m_log.DebugFormat(
// "[XINVENTORY]: Storing version only update to system folder {0} {1} {2}",
// xFolder.folderName, xFolder.version, xFolder.type);
return m_Database.StoreFolder(xFolder);
}
if (xFolder.version < check.Version)
xFolder.version = check.Version;
xFolder.folderID = check.ID;
return m_Database.StoreFolder(xFolder);
@ -433,7 +443,6 @@ namespace OpenSim.Services.InventoryService
public virtual bool UpdateItem(InventoryItemBase item)
{
// throw new Exception("urrgh");
if (!m_AllowDelete)
if (item.AssetType == (sbyte)AssetType.Link || item.AssetType == (sbyte)AssetType.LinkFolder)
return false;

View File

@ -566,7 +566,7 @@ namespace OpenSim.Tests.Common
/// <returns></returns>
public static SceneObjectPart AddSceneObject(Scene scene)
{
return AddSceneObject(scene, "Test Object");
return AddSceneObject(scene, "Test Object", UUID.Zero);
}
/// <summary>
@ -574,10 +574,11 @@ namespace OpenSim.Tests.Common
/// </summary>
/// <param name="scene"></param>
/// <param name="name"></param>
/// <param name="ownerId"></param>
/// <returns></returns>
public static SceneObjectPart AddSceneObject(Scene scene, string name)
public static SceneObjectPart AddSceneObject(Scene scene, string name, UUID ownerId)
{
SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), UUID.Zero);
SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), ownerId);
//part.UpdatePrimFlags(false, false, true);
//part.ObjectFlags |= (uint)PrimFlags.Phantom;

View File

@ -112,6 +112,21 @@ namespace OpenSim.Data.Null
{
m_store.StoreRegionWindlightSettings(wl);
}
public string LoadRegionEnvironmentSettings(UUID regionUUID)
{
return m_store.LoadRegionEnvironmentSettings(regionUUID);
}
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
{
m_store.StoreRegionEnvironmentSettings(regionUUID, settings);
}
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
{
m_store.RemoveRegionEnvironmentSettings(regionUUID);
}
}
/// <summary>
@ -158,7 +173,25 @@ namespace OpenSim.Data.Null
{
//This connector doesn't support the windlight module yet
}
#region Environment Settings
public string LoadRegionEnvironmentSettings(UUID regionUUID)
{
//This connector doesn't support the Environment module yet
return string.Empty;
}
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
{
//This connector doesn't support the Environment module yet
}
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
{
//This connector doesn't support the Environment module yet
}
#endregion
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
RegionSettings rs = null;

View File

@ -534,7 +534,7 @@
; silly vanity "Facelights" dead. Sorry, head mounted miner's lamps
; will also be affected.
;
;DisableFacelights = "false(1815)
;DisableFacelights = false
[ClientStack.LindenCaps]
;; Long list of capabilities taken from
@ -549,6 +549,7 @@
Cap_CopyInventoryFromNotecard = "localhost"
Cap_DispatchRegionInfo = ""
Cap_EstateChangeInfo = ""
Cap_EnvironmentSettings = "localhost"
Cap_EventQueueGet = "localhost"
Cap_FetchInventory = ""
Cap_ObjectMedia = "localhost"