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

0.8.0.3
Justin Clark-Casey (justincc) 2014-05-06 17:22:47 +01:00
commit 95eeb4dde8
19 changed files with 262 additions and 90 deletions

View File

@ -496,12 +496,13 @@ namespace OpenSim.Groups
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);
string message;
InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
giver, notice.noticeData.AttachmentItemID);
giver, notice.noticeData.AttachmentItemID, out message);
if (itemCopy == null)
{
remoteClient.SendAgentAlertMessage("Can't find item to give. Nothing given.", false);
remoteClient.SendAgentAlertMessage(message, false);
return;
}

View File

@ -44,15 +44,17 @@ namespace OpenSim.Groups
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_ServerURI;
private string m_SecretKey;
private object m_Lock = new object();
public GroupsServiceRemoteConnector(string url)
public GroupsServiceRemoteConnector(string url, string secret)
{
m_ServerURI = url;
if (!m_ServerURI.EndsWith("/"))
m_ServerURI += "/";
m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}", m_ServerURI);
m_SecretKey = secret;
m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, secret key {1}", m_ServerURI, m_SecretKey);
}
public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
@ -654,6 +656,8 @@ namespace OpenSim.Groups
private Dictionary<string, object> MakeRequest(string method, Dictionary<string, object> sendData)
{
sendData["METHOD"] = method;
if (m_SecretKey != string.Empty)
sendData["KEY"] = m_SecretKey;
string reply = string.Empty;
lock (m_Lock)

View File

@ -77,7 +77,8 @@ namespace OpenSim.Groups
if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url));
m_GroupsService = new GroupsServiceRemoteConnector(url);
string secret = groupsConfig.GetString("SecretKey", string.Empty);
m_GroupsService = new GroupsServiceRemoteConnector(url, secret);
m_Scenes = new List<Scene>();
}

View File

@ -52,14 +52,24 @@ namespace OpenSim.Groups
public GroupsServiceRobustConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
string key = string.Empty;
if (configName != String.Empty)
m_ConfigName = configName;
m_log.DebugFormat("[Groups.RobustConnector]: Starting with config name {0}", m_ConfigName);
IConfig groupsConfig = config.Configs[m_ConfigName];
if (groupsConfig != null)
{
key = groupsConfig.GetString("SecretKey", string.Empty);
m_log.DebugFormat("[Groups.RobustConnector]: Starting with secret key {0}", key);
}
else
m_log.WarnFormat("[Groups.RobustConnector]: Unable to find {0} section in configuration", m_ConfigName);
m_GroupsService = new GroupsService(config);
server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService));
server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, key));
}
}
@ -68,11 +78,13 @@ namespace OpenSim.Groups
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private GroupsService m_GroupsService;
private string m_SecretKey = String.Empty;
public GroupsServicePostHandler(GroupsService service) :
public GroupsServicePostHandler(GroupsService service, string key) :
base("POST", "/groups")
{
m_GroupsService = service;
m_SecretKey = key;
}
protected override byte[] ProcessRequest(string path, Stream requestData,
@ -96,6 +108,20 @@ namespace OpenSim.Groups
string method = request["METHOD"].ToString();
request.Remove("METHOD");
if (!String.IsNullOrEmpty(m_SecretKey)) // Verification required
{
// Sender didn't send key
if (!request.ContainsKey("KEY") || (request["KEY"] == null))
return FailureResult("This service requires a secret key");
// Sender sent wrong key
if (!m_SecretKey.Equals(request["KEY"]))
return FailureResult("Provided key does not match existing one");
// OK, key matches. Remove it.
request.Remove("KEY");
}
m_log.DebugFormat("[Groups.Handler]: {0}", method);
switch (method)
{
@ -784,6 +810,14 @@ namespace OpenSim.Groups
string xmlString = ServerUtils.BuildXmlResponse(result);
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
}
private byte[] FailureResult(string reason)
{
Dictionary<string, object> result = new Dictionary<string, object>();
NullResult(result, reason);
string xmlString = ServerUtils.BuildXmlResponse(result);
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
}
#endregion
}
}

View File

@ -35,6 +35,10 @@ namespace OpenSim.Framework
/// </summary>
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>
/// The inventory type of the item. This is slightly different from the asset type in some situations.
/// </value>

View File

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

View File

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

View File

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

View File

@ -534,9 +534,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="recipientClient"></param>
/// <param name="senderId">ID of the sender of the item</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)
recipientClient.SendBulkUpdateInventory(itemCopy);
@ -549,9 +549,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="senderId">ID of the sender of the item</param>
/// <param name="itemId"></param>
/// <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>
@ -568,12 +568,15 @@ namespace OpenSim.Region.Framework.Scenes
/// The inventory item copy given, null if the give was unsuccessful
/// </returns>
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");
if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient))
{
message = "Not allowed to transfer this item.";
return null;
}
InventoryItemBase item = new InventoryItemBase(itemId, senderId);
item = InventoryService.GetItem(item);
@ -582,6 +585,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.WarnFormat(
"[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;
}
@ -590,6 +594,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.WarnFormat(
"[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);
message = "Sender did not match item owner.";
return null;
}
@ -600,7 +605,10 @@ namespace OpenSim.Region.Framework.Scenes
if (!Permissions.BypassPermissions())
{
if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
{
message = "Item doesn't have the Transfer permission.";
return null;
}
}
// Insert a copy of the item into the recipient
@ -736,9 +744,14 @@ namespace OpenSim.Region.Framework.Scenes
InventoryFolderBase root = InventoryService.GetRootFolder(recipient);
if (root != null)
{
itemCopy.Folder = root.ID;
}
else
return null; // No destination
{
message = "Can't find a folder to add the item to.";
return null;
}
}
}
@ -763,6 +776,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
message = null;
return itemCopy;
}
@ -780,7 +794,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>
/// The inventory folder copy given, null if the copy was unsuccessful
/// </returns>
public virtual InventoryFolderBase GiveInventoryFolder(
public virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client,
UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId)
{
//// Retrieve the folder from the sender
@ -815,13 +829,18 @@ namespace OpenSim.Region.Framework.Scenes
InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId);
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
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;
@ -1148,11 +1167,19 @@ namespace OpenSim.Region.Framework.Scenes
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
// 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.
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)
{
@ -1164,11 +1191,16 @@ namespace OpenSim.Region.Framework.Scenes
group.RemoveInventoryItem(localID, itemID);
}
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);
@ -1179,12 +1211,13 @@ namespace OpenSim.Region.Framework.Scenes
+ " inventory item from a prim's inventory item "
+ " but the required item does not exist in the prim's inventory",
itemId, part.Name, part.UUID);
message = "Item not found: " + itemId;
return null;
}
if ((destAgent != taskItem.OwnerID) && ((taskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0))
{
message = "Item doesn't have the Transfer permission.";
return null;
}
@ -1230,11 +1263,24 @@ namespace OpenSim.Region.Framework.Scenes
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 ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
{
if (taskItem.Type == 10)
if (taskItem.Type == (int)AssetType.LSLText)
{
part.RemoveScriptEvents(itemId);
EventManager.TriggerRemoveScript(part.LocalId, itemId);
@ -1243,8 +1289,6 @@ namespace OpenSim.Region.Framework.Scenes
part.Inventory.RemoveInventoryItem(itemId);
}
}
return agentItem;
}
/// <summary>
@ -1254,19 +1298,22 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="folderID"></param>
/// <param name="part"></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(
"[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}",
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)
return null;
agentItem.Folder = folderId;
AddInventoryItem(remoteClient, agentItem);
RemoveNonCopyTaskItemFromPrim(part, itemId);
message = null;
return agentItem;
}
@ -1317,7 +1364,11 @@ namespace OpenSim.Region.Framework.Scenes
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>
@ -1331,17 +1382,17 @@ namespace OpenSim.Region.Framework.Scenes
/// </param>
/// <param name="part"></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;
if (TryGetScenePresence(avatarId, out avatar))
{
return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId);
return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId, out message);
}
else
{
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId);
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId, out message);
if (agentItem == null)
return null;
@ -1350,6 +1401,8 @@ namespace OpenSim.Region.Framework.Scenes
AddInventoryItem(agentItem);
RemoveNonCopyTaskItemFromPrim(part, itemId);
return agentItem;
}
}
@ -1455,6 +1508,11 @@ namespace OpenSim.Region.Framework.Scenes
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);
UUID newFolderID = UUID.Random();
@ -1464,26 +1522,28 @@ namespace OpenSim.Region.Framework.Scenes
foreach (UUID itemID in items)
{
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID);
string message;
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID, out message);
if (agentItem != null)
{
agentItem.Folder = newFolderID;
AddInventoryItem(agentItem);
RemoveNonCopyTaskItemFromPrim(host, itemID);
}
else
{
if (remoteClient != null)
remoteClient.SendAgentAlertMessage(message, false);
}
}
ScenePresence avatar = null;
if (TryGetScenePresence(destID, out avatar))
if (remoteClient != null)
{
//profile.SendInventoryDecendents(avatar.ControllingClient,
// profile.RootFolder.ID, true, false);
//profile.SendInventoryDecendents(avatar.ControllingClient,
// newFolderID, false, true);
SendInventoryUpdate(avatar.ControllingClient, rootFolder, true, false);
SendInventoryUpdate(avatar.ControllingClient, newFolder, false, true);
SendInventoryUpdate(remoteClient, rootFolder, true, false);
SendInventoryUpdate(remoteClient, newFolder, false, true);
}
return newFolderID;

View File

@ -136,7 +136,8 @@ namespace OpenSim.Region.Framework.Tests
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
// 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
= 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!");
// 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
= 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));
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
= UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1");
@ -103,7 +105,7 @@ namespace OpenSim.Region.Framework.Tests
Assert.That(retrievedItem1, Is.Not.Null);
// 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
= UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1");
@ -123,7 +125,7 @@ namespace OpenSim.Region.Framework.Tests
InventoryFolderBase folder1
= 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
= UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1");
@ -131,7 +133,7 @@ namespace OpenSim.Region.Framework.Tests
Assert.That(retrievedFolder1, Is.Not.Null);
// 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
= UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1");

View File

@ -560,12 +560,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (m_debugEnabled)
m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
string message;
InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
giver, attachmentUUID);
giver, attachmentUUID, out message);
if (itemCopy == null)
{
remoteClient.SendAgentAlertMessage("Can't find item to give. Nothing given.", false);
remoteClient.SendAgentAlertMessage(message, false);
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.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f);
part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f);
part.Shape.LightIntensity = intensity;
part.Shape.LightRadius = radius;
part.Shape.LightFalloff = falloff;
part.Shape.LightIntensity = Util.Clip((float)intensity, 0.0f, 1.0f);
part.Shape.LightRadius = Util.Clip((float)radius, 0.1f, 20.0f);
part.Shape.LightFalloff = Util.Clip((float)falloff, 0.01f, 2.0f);
}
else
{
@ -4127,10 +4127,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
// 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)
{
llSay(0, message);
return;
}
if (m_TransferModule != null)
{

View File

@ -3397,14 +3397,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (sp == null)
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)
{
m_log.ErrorFormat(
"[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}",
itemName, m_host.Name, attachmentPoint, World.Name);
"[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}: {4}",
itemName, m_host.Name, attachmentPoint, World.Name, message);
((LSL_Api)m_LSL_Api).llSay(0, message);
return;
}

View File

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

View File

@ -243,7 +243,7 @@ namespace OpenSim.Server.Handlers.Simulation
}
Stream inputStream = request;
if ((httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
StreamReader reader = new StreamReader(inputStream, encoding);
@ -454,7 +454,7 @@ namespace OpenSim.Server.Handlers.Simulation
keysvals.Add("querystringkeys", querystringkeys);
Stream inputStream = request;
if ((httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
Encoding encoding = Encoding.UTF8;

View File

@ -156,9 +156,9 @@ namespace OpenSim.Services.HypergridService
if (suitcase == null)
{
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
// In the DB we tag it as type 100, but we use -1 (Unknown) outside
suitcase = CreateFolder(principalID, root.folderID, 100, "My Suitcase");
// Create the My Suitcase folder under the user's root folder.
// 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, InventoryItemBase.SUITCASE_FOLDER_TYPE, InventoryItemBase.SUITCASE_FOLDER_NAME);
if (suitcase == null)
{
m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder");
@ -248,7 +248,10 @@ namespace OpenSim.Services.HypergridService
InventoryCollection coll = null;
if (!IsWithinSuitcaseTree(principalID, folderID))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent: folder {0} is not within Suitcase tree", folderID);
return new InventoryCollection();
}
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
// make sure the given folder exists under the suitcase tree of this user
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 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
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;
}
// OK, it's legit
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);
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;
}
@ -307,9 +316,17 @@ namespace OpenSim.Services.HypergridService
public override bool MoveFolder(InventoryFolderBase folder)
{
if (!IsWithinSuitcaseTree(folder.Owner, folder.ID) ||
!IsWithinSuitcaseTree(folder.Owner, folder.ParentID))
if (!IsWithinSuitcaseTree(folder.Owner, folder.ID))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ID);
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);
}
@ -331,7 +348,10 @@ namespace OpenSim.Services.HypergridService
// 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
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;
}
// OK, it's legit
return base.AddItem(item);
@ -341,7 +361,10 @@ namespace OpenSim.Services.HypergridService
public override bool UpdateItem(InventoryItemBase item)
{
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 base.UpdateItem(item);
}
@ -350,11 +373,28 @@ namespace OpenSim.Services.HypergridService
{
// Principal is b0rked. *sigh*
if (!IsWithinSuitcaseTree(items[0].Owner, items[0].Folder))
return false;
// Check the items' destination folders
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);
}
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))
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase",
it.Name, it.Folder);
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0}/{1} (folder {2}) is not within Suitcase tree or Appearance",
it.Name, it.ID, it.Folder);
return null;
}
@ -396,7 +436,11 @@ namespace OpenSim.Services.HypergridService
if (f != null)
{
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 f;
@ -464,7 +508,7 @@ namespace OpenSim.Services.HypergridService
// Warp! Root folder for travelers
XInventoryFolder[] folders = m_Database.GetFolders(
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)
return folders[0];
@ -472,13 +516,13 @@ namespace OpenSim.Services.HypergridService
// check to see if we have the old Suitcase folder
folders = m_Database.GetFolders(
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)
{
// Move it to under the root folder
XInventoryFolder root = GetRootXFolder(principalID);
folders[0].parentFolderID = root.folderID;
folders[0].type = 100;
folders[0].type = InventoryItemBase.SUITCASE_FOLDER_TYPE;
m_Database.StoreFolder(folders[0]);
return folders[0];
}
@ -488,7 +532,7 @@ namespace OpenSim.Services.HypergridService
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)

View File

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

View File

@ -996,6 +996,10 @@
;; Used for V2 in HG only. If standalone, set this to local; if grided sim, set this to remote
; LocalService = local
;# {SecretKey} {ServicesConnectorModule:Groups Remote Service Connector} {Secret key between sim and remote group service} {} ""
;; Used for V2 in Remote only.
; SecretKey = ""
;# {GroupsServerURI} {Module:GroupsModule (ServicesConnectorModule:Groups Remote Service Connector or (ServicesConnectorModule:Groups HG Service Connector and LocalService:remote))} {Groups Server URI} {}
;; URI for the groups services of this grid
;; e.g. http://yourxmlrpcserver.com/xmlrpc.php for Flotsam XmlRpc