Merge branch 'master' of /home/opensim/var/repo/opensim
commit
b5db5d7a57
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
destinationRegionName = sp.Scene.RegionInfo.RegionName;
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: RequestTeleportToLocation for {0} to {1} within existing region {2}",
|
||||
"[ENTITY TRANSFER MODULE]: Teleport for {0} to {1} within {2}",
|
||||
sp.Name, position, destinationRegionName);
|
||||
|
||||
// Teleport within the same region
|
||||
|
@ -231,7 +231,10 @@ 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;
|
||||
}
|
||||
|
@ -320,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);
|
||||
|
@ -444,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.
|
||||
|
@ -656,7 +665,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());
|
||||
|
@ -671,14 +681,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
|
||||
|
@ -1362,19 +1378,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)
|
||||
{
|
||||
|
@ -1391,7 +1405,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);
|
||||
|
@ -1402,10 +1416,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>
|
||||
|
|
|
@ -201,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>();
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
@ -709,6 +710,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 =
|
||||
|
@ -3215,8 +3217,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 {2}",
|
||||
(isChildAgent ? "child" : "root"), avatar.Name, agentID, RegionInfo.RegionName);
|
||||
|
||||
m_sceneGraph.removeUserCount(!isChildAgent);
|
||||
|
||||
|
@ -3794,41 +3796,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.
|
||||
|
|
|
@ -1142,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;
|
||||
}
|
||||
|
@ -1690,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;
|
||||
|
|
|
@ -76,22 +76,27 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
|
||||
public void Say(string message)
|
||||
{
|
||||
SendOnChatFromClient(message, ChatTypeEnum.Say);
|
||||
SendOnChatFromClient(0, message, ChatTypeEnum.Say);
|
||||
}
|
||||
|
||||
public void Shout(string message)
|
||||
public void Say(int channel, string message)
|
||||
{
|
||||
SendOnChatFromClient(message, ChatTypeEnum.Shout);
|
||||
SendOnChatFromClient(channel, message, ChatTypeEnum.Say);
|
||||
}
|
||||
|
||||
public void Whisper(string message)
|
||||
public void Shout(int channel, string message)
|
||||
{
|
||||
SendOnChatFromClient(message, ChatTypeEnum.Whisper);
|
||||
SendOnChatFromClient(channel, message, ChatTypeEnum.Shout);
|
||||
}
|
||||
|
||||
public void Whisper(int channel, string message)
|
||||
{
|
||||
SendOnChatFromClient(channel, message, ChatTypeEnum.Whisper);
|
||||
}
|
||||
|
||||
public void Broadcast(string message)
|
||||
{
|
||||
SendOnChatFromClient(message, ChatTypeEnum.Broadcast);
|
||||
SendOnChatFromClient(0, message, ChatTypeEnum.Broadcast);
|
||||
}
|
||||
|
||||
public void GiveMoney(UUID target, int amount)
|
||||
|
@ -146,10 +151,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
|
||||
#region Internal Functions
|
||||
|
||||
private void SendOnChatFromClient(string message, ChatTypeEnum chatType)
|
||||
private void SendOnChatFromClient(int channel, string message, ChatTypeEnum chatType)
|
||||
{
|
||||
OSChatMessage chatFromClient = new OSChatMessage();
|
||||
chatFromClient.Channel = 0;
|
||||
chatFromClient.Channel = channel;
|
||||
chatFromClient.From = Name;
|
||||
chatFromClient.Message = message;
|
||||
chatFromClient.Position = StartPos;
|
||||
|
|
|
@ -211,6 +211,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
}
|
||||
|
||||
public bool Say(UUID agentID, Scene scene, string text)
|
||||
{
|
||||
return Say(agentID, scene, text, 0);
|
||||
}
|
||||
|
||||
public bool Say(UUID agentID, Scene scene, string text, int channel)
|
||||
{
|
||||
lock (m_avatars)
|
||||
{
|
||||
|
@ -219,7 +224,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
ScenePresence sp;
|
||||
scene.TryGetScenePresence(agentID, out sp);
|
||||
|
||||
m_avatars[agentID].Say(text);
|
||||
m_avatars[agentID].Say(channel, text);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Shout(UUID agentID, Scene scene, string text, int channel)
|
||||
{
|
||||
lock (m_avatars)
|
||||
{
|
||||
if (m_avatars.ContainsKey(agentID))
|
||||
{
|
||||
ScenePresence sp;
|
||||
scene.TryGetScenePresence(agentID, out sp);
|
||||
|
||||
m_avatars[agentID].Shout(channel, text);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -246,6 +269,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool Whisper(UUID agentID, Scene scene, string text, int channel)
|
||||
{
|
||||
lock (m_avatars)
|
||||
{
|
||||
if (m_avatars.ContainsKey(agentID))
|
||||
{
|
||||
ScenePresence sp;
|
||||
scene.TryGetScenePresence(agentID, out sp);
|
||||
|
||||
m_avatars[agentID].Whisper(channel, text);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Stand(UUID agentID, Scene scene)
|
||||
{
|
||||
lock (m_avatars)
|
||||
|
|
|
@ -351,7 +351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
UUID ownerID = ti.OwnerID;
|
||||
|
||||
//OSSL only may be used if objet is in the same group as the parcel
|
||||
//OSSL only may be used if object is in the same group as the parcel
|
||||
if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER"))
|
||||
{
|
||||
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
|
||||
|
@ -729,11 +729,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
// For safety, we add another permission check here, and don't rely only on the standard OSSL permissions
|
||||
if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
|
||||
{
|
||||
MainConsole.Instance.RunCommand(command);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2538,6 +2540,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
|
||||
public void osNpcSay(LSL_Key npc, string message)
|
||||
{
|
||||
osNpcSay(npc, 0, message);
|
||||
}
|
||||
|
||||
public void osNpcSay(LSL_Key npc, int channel, string message)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcSay");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
@ -2550,7 +2557,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (!module.CheckPermissions(npcId, m_host.OwnerID))
|
||||
return;
|
||||
|
||||
module.Say(npcId, World, message);
|
||||
module.Say(npcId, World, message, channel);
|
||||
}
|
||||
}
|
||||
|
||||
public void osNpcShout(LSL_Key npc, int channel, string message)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcShout");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||
if (module != null)
|
||||
{
|
||||
UUID npcId = new UUID(npc.m_string);
|
||||
|
||||
if (!module.CheckPermissions(npcId, m_host.OwnerID))
|
||||
return;
|
||||
|
||||
module.Shout(npcId, World, message, channel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2635,6 +2659,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
}
|
||||
|
||||
public void osNpcWhisper(LSL_Key npc, int channel, string message)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcWhisper");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||
if (module != null)
|
||||
{
|
||||
UUID npcId = new UUID(npc.m_string);
|
||||
|
||||
if (!module.CheckPermissions(npcId, m_host.OwnerID))
|
||||
return;
|
||||
|
||||
module.Whisper(npcId, World, message, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save the current appearance of the script owner permanently to the named notecard.
|
||||
/// </summary>
|
||||
|
@ -2786,21 +2827,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
|
||||
World.ForEachRootScenePresence(delegate(ScenePresence sp)
|
||||
{
|
||||
World.ForEachRootScenePresence(delegate(ScenePresence sp)
|
||||
if (sp.Firstname == FirstName && sp.Lastname == SurName)
|
||||
{
|
||||
if (sp.Firstname == FirstName && sp.Lastname == SurName)
|
||||
{
|
||||
// kick client...
|
||||
if (alert != null)
|
||||
sp.ControllingClient.Kick(alert);
|
||||
// kick client...
|
||||
if (alert != null)
|
||||
sp.ControllingClient.Kick(alert);
|
||||
|
||||
// ...and close on our side
|
||||
sp.Scene.IncomingCloseAgent(sp.UUID);
|
||||
}
|
||||
});
|
||||
}
|
||||
// ...and close on our side
|
||||
sp.Scene.IncomingCloseAgent(sp.UUID);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void osCauseDamage(string avatar, double damage)
|
||||
|
|
|
@ -217,11 +217,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
void osNpcSetRot(LSL_Key npc, rotation rot);
|
||||
void osNpcStopMoveToTarget(LSL_Key npc);
|
||||
void osNpcSay(key npc, string message);
|
||||
void osNpcSay(key npc, int channel, string message);
|
||||
void osNpcShout(key npc, int channel, string message);
|
||||
void osNpcSit(key npc, key target, int options);
|
||||
void osNpcStand(LSL_Key npc);
|
||||
void osNpcRemove(key npc);
|
||||
void osNpcPlayAnimation(LSL_Key npc, string animation);
|
||||
void osNpcStopAnimation(LSL_Key npc, string animation);
|
||||
void osNpcWhisper(key npc, int channel, string message);
|
||||
|
||||
LSL_Key osOwnerSaveAppearance(string notecard);
|
||||
LSL_Key osAgentSaveAppearance(key agentId, string notecard);
|
||||
|
|
|
@ -580,6 +580,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
m_OSSL_Functions.osNpcSay(npc, message);
|
||||
}
|
||||
|
||||
public void osNpcSay(key npc, int channel, string message)
|
||||
{
|
||||
m_OSSL_Functions.osNpcSay(npc, channel, message);
|
||||
}
|
||||
|
||||
|
||||
public void osNpcShout(key npc, int channel, string message)
|
||||
{
|
||||
m_OSSL_Functions.osNpcShout(npc, channel, message);
|
||||
}
|
||||
|
||||
public void osNpcSit(LSL_Key npc, LSL_Key target, int options)
|
||||
{
|
||||
m_OSSL_Functions.osNpcSit(npc, target, options);
|
||||
|
@ -605,6 +616,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
m_OSSL_Functions.osNpcStopAnimation(npc, animation);
|
||||
}
|
||||
|
||||
public void osNpcWhisper(key npc, int channel, string message)
|
||||
{
|
||||
m_OSSL_Functions.osNpcWhisper(npc, channel, message);
|
||||
}
|
||||
|
||||
public LSL_Key osOwnerSaveAppearance(string notecard)
|
||||
{
|
||||
return m_OSSL_Functions.osOwnerSaveAppearance(notecard);
|
||||
|
|
|
@ -337,6 +337,13 @@
|
|||
; OpenJPEG if false
|
||||
; UseCSJ2K = true
|
||||
|
||||
|
||||
; Use "Trash" folder for items deleted from the scene
|
||||
; When set to True (the default) items deleted from the scene will be
|
||||
; stored in the user's trash or lost and found folder. When set to
|
||||
; False items will be removed from the scene permanently
|
||||
UseTrashOnDelete = True
|
||||
|
||||
; Persist avatar baked textures
|
||||
; Persisting baked textures can speed up login and region border
|
||||
; crossings especially with large numbers of users, though it
|
||||
|
|
Loading…
Reference in New Issue