Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

bullet-2.82
Diva Canto 2014-05-07 17:00:12 -07:00
commit f4cba27105
28 changed files with 473 additions and 107 deletions

View File

@ -127,6 +127,7 @@ what it is today.
* maimedleech * maimedleech
* Mana Janus * Mana Janus
* MarcelEdward * MarcelEdward
* Matt Lehmann
* Mic Bowman * Mic Bowman
* Michelle Argus * Michelle Argus
* Michael Cortez (The Flotsam Project, http://osflotsam.org/) * Michael Cortez (The Flotsam Project, http://osflotsam.org/)

View File

@ -496,12 +496,13 @@ namespace OpenSim.Groups
Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out giver, out tmp, out tmp, out tmp, out tmp); Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out giver, out tmp, out tmp, out tmp, out tmp);
m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
string message;
InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
giver, notice.noticeData.AttachmentItemID); giver, notice.noticeData.AttachmentItemID, out message);
if (itemCopy == null) if (itemCopy == null)
{ {
remoteClient.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); remoteClient.SendAgentAlertMessage(message, false);
return; return;
} }

View File

@ -35,6 +35,10 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
public class InventoryItemBase : InventoryNodeBase, ICloneable public class InventoryItemBase : InventoryNodeBase, ICloneable
{ {
public static readonly string SUITCASE_FOLDER_NAME = "My Suitcase";
public static readonly sbyte SUITCASE_FOLDER_TYPE = 100;
public static readonly sbyte SUITCASE_FOLDER_FAKE_TYPE = 8;
/// <value> /// <value>
/// The inventory type of the item. This is slightly different from the asset type in some situations. /// The inventory type of the item. This is slightly different from the asset type in some situations.
/// </value> /// </value>

View File

@ -272,6 +272,7 @@ namespace OpenSim
+ " [--no-objects]" + " [--no-objects]"
+ " [--rotation degrees] [--rotation-center \"<x,y,z>\"]" + " [--rotation degrees] [--rotation-center \"<x,y,z>\"]"
+ " [--displacement \"<x,y,z>\"]" + " [--displacement \"<x,y,z>\"]"
+ " [--default-user \"User Name\"]"
+ " [<OAR path>]", + " [<OAR path>]",
"Load a region's data from an OAR archive.", "Load a region's data from an OAR archive.",
"--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading)." + Environment.NewLine "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading)." + Environment.NewLine
@ -401,6 +402,12 @@ namespace OpenSim
"Delete a region from disk", "Delete a region from disk",
RunCommand); RunCommand);
m_console.Commands.AddCommand("Estates", false, "estate create",
"estate create <owner UUID> <estate name>",
"Creates a new estate with the specified name, owned by the specified user."
+ " Estate name must be unique.",
CreateEstateCommand);
m_console.Commands.AddCommand("Estates", false, "estate set owner", m_console.Commands.AddCommand("Estates", false, "estate set owner",
"estate set owner <estate-id>[ <UUID> | <Firstname> <Lastname> ]", "estate set owner <estate-id>[ <UUID> | <Firstname> <Lastname> ]",
"Sets the owner of the specified estate to the specified UUID or user. ", "Sets the owner of the specified estate to the specified UUID or user. ",
@ -410,6 +417,11 @@ namespace OpenSim
"estate set name <estate-id> <new name>", "estate set name <estate-id> <new name>",
"Sets the name of the specified estate to the specified value. New name must be unique.", "Sets the name of the specified estate to the specified value. New name must be unique.",
SetEstateNameCommand); SetEstateNameCommand);
m_console.Commands.AddCommand("Estates", false, "estate link region",
"estate link region <estate ID> <region ID>",
"Attaches the specified region to the specified estate.",
EstateLinkRegionCommand);
} }
protected override void ShutdownSpecific() protected override void ShutdownSpecific()
@ -1176,6 +1188,58 @@ namespace OpenSim
SceneManager.SaveCurrentSceneToArchive(cmdparams); SceneManager.SaveCurrentSceneToArchive(cmdparams);
} }
protected void CreateEstateCommand(string module, string[] args)
{
string response = null;
UUID userID;
if (args.Length == 2)
{
response = "No user specified.";
}
else if (!UUID.TryParse(args[2], out userID))
{
response = String.Format("{0} is not a valid UUID", args[2]);
}
else if (args.Length == 3)
{
response = "No estate name specified.";
}
else
{
Scene scene = SceneManager.CurrentOrFirstScene;
// TODO: Is there a better choice here?
UUID scopeID = UUID.Zero;
UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, userID);
if (account == null)
{
response = String.Format("Could not find user {0}", userID);
}
else
{
// concatenate it all to "name"
StringBuilder sb = new StringBuilder(args[3]);
for (int i = 4; i < args.Length; i++)
sb.Append (" " + args[i]);
string estateName = sb.ToString().Trim();
// send it off for processing.
IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>();
response = estateModule.CreateEstate(estateName, userID);
if (response == String.Empty)
{
List<int> estates = scene.EstateDataService.GetEstates(estateName);
response = String.Format("Estate {0} created as \"{1}\"", estates.ElementAt(0), estateName);
}
}
}
// give the user some feedback
if (response != null)
MainConsole.Instance.Output(response);
}
protected void SetEstateOwnerCommand(string module, string[] args) protected void SetEstateOwnerCommand(string module, string[] args)
{ {
string response = null; string response = null;
@ -1298,6 +1362,56 @@ namespace OpenSim
MainConsole.Instance.Output(response); MainConsole.Instance.Output(response);
} }
private void EstateLinkRegionCommand(string module, string[] args)
{
int estateId =-1;
UUID regionId = UUID.Zero;
Scene scene = null;
string response = null;
if (args.Length == 3)
{
response = "No estate specified.";
}
else if (!int.TryParse(args [3], out estateId))
{
response = String.Format("\"{0}\" is not a valid ID for an Estate", args [3]);
}
else if (args.Length == 4)
{
response = "No region specified.";
}
else if (!UUID.TryParse(args[4], out regionId))
{
response = String.Format("\"{0}\" is not a valid UUID for a Region", args [4]);
}
else if (!SceneManager.TryGetScene(regionId, out scene))
{
// region may exist, but on a different sim.
response = String.Format("No access to Region \"{0}\"", args [4]);
}
if (response != null)
{
MainConsole.Instance.Output(response);
return;
}
// send it off for processing.
IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>();
response = estateModule.SetRegionEstate(scene.RegionInfo, estateId);
if (response == String.Empty)
{
estateModule.TriggerRegionInfoChange();
estateModule.sendRegionHandshakeToAll();
response = String.Format ("Region {0} is now attached to estate {1}", regionId, estateId);
}
// give the user some feedback
if (response != null)
MainConsole.Instance.Output (response);
}
#endregion #endregion
private static string CombineParams(string[] commandParams, int pos) private static string CombineParams(string[] commandParams, int pos)

View File

@ -865,18 +865,26 @@ namespace OpenSim.Region.ClientStack.Linden
item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID)); item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID));
if (item != null) if (item != null)
{ {
copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID); string message;
if (copyItem != null && client != null) copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID, out message);
if (client != null)
{ {
m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder); if (copyItem != null)
client.SendBulkUpdateInventory(copyItem); {
m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder);
client.SendBulkUpdateInventory(copyItem);
}
else
{
client.SendAgentAlertMessage(message, false);
}
} }
} }
else else
{ {
m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID); m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID);
if (client != null) if (client != null)
client.SendAlertMessage("Failed to retrieve item"); client.SendAgentAlertMessage("Failed to retrieve item", false);
} }
} }
catch (Exception e) catch (Exception e)

View File

@ -129,12 +129,12 @@ namespace OpenSim.Region.ClientStack.Linden
m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
if (cacheItems.Length > 0) if (cacheItems.Length > 0)
{ {
m_log.Debug("[Cacheitems]: " + cacheItems.Length); // m_log.Debug("[Cacheitems]: " + cacheItems.Length);
for (int iter = 0; iter < maxCacheitemsLoop; iter++) // for (int iter = 0; iter < maxCacheitemsLoop; iter++)
{ // {
m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + // m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" +
cacheItems[iter].TextureID); // cacheItems[iter].TextureID);
} // }
ScenePresence p = null; ScenePresence p = null;
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p)) if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p))

View File

@ -1761,6 +1761,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
newBlock.Name = Util.StringToBytes256(folder.Name); newBlock.Name = Util.StringToBytes256(folder.Name);
newBlock.ParentID = folder.ParentID; newBlock.ParentID = folder.ParentID;
newBlock.Type = (sbyte)folder.Type; newBlock.Type = (sbyte)folder.Type;
if (newBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
newBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
return newBlock; return newBlock;
} }
@ -2010,8 +2012,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
folderBlock.FolderID = folder.ID; folderBlock.FolderID = folder.ID;
folderBlock.ParentID = folder.ParentID; folderBlock.ParentID = folder.ParentID;
//folderBlock.Type = -1;
folderBlock.Type = (sbyte)folder.Type; folderBlock.Type = (sbyte)folder.Type;
if (folderBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
folderBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
folderBlock.Name = Util.StringToBytes256(folder.Name); folderBlock.Name = Util.StringToBytes256(folder.Name);
return folderBlock; return folderBlock;

View File

@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
folderID, new UUID(im.toAgentID)); folderID, new UUID(im.toAgentID));
InventoryFolderBase folderCopy InventoryFolderBase folderCopy
= scene.GiveInventoryFolder(receipientID, client.AgentId, folderID, UUID.Zero); = scene.GiveInventoryFolder(client, receipientID, client.AgentId, folderID, UUID.Zero);
if (folderCopy == null) if (folderCopy == null)
{ {
@ -217,13 +217,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
"into agent {1}'s inventory", "into agent {1}'s inventory",
itemID, new UUID(im.toAgentID)); itemID, new UUID(im.toAgentID));
InventoryItemBase itemCopy = scene.GiveInventoryItem( string message;
new UUID(im.toAgentID), InventoryItemBase itemCopy = scene.GiveInventoryItem(new UUID(im.toAgentID), client.AgentId, itemID, out message);
client.AgentId, itemID);
if (itemCopy == null) if (itemCopy == null)
{ {
client.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); client.SendAgentAlertMessage(message, false);
return; return;
} }

View File

@ -160,10 +160,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver
private IAssetService m_assetService = null; private IAssetService m_assetService = null;
private UUID m_defaultUser;
public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string,object>options) public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string,object>options)
{ {
m_rootScene = scene; m_rootScene = scene;
if (options.ContainsKey("default-user"))
{
m_defaultUser = (UUID)options["default-user"];
m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString());
}
else
{
m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner;
}
m_loadPath = loadPath; m_loadPath = loadPath;
try try
{ {
@ -206,6 +218,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_merge = options.ContainsKey("merge"); m_merge = options.ContainsKey("merge");
m_requestId = requestId; m_requestId = requestId;
m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner;
// Zero can never be a valid user id // Zero can never be a valid user id
m_validUserUuids[UUID.Zero] = false; m_validUserUuids[UUID.Zero] = false;
@ -562,16 +576,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (string.IsNullOrEmpty(part.CreatorData)) if (string.IsNullOrEmpty(part.CreatorData))
{ {
if (!ResolveUserUuid(scene, part.CreatorID)) if (!ResolveUserUuid(scene, part.CreatorID))
part.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; part.CreatorID = m_defaultUser;
} }
if (UserManager != null) if (UserManager != null)
UserManager.AddUser(part.CreatorID, part.CreatorData); UserManager.AddUser(part.CreatorID, part.CreatorData);
if (!(ResolveUserUuid(scene, part.OwnerID) || ResolveGroupUuid(part.OwnerID))) if (!(ResolveUserUuid(scene, part.OwnerID) || ResolveGroupUuid(part.OwnerID)))
part.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner; part.OwnerID = m_defaultUser;
if (!(ResolveUserUuid(scene, part.LastOwnerID) || ResolveGroupUuid(part.LastOwnerID))) if (!(ResolveUserUuid(scene, part.LastOwnerID) || ResolveGroupUuid(part.LastOwnerID)))
part.LastOwnerID = scene.RegionInfo.EstateSettings.EstateOwner; part.LastOwnerID = m_defaultUser;
if (!ResolveGroupUuid(part.GroupID)) if (!ResolveGroupUuid(part.GroupID))
part.GroupID = UUID.Zero; part.GroupID = UUID.Zero;
@ -590,13 +604,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
if (!(ResolveUserUuid(scene, kvp.Value.OwnerID) || ResolveGroupUuid(kvp.Value.OwnerID))) if (!(ResolveUserUuid(scene, kvp.Value.OwnerID) || ResolveGroupUuid(kvp.Value.OwnerID)))
{ {
kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner; kvp.Value.OwnerID = m_defaultUser;
} }
if (string.IsNullOrEmpty(kvp.Value.CreatorData)) if (string.IsNullOrEmpty(kvp.Value.CreatorData))
{ {
if (!ResolveUserUuid(scene, kvp.Value.CreatorID)) if (!ResolveUserUuid(scene, kvp.Value.CreatorID))
kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; kvp.Value.CreatorID = m_defaultUser;
} }
if (UserManager != null) if (UserManager != null)

View File

@ -108,6 +108,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
bool forceParcels = false; bool forceParcels = false;
bool noObjects = false; bool noObjects = false;
Vector3 displacement = new Vector3(0f, 0f, 0f); Vector3 displacement = new Vector3(0f, 0f, 0f);
String defaultUser = "";
float rotation = 0f; float rotation = 0f;
Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0);
@ -119,6 +120,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); }); options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); });
options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility
options.Add("no-objects", delegate (string v) { noObjects = (v != null); }); options.Add("no-objects", delegate (string v) { noObjects = (v != null); });
options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; });
options.Add("displacement=", delegate (string v) { options.Add("displacement=", delegate (string v) {
try try
{ {
@ -131,7 +133,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
return; return;
} }
}); });
options.Add("rotation=", delegate (string v) { options.Add("rotation=", delegate(string v)
{
try try
{ {
rotation = v == null ? 0f : float.Parse(v); rotation = v == null ? 0f : float.Parse(v);
@ -181,6 +184,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (forceTerrain) archiveOptions.Add("force-terrain", null); if (forceTerrain) archiveOptions.Add("force-terrain", null);
if (forceParcels) archiveOptions.Add("force-parcels", null); if (forceParcels) archiveOptions.Add("force-parcels", null);
if (noObjects) archiveOptions.Add("no-objects", null); if (noObjects) archiveOptions.Add("no-objects", null);
if (defaultUser != "")
{
UUID defaultUserUUID = UUID.Zero;
try
{
defaultUserUUID = Scene.UserManagementModule.GetUserIdByName(defaultUser);
}
catch
{
m_log.ErrorFormat("[ARCHIVER MODULE] default user must be in format \"First Last\"", defaultUser);
}
if (defaultUserUUID == UUID.Zero)
{
m_log.ErrorFormat("[ARCHIVER MODULE] cannot find specified default user {0}", defaultUser);
return;
}
else
{
archiveOptions.Add("default-user", defaultUserUUID);
}
}
archiveOptions.Add("displacement", displacement); archiveOptions.Add("displacement", displacement);
archiveOptions.Add("rotation", rotation); archiveOptions.Add("rotation", rotation);
archiveOptions.Add("rotation-center", rotationCenter); archiveOptions.Add("rotation-center", rotationCenter);

View File

@ -313,6 +313,69 @@ namespace OpenSim.Region.CoreModules.World.Estate
return response; return response;
} }
public string SetRegionEstate(RegionInfo regionInfo, int estateID)
{
string response;
if (regionInfo.EstateSettings.EstateID == estateID)
{
response = String.Format("\"{0}\" is already part of estate {1}", regionInfo.RegionName, estateID);
}
else
{
// get the current settings from DB
EstateSettings dbSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
if (dbSettings.EstateID == 0)
{
response = String.Format("No estate found with ID {0}", estateID);
}
else if (Scene.EstateDataService.LinkRegion(regionInfo.RegionID, estateID))
{
// make sure there's a log entry to document the change
m_log.InfoFormat("[ESTATE]: Region {0} ({1}) moved to Estate {2} ({3}).", regionInfo.RegionID, regionInfo.RegionName, estateID, dbSettings.EstateName);
// propagate the change
ChangeDelegate change = OnEstateInfoChange;
if (change != null)
change(regionInfo.RegionID);
response = String.Empty;
}
else
{
response = String.Format("Could not move \"{0}\" to estate {1}", regionInfo.RegionName, estateID);
}
}
return response;
}
public string CreateEstate(string estateName, UUID ownerID)
{
string response;
if (string.IsNullOrEmpty(estateName))
{
response = "No estate name specified.";
}
else
{
List<int> estates = Scene.EstateDataService.GetEstates(estateName);
if (estates.Count() > 0)
{
response = String.Format("An estate named \"{0}\" already exists.", estateName);
}
else
{
EstateSettings settings = Scene.EstateDataService.CreateNewEstate();
settings.EstateOwner = ownerID;
settings.EstateName = estateName;
settings.Save();
response = String.Empty;
}
}
return response;
}
#endregion #endregion
#region Packet Data Responders #region Packet Data Responders

View File

@ -26,6 +26,7 @@
*/ */
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
@ -44,6 +45,8 @@ namespace OpenSim.Region.Framework.Interfaces
string SetEstateOwner(int estateID, UserAccount account); string SetEstateOwner(int estateID, UserAccount account);
string SetEstateName(int estateID, string newName); string SetEstateName(int estateID, string newName);
string SetRegionEstate(RegionInfo regionInfo, int estateID);
string CreateEstate(string estateName, UUID ownerID);
/// <summary> /// <summary>
/// Tell all clients about the current state of the region (terrain textures, water height, etc.). /// Tell all clients about the current state of the region (terrain textures, water height, etc.).

View File

@ -541,9 +541,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="recipientClient"></param> /// <param name="recipientClient"></param>
/// <param name="senderId">ID of the sender of the item</param> /// <param name="senderId">ID of the sender of the item</param>
/// <param name="itemId"></param> /// <param name="itemId"></param>
public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId) public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId, out string message)
{ {
InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId); InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId, out message);
if (itemCopy != null) if (itemCopy != null)
recipientClient.SendBulkUpdateInventory(itemCopy); recipientClient.SendBulkUpdateInventory(itemCopy);
@ -556,9 +556,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="senderId">ID of the sender of the item</param> /// <param name="senderId">ID of the sender of the item</param>
/// <param name="itemId"></param> /// <param name="itemId"></param>
/// <returns>The inventory item copy given, null if the give was unsuccessful</returns> /// <returns>The inventory item copy given, null if the give was unsuccessful</returns>
public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId) public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId, out string message)
{ {
return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero); return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero, out message);
} }
/// <summary> /// <summary>
@ -575,12 +575,15 @@ namespace OpenSim.Region.Framework.Scenes
/// The inventory item copy given, null if the give was unsuccessful /// The inventory item copy given, null if the give was unsuccessful
/// </returns> /// </returns>
public virtual InventoryItemBase GiveInventoryItem( public virtual InventoryItemBase GiveInventoryItem(
UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId) UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId, out string message)
{ {
//Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); //Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient)) if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient))
{
message = "Not allowed to transfer this item.";
return null; return null;
}
InventoryItemBase item = new InventoryItemBase(itemId, senderId); InventoryItemBase item = new InventoryItemBase(itemId, senderId);
item = InventoryService.GetItem(item); item = InventoryService.GetItem(item);
@ -589,6 +592,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient); "[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient);
message = string.Format("Item not found: {0}.", itemId);
return null; return null;
} }
@ -597,6 +601,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.WarnFormat( m_log.WarnFormat(
"[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}", "[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}",
item.Name, item.ID, recipient, senderId, item.Owner); item.Name, item.ID, recipient, senderId, item.Owner);
message = "Sender did not match item owner.";
return null; return null;
} }
@ -607,7 +612,10 @@ namespace OpenSim.Region.Framework.Scenes
if (!Permissions.BypassPermissions()) if (!Permissions.BypassPermissions())
{ {
if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
{
message = "Item doesn't have the Transfer permission.";
return null; return null;
}
} }
// Insert a copy of the item into the recipient // Insert a copy of the item into the recipient
@ -743,9 +751,14 @@ namespace OpenSim.Region.Framework.Scenes
InventoryFolderBase root = InventoryService.GetRootFolder(recipient); InventoryFolderBase root = InventoryService.GetRootFolder(recipient);
if (root != null) if (root != null)
{
itemCopy.Folder = root.ID; itemCopy.Folder = root.ID;
}
else else
return null; // No destination {
message = "Can't find a folder to add the item to.";
return null;
}
} }
} }
@ -770,6 +783,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
message = null;
return itemCopy; return itemCopy;
} }
@ -787,7 +801,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns> /// <returns>
/// The inventory folder copy given, null if the copy was unsuccessful /// The inventory folder copy given, null if the copy was unsuccessful
/// </returns> /// </returns>
public virtual InventoryFolderBase GiveInventoryFolder( public virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client,
UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId)
{ {
//// Retrieve the folder from the sender //// Retrieve the folder from the sender
@ -822,13 +836,18 @@ namespace OpenSim.Region.Framework.Scenes
InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId); InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId);
foreach (InventoryFolderBase childFolder in contents.Folders) foreach (InventoryFolderBase childFolder in contents.Folders)
{ {
GiveInventoryFolder(recipientId, senderId, childFolder.ID, newFolder.ID); GiveInventoryFolder(client, recipientId, senderId, childFolder.ID, newFolder.ID);
} }
// Give all the items // Give all the items
foreach (InventoryItemBase item in contents.Items) foreach (InventoryItemBase item in contents.Items)
{ {
GiveInventoryItem(recipientId, senderId, item.ID, newFolder.ID); string message;
if (GiveInventoryItem(recipientId, senderId, item.ID, newFolder.ID, out message) == null)
{
if (client != null)
client.SendAgentAlertMessage(message, false);
}
} }
return newFolder; return newFolder;
@ -1155,11 +1174,19 @@ namespace OpenSim.Region.Framework.Scenes
InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder); InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder);
// Move the item to trash. If this is a copiable item, only // Move the item to trash. If this is a copyable item, only
// a copy will be moved and we will still need to delete // a copy will be moved and we will still need to delete
// the item from the prim. If it was no copy, is will be // the item from the prim. If it was no copy, it will be
// deleted by this method. // deleted by this method.
MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID); string message;
InventoryItemBase item2 = MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID, out message);
if (item2 == null)
{
m_log.WarnFormat("[SCENE INVENTORY]: RemoveTaskInventory of item {0} failed: {1}", itemID, message);
remoteClient.SendAgentAlertMessage(message, false);
return;
}
if (group.GetInventoryItem(localID, itemID) != null) if (group.GetInventoryItem(localID, itemID) != null)
{ {
@ -1171,11 +1198,16 @@ namespace OpenSim.Region.Framework.Scenes
group.RemoveInventoryItem(localID, itemID); group.RemoveInventoryItem(localID, itemID);
} }
part.SendPropertiesToClient(remoteClient); part.SendPropertiesToClient(remoteClient);
} }
} }
private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId)
/// <summary>
/// Creates (in memory only) a user inventory item that will contain a copy of a task inventory item.
/// </summary>
private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId, out string message)
{ {
TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId);
@ -1186,12 +1218,13 @@ namespace OpenSim.Region.Framework.Scenes
+ " inventory item from a prim's inventory item " + " inventory item from a prim's inventory item "
+ " but the required item does not exist in the prim's inventory", + " but the required item does not exist in the prim's inventory",
itemId, part.Name, part.UUID); itemId, part.Name, part.UUID);
message = "Item not found: " + itemId;
return null; return null;
} }
if ((destAgent != taskItem.OwnerID) && ((taskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) if ((destAgent != taskItem.OwnerID) && ((taskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0))
{ {
message = "Item doesn't have the Transfer permission.";
return null; return null;
} }
@ -1237,11 +1270,24 @@ namespace OpenSim.Region.Framework.Scenes
agentItem.GroupPermissions = taskItem.GroupPermissions; agentItem.GroupPermissions = taskItem.GroupPermissions;
} }
message = null;
return agentItem;
}
/// <summary>
/// If the task item is not-copyable then remove it from the prim.
/// </summary>
private void RemoveNonCopyTaskItemFromPrim(SceneObjectPart part, UUID itemId)
{
TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId);
if (taskItem == null)
return;
if (!Permissions.BypassPermissions()) if (!Permissions.BypassPermissions())
{ {
if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
{ {
if (taskItem.Type == 10) if (taskItem.Type == (int)AssetType.LSLText)
{ {
part.RemoveScriptEvents(itemId); part.RemoveScriptEvents(itemId);
EventManager.TriggerRemoveScript(part.LocalId, itemId); EventManager.TriggerRemoveScript(part.LocalId, itemId);
@ -1250,8 +1296,6 @@ namespace OpenSim.Region.Framework.Scenes
part.Inventory.RemoveInventoryItem(itemId); part.Inventory.RemoveInventoryItem(itemId);
} }
} }
return agentItem;
} }
/// <summary> /// <summary>
@ -1261,19 +1305,22 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="folderID"></param> /// <param name="folderID"></param>
/// <param name="part"></param> /// <param name="part"></param>
/// <param name="itemID"></param> /// <param name="itemID"></param>
public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId) public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId, out string message)
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}", "[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}",
itemId, part.Name, folderId, remoteClient.Name); itemId, part.Name, folderId, remoteClient.Name);
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId); InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId, out message);
if (agentItem == null) if (agentItem == null)
return null; return null;
agentItem.Folder = folderId; agentItem.Folder = folderId;
AddInventoryItem(remoteClient, agentItem); AddInventoryItem(remoteClient, agentItem);
RemoveNonCopyTaskItemFromPrim(part, itemId);
message = null;
return agentItem; return agentItem;
} }
@ -1324,7 +1371,11 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
MoveTaskInventoryItem(remoteClient, folderId, part, itemId); string message;
InventoryItemBase item = MoveTaskInventoryItem(remoteClient, folderId, part, itemId, out message);
if (item == null)
remoteClient.SendAgentAlertMessage(message, false);
} }
/// <summary> /// <summary>
@ -1338,17 +1389,17 @@ namespace OpenSim.Region.Framework.Scenes
/// </param> /// </param>
/// <param name="part"></param> /// <param name="part"></param>
/// <param name="itemID"></param> /// <param name="itemID"></param>
public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId) public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId, out string message)
{ {
ScenePresence avatar; ScenePresence avatar;
if (TryGetScenePresence(avatarId, out avatar)) if (TryGetScenePresence(avatarId, out avatar))
{ {
return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId, out message);
} }
else else
{ {
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId); InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId, out message);
if (agentItem == null) if (agentItem == null)
return null; return null;
@ -1357,6 +1408,8 @@ namespace OpenSim.Region.Framework.Scenes
AddInventoryItem(agentItem); AddInventoryItem(agentItem);
RemoveNonCopyTaskItemFromPrim(part, itemId);
return agentItem; return agentItem;
} }
} }
@ -1462,6 +1515,11 @@ namespace OpenSim.Region.Framework.Scenes
public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items)
{ {
ScenePresence avatar;
IClientAPI remoteClient = null;
if (TryGetScenePresence(destID, out avatar))
remoteClient = avatar.ControllingClient;
InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID);
UUID newFolderID = UUID.Random(); UUID newFolderID = UUID.Random();
@ -1471,26 +1529,28 @@ namespace OpenSim.Region.Framework.Scenes
foreach (UUID itemID in items) foreach (UUID itemID in items)
{ {
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID); string message;
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID, out message);
if (agentItem != null) if (agentItem != null)
{ {
agentItem.Folder = newFolderID; agentItem.Folder = newFolderID;
AddInventoryItem(agentItem); AddInventoryItem(agentItem);
RemoveNonCopyTaskItemFromPrim(host, itemID);
}
else
{
if (remoteClient != null)
remoteClient.SendAgentAlertMessage(message, false);
} }
} }
ScenePresence avatar = null; if (remoteClient != null)
if (TryGetScenePresence(destID, out avatar))
{ {
//profile.SendInventoryDecendents(avatar.ControllingClient, SendInventoryUpdate(remoteClient, rootFolder, true, false);
// profile.RootFolder.ID, true, false); SendInventoryUpdate(remoteClient, newFolder, false, true);
//profile.SendInventoryDecendents(avatar.ControllingClient,
// newFolderID, false, true);
SendInventoryUpdate(avatar.ControllingClient, rootFolder, true, false);
SendInventoryUpdate(avatar.ControllingClient, newFolder, false, true);
} }
return newFolderID; return newFolderID;

View File

@ -1421,7 +1421,7 @@ namespace OpenSim.Region.Framework.Scenes
Scene.ForEachScenePresence(sp => Scene.ForEachScenePresence(sp =>
{ {
if (!sp.IsChildAgent && sp.ParentID == LocalId) if (!sp.IsChildAgent && sp.ParentID == part.LocalId)
sp.StandUp(); sp.StandUp();
if (!silent) if (!silent)

View File

@ -136,7 +136,8 @@ namespace OpenSim.Region.Framework.Tests
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
// Perform test // Perform test
scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); string message;
scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID, out message);
InventoryItemBase ncUserItem InventoryItemBase ncUserItem
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem");
@ -165,7 +166,8 @@ namespace OpenSim.Region.Framework.Tests
scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
// Perform test // Perform test
scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); string message;
scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID, out message);
InventoryItemBase ncUserItem InventoryItemBase ncUserItem
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem");

View File

@ -95,7 +95,9 @@ namespace OpenSim.Region.Framework.Tests
UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID);
scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); string message;
scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID, out message);
InventoryItemBase retrievedItem1 InventoryItemBase retrievedItem1
= UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1"); = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1");
@ -103,7 +105,7 @@ namespace OpenSim.Region.Framework.Tests
Assert.That(retrievedItem1, Is.Not.Null); Assert.That(retrievedItem1, Is.Not.Null);
// Try giving back the freshly received item // Try giving back the freshly received item
scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID); scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID, out message);
List<InventoryItemBase> reretrievedItems List<InventoryItemBase> reretrievedItems
= UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1"); = UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1");
@ -123,7 +125,7 @@ namespace OpenSim.Region.Framework.Tests
InventoryFolderBase folder1 InventoryFolderBase folder1
= UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false); = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false);
scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); scene.GiveInventoryFolder(null, user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero);
InventoryFolderBase retrievedFolder1 InventoryFolderBase retrievedFolder1
= UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1"); = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1");
@ -131,7 +133,7 @@ namespace OpenSim.Region.Framework.Tests
Assert.That(retrievedFolder1, Is.Not.Null); Assert.That(retrievedFolder1, Is.Not.Null);
// Try giving back the freshly received folder // Try giving back the freshly received folder
scene.GiveInventoryFolder(user1.PrincipalID, user2.PrincipalID, retrievedFolder1.ID, UUID.Zero); scene.GiveInventoryFolder(null, user1.PrincipalID, user2.PrincipalID, retrievedFolder1.ID, UUID.Zero);
List<InventoryFolderBase> reretrievedFolders List<InventoryFolderBase> reretrievedFolders
= UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1"); = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1");

View File

@ -560,12 +560,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (m_debugEnabled) if (m_debugEnabled)
m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
string message;
InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
giver, attachmentUUID); giver, attachmentUUID, out message);
if (itemCopy == null) if (itemCopy == null)
{ {
remoteClient.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); remoteClient.SendAgentAlertMessage(message, false);
return; return;
} }

View File

@ -1884,9 +1884,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.Shape.LightColorR = Util.Clip((float)color.x, 0.0f, 1.0f); part.Shape.LightColorR = Util.Clip((float)color.x, 0.0f, 1.0f);
part.Shape.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f); part.Shape.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f);
part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f); part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f);
part.Shape.LightIntensity = intensity; part.Shape.LightIntensity = Util.Clip((float)intensity, 0.0f, 1.0f);
part.Shape.LightRadius = radius; part.Shape.LightRadius = Util.Clip((float)radius, 0.1f, 20.0f);
part.Shape.LightFalloff = falloff; part.Shape.LightFalloff = Util.Clip((float)falloff, 0.01f, 2.0f);
} }
else else
{ {
@ -3162,6 +3162,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
public LSL_Float llGetMassMKS()
{
// this is what the wiki says it does!
// http://wiki.secondlife.com/wiki/LlGetMassMKS
return llGetMass() * 100.0;
}
public void llCollisionFilter(string name, string id, int accept) public void llCollisionFilter(string name, string id, int accept)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -4127,10 +4134,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
// destination is an avatar // destination is an avatar
InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId); string message;
InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId, out message);
if (agentItem == null) if (agentItem == null)
{
llSay(0, message);
return; return;
}
if (m_TransferModule != null) if (m_TransferModule != null)
{ {
@ -6144,10 +6155,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (UUID.TryParse(id, out key)) if (UUID.TryParse(id, out key))
{ {
ScenePresence av = World.GetScenePresence(key); ScenePresence av = World.GetScenePresence(key);
List<ScenePresence> sittingAvatars = m_host.ParentGroup.GetSittingAvatars();
if (av != null) if (av != null)
{ {
if (llAvatarOnSitTarget() == id) if (sittingAvatars.Contains(av))
{ {
// if the avatar is sitting on this object, then // if the avatar is sitting on this object, then
// we can unsit them. We don't want random scripts unsitting random people // we can unsit them. We don't want random scripts unsitting random people

View File

@ -3397,14 +3397,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (sp == null) if (sp == null)
return; return;
InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID); string message;
InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID, out message);
if (newItem == null) if (newItem == null)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}", "[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}: {4}",
itemName, m_host.Name, attachmentPoint, World.Name); itemName, m_host.Name, attachmentPoint, World.Name, message);
((LSL_Api)m_LSL_Api).llSay(0, message);
return; return;
} }

View File

@ -149,6 +149,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Vector llGetLocalPos(); LSL_Vector llGetLocalPos();
LSL_Rotation llGetLocalRot(); LSL_Rotation llGetLocalRot();
LSL_Float llGetMass(); LSL_Float llGetMass();
LSL_Float llGetMassMKS();
LSL_Integer llGetMemoryLimit(); LSL_Integer llGetMemoryLimit();
void llGetNextEmail(string address, string subject); void llGetNextEmail(string address, string subject);
LSL_String llGetNotecardLine(string name, int line); LSL_String llGetNotecardLine(string name, int line);

View File

@ -584,6 +584,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetMass(); return m_LSL_Functions.llGetMass();
} }
public LSL_Float llGetMassMKS()
{
return m_LSL_Functions.llGetMassMKS();
}
public LSL_Integer llGetMemoryLimit() public LSL_Integer llGetMemoryLimit()
{ {
return m_LSL_Functions.llGetMemoryLimit(); return m_LSL_Functions.llGetMemoryLimit();

View File

@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Asset
{ {
asset = (AssetBase)xs.Deserialize(request); asset = (AssetBase)xs.Deserialize(request);
} }
catch (XmlException) catch (Exception)
{ {
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
return null; return null;

View File

@ -156,9 +156,9 @@ namespace OpenSim.Services.HypergridService
if (suitcase == null) if (suitcase == null)
{ {
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder. Creating it...", principalID); m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder. Creating it...", principalID);
// make one, and let's add it to the user's inventory as a direct child of the root folder // Create the My Suitcase folder under the user's root folder.
// In the DB we tag it as type 100, but we use -1 (Unknown) outside // In the DB we tag it as type 100, but we use type 8 (Folder) outside, as this affects the sort order.
suitcase = CreateFolder(principalID, root.folderID, 100, "My Suitcase"); suitcase = CreateFolder(principalID, root.folderID, InventoryItemBase.SUITCASE_FOLDER_TYPE, InventoryItemBase.SUITCASE_FOLDER_NAME);
if (suitcase == null) if (suitcase == null)
{ {
m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder"); m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder");
@ -248,7 +248,10 @@ namespace OpenSim.Services.HypergridService
InventoryCollection coll = null; InventoryCollection coll = null;
if (!IsWithinSuitcaseTree(principalID, folderID)) if (!IsWithinSuitcaseTree(principalID, folderID))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent: folder {0} is not within Suitcase tree", folderID);
return new InventoryCollection(); return new InventoryCollection();
}
coll = base.GetFolderContent(principalID, folderID); coll = base.GetFolderContent(principalID, folderID);
@ -265,7 +268,10 @@ namespace OpenSim.Services.HypergridService
// Let's do a bit of sanity checking, more than the base service does // Let's do a bit of sanity checking, more than the base service does
// make sure the given folder exists under the suitcase tree of this user // make sure the given folder exists under the suitcase tree of this user
if (!IsWithinSuitcaseTree(principalID, folderID)) if (!IsWithinSuitcaseTree(principalID, folderID))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderItems: folder {0} is not within Suitcase tree", folderID);
return new List<InventoryItemBase>(); return new List<InventoryItemBase>();
}
return base.GetFolderItems(principalID, folderID); return base.GetFolderItems(principalID, folderID);
} }
@ -277,7 +283,10 @@ namespace OpenSim.Services.HypergridService
// make sure the given folder's parent folder exists under the suitcase tree of this user // make sure the given folder's parent folder exists under the suitcase tree of this user
if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder: folder {0} is not within Suitcase tree", folder.ParentID);
return false; return false;
}
// OK, it's legit // OK, it's legit
if (base.AddFolder(folder)) if (base.AddFolder(folder))
@ -297,7 +306,7 @@ namespace OpenSim.Services.HypergridService
//m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version);
if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) if (!IsWithinSuitcaseTree(folder.Owner, folder.ID))
{ {
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateFolder: folder {0}/{1} is not within Suitcase tree", folder.Name, folder.ID);
return false; return false;
} }
@ -307,9 +316,17 @@ namespace OpenSim.Services.HypergridService
public override bool MoveFolder(InventoryFolderBase folder) public override bool MoveFolder(InventoryFolderBase folder)
{ {
if (!IsWithinSuitcaseTree(folder.Owner, folder.ID) || if (!IsWithinSuitcaseTree(folder.Owner, folder.ID))
!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) {
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ID);
return false; return false;
}
if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ParentID);
return false;
}
return base.MoveFolder(folder); return base.MoveFolder(folder);
} }
@ -331,7 +348,10 @@ namespace OpenSim.Services.HypergridService
// Let's do a bit of sanity checking, more than the base service does // Let's do a bit of sanity checking, more than the base service does
// make sure the given folder's parent folder exists under the suitcase tree of this user // make sure the given folder's parent folder exists under the suitcase tree of this user
if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) if (!IsWithinSuitcaseTree(item.Owner, item.Folder))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddItem: folder {0} is not within Suitcase tree", item.Folder);
return false; return false;
}
// OK, it's legit // OK, it's legit
return base.AddItem(item); return base.AddItem(item);
@ -341,7 +361,10 @@ namespace OpenSim.Services.HypergridService
public override bool UpdateItem(InventoryItemBase item) public override bool UpdateItem(InventoryItemBase item)
{ {
if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) if (!IsWithinSuitcaseTree(item.Owner, item.Folder))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateItem: folder {0} is not within Suitcase tree", item.Folder);
return false; return false;
}
return base.UpdateItem(item); return base.UpdateItem(item);
} }
@ -350,11 +373,28 @@ namespace OpenSim.Services.HypergridService
{ {
// Principal is b0rked. *sigh* // Principal is b0rked. *sigh*
if (!IsWithinSuitcaseTree(items[0].Owner, items[0].Folder)) // Check the items' destination folders
return false; foreach (InventoryItemBase item in items)
{
if (!IsWithinSuitcaseTree(item.Owner, item.Folder))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", item.Folder);
return false;
}
}
// Check the items' current folders
foreach (InventoryItemBase item in items)
{
InventoryItemBase originalItem = base.GetItem(item);
if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", originalItem.Folder);
return false;
}
}
return base.MoveItems(principalID, items); return base.MoveItems(principalID, items);
} }
public override bool DeleteItems(UUID principalID, List<UUID> itemIDs) public override bool DeleteItems(UUID principalID, List<UUID> itemIDs)
@ -374,8 +414,8 @@ namespace OpenSim.Services.HypergridService
if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID))
{ {
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0}/{1} (folder {2}) is not within Suitcase tree or Appearance",
it.Name, it.Folder); it.Name, it.ID, it.Folder);
return null; return null;
} }
@ -396,7 +436,11 @@ namespace OpenSim.Services.HypergridService
if (f != null) if (f != null)
{ {
if (!IsWithinSuitcaseTree(f.Owner, f.ID)) if (!IsWithinSuitcaseTree(f.Owner, f.ID))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Folder {0}/{1} is not within Suitcase tree",
f.Name, f.ID);
return null; return null;
}
} }
return f; return f;
@ -464,7 +508,7 @@ namespace OpenSim.Services.HypergridService
// Warp! Root folder for travelers // Warp! Root folder for travelers
XInventoryFolder[] folders = m_Database.GetFolders( XInventoryFolder[] folders = m_Database.GetFolders(
new string[] { "agentID", "type" }, new string[] { "agentID", "type" },
new string[] { principalID.ToString(), "100" }); // This is a special folder type... new string[] { principalID.ToString(), InventoryItemBase.SUITCASE_FOLDER_TYPE.ToString() }); // This is a special folder type...
if (folders != null && folders.Length > 0) if (folders != null && folders.Length > 0)
return folders[0]; return folders[0];
@ -472,13 +516,13 @@ namespace OpenSim.Services.HypergridService
// check to see if we have the old Suitcase folder // check to see if we have the old Suitcase folder
folders = m_Database.GetFolders( folders = m_Database.GetFolders(
new string[] { "agentID", "folderName", "parentFolderID" }, new string[] { "agentID", "folderName", "parentFolderID" },
new string[] { principalID.ToString(), "My Suitcase", UUID.Zero.ToString() }); new string[] { principalID.ToString(), InventoryItemBase.SUITCASE_FOLDER_NAME, UUID.Zero.ToString() });
if (folders != null && folders.Length > 0) if (folders != null && folders.Length > 0)
{ {
// Move it to under the root folder // Move it to under the root folder
XInventoryFolder root = GetRootXFolder(principalID); XInventoryFolder root = GetRootXFolder(principalID);
folders[0].parentFolderID = root.folderID; folders[0].parentFolderID = root.folderID;
folders[0].type = 100; folders[0].type = InventoryItemBase.SUITCASE_FOLDER_TYPE;
m_Database.StoreFolder(folders[0]); m_Database.StoreFolder(folders[0]);
return folders[0]; return folders[0];
} }
@ -488,7 +532,7 @@ namespace OpenSim.Services.HypergridService
private void SetAsNormalFolder(XInventoryFolder suitcase) private void SetAsNormalFolder(XInventoryFolder suitcase)
{ {
suitcase.type = (short)AssetType.Folder; suitcase.type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
} }
private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder) private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder)

View File

@ -631,8 +631,8 @@ namespace OpenSim.Services.InventoryService
newFolder.ParentID = folder.parentFolderID; newFolder.ParentID = folder.parentFolderID;
newFolder.Type = (short)folder.type; newFolder.Type = (short)folder.type;
// Viewer can't understand anything that's not in it's LLFolderType enum // Viewer can't understand anything that's not in it's LLFolderType enum
if (newFolder.Type == 100) if (newFolder.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
newFolder.Type = -1; newFolder.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
newFolder.Version = (ushort)folder.version; newFolder.Version = (ushort)folder.version;
newFolder.Name = folder.folderName; newFolder.Name = folder.folderName;
newFolder.Owner = folder.agentID; newFolder.Owner = folder.agentID;

View File

@ -204,11 +204,12 @@
; meshing = ZeroMesher ; meshing = ZeroMesher
;; Choose one of the physics engines below ;; Choose one of the physics engines below
;# {physics} {} {Select physics engine} {OpenDynamicsEngine BulletSim basicphysics POS} OpenDynamicsEngine ;# {physics} {} {Select physics engine} {OpenDynamicsEngine BulletSim basicphysics POS} BulletSim
;; OpenDynamicsEngine is by some distance the most developed physics engine ;; BulletSim is the default physics engine. It provides the best performance and most functionality.
;; BulletSim is experimental and in active development. ;; BulletSim supports varregions.
;; basicphysics effectively does not model physics at all, making all ;; OpenDynamicsEngine was the previous default physics engine in OpenSimulator 0.7.6.1 and before.
;; objects phantom. ;; It continues to provide a workable physics implementation. It does not currently support varregions.
;; basicphysics effectively does not model physics at all, making all objects phantom.
;; Default is OpenDynamicsEngine ;; Default is OpenDynamicsEngine
; physics = OpenDynamicsEngine ; physics = OpenDynamicsEngine
; physics = BulletSim ; physics = BulletSim

View File

@ -234,9 +234,12 @@
; to false if you have compatibility problems. ; to false if you have compatibility problems.
;CacheSculptMaps = true ;CacheSculptMaps = true
; Choose one of the physics engines below. ;; BulletSim is the default physics engine. It provides the best performance and most functionality.
; BulletSim is a high performance physics engine. It is the default OpenSimulator physics engine ;; BulletSim supports varregions.
; OpenDynamicsEngine is another developed physics engine that was the previous default in OpenSimulator 0.7.6 and before ;; OpenDynamicsEngine was the previous default physics engine in OpenSimulator 0.7.6.1 and before.
;; It continues to provide a workable physics implementation. It does not currently support varregions.
;; basicphysics effectively does not model physics at all, making all objects phantom.
;; Default is OpenDynamicsEngine
physics = BulletSim physics = BulletSim
;physics = modified_BulletX ;physics = modified_BulletX
;physics = OpenDynamicsEngine ;physics = OpenDynamicsEngine

View File

@ -163,8 +163,6 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
[GridService] [GridService]
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
HypergridLinker = true
; Realm = "regions" ; Realm = "regions"
; AllowDuplicateNames = "True" ; AllowDuplicateNames = "True"
@ -284,6 +282,7 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
GridService = "OpenSim.Services.GridService.dll:GridService" GridService = "OpenSim.Services.GridService.dll:GridService"
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService" InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService" AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
;; This switch creates the minimum set of body parts and avatar entries for a viewer 2 ;; This switch creates the minimum set of body parts and avatar entries for a viewer 2
;; to show a default "Ruth" avatar rather than a cloud for a newly created user. ;; to show a default "Ruth" avatar rather than a cloud for a newly created user.

View File

@ -240,6 +240,7 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto
GridService = "OpenSim.Services.GridService.dll:GridService" GridService = "OpenSim.Services.GridService.dll:GridService"
InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService" InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService"
AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService" AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService"
;; This switch creates the minimum set of body parts and avatar entries for a viewer 2 ;; This switch creates the minimum set of body parts and avatar entries for a viewer 2
;; to show a default "Ruth" avatar rather than a cloud for a newly created user. ;; to show a default "Ruth" avatar rather than a cloud for a newly created user.