Compare commits
202 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c60ecf3ed | |||
| 9bc94c502a | |||
| a9dbe39319 | |||
| 292752bb78 | |||
| ac64fe03d8 | |||
| 0bf3f597fe | |||
| 2970a18e54 | |||
| c84f63f4dc | |||
| e4e754ee93 | |||
| 02cc1ed91a | |||
| def8012ec1 | |||
| 07e62df558 | |||
| b5db5d7a57 | |||
| 8a65f5a70d | |||
| 0da8fe3124 | |||
| ee13d817f1 | |||
| cb6791fb30 | |||
| d19aa9e792 | |||
| 2542ca2a49 | |||
| fba802bb03 | |||
| b8114d2b67 | |||
| ca228c4770 | |||
| f49912f92a | |||
| b0cbf16c19 | |||
| 4c4ffb9868 | |||
| e52fe03fff | |||
| 74dbfe6bb5 | |||
| 133370f158 | |||
| a2d544c938 | |||
| d76df3df79 | |||
| 88553bb884 | |||
| a153a3cf3b | |||
| 1afae01311 | |||
| bec100a662 | |||
| cca3c5f66e | |||
| 6fd803f24f | |||
| 32a70fb7e9 | |||
| 7aa25c6762 | |||
| fd281ded3f | |||
| cf1c34605b | |||
| 38c0927707 | |||
| 550ff3b4da | |||
| 3be3189ee0 | |||
| af86e2939c | |||
| 683cfc6f82 | |||
| a65ca24701 | |||
| de4327bfd5 | |||
| f24289c47f | |||
| 6b299a4287 | |||
| 39a6d7cab4 | |||
| bf0b0c9ad5 | |||
| 578ec6cc26 | |||
| 0f470326aa | |||
| c0b2e64a90 | |||
| 54d5ff6774 | |||
| ef1668adb3 | |||
| 2f398231ac | |||
| 3dc88c55a9 | |||
| d3a4d67a20 | |||
| da5fd53702 | |||
| c70e85a327 | |||
| 6011bfa5e3 | |||
| cbe889e10b | |||
| 0e3053e4c9 | |||
| 4d78837a3a | |||
| c6f30e044b | |||
| 3750f329d1 | |||
| 40828910e7 | |||
| fd27988978 | |||
| 6c21e15cb9 | |||
| 40e37d8b78 | |||
| b798b32b19 | |||
| 1f8d1bcdcf | |||
| 60065f06b3 | |||
| 3c03418e06 | |||
| 679da63da6 | |||
| 6a69c3ac04 | |||
| e8909703ae | |||
| 3e546ebbc5 | |||
| 49ed68e98c | |||
| 58c890df5d | |||
| 8205fe79ce | |||
| bd0dfc1d6d | |||
| 05b369965e | |||
| ae2b8f7007 | |||
| f609594595 | |||
| e76fa4c5aa | |||
| 027d313703 | |||
| 77a7de87e1 | |||
| 9b1741da0d | |||
| d5c724e5b8 | |||
| 9ac48b2aff | |||
| 17bf2a62db | |||
| 71900968b2 | |||
| ae789f6c16 | |||
| 06552f217e | |||
| 2122748af1 | |||
| 7a574be3fd | |||
| c8307cdf1e | |||
| 566327a948 | |||
| 040412857c | |||
| 70808d6d54 | |||
| 083dd0c17c | |||
| b6f6f05e1a | |||
| 75f117484b | |||
| cba64ebc79 | |||
| 4ac2f839bd | |||
| 63cda3a6d0 | |||
| f3dda2d85d | |||
| 2b98e2f106 | |||
| 3d6f9f9cec | |||
| beb7b8d189 | |||
| 28f0bf7f08 | |||
| 7a255efdb2 | |||
| ea73a03553 | |||
| c85f9d681a | |||
| b430c0162c | |||
| 859646ef5c | |||
| 84891930aa | |||
| 4db518b9a3 | |||
| 2d45ba47ac | |||
| 5ff2bda587 | |||
| 4bb72c9ffe | |||
| cca6b6bd0d | |||
| 2f2181683c | |||
| 7e1ab216e3 | |||
| 24a0cc5261 | |||
| 5655239f44 | |||
| e6ec83125b | |||
| 572440cd23 | |||
| 1bb3873338 | |||
| f213f55586 | |||
| 2c74e1bba8 | |||
| da342d0b21 | |||
| f61b234252 | |||
| 0f96b9f41b | |||
| 317aebcce6 | |||
| f3f85c3106 | |||
| 40d01fb20b | |||
| 3ae98611f2 | |||
| 7bcd6a6842 | |||
| e8898710d5 | |||
| 30fff0e78e | |||
| 2254a718c8 | |||
| 4d652c7041 | |||
| 4bdd9d51bc | |||
| eeec1f32c6 | |||
| a366c05ae2 | |||
| eced091689 | |||
| 1ad3fdb40b | |||
| 9babd79a66 | |||
| 08e509978d | |||
| ffc1f6a656 | |||
| 30d8506bc2 | |||
| e0c4f8ed76 | |||
| a57ec18fb5 | |||
| 8be14095fe | |||
| 1f4d3d3582 | |||
| f2ede8c7e0 | |||
| 0a949a20ca | |||
| bb3aa1440d | |||
| 1d4bee454e | |||
| d95e6ca0c6 | |||
| 78fd487a70 | |||
| 3e6043bb47 | |||
| 679533f632 | |||
| a798b98f85 | |||
| 0838c5288f | |||
| 35fa8b454d | |||
| 4b278c64d6 | |||
| 27845de7ea | |||
| fb18476032 | |||
| 74776c4ee0 | |||
| 952ad59c1f | |||
| c066f528ef | |||
| 0591a85787 | |||
| 7a686ef124 | |||
| 931c28888b | |||
| d4a6ed3d98 | |||
| b8eafc6280 | |||
| 5509d981d4 | |||
| 4f4ca1625f | |||
| 90a2296983 | |||
| 1aab096a83 | |||
| de1d213117 | |||
| f494e6b086 | |||
| 2d9971ea93 | |||
| f266e19243 | |||
| e4a69297f6 | |||
| 4fa5fa5e08 | |||
| d2cd39d0d8 | |||
| a4cb9639cc | |||
| 639c6bdd62 | |||
| b3ecf935cd | |||
| 4c5b3adb96 | |||
| 335d167ead | |||
| 36daea4480 | |||
| 5c92aa262a | |||
| 445caca18b | |||
| 4b90dcfb73 | |||
| ade1acc9d4 | |||
| e8eb9b7e84 |
@@ -144,6 +144,7 @@ what it is today.
|
||||
* SignpostMarv
|
||||
* SpotOn3D
|
||||
* Strawberry Fride
|
||||
* Talun
|
||||
* tglion
|
||||
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
|
||||
* tyre
|
||||
|
||||
@@ -135,7 +135,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//[TODO]: Temporary fix for an issue after the mono-addis upgrade
|
||||
// PostInilise can fire before the region is loaded, so need to
|
||||
// track down the cause of that
|
||||
Thread.Sleep(300);
|
||||
m_openSim.ModuleLoader.PostInitialise();
|
||||
m_openSim.ModuleLoader.ClearCache();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Overkill - we only really need the asset service, not a whole scene.
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService);
|
||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||
|
||||
@@ -49,6 +49,7 @@ namespace OpenSim.Data
|
||||
bool Store(PresenceData data);
|
||||
|
||||
PresenceData Get(UUID sessionID);
|
||||
PresenceData Verify(UUID s_sessionID);
|
||||
void LogoutRegionAgents(UUID regionID);
|
||||
bool ReportAgent(UUID sessionID, UUID regionID);
|
||||
PresenceData[] Get(string field, string data);
|
||||
|
||||
@@ -61,6 +61,17 @@ namespace OpenSim.Data.MSSQL
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public PresenceData Verify(UUID s_sessionID)
|
||||
{
|
||||
PresenceData[] ret = Get("SecureSessionID",
|
||||
s_sessionID.ToString());
|
||||
|
||||
if (ret.Length == 0)
|
||||
return null;
|
||||
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public void LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
|
||||
@@ -79,14 +79,7 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
ret.PrincipalID = principalID;
|
||||
|
||||
if (m_ColumnNames == null)
|
||||
{
|
||||
m_ColumnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
CheckColumnNames(result);
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
{
|
||||
@@ -105,6 +98,20 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckColumnNames(IDataReader result)
|
||||
{
|
||||
if (m_ColumnNames != null)
|
||||
return;
|
||||
|
||||
List<string> columnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
columnNames.Add(row["ColumnName"].ToString());
|
||||
|
||||
m_ColumnNames = columnNames;
|
||||
}
|
||||
|
||||
public bool Store(AuthenticationData data)
|
||||
{
|
||||
if (data.Data.ContainsKey("UUID"))
|
||||
|
||||
@@ -91,15 +91,17 @@ namespace OpenSim.Data.MySQL
|
||||
if (m_ColumnNames != null)
|
||||
return;
|
||||
|
||||
m_ColumnNames = new List<string>();
|
||||
List<string> columnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = reader.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
{
|
||||
if (row["ColumnName"] != null &&
|
||||
(!m_Fields.ContainsKey(row["ColumnName"].ToString())))
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
columnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
|
||||
m_ColumnNames = columnNames;
|
||||
}
|
||||
|
||||
public virtual T[] Get(string field, string key)
|
||||
|
||||
@@ -61,6 +61,17 @@ namespace OpenSim.Data.MySQL
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public PresenceData Verify(UUID s_sessionID)
|
||||
{
|
||||
PresenceData[] ret = Get("SecureSessionID",
|
||||
s_sessionID.ToString());
|
||||
|
||||
if (ret.Length == 0)
|
||||
return null;
|
||||
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public void LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
@@ -162,17 +162,7 @@ namespace OpenSim.Data.MySQL
|
||||
ret.sizeX = Convert.ToInt32(result["sizeX"]);
|
||||
ret.sizeY = Convert.ToInt32(result["sizeY"]);
|
||||
|
||||
if (m_ColumnNames == null)
|
||||
{
|
||||
m_ColumnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
{
|
||||
if (row["ColumnName"] != null)
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
}
|
||||
CheckColumnNames(result);
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
{
|
||||
@@ -187,7 +177,11 @@ namespace OpenSim.Data.MySQL
|
||||
if (s == "locY")
|
||||
continue;
|
||||
|
||||
ret.Data[s] = result[s].ToString();
|
||||
object value = result[s];
|
||||
if (value is DBNull)
|
||||
ret.Data[s] = null;
|
||||
else
|
||||
ret.Data[s] = result[s].ToString();
|
||||
}
|
||||
|
||||
retList.Add(ret);
|
||||
@@ -198,6 +192,23 @@ namespace OpenSim.Data.MySQL
|
||||
return retList;
|
||||
}
|
||||
|
||||
private void CheckColumnNames(IDataReader result)
|
||||
{
|
||||
if (m_ColumnNames != null)
|
||||
return;
|
||||
|
||||
List<string> columnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
{
|
||||
if (row["ColumnName"] != null)
|
||||
columnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
|
||||
m_ColumnNames = columnNames;
|
||||
}
|
||||
|
||||
public bool Store(RegionData data)
|
||||
{
|
||||
if (data.Data.ContainsKey("uuid"))
|
||||
|
||||
@@ -79,6 +79,19 @@ namespace OpenSim.Data.Null
|
||||
return null;
|
||||
}
|
||||
|
||||
public PresenceData Verify(UUID s_sessionID)
|
||||
{
|
||||
if (Instance != this)
|
||||
return Instance.Verify(s_sessionID);
|
||||
|
||||
if (m_presenceData.ContainsKey(s_sessionID))
|
||||
{
|
||||
return m_presenceData[s_sessionID];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
if (Instance != this)
|
||||
|
||||
@@ -296,6 +296,10 @@ namespace OpenSim.Framework.Console
|
||||
matches[0].Groups["Category"].Value);
|
||||
System.Console.Write("]:");
|
||||
}
|
||||
else
|
||||
{
|
||||
outText = outText.Trim();
|
||||
}
|
||||
}
|
||||
|
||||
if (level == "error")
|
||||
|
||||
@@ -322,7 +322,7 @@ namespace OpenSim.Framework
|
||||
l_EstateManagers.Remove(avatarID);
|
||||
}
|
||||
|
||||
public bool IsEstateManager(UUID avatarID)
|
||||
public bool IsEstateManagerOrOwner(UUID avatarID)
|
||||
{
|
||||
if (IsEstateOwner(avatarID))
|
||||
return true;
|
||||
@@ -368,7 +368,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public bool HasAccess(UUID user)
|
||||
{
|
||||
if (IsEstateManager(user))
|
||||
if (IsEstateManagerOrOwner(user))
|
||||
return true;
|
||||
|
||||
return l_EstateAccess.Contains(user);
|
||||
|
||||
@@ -51,10 +51,12 @@ namespace OpenSim.Framework
|
||||
protected object m_senderObject;
|
||||
protected ChatTypeEnum m_type;
|
||||
protected UUID m_fromID;
|
||||
protected UUID m_toID;
|
||||
|
||||
public OSChatMessage()
|
||||
{
|
||||
m_position = new Vector3();
|
||||
m_toID = UUID.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -102,6 +104,15 @@ namespace OpenSim.Framework
|
||||
set { m_from = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The name of the sender (needed for scripts)
|
||||
/// </summary>
|
||||
public string To
|
||||
{
|
||||
get { return m_from; }
|
||||
set { m_from = value; }
|
||||
}
|
||||
|
||||
#region IEventArgs Members
|
||||
|
||||
/// TODO: Sender and SenderObject should just be Sender and of
|
||||
@@ -131,6 +142,15 @@ namespace OpenSim.Framework
|
||||
set { m_fromID = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The single recipient or all if not set.
|
||||
/// </summary>
|
||||
public UUID TargetUUID
|
||||
{
|
||||
get { return m_toID; }
|
||||
set { m_toID = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
+168
-218
@@ -38,239 +38,189 @@ namespace OpenSim.Framework
|
||||
public static class SLUtil
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
||||
#region SL / file extension / content-type conversions
|
||||
|
||||
private class TypeMapping
|
||||
{
|
||||
private sbyte assetType;
|
||||
private InventoryType inventoryType;
|
||||
private string contentType;
|
||||
private string contentType2;
|
||||
private string extension;
|
||||
|
||||
public sbyte AssetTypeCode
|
||||
{
|
||||
get { return assetType; }
|
||||
}
|
||||
|
||||
public object AssetType
|
||||
{
|
||||
get {
|
||||
if (Enum.IsDefined(typeof(OpenMetaverse.AssetType), assetType))
|
||||
return (OpenMetaverse.AssetType)assetType;
|
||||
else
|
||||
return OpenMetaverse.AssetType.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
public InventoryType InventoryType
|
||||
{
|
||||
get { return inventoryType; }
|
||||
}
|
||||
|
||||
public string ContentType
|
||||
{
|
||||
get { return contentType; }
|
||||
}
|
||||
|
||||
public string ContentType2
|
||||
{
|
||||
get { return contentType2; }
|
||||
}
|
||||
|
||||
public string Extension
|
||||
{
|
||||
get { return extension; }
|
||||
}
|
||||
|
||||
private TypeMapping(sbyte assetType, InventoryType inventoryType, string contentType, string contentType2, string extension)
|
||||
{
|
||||
this.assetType = assetType;
|
||||
this.inventoryType = inventoryType;
|
||||
this.contentType = contentType;
|
||||
this.contentType2 = contentType2;
|
||||
this.extension = extension;
|
||||
}
|
||||
|
||||
public TypeMapping(AssetType assetType, InventoryType inventoryType, string contentType, string contentType2, string extension)
|
||||
: this((sbyte)assetType, inventoryType, contentType, contentType2, extension)
|
||||
{
|
||||
}
|
||||
|
||||
public TypeMapping(AssetType assetType, InventoryType inventoryType, string contentType, string extension)
|
||||
: this((sbyte)assetType, inventoryType, contentType, null, extension)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps between AssetType, InventoryType and Content-Type.
|
||||
/// Where more than one possibility exists, the first one takes precedence. E.g.:
|
||||
/// AssetType "AssetType.Texture" -> Content-Type "image-xj2c"
|
||||
/// Content-Type "image/x-j2c" -> InventoryType "InventoryType.Texture"
|
||||
/// </summary>
|
||||
private static TypeMapping[] MAPPINGS = new TypeMapping[] {
|
||||
new TypeMapping(AssetType.Unknown, InventoryType.Unknown, "application/octet-stream", "bin"),
|
||||
new TypeMapping(AssetType.Texture, InventoryType.Texture, "image/x-j2c", "image/jp2", "j2c"),
|
||||
new TypeMapping(AssetType.Texture, InventoryType.Snapshot, "image/x-j2c", "image/jp2", "j2c"),
|
||||
new TypeMapping(AssetType.TextureTGA, InventoryType.Texture, "image/tga", "tga"),
|
||||
new TypeMapping(AssetType.ImageTGA, InventoryType.Texture, "image/tga", "tga"),
|
||||
new TypeMapping(AssetType.ImageJPEG, InventoryType.Texture, "image/jpeg", "jpg"),
|
||||
new TypeMapping(AssetType.Sound, InventoryType.Sound, "audio/ogg", "application/ogg", "ogg"),
|
||||
new TypeMapping(AssetType.SoundWAV, InventoryType.Sound, "audio/x-wav", "wav"),
|
||||
new TypeMapping(AssetType.CallingCard, InventoryType.CallingCard, "application/vnd.ll.callingcard", "application/x-metaverse-callingcard", "callingcard"),
|
||||
new TypeMapping(AssetType.Landmark, InventoryType.Landmark, "application/vnd.ll.landmark", "application/x-metaverse-landmark", "landmark"),
|
||||
new TypeMapping(AssetType.Clothing, InventoryType.Wearable, "application/vnd.ll.clothing", "application/x-metaverse-clothing", "clothing"),
|
||||
new TypeMapping(AssetType.Object, InventoryType.Object, "application/vnd.ll.primitive", "application/x-metaverse-primitive", "primitive"),
|
||||
new TypeMapping(AssetType.Object, InventoryType.Attachment, "application/vnd.ll.primitive", "application/x-metaverse-primitive", "primitive"),
|
||||
new TypeMapping(AssetType.Notecard, InventoryType.Notecard, "application/vnd.ll.notecard", "application/x-metaverse-notecard", "notecard"),
|
||||
new TypeMapping(AssetType.Folder, InventoryType.Folder, "application/vnd.ll.folder", "folder"),
|
||||
new TypeMapping(AssetType.RootFolder, InventoryType.RootCategory, "application/vnd.ll.rootfolder", "rootfolder"),
|
||||
new TypeMapping(AssetType.LSLText, InventoryType.LSL, "application/vnd.ll.lsltext", "application/x-metaverse-lsl", "lsl"),
|
||||
new TypeMapping(AssetType.LSLBytecode, InventoryType.LSL, "application/vnd.ll.lslbyte", "application/x-metaverse-lso", "lso"),
|
||||
new TypeMapping(AssetType.Bodypart, InventoryType.Wearable, "application/vnd.ll.bodypart", "application/x-metaverse-bodypart", "bodypart"),
|
||||
new TypeMapping(AssetType.TrashFolder, InventoryType.Folder, "application/vnd.ll.trashfolder", "trashfolder"),
|
||||
new TypeMapping(AssetType.SnapshotFolder, InventoryType.Folder, "application/vnd.ll.snapshotfolder", "snapshotfolder"),
|
||||
new TypeMapping(AssetType.LostAndFoundFolder, InventoryType.Folder, "application/vnd.ll.lostandfoundfolder", "lostandfoundfolder"),
|
||||
new TypeMapping(AssetType.Animation, InventoryType.Animation, "application/vnd.ll.animation", "application/x-metaverse-animation", "animation"),
|
||||
new TypeMapping(AssetType.Gesture, InventoryType.Gesture, "application/vnd.ll.gesture", "application/x-metaverse-gesture", "gesture"),
|
||||
new TypeMapping(AssetType.Simstate, InventoryType.Snapshot, "application/x-metaverse-simstate", "simstate"),
|
||||
new TypeMapping(AssetType.FavoriteFolder, InventoryType.Unknown, "application/vnd.ll.favoritefolder", "favoritefolder"),
|
||||
new TypeMapping(AssetType.Link, InventoryType.Unknown, "application/vnd.ll.link", "link"),
|
||||
new TypeMapping(AssetType.LinkFolder, InventoryType.Unknown, "application/vnd.ll.linkfolder", "linkfolder"),
|
||||
new TypeMapping(AssetType.CurrentOutfitFolder, InventoryType.Unknown, "application/vnd.ll.currentoutfitfolder", "currentoutfitfolder"),
|
||||
new TypeMapping(AssetType.OutfitFolder, InventoryType.Unknown, "application/vnd.ll.outfitfolder", "outfitfolder"),
|
||||
new TypeMapping(AssetType.MyOutfitsFolder, InventoryType.Unknown, "application/vnd.ll.myoutfitsfolder", "myoutfitsfolder"),
|
||||
new TypeMapping(AssetType.Mesh, InventoryType.Mesh, "application/vnd.ll.mesh", "llm")
|
||||
};
|
||||
|
||||
private static Dictionary<sbyte, string> asset2Content;
|
||||
private static Dictionary<sbyte, string> asset2Extension;
|
||||
private static Dictionary<InventoryType, string> inventory2Content;
|
||||
private static Dictionary<string, sbyte> content2Asset;
|
||||
private static Dictionary<string, InventoryType> content2Inventory;
|
||||
|
||||
static SLUtil()
|
||||
{
|
||||
asset2Content = new Dictionary<sbyte, string>();
|
||||
asset2Extension = new Dictionary<sbyte, string>();
|
||||
inventory2Content = new Dictionary<InventoryType, string>();
|
||||
content2Asset = new Dictionary<string, sbyte>();
|
||||
content2Inventory = new Dictionary<string, InventoryType>();
|
||||
|
||||
foreach (TypeMapping mapping in MAPPINGS)
|
||||
{
|
||||
sbyte assetType = mapping.AssetTypeCode;
|
||||
if (!asset2Content.ContainsKey(assetType))
|
||||
asset2Content.Add(assetType, mapping.ContentType);
|
||||
if (!asset2Extension.ContainsKey(assetType))
|
||||
asset2Extension.Add(assetType, mapping.Extension);
|
||||
if (!inventory2Content.ContainsKey(mapping.InventoryType))
|
||||
inventory2Content.Add(mapping.InventoryType, mapping.ContentType);
|
||||
if (!content2Asset.ContainsKey(mapping.ContentType))
|
||||
content2Asset.Add(mapping.ContentType, assetType);
|
||||
if (!content2Inventory.ContainsKey(mapping.ContentType))
|
||||
content2Inventory.Add(mapping.ContentType, mapping.InventoryType);
|
||||
|
||||
if (mapping.ContentType2 != null)
|
||||
{
|
||||
if (!content2Asset.ContainsKey(mapping.ContentType2))
|
||||
content2Asset.Add(mapping.ContentType2, assetType);
|
||||
if (!content2Inventory.ContainsKey(mapping.ContentType2))
|
||||
content2Inventory.Add(mapping.ContentType2, mapping.InventoryType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string SLAssetTypeToContentType(int assetType)
|
||||
{
|
||||
switch ((AssetType)assetType)
|
||||
{
|
||||
case AssetType.Texture:
|
||||
return "image/x-j2c";
|
||||
case AssetType.Sound:
|
||||
return "audio/ogg";
|
||||
case AssetType.CallingCard:
|
||||
return "application/vnd.ll.callingcard";
|
||||
case AssetType.Landmark:
|
||||
return "application/vnd.ll.landmark";
|
||||
case AssetType.Clothing:
|
||||
return "application/vnd.ll.clothing";
|
||||
case AssetType.Object:
|
||||
return "application/vnd.ll.primitive";
|
||||
case AssetType.Notecard:
|
||||
return "application/vnd.ll.notecard";
|
||||
case AssetType.Folder:
|
||||
return "application/vnd.ll.folder";
|
||||
case AssetType.RootFolder:
|
||||
return "application/vnd.ll.rootfolder";
|
||||
case AssetType.LSLText:
|
||||
return "application/vnd.ll.lsltext";
|
||||
case AssetType.LSLBytecode:
|
||||
return "application/vnd.ll.lslbyte";
|
||||
case AssetType.TextureTGA:
|
||||
case AssetType.ImageTGA:
|
||||
return "image/tga";
|
||||
case AssetType.Bodypart:
|
||||
return "application/vnd.ll.bodypart";
|
||||
case AssetType.TrashFolder:
|
||||
return "application/vnd.ll.trashfolder";
|
||||
case AssetType.SnapshotFolder:
|
||||
return "application/vnd.ll.snapshotfolder";
|
||||
case AssetType.LostAndFoundFolder:
|
||||
return "application/vnd.ll.lostandfoundfolder";
|
||||
case AssetType.SoundWAV:
|
||||
return "audio/x-wav";
|
||||
case AssetType.ImageJPEG:
|
||||
return "image/jpeg";
|
||||
case AssetType.Animation:
|
||||
return "application/vnd.ll.animation";
|
||||
case AssetType.Gesture:
|
||||
return "application/vnd.ll.gesture";
|
||||
case AssetType.Simstate:
|
||||
return "application/x-metaverse-simstate";
|
||||
case AssetType.FavoriteFolder:
|
||||
return "application/vnd.ll.favoritefolder";
|
||||
case AssetType.Link:
|
||||
return "application/vnd.ll.link";
|
||||
case AssetType.LinkFolder:
|
||||
return "application/vnd.ll.linkfolder";
|
||||
case AssetType.CurrentOutfitFolder:
|
||||
return "application/vnd.ll.currentoutfitfolder";
|
||||
case AssetType.OutfitFolder:
|
||||
return "application/vnd.ll.outfitfolder";
|
||||
case AssetType.MyOutfitsFolder:
|
||||
return "application/vnd.ll.myoutfitsfolder";
|
||||
case AssetType.Unknown:
|
||||
default:
|
||||
return "application/octet-stream";
|
||||
}
|
||||
string contentType;
|
||||
if (!asset2Content.TryGetValue((sbyte)assetType, out contentType))
|
||||
contentType = asset2Content[(sbyte)AssetType.Unknown];
|
||||
return contentType;
|
||||
}
|
||||
|
||||
public static string SLInvTypeToContentType(int invType)
|
||||
{
|
||||
switch ((InventoryType)invType)
|
||||
{
|
||||
case InventoryType.Animation:
|
||||
return "application/vnd.ll.animation";
|
||||
case InventoryType.CallingCard:
|
||||
return "application/vnd.ll.callingcard";
|
||||
case InventoryType.Folder:
|
||||
return "application/vnd.ll.folder";
|
||||
case InventoryType.Gesture:
|
||||
return "application/vnd.ll.gesture";
|
||||
case InventoryType.Landmark:
|
||||
return "application/vnd.ll.landmark";
|
||||
case InventoryType.LSL:
|
||||
return "application/vnd.ll.lsltext";
|
||||
case InventoryType.Notecard:
|
||||
return "application/vnd.ll.notecard";
|
||||
case InventoryType.Attachment:
|
||||
case InventoryType.Object:
|
||||
return "application/vnd.ll.primitive";
|
||||
case InventoryType.Sound:
|
||||
return "audio/ogg";
|
||||
case InventoryType.Snapshot:
|
||||
case InventoryType.Texture:
|
||||
return "image/x-j2c";
|
||||
case InventoryType.Wearable:
|
||||
return "application/vnd.ll.clothing";
|
||||
default:
|
||||
return "application/octet-stream";
|
||||
}
|
||||
string contentType;
|
||||
if (!inventory2Content.TryGetValue((InventoryType)invType, out contentType))
|
||||
contentType = inventory2Content[InventoryType.Unknown];
|
||||
return contentType;
|
||||
}
|
||||
|
||||
public static sbyte ContentTypeToSLAssetType(string contentType)
|
||||
{
|
||||
switch (contentType)
|
||||
{
|
||||
case "image/x-j2c":
|
||||
case "image/jp2":
|
||||
return (sbyte)AssetType.Texture;
|
||||
case "application/ogg":
|
||||
case "audio/ogg":
|
||||
return (sbyte)AssetType.Sound;
|
||||
case "application/vnd.ll.callingcard":
|
||||
case "application/x-metaverse-callingcard":
|
||||
return (sbyte)AssetType.CallingCard;
|
||||
case "application/vnd.ll.landmark":
|
||||
case "application/x-metaverse-landmark":
|
||||
return (sbyte)AssetType.Landmark;
|
||||
case "application/vnd.ll.clothing":
|
||||
case "application/x-metaverse-clothing":
|
||||
return (sbyte)AssetType.Clothing;
|
||||
case "application/vnd.ll.primitive":
|
||||
case "application/x-metaverse-primitive":
|
||||
return (sbyte)AssetType.Object;
|
||||
case "application/vnd.ll.notecard":
|
||||
case "application/x-metaverse-notecard":
|
||||
return (sbyte)AssetType.Notecard;
|
||||
case "application/vnd.ll.folder":
|
||||
return (sbyte)AssetType.Folder;
|
||||
case "application/vnd.ll.rootfolder":
|
||||
return (sbyte)AssetType.RootFolder;
|
||||
case "application/vnd.ll.lsltext":
|
||||
case "application/x-metaverse-lsl":
|
||||
return (sbyte)AssetType.LSLText;
|
||||
case "application/vnd.ll.lslbyte":
|
||||
case "application/x-metaverse-lso":
|
||||
return (sbyte)AssetType.LSLBytecode;
|
||||
case "image/tga":
|
||||
// Note that AssetType.TextureTGA will be converted to AssetType.ImageTGA
|
||||
return (sbyte)AssetType.ImageTGA;
|
||||
case "application/vnd.ll.bodypart":
|
||||
case "application/x-metaverse-bodypart":
|
||||
return (sbyte)AssetType.Bodypart;
|
||||
case "application/vnd.ll.trashfolder":
|
||||
return (sbyte)AssetType.TrashFolder;
|
||||
case "application/vnd.ll.snapshotfolder":
|
||||
return (sbyte)AssetType.SnapshotFolder;
|
||||
case "application/vnd.ll.lostandfoundfolder":
|
||||
return (sbyte)AssetType.LostAndFoundFolder;
|
||||
case "audio/x-wav":
|
||||
return (sbyte)AssetType.SoundWAV;
|
||||
case "image/jpeg":
|
||||
return (sbyte)AssetType.ImageJPEG;
|
||||
case "application/vnd.ll.animation":
|
||||
case "application/x-metaverse-animation":
|
||||
return (sbyte)AssetType.Animation;
|
||||
case "application/vnd.ll.gesture":
|
||||
case "application/x-metaverse-gesture":
|
||||
return (sbyte)AssetType.Gesture;
|
||||
case "application/x-metaverse-simstate":
|
||||
return (sbyte)AssetType.Simstate;
|
||||
case "application/vnd.ll.favoritefolder":
|
||||
return (sbyte)AssetType.FavoriteFolder;
|
||||
case "application/vnd.ll.link":
|
||||
return (sbyte)AssetType.Link;
|
||||
case "application/vnd.ll.linkfolder":
|
||||
return (sbyte)AssetType.LinkFolder;
|
||||
case "application/vnd.ll.currentoutfitfolder":
|
||||
return (sbyte)AssetType.CurrentOutfitFolder;
|
||||
case "application/vnd.ll.outfitfolder":
|
||||
return (sbyte)AssetType.OutfitFolder;
|
||||
case "application/vnd.ll.myoutfitsfolder":
|
||||
return (sbyte)AssetType.MyOutfitsFolder;
|
||||
case "application/octet-stream":
|
||||
default:
|
||||
return (sbyte)AssetType.Unknown;
|
||||
}
|
||||
sbyte assetType;
|
||||
if (!content2Asset.TryGetValue(contentType, out assetType))
|
||||
assetType = (sbyte)AssetType.Unknown;
|
||||
return (sbyte)assetType;
|
||||
}
|
||||
|
||||
public static sbyte ContentTypeToSLInvType(string contentType)
|
||||
{
|
||||
switch (contentType)
|
||||
{
|
||||
case "image/x-j2c":
|
||||
case "image/jp2":
|
||||
case "image/tga":
|
||||
case "image/jpeg":
|
||||
return (sbyte)InventoryType.Texture;
|
||||
case "application/ogg":
|
||||
case "audio/ogg":
|
||||
case "audio/x-wav":
|
||||
return (sbyte)InventoryType.Sound;
|
||||
case "application/vnd.ll.callingcard":
|
||||
case "application/x-metaverse-callingcard":
|
||||
return (sbyte)InventoryType.CallingCard;
|
||||
case "application/vnd.ll.landmark":
|
||||
case "application/x-metaverse-landmark":
|
||||
return (sbyte)InventoryType.Landmark;
|
||||
case "application/vnd.ll.clothing":
|
||||
case "application/x-metaverse-clothing":
|
||||
case "application/vnd.ll.bodypart":
|
||||
case "application/x-metaverse-bodypart":
|
||||
return (sbyte)InventoryType.Wearable;
|
||||
case "application/vnd.ll.primitive":
|
||||
case "application/x-metaverse-primitive":
|
||||
return (sbyte)InventoryType.Object;
|
||||
case "application/vnd.ll.notecard":
|
||||
case "application/x-metaverse-notecard":
|
||||
return (sbyte)InventoryType.Notecard;
|
||||
case "application/vnd.ll.folder":
|
||||
return (sbyte)InventoryType.Folder;
|
||||
case "application/vnd.ll.rootfolder":
|
||||
return (sbyte)InventoryType.RootCategory;
|
||||
case "application/vnd.ll.lsltext":
|
||||
case "application/x-metaverse-lsl":
|
||||
case "application/vnd.ll.lslbyte":
|
||||
case "application/x-metaverse-lso":
|
||||
return (sbyte)InventoryType.LSL;
|
||||
case "application/vnd.ll.trashfolder":
|
||||
case "application/vnd.ll.snapshotfolder":
|
||||
case "application/vnd.ll.lostandfoundfolder":
|
||||
return (sbyte)InventoryType.Folder;
|
||||
case "application/vnd.ll.animation":
|
||||
case "application/x-metaverse-animation":
|
||||
return (sbyte)InventoryType.Animation;
|
||||
case "application/vnd.ll.gesture":
|
||||
case "application/x-metaverse-gesture":
|
||||
return (sbyte)InventoryType.Gesture;
|
||||
case "application/x-metaverse-simstate":
|
||||
return (sbyte)InventoryType.Snapshot;
|
||||
case "application/octet-stream":
|
||||
default:
|
||||
return (sbyte)InventoryType.Unknown;
|
||||
}
|
||||
InventoryType invType;
|
||||
if (!content2Inventory.TryGetValue(contentType, out invType))
|
||||
invType = InventoryType.Unknown;
|
||||
return (sbyte)invType;
|
||||
}
|
||||
|
||||
public static string SLAssetTypeToExtension(int assetType)
|
||||
{
|
||||
string extension;
|
||||
if (!asset2Extension.TryGetValue((sbyte)assetType, out extension))
|
||||
extension = asset2Extension[(sbyte)AssetType.Unknown];
|
||||
return extension;
|
||||
}
|
||||
|
||||
#endregion SL / file extension / content-type conversions
|
||||
@@ -377,4 +327,4 @@ namespace OpenSim.Framework
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -662,11 +662,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e);
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}{1}", e.Message, e.StackTrace);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e.StackTrace);
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}{1}", e.Message, e.StackTrace);
|
||||
SendHTML500(response);
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -227,10 +227,10 @@ namespace OpenSim.Framework.Tests
|
||||
es.AddEstateManager(UUID.Zero);
|
||||
|
||||
es.AddEstateManager(bannedUserId);
|
||||
Assert.IsTrue(es.IsEstateManager(bannedUserId), "bannedUserId should be EstateManager but isn't.");
|
||||
Assert.IsTrue(es.IsEstateManagerOrOwner(bannedUserId), "bannedUserId should be EstateManager but isn't.");
|
||||
|
||||
es.RemoveEstateManager(bannedUserId);
|
||||
Assert.IsFalse(es.IsEstateManager(bannedUserId), "bannedUserID is estateManager but shouldn't be");
|
||||
Assert.IsFalse(es.IsEstateManagerOrOwner(bannedUserId), "bannedUserID is estateManager but shouldn't be");
|
||||
|
||||
Assert.IsFalse(es.HasAccess(bannedUserId), "bannedUserID has access but shouldn't");
|
||||
|
||||
|
||||
@@ -214,16 +214,13 @@ namespace OpenSim.Framework.Tests
|
||||
|
||||
for (int i = 0; i < contenttypes.Length; i++)
|
||||
{
|
||||
if (SLUtil.ContentTypeToSLAssetType(contenttypes[i]) == 18)
|
||||
{
|
||||
Assert.That(contenttypes[i] == "image/tga");
|
||||
}
|
||||
int expected;
|
||||
if (contenttypes[i] == "image/tga")
|
||||
expected = 12; // if we know only the content-type "image/tga", then we assume the asset type is TextureTGA; not ImageTGA
|
||||
else
|
||||
{
|
||||
Assert.That(SLUtil.ContentTypeToSLAssetType(contenttypes[i]) == assettypes[i],
|
||||
"Expecting {0} but got {1}", assettypes[i],
|
||||
SLUtil.ContentTypeToSLAssetType(contenttypes[i]));
|
||||
}
|
||||
expected = assettypes[i];
|
||||
Assert.AreEqual(expected, SLUtil.ContentTypeToSLAssetType(contenttypes[i]),
|
||||
String.Format("Incorrect AssetType mapped from Content-Type {0}", contenttypes[i]));
|
||||
}
|
||||
|
||||
int[] inventorytypes = new int[] {-1,0,1,2,3,6,7,8,9,10,15,17,18,20};
|
||||
@@ -237,7 +234,7 @@ namespace OpenSim.Framework.Tests
|
||||
"application/vnd.ll.primitive",
|
||||
"application/vnd.ll.notecard",
|
||||
"application/vnd.ll.folder",
|
||||
"application/octet-stream",
|
||||
"application/vnd.ll.rootfolder",
|
||||
"application/vnd.ll.lsltext",
|
||||
"image/x-j2c",
|
||||
"application/vnd.ll.primitive",
|
||||
@@ -247,7 +244,8 @@ namespace OpenSim.Framework.Tests
|
||||
|
||||
for (int i=0;i<inventorytypes.Length;i++)
|
||||
{
|
||||
Assert.That(SLUtil.SLInvTypeToContentType(inventorytypes[i]) == invcontenttypes[i], "Expected {0}, Got {1}", invcontenttypes[i], SLUtil.SLInvTypeToContentType(inventorytypes[i]));
|
||||
Assert.AreEqual(invcontenttypes[i], SLUtil.SLInvTypeToContentType(inventorytypes[i]),
|
||||
String.Format("Incorrect Content-Type mapped from InventoryType {0}", inventorytypes[i]));
|
||||
}
|
||||
|
||||
invcontenttypes = new string[]
|
||||
@@ -280,7 +278,8 @@ namespace OpenSim.Framework.Tests
|
||||
|
||||
for (int i = 0; i < invtypes.Length; i++)
|
||||
{
|
||||
Assert.That(SLUtil.ContentTypeToSLInvType(invcontenttypes[i]) == invtypes[i], "Expected {0}, Got {1}", invtypes[i], SLUtil.ContentTypeToSLInvType(invcontenttypes[i]));
|
||||
Assert.AreEqual(invtypes[i], SLUtil.ContentTypeToSLInvType(invcontenttypes[i]),
|
||||
String.Format("Incorrect InventoryType mapped from Content-Type {0}", invcontenttypes[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,8 +86,7 @@ namespace OpenSim.Framework
|
||||
return eplock;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region JSONRequest
|
||||
|
||||
/// <summary>
|
||||
@@ -216,7 +215,9 @@ namespace OpenSim.Framework
|
||||
reqnum,url,method,tickdiff,tickdata);
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
|
||||
|
||||
return ErrorResponseMap(errorMessage);
|
||||
}
|
||||
|
||||
@@ -357,7 +358,8 @@ namespace OpenSim.Framework
|
||||
reqnum,url,method,tickdiff,tickdata);
|
||||
}
|
||||
|
||||
m_log.WarnFormat("[WEB UTIL]: <{0}> form request failed: {1}",reqnum,errorMessage);
|
||||
m_log.WarnFormat("[WEB UTIL]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage);
|
||||
|
||||
return ErrorResponseMap(errorMessage);
|
||||
}
|
||||
|
||||
@@ -771,12 +773,16 @@ namespace OpenSim.Framework
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", verb, requestUrl, e.Status, e.Message);
|
||||
m_log.ErrorFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}",
|
||||
verb, requestUrl, e.Status, e.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e);
|
||||
m_log.ErrorFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}",
|
||||
verb, requestUrl, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
|
||||
@@ -788,7 +794,8 @@ namespace OpenSim.Framework
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e);
|
||||
"[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}{3}",
|
||||
verb, requestUrl, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
}, null);
|
||||
@@ -841,7 +848,8 @@ namespace OpenSim.Framework
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
|
||||
m_log.DebugFormat(
|
||||
"[FORMS]: exception occured {0} {1}: {2}{3}", verb, requestUrl, e.Message, e.StackTrace);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -867,7 +875,9 @@ namespace OpenSim.Framework
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
|
||||
m_log.DebugFormat(
|
||||
"[FORMS]: Exception occured on receiving {0} {1}: {2}{3}",
|
||||
verb, requestUrl, e.Message, e.StackTrace);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -880,7 +890,7 @@ namespace OpenSim.Framework
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
// This is what happens when there is invalid XML
|
||||
m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
|
||||
m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving {0} {1}", verb, requestUrl);
|
||||
}
|
||||
}
|
||||
return respstring;
|
||||
@@ -938,7 +948,10 @@ namespace OpenSim.Framework
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[SynchronousRestObjectRequester]: exception in sending data to {0}: {1}", requestUrl, e);
|
||||
m_log.DebugFormat(
|
||||
"[SynchronousRestObjectRequester]: Exception in making request {0} {1}: {2}{3}",
|
||||
verb, requestUrl, e.Message, e.StackTrace);
|
||||
|
||||
return deserial;
|
||||
}
|
||||
finally
|
||||
@@ -960,7 +973,11 @@ namespace OpenSim.Framework
|
||||
respStream.Close();
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb);
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}",
|
||||
verb, requestUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
@@ -971,20 +988,24 @@ namespace OpenSim.Framework
|
||||
return deserial;
|
||||
else
|
||||
m_log.ErrorFormat(
|
||||
"[SynchronousRestObjectRequester]: WebException {0} {1} {2} {3}",
|
||||
requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace);
|
||||
"[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}",
|
||||
verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace);
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
// This is what happens when there is invalid XML
|
||||
m_log.DebugFormat("[SynchronousRestObjectRequester]: Invalid XML {0} {1}", requestUrl, typeof(TResponse).ToString());
|
||||
m_log.DebugFormat(
|
||||
"[SynchronousRestObjectRequester]: Invalid XML from {0} {1} {2}",
|
||||
verb, requestUrl, typeof(TResponse).ToString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}", requestUrl, e);
|
||||
m_log.DebugFormat(
|
||||
"[SynchronousRestObjectRequester]: Exception on response from {0} {1}: {2}{3}",
|
||||
verb, requestUrl, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
return deserial;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,7 +235,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
|
||||
{
|
||||
m_log.DebugFormat("[CAPS]: Unauthorized CAPS client");
|
||||
m_log.DebugFormat(
|
||||
"[CAPS]: Unauthorized CAPS client {0} from {1}",
|
||||
m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint);
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
|
||||
CapabilitiesModule capsModule = new CapabilitiesModule();
|
||||
EventQueueGetModule eqgModule = new EventQueueGetModule();
|
||||
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, config, capsModule, eqgModule);
|
||||
}
|
||||
|
||||
|
||||
@@ -916,7 +916,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
UDPPacketBuffer buffer = (UDPPacketBuffer)array[0];
|
||||
UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1];
|
||||
|
||||
m_log.DebugFormat("[LLUDPSERVER]: Handling UseCircuitCode request from {0}", buffer.RemoteEndPoint);
|
||||
m_log.DebugFormat(
|
||||
"[LLUDPSERVER]: Handling UseCircuitCode request for circuit {0} from {1}",
|
||||
uccp.CircuitCode.Code, buffer.RemoteEndPoint);
|
||||
|
||||
remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint;
|
||||
|
||||
@@ -1350,7 +1352,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[LLUDPSERVER]: Dropping incoming {0} packet for dead client {1}", packet.Type, udpClient.AgentID);
|
||||
m_log.DebugFormat(
|
||||
"[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
|
||||
packet.Type, udpClient.AgentID, m_scene.RegionInfo.RegionName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||
TestHelpers.InMethod();
|
||||
// XmlConfigurator.Configure();
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
uint myCircuitCode = 123456;
|
||||
UUID myAgentUuid = TestHelpers.ParseTail(0x1);
|
||||
UUID mySessionUuid = TestHelpers.ParseTail(0x2);
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||
|
||||
J2KDecoderModule j2kdm = new J2KDecoderModule();
|
||||
|
||||
scene = SceneHelpers.SetupScene();
|
||||
scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, j2kdm);
|
||||
|
||||
tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.Asset.Tests
|
||||
config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true");
|
||||
|
||||
m_cache = new FlotsamAssetCache();
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, config, m_cache);
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ATTACHMENTS MODULE]: Unable to rez attachment: {0}{1}", e.Message, e.StackTrace);
|
||||
UUID agentId = (sp.ControllingClient == null) ? (UUID)null : sp.ControllingClient.AgentId;
|
||||
m_log.ErrorFormat("[ATTACHMENTS MODULE]: Unable to rez attachment with itemID {0}, assetID {1}, point {2} for {3}: {4}\n{5}",
|
||||
attach.ItemID, attach.AssetID, p, agentId, e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -389,7 +391,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
lock (sp.AttachmentsSyncLock)
|
||||
{
|
||||
// Save avatar attachment information
|
||||
m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID);
|
||||
// m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID);
|
||||
|
||||
bool changed = sp.Appearance.DetachAttachment(itemID);
|
||||
if (changed && m_scene.AvatarFactory != null)
|
||||
@@ -469,9 +471,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
|
||||
if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts()))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
|
||||
grp.UUID, grp.AttachmentPoint);
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
|
||||
// grp.UUID, grp.AttachmentPoint);
|
||||
|
||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
|
||||
|
||||
@@ -502,12 +504,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
}
|
||||
grp.HasGroupChanged = false; // Prevent it being saved over and over
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
|
||||
grp.UUID, grp.AttachmentPoint);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
|
||||
// grp.UUID, grp.AttachmentPoint);
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -889,13 +891,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
// Calls attach with a Zero position
|
||||
if (AttachObject(sp, part.ParentGroup, AttachmentPt, false))
|
||||
{
|
||||
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId);
|
||||
// m_log.Debug(
|
||||
// "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||
// + ", AttachmentPoint: " + AttachmentPt);
|
||||
|
||||
// Save avatar attachment information
|
||||
m_log.Debug(
|
||||
"[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||
+ ", AttachmentPoint: " + AttachmentPt);
|
||||
|
||||
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||
config.AddConfig("Modules");
|
||||
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
||||
|
||||
scene = SceneHelpers.SetupScene();
|
||||
scene = new SceneHelpers().SetupScene();
|
||||
m_attMod = new AttachmentsModule();
|
||||
SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule());
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
// Process the baked texture array
|
||||
if (textureEntry != null)
|
||||
{
|
||||
m_log.InfoFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID);
|
||||
// m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID);
|
||||
|
||||
// WriteBakedTexturesReport(sp, m_log.DebugFormat);
|
||||
|
||||
@@ -208,7 +208,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentId);
|
||||
if (sp == null)
|
||||
{
|
||||
m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId);
|
||||
// This is expected if the user has gone away.
|
||||
// m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -248,10 +249,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
|
||||
if (bakedTextureFace == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently",
|
||||
bakeType, sp.Name, m_scene.RegionInfo.RegionName);
|
||||
|
||||
// This can happen legitimately, since some baked textures might not exist
|
||||
//m_log.WarnFormat(
|
||||
// "[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently",
|
||||
// bakeType, sp.Name, m_scene.RegionInfo.RegionName);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -337,7 +338,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
return false;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
|
||||
// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
|
||||
|
||||
// If we only found default textures, then the appearance is not cached
|
||||
return (defonly ? false : true);
|
||||
@@ -417,7 +418,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
|
||||
|
||||
int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType);
|
||||
bakedTextures[bakeType] = faceTextures[ftIndex];
|
||||
Primitive.TextureEntryFace texture = faceTextures[ftIndex]; // this will be null if there's no such baked texture
|
||||
bakedTextures[bakeType] = texture;
|
||||
}
|
||||
|
||||
return bakedTextures;
|
||||
@@ -482,7 +484,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentid);
|
||||
if (sp == null)
|
||||
{
|
||||
m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid);
|
||||
// This is expected if the user has gone away.
|
||||
// m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
|
||||
AvatarFactoryModule afm = new AvatarFactoryModule();
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, afm);
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
CoreAssetCache assetCache = new CoreAssetCache();
|
||||
|
||||
AvatarFactoryModule afm = new AvatarFactoryModule();
|
||||
TestScene scene = SceneHelpers.SetupScene(assetCache);
|
||||
TestScene scene = new SceneHelpers(assetCache).SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, afm);
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
|
||||
|
||||
|
||||
@@ -186,6 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
{
|
||||
string fromName = c.From;
|
||||
UUID fromID = UUID.Zero;
|
||||
UUID targetID = c.TargetUUID;
|
||||
string message = c.Message;
|
||||
IScene scene = c.Scene;
|
||||
Vector3 fromPos = c.Position;
|
||||
@@ -221,24 +222,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
message = message.Substring(0, 1000);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}",
|
||||
// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType);
|
||||
// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}, targetID {5}",
|
||||
// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType, targetID);
|
||||
|
||||
HashSet<UUID> receiverIDs = new HashSet<UUID>();
|
||||
|
||||
|
||||
foreach (Scene s in m_scenes)
|
||||
{
|
||||
// This should use ForEachClient, but clients don't have a position.
|
||||
// If camera is moved into client, then camera position can be used
|
||||
s.ForEachRootScenePresence(
|
||||
delegate(ScenePresence presence)
|
||||
if (targetID == UUID.Zero)
|
||||
{
|
||||
// This should use ForEachClient, but clients don't have a position.
|
||||
// If camera is moved into client, then camera position can be used
|
||||
s.ForEachRootScenePresence(
|
||||
delegate(ScenePresence presence)
|
||||
{
|
||||
if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType, false))
|
||||
receiverIDs.Add(presence.UUID);
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is a send to a specific client eg from llRegionSayTo
|
||||
// no need to check distance etc, jand send is as say
|
||||
ScenePresence presence = s.GetScenePresence(targetID);
|
||||
if (presence != null && !presence.IsChildAgent)
|
||||
{
|
||||
if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType))
|
||||
receiverIDs.Add(presence.UUID);
|
||||
if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, ChatTypeEnum.Say, message, sourceType, true))
|
||||
receiverIDs.Add(presence.UUID);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
(scene as Scene).EventManager.TriggerOnChatToClients(
|
||||
fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully);
|
||||
}
|
||||
@@ -315,7 +330,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
/// precondition</returns>
|
||||
protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
|
||||
UUID fromAgentID, string fromName, ChatTypeEnum type,
|
||||
string message, ChatSourceType src)
|
||||
string message, ChatSourceType src, bool ignoreDistance)
|
||||
{
|
||||
// don't send stuff to child agents
|
||||
if (presence.IsChildAgent) return false;
|
||||
@@ -326,12 +341,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
|
||||
|
||||
int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos);
|
||||
|
||||
if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
|
||||
type == ChatTypeEnum.Say && dis > m_saydistance ||
|
||||
type == ChatTypeEnum.Shout && dis > m_shoutdistance)
|
||||
|
||||
if (!ignoreDistance)
|
||||
{
|
||||
return false;
|
||||
if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
|
||||
type == ChatTypeEnum.Say && dis > m_saydistance ||
|
||||
type == ChatTypeEnum.Shout && dis > m_shoutdistance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: should change so the message is sent through the avatar rather than direct to the ClientView
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
}
|
||||
}
|
||||
|
||||
protected void InitModule(IConfigSource config)
|
||||
protected virtual void InitModule(IConfigSource config)
|
||||
{
|
||||
IConfig friendsConfig = config.Configs["Friends"];
|
||||
if (friendsConfig != null)
|
||||
@@ -546,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
}
|
||||
}
|
||||
|
||||
private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
||||
protected virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
||||
{
|
||||
if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
|
||||
{
|
||||
|
||||
@@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private int m_levelHGFriends = 0;
|
||||
|
||||
IUserManagement m_uMan;
|
||||
public IUserManagement UserManagementModule
|
||||
{
|
||||
@@ -87,6 +89,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
m_StatusNotifier = new HGStatusNotifier(this);
|
||||
}
|
||||
|
||||
protected override void InitModule(IConfigSource config)
|
||||
{
|
||||
base.InitModule(config);
|
||||
|
||||
// Additionally to the base method
|
||||
IConfig friendsConfig = config.Configs["HGFriendsModule"];
|
||||
if (friendsConfig != null)
|
||||
{
|
||||
m_levelHGFriends = friendsConfig.GetInt("LevelHGFriends", 0);
|
||||
|
||||
// TODO: read in all config variables pertaining to
|
||||
// HG friendship permissions
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IFriendsSimConnector
|
||||
@@ -105,6 +122,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
|
||||
#endregion
|
||||
|
||||
protected override void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
||||
{
|
||||
if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
|
||||
{
|
||||
// we got a friendship offer
|
||||
UUID principalID = new UUID(im.fromAgentID);
|
||||
UUID friendID = new UUID(im.toAgentID);
|
||||
|
||||
// Check if friendID is foreigner and if principalID has the permission
|
||||
// to request friendships with foreigners. If not, return immediately.
|
||||
if (!UserManagementModule.IsLocalGridUser(friendID))
|
||||
{
|
||||
ScenePresence avatar = null;
|
||||
((Scene)client.Scene).TryGetScenePresence(principalID, out avatar);
|
||||
|
||||
if (avatar == null)
|
||||
return;
|
||||
|
||||
if (avatar.UserLevel < m_levelHGFriends)
|
||||
{
|
||||
client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base.OnInstantMessage(client, im);
|
||||
}
|
||||
|
||||
protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders)
|
||||
{
|
||||
// Update the local cache. Yes, we need to do it right here
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
|
||||
config.AddConfig("FriendsService");
|
||||
config.Configs["FriendsService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
|
||||
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
m_fm = new FriendsModule();
|
||||
SceneHelpers.SetupSceneModules(m_scene, config, m_fm);
|
||||
}
|
||||
|
||||
+59
-29
@@ -91,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public InventoryArchiveWriteRequest(
|
||||
Guid id, InventoryArchiverModule module, Scene scene,
|
||||
Guid id, InventoryArchiverModule module, Scene scene,
|
||||
UserAccount userInfo, string invPath, string savePath)
|
||||
: this(
|
||||
id,
|
||||
@@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public InventoryArchiveWriteRequest(
|
||||
Guid id, InventoryArchiverModule module, Scene scene,
|
||||
Guid id, InventoryArchiverModule module, Scene scene,
|
||||
UserAccount userInfo, string invPath, Stream saveStream)
|
||||
{
|
||||
m_id = id;
|
||||
@@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
Exception reportedException = null;
|
||||
bool succeeded = true;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
m_archiveWriter.Close();
|
||||
@@ -146,6 +146,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService)
|
||||
{
|
||||
if (options.ContainsKey("exclude"))
|
||||
{
|
||||
if (((List<String>)options["exclude"]).Contains(inventoryItem.Name) ||
|
||||
((List<String>)options["exclude"]).Contains(inventoryItem.ID.ToString()))
|
||||
{
|
||||
if (options.ContainsKey("verbose"))
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Skipping inventory item {0} {1} at {2}",
|
||||
inventoryItem.Name, inventoryItem.ID, path);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.ContainsKey("verbose"))
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Saving item {0} {1} with asset {2}",
|
||||
@@ -175,12 +190,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
/// <param name="options"></param>
|
||||
/// <param name="userAccountService"></param>
|
||||
protected void SaveInvFolder(
|
||||
InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself,
|
||||
InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself,
|
||||
Dictionary<string, object> options, IUserAccountService userAccountService)
|
||||
{
|
||||
if (options.ContainsKey("excludefolders"))
|
||||
{
|
||||
if (((List<String>)options["excludefolders"]).Contains(inventoryFolder.Name) ||
|
||||
((List<String>)options["excludefolders"]).Contains(inventoryFolder.ID.ToString()))
|
||||
{
|
||||
if (options.ContainsKey("verbose"))
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Skipping folder {0} at {1}",
|
||||
inventoryFolder.Name, path);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.ContainsKey("verbose"))
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving folder {0}", inventoryFolder.Name);
|
||||
|
||||
|
||||
if (saveThisFolderItself)
|
||||
{
|
||||
path += CreateArchiveFolderName(inventoryFolder);
|
||||
@@ -189,7 +219,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
m_archiveWriter.WriteDir(path);
|
||||
}
|
||||
|
||||
InventoryCollection contents
|
||||
InventoryCollection contents
|
||||
= m_scene.InventoryService.GetFolderContent(inventoryFolder.Owner, inventoryFolder.ID);
|
||||
|
||||
foreach (InventoryFolderBase childFolder in contents.Folders)
|
||||
@@ -216,16 +246,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
InventoryFolderBase inventoryFolder = null;
|
||||
InventoryItemBase inventoryItem = null;
|
||||
InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
|
||||
|
||||
|
||||
bool saveFolderContentsOnly = false;
|
||||
|
||||
|
||||
// Eliminate double slashes and any leading / on the path.
|
||||
string[] components
|
||||
= m_invPath.Split(
|
||||
new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
|
||||
int maxComponentIndex = components.Length - 1;
|
||||
|
||||
|
||||
// If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the
|
||||
// folder itself. This may get more sophisicated later on
|
||||
if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
|
||||
@@ -233,13 +263,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
saveFolderContentsOnly = true;
|
||||
maxComponentIndex--;
|
||||
}
|
||||
|
||||
|
||||
m_invPath = String.Empty;
|
||||
for (int i = 0; i <= maxComponentIndex; i++)
|
||||
{
|
||||
m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER;
|
||||
}
|
||||
|
||||
|
||||
// Annoyingly Split actually returns the original string if the input string consists only of delimiters
|
||||
// Therefore if we still start with a / after the split, then we need the root folder
|
||||
if (m_invPath.Length == 0)
|
||||
@@ -249,25 +279,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
else
|
||||
{
|
||||
m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
|
||||
List<InventoryFolderBase> candidateFolders
|
||||
List<InventoryFolderBase> candidateFolders
|
||||
= InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||
if (candidateFolders.Count > 0)
|
||||
inventoryFolder = candidateFolders[0];
|
||||
}
|
||||
|
||||
|
||||
// The path may point to an item instead
|
||||
if (inventoryFolder == null)
|
||||
inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||
|
||||
|
||||
if (null == inventoryFolder && null == inventoryItem)
|
||||
{
|
||||
// We couldn't find the path indicated
|
||||
// We couldn't find the path indicated
|
||||
string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
|
||||
Exception e = new InventoryArchiverException(errorMessage);
|
||||
m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
m_archiveWriter = new TarArchiveWriter(m_saveStream);
|
||||
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Adding control file to archive.");
|
||||
@@ -281,10 +311,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
|
||||
inventoryFolder.Name,
|
||||
inventoryFolder.ID,
|
||||
inventoryFolder.Name,
|
||||
inventoryFolder.ID,
|
||||
m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath);
|
||||
|
||||
|
||||
//recurse through all dirs getting dirs and files
|
||||
SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly, options, userAccountService);
|
||||
}
|
||||
@@ -293,10 +323,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY ARCHIVER]: Found item {0} {1} at {2}",
|
||||
inventoryItem.Name, inventoryItem.ID, m_invPath);
|
||||
|
||||
|
||||
SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH, options, userAccountService);
|
||||
}
|
||||
|
||||
|
||||
// Don't put all this profile information into the archive right now.
|
||||
//SaveUsers();
|
||||
|
||||
@@ -355,7 +385,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
///
|
||||
/// These names are prepended with an inventory folder's UUID so that more than one folder can have the
|
||||
/// same name
|
||||
///
|
||||
///
|
||||
/// <param name="folder"></param>
|
||||
/// <returns></returns>
|
||||
public static string CreateArchiveFolderName(InventoryFolderBase folder)
|
||||
@@ -369,7 +399,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
///
|
||||
/// These names are prepended with an inventory item's UUID so that more than one item can have the
|
||||
/// same name
|
||||
///
|
||||
///
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public static string CreateArchiveItemName(InventoryItemBase item)
|
||||
@@ -415,7 +445,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
public string CreateControlFile(Dictionary<string, object> options)
|
||||
{
|
||||
int majorVersion, minorVersion;
|
||||
|
||||
|
||||
if (options.ContainsKey("home"))
|
||||
{
|
||||
majorVersion = 1;
|
||||
@@ -425,10 +455,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
majorVersion = 0;
|
||||
minorVersion = 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion);
|
||||
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
XmlTextWriter xtw = new XmlTextWriter(sw);
|
||||
xtw.Formatting = Formatting.Indented;
|
||||
@@ -450,4 +480,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,18 +47,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
||||
public string Name { get { return "Inventory Archiver Module"; } }
|
||||
|
||||
|
||||
public bool IsSharedModule { get { return true; } }
|
||||
|
||||
/// <value>
|
||||
/// Enable or disable checking whether the iar user is actually logged in
|
||||
/// Enable or disable checking whether the iar user is actually logged in
|
||||
/// </value>
|
||||
// public bool DisablePresenceChecks { get; set; }
|
||||
|
||||
|
||||
public event InventoryArchiveSaved OnInventoryArchiveSaved;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The file to load and save inventory if no filename has been specified
|
||||
/// </summary>
|
||||
@@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
/// Pending save completions initiated from the console
|
||||
/// </value>
|
||||
protected List<Guid> m_pendingConsoleSaves = new List<Guid>();
|
||||
|
||||
|
||||
/// <value>
|
||||
/// All scenes that this module knows about
|
||||
/// </value>
|
||||
@@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
|
||||
OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
|
||||
|
||||
|
||||
scene.AddCommand(
|
||||
"Archiving", this, "load iar",
|
||||
"load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]",
|
||||
@@ -119,11 +119,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
+ "<IAR path> is the filesystem path or URI from which to load the IAR."
|
||||
+ string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
|
||||
HandleLoadInvConsoleCommand);
|
||||
|
||||
|
||||
scene.AddCommand(
|
||||
"Archiving", this, "save iar",
|
||||
"save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]",
|
||||
"Save user inventory archive (IAR).",
|
||||
"save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]",
|
||||
"Save user inventory archive (IAR).",
|
||||
"<first> is the user's first name.\n"
|
||||
+ "<last> is the user's last name.\n"
|
||||
+ "<inventory path> is the path inside the user's inventory for the folder/item to be saved.\n"
|
||||
@@ -131,32 +131,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
+ string.Format(" If this is not given then the filename {0} in the current directory is used.\n", DEFAULT_INV_BACKUP_FILENAME)
|
||||
+ "-h|--home=<url> adds the url of the profile service to the saved user information.\n"
|
||||
+ "-c|--creators preserves information about foreign creators.\n"
|
||||
+ "-e|--exclude=<name/uuid> don't save the inventory item in archive" + Environment.NewLine
|
||||
+ "-f|--excludefolder=<folder/uuid> don't save contents of the folder in archive" + Environment.NewLine
|
||||
+ "-v|--verbose extra debug messages.\n"
|
||||
+ "--noassets stops assets being saved to the IAR.",
|
||||
HandleSaveInvConsoleCommand);
|
||||
|
||||
m_aScene = scene;
|
||||
}
|
||||
|
||||
|
||||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||
}
|
||||
|
||||
public void PostInitialise() {}
|
||||
|
||||
public void Close() {}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Trigger the inventory archive saved event.
|
||||
/// </summary>
|
||||
protected internal void TriggerInventoryArchiveSaved(
|
||||
Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
|
||||
Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
|
||||
Exception reportedException)
|
||||
{
|
||||
InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved;
|
||||
if (handlerInventoryArchiveSaved != null)
|
||||
handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
|
||||
}
|
||||
|
||||
|
||||
public bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream)
|
||||
{
|
||||
@@ -164,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
}
|
||||
|
||||
public bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
@@ -188,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
// }
|
||||
// else
|
||||
@@ -202,15 +204,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, string savePath,
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, string savePath,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
UserAccount userInfo = GetUserInfo(firstName, lastName, pass);
|
||||
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
// if (CheckPresence(userInfo.PrincipalID))
|
||||
@@ -228,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
// }
|
||||
// else
|
||||
@@ -239,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -247,9 +249,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>());
|
||||
}
|
||||
|
||||
|
||||
public bool DearchiveInventory(
|
||||
string firstName, string lastName, string invPath, string pass, Stream loadStream,
|
||||
string firstName, string lastName, string invPath, string pass, Stream loadStream,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
@@ -295,22 +297,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public bool DearchiveInventory(
|
||||
string firstName, string lastName, string invPath, string pass, string loadPath,
|
||||
string firstName, string lastName, string invPath, string pass, string loadPath,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
UserAccount userInfo = GetUserInfo(firstName, lastName, pass);
|
||||
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
// if (CheckPresence(userInfo.PrincipalID))
|
||||
// {
|
||||
InventoryArchiveReadRequest request;
|
||||
bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge);
|
||||
@@ -324,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
UpdateClientWithLoadedNodes(userInfo, request.Execute());
|
||||
|
||||
return true;
|
||||
@@ -340,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Load inventory from an inventory file archive
|
||||
/// </summary>
|
||||
@@ -351,26 +353,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
|
||||
|
||||
|
||||
List<string> mainParams = optionSet.Parse(cmdparams);
|
||||
|
||||
|
||||
if (mainParams.Count < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> <user password> [<load file path>]");
|
||||
"[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> <user password> [<load file path>]");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
string firstName = mainParams[2];
|
||||
string lastName = mainParams[3];
|
||||
string invPath = mainParams[4];
|
||||
string pass = mainParams[5];
|
||||
string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
|
||||
loadPath, invPath, firstName, lastName);
|
||||
|
||||
|
||||
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
|
||||
@@ -381,7 +383,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Save inventory to a file archive
|
||||
/// </summary>
|
||||
@@ -398,6 +400,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; });
|
||||
ops.Add("c|creators", delegate(string v) { options["creators"] = v; });
|
||||
ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; });
|
||||
ops.Add("e|exclude=", delegate(string v)
|
||||
{
|
||||
if (!options.ContainsKey("exclude"))
|
||||
options["exclude"] = new List<String>();
|
||||
((List<String>)options["exclude"]).Add(v);
|
||||
});
|
||||
ops.Add("f|excludefolder=", delegate(string v)
|
||||
{
|
||||
if (!options.ContainsKey("excludefolders"))
|
||||
options["excludefolders"] = new List<String>();
|
||||
((List<String>)options["excludefolders"]).Add(v);
|
||||
});
|
||||
|
||||
List<string> mainParams = ops.Parse(cmdparams);
|
||||
|
||||
@@ -406,10 +420,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
if (mainParams.Count < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is save iar [-h|--home=<url>] [--noassets] <first name> <last name> <inventory path> <user password> [<save file path>] [-c|--creators] [-v|--verbose]");
|
||||
"[INVENTORY ARCHIVER]: save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (options.ContainsKey("home"))
|
||||
m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR");
|
||||
|
||||
@@ -418,7 +432,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
string invPath = mainParams[4];
|
||||
string pass = mainParams[5];
|
||||
string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
|
||||
savePath, invPath, firstName, lastName);
|
||||
@@ -433,9 +447,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void SaveInvConsoleCommandCompleted(
|
||||
Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
|
||||
Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
|
||||
Exception reportedException)
|
||||
{
|
||||
lock (m_pendingConsoleSaves)
|
||||
@@ -445,7 +459,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (succeeded)
|
||||
{
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0} {1}", userInfo.FirstName, userInfo.LastName);
|
||||
@@ -453,11 +467,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[INVENTORY ARCHIVER]: Archive save for {0} {1} failed - {2}",
|
||||
"[INVENTORY ARCHIVER]: Archive save for {0} {1} failed - {2}",
|
||||
userInfo.FirstName, userInfo.LastName, reportedException.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get user information for the given name.
|
||||
/// </summary>
|
||||
@@ -467,13 +481,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
/// <returns></returns>
|
||||
protected UserAccount GetUserInfo(string firstName, string lastName, string pass)
|
||||
{
|
||||
UserAccount account
|
||||
UserAccount account
|
||||
= m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName);
|
||||
|
||||
|
||||
if (null == account)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[INVENTORY ARCHIVER]: Failed to find user info for {0} {1}",
|
||||
"[INVENTORY ARCHIVER]: Failed to find user info for {0} {1}",
|
||||
firstName, lastName);
|
||||
return null;
|
||||
}
|
||||
@@ -488,7 +502,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.",
|
||||
"[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.",
|
||||
firstName, lastName);
|
||||
return null;
|
||||
}
|
||||
@@ -499,7 +513,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Notify the client of loaded nodes if they are logged in
|
||||
/// </summary>
|
||||
@@ -508,22 +522,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
if (loadedNodes.Count == 0)
|
||||
return;
|
||||
|
||||
|
||||
foreach (Scene scene in m_scenes.Values)
|
||||
{
|
||||
ScenePresence user = scene.GetScenePresence(userInfo.PrincipalID);
|
||||
|
||||
|
||||
if (user != null && !user.IsChildAgent)
|
||||
{
|
||||
foreach (InventoryNodeBase node in loadedNodes)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}",
|
||||
// "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}",
|
||||
// user.Name, node.Name);
|
||||
|
||||
|
||||
user.ControllingClient.SendBulkUpdateInventory(node);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -538,7 +552,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
// {
|
||||
// if (DisablePresenceChecks)
|
||||
// return true;
|
||||
//
|
||||
//
|
||||
// foreach (Scene scene in m_scenes.Values)
|
||||
// {
|
||||
// ScenePresence p;
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, archiverModule);
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
m_archiverModule = new InventoryArchiverModule();
|
||||
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, archiverModule);
|
||||
|
||||
// Create user
|
||||
@@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
|
||||
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||
|
||||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password");
|
||||
@@ -247,7 +247,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, archiverModule);
|
||||
|
||||
// Create user
|
||||
@@ -326,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
|
||||
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
|
||||
@@ -393,7 +393,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
|
||||
string folder1ExistingName = "a";
|
||||
@@ -444,7 +444,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
|
||||
string folder1ExistingName = "a";
|
||||
|
||||
@@ -151,11 +151,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||
Scene scene = (Scene)(client.Scene);
|
||||
ScenePresence presence = scene.GetScenePresence(client.AgentId);
|
||||
|
||||
// Round up Z co-ordinate rather than round-down by casting. This stops tall avatars from being given
|
||||
// a teleport Z co-ordinate by short avatars that drops them through or embeds them in thin floors on
|
||||
// arrival.
|
||||
//
|
||||
// Ideally we would give the exact float position adjusting for the relative height of the two avatars
|
||||
// but it looks like a float component isn't possible with a parcel ID.
|
||||
UUID dest = Util.BuildFakeParcelID(
|
||||
scene.RegionInfo.RegionHandle,
|
||||
(uint)presence.AbsolutePosition.X,
|
||||
(uint)presence.AbsolutePosition.Y,
|
||||
(uint)presence.AbsolutePosition.Z);
|
||||
(uint)Math.Ceiling(presence.AbsolutePosition.Z));
|
||||
|
||||
m_log.DebugFormat("TP invite with message {0}", message);
|
||||
|
||||
|
||||
@@ -61,8 +61,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
set { m_MaxTransferDistance = value; }
|
||||
}
|
||||
|
||||
private int m_levelHGTeleport = 0;
|
||||
|
||||
protected bool m_Enabled = false;
|
||||
protected Scene m_aScene;
|
||||
protected List<Scene> m_Scenes = new List<Scene>();
|
||||
@@ -106,7 +104,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
if (transferConfig != null)
|
||||
{
|
||||
MaxTransferDistance = transferConfig.GetInt("max_distance", 4095);
|
||||
m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0);
|
||||
}
|
||||
|
||||
m_agentsInTransit = new List<UUID>();
|
||||
@@ -172,13 +169,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// Reset animations; the viewer does that in teleports.
|
||||
sp.Animator.ResetAnimations();
|
||||
|
||||
string destinationRegionName = "(not found)";
|
||||
|
||||
try
|
||||
{
|
||||
if (regionHandle == sp.Scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
destinationRegionName = sp.Scene.RegionInfo.RegionName;
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation {0} within {1}",
|
||||
position, sp.Scene.RegionInfo.RegionName);
|
||||
"[ENTITY TRANSFER MODULE]: Teleport for {0} to {1} within {2}",
|
||||
sp.Name, position, destinationRegionName);
|
||||
|
||||
// Teleport within the same region
|
||||
if (IsOutsideRegion(sp.Scene, position) || position.Z < 0)
|
||||
@@ -188,6 +189,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
m_log.WarnFormat(
|
||||
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
|
||||
position, sp.Name, sp.UUID, emergencyPos);
|
||||
|
||||
position = emergencyPos;
|
||||
}
|
||||
|
||||
@@ -210,6 +212,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||
|
||||
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
||||
sp.Velocity = Vector3.Zero;
|
||||
sp.Teleport(position);
|
||||
|
||||
foreach (SceneObjectGroup grp in sp.GetAttachments())
|
||||
@@ -228,20 +231,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
GridRegion finalDestination = GetFinalDestination(reg);
|
||||
if (finalDestination == null)
|
||||
{
|
||||
m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination is having problems. Unable to teleport agent.");
|
||||
m_log.WarnFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Final destination is having problems. Unable to teleport {0} {1}",
|
||||
sp.Name, sp.UUID);
|
||||
|
||||
sp.ControllingClient.SendTeleportFailed("Problem at destination");
|
||||
return;
|
||||
}
|
||||
|
||||
// check if HyperGrid teleport is allowed, based on user level
|
||||
int flags = m_aScene.GridService.GetRegionFlags(sp.Scene.RegionInfo.ScopeID, reg.RegionID);
|
||||
|
||||
if (((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) && (sp.UserLevel < m_levelHGTeleport))
|
||||
{
|
||||
m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination link is non permitted hypergrid region. Unable to teleport agent.");
|
||||
sp.ControllingClient.SendTeleportFailed("HyperGrid teleport not permitted");
|
||||
return;
|
||||
}
|
||||
destinationRegionName = finalDestination.RegionName;
|
||||
|
||||
uint curX = 0, curY = 0;
|
||||
Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
|
||||
@@ -307,7 +305,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0} {1}", e.Message, e.StackTrace);
|
||||
m_log.ErrorFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Exception on teleport of {0} from {1}@{2} to {3}@{4}: {5}{6}",
|
||||
sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName,
|
||||
e.Message, e.StackTrace);
|
||||
|
||||
sp.ControllingClient.SendTeleportFailed("Internal error");
|
||||
}
|
||||
}
|
||||
@@ -321,10 +323,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
}
|
||||
|
||||
if (IsInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this.
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.",
|
||||
sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}",
|
||||
"[ENTITY TRANSFER MODULE]: Teleporting {0} {1} from {2} to {3} ({4}) {5}/{6}",
|
||||
sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName,
|
||||
reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
|
||||
|
||||
uint newRegionX = (uint)(reg.RegionHandle >> 40);
|
||||
@@ -402,7 +411,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
bool logout = false;
|
||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}",
|
||||
sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}",
|
||||
reason));
|
||||
return;
|
||||
}
|
||||
@@ -445,7 +454,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
|
||||
}
|
||||
|
||||
|
||||
SetInTransit(sp.UUID);
|
||||
|
||||
// Let's send a full update of the agent. This is a synchronous call.
|
||||
@@ -589,7 +597,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
|
||||
{
|
||||
sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true);
|
||||
if (sp.Scene.AttachmentsModule != null)
|
||||
sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true);
|
||||
}
|
||||
|
||||
protected void KillEntity(Scene scene, uint localID)
|
||||
@@ -657,7 +666,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
public virtual void TeleportHome(UUID id, IClientAPI client)
|
||||
{
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
|
||||
|
||||
//OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId);
|
||||
GridUserInfo uinfo = m_aScene.GridUserService.GetGridUserInfo(client.AgentId.ToString());
|
||||
@@ -672,14 +682,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})",
|
||||
regionInfo.RegionName, regionInfo.RegionID, regionInfo.RegionLocX / Constants.RegionSize, regionInfo.RegionLocY / Constants.RegionSize);
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Home region of {0} is {1} ({2}-{3})",
|
||||
client.Name, regionInfo.RegionName, regionInfo.RegionCoordX, regionInfo.RegionCoordY);
|
||||
|
||||
// a little eekie that this goes back to Scene and with a forced cast, will fix that at some point...
|
||||
((Scene)(client.Scene)).RequestTeleportLocation(
|
||||
client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt,
|
||||
(uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ENTITY TRANSFER MODULE]: No grid user information found for {0} {1}. Cannot send home.",
|
||||
client.Name, client.AgentId);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -1363,19 +1379,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// after a cross here
|
||||
Thread.Sleep(500);
|
||||
|
||||
Scene m_scene = sp.Scene;
|
||||
Scene scene = sp.Scene;
|
||||
|
||||
uint x, y;
|
||||
Utils.LongToUInts(reg.RegionHandle, out x, out y);
|
||||
x = x / Constants.RegionSize;
|
||||
y = y / Constants.RegionSize;
|
||||
m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint + ")");
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})",
|
||||
sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY);
|
||||
|
||||
string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath);
|
||||
|
||||
string reason = String.Empty;
|
||||
|
||||
bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
|
||||
bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
|
||||
|
||||
if (regionAccepted && newAgent)
|
||||
{
|
||||
@@ -1392,7 +1406,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} is sending {1} EnableSimulator for neighbour region {2} @ {3} " +
|
||||
"and EstablishAgentCommunication with seed cap {4}",
|
||||
m_scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath);
|
||||
scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath);
|
||||
|
||||
eq.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID);
|
||||
eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
|
||||
@@ -1403,10 +1417,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// TODO: make Event Queue disablable!
|
||||
}
|
||||
|
||||
m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString());
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Completed inform {0} {1} about neighbour {2}", sp.Name, sp.UUID, endPoint);
|
||||
}
|
||||
|
||||
if (!regionAccepted)
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Region {0} did not accept agent: {1}", reg.RegionName, reason);
|
||||
m_log.WarnFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Region {0} did not accept {1} {2}: {3}",
|
||||
reg.RegionName, sp.Name, sp.UUID, reason);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
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;
|
||||
|
||||
@@ -68,6 +69,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
string name = moduleConfig.GetString("EntityTransferModule", "");
|
||||
if (name == Name)
|
||||
{
|
||||
IConfig transferConfig = source.Configs["EntityTransfer"];
|
||||
if (transferConfig != null)
|
||||
m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0);
|
||||
|
||||
InitialiseCommon(source);
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
|
||||
}
|
||||
@@ -164,6 +169,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
||||
{
|
||||
// this user is going to another grid
|
||||
// check if HyperGrid teleport is allowed, based on user level
|
||||
if (sp.UserLevel < m_levelHGTeleport)
|
||||
{
|
||||
m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel.");
|
||||
reason = "Hypergrid teleport not allowed";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (agentCircuit.ServiceURLs.ContainsKey("HomeURI"))
|
||||
{
|
||||
string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();
|
||||
@@ -188,7 +201,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
public override void TeleportHome(UUID id, IClientAPI client)
|
||||
{
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
|
||||
m_log.DebugFormat(
|
||||
"[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>();
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
|
||||
config.AddConfig("Modules");
|
||||
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
||||
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, config, m_iam);
|
||||
|
||||
// Create user
|
||||
|
||||
@@ -308,56 +308,56 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||
/// <param name='msg'>
|
||||
/// Message.
|
||||
/// </param>
|
||||
public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error)
|
||||
public void DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg)
|
||||
{
|
||||
error = null;
|
||||
// Is id an avatar?
|
||||
ScenePresence sp = m_scene.GetScenePresence(target);
|
||||
|
||||
if (sp != null)
|
||||
{
|
||||
// Send message to avatar
|
||||
// ignore if a child agent this is restricted to inside one region
|
||||
if (sp.IsChildAgent)
|
||||
return;
|
||||
|
||||
// Send message to the avatar.
|
||||
// Channel zero only goes to the avatar
|
||||
// non zero channel messages only go to the attachments
|
||||
if (channel == 0)
|
||||
{
|
||||
m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false);
|
||||
}
|
||||
|
||||
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||
|
||||
if (attachments.Count == 0)
|
||||
return true;
|
||||
|
||||
// Get uuid of attachments
|
||||
List<UUID> targets = new List<UUID>();
|
||||
foreach (SceneObjectGroup sog in attachments)
|
||||
m_scene.SimChatToAgent(target, Utils.StringToBytes(msg), pos, name, id, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sog.IsDeleted)
|
||||
targets.Add(sog.UUID);
|
||||
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||
if (attachments.Count == 0)
|
||||
return;
|
||||
|
||||
// Get uuid of attachments
|
||||
List<UUID> targets = new List<UUID>();
|
||||
foreach (SceneObjectGroup sog in attachments)
|
||||
{
|
||||
if (!sog.IsDeleted)
|
||||
targets.Add(sog.UUID);
|
||||
}
|
||||
|
||||
// Need to check each attachment
|
||||
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
|
||||
{
|
||||
if (li.GetHostID().Equals(id))
|
||||
continue;
|
||||
|
||||
if (m_scene.GetSceneObjectPart(li.GetHostID()) == null)
|
||||
continue;
|
||||
|
||||
if (targets.Contains(li.GetHostID()))
|
||||
QueueMessage(new ListenerInfo(li, name, id, msg));
|
||||
}
|
||||
}
|
||||
|
||||
// Need to check each attachment
|
||||
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
|
||||
{
|
||||
if (li.GetHostID().Equals(id))
|
||||
continue;
|
||||
|
||||
if (m_scene.GetSceneObjectPart(li.GetHostID()) == null)
|
||||
continue;
|
||||
|
||||
if (targets.Contains(li.GetHostID()))
|
||||
QueueMessage(new ListenerInfo(li, name, id, msg));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Need to toss an error here
|
||||
if (channel == 0)
|
||||
{
|
||||
error = "Cannot use llRegionSayTo to message objects on channel 0";
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
// No avatar found so look for an object
|
||||
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
|
||||
{
|
||||
// Dont process if this message is from yourself!
|
||||
@@ -375,7 +375,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
protected void QueueMessage(ListenerInfo li)
|
||||
|
||||
@@ -146,9 +146,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
|
||||
lock (m_scenes)
|
||||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||
|
||||
scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded);
|
||||
scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
|
||||
}
|
||||
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
@@ -163,9 +164,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
|
||||
|
||||
#endregion ISharedRegionModule
|
||||
|
||||
void EventManager_OnPrimsLoaded(Scene s)
|
||||
void OnLoginsEnabled(string regionName)
|
||||
{
|
||||
UploadMapTile(s);
|
||||
Scene scene = null;
|
||||
foreach (Scene s in m_scenes.Values)
|
||||
if (s.RegionInfo.RegionName == regionName)
|
||||
{
|
||||
scene = s;
|
||||
break;
|
||||
}
|
||||
if (scene != null)
|
||||
UploadMapTile(scene);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+5
@@ -193,6 +193,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||
return m_PresenceService.GetAgents(userIDs);
|
||||
}
|
||||
|
||||
public PresenceInfo VerifyAgent(UUID s_sessionID)
|
||||
{
|
||||
return m_PresenceService.VerifyAgent(s_sessionID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
+5
@@ -153,6 +153,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
||||
return m_RemoteConnector.GetAgents(userIDs);
|
||||
}
|
||||
|
||||
public PresenceInfo VerifyAgent(UUID sessionID)
|
||||
{
|
||||
return m_RemoteConnector.VerifyAgent(sessionID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
{
|
||||
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
|
||||
{
|
||||
m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
|
||||
// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
|
||||
return s.NewUserConnection(aCircuit, teleportFlags, out reason);
|
||||
}
|
||||
}
|
||||
@@ -209,9 +209,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
{
|
||||
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||
s.RegionInfo.RegionName, 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;
|
||||
@@ -281,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
{
|
||||
if (s.RegionInfo.RegionID == origin)
|
||||
{
|
||||
m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent");
|
||||
// m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent");
|
||||
AgentTransferModule.AgentArrivedAtDestination(id);
|
||||
return true;
|
||||
// return s.IncomingReleaseAgent(id);
|
||||
|
||||
@@ -297,10 +297,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
if (checkPermissions.Contains("T") && !canTransfer)
|
||||
partPermitted = false;
|
||||
|
||||
// If the user is the Creator of the object then it can always be included in the OAR
|
||||
bool creator = (obj.CreatorID.Guid == user.Guid);
|
||||
if (creator)
|
||||
partPermitted = true;
|
||||
|
||||
//string name = (objGroup.PrimCount == 1) ? objGroup.Name : string.Format("{0} ({1}/{2})", obj.Name, primNumber, objGroup.PrimCount);
|
||||
//m_log.DebugFormat("[ARCHIVER]: Object permissions: {0}: Base={1:X4}, Owner={2:X4}, Everyone={3:X4}, permissionClass={4}, checkPermissions={5}, canCopy={6}, canTransfer={7}, permitted={8}",
|
||||
//m_log.DebugFormat("[ARCHIVER]: Object permissions: {0}: Base={1:X4}, Owner={2:X4}, Everyone={3:X4}, permissionClass={4}, checkPermissions={5}, canCopy={6}, canTransfer={7}, creator={8}, permitted={9}",
|
||||
// name, obj.BaseMask, obj.OwnerMask, obj.EveryoneMask,
|
||||
// permissionClass, checkPermissions, canCopy, canTransfer, permitted);
|
||||
// permissionClass, checkPermissions, canCopy, canTransfer, creator, partPermitted);
|
||||
|
||||
if (!partPermitted)
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
TerrainModule terrainModule = new TerrainModule();
|
||||
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule);
|
||||
}
|
||||
|
||||
@@ -102,9 +102,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
|
||||
Vector3 groupPosition = new Vector3(10, 20, 30);
|
||||
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
|
||||
Vector3 offsetPosition = new Vector3(5, 10, 15);
|
||||
// Vector3 offsetPosition = new Vector3(5, 10, 15);
|
||||
|
||||
return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
|
||||
return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, Vector3.Zero) { Name = partName };
|
||||
}
|
||||
|
||||
protected SceneObjectPart CreateSceneObjectPart2()
|
||||
@@ -463,7 +463,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
TerrainModule terrainModule = new TerrainModule();
|
||||
|
||||
TestScene scene2 = SceneHelpers.SetupScene();
|
||||
TestScene scene2 = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule);
|
||||
|
||||
// Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is
|
||||
@@ -607,7 +607,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
TerrainModule terrainModule = new TerrainModule();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
|
||||
|
||||
m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
|
||||
|
||||
@@ -157,12 +157,18 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
sendRegionInfoPacketToAll();
|
||||
}
|
||||
|
||||
public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, UUID texture)
|
||||
public void setEstateTerrainBaseTexture(int level, UUID texture)
|
||||
{
|
||||
setEstateTerrainBaseTexture(null, level, texture);
|
||||
sendRegionHandshakeToAll();
|
||||
}
|
||||
|
||||
public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture)
|
||||
{
|
||||
if (texture == UUID.Zero)
|
||||
return;
|
||||
|
||||
switch (corner)
|
||||
switch (level)
|
||||
{
|
||||
case 0:
|
||||
Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture;
|
||||
@@ -182,6 +188,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
sendRegionInfoPacketToAll();
|
||||
}
|
||||
|
||||
public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue)
|
||||
{
|
||||
setEstateTerrainTextureHeights(null, corner, lowValue, highValue);
|
||||
}
|
||||
|
||||
public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue)
|
||||
{
|
||||
switch (corner)
|
||||
@@ -956,7 +967,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
{
|
||||
RegionHandshakeArgs args = new RegionHandshakeArgs();
|
||||
|
||||
args.isEstateManager = Scene.RegionInfo.EstateSettings.IsEstateManager(remoteClient.AgentId);
|
||||
args.isEstateManager = Scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(remoteClient.AgentId);
|
||||
if (Scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero && Scene.RegionInfo.EstateSettings.EstateOwner == remoteClient.AgentId)
|
||||
args.isEstateManager = true;
|
||||
|
||||
|
||||
@@ -469,7 +469,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
if (m_scene.Permissions.IsAdministrator(avatar))
|
||||
return false;
|
||||
|
||||
if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar))
|
||||
if (m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(avatar))
|
||||
return false;
|
||||
|
||||
if (avatar == LandData.OwnerID)
|
||||
@@ -499,7 +499,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
if (m_scene.Permissions.IsAdministrator(avatar))
|
||||
return false;
|
||||
|
||||
if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar))
|
||||
if (m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(avatar))
|
||||
return false;
|
||||
|
||||
if (avatar == LandData.OwnerID)
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
|
||||
{
|
||||
m_pcm = new PrimCountModule();
|
||||
LandManagementModule lmm = new LandManagementModule();
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
|
||||
|
||||
int xParcelDivider = (int)Constants.RegionSize - 1;
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||
int tc = 0;
|
||||
double[,] hm = whichScene.Heightmap.GetDoubles();
|
||||
tc = Environment.TickCount;
|
||||
m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
|
||||
m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
|
||||
EntityBase[] objs = whichScene.GetEntities();
|
||||
Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>();
|
||||
//SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>();
|
||||
@@ -541,7 +541,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||
g.Dispose();
|
||||
} // lock entities objs
|
||||
|
||||
m_log.Info("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms");
|
||||
m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms");
|
||||
return mapbmp;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||
public void TerrainToBitmap(Bitmap mapbmp)
|
||||
{
|
||||
int tc = Environment.TickCount;
|
||||
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain");
|
||||
m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain");
|
||||
|
||||
double[,] hm = m_scene.Heightmap.GetDoubles();
|
||||
bool ShadowDebugContinue = true;
|
||||
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||
}
|
||||
}
|
||||
}
|
||||
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
|
||||
m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||
public void TerrainToBitmap(Bitmap mapbmp)
|
||||
{
|
||||
int tc = Environment.TickCount;
|
||||
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain");
|
||||
m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain");
|
||||
|
||||
// These textures should be in the AssetCache anyway, as every client conneting to this
|
||||
// region needs them. Except on start, when the map is recreated (before anyone connected),
|
||||
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||
}
|
||||
}
|
||||
}
|
||||
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
|
||||
m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
|
||||
public void SetUp()
|
||||
{
|
||||
m_module = new MoapModule();
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, m_module);
|
||||
}
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
|
||||
sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
sb.AppendFormat("Parent: {0}",
|
||||
sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID));
|
||||
sb.AppendFormat("Parts: {0}\n", !sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString());;
|
||||
sb.AppendFormat("Link number: {0}\n", sop.LinkNum);
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
@@ -503,7 +503,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
{
|
||||
if (user == UUID.Zero) return false;
|
||||
|
||||
return m_scene.RegionInfo.EstateSettings.IsEstateManager(user);
|
||||
return m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(user);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -343,7 +343,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
|
||||
public void Init()
|
||||
{
|
||||
m_serialiserModule = new SerialiserModule();
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, m_serialiserModule);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,28 +59,32 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||
/// <returns>A terrain channel generated from the image.</returns>
|
||||
public virtual ITerrainChannel LoadFile(string filename)
|
||||
{
|
||||
return LoadBitmap(new Bitmap(filename));
|
||||
using (Bitmap b = new Bitmap(filename))
|
||||
return LoadBitmap(b);
|
||||
}
|
||||
|
||||
public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h)
|
||||
{
|
||||
Bitmap bitmap = new Bitmap(filename);
|
||||
ITerrainChannel retval = new TerrainChannel(true);
|
||||
|
||||
for (int x = 0; x < retval.Width; x++)
|
||||
using (Bitmap bitmap = new Bitmap(filename))
|
||||
{
|
||||
for (int y = 0; y < retval.Height; y++)
|
||||
{
|
||||
retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128;
|
||||
}
|
||||
}
|
||||
ITerrainChannel retval = new TerrainChannel(true);
|
||||
|
||||
return retval;
|
||||
for (int x = 0; x < retval.Width; x++)
|
||||
{
|
||||
for (int y = 0; y < retval.Height; y++)
|
||||
{
|
||||
retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ITerrainChannel LoadStream(Stream stream)
|
||||
{
|
||||
return LoadBitmap(new Bitmap(stream));
|
||||
using (Bitmap b = new Bitmap(stream))
|
||||
return LoadBitmap(b);
|
||||
}
|
||||
|
||||
protected virtual ITerrainChannel LoadBitmap(Bitmap bitmap)
|
||||
@@ -134,35 +138,53 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||
// "Saving the image to the same file it was constructed from is not allowed and throws an exception."
|
||||
string tempName = Path.GetTempFileName();
|
||||
|
||||
Bitmap entireBitmap = null;
|
||||
Bitmap existingBitmap = null;
|
||||
Bitmap thisBitmap = null;
|
||||
if (File.Exists(filename))
|
||||
Bitmap newBitmap = null;
|
||||
|
||||
try
|
||||
{
|
||||
File.Copy(filename, tempName, true);
|
||||
entireBitmap = new Bitmap(tempName);
|
||||
if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY)
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
// old file, let's overwrite it
|
||||
entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
||||
File.Copy(filename, tempName, true);
|
||||
existingBitmap = new Bitmap(tempName);
|
||||
if (existingBitmap.Width != fileWidth * regionSizeX || existingBitmap.Height != fileHeight * regionSizeY)
|
||||
{
|
||||
// old file, let's overwrite it
|
||||
newBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
||||
}
|
||||
else
|
||||
{
|
||||
newBitmap = existingBitmap;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
||||
}
|
||||
|
||||
thisBitmap = CreateGrayscaleBitmapFromMap(m_channel);
|
||||
// Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY);
|
||||
for (int x = 0; x < regionSizeX; x++)
|
||||
for (int y = 0; y < regionSizeY; y++)
|
||||
newBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y));
|
||||
|
||||
Save(newBitmap, filename);
|
||||
}
|
||||
else
|
||||
finally
|
||||
{
|
||||
entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
||||
if (existingBitmap != null)
|
||||
existingBitmap.Dispose();
|
||||
|
||||
if (thisBitmap != null)
|
||||
thisBitmap.Dispose();
|
||||
|
||||
if (newBitmap != null)
|
||||
newBitmap.Dispose();
|
||||
|
||||
if (File.Exists(tempName))
|
||||
File.Delete(tempName);
|
||||
}
|
||||
|
||||
thisBitmap = CreateGrayscaleBitmapFromMap(m_channel);
|
||||
// Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY);
|
||||
for (int x = 0; x < regionSizeX; x++)
|
||||
for (int y = 0; y < regionSizeY; y++)
|
||||
entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y));
|
||||
|
||||
Save(entireBitmap, filename);
|
||||
thisBitmap.Dispose();
|
||||
entireBitmap.Dispose();
|
||||
|
||||
if (File.Exists(tempName))
|
||||
File.Delete(tempName);
|
||||
}
|
||||
|
||||
protected virtual void Save(Bitmap bmp, string filename)
|
||||
@@ -226,16 +248,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||
/// <returns>A System.Drawing.Bitmap containing a coloured image</returns>
|
||||
protected static Bitmap CreateBitmapFromMap(ITerrainChannel map)
|
||||
{
|
||||
Bitmap gradientmapLd = new Bitmap("defaultstripe.png");
|
||||
int pallete;
|
||||
Bitmap bmp;
|
||||
Color[] colours;
|
||||
|
||||
int pallete = gradientmapLd.Height;
|
||||
|
||||
Bitmap bmp = new Bitmap(map.Width, map.Height);
|
||||
Color[] colours = new Color[pallete];
|
||||
|
||||
for (int i = 0; i < pallete; i++)
|
||||
using (Bitmap gradientmapLd = new Bitmap("defaultstripe.png"))
|
||||
{
|
||||
colours[i] = gradientmapLd.GetPixel(0, i);
|
||||
pallete = gradientmapLd.Height;
|
||||
|
||||
bmp = new Bitmap(map.Width, map.Height);
|
||||
colours = new Color[pallete];
|
||||
|
||||
for (int i = 0; i < pallete; i++)
|
||||
{
|
||||
colours[i] = gradientmapLd.GetPixel(0, i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = 0; y < map.Height; y++)
|
||||
|
||||
@@ -99,16 +99,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||
|
||||
private static Bitmap CreateBitmapFromMap(ITerrainChannel map)
|
||||
{
|
||||
Bitmap gradientmapLd = new Bitmap("defaultstripe.png");
|
||||
int pallete;
|
||||
Bitmap bmp;
|
||||
Color[] colours;
|
||||
|
||||
int pallete = gradientmapLd.Height;
|
||||
|
||||
Bitmap bmp = new Bitmap(map.Width, map.Height);
|
||||
Color[] colours = new Color[pallete];
|
||||
|
||||
for (int i = 0; i < pallete; i++)
|
||||
using (Bitmap gradientmapLd = new Bitmap("defaultstripe.png"))
|
||||
{
|
||||
colours[i] = gradientmapLd.GetPixel(0, i);
|
||||
pallete = gradientmapLd.Height;
|
||||
|
||||
bmp = new Bitmap(map.Width, map.Height);
|
||||
colours = new Color[pallete];
|
||||
|
||||
for (int i = 0; i < pallete; i++)
|
||||
{
|
||||
colours[i] = gradientmapLd.GetPixel(0, i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = 0; y < map.Height; y++)
|
||||
|
||||
@@ -88,11 +88,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||
if (renderers.Count > 0)
|
||||
{
|
||||
m_primMesher = RenderingLoader.LoadRenderer(renderers[0]);
|
||||
m_log.Info("[MAPTILE]: Loaded prim mesher " + m_primMesher.ToString());
|
||||
m_log.Debug("[MAPTILE]: Loaded prim mesher " + m_primMesher.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled");
|
||||
m_log.Debug("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled");
|
||||
}
|
||||
|
||||
m_scene.RegisterModuleInterface<IMapImageGenerator>(this);
|
||||
|
||||
@@ -172,7 +172,17 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// If no inventory item has that name then an empty list is returned.
|
||||
/// </returns>
|
||||
List<TaskInventoryItem> GetInventoryItems(string name);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get inventory items by type.
|
||||
/// </summary>
|
||||
/// <param type="name"></param>
|
||||
/// <returns>
|
||||
/// A list of inventory items of that type.
|
||||
/// If no inventory items of that type then an empty list is returned.
|
||||
/// </returns>
|
||||
List<TaskInventoryItem> GetInventoryItems(InventoryType type);
|
||||
|
||||
/// <summary>
|
||||
/// Get the scene object referenced by an inventory item.
|
||||
/// </summary>
|
||||
|
||||
@@ -45,5 +45,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// Tell all clients about the current state of the region (terrain textures, water height, etc.).
|
||||
/// </summary>
|
||||
void sendRegionHandshakeToAll();
|
||||
|
||||
void setEstateTerrainBaseTexture(int level, UUID texture);
|
||||
void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) Contributors
|
||||
* 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 OpenSim 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;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public delegate void TakeValueCallback(string s);
|
||||
|
||||
public interface IJsonStoreModule
|
||||
{
|
||||
bool CreateStore(string value, out UUID result);
|
||||
bool DestroyStore(UUID storeID);
|
||||
bool TestPath(UUID storeID, string path, bool useJson);
|
||||
bool SetValue(UUID storeID, string path, string value, bool useJson);
|
||||
bool RemoveValue(UUID storeID, string path);
|
||||
bool GetValue(UUID storeID, string path, bool useJson, out string value);
|
||||
|
||||
void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback);
|
||||
void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback);
|
||||
}
|
||||
}
|
||||
@@ -134,6 +134,36 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool Say(UUID agentID, Scene scene, string text);
|
||||
|
||||
/// <summary>
|
||||
/// Get the NPC to say something.
|
||||
/// </summary>
|
||||
/// <param name="agentID">The UUID of the NPC</param>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="text"></param>
|
||||
/// <param name="channel"></param>
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool Say(UUID agentID, Scene scene, string text, int channel);
|
||||
|
||||
/// <summary>
|
||||
/// Get the NPC to shout something.
|
||||
/// </summary>
|
||||
/// <param name="agentID">The UUID of the NPC</param>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="text"></param>
|
||||
/// <param name="channel"></param>
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool Shout(UUID agentID, Scene scene, string text, int channel);
|
||||
|
||||
/// <summary>
|
||||
/// Get the NPC to whisper something.
|
||||
/// </summary>
|
||||
/// <param name="agentID">The UUID of the NPC</param>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="text"></param>
|
||||
/// <param name="channel"></param>
|
||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||
bool Whisper(UUID agentID, Scene scene, string text, int channel);
|
||||
|
||||
/// <summary>
|
||||
/// Sit the NPC.
|
||||
/// </summary>
|
||||
|
||||
@@ -82,6 +82,14 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// </summary>
|
||||
void StartProcessing();
|
||||
|
||||
/// <summary>
|
||||
/// Get the execution times of all scripts in the given array if they are currently running.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A float the value is a representative execution time in milliseconds of all scripts in that Array.
|
||||
/// </returns>
|
||||
float GetScriptExecutionTime(List<UUID> itemIDs);
|
||||
|
||||
/// <summary>
|
||||
/// Get the execution times of all scripts in each object.
|
||||
/// </summary>
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <param name='msg'>
|
||||
/// Message.
|
||||
/// </param>
|
||||
bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error);
|
||||
void DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg);
|
||||
|
||||
/// <summary>
|
||||
/// Are there any listen events ready to be dispatched?
|
||||
|
||||
@@ -1988,7 +1988,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
if (permissionToTake)
|
||||
if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete))
|
||||
{
|
||||
m_asyncSceneObjectDeleter.DeleteToInventory(
|
||||
action, destinationID, deleteGroups, remoteClient,
|
||||
|
||||
@@ -38,8 +38,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
public partial class Scene
|
||||
{
|
||||
|
||||
protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
|
||||
UUID fromID, bool fromAgent, bool broadcast)
|
||||
UUID fromID, UUID targetID, bool fromAgent, bool broadcast)
|
||||
{
|
||||
OSChatMessage args = new OSChatMessage();
|
||||
|
||||
@@ -63,14 +64,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
args.From = fromName;
|
||||
//args.
|
||||
args.TargetUUID = targetID;
|
||||
|
||||
if (broadcast)
|
||||
EventManager.TriggerOnChatBroadcast(this, args);
|
||||
else
|
||||
EventManager.TriggerOnChatFromWorld(this, args);
|
||||
}
|
||||
|
||||
|
||||
protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
|
||||
UUID fromID, bool fromAgent, bool broadcast)
|
||||
{
|
||||
SimChat(message, type, channel, fromPos, fromName, fromID, UUID.Zero, fromAgent, broadcast);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -108,6 +115,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true);
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="fromPos"></param>
|
||||
/// <param name="fromName"></param>
|
||||
/// <param name="fromAgentID"></param>
|
||||
/// <param name="targetID"></param>
|
||||
public void SimChatToAgent(UUID targetID, byte[] message, Vector3 fromPos, string fromName, UUID fromID, bool fromAgent)
|
||||
{
|
||||
SimChat(message, ChatTypeEnum.Say, 0, fromPos, fromName, fromID, targetID, fromAgent, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the client requests a prim.
|
||||
|
||||
@@ -103,6 +103,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public bool m_trustBinaries;
|
||||
public bool m_allowScriptCrossings;
|
||||
public bool m_useFlySlow;
|
||||
public bool m_useTrashOnDelete = true;
|
||||
|
||||
/// <summary>
|
||||
/// Temporarily setting to trigger appearance resends at 60 second intervals.
|
||||
@@ -436,6 +437,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (m_simulationService == null)
|
||||
m_simulationService = RequestModuleInterface<ISimulationService>();
|
||||
|
||||
return m_simulationService;
|
||||
}
|
||||
}
|
||||
@@ -684,8 +686,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
//Animation states
|
||||
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
|
||||
|
||||
PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
|
||||
CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
|
||||
PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims);
|
||||
CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims);
|
||||
|
||||
m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
|
||||
if (RegionInfo.NonphysPrimMax > 0)
|
||||
@@ -709,6 +711,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_clampPrimSize = true;
|
||||
}
|
||||
|
||||
m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete);
|
||||
m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
|
||||
m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
|
||||
m_dontPersistBefore =
|
||||
@@ -800,13 +803,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mock constructor for scene group persistency unit tests.
|
||||
/// SceneObjectGroup RegionId property is delegated to Scene.
|
||||
/// </summary>
|
||||
/// <param name="regInfo"></param>
|
||||
public Scene(RegionInfo regInfo)
|
||||
{
|
||||
PhysicalPrims = true;
|
||||
CollidablePrims = true;
|
||||
|
||||
BordersLocked = true;
|
||||
Border northBorder = new Border();
|
||||
northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
|
||||
@@ -833,8 +834,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_eventManager = new EventManager();
|
||||
|
||||
m_permissions = new ScenePermissions(this);
|
||||
|
||||
// m_lastUpdate = Util.EnvironmentTickCount();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -3219,8 +3218,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
try
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[SCENE]: Removing {0} agent {1} from region {2}",
|
||||
(isChildAgent ? "child" : "root"), agentID, RegionInfo.RegionName);
|
||||
"[SCENE]: Removing {0} agent {1} {2} from region {3}",
|
||||
(isChildAgent ? "child" : "root"), avatar.Name, agentID, RegionInfo.RegionName);
|
||||
|
||||
m_sceneGraph.removeUserCount(!isChildAgent);
|
||||
|
||||
@@ -3798,41 +3797,41 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Grid has requested that we log-off a user. Log them off.
|
||||
/// </summary>
|
||||
/// <param name="AvatarID">Unique ID of the avatar to log-off</param>
|
||||
/// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param>
|
||||
/// <param name="message">message to display to the user. Reason for being logged off</param>
|
||||
public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message)
|
||||
{
|
||||
ScenePresence loggingOffUser = GetScenePresence(AvatarID);
|
||||
if (loggingOffUser != null)
|
||||
{
|
||||
UUID localRegionSecret = UUID.Zero;
|
||||
bool parsedsecret = UUID.TryParse(m_regInfo.regionSecret, out localRegionSecret);
|
||||
|
||||
// Region Secret is used here in case a new sessionid overwrites an old one on the user server.
|
||||
// Will update the user server in a few revisions to use it.
|
||||
|
||||
if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret))
|
||||
{
|
||||
m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles);
|
||||
loggingOffUser.ControllingClient.Kick(message);
|
||||
// Give them a second to receive the message!
|
||||
Thread.Sleep(1000);
|
||||
loggingOffUser.ControllingClient.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString());
|
||||
}
|
||||
}
|
||||
// /// <summary>
|
||||
// /// The Grid has requested that we log-off a user. Log them off.
|
||||
// /// </summary>
|
||||
// /// <param name="AvatarID">Unique ID of the avatar to log-off</param>
|
||||
// /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param>
|
||||
// /// <param name="message">message to display to the user. Reason for being logged off</param>
|
||||
// public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message)
|
||||
// {
|
||||
// ScenePresence loggingOffUser = GetScenePresence(AvatarID);
|
||||
// if (loggingOffUser != null)
|
||||
// {
|
||||
// UUID localRegionSecret = UUID.Zero;
|
||||
// bool parsedsecret = UUID.TryParse(m_regInfo.regionSecret, out localRegionSecret);
|
||||
//
|
||||
// // Region Secret is used here in case a new sessionid overwrites an old one on the user server.
|
||||
// // Will update the user server in a few revisions to use it.
|
||||
//
|
||||
// if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret))
|
||||
// {
|
||||
// m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles);
|
||||
// loggingOffUser.ControllingClient.Kick(message);
|
||||
// // Give them a second to receive the message!
|
||||
// Thread.Sleep(1000);
|
||||
// loggingOffUser.ControllingClient.Close();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate");
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString());
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an agent crosses into this sim. Also happens on initial login.
|
||||
@@ -3881,7 +3880,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2);
|
||||
if (nearestParcel == null)
|
||||
{
|
||||
m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: no allowed parcel", cAgentData.AgentID);
|
||||
m_log.DebugFormat(
|
||||
"[SCENE]: Denying root agent entry to {0} in {1}: no allowed parcel",
|
||||
cAgentData.AgentID, RegionInfo.RegionName);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
|
||||
|
||||
/// <summary>
|
||||
/// Lock to prevent object group update, linking and delinking operations from running concurrently.
|
||||
/// </summary>
|
||||
private Object m_updateLock = new Object();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1962,9 +1962,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Link the prims in a given group to this group
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Do not call this method directly - use Scene.LinkObjects() instead to avoid races between threads.
|
||||
/// FIXME: There are places where scripts call these methods directly without locking. This is a potential race condition.
|
||||
/// </remarks>
|
||||
/// <param name="objectGroup">The group of prims which should be linked to this group</param>
|
||||
public void LinkToGroup(SceneObjectGroup objectGroup)
|
||||
{
|
||||
LinkToGroup(objectGroup, false);
|
||||
}
|
||||
|
||||
public void LinkToGroup(SceneObjectGroup objectGroup, bool insert)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}",
|
||||
// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID);
|
||||
@@ -1975,6 +1984,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
SceneObjectPart linkPart = objectGroup.m_rootPart;
|
||||
|
||||
// physics flags from group to be applied to linked parts
|
||||
bool grpusephys = UsesPhysics;
|
||||
bool grptemporary = IsTemporary;
|
||||
|
||||
Vector3 oldGroupPosition = linkPart.GroupPosition;
|
||||
Quaternion oldRootRotation = linkPart.RotationOffset;
|
||||
|
||||
@@ -1998,13 +2011,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
lock (m_parts.SyncRoot)
|
||||
{
|
||||
int linkNum = PrimCount + 1;
|
||||
int linkNum;
|
||||
if (insert)
|
||||
{
|
||||
linkNum = 2;
|
||||
foreach (SceneObjectPart part in Parts)
|
||||
{
|
||||
if (part.LinkNum > 1)
|
||||
part.LinkNum++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
linkNum = PrimCount + 1;
|
||||
}
|
||||
|
||||
m_parts.Add(linkPart.UUID, linkPart);
|
||||
|
||||
linkPart.SetParent(this);
|
||||
linkPart.CreateSelected = true;
|
||||
|
||||
// let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now
|
||||
linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive);
|
||||
if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical)
|
||||
{
|
||||
linkPart.PhysActor.link(m_rootPart.PhysActor);
|
||||
this.Scene.PhysicsScene.AddPhysicsActorTaint(linkPart.PhysActor);
|
||||
}
|
||||
|
||||
linkPart.LinkNum = linkNum++;
|
||||
|
||||
SceneObjectPart[] ogParts = objectGroup.Parts;
|
||||
@@ -2017,7 +2051,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
SceneObjectPart part = ogParts[i];
|
||||
if (part.UUID != objectGroup.m_rootPart.UUID)
|
||||
{
|
||||
LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++);
|
||||
// let physics know
|
||||
part.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (part.Flags & PrimFlags.Phantom) != 0), part.VolumeDetectActive);
|
||||
if (part.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical)
|
||||
{
|
||||
part.PhysActor.link(m_rootPart.PhysActor);
|
||||
this.Scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
|
||||
}
|
||||
}
|
||||
part.ClearUndoState();
|
||||
}
|
||||
}
|
||||
@@ -2045,6 +2088,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Delink the given prim from this group. The delinked prim is established as
|
||||
/// an independent SceneObjectGroup.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
|
||||
/// condition. But currently there is no
|
||||
/// alternative method that does take a lonk to delink a single prim.
|
||||
/// </remarks>
|
||||
/// <param name="partID"></param>
|
||||
/// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
|
||||
public SceneObjectGroup DelinkFromGroup(uint partID)
|
||||
@@ -2056,6 +2104,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Delink the given prim from this group. The delinked prim is established as
|
||||
/// an independent SceneObjectGroup.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
|
||||
/// condition. But currently there is no
|
||||
/// alternative method that does take a lonk to delink a single prim.
|
||||
/// </remarks>
|
||||
/// <param name="partID"></param>
|
||||
/// <param name="sendEvents"></param>
|
||||
/// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
|
||||
@@ -2081,6 +2134,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Delink the given prim from this group. The delinked prim is established as
|
||||
/// an independent SceneObjectGroup.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
|
||||
/// condition. But currently there is no
|
||||
/// alternative method that does take a lonk to delink a single prim.
|
||||
/// </remarks>
|
||||
/// <param name="partID"></param>
|
||||
/// <param name="sendEvents"></param>
|
||||
/// <returns>The object group of the newly delinked prim.</returns>
|
||||
@@ -2201,6 +2259,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
oldRot = part.RotationOffset;
|
||||
Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
|
||||
part.RotationOffset = newRot;
|
||||
|
||||
part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3269,6 +3329,45 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A float the value is a representative execution time in milliseconds of all scripts in the link set.
|
||||
/// </summary>
|
||||
public float ScriptExecutionTime()
|
||||
{
|
||||
IScriptModule[] engines = Scene.RequestModuleInterfaces<IScriptModule>();
|
||||
|
||||
if (engines.Length == 0) // No engine at all
|
||||
return 0.0f;
|
||||
|
||||
float time = 0.0f;
|
||||
|
||||
// get all the scripts in all parts
|
||||
SceneObjectPart[] parts = m_parts.GetArray();
|
||||
List<TaskInventoryItem> scripts = new List<TaskInventoryItem>();
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
{
|
||||
scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL));
|
||||
}
|
||||
// extract the UUIDs
|
||||
List<UUID> ids = new List<UUID>(scripts.Count);
|
||||
foreach (TaskInventoryItem script in scripts)
|
||||
{
|
||||
if (!ids.Contains(script.ItemID))
|
||||
{
|
||||
ids.Add(script.ItemID);
|
||||
}
|
||||
}
|
||||
// Offer the list of script UUIDs to each engine found and accumulate the time
|
||||
foreach (IScriptModule e in engines)
|
||||
{
|
||||
if (e != null)
|
||||
{
|
||||
time += e.GetScriptExecutionTime(ids);
|
||||
}
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a count of the number of running scripts in this groups parts.
|
||||
/// </summary>
|
||||
|
||||
@@ -1706,6 +1706,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="isNew"></param>
|
||||
public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
|
||||
{
|
||||
if (ParentGroup.Scene == null)
|
||||
return;
|
||||
|
||||
if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
|
||||
return;
|
||||
|
||||
@@ -4161,7 +4164,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// For now, we use the NINJA naming scheme for identifying joints.
|
||||
// In the future, we can support other joint specification schemes such as a
|
||||
// custom checkbox in the viewer GUI.
|
||||
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||
if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||
{
|
||||
string hingeString = "hingejoint";
|
||||
return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString);
|
||||
@@ -4177,7 +4180,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// For now, we use the NINJA naming scheme for identifying joints.
|
||||
// In the future, we can support other joint specification schemes such as a
|
||||
// custom checkbox in the viewer GUI.
|
||||
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||
if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||
{
|
||||
string ballString = "balljoint";
|
||||
return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString);
|
||||
@@ -4193,7 +4196,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// For now, we use the NINJA naming scheme for identifying joints.
|
||||
// In the future, we can support other joint specification schemes such as a
|
||||
// custom checkbox in the viewer GUI.
|
||||
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||
if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
|
||||
{
|
||||
return IsHingeJoint() || IsBallJoint();
|
||||
}
|
||||
@@ -4287,7 +4290,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
AddFlag(PrimFlags.Phantom);
|
||||
|
||||
if (PhysActor != null)
|
||||
{
|
||||
RemoveFromPhysics();
|
||||
pa = null;
|
||||
}
|
||||
}
|
||||
else // Not phantom
|
||||
{
|
||||
@@ -4353,7 +4359,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
pa.SetVolumeDetect(1);
|
||||
AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
|
||||
this.VolumeDetectActive = true;
|
||||
VolumeDetectActive = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -4361,9 +4367,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
|
||||
// (mumbles, well, at least if you have infinte CPU powers :-))
|
||||
if (pa != null)
|
||||
PhysActor.SetVolumeDetect(0);
|
||||
pa.SetVolumeDetect(0);
|
||||
|
||||
this.VolumeDetectActive = false;
|
||||
VolumeDetectActive = false;
|
||||
}
|
||||
|
||||
if (SetTemporary)
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
|
||||
{
|
||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||
List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
|
||||
foreach (TaskInventoryItem item in scripts)
|
||||
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
||||
}
|
||||
@@ -255,7 +255,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </param>
|
||||
public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
|
||||
{
|
||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||
List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
|
||||
foreach (TaskInventoryItem item in scripts)
|
||||
RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
|
||||
}
|
||||
@@ -1116,7 +1116,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return 0;
|
||||
|
||||
int count = 0;
|
||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||
List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
|
||||
|
||||
foreach (TaskInventoryItem item in scripts)
|
||||
{
|
||||
@@ -1157,14 +1157,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<TaskInventoryItem> GetInventoryScripts()
|
||||
public List<TaskInventoryItem> GetInventoryItems(InventoryType type)
|
||||
{
|
||||
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
|
||||
|
||||
lock (m_items)
|
||||
{
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
if (item.InvType == (int)InventoryType.LSL)
|
||||
if (item.InvType == (int)type)
|
||||
ret.Add(item);
|
||||
}
|
||||
|
||||
@@ -1183,7 +1183,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (engines.Length == 0) // No engine at all
|
||||
return ret;
|
||||
|
||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||
List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
|
||||
|
||||
foreach (TaskInventoryItem item in scripts)
|
||||
{
|
||||
@@ -1211,7 +1211,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (engines.Length == 0)
|
||||
return;
|
||||
|
||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||
List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
|
||||
|
||||
foreach (TaskInventoryItem item in scripts)
|
||||
{
|
||||
|
||||
@@ -990,23 +990,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="pos"></param>
|
||||
public void Teleport(Vector3 pos)
|
||||
{
|
||||
bool isFlying = Flying;
|
||||
RemoveFromPhysicalScene();
|
||||
Velocity = Vector3.Zero;
|
||||
CheckLandingPoint(ref pos);
|
||||
AbsolutePosition = pos;
|
||||
AddToPhysicalScene(isFlying);
|
||||
|
||||
SendTerseUpdateToAllClients();
|
||||
TeleportWithMomentum(pos, null);
|
||||
}
|
||||
|
||||
public void TeleportWithMomentum(Vector3 pos)
|
||||
public void TeleportWithMomentum(Vector3 pos, Vector3? v)
|
||||
{
|
||||
bool isFlying = Flying;
|
||||
Vector3 vel = Velocity;
|
||||
RemoveFromPhysicalScene();
|
||||
CheckLandingPoint(ref pos);
|
||||
AbsolutePosition = pos;
|
||||
AddToPhysicalScene(isFlying);
|
||||
if (PhysicsActor != null)
|
||||
{
|
||||
if (v.HasValue)
|
||||
PhysicsActor.SetMomentum((Vector3)v);
|
||||
else
|
||||
PhysicsActor.SetMomentum(vel);
|
||||
}
|
||||
|
||||
SendTerseUpdateToAllClients();
|
||||
}
|
||||
@@ -1141,7 +1142,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
|
||||
{
|
||||
m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI);
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}",
|
||||
client.Name, client.AgentId, m_callbackURI);
|
||||
|
||||
Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI);
|
||||
m_callbackURI = null;
|
||||
}
|
||||
@@ -1689,9 +1693,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (pos.Z - terrainHeight < 0.2)
|
||||
pos.Z = terrainHeight;
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
|
||||
Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
|
||||
// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
|
||||
|
||||
if (noFly)
|
||||
Flying = false;
|
||||
@@ -3437,6 +3441,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A float the value is a representative execution time in milliseconds of all scripts in all attachments.
|
||||
/// </summary>
|
||||
public float ScriptExecutionTime()
|
||||
{
|
||||
float time = 0.0f;
|
||||
lock (m_attachments)
|
||||
{
|
||||
foreach (SceneObjectGroup gobj in m_attachments)
|
||||
{
|
||||
if (gobj != null)
|
||||
{
|
||||
time += gobj.ScriptExecutionTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the total count of running scripts in all parts.
|
||||
/// </summary>
|
||||
@@ -3813,7 +3836,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
land.LandData.UserLocation != Vector3.Zero &&
|
||||
land.LandData.OwnerID != m_uuid &&
|
||||
(!m_scene.Permissions.IsGod(m_uuid)) &&
|
||||
(!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)))
|
||||
(!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)))
|
||||
{
|
||||
float curr = Vector3.Distance(AbsolutePosition, pos);
|
||||
if (Vector3.Distance(land.LandData.UserLocation, pos) < curr)
|
||||
@@ -3833,7 +3856,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (GodLevel < 200 &&
|
||||
((!m_scene.Permissions.IsGod(m_uuid) &&
|
||||
!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) ||
|
||||
!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) ||
|
||||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
|
||||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0))
|
||||
{
|
||||
@@ -3901,7 +3924,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
GodLevel < 200 &&
|
||||
((land.LandData.OwnerID != m_uuid &&
|
||||
!m_scene.Permissions.IsGod(m_uuid) &&
|
||||
!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)) ||
|
||||
!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) ||
|
||||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
|
||||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0))
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
static public Random random;
|
||||
SceneObjectGroup found;
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
[Test]
|
||||
public void T010_AddObjects()
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
public void TestDuplicateObject()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010");
|
||||
string part1Name = "part1";
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
int partsToTestCount = 3;
|
||||
|
||||
SceneObjectGroup so
|
||||
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
string obj1Name = "Alfred";
|
||||
string obj2Name = "Betty";
|
||||
@@ -152,7 +152,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
int partsToTestCount = 3;
|
||||
|
||||
SceneObjectGroup so
|
||||
@@ -185,7 +185,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
|
||||
scene.DeleteSceneObject(part.ParentGroup, false);
|
||||
|
||||
@@ -204,7 +204,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
|
||||
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
|
||||
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
|
||||
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
IConfig config = configSource.AddConfig("Startup");
|
||||
config.Set("serverside_object_permissions", true);
|
||||
@@ -100,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
|
||||
UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001");
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
IConfig config = configSource.AddConfig("Startup");
|
||||
config.Set("serverside_object_permissions", true);
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
UUID ownerId = TestHelpers.ParseTail(0x1);
|
||||
int nParts = 3;
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10);
|
||||
scene.AddSceneObject(sog1);
|
||||
scene.LinkObjects(ownerId, sog1.LocalId, new List<uint>() { sog1.Parts[1].LocalId });
|
||||
@@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
|
||||
bool debugtest = false;
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene);
|
||||
SceneObjectGroup grp1 = part1.ParentGroup;
|
||||
SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene);
|
||||
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
|
||||
bool debugtest = false;
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene);
|
||||
SceneObjectGroup grp1 = part1.ParentGroup;
|
||||
SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene);
|
||||
@@ -286,7 +286,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
string rootPartName = "rootpart";
|
||||
UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
|
||||
@@ -325,7 +325,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
string rootPartName = "rootpart";
|
||||
UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup;
|
||||
|
||||
g1.GroupResize(new Vector3(2, 3, 4));
|
||||
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
TestHelpers.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero);
|
||||
g1.RootPart.Scale = new Vector3(2, 3, 4);
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
// UUID itemId = TestHelpers.ParseTail(0x2);
|
||||
string itemName = "Test Script Item";
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId);
|
||||
scene.AddNewSceneObject(so, true);
|
||||
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* 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 System.Threading;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.)
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class SceneObjectSpatialTests
|
||||
{
|
||||
TestScene m_scene;
|
||||
UUID m_ownerId = TestHelpers.ParseTail(0x1);
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetSceneObjectGroupPosition()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Vector3 position = new Vector3(10, 20, 30);
|
||||
|
||||
SceneObjectGroup so
|
||||
= SceneHelpers.CreateSceneObject(1, m_ownerId, "obj1", 0x10);
|
||||
so.AbsolutePosition = position;
|
||||
m_scene.AddNewSceneObject(so, false);
|
||||
|
||||
Assert.That(so.AbsolutePosition, Is.EqualTo(position));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetRootPartPosition()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Vector3 partPosition = new Vector3(10, 20, 30);
|
||||
|
||||
SceneObjectGroup so
|
||||
= SceneHelpers.CreateSceneObject(1, m_ownerId, "obj1", 0x10);
|
||||
so.AbsolutePosition = partPosition;
|
||||
m_scene.AddNewSceneObject(so, false);
|
||||
|
||||
Assert.That(so.RootPart.AbsolutePosition, Is.EqualTo(partPosition));
|
||||
Assert.That(so.RootPart.GroupPosition, Is.EqualTo(partPosition));
|
||||
Assert.That(so.RootPart.GetWorldPosition(), Is.EqualTo(partPosition));
|
||||
Assert.That(so.RootPart.RelativePosition, Is.EqualTo(partPosition));
|
||||
Assert.That(so.RootPart.OffsetPosition, Is.EqualTo(Vector3.Zero));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetChildPartPosition()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Vector3 rootPartPosition = new Vector3(10, 20, 30);
|
||||
Vector3 childOffsetPosition = new Vector3(2, 3, 4);
|
||||
|
||||
SceneObjectGroup so
|
||||
= SceneHelpers.CreateSceneObject(2, m_ownerId, "obj1", 0x10);
|
||||
so.AbsolutePosition = rootPartPosition;
|
||||
so.Parts[1].OffsetPosition = childOffsetPosition;
|
||||
|
||||
m_scene.AddNewSceneObject(so, false);
|
||||
|
||||
// Calculate child absolute position.
|
||||
Vector3 childPosition = new Vector3(rootPartPosition + childOffsetPosition);
|
||||
|
||||
SceneObjectPart childPart = so.Parts[1];
|
||||
Assert.That(childPart.AbsolutePosition, Is.EqualTo(childPosition));
|
||||
Assert.That(childPart.GroupPosition, Is.EqualTo(rootPartPosition));
|
||||
Assert.That(childPart.GetWorldPosition(), Is.EqualTo(childPosition));
|
||||
Assert.That(childPart.RelativePosition, Is.EqualTo(childOffsetPosition));
|
||||
Assert.That(childPart.OffsetPosition, Is.EqualTo(childOffsetPosition));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetChildPartPositionAfterObjectRotation()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Vector3 rootPartPosition = new Vector3(10, 20, 30);
|
||||
Vector3 childOffsetPosition = new Vector3(2, 3, 4);
|
||||
|
||||
SceneObjectGroup so
|
||||
= SceneHelpers.CreateSceneObject(2, m_ownerId, "obj1", 0x10);
|
||||
so.AbsolutePosition = rootPartPosition;
|
||||
so.Parts[1].OffsetPosition = childOffsetPosition;
|
||||
|
||||
m_scene.AddNewSceneObject(so, false);
|
||||
|
||||
so.UpdateGroupRotationR(Quaternion.CreateFromEulers(0, 0, -90 * Utils.DEG_TO_RAD));
|
||||
|
||||
// Calculate child absolute position.
|
||||
Vector3 rotatedChildOffsetPosition
|
||||
= new Vector3(childOffsetPosition.Y, -childOffsetPosition.X, childOffsetPosition.Z);
|
||||
|
||||
Vector3 childPosition = new Vector3(rootPartPosition + rotatedChildOffsetPosition);
|
||||
|
||||
SceneObjectPart childPart = so.Parts[1];
|
||||
|
||||
// FIXME: Should be childPosition after rotation?
|
||||
Assert.That(childPart.AbsolutePosition, Is.EqualTo(rootPartPosition + childOffsetPosition));
|
||||
|
||||
Assert.That(childPart.GroupPosition, Is.EqualTo(rootPartPosition));
|
||||
Assert.That(childPart.GetWorldPosition(), Is.EqualTo(childPosition));
|
||||
|
||||
// Relative to root part as (0, 0, 0)
|
||||
Assert.That(childPart.RelativePosition, Is.EqualTo(childOffsetPosition));
|
||||
|
||||
// Relative to root part as (0, 0, 0)
|
||||
Assert.That(childPart.OffsetPosition, Is.EqualTo(childOffsetPosition));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
@@ -43,24 +44,141 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[TestFixture]
|
||||
public class SceneObjectStatusTests
|
||||
{
|
||||
private TestScene m_scene;
|
||||
private UUID m_ownerId = TestHelpers.ParseTail(0x1);
|
||||
private SceneObjectGroup m_so1;
|
||||
private SceneObjectGroup m_so2;
|
||||
|
||||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
m_so1 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so1", 0x10);
|
||||
m_so2 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so2", 0x20);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSetPhantom()
|
||||
public void TestSetPhantomSinglePrim()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero);
|
||||
SceneObjectPart rootPart = so.RootPart;
|
||||
m_scene.AddSceneObject(m_so1);
|
||||
|
||||
SceneObjectPart rootPart = m_so1.RootPart;
|
||||
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||
|
||||
so.ScriptSetPhantomStatus(true);
|
||||
m_so1.ScriptSetPhantomStatus(true);
|
||||
|
||||
// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
|
||||
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
|
||||
|
||||
so.ScriptSetPhantomStatus(false);
|
||||
m_so1.ScriptSetPhantomStatus(false);
|
||||
|
||||
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSetPhysicsSinglePrim()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
m_scene.AddSceneObject(m_so1);
|
||||
|
||||
SceneObjectPart rootPart = m_so1.RootPart;
|
||||
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||
|
||||
m_so1.ScriptSetPhysicsStatus(true);
|
||||
|
||||
// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
|
||||
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics));
|
||||
|
||||
m_so1.ScriptSetPhysicsStatus(false);
|
||||
|
||||
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSetPhysicsLinkset()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
m_scene.AddSceneObject(m_so1);
|
||||
m_scene.AddSceneObject(m_so2);
|
||||
|
||||
m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
|
||||
|
||||
m_so1.ScriptSetPhysicsStatus(true);
|
||||
|
||||
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
|
||||
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
|
||||
|
||||
m_so1.ScriptSetPhysicsStatus(false);
|
||||
|
||||
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
|
||||
|
||||
m_so1.ScriptSetPhysicsStatus(true);
|
||||
|
||||
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
|
||||
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that linking results in the correct physical status for all linkees.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLinkPhysicsBothPhysical()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
m_scene.AddSceneObject(m_so1);
|
||||
m_scene.AddSceneObject(m_so2);
|
||||
|
||||
m_so1.ScriptSetPhysicsStatus(true);
|
||||
m_so2.ScriptSetPhysicsStatus(true);
|
||||
|
||||
m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
|
||||
|
||||
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
|
||||
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that linking results in the correct physical status for all linkees.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLinkPhysicsRootPhysicalOnly()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
m_scene.AddSceneObject(m_so1);
|
||||
m_scene.AddSceneObject(m_so2);
|
||||
|
||||
m_so1.ScriptSetPhysicsStatus(true);
|
||||
|
||||
m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
|
||||
|
||||
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
|
||||
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that linking results in the correct physical status for all linkees.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLinkPhysicsChildPhysicalOnly()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
m_scene.AddSceneObject(m_so1);
|
||||
m_scene.AddSceneObject(m_so2);
|
||||
|
||||
m_so2.ScriptSetPhysicsStatus(true);
|
||||
|
||||
m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
|
||||
|
||||
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
|
||||
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
|
||||
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
|
||||
IConfig startupConfig = configSource.AddConfig("Startup");
|
||||
|
||||
@@ -67,10 +67,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
public void Init()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
|
||||
scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
|
||||
scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
|
||||
|
||||
SceneHelpers sh = new SceneHelpers();
|
||||
|
||||
scene = sh.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
|
||||
scene2 = sh.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
|
||||
scene3 = sh.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
|
||||
|
||||
ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
|
||||
interregionComms.Initialise(new IniConfigSource());
|
||||
@@ -101,7 +103,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
|
||||
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null);
|
||||
@@ -126,7 +128,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
IConfig config = configSource.AddConfig("Modules");
|
||||
config.Set("SimulationServices", "LocalSimulationConnectorModule");
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, configSource, lsc);
|
||||
|
||||
UUID agentId = TestHelpers.ParseTail(0x01);
|
||||
@@ -176,8 +178,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
|
||||
// UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||
|
||||
TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
|
||||
TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
|
||||
TestScene myScene1 = new SceneHelpers().SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
|
||||
TestScene myScene2 = new SceneHelpers().SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
|
||||
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
IConfig config = configSource.AddConfig("Startup");
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
sp.Flying = true;
|
||||
sp.PhysicsCollisionUpdate(new CollisionEventUpdate());
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
m_sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Region.CoreModules.Framework.EntityTransfer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
|
||||
using OpenSim.Tests.Common;
|
||||
@@ -47,145 +48,93 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[TestFixture]
|
||||
public class ScenePresenceTeleportTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
|
||||
/// </summary>
|
||||
/// Does not yet do what is says on the tin.
|
||||
/// Commenting for now
|
||||
//[Test, LongRunning]
|
||||
public void TestSimpleNotNeighboursTeleport()
|
||||
[Test]
|
||||
public void TestSameRegionTeleport()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
ThreadRunResults results = new ThreadRunResults();
|
||||
results.Result = false;
|
||||
results.Message = "Test did not run";
|
||||
TestRunning testClass = new TestRunning(results);
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Thread testThread = new Thread(testClass.run);
|
||||
EntityTransferModule etm = new EntityTransferModule();
|
||||
|
||||
// Seems kind of redundant to start a thread and then join it, however.. We need to protect against
|
||||
// A thread abort exception in the simulator code.
|
||||
testThread.Start();
|
||||
testThread.Join();
|
||||
IConfigSource config = new IniConfigSource();
|
||||
config.AddConfig("Modules");
|
||||
// Not strictly necessary since FriendsModule assumes it is the default (!)
|
||||
config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
|
||||
|
||||
Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message);
|
||||
// Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
|
||||
TestScene scene = new SceneHelpers().SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
|
||||
SceneHelpers.SetupSceneModules(scene, config, etm);
|
||||
|
||||
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
||||
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
||||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
sp.AbsolutePosition = new Vector3(30, 31, 32);
|
||||
scene.RequestTeleportLocation(
|
||||
sp.ControllingClient,
|
||||
scene.RegionInfo.RegionHandle,
|
||||
teleportPosition,
|
||||
teleportLookAt,
|
||||
(uint)TeleportFlags.ViaLocation);
|
||||
|
||||
Assert.That(sp.AbsolutePosition, Is.EqualTo(teleportPosition));
|
||||
|
||||
// Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
|
||||
// position instead).
|
||||
// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
[Test]
|
||||
public void TestSameSimulatorSeparatedRegionsTeleport()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MainServer.Instance != null) MainServer.Instance.Stop();
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{ }
|
||||
}
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
}
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
|
||||
public class ThreadRunResults
|
||||
{
|
||||
public bool Result = false;
|
||||
public string Message = string.Empty;
|
||||
}
|
||||
EntityTransferModule etm = new EntityTransferModule();
|
||||
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
|
||||
|
||||
public class TestRunning
|
||||
{
|
||||
public ThreadRunResults results;
|
||||
public TestRunning(ThreadRunResults t)
|
||||
{
|
||||
results = t;
|
||||
}
|
||||
public void run(object o)
|
||||
{
|
||||
|
||||
//results.Result = true;
|
||||
log4net.Config.XmlConfigurator.Configure();
|
||||
IConfigSource config = new IniConfigSource();
|
||||
config.AddConfig("Modules");
|
||||
// Not strictly necessary since FriendsModule assumes it is the default (!)
|
||||
config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
|
||||
config.Configs["Modules"].Set("SimulationServices", lscm.Name);
|
||||
|
||||
UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100");
|
||||
UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200");
|
||||
SceneHelpers sh = new SceneHelpers();
|
||||
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
|
||||
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
|
||||
|
||||
// shared module
|
||||
ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
|
||||
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
|
||||
|
||||
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
||||
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
||||
|
||||
Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010);
|
||||
SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
|
||||
sceneB.RegisterRegionWithGrid();
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
|
||||
sp.AbsolutePosition = new Vector3(30, 31, 32);
|
||||
|
||||
Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000);
|
||||
SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
|
||||
sceneA.RegisterRegionWithGrid();
|
||||
// XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole
|
||||
// UDP stack (?)
|
||||
((TestClient)sp.ControllingClient).TeleportTargetScene = sceneB;
|
||||
|
||||
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
|
||||
TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient;
|
||||
sceneA.RequestTeleportLocation(
|
||||
sp.ControllingClient,
|
||||
sceneB.RegionInfo.RegionHandle,
|
||||
teleportPosition,
|
||||
teleportLookAt,
|
||||
(uint)TeleportFlags.ViaLocation);
|
||||
|
||||
ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>();
|
||||
Assert.That(sceneA.GetScenePresence(userId), Is.Null);
|
||||
|
||||
results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl);
|
||||
|
||||
if (!results.Result)
|
||||
{
|
||||
results.Message = "Incorrect caps object path set up in sceneA";
|
||||
return;
|
||||
}
|
||||
ScenePresence sceneBSp = sceneB.GetScenePresence(userId);
|
||||
Assert.That(sceneBSp, Is.Not.Null);
|
||||
Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName));
|
||||
Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition));
|
||||
|
||||
/*
|
||||
Assert.That(
|
||||
sceneACapsModule.GetCapsPath(agentId),
|
||||
Is.EqualTo(client.CapsSeedUrl),
|
||||
"Incorrect caps object path set up in sceneA");
|
||||
*/
|
||||
// FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used.
|
||||
|
||||
// TODO: Add assertions to check correct circuit details in both scenes.
|
||||
|
||||
client.TeleportTargetScene = sceneB;
|
||||
client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40));
|
||||
|
||||
results.Result = (sceneB.GetScenePresence(agentId) != null);
|
||||
if (!results.Result)
|
||||
{
|
||||
results.Message = "Client does not have an agent in sceneB";
|
||||
return;
|
||||
}
|
||||
|
||||
//Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB");
|
||||
|
||||
//Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA");
|
||||
|
||||
results.Result = (sceneA.GetScenePresence(agentId) == null);
|
||||
if (!results.Result)
|
||||
{
|
||||
results.Message = "Client still had an agent in sceneA";
|
||||
return;
|
||||
}
|
||||
|
||||
ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface<ICapabilitiesModule>();
|
||||
|
||||
|
||||
results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort +
|
||||
"/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl);
|
||||
if (!results.Result)
|
||||
{
|
||||
results.Message = "Incorrect caps object path set up in sceneB";
|
||||
return;
|
||||
}
|
||||
|
||||
// Temporary assertion - caps url construction should at least be doable through a method.
|
||||
/*
|
||||
Assert.That(
|
||||
"http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/",
|
||||
Is.EqualTo(client.CapsSeedUrl),
|
||||
"Incorrect caps object path set up in sceneB");
|
||||
*/
|
||||
// This assertion will currently fail since we don't remove the caps paths when no longer needed
|
||||
//Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path");
|
||||
|
||||
// TODO: Check that more of everything is as it should be
|
||||
|
||||
// TODO: test what happens if we try to teleport to a region that doesn't exist
|
||||
// Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
|
||||
// position instead).
|
||||
// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
scene.Update(1);
|
||||
|
||||
Assert.That(scene.Frame, Is.EqualTo(1));
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
|
||||
SceneObjectPart sop1 = sog1.RootPart;
|
||||
@@ -81,7 +81,7 @@ namespace OpenSim.Region.Framework.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
|
||||
SceneObjectPart sop1 = sog1.RootPart;
|
||||
@@ -124,7 +124,7 @@ namespace OpenSim.Region.Framework.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
|
||||
SceneObjectPart sop1 = sog1.RootPart;
|
||||
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
|
||||
SceneObjectPart sop1 = sog1.RootPart;
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
|
||||
UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
|
||||
InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID);
|
||||
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
|
||||
UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
|
||||
InventoryFolderBase folder1
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
public void Init()
|
||||
{
|
||||
// FIXME: We don't need a full scene here - it would be enough to set up the asset service.
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
m_assetService = scene.AssetService;
|
||||
m_uuidGatherer = new UuidGatherer(m_assetService);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
|
||||
private Scene m_scene;
|
||||
private IFriendsModule m_friendsModule;
|
||||
private IUserManagement m_userManagementModule;
|
||||
private IPresenceService m_presenceService;
|
||||
|
||||
// private IAvatarFactoryModule m_avatarFactory;
|
||||
|
||||
@@ -99,8 +100,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
|
||||
|
||||
m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
||||
m_userManagementModule = m_scene.RequestModuleInterface<IUserManagement>();
|
||||
m_presenceService = m_scene.RequestModuleInterface<IPresenceService>();
|
||||
|
||||
if (m_friendsModule != null && m_userManagementModule != null)
|
||||
if (m_friendsModule != null && m_userManagementModule != null && m_presenceService != null)
|
||||
{
|
||||
m_scene.AddCommand(
|
||||
"Friends", this, "friends show",
|
||||
@@ -162,7 +164,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
|
||||
|
||||
MainConsole.Instance.OutputFormat("Friends for {0} {1} {2}:", firstName, lastName, userId);
|
||||
|
||||
MainConsole.Instance.OutputFormat("UUID, Name, MyFlags, TheirFlags");
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"{0,-36} {1,-36} {2,-7} {3,7} {4,10}", "UUID", "Name", "Status", "MyFlags", "TheirFlags");
|
||||
|
||||
foreach (FriendInfo friend in friends)
|
||||
{
|
||||
@@ -175,14 +178,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends
|
||||
|
||||
UUID friendId;
|
||||
string friendName;
|
||||
string onlineText;
|
||||
|
||||
if (UUID.TryParse(friend.Friend, out friendId))
|
||||
friendName = m_userManagementModule.GetUserName(friendId);
|
||||
else
|
||||
friendName = friend.Friend;
|
||||
|
||||
OpenSim.Services.Interfaces.PresenceInfo[] pi = m_presenceService.GetAgents(new string[] { friend.Friend });
|
||||
if (pi.Length > 0)
|
||||
onlineText = "online";
|
||||
else
|
||||
onlineText = "offline";
|
||||
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"{0} {1} {2} {3}", friend.Friend, friendName, friend.MyFlags, friend.TheirFlags);
|
||||
"{0,-36} {1,-36} {2,-7} {3,-7} {4,-10}",
|
||||
friend.Friend, friendName, onlineText, friend.MyFlags, friend.TheirFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
IConfig config = configSource.AddConfig("Groups");
|
||||
config.Set("Enabled", true);
|
||||
|
||||
@@ -0,0 +1,500 @@
|
||||
/*
|
||||
* Copyright (c) Contributors
|
||||
* 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 OpenSim 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 Mono.Addins;
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
public class JsonStore
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private OSD m_ValueStore;
|
||||
|
||||
protected class TakeValueCallbackClass
|
||||
{
|
||||
public string Path { get; set; }
|
||||
public bool UseJson { get; set; }
|
||||
public TakeValueCallback Callback { get; set; }
|
||||
|
||||
public TakeValueCallbackClass(string spath, bool usejson, TakeValueCallback cback)
|
||||
{
|
||||
Path = spath;
|
||||
UseJson = usejson;
|
||||
Callback = cback;
|
||||
}
|
||||
}
|
||||
|
||||
protected List<TakeValueCallbackClass> m_TakeStore;
|
||||
protected List<TakeValueCallbackClass> m_ReadStore;
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public JsonStore() : this("") {}
|
||||
|
||||
public JsonStore(string value)
|
||||
{
|
||||
m_TakeStore = new List<TakeValueCallbackClass>();
|
||||
m_ReadStore = new List<TakeValueCallbackClass>();
|
||||
|
||||
if (String.IsNullOrEmpty(value))
|
||||
m_ValueStore = new OSDMap();
|
||||
else
|
||||
m_ValueStore = OSDParser.DeserializeJson(value);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool TestPath(string expr, bool useJson)
|
||||
{
|
||||
Stack<string> path = ParsePathExpression(expr);
|
||||
OSD result = ProcessPathExpression(m_ValueStore,path);
|
||||
|
||||
if (result == null)
|
||||
return false;
|
||||
|
||||
if (useJson || result.Type == OSDType.String)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool GetValue(string expr, out string value, bool useJson)
|
||||
{
|
||||
Stack<string> path = ParsePathExpression(expr);
|
||||
OSD result = ProcessPathExpression(m_ValueStore,path);
|
||||
return ConvertOutputValue(result,out value,useJson);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool RemoveValue(string expr)
|
||||
{
|
||||
return SetValueFromExpression(expr,null);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool SetValue(string expr, string value, bool useJson)
|
||||
{
|
||||
OSD ovalue = useJson ? OSDParser.DeserializeJson(value) : new OSDString(value);
|
||||
return SetValueFromExpression(expr,ovalue);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool TakeValue(string expr, bool useJson, TakeValueCallback cback)
|
||||
{
|
||||
Stack<string> path = ParsePathExpression(expr);
|
||||
string pexpr = PathExpressionToKey(path);
|
||||
|
||||
OSD result = ProcessPathExpression(m_ValueStore,path);
|
||||
if (result == null)
|
||||
{
|
||||
m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
|
||||
return false;
|
||||
}
|
||||
|
||||
string value = String.Empty;
|
||||
if (! ConvertOutputValue(result,out value,useJson))
|
||||
{
|
||||
// the structure does not match the request so i guess we'll wait
|
||||
m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
|
||||
return false;
|
||||
}
|
||||
|
||||
SetValueFromExpression(expr,null);
|
||||
cback(value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool ReadValue(string expr, bool useJson, TakeValueCallback cback)
|
||||
{
|
||||
Stack<string> path = ParsePathExpression(expr);
|
||||
string pexpr = PathExpressionToKey(path);
|
||||
|
||||
OSD result = ProcessPathExpression(m_ValueStore,path);
|
||||
if (result == null)
|
||||
{
|
||||
m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
|
||||
return false;
|
||||
}
|
||||
|
||||
string value = String.Empty;
|
||||
if (! ConvertOutputValue(result,out value,useJson))
|
||||
{
|
||||
// the structure does not match the request so i guess we'll wait
|
||||
m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
|
||||
return false;
|
||||
}
|
||||
|
||||
cback(value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected bool SetValueFromExpression(string expr, OSD ovalue)
|
||||
{
|
||||
Stack<string> path = ParsePathExpression(expr);
|
||||
if (path.Count == 0)
|
||||
{
|
||||
m_ValueStore = ovalue;
|
||||
return true;
|
||||
}
|
||||
|
||||
string pkey = path.Pop();
|
||||
string pexpr = PathExpressionToKey(path);
|
||||
if (pexpr != "")
|
||||
pexpr += ".";
|
||||
|
||||
OSD result = ProcessPathExpression(m_ValueStore,path);
|
||||
if (result == null)
|
||||
return false;
|
||||
|
||||
Regex aPattern = new Regex("\\[([0-9]+|\\+)\\]");
|
||||
MatchCollection amatches = aPattern.Matches(pkey,0);
|
||||
|
||||
if (amatches.Count > 0)
|
||||
{
|
||||
if (result.Type != OSDType.Array)
|
||||
return false;
|
||||
|
||||
OSDArray amap = result as OSDArray;
|
||||
|
||||
Match match = amatches[0];
|
||||
GroupCollection groups = match.Groups;
|
||||
string akey = groups[1].Value;
|
||||
|
||||
if (akey == "+")
|
||||
{
|
||||
string npkey = String.Format("[{0}]",amap.Count);
|
||||
|
||||
amap.Add(ovalue);
|
||||
InvokeNextCallback(pexpr + npkey);
|
||||
return true;
|
||||
}
|
||||
|
||||
int aval = Convert.ToInt32(akey);
|
||||
if (0 <= aval && aval < amap.Count)
|
||||
{
|
||||
if (ovalue == null)
|
||||
amap.RemoveAt(aval);
|
||||
else
|
||||
{
|
||||
amap[aval] = ovalue;
|
||||
InvokeNextCallback(pexpr + pkey);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Regex hPattern = new Regex("{([^}]+)}");
|
||||
MatchCollection hmatches = hPattern.Matches(pkey,0);
|
||||
|
||||
if (hmatches.Count > 0)
|
||||
{
|
||||
Match match = hmatches[0];
|
||||
GroupCollection groups = match.Groups;
|
||||
string hkey = groups[1].Value;
|
||||
|
||||
if (result is OSDMap)
|
||||
{
|
||||
OSDMap hmap = result as OSDMap;
|
||||
if (ovalue != null)
|
||||
{
|
||||
hmap[hkey] = ovalue;
|
||||
InvokeNextCallback(pexpr + pkey);
|
||||
}
|
||||
else if (hmap.ContainsKey(hkey))
|
||||
hmap.Remove(hkey);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Shouldn't get here if the path was checked correctly
|
||||
m_log.WarnFormat("[JsonStore] invalid path expression");
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected bool InvokeNextCallback(string pexpr)
|
||||
{
|
||||
// Process all of the reads that match the expression first
|
||||
List<TakeValueCallbackClass> reads =
|
||||
m_ReadStore.FindAll(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); });
|
||||
|
||||
foreach (TakeValueCallbackClass readcb in reads)
|
||||
{
|
||||
m_ReadStore.Remove(readcb);
|
||||
ReadValue(readcb.Path,readcb.UseJson,readcb.Callback);
|
||||
}
|
||||
|
||||
// Process one take next
|
||||
TakeValueCallbackClass takecb =
|
||||
m_TakeStore.Find(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); });
|
||||
|
||||
if (takecb != null)
|
||||
{
|
||||
m_TakeStore.Remove(takecb);
|
||||
TakeValue(takecb.Path,takecb.UseJson,takecb.Callback);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Parse the path expression and put the components into a stack. We
|
||||
/// use a stack because we process the path in inverse order later
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected static Stack<string> ParsePathExpression(string path)
|
||||
{
|
||||
Stack<string> m_path = new Stack<string>();
|
||||
|
||||
// add front and rear separators
|
||||
path = "." + path + ".";
|
||||
|
||||
// add separators for quoted paths
|
||||
Regex pass1 = new Regex("{[^}]+}");
|
||||
path = pass1.Replace(path,".$0.",-1,0);
|
||||
|
||||
// add separators for array references
|
||||
Regex pass2 = new Regex("(\\[[0-9]+\\]|\\[\\+\\])");
|
||||
path = pass2.Replace(path,".$0.",-1,0);
|
||||
|
||||
// add quotes to bare identifier
|
||||
Regex pass3 = new Regex("\\.([a-zA-Z]+)");
|
||||
path = pass3.Replace(path,".{$1}",-1,0);
|
||||
|
||||
// remove extra separators
|
||||
Regex pass4 = new Regex("\\.+");
|
||||
path = pass4.Replace(path,".",-1,0);
|
||||
|
||||
Regex validate = new Regex("^\\.(({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])\\.)+$");
|
||||
if (validate.IsMatch(path))
|
||||
{
|
||||
Regex parser = new Regex("\\.({[^}]+}|\\[[0-9]+\\]|\\[\\+\\]+)");
|
||||
MatchCollection matches = parser.Matches(path,0);
|
||||
foreach (Match match in matches)
|
||||
m_path.Push(match.Groups[1].Value);
|
||||
}
|
||||
|
||||
return m_path;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param>path is a stack where the top level of the path is at the bottom of the stack</param>
|
||||
// -----------------------------------------------------------------
|
||||
protected static OSD ProcessPathExpression(OSD map, Stack<string> path)
|
||||
{
|
||||
if (path.Count == 0)
|
||||
return map;
|
||||
|
||||
string pkey = path.Pop();
|
||||
|
||||
OSD rmap = ProcessPathExpression(map,path);
|
||||
if (rmap == null)
|
||||
return null;
|
||||
|
||||
// ---------- Check for an array index ----------
|
||||
Regex aPattern = new Regex("\\[([0-9]+)\\]");
|
||||
MatchCollection amatches = aPattern.Matches(pkey,0);
|
||||
|
||||
if (amatches.Count > 0)
|
||||
{
|
||||
if (rmap.Type != OSDType.Array)
|
||||
{
|
||||
m_log.WarnFormat("[JsonStore] wrong type for key {2}, expecting {0}, got {1}",OSDType.Array,rmap.Type,pkey);
|
||||
return null;
|
||||
}
|
||||
|
||||
OSDArray amap = rmap as OSDArray;
|
||||
|
||||
Match match = amatches[0];
|
||||
GroupCollection groups = match.Groups;
|
||||
string akey = groups[1].Value;
|
||||
int aval = Convert.ToInt32(akey);
|
||||
|
||||
if (aval < amap.Count)
|
||||
return (OSD) amap[aval];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------- Check for a hash index ----------
|
||||
Regex hPattern = new Regex("{([^}]+)}");
|
||||
MatchCollection hmatches = hPattern.Matches(pkey,0);
|
||||
|
||||
if (hmatches.Count > 0)
|
||||
{
|
||||
if (rmap.Type != OSDType.Map)
|
||||
{
|
||||
m_log.WarnFormat("[JsonStore] wrong type for key {2}, expecting {0}, got {1}",OSDType.Map,rmap.Type,pkey);
|
||||
return null;
|
||||
}
|
||||
|
||||
OSDMap hmap = rmap as OSDMap;
|
||||
|
||||
Match match = hmatches[0];
|
||||
GroupCollection groups = match.Groups;
|
||||
string hkey = groups[1].Value;
|
||||
|
||||
if (hmap.ContainsKey(hkey))
|
||||
return (OSD) hmap[hkey];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Shouldn't get here if the path was checked correctly
|
||||
m_log.WarnFormat("[JsonStore] Path type (unknown) does not match the structure");
|
||||
return null;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected static bool ConvertOutputValue(OSD result, out string value, bool useJson)
|
||||
{
|
||||
value = String.Empty;
|
||||
|
||||
// If we couldn't process the path
|
||||
if (result == null)
|
||||
return false;
|
||||
|
||||
if (useJson)
|
||||
{
|
||||
// The path pointed to an intermediate hash structure
|
||||
if (result.Type == OSDType.Map)
|
||||
{
|
||||
value = OSDParser.SerializeJsonString(result as OSDMap);
|
||||
return true;
|
||||
}
|
||||
|
||||
// The path pointed to an intermediate hash structure
|
||||
if (result.Type == OSDType.Array)
|
||||
{
|
||||
value = OSDParser.SerializeJsonString(result as OSDArray);
|
||||
return true;
|
||||
}
|
||||
|
||||
value = "'" + result.AsString() + "'";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (result.Type == OSDType.String)
|
||||
{
|
||||
value = result.AsString();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected static string PathExpressionToKey(Stack<string> path)
|
||||
{
|
||||
if (path.Count == 0)
|
||||
return "";
|
||||
|
||||
string pkey = "";
|
||||
foreach (string k in path)
|
||||
pkey = (pkey == "") ? k : (k + "." + pkey);
|
||||
|
||||
return pkey;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,430 @@
|
||||
/*
|
||||
* Copyright (c) Contributors
|
||||
* 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 OpenSim 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 Mono.Addins;
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "JsonStoreModule")]
|
||||
|
||||
public class JsonStoreModule : INonSharedRegionModule, IJsonStoreModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IConfig m_config = null;
|
||||
private bool m_enabled = false;
|
||||
private Scene m_scene = null;
|
||||
|
||||
private Dictionary<UUID,JsonStore> m_JsonValueStore;
|
||||
private UUID m_sharedStore;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Name of this shared module is it's class name
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public string Name
|
||||
{
|
||||
get { return this.GetType().Name; }
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Initialise this shared module
|
||||
/// </summary>
|
||||
/// <param name="scene">this region is getting initialised</param>
|
||||
/// <param name="source">nini config, we are not using this</param>
|
||||
// -----------------------------------------------------------------
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((m_config = config.Configs["JsonStore"]) == null)
|
||||
{
|
||||
// There is no configuration, the module is disabled
|
||||
// m_log.InfoFormat("[JsonStore] no configuration info");
|
||||
return;
|
||||
}
|
||||
|
||||
m_enabled = m_config.GetBoolean("Enabled", m_enabled);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[JsonStore] initialization error: {0}",e.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_enabled)
|
||||
m_log.DebugFormat("[JsonStore] module is enabled");
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// everything is loaded, perform post load configuration
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Nothing to do on close
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
m_scene = scene;
|
||||
m_scene.RegisterModuleInterface<IJsonStoreModule>(this);
|
||||
|
||||
m_sharedStore = UUID.Zero;
|
||||
m_JsonValueStore = new Dictionary<UUID,JsonStore>();
|
||||
m_JsonValueStore.Add(m_sharedStore,new JsonStore(""));
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
// need to remove all references to the scene in the subscription
|
||||
// list to enable full garbage collection of the scene object
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Called when all modules have been added for a region. This is
|
||||
/// where we hook up events
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (m_enabled) {}
|
||||
}
|
||||
|
||||
/// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ScriptInvocationInteface
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool CreateStore(string value, out UUID result)
|
||||
{
|
||||
result = UUID.Zero;
|
||||
|
||||
if (! m_enabled) return false;
|
||||
|
||||
UUID uuid = UUID.Random();
|
||||
JsonStore map = null;
|
||||
|
||||
try
|
||||
{
|
||||
map = new JsonStore(value);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[JsonStore] Unable to initialize store from {0}; {1}",value,e.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (m_JsonValueStore)
|
||||
m_JsonValueStore.Add(uuid,map);
|
||||
|
||||
result = uuid;
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool DestroyStore(UUID storeID)
|
||||
{
|
||||
if (! m_enabled) return false;
|
||||
|
||||
lock (m_JsonValueStore)
|
||||
m_JsonValueStore.Remove(storeID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool TestPath(UUID storeID, string path, bool useJson)
|
||||
{
|
||||
if (! m_enabled) return false;
|
||||
|
||||
JsonStore map = null;
|
||||
lock (m_JsonValueStore)
|
||||
{
|
||||
if (! m_JsonValueStore.TryGetValue(storeID,out map))
|
||||
{
|
||||
m_log.InfoFormat("[JsonStore] Missing store {0}",storeID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
lock (map)
|
||||
return map.TestPath(path,useJson);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[JsonStore] Path test failed for {0} in {1}; {2}",path,storeID,e.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool SetValue(UUID storeID, string path, string value, bool useJson)
|
||||
{
|
||||
if (! m_enabled) return false;
|
||||
|
||||
JsonStore map = null;
|
||||
lock (m_JsonValueStore)
|
||||
{
|
||||
if (! m_JsonValueStore.TryGetValue(storeID,out map))
|
||||
{
|
||||
m_log.InfoFormat("[JsonStore] Missing store {0}",storeID);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
lock (map)
|
||||
if (map.SetValue(path,value,useJson))
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[JsonStore] Unable to assign {0} to {1} in {2}; {3}",value,path,storeID,e.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool RemoveValue(UUID storeID, string path)
|
||||
{
|
||||
if (! m_enabled) return false;
|
||||
|
||||
JsonStore map = null;
|
||||
lock (m_JsonValueStore)
|
||||
{
|
||||
if (! m_JsonValueStore.TryGetValue(storeID,out map))
|
||||
{
|
||||
m_log.InfoFormat("[JsonStore] Missing store {0}",storeID);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
lock (map)
|
||||
if (map.RemoveValue(path))
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[JsonStore] Unable to remove {0} in {1}; {2}",path,storeID,e.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool GetValue(UUID storeID, string path, bool useJson, out string value)
|
||||
{
|
||||
value = String.Empty;
|
||||
|
||||
if (! m_enabled) return false;
|
||||
|
||||
JsonStore map = null;
|
||||
lock (m_JsonValueStore)
|
||||
{
|
||||
if (! m_JsonValueStore.TryGetValue(storeID,out map))
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
lock (map)
|
||||
{
|
||||
return map.GetValue(path, out value, useJson);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback)
|
||||
{
|
||||
if (! m_enabled)
|
||||
{
|
||||
cback(String.Empty);
|
||||
return;
|
||||
}
|
||||
|
||||
JsonStore map = null;
|
||||
lock (m_JsonValueStore)
|
||||
{
|
||||
if (! m_JsonValueStore.TryGetValue(storeID,out map))
|
||||
{
|
||||
cback(String.Empty);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
lock (map)
|
||||
{
|
||||
map.TakeValue(path, useJson, cback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.ToString());
|
||||
}
|
||||
|
||||
cback(String.Empty);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback)
|
||||
{
|
||||
if (! m_enabled)
|
||||
{
|
||||
cback(String.Empty);
|
||||
return;
|
||||
}
|
||||
|
||||
JsonStore map = null;
|
||||
lock (m_JsonValueStore)
|
||||
{
|
||||
if (! m_JsonValueStore.TryGetValue(storeID,out map))
|
||||
{
|
||||
cback(String.Empty);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
lock (map)
|
||||
{
|
||||
map.ReadValue(path, useJson, cback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.ToString());
|
||||
}
|
||||
|
||||
cback(String.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,499 @@
|
||||
/*
|
||||
* Copyright (c) Contributors
|
||||
* 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 OpenSim 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 Mono.Addins;
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "JsonStoreScriptModule")]
|
||||
|
||||
public class JsonStoreScriptModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IConfig m_config = null;
|
||||
private bool m_enabled = false;
|
||||
private Scene m_scene = null;
|
||||
|
||||
private IScriptModuleComms m_comms;
|
||||
private IJsonStoreModule m_store;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Name of this shared module is it's class name
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public string Name
|
||||
{
|
||||
get { return this.GetType().Name; }
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Initialise this shared module
|
||||
/// </summary>
|
||||
/// <param name="scene">this region is getting initialised</param>
|
||||
/// <param name="source">nini config, we are not using this</param>
|
||||
// -----------------------------------------------------------------
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((m_config = config.Configs["JsonStore"]) == null)
|
||||
{
|
||||
// There is no configuration, the module is disabled
|
||||
// m_log.InfoFormat("[JsonStoreScripts] no configuration info");
|
||||
return;
|
||||
}
|
||||
|
||||
m_enabled = m_config.GetBoolean("Enabled", m_enabled);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[JsonStoreScripts] initialization error: {0}",e.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_enabled)
|
||||
m_log.DebugFormat("[JsonStoreScripts] module is enabled");
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// everything is loaded, perform post load configuration
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Nothing to do on close
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
// need to remove all references to the scene in the subscription
|
||||
// list to enable full garbage collection of the scene object
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Called when all modules have been added for a region. This is
|
||||
/// where we hook up events
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (m_enabled)
|
||||
{
|
||||
m_scene = scene;
|
||||
m_comms = m_scene.RequestModuleInterface<IScriptModuleComms>();
|
||||
if (m_comms == null)
|
||||
{
|
||||
m_log.ErrorFormat("[JsonStoreScripts] ScriptModuleComms interface not defined");
|
||||
m_enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_store = m_scene.RequestModuleInterface<IJsonStoreModule>();
|
||||
if (m_store == null)
|
||||
{
|
||||
m_log.ErrorFormat("[JsonStoreScripts] JsonModule interface not defined");
|
||||
m_enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_comms.RegisterScriptInvocation(this,"JsonCreateStore");
|
||||
m_comms.RegisterScriptInvocation(this,"JsonDestroyStore");
|
||||
|
||||
m_comms.RegisterScriptInvocation(this,"JsonReadNotecard");
|
||||
m_comms.RegisterScriptInvocation(this,"JsonWriteNotecard");
|
||||
|
||||
m_comms.RegisterScriptInvocation(this,"JsonTestPath");
|
||||
m_comms.RegisterScriptInvocation(this,"JsonTestPathJson");
|
||||
|
||||
m_comms.RegisterScriptInvocation(this,"JsonGetValue");
|
||||
m_comms.RegisterScriptInvocation(this,"JsonGetValueJson");
|
||||
|
||||
m_comms.RegisterScriptInvocation(this,"JsonTakeValue");
|
||||
m_comms.RegisterScriptInvocation(this,"JsonTakeValueJson");
|
||||
|
||||
m_comms.RegisterScriptInvocation(this,"JsonReadValue");
|
||||
m_comms.RegisterScriptInvocation(this,"JsonReadValueJson");
|
||||
|
||||
m_comms.RegisterScriptInvocation(this,"JsonSetValue");
|
||||
m_comms.RegisterScriptInvocation(this,"JsonSetValueJson");
|
||||
|
||||
m_comms.RegisterScriptInvocation(this,"JsonRemoveValue");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// See http://opensimulator.org/mantis/view.php?id=5971 for more information
|
||||
m_log.WarnFormat("[JsonStroreScripts] script method registration failed; {0}",e.Message);
|
||||
m_enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ScriptInvocationInteface
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected void GenerateRuntimeError(string msg)
|
||||
{
|
||||
throw new Exception("JsonStore Runtime Error: " + msg);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected UUID JsonCreateStore(UUID hostID, UUID scriptID, string value)
|
||||
{
|
||||
UUID uuid = UUID.Zero;
|
||||
if (! m_store.CreateStore(value, out uuid))
|
||||
GenerateRuntimeError("Failed to create Json store");
|
||||
|
||||
return uuid;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected int JsonDestroyStore(UUID hostID, UUID scriptID, UUID storeID)
|
||||
{
|
||||
return m_store.DestroyStore(storeID) ? 1 : 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID)
|
||||
{
|
||||
UUID reqID = UUID.Random();
|
||||
Util.FireAndForget(delegate(object o) { DoJsonReadNotecard(reqID,hostID,scriptID,storeID,path,assetID); });
|
||||
return reqID;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected UUID JsonWriteNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, string name)
|
||||
{
|
||||
UUID reqID = UUID.Random();
|
||||
Util.FireAndForget(delegate(object o) { DoJsonWriteNotecard(reqID,hostID,scriptID,storeID,path,name); });
|
||||
return reqID;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected int JsonTestPath(UUID hostID, UUID scriptID, UUID storeID, string path)
|
||||
{
|
||||
return m_store.TestPath(storeID,path,false) ? 1 : 0;
|
||||
}
|
||||
|
||||
protected int JsonTestPathJson(UUID hostID, UUID scriptID, UUID storeID, string path)
|
||||
{
|
||||
return m_store.TestPath(storeID,path,true) ? 1 : 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected int JsonSetValue(UUID hostID, UUID scriptID, UUID storeID, string path, string value)
|
||||
{
|
||||
return m_store.SetValue(storeID,path,value,false) ? 1 : 0;
|
||||
}
|
||||
|
||||
protected int JsonSetValueJson(UUID hostID, UUID scriptID, UUID storeID, string path, string value)
|
||||
{
|
||||
return m_store.SetValue(storeID,path,value,true) ? 1 : 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected int JsonRemoveValue(UUID hostID, UUID scriptID, UUID storeID, string path)
|
||||
{
|
||||
return m_store.RemoveValue(storeID,path) ? 1 : 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected string JsonGetValue(UUID hostID, UUID scriptID, UUID storeID, string path)
|
||||
{
|
||||
string value = String.Empty;
|
||||
m_store.GetValue(storeID,path,false,out value);
|
||||
return value;
|
||||
}
|
||||
|
||||
protected string JsonGetValueJson(UUID hostID, UUID scriptID, UUID storeID, string path)
|
||||
{
|
||||
string value = String.Empty;
|
||||
m_store.GetValue(storeID,path,true, out value);
|
||||
return value;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected UUID JsonTakeValue(UUID hostID, UUID scriptID, UUID storeID, string path)
|
||||
{
|
||||
UUID reqID = UUID.Random();
|
||||
Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,false); });
|
||||
return reqID;
|
||||
}
|
||||
|
||||
protected UUID JsonTakeValueJson(UUID hostID, UUID scriptID, UUID storeID, string path)
|
||||
{
|
||||
UUID reqID = UUID.Random();
|
||||
Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,true); });
|
||||
return reqID;
|
||||
}
|
||||
|
||||
private void DoJsonTakeValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_store.TakeValue(storeID,path,useJson,delegate(string value) { DispatchValue(scriptID,reqID,value); });
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[JsonStoreScripts] unable to retrieve value; {0}",e.ToString());
|
||||
}
|
||||
|
||||
DispatchValue(scriptID,reqID,String.Empty);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected UUID JsonReadValue(UUID hostID, UUID scriptID, UUID storeID, string path)
|
||||
{
|
||||
UUID reqID = UUID.Random();
|
||||
Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,false); });
|
||||
return reqID;
|
||||
}
|
||||
|
||||
protected UUID JsonReadValueJson(UUID hostID, UUID scriptID, UUID storeID, string path)
|
||||
{
|
||||
UUID reqID = UUID.Random();
|
||||
Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,true); });
|
||||
return reqID;
|
||||
}
|
||||
|
||||
private void DoJsonReadValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_store.ReadValue(storeID,path,useJson,delegate(string value) { DispatchValue(scriptID,reqID,value); });
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[JsonStoreScripts] unable to retrieve value; {0}",e.ToString());
|
||||
}
|
||||
|
||||
DispatchValue(scriptID,reqID,String.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected void DispatchValue(UUID scriptID, UUID reqID, string value)
|
||||
{
|
||||
m_comms.DispatchReply(scriptID,1,value,reqID.ToString());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
private void DoJsonReadNotecard(UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID)
|
||||
{
|
||||
AssetBase a = m_scene.AssetService.Get(assetID.ToString());
|
||||
if (a == null)
|
||||
GenerateRuntimeError(String.Format("Unable to find notecard asset {0}",assetID));
|
||||
|
||||
if (a.Type != (sbyte)AssetType.Notecard)
|
||||
GenerateRuntimeError(String.Format("Invalid notecard asset {0}",assetID));
|
||||
|
||||
m_log.DebugFormat("[JsonStoreScripts] read notecard in context {0}",storeID);
|
||||
|
||||
try
|
||||
{
|
||||
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
|
||||
string jsondata = SLUtil.ParseNotecardToString(enc.GetString(a.Data));
|
||||
int result = m_store.SetValue(storeID,path,jsondata,true) ? 1 : 0;
|
||||
m_comms.DispatchReply(scriptID,result,"",reqID.ToString());
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[JsonStoreScripts] Json parsing failed; {0}",e.Message);
|
||||
}
|
||||
|
||||
GenerateRuntimeError(String.Format("Json parsing failed for {0}",assetID.ToString()));
|
||||
m_comms.DispatchReply(scriptID,0,"",reqID.ToString());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
private void DoJsonWriteNotecard(UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, string name)
|
||||
{
|
||||
string data;
|
||||
if (! m_store.GetValue(storeID,path,true, out data))
|
||||
{
|
||||
m_comms.DispatchReply(scriptID,0,UUID.Zero.ToString(),reqID.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
SceneObjectPart host = m_scene.GetSceneObjectPart(hostID);
|
||||
|
||||
// Create new asset
|
||||
UUID assetID = UUID.Random();
|
||||
AssetBase asset = new AssetBase(assetID, name, (sbyte)AssetType.Notecard, host.OwnerID.ToString());
|
||||
asset.Description = "Json store";
|
||||
|
||||
int textLength = data.Length;
|
||||
data = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length "
|
||||
+ textLength.ToString() + "\n" + data + "}\n";
|
||||
|
||||
asset.Data = Util.UTF8.GetBytes(data);
|
||||
m_scene.AssetService.Store(asset);
|
||||
|
||||
// Create Task Entry
|
||||
TaskInventoryItem taskItem = new TaskInventoryItem();
|
||||
|
||||
taskItem.ResetIDs(host.UUID);
|
||||
taskItem.ParentID = host.UUID;
|
||||
taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch();
|
||||
taskItem.Name = asset.Name;
|
||||
taskItem.Description = asset.Description;
|
||||
taskItem.Type = (int)AssetType.Notecard;
|
||||
taskItem.InvType = (int)InventoryType.Notecard;
|
||||
taskItem.OwnerID = host.OwnerID;
|
||||
taskItem.CreatorID = host.OwnerID;
|
||||
taskItem.BasePermissions = (uint)PermissionMask.All;
|
||||
taskItem.CurrentPermissions = (uint)PermissionMask.All;
|
||||
taskItem.EveryonePermissions = 0;
|
||||
taskItem.NextPermissions = (uint)PermissionMask.All;
|
||||
taskItem.GroupID = host.GroupID;
|
||||
taskItem.GroupPermissions = 0;
|
||||
taskItem.Flags = 0;
|
||||
taskItem.PermsGranter = UUID.Zero;
|
||||
taskItem.PermsMask = 0;
|
||||
taskItem.AssetID = asset.FullID;
|
||||
|
||||
host.Inventory.AddInventoryItem(taskItem, false);
|
||||
|
||||
m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||
public Vector3 WorldPosition
|
||||
{
|
||||
get { return GetSP().AbsolutePosition; }
|
||||
set { GetSP().TeleportWithMomentum(value); }
|
||||
set { GetSP().Teleport(value); }
|
||||
}
|
||||
|
||||
public bool IsChildAgent
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user