Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2011-04-21 16:28:29 +01:00
commit 09b6d717bf
21 changed files with 609 additions and 414 deletions

View File

@ -430,7 +430,7 @@ namespace OpenSim.Framework.Servers.HttpServer
string path = request.RawUrl; string path = request.RawUrl;
string handlerKey = GetHandlerKey(request.HttpMethod, path); string handlerKey = GetHandlerKey(request.HttpMethod, path);
//m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); // m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
if (TryGetStreamHandler(handlerKey, out requestHandler)) if (TryGetStreamHandler(handlerKey, out requestHandler))
{ {

View File

@ -66,12 +66,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig startupConfig = source.Configs["Startup"]; IConfig meshConfig = source.Configs["Mesh"];
if (startupConfig == null) if (meshConfig == null)
return; return;
if (!startupConfig.GetBoolean("ColladaMesh",true)) m_enabled = meshConfig.GetBoolean("ColladaMesh", true);
m_enabled = false;
} }
public void AddRegion(Scene pScene) public void AddRegion(Scene pScene)

View File

@ -68,12 +68,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig startupConfig = source.Configs["Startup"]; IConfig meshConfig = source.Configs["Mesh"];
if (startupConfig == null) if (meshConfig == null)
return; return;
if (!startupConfig.GetBoolean("ColladaMesh",true)) m_enabled = meshConfig.GetBoolean("ColladaMesh", true);
m_enabled = false;
} }
public void AddRegion(Scene pScene) public void AddRegion(Scene pScene)

View File

@ -77,7 +77,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// </value> /// </value>
private Stream m_loadStream; private Stream m_loadStream;
protected bool m_controlFileLoaded; /// <summary>
/// Has the control file been loaded for this archive?
/// </summary>
public bool ControlFileLoaded { get; private set; }
/// <summary>
/// Do we want to enforce the check. IAR versions before 0.2 and 1.1 do not guarantee this order, so we can't
/// enforce.
/// </summary>
public bool EnforceControlFileCheck { get; private set; }
protected bool m_assetsLoaded; protected bool m_assetsLoaded;
protected bool m_inventoryNodesLoaded; protected bool m_inventoryNodesLoaded;
@ -126,6 +136,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_userInfo = userInfo; m_userInfo = userInfo;
m_invPath = invPath; m_invPath = invPath;
m_loadStream = loadStream; m_loadStream = loadStream;
// FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things
// (I thought they weren't). We will need to bump the version number and perform this check on all
// subsequent IAR versions only
ControlFileLoaded = true;
} }
/// <summary> /// <summary>
@ -517,7 +532,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// </summary> /// </summary>
/// <param name="path"></param> /// <param name="path"></param>
/// <param name="data"></param> /// <param name="data"></param>
protected void LoadControlFile(string path, byte[] data) public void LoadControlFile(string path, byte[] data)
{ {
XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data));
XElement archiveElement = doc.Element("archive"); XElement archiveElement = doc.Element("archive");
@ -533,7 +548,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
majorVersion, MAX_MAJOR_VERSION)); majorVersion, MAX_MAJOR_VERSION));
} }
m_controlFileLoaded = true; ControlFileLoaded = true;
m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
} }
@ -545,7 +560,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <param name="data"></param> /// <param name="data"></param>
protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data) protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data)
{ {
if (!m_controlFileLoaded) if (!ControlFileLoaded)
throw new Exception( throw new Exception(
string.Format( string.Format(
"The IAR you are trying to load does not list {0} before {1}. Aborting load", "The IAR you are trying to load does not list {0} before {1}. Aborting load",
@ -592,7 +607,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <param name="data"></param> /// <param name="data"></param>
protected void LoadAssetFile(string path, byte[] data) protected void LoadAssetFile(string path, byte[] data)
{ {
if (!m_controlFileLoaded) if (!ControlFileLoaded)
throw new Exception( throw new Exception(
string.Format( string.Format(
"The IAR you are trying to load does not list {0} before {1}. Aborting load", "The IAR you are trying to load does not list {0} before {1}. Aborting load",

View File

@ -388,12 +388,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (options.ContainsKey("profile")) if (options.ContainsKey("profile"))
{ {
majorVersion = 1; majorVersion = 1;
minorVersion = 0; minorVersion = 1;
} }
else else
{ {
majorVersion = 0; majorVersion = 0;
minorVersion = 1; minorVersion = 2;
} }
m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion);

View File

@ -96,6 +96,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75))); Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75)));
} }
/// <summary>
/// Test that the IAR has the required files in the right order.
/// </summary>
/// <remarks>
/// At the moment, the only thing that matters is that the control file is the very first one.
/// </remarks>
[Test]
public void TestOrder()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
MemoryStream archiveReadStream = new MemoryStream(m_iarStreamBytes);
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
string filePath;
TarArchiveReader.TarEntryType tarEntryType;
byte[] data = tar.ReadEntry(out filePath, out tarEntryType);
Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
InventoryArchiveReadRequest iarr
= new InventoryArchiveReadRequest(null, null, null, (Stream)null, false);
iarr.LoadControlFile(filePath, data);
Assert.That(iarr.ControlFileLoaded, Is.True);
}
/// <summary> /// <summary>
/// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive
/// (subject to change since there is no fixed format yet). /// (subject to change since there is no fixed format yet).

View File

@ -214,18 +214,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return UUID.Zero; return UUID.Zero;
} }
/// <summary> public virtual UUID CopyToInventory(DeRezAction action, UUID folderID,
/// Delete a scene object from a scene and place in the given avatar's inventory.
/// Returns the UUID of the newly created asset.
/// </summary>
/// <param name="action"></param>
/// <param name="folderID"></param>
/// <param name="objectGroup"></param>
/// <param name="remoteClient"> </param>
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) List<SceneObjectGroup> objectGroups, IClientAPI remoteClient)
{ {
Dictionary<UUID, List<SceneObjectGroup>> deletes = new Dictionary<UUID, List<SceneObjectGroup>>(); Dictionary<UUID, List<SceneObjectGroup>> bundlesToCopy = new Dictionary<UUID, List<SceneObjectGroup>>();
if (CoalesceMultipleObjectsToInventory) if (CoalesceMultipleObjectsToInventory)
{ {
@ -234,10 +226,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// reasons. // reasons.
foreach (SceneObjectGroup g in objectGroups) foreach (SceneObjectGroup g in objectGroups)
{ {
if (!deletes.ContainsKey(g.OwnerID)) if (!bundlesToCopy.ContainsKey(g.OwnerID))
deletes[g.OwnerID] = new List<SceneObjectGroup>(); bundlesToCopy[g.OwnerID] = new List<SceneObjectGroup>();
deletes[g.OwnerID].Add(g); bundlesToCopy[g.OwnerID].Add(g);
} }
} }
else else
@ -247,7 +239,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{ {
List<SceneObjectGroup> bundle = new List<SceneObjectGroup>(); List<SceneObjectGroup> bundle = new List<SceneObjectGroup>();
bundle.Add(g); bundle.Add(g);
deletes[g.UUID] = bundle; bundlesToCopy[g.UUID] = bundle;
} }
} }
@ -257,328 +249,348 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// Each iteration is really a separate asset being created, // Each iteration is really a separate asset being created,
// with distinct destinations as well. // with distinct destinations as well.
foreach (List<SceneObjectGroup> objlist in deletes.Values) foreach (List<SceneObjectGroup> bundle in bundlesToCopy.Values)
assetID = CopyBundleToInventory(action, folderID, bundle, remoteClient);
return assetID;
}
/// <summary>
/// Copy a bundle of objects to inventory. If there is only one object, then this will create an object
/// item. If there are multiple objects then these will be saved as a single coalesced item.
/// </summary>
/// <param name="action"></param>
/// <param name="folderID"></param>
/// <param name="objlist"></param>
/// <param name="remoteClient"></param>
/// <returns></returns>
protected UUID CopyBundleToInventory(
DeRezAction action, UUID folderID, List<SceneObjectGroup> objlist, IClientAPI remoteClient)
{
UUID assetID = UUID.Zero;
CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero);
Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();
Dictionary<UUID, string> xmlStrings =
new Dictionary<UUID, string>();
foreach (SceneObjectGroup objectGroup in objlist)
{ {
Dictionary<UUID, string> xmlStrings = Vector3 inventoryStoredPosition = new Vector3
new Dictionary<UUID, string>(); (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
? 250
: objectGroup.AbsolutePosition.X)
,
(objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize)
? 250
: objectGroup.AbsolutePosition.Y,
objectGroup.AbsolutePosition.Z);
foreach (SceneObjectGroup objectGroup in objlist) Vector3 originalPosition = objectGroup.AbsolutePosition;
// Restore attachment data after trip through the sim
if (objectGroup.RootPart.AttachPoint > 0)
inventoryStoredPosition = objectGroup.RootPart.AttachOffset;
objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
objectGroup.AbsolutePosition = inventoryStoredPosition;
// Make sure all bits but the ones we want are clear
// on take.
// This will be applied to the current perms, so
// it will do what we want.
objectGroup.RootPart.NextOwnerMask &=
((uint)PermissionMask.Copy |
(uint)PermissionMask.Transfer |
(uint)PermissionMask.Modify);
objectGroup.RootPart.NextOwnerMask |=
(uint)PermissionMask.Move;
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
objectGroup.AbsolutePosition = originalPosition;
xmlStrings[objectGroup.UUID] = sceneObjectXml;
}
string itemXml;
if (objlist.Count > 1)
{
float minX, minY, minZ;
float maxX, maxY, maxZ;
Vector3[] offsets = Scene.GetCombinedBoundingBox(objlist,
out minX, out maxX, out minY, out maxY,
out minZ, out maxZ);
// CreateWrapper
XmlDocument itemDoc = new XmlDocument();
XmlElement root = itemDoc.CreateElement("", "CoalescedObject", "");
itemDoc.AppendChild(root);
// Embed the offsets into the group XML
for ( int i = 0 ; i < objlist.Count ; i++ )
{ {
Vector3 inventoryStoredPosition = new Vector3 XmlDocument doc = new XmlDocument();
(((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) SceneObjectGroup g = objlist[i];
? 250 doc.LoadXml(xmlStrings[g.UUID]);
: objectGroup.AbsolutePosition.X) XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup");
, e.SetAttribute("offsetx", offsets[i].X.ToString());
(objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize) e.SetAttribute("offsety", offsets[i].Y.ToString());
? 250 e.SetAttribute("offsetz", offsets[i].Z.ToString());
: objectGroup.AbsolutePosition.Y,
objectGroup.AbsolutePosition.Z);
Vector3 originalPosition = objectGroup.AbsolutePosition; XmlNode objectNode = itemDoc.ImportNode(e, true);
root.AppendChild(objectNode);
// Restore attachment data after trip through the sim
if (objectGroup.RootPart.AttachPoint > 0)
inventoryStoredPosition = objectGroup.RootPart.AttachOffset;
objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
objectGroup.AbsolutePosition = inventoryStoredPosition;
// Make sure all bits but the ones we want are clear
// on take.
// This will be applied to the current perms, so
// it will do what we want.
objectGroup.RootPart.NextOwnerMask &=
((uint)PermissionMask.Copy |
(uint)PermissionMask.Transfer |
(uint)PermissionMask.Modify);
objectGroup.RootPart.NextOwnerMask |=
(uint)PermissionMask.Move;
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
objectGroup.AbsolutePosition = originalPosition;
xmlStrings[objectGroup.UUID] = sceneObjectXml;
} }
string itemXml; float sizeX = maxX - minX;
float sizeY = maxY - minY;
float sizeZ = maxZ - minZ;
if (objlist.Count > 1) root.SetAttribute("x", sizeX.ToString());
{ root.SetAttribute("y", sizeY.ToString());
float minX, minY, minZ; root.SetAttribute("z", sizeZ.ToString());
float maxX, maxY, maxZ;
Vector3[] offsets = Scene.GetCombinedBoundingBox(objlist, itemXml = itemDoc.InnerXml;
out minX, out maxX, out minY, out maxY, }
out minZ, out maxZ); else
{
itemXml = xmlStrings[objlist[0].UUID];
}
// CreateWrapper // Get the user info of the item destination
XmlDocument itemDoc = new XmlDocument(); //
XmlElement root = itemDoc.CreateElement("", "CoalescedObject", ""); UUID userID = UUID.Zero;
itemDoc.AppendChild(root);
// Embed the offsets into the group XML if (action == DeRezAction.Take || action == DeRezAction.TakeCopy ||
for ( int i = 0 ; i < objlist.Count ; i++ ) action == DeRezAction.SaveToExistingUserInventoryItem)
{ {
XmlDocument doc = new XmlDocument(); // Take or take copy require a taker
SceneObjectGroup g = objlist[i]; // Saving changes requires a local user
doc.LoadXml(xmlStrings[g.UUID]);
XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup");
e.SetAttribute("offsetx", offsets[i].X.ToString());
e.SetAttribute("offsety", offsets[i].Y.ToString());
e.SetAttribute("offsetz", offsets[i].Z.ToString());
XmlNode objectNode = itemDoc.ImportNode(e, true);
root.AppendChild(objectNode);
}
float sizeX = maxX - minX;
float sizeY = maxY - minY;
float sizeZ = maxZ - minZ;
root.SetAttribute("x", sizeX.ToString());
root.SetAttribute("y", sizeY.ToString());
root.SetAttribute("z", sizeZ.ToString());
itemXml = itemDoc.InnerXml;
}
else
{
itemXml = xmlStrings[objlist[0].UUID];
}
// Get the user info of the item destination
// //
UUID userID = UUID.Zero; if (remoteClient == null)
return UUID.Zero;
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || userID = remoteClient.AgentId;
action == DeRezAction.SaveToExistingUserInventoryItem) }
{ else
// Take or take copy require a taker {
// Saving changes requires a local user // All returns / deletes go to the object owner
// //
if (remoteClient == null)
return UUID.Zero; userID = objlist[0].RootPart.OwnerID;
}
userID = remoteClient.AgentId;
} if (userID == UUID.Zero) // Can't proceed
else {
{ return UUID.Zero;
// All returns / deletes go to the object owner }
//
// If we're returning someone's item, it goes back to the
userID = objlist[0].RootPart.OwnerID; // owner's Lost And Found folder.
} // Delete is treated like return in this case
// Deleting your own items makes them go to trash
if (userID == UUID.Zero) // Can't proceed //
InventoryFolderBase folder = null;
InventoryItemBase item = null;
if (DeRezAction.SaveToExistingUserInventoryItem == action)
{
item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID);
item = m_Scene.InventoryService.GetItem(item);
//item = userInfo.RootFolder.FindItem(
// objectGroup.RootPart.FromUserInventoryItemID);
if (null == item)
{ {
m_log.DebugFormat(
"[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.",
objlist[0].Name, objlist[0].UUID);
return UUID.Zero; return UUID.Zero;
} }
}
// If we're returning someone's item, it goes back to the else
// owner's Lost And Found folder. {
// Delete is treated like return in this case // Folder magic
// Deleting your own items makes them go to trash
// //
if (action == DeRezAction.Delete)
InventoryFolderBase folder = null;
InventoryItemBase item = null;
if (DeRezAction.SaveToExistingUserInventoryItem == action)
{ {
item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID); // Deleting someone else's item
item = m_Scene.InventoryService.GetItem(item); //
if (remoteClient == null ||
//item = userInfo.RootFolder.FindItem( objlist[0].OwnerID != remoteClient.AgentId)
// objectGroup.RootPart.FromUserInventoryItemID);
if (null == item)
{ {
m_log.DebugFormat(
"[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
objlist[0].Name, objlist[0].UUID); }
return UUID.Zero; else
{
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
} }
} }
else else if (action == DeRezAction.Return)
{ {
// Folder magic
// Dump to lost + found unconditionally
// //
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
}
if (folderID == UUID.Zero && folder == null)
{
if (action == DeRezAction.Delete) if (action == DeRezAction.Delete)
{ {
// Deleting someone else's item // Deletes go to trash by default
// //
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
}
else
{
if (remoteClient == null || if (remoteClient == null ||
objlist[0].OwnerID != remoteClient.AgentId) objlist[0].OwnerID != remoteClient.AgentId)
{ {
// Taking copy of another person's item. Take to
// Objects folder.
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object);
}
else
{
// Catch all. Use lost & found
//
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
} }
else
{
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
}
}
else if (action == DeRezAction.Return)
{
// Dump to lost + found unconditionally
//
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
}
if (folderID == UUID.Zero && folder == null)
{
if (action == DeRezAction.Delete)
{
// Deletes go to trash by default
//
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
}
else
{
if (remoteClient == null ||
objlist[0].OwnerID != remoteClient.AgentId)
{
// Taking copy of another person's item. Take to
// Objects folder.
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object);
}
else
{
// Catch all. Use lost & found
//
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
}
}
}
// Override and put into where it came from, if it came
// from anywhere in inventory
//
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
{
if (objlist[0].RootPart.FromFolderID != UUID.Zero && objlist[0].OwnerID == remoteClient.AgentId)
{
InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID);
folder = m_Scene.InventoryService.GetFolder(f);
}
}
if (folder == null) // None of the above
{
folder = new InventoryFolderBase(folderID);
if (folder == null) // Nowhere to put it
{
return UUID.Zero;
}
}
item = new InventoryItemBase();
// Can't know creator is the same, so null it in inventory
if (objlist.Count > 1)
{
item.CreatorId = UUID.Zero.ToString();
item.CreatorData = String.Empty;
}
else
{
item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
item.CreatorData = objlist[0].RootPart.CreatorData;
}
item.ID = UUID.Random();
item.InvType = (int)InventoryType.Object;
item.Folder = folder.ID;
item.Owner = userID;
if (objlist.Count > 1)
{
item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems;
}
else
{
item.SaleType = objlist[0].RootPart.ObjectSaleType;
item.SalePrice = objlist[0].RootPart.SalePrice;
} }
} }
AssetBase asset = CreateAsset( // Override and put into where it came from, if it came
objlist[0].GetPartName(objlist[0].RootPart.LocalId), // from anywhere in inventory
objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), //
(sbyte)AssetType.Object, if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
Utils.StringToBytes(itemXml),
objlist[0].OwnerID.ToString());
m_Scene.AssetService.Store(asset);
assetID = asset.FullID;
if (DeRezAction.SaveToExistingUserInventoryItem == action)
{ {
item.AssetID = asset.FullID; if (objlist[0].RootPart.FromFolderID != UUID.Zero && objlist[0].OwnerID == remoteClient.AgentId)
m_Scene.InventoryService.UpdateItem(item); {
InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID);
folder = m_Scene.InventoryService.GetFolder(f);
}
}
if (folder == null) // None of the above
{
folder = new InventoryFolderBase(folderID);
if (folder == null) // Nowhere to put it
{
return UUID.Zero;
}
}
item = new InventoryItemBase();
// Can't know creator is the same, so null it in inventory
if (objlist.Count > 1)
{
item.CreatorId = UUID.Zero.ToString();
item.CreatorData = String.Empty;
} }
else else
{ {
item.AssetID = asset.FullID; item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
item.CreatorData = objlist[0].RootPart.CreatorData;
}
item.ID = UUID.Random();
item.InvType = (int)InventoryType.Object;
item.Folder = folder.ID;
item.Owner = userID;
if (objlist.Count > 1)
{
item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems;
}
else
{
item.SaleType = objlist[0].RootPart.ObjectSaleType;
item.SalePrice = objlist[0].RootPart.SalePrice;
}
}
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; AssetBase asset = CreateAsset(
foreach (SceneObjectGroup grp in objlist) objlist[0].GetPartName(objlist[0].RootPart.LocalId),
effectivePerms &= grp.GetEffectivePermissions(); objlist[0].GetPartDescription(objlist[0].RootPart.LocalId),
effectivePerms |= (uint)PermissionMask.Move; (sbyte)AssetType.Object,
Utils.StringToBytes(itemXml),
objlist[0].OwnerID.ToString());
m_Scene.AssetService.Store(asset);
assetID = asset.FullID;
if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) if (DeRezAction.SaveToExistingUserInventoryItem == action)
{
item.AssetID = asset.FullID;
m_Scene.InventoryService.UpdateItem(item);
}
else
{
item.AssetID = asset.FullID;
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7;
foreach (SceneObjectGroup grp in objlist)
effectivePerms &= grp.GetEffectivePermissions();
effectivePerms |= (uint)PermissionMask.Move;
if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
{
uint perms = effectivePerms;
uint nextPerms = (perms & 7) << 13;
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
perms &= ~(uint)PermissionMask.Copy;
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
perms &= ~(uint)PermissionMask.Transfer;
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
perms &= ~(uint)PermissionMask.Modify;
item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask;
item.CurrentPermissions = item.BasePermissions;
item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask;
item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask;
item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask;
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
}
else
{
item.BasePermissions = effectivePerms;
item.CurrentPermissions = effectivePerms;
item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms;
item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms;
item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms;
item.CurrentPermissions &=
((uint)PermissionMask.Copy |
(uint)PermissionMask.Transfer |
(uint)PermissionMask.Modify |
(uint)PermissionMask.Move |
7); // Preserve folded permissions
}
item.CreationDate = Util.UnixTimeSinceEpoch();
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
m_Scene.AddInventoryItem(item);
if (remoteClient != null && item.Owner == remoteClient.AgentId)
{
remoteClient.SendInventoryItemCreateUpdate(item, 0);
}
else
{
ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner);
if (notifyUser != null)
{ {
uint perms = effectivePerms; notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
uint nextPerms = (perms & 7) << 13;
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
perms &= ~(uint)PermissionMask.Copy;
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
perms &= ~(uint)PermissionMask.Transfer;
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
perms &= ~(uint)PermissionMask.Modify;
item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask;
item.CurrentPermissions = item.BasePermissions;
item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask;
item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask;
item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask;
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
}
else
{
item.BasePermissions = effectivePerms;
item.CurrentPermissions = effectivePerms;
item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms;
item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms;
item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms;
item.CurrentPermissions &=
((uint)PermissionMask.Copy |
(uint)PermissionMask.Transfer |
(uint)PermissionMask.Modify |
(uint)PermissionMask.Move |
7); // Preserve folded permissions
}
item.CreationDate = Util.UnixTimeSinceEpoch();
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
m_Scene.AddInventoryItem(item);
if (remoteClient != null && item.Owner == remoteClient.AgentId)
{
remoteClient.SendInventoryItemCreateUpdate(item, 0);
}
else
{
ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner);
if (notifyUser != null)
{
notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
}
} }
} }
} }

View File

@ -58,6 +58,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// </summary> /// </summary>
public static int MAX_MAJOR_VERSION = 1; public static int MAX_MAJOR_VERSION = 1;
/// <summary>
/// Has the control file been loaded for this archive?
/// </summary>
public bool ControlFileLoaded { get; private set; }
protected Scene m_scene; protected Scene m_scene;
protected Stream m_loadStream; protected Stream m_loadStream;
protected Guid m_requestId; protected Guid m_requestId;
@ -545,7 +550,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// </summary> /// </summary>
/// <param name="path"></param> /// <param name="path"></param>
/// <param name="data"></param> /// <param name="data"></param>
protected void LoadControlFile(string path, byte[] data) public void LoadControlFile(string path, byte[] data)
{ {
XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
@ -591,6 +596,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
} }
currentRegionSettings.Save(); currentRegionSettings.Save();
ControlFileLoaded = true;
} }
} }
} }

View File

@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <returns></returns> /// <returns></returns>
public static string CreateControlFile(Dictionary<string, object> options) public static string CreateControlFile(Dictionary<string, object> options)
{ {
int majorVersion = MAX_MAJOR_VERSION, minorVersion = 5; int majorVersion = MAX_MAJOR_VERSION, minorVersion = 6;
// //
// if (options.ContainsKey("version")) // if (options.ContainsKey("version"))
// { // {

View File

@ -171,7 +171,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
MemoryStream archiveReadStream = new MemoryStream(archive); MemoryStream archiveReadStream = new MemoryStream(archive);
TarArchiveReader tar = new TarArchiveReader(archiveReadStream); TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
bool gotControlFile = false;
bool gotNcAssetFile = false; bool gotNcAssetFile = false;
string expectedNcAssetFileName = string.Format("{0}_{1}", ncAssetUuid, "notecard.txt"); string expectedNcAssetFileName = string.Format("{0}_{1}", ncAssetUuid, "notecard.txt");
@ -184,13 +183,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
string filePath; string filePath;
TarArchiveReader.TarEntryType tarEntryType; TarArchiveReader.TarEntryType tarEntryType;
byte[] data = tar.ReadEntry(out filePath, out tarEntryType);
Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, false, false, Guid.Empty);
arr.LoadControlFile(filePath, data);
Assert.That(arr.ControlFileLoaded, Is.True);
while (tar.ReadEntry(out filePath, out tarEntryType) != null) while (tar.ReadEntry(out filePath, out tarEntryType) != null)
{ {
if (ArchiveConstants.CONTROL_FILE_PATH == filePath) if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
{
gotControlFile = true;
}
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
{ {
string fileName = filePath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); string fileName = filePath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
@ -203,7 +206,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
} }
} }
Assert.That(gotControlFile, Is.True, "No control file in archive");
Assert.That(gotNcAssetFile, Is.True, "No notecard asset file in archive"); Assert.That(gotNcAssetFile, Is.True, "No notecard asset file in archive");
Assert.That(foundPaths, Is.EquivalentTo(expectedPaths)); Assert.That(foundPaths, Is.EquivalentTo(expectedPaths));

View File

@ -38,7 +38,23 @@ namespace OpenSim.Region.Framework.Interfaces
public interface IInventoryAccessModule public interface IInventoryAccessModule
{ {
UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data); UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data);
UUID DeleteToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient);
/// <summary>
/// Copy objects to a user's inventory.
/// </summary>
/// <remarks>
/// Is it left to the caller to delete them from the scene if required.
/// </remarks>
/// <param name="action"></param>
/// <param name="folderID"></param>
/// <param name="objectGroups"></param>
/// <param name="remoteClient"></param>
/// <returns>
/// Returns the UUID of the newly created item asset (not the item itself).
/// FIXME: This is not very useful. It would be far more useful to return a list of items instead.
/// </returns>
UUID CopyToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient);
SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart,
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment);

View File

@ -150,7 +150,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null) if (invAccess != null)
invAccess.DeleteToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient); invAccess.CopyToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient);
if (x.permissionToDelete) if (x.permissionToDelete)
{ {
foreach (SceneObjectGroup g in x.objectGroups) foreach (SceneObjectGroup g in x.objectGroups)

View File

@ -118,7 +118,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
if (serviceDll == String.Empty) if (serviceDll == String.Empty)
{ {
m_log.Error("[FreeSwitchVoice]: No LocalServiceModule named in section FreeSwitchVoice"); m_log.Error("[FreeSwitchVoice]: No LocalServiceModule named in section FreeSwitchVoice. Not starting.");
return; return;
} }
@ -143,8 +143,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
if (String.IsNullOrEmpty(m_freeSwitchRealm) || if (String.IsNullOrEmpty(m_freeSwitchRealm) ||
String.IsNullOrEmpty(m_freeSwitchAPIPrefix)) String.IsNullOrEmpty(m_freeSwitchAPIPrefix))
{ {
m_log.Error("[FreeSwitchVoice] plugin mis-configured"); m_log.Error("[FreeSwitchVoice]: Freeswitch service mis-configured. Not starting.");
m_log.Info("[FreeSwitchVoice] plugin disabled: incomplete configuration");
return; return;
} }
@ -164,24 +163,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler); // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
// MainServer.Instance.AddStreamHandler(h); // MainServer.Instance.AddStreamHandler(h);
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix), MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix),
FreeSwitchSLVoiceSigninHTTPHandler); FreeSwitchSLVoiceSigninHTTPHandler);
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix), MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix),
FreeSwitchSLVoiceBuddyHTTPHandler); FreeSwitchSLVoiceBuddyHTTPHandler);
m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm); MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_watcher.php", m_freeSwitchAPIPrefix),
FreeSwitchSLVoiceWatcherHTTPHandler);
m_log.InfoFormat("[FreeSwitchVoice]: using FreeSwitch server {0}", m_freeSwitchRealm);
m_Enabled = true; m_Enabled = true;
m_log.Info("[FreeSwitchVoice] plugin enabled"); m_log.Info("[FreeSwitchVoice]: plugin enabled");
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.Message); m_log.ErrorFormat("[FreeSwitchVoice]: plugin initialization failed: {0} {1}", e.Message, e.StackTrace);
m_log.DebugFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.ToString());
return; return;
} }
@ -240,7 +239,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{ {
if (m_Enabled) if (m_Enabled)
{ {
m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); m_log.Info("[FreeSwitchVoice]: registering IVoiceModule with the scene");
// register the voice interface for this module, so the script engine can call us // register the voice interface for this module, so the script engine can call us
scene.RegisterModuleInterface<IVoiceModule>(this); scene.RegisterModuleInterface<IVoiceModule>(this);
@ -302,7 +301,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
// </summary> // </summary>
public void OnRegisterCaps(Scene scene, UUID agentID, Caps caps) public void OnRegisterCaps(Scene scene, UUID agentID, Caps caps)
{ {
m_log.DebugFormat("[FreeSwitchVoice] OnRegisterCaps: agentID {0} caps {1}", agentID, caps); m_log.DebugFormat(
"[FreeSwitchVoice]: OnRegisterCaps() called with agentID {0} caps {1} in scene {2}",
agentID, caps, scene.RegionInfo.RegionName);
string capsBase = "/CAPS/" + caps.CapsObjectPath; string capsBase = "/CAPS/" + caps.CapsObjectPath;
caps.RegisterHandler("ProvisionVoiceAccountRequest", caps.RegisterHandler("ProvisionVoiceAccountRequest",
@ -344,6 +345,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
public string ProvisionVoiceAccountRequest(Scene scene, string request, string path, string param, public string ProvisionVoiceAccountRequest(Scene scene, string request, string path, string param,
UUID agentID, Caps caps) UUID agentID, Caps caps)
{ {
m_log.DebugFormat(
"[FreeSwitchVoice][PROVISIONVOICE]: ProvisionVoiceAccountRequest() request: {0}, path: {1}, param: {2}", request, path, param);
ScenePresence avatar = scene.GetScenePresence(agentID); ScenePresence avatar = scene.GetScenePresence(agentID);
if (avatar == null) if (avatar == null)
{ {
@ -357,9 +361,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
try try
{ {
//m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
// request, path, param);
//XmlElement resp; //XmlElement resp;
string agentname = "x" + Convert.ToBase64String(agentID.GetBytes()); string agentname = "x" + Convert.ToBase64String(agentID.GetBytes());
string password = "1234";//temp hack//new UUID(Guid.NewGuid()).ToString().Replace('-','Z').Substring(0,16); string password = "1234";//temp hack//new UUID(Guid.NewGuid()).ToString().Replace('-','Z').Substring(0,16);
@ -416,6 +417,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param, public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param,
UUID agentID, Caps caps) UUID agentID, Caps caps)
{ {
// m_log.DebugFormat(
// "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}",
// scene.RegionInfo.RegionName, agentID);
ScenePresence avatar = scene.GetScenePresence(agentID); ScenePresence avatar = scene.GetScenePresence(agentID);
string avatarName = avatar.Name; string avatarName = avatar.Name;
@ -502,6 +507,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
m_log.DebugFormat("[FreeSwitchVoice][CHATSESSION]: avatar \"{0}\": request: {1}, path: {2}, param: {3}", m_log.DebugFormat("[FreeSwitchVoice][CHATSESSION]: avatar \"{0}\": request: {1}, path: {2}, param: {3}",
avatarName, request, path, param); avatarName, request, path, param);
return "<llsd>true</llsd>"; return "<llsd>true</llsd>";
} }
@ -555,7 +561,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
return response; return response;
} }
public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request) public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request)
{ {
// m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler called"); // m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler called");
@ -592,6 +597,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
public Hashtable FreeSwitchSLVoiceBuddyHTTPHandler(Hashtable request) public Hashtable FreeSwitchSLVoiceBuddyHTTPHandler(Hashtable request)
{ {
m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceBuddyHTTPHandler called");
Hashtable response = new Hashtable(); Hashtable response = new Hashtable();
response["int_response_code"] = 200; response["int_response_code"] = 200;
response["str_response_string"] = string.Empty; response["str_response_string"] = string.Empty;
@ -650,15 +657,58 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
<bdy_status>A</bdy_status> <bdy_status>A</bdy_status>
<modified_ts>{3}</modified_ts> <modified_ts>{3}</modified_ts>
<b2g_group_id></b2g_group_id> <b2g_group_id></b2g_group_id>
</level3>", ids[i],i,m_freeSwitchRealm,dt)); </level3>", ids[i], i ,m_freeSwitchRealm, dt));
} }
resp.Append("</buddies><groups></groups></body></level0></response>"); resp.Append("</buddies><groups></groups></body></level0></response>");
response["str_response_string"] = resp.ToString(); response["str_response_string"] = resp.ToString();
// Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline); // Regex normalizeEndLines = new Regex(@"(\r\n|\n)", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
//
// m_log.DebugFormat(
// "[FREESWITCH]: FreeSwitchSLVoiceBuddyHTTPHandler() response {0}",
// normalizeEndLines.Replace((string)response["str_response_string"],""));
return response;
}
public Hashtable FreeSwitchSLVoiceWatcherHTTPHandler(Hashtable request)
{
m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceWatcherHTTPHandler called");
Hashtable response = new Hashtable();
response["int_response_code"] = 200;
response["content-type"] = "text/xml";
Hashtable requestBody = ParseRequestBody((string)request["body"]);
string auth_token = (string)requestBody["auth_token"];
//string[] auth_tokenvals = auth_token.Split(':');
//string username = auth_tokenvals[0];
StringBuilder resp = new StringBuilder();
resp.Append("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?><response xmlns=\"http://www.vivox.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation= \"/xsd/buddy_list.xsd\">");
// FIXME: This is enough of a response to stop viewer 2 complaining about a login failure and get voice to work. If we don't
// give an OK response, then viewer 2 engages in an continuous viv_signin.php, viv_buddy.php, viv_watcher.php loop
// Viewer 1 appeared happy to ignore the lack of reply and still works with this reply.
//
// However, really we need to fill in whatever watcher data should be here (whatever that is).
resp.Append(string.Format(@"<level0>
<status>OK</status>
<cookie_name>lib_session</cookie_name>
<cookie>{0}</cookie>
<auth_token>{0}</auth_token>
<body/></level0></response>", auth_token));
response["str_response_string"] = resp.ToString();
// Regex normalizeEndLines = new Regex(@"(\r\n|\n)", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
//
// m_log.DebugFormat(
// "[FREESWITCH]: FreeSwitchSLVoiceWatcherHTTPHandler() response {0}",
// normalizeEndLines.Replace((string)response["str_response_string"],""));
//m_log.DebugFormat("[FREESWITCH]: {0}", normalizeEndLines.Replace((string)response["str_response_string"],""));
return response; return response;
} }
@ -710,6 +760,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
</response>", userid, pos, avatarName); </response>", userid, pos, avatarName);
response["int_response_code"] = 200; response["int_response_code"] = 200;
// m_log.DebugFormat("[FreeSwitchVoice]: Sending FreeSwitchSLVoiceSigninHTTPHandler response");
return response; return response;
} }
@ -795,16 +848,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
response["keepalive"] = false; response["keepalive"] = false;
response["int_response_code"] = 500; response["int_response_code"] = 500;
Hashtable requestBody = ParseRequestBody((string) request["body"]); Hashtable requestBody = ParseRequestBody((string)request["body"]);
string section = (string) requestBody["section"]; string section = (string) requestBody["section"];
m_log.DebugFormat("[FreeSwitchVoice]: Received request for config section {0}", section);
if (section == "directory") if (section == "directory")
response = m_FreeswitchService.HandleDirectoryRequest(requestBody); response = m_FreeswitchService.HandleDirectoryRequest(requestBody);
else if (section == "dialplan") else if (section == "dialplan")
response = m_FreeswitchService.HandleDialplanRequest(requestBody); response = m_FreeswitchService.HandleDialplanRequest(requestBody);
else else
m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section); m_log.WarnFormat("[FreeSwitchVoice]: Unknown section {0} was requested.", section);
return response; return response;
} }

View File

@ -62,6 +62,8 @@ namespace PrimMesher
bool needsScaling = false; bool needsScaling = false;
bool smallMap = bmW * bmH <= lod * lod;
width = bmW; width = bmW;
height = bmH; height = bmH;
while (width * height > numLodPixels) while (width * height > numLodPixels)
@ -104,9 +106,14 @@ namespace PrimMesher
{ {
for (int x = 0; x <= width; x++) for (int x = 0; x <= width; x++)
{ {
int bmY = y < height ? y * 2 : y * 2 - 1; Color c;
int bmX = x < width ? x * 2 : x * 2 - 1;
Color c = bm.GetPixel(bmX, bmY); if (smallMap)
c = bm.GetPixel(x < width ? x : x - 1,
y < height ? y : y - 1);
else
c = bm.GetPixel(x < width ? x * 2 : x * 2 - 1,
y < height ? y * 2 : y * 2 - 1);
redBytes[byteNdx] = c.R; redBytes[byteNdx] = c.R;
greenBytes[byteNdx] = c.G; greenBytes[byteNdx] = c.G;

View File

@ -50,13 +50,13 @@ namespace OpenSim.Services.FreeswitchService
public Hashtable HandleDialplanRequest(Hashtable request) public Hashtable HandleDialplanRequest(Hashtable request)
{ {
m_log.DebugFormat("[FreeSwitchVoice] HandleDialplanRequest called with {0}",request.ToString()); m_log.DebugFormat("[FreeSwitchVoice]: HandleDialplanRequest called with {0}",request.ToString());
Hashtable response = new Hashtable(); Hashtable response = new Hashtable();
foreach (DictionaryEntry item in request) foreach (DictionaryEntry item in request)
{ {
m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value); m_log.InfoFormat("[FreeSwitchDirectory]: requestBody item {0} {1}",item.Key, item.Value);
} }
string requestcontext = (string) request["Hunt-Context"]; string requestcontext = (string) request["Hunt-Context"];
@ -66,7 +66,7 @@ namespace OpenSim.Services.FreeswitchService
if (m_freeSwitchContext != String.Empty && m_freeSwitchContext != requestcontext) if (m_freeSwitchContext != String.Empty && m_freeSwitchContext != requestcontext)
{ {
m_log.Debug("[FreeSwitchDirectory] returning empty as it's for another context"); m_log.Debug("[FreeSwitchDirectory]: returning empty as it's for another context");
response["str_response_string"] = ""; response["str_response_string"] = "";
} }
else else
@ -116,13 +116,16 @@ namespace OpenSim.Services.FreeswitchService
{ {
Hashtable response = new Hashtable(); Hashtable response = new Hashtable();
string domain = (string) request["domain"]; string domain = (string) request["domain"];
if (domain != m_freeSwitchRealm) { if (domain != m_freeSwitchRealm)
{
response["content_type"] = "text/xml"; response["content_type"] = "text/xml";
response["keepalive"] = false; response["keepalive"] = false;
response["int_response_code"] = 200; response["int_response_code"] = 200;
response["str_response_string"] = ""; response["str_response_string"] = "";
} else { }
m_log.DebugFormat("[FreeSwitchDirectory] HandleDirectoryRequest called with {0}",request.ToString()); else
{
// m_log.DebugFormat("[FreeSwitchDirectory]: HandleDirectoryRequest called with {0}",request.ToString());
// information in the request we might be interested in // information in the request we might be interested in
@ -145,7 +148,7 @@ namespace OpenSim.Services.FreeswitchService
foreach (DictionaryEntry item in request) foreach (DictionaryEntry item in request)
{ {
m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}", item.Key, item.Value); m_log.DebugFormat("[FreeSwitchDirectory]: requestBody item {0} {1}", item.Key, item.Value);
} }
string eventCallingFunction = (string) request["Event-Calling-Function"]; string eventCallingFunction = (string) request["Event-Calling-Function"];
@ -173,7 +176,7 @@ namespace OpenSim.Services.FreeswitchService
} }
else else
{ {
m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod); m_log.ErrorFormat("[FreeSwitchVoice]: HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod);
response["int_response_code"] = 404; response["int_response_code"] = 404;
response["content_type"] = "text/xml"; response["content_type"] = "text/xml";
response["str_response_string"] = ""; response["str_response_string"] = "";
@ -205,7 +208,7 @@ namespace OpenSim.Services.FreeswitchService
} }
else else
{ {
m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown Event-Calling-Function {0}",eventCallingFunction); m_log.ErrorFormat("[FreeSwitchVoice]: HandleDirectoryRequest unknown Event-Calling-Function {0}",eventCallingFunction);
response["int_response_code"] = 404; response["int_response_code"] = 404;
response["keepalive"] = false; response["keepalive"] = false;
response["content_type"] = "text/xml"; response["content_type"] = "text/xml";
@ -217,7 +220,7 @@ namespace OpenSim.Services.FreeswitchService
private Hashtable HandleRegister(string Context, string Realm, Hashtable request) private Hashtable HandleRegister(string Context, string Realm, Hashtable request)
{ {
m_log.Info("[FreeSwitchDirectory] HandleRegister called"); m_log.Info("[FreeSwitchDirectory]: HandleRegister called");
// TODO the password we return needs to match that sent in the request, this is hard coded for now // TODO the password we return needs to match that sent in the request, this is hard coded for now
string password = "1234"; string password = "1234";
@ -254,7 +257,7 @@ namespace OpenSim.Services.FreeswitchService
private Hashtable HandleInvite(string Context, string Realm, Hashtable request) private Hashtable HandleInvite(string Context, string Realm, Hashtable request)
{ {
m_log.Info("[FreeSwitchDirectory] HandleInvite called"); m_log.Info("[FreeSwitchDirectory]: HandleInvite called");
// TODO the password we return needs to match that sent in the request, this is hard coded for now // TODO the password we return needs to match that sent in the request, this is hard coded for now
string password = "1234"; string password = "1234";
@ -301,7 +304,7 @@ namespace OpenSim.Services.FreeswitchService
private Hashtable HandleLocateUser(String Realm, Hashtable request) private Hashtable HandleLocateUser(String Realm, Hashtable request)
{ {
m_log.Info("[FreeSwitchDirectory] HandleLocateUser called"); m_log.Info("[FreeSwitchDirectory]: HandleLocateUser called");
// TODO the password we return needs to match that sent in the request, this is hard coded for now // TODO the password we return needs to match that sent in the request, this is hard coded for now
string domain = (string) request["domain"]; string domain = (string) request["domain"];
@ -335,7 +338,7 @@ namespace OpenSim.Services.FreeswitchService
private Hashtable HandleConfigSofia(string Context, string Realm, Hashtable request) private Hashtable HandleConfigSofia(string Context, string Realm, Hashtable request)
{ {
m_log.Info("[FreeSwitchDirectory] HandleConfigSofia called"); m_log.Info("[FreeSwitchDirectory]: HandleConfigSofia called.");
// TODO the password we return needs to match that sent in the request, this is hard coded for now // TODO the password we return needs to match that sent in the request, this is hard coded for now
string domain = (string) request["domain"]; string domain = (string) request["domain"];

View File

@ -64,7 +64,7 @@ namespace OpenSim.Services.FreeswitchService
m_freeSwitchDefaultWellKnownIP = freeswitchConfig.GetString("ServerAddress", String.Empty); m_freeSwitchDefaultWellKnownIP = freeswitchConfig.GetString("ServerAddress", String.Empty);
if (m_freeSwitchDefaultWellKnownIP == String.Empty) if (m_freeSwitchDefaultWellKnownIP == String.Empty)
{ {
m_log.Error("[FREESWITCH]: No FreeswitchServerAddress given, can't continue"); m_log.Error("[FREESWITCH]: No ServerAddress given, cannot start service.");
return; return;
} }

View File

@ -621,10 +621,11 @@
;; You need to load a local service for a standalone, and a remote service ;; You need to load a local service for a standalone, and a remote service
;; for a grid region. Use one of the lines below, as appropriate ;; for a grid region. Use one of the lines below, as appropriate
;; If you're using Freeswitch on a standalone then you will also need to configure the [FreeswitchService] section
; LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService ; LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService
; LocalServiceModule = OpenSim.Services.Connectors.dll:RemoteFreeswitchConnector ; LocalServiceModule = OpenSim.Services.Connectors.dll:RemoteFreeswitchConnector
;; If using a remote module, specify the server URL ;; If using a remote connector, specify the server URL
; FreeswitchServiceURL = http://my.grid.server:8003/fsapi ; FreeswitchServiceURL = http://my.grid.server:8003/fsapi
@ -632,20 +633,37 @@
;; !!!!!!!!!!!!!!!!!!!!!!!!!!! ;; !!!!!!!!!!!!!!!!!!!!!!!!!!!
;; !!!!!!STANDALONE ONLY!!!!!! ;; !!!!!!STANDALONE ONLY!!!!!!
;; !!!!!!!!!!!!!!!!!!!!!!!!!!! ;; !!!!!!!!!!!!!!!!!!!!!!!!!!!
;; IP of your FS server ;; The IP address of your FreeSWITCH server. The common case is for this to be the same as the server running the OpenSim standalone
;ServerAddress = 85.25.142.92 ;; This has to be set for the FreeSWITCH service to work
;ServerAddress = 127.0.0.1
;; All other options are - well - optional ;; The following configuration parameters are optional
; Realm = "127.0.0.1"
; SIPProxy = "127.0.0.1:5060" ;; By default, this is the same as the ServerAddress
; EchoServer = "127.0.0.1" ; Realm = 127.0.0.1
; EchoPort = 50505
; AttemptSTUN = "false" ;; By default, this is the same as the ServerAddress on port 5060
; SIPProxy = 127.0.0.1:5060
;; Default is 5000ms
; DefaultTimeout = 5000 ; DefaultTimeout = 5000
; Context = "default"
; UserName = "freeswitch"
; Password = "password"
;; The dial plan context. Default is "default"
; Context = default
;; Currently unused
; UserName = freeswitch
;; Currently unused
; Password = password
;; The following parameters are for STUN = Simple Traversal of UDP through NATs
;; See http://wiki.freeswitch.org/wiki/NAT_Traversal
;; stun.freeswitch.org is not guaranteed to be running so use it in
;; production at your own risk
; EchoServer = 127.0.0.1
; EchoPort = 50505
; AttemptSTUN = false
[Groups] [Groups]
;# {Enabled} {} {Enable groups?} {true false} false ;# {Enabled} {} {Enable groups?} {true false} false

View File

@ -155,10 +155,6 @@
; it may cause unexpected physics problems. ; it may cause unexpected physics problems.
;UseMeshiesPhysicsMesh = false ;UseMeshiesPhysicsMesh = false
; enable / disable Collada mesh support
; default is true
; ColladaMesh = true
; Choose one of the physics engines below ; Choose one of the physics engines below
; OpenDynamicsEngine is by some distance the most developed physics engine ; OpenDynamicsEngine is by some distance the most developed physics engine
; basicphysics effectively does not model physics at all, making all objects phantom ; basicphysics effectively does not model physics at all, making all objects phantom
@ -460,6 +456,12 @@
CoalesceMultipleObjectsToInventory = true CoalesceMultipleObjectsToInventory = true
[Mesh]
; enable / disable Collada mesh support
; default is true
ColladaMesh = true
[ODEPhysicsSettings] [ODEPhysicsSettings]
;## ;##
;## World Settings ;## World Settings

View File

@ -85,19 +85,41 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; * This is the configuration for the freeswitch server in grid mode ; * This is the configuration for the freeswitch server in grid mode
[FreeswitchService] [FreeswitchService]
LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService" LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService"
;; IP of your FS server
;; The IP address of your FreeSWITCH server.
; ServerAddress = 127.0.0.1 ; ServerAddress = 127.0.0.1
;; All other options are - well - optional ;; The following configuration parameters are optional
; Realm = "127.0.0.1"
; SIPProxy = "127.0.0.1:5060" ;; By default, this is the same as the ServerAddress
; EchoServer = "127.0.0.1" ; Realm = 127.0.0.1
; EchoPort = 50505
; AttemptSTUN = "false" ;; By default, this is the same as the ServerAddress on port 5060
; SIPProxy = 127.0.0.1:5060
;; Default is 5000ms
; DefaultTimeout = 5000 ; DefaultTimeout = 5000
; Context = "default"
; UserName = "freeswitch" ;; The dial plan context. Default is "default"
; Password = "password" ; Context = default
;; Currently unused
; UserName = freeswitch
;; Currently unused
; Password = password
;; The following parameters are for STUN = Simple Traversal of UDP through NATs
;; See http://wiki.freeswitch.org/wiki/NAT_Traversal
;; stun.freeswitch.org is not guaranteed to be running so use it in
;; production at your own risk
; EchoServer = 127.0.0.1
; EchoPort = 50505
; AttemptSTUN = false
LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService"
;; IP of your FS server
; ServerAddress = 127.0.0.1
; * This is the new style authentication service. Currently, only MySQL ; * This is the new style authentication service. Currently, only MySQL
; * is implemented. ; * is implemented.

View File

@ -69,19 +69,37 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; * This is the configuration for the freeswitch server in grid mode ; * This is the configuration for the freeswitch server in grid mode
[FreeswitchService] [FreeswitchService]
LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService" LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService"
;; IP of your FS server
;; The IP address of your FreeSWITCH server.
; ServerAddress = 127.0.0.1 ; ServerAddress = 127.0.0.1
;; All other options are - well - optional ;; The following configuration parameters are optional
; Realm = "127.0.0.1"
; SIPProxy = "127.0.0.1:5060" ;; By default, this is the same as the ServerAddress
; EchoServer = "127.0.0.1" ; Realm = 127.0.0.1
; EchoPort = 50505
; AttemptSTUN = "false" ;; By default, this is the same as the ServerAddress on port 5060
; SIPProxy = 127.0.0.1:5060
;; Default is 5000ms
; DefaultTimeout = 5000 ; DefaultTimeout = 5000
; Context = "default"
; UserName = "freeswitch" ;; The dial plan context. Default is "default"
; Password = "password" ; Context = default
;; Currently unused
; UserName = freeswitch
;; Currently unused
; Password = password
;; The following parameters are for STUN = Simple Traversal of UDP through NATs
;; See http://wiki.freeswitch.org/wiki/NAT_Traversal
;; stun.freeswitch.org is not guaranteed to be running so use it in
;; production at your own risk
; EchoServer = 127.0.0.1
; EchoPort = 50505
; AttemptSTUN = false
; * This is the new style authentication service. Currently, only MySQL ; * This is the new style authentication service. Currently, only MySQL
; * is implemented. ; * is implemented.

View File

@ -28,10 +28,10 @@
[HGInventoryAccessModule] [HGInventoryAccessModule]
ProfileServerURI = "http://127.0.0.1:9000/profiles" ProfileServerURI = "http://127.0.0.1:9000/profiles"
;; If you want to protect your assets from being copied by foreign visitors
;; uncomment the next line. You may want to do this on sims that have licensed content.
; OutboundPermission = False
;; If you want to protect your assets from being copied by foreign visitors
;; uncomment the next line. You may want to do this on sims that have licensed content.
; OutboundPermission = False
[Modules] [Modules]
;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists.
@ -45,16 +45,9 @@
AssetCaching = "CenomeMemoryAssetCache" AssetCaching = "CenomeMemoryAssetCache"
Include-CenomeCache = "config-include/CenomeCache.ini" Include-CenomeCache = "config-include/CenomeCache.ini"
;; Enable this to use Freeswitch on a standalone
;FreeswitchServiceInConnector = True
;; Authorization is not on by default, as it depends on external php ;; Authorization is not on by default, as it depends on external php
;AuthorizationServices = "LocalAuthorizationServicesConnector" ;AuthorizationServices = "LocalAuthorizationServicesConnector"
[FreeswitchService]
;; Configuration for the freeswitch service goes here
LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService"
[GridService] [GridService]
;; For in-memory region storage (default) ;; For in-memory region storage (default)
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
@ -74,9 +67,8 @@
Region_Welcome_Area = "DefaultRegion, FallbackRegion" Region_Welcome_Area = "DefaultRegion, FallbackRegion"
; === HG ONLY === ; === HG ONLY ===
;; change this to the address of your simulator ;; change this to the address of your simulator
Gatekeeper="http://127.0.0.1:9000" Gatekeeper="http://127.0.0.1:9000"
[LibraryModule] [LibraryModule]
; Set this if you want to change the name of the OpenSim Library ; Set this if you want to change the name of the OpenSim Library