aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-05-06 17:22:47 +0100
committerJustin Clark-Casey (justincc)2014-05-06 17:22:47 +0100
commit95eeb4dde840a8b0d325dd0423dc7099aaed7dfa (patch)
tree139e7fd30e49d13cdb5c53ebcf82eb5cc22cc8e9
parentminor: Comment out Cacheitems debug log lines for now (diff)
parentBetter error handling in AssetServerPostHandler. Invalid XML causes an Invali... (diff)
downloadopensim-SC_OLD-95eeb4dde840a8b0d325dd0423dc7099aaed7dfa.zip
opensim-SC_OLD-95eeb4dde840a8b0d325dd0423dc7099aaed7dfa.tar.gz
opensim-SC_OLD-95eeb4dde840a8b0d325dd0423dc7099aaed7dfa.tar.bz2
opensim-SC_OLD-95eeb4dde840a8b0d325dd0423dc7099aaed7dfa.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Addons/Groups/GroupsModule.cs5
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs8
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs3
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs38
-rw-r--r--OpenSim/Framework/InventoryItemBase.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs18
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs5
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs130
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs10
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs9
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs4
-rw-r--r--OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs74
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs4
-rw-r--r--bin/OpenSim.ini.example4
19 files changed, 262 insertions, 90 deletions
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs
index f11606a..2831326 100644
--- a/OpenSim/Addons/Groups/GroupsModule.cs
+++ b/OpenSim/Addons/Groups/GroupsModule.cs
@@ -496,12 +496,13 @@ namespace OpenSim.Groups
496 Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out giver, out tmp, out tmp, out tmp, out tmp); 496 Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out giver, out tmp, out tmp, out tmp, out tmp);
497 497
498 m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); 498 m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
499 string message;
499 InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, 500 InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
500 giver, notice.noticeData.AttachmentItemID); 501 giver, notice.noticeData.AttachmentItemID, out message);
501 502
502 if (itemCopy == null) 503 if (itemCopy == null)
503 { 504 {
504 remoteClient.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); 505 remoteClient.SendAgentAlertMessage(message, false);
505 return; 506 return;
506 } 507 }
507 508
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
index 67402a2..1425a23 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
@@ -44,15 +44,17 @@ namespace OpenSim.Groups
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 private string m_ServerURI; 46 private string m_ServerURI;
47 private string m_SecretKey;
47 private object m_Lock = new object(); 48 private object m_Lock = new object();
48 49
49 public GroupsServiceRemoteConnector(string url) 50 public GroupsServiceRemoteConnector(string url, string secret)
50 { 51 {
51 m_ServerURI = url; 52 m_ServerURI = url;
52 if (!m_ServerURI.EndsWith("/")) 53 if (!m_ServerURI.EndsWith("/"))
53 m_ServerURI += "/"; 54 m_ServerURI += "/";
54 55
55 m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}", m_ServerURI); 56 m_SecretKey = secret;
57 m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, secret key {1}", m_ServerURI, m_SecretKey);
56 } 58 }
57 59
58 public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, 60 public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
@@ -654,6 +656,8 @@ namespace OpenSim.Groups
654 private Dictionary<string, object> MakeRequest(string method, Dictionary<string, object> sendData) 656 private Dictionary<string, object> MakeRequest(string method, Dictionary<string, object> sendData)
655 { 657 {
656 sendData["METHOD"] = method; 658 sendData["METHOD"] = method;
659 if (m_SecretKey != string.Empty)
660 sendData["KEY"] = m_SecretKey;
657 661
658 string reply = string.Empty; 662 string reply = string.Empty;
659 lock (m_Lock) 663 lock (m_Lock)
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
index d3de0e8..5fb3c19 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs
@@ -77,7 +77,8 @@ namespace OpenSim.Groups
77 if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) 77 if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
78 throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url)); 78 throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url));
79 79
80 m_GroupsService = new GroupsServiceRemoteConnector(url); 80 string secret = groupsConfig.GetString("SecretKey", string.Empty);
81 m_GroupsService = new GroupsServiceRemoteConnector(url, secret);
81 m_Scenes = new List<Scene>(); 82 m_Scenes = new List<Scene>();
82 83
83 } 84 }
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
index 616afa9..828965f 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs
@@ -52,14 +52,24 @@ namespace OpenSim.Groups
52 public GroupsServiceRobustConnector(IConfigSource config, IHttpServer server, string configName) : 52 public GroupsServiceRobustConnector(IConfigSource config, IHttpServer server, string configName) :
53 base(config, server, configName) 53 base(config, server, configName)
54 { 54 {
55 string key = string.Empty;
55 if (configName != String.Empty) 56 if (configName != String.Empty)
56 m_ConfigName = configName; 57 m_ConfigName = configName;
57 58
58 m_log.DebugFormat("[Groups.RobustConnector]: Starting with config name {0}", m_ConfigName); 59 m_log.DebugFormat("[Groups.RobustConnector]: Starting with config name {0}", m_ConfigName);
59 60
61 IConfig groupsConfig = config.Configs[m_ConfigName];
62 if (groupsConfig != null)
63 {
64 key = groupsConfig.GetString("SecretKey", string.Empty);
65 m_log.DebugFormat("[Groups.RobustConnector]: Starting with secret key {0}", key);
66 }
67 else
68 m_log.WarnFormat("[Groups.RobustConnector]: Unable to find {0} section in configuration", m_ConfigName);
69
60 m_GroupsService = new GroupsService(config); 70 m_GroupsService = new GroupsService(config);
61 71
62 server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService)); 72 server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, key));
63 } 73 }
64 } 74 }
65 75
@@ -68,11 +78,13 @@ namespace OpenSim.Groups
68 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 78 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
69 79
70 private GroupsService m_GroupsService; 80 private GroupsService m_GroupsService;
81 private string m_SecretKey = String.Empty;
71 82
72 public GroupsServicePostHandler(GroupsService service) : 83 public GroupsServicePostHandler(GroupsService service, string key) :
73 base("POST", "/groups") 84 base("POST", "/groups")
74 { 85 {
75 m_GroupsService = service; 86 m_GroupsService = service;
87 m_SecretKey = key;
76 } 88 }
77 89
78 protected override byte[] ProcessRequest(string path, Stream requestData, 90 protected override byte[] ProcessRequest(string path, Stream requestData,
@@ -96,6 +108,20 @@ namespace OpenSim.Groups
96 string method = request["METHOD"].ToString(); 108 string method = request["METHOD"].ToString();
97 request.Remove("METHOD"); 109 request.Remove("METHOD");
98 110
111 if (!String.IsNullOrEmpty(m_SecretKey)) // Verification required
112 {
113 // Sender didn't send key
114 if (!request.ContainsKey("KEY") || (request["KEY"] == null))
115 return FailureResult("This service requires a secret key");
116
117 // Sender sent wrong key
118 if (!m_SecretKey.Equals(request["KEY"]))
119 return FailureResult("Provided key does not match existing one");
120
121 // OK, key matches. Remove it.
122 request.Remove("KEY");
123 }
124
99 m_log.DebugFormat("[Groups.Handler]: {0}", method); 125 m_log.DebugFormat("[Groups.Handler]: {0}", method);
100 switch (method) 126 switch (method)
101 { 127 {
@@ -784,6 +810,14 @@ namespace OpenSim.Groups
784 string xmlString = ServerUtils.BuildXmlResponse(result); 810 string xmlString = ServerUtils.BuildXmlResponse(result);
785 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 811 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
786 } 812 }
813
814 private byte[] FailureResult(string reason)
815 {
816 Dictionary<string, object> result = new Dictionary<string, object>();
817 NullResult(result, reason);
818 string xmlString = ServerUtils.BuildXmlResponse(result);
819 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
820 }
787 #endregion 821 #endregion
788 } 822 }
789} 823}
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs
index 5761200..ce63ee0 100644
--- a/OpenSim/Framework/InventoryItemBase.cs
+++ b/OpenSim/Framework/InventoryItemBase.cs
@@ -35,6 +35,10 @@ namespace OpenSim.Framework
35 /// </summary> 35 /// </summary>
36 public class InventoryItemBase : InventoryNodeBase, ICloneable 36 public class InventoryItemBase : InventoryNodeBase, ICloneable
37 { 37 {
38 public static readonly string SUITCASE_FOLDER_NAME = "My Suitcase";
39 public static readonly sbyte SUITCASE_FOLDER_TYPE = 100;
40 public static readonly sbyte SUITCASE_FOLDER_FAKE_TYPE = 8;
41
38 /// <value> 42 /// <value>
39 /// The inventory type of the item. This is slightly different from the asset type in some situations. 43 /// The inventory type of the item. This is slightly different from the asset type in some situations.
40 /// </value> 44 /// </value>
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 79bc5ef..0eb15f8 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -865,18 +865,26 @@ namespace OpenSim.Region.ClientStack.Linden
865 item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID)); 865 item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID));
866 if (item != null) 866 if (item != null)
867 { 867 {
868 copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID); 868 string message;
869 if (copyItem != null && client != null) 869 copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID, out message);
870 if (client != null)
870 { 871 {
871 m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder); 872 if (copyItem != null)
872 client.SendBulkUpdateInventory(copyItem); 873 {
874 m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder);
875 client.SendBulkUpdateInventory(copyItem);
876 }
877 else
878 {
879 client.SendAgentAlertMessage(message, false);
880 }
873 } 881 }
874 } 882 }
875 else 883 else
876 { 884 {
877 m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID); 885 m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID);
878 if (client != null) 886 if (client != null)
879 client.SendAlertMessage("Failed to retrieve item"); 887 client.SendAgentAlertMessage("Failed to retrieve item", false);
880 } 888 }
881 } 889 }
882 catch (Exception e) 890 catch (Exception e)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 7cb5b53..53217a0 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -1761,6 +1761,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1761 newBlock.Name = Util.StringToBytes256(folder.Name); 1761 newBlock.Name = Util.StringToBytes256(folder.Name);
1762 newBlock.ParentID = folder.ParentID; 1762 newBlock.ParentID = folder.ParentID;
1763 newBlock.Type = (sbyte)folder.Type; 1763 newBlock.Type = (sbyte)folder.Type;
1764 if (newBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
1765 newBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
1764 1766
1765 return newBlock; 1767 return newBlock;
1766 } 1768 }
@@ -2010,8 +2012,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2010 2012
2011 folderBlock.FolderID = folder.ID; 2013 folderBlock.FolderID = folder.ID;
2012 folderBlock.ParentID = folder.ParentID; 2014 folderBlock.ParentID = folder.ParentID;
2013 //folderBlock.Type = -1;
2014 folderBlock.Type = (sbyte)folder.Type; 2015 folderBlock.Type = (sbyte)folder.Type;
2016 if (folderBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
2017 folderBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
2015 folderBlock.Name = Util.StringToBytes256(folder.Name); 2018 folderBlock.Name = Util.StringToBytes256(folder.Name);
2016 2019
2017 return folderBlock; 2020 return folderBlock;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 0b10dd8..c632798 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -180,8 +180,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
180 "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", 180 "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory",
181 folderID, new UUID(im.toAgentID)); 181 folderID, new UUID(im.toAgentID));
182 182
183 InventoryFolderBase folderCopy 183 InventoryFolderBase folderCopy
184 = scene.GiveInventoryFolder(receipientID, client.AgentId, folderID, UUID.Zero); 184 = scene.GiveInventoryFolder(client, receipientID, client.AgentId, folderID, UUID.Zero);
185 185
186 if (folderCopy == null) 186 if (folderCopy == null)
187 { 187 {
@@ -217,13 +217,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
217 "into agent {1}'s inventory", 217 "into agent {1}'s inventory",
218 itemID, new UUID(im.toAgentID)); 218 itemID, new UUID(im.toAgentID));
219 219
220 InventoryItemBase itemCopy = scene.GiveInventoryItem( 220 string message;
221 new UUID(im.toAgentID), 221 InventoryItemBase itemCopy = scene.GiveInventoryItem(new UUID(im.toAgentID), client.AgentId, itemID, out message);
222 client.AgentId, itemID);
223 222
224 if (itemCopy == null) 223 if (itemCopy == null)
225 { 224 {
226 client.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); 225 client.SendAgentAlertMessage(message, false);
227 return; 226 return;
228 } 227 }
229 228
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index bb9f457..91f1b63 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Region.Framework.Scenes
46{ 46{
47 public partial class Scene 47 public partial class Scene
48 { 48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private static readonly string LogHeader = "[SCENE INVENTORY]"; 50 private static readonly string LogHeader = "[SCENE INVENTORY]";
51 51
52 /// <summary> 52 /// <summary>
@@ -534,9 +534,9 @@ namespace OpenSim.Region.Framework.Scenes
534 /// <param name="recipientClient"></param> 534 /// <param name="recipientClient"></param>
535 /// <param name="senderId">ID of the sender of the item</param> 535 /// <param name="senderId">ID of the sender of the item</param>
536 /// <param name="itemId"></param> 536 /// <param name="itemId"></param>
537 public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId) 537 public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId, out string message)
538 { 538 {
539 InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId); 539 InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId, out message);
540 540
541 if (itemCopy != null) 541 if (itemCopy != null)
542 recipientClient.SendBulkUpdateInventory(itemCopy); 542 recipientClient.SendBulkUpdateInventory(itemCopy);
@@ -549,9 +549,9 @@ namespace OpenSim.Region.Framework.Scenes
549 /// <param name="senderId">ID of the sender of the item</param> 549 /// <param name="senderId">ID of the sender of the item</param>
550 /// <param name="itemId"></param> 550 /// <param name="itemId"></param>
551 /// <returns>The inventory item copy given, null if the give was unsuccessful</returns> 551 /// <returns>The inventory item copy given, null if the give was unsuccessful</returns>
552 public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId) 552 public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId, out string message)
553 { 553 {
554 return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero); 554 return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero, out message);
555 } 555 }
556 556
557 /// <summary> 557 /// <summary>
@@ -568,12 +568,15 @@ namespace OpenSim.Region.Framework.Scenes
568 /// The inventory item copy given, null if the give was unsuccessful 568 /// The inventory item copy given, null if the give was unsuccessful
569 /// </returns> 569 /// </returns>
570 public virtual InventoryItemBase GiveInventoryItem( 570 public virtual InventoryItemBase GiveInventoryItem(
571 UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId) 571 UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId, out string message)
572 { 572 {
573 //Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); 573 //Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
574 574
575 if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient)) 575 if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient))
576 {
577 message = "Not allowed to transfer this item.";
576 return null; 578 return null;
579 }
577 580
578 InventoryItemBase item = new InventoryItemBase(itemId, senderId); 581 InventoryItemBase item = new InventoryItemBase(itemId, senderId);
579 item = InventoryService.GetItem(item); 582 item = InventoryService.GetItem(item);
@@ -582,6 +585,7 @@ namespace OpenSim.Region.Framework.Scenes
582 { 585 {
583 m_log.WarnFormat( 586 m_log.WarnFormat(
584 "[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient); 587 "[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient);
588 message = string.Format("Item not found: {0}.", itemId);
585 return null; 589 return null;
586 } 590 }
587 591
@@ -590,6 +594,7 @@ namespace OpenSim.Region.Framework.Scenes
590 m_log.WarnFormat( 594 m_log.WarnFormat(
591 "[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}", 595 "[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}",
592 item.Name, item.ID, recipient, senderId, item.Owner); 596 item.Name, item.ID, recipient, senderId, item.Owner);
597 message = "Sender did not match item owner.";
593 return null; 598 return null;
594 } 599 }
595 600
@@ -600,7 +605,10 @@ namespace OpenSim.Region.Framework.Scenes
600 if (!Permissions.BypassPermissions()) 605 if (!Permissions.BypassPermissions())
601 { 606 {
602 if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) 607 if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
608 {
609 message = "Item doesn't have the Transfer permission.";
603 return null; 610 return null;
611 }
604 } 612 }
605 613
606 // Insert a copy of the item into the recipient 614 // Insert a copy of the item into the recipient
@@ -736,9 +744,14 @@ namespace OpenSim.Region.Framework.Scenes
736 InventoryFolderBase root = InventoryService.GetRootFolder(recipient); 744 InventoryFolderBase root = InventoryService.GetRootFolder(recipient);
737 745
738 if (root != null) 746 if (root != null)
747 {
739 itemCopy.Folder = root.ID; 748 itemCopy.Folder = root.ID;
749 }
740 else 750 else
741 return null; // No destination 751 {
752 message = "Can't find a folder to add the item to.";
753 return null;
754 }
742 } 755 }
743 } 756 }
744 757
@@ -763,6 +776,7 @@ namespace OpenSim.Region.Framework.Scenes
763 } 776 }
764 } 777 }
765 778
779 message = null;
766 return itemCopy; 780 return itemCopy;
767 } 781 }
768 782
@@ -780,7 +794,7 @@ namespace OpenSim.Region.Framework.Scenes
780 /// <returns> 794 /// <returns>
781 /// The inventory folder copy given, null if the copy was unsuccessful 795 /// The inventory folder copy given, null if the copy was unsuccessful
782 /// </returns> 796 /// </returns>
783 public virtual InventoryFolderBase GiveInventoryFolder( 797 public virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client,
784 UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) 798 UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId)
785 { 799 {
786 //// Retrieve the folder from the sender 800 //// Retrieve the folder from the sender
@@ -815,13 +829,18 @@ namespace OpenSim.Region.Framework.Scenes
815 InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId); 829 InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId);
816 foreach (InventoryFolderBase childFolder in contents.Folders) 830 foreach (InventoryFolderBase childFolder in contents.Folders)
817 { 831 {
818 GiveInventoryFolder(recipientId, senderId, childFolder.ID, newFolder.ID); 832 GiveInventoryFolder(client, recipientId, senderId, childFolder.ID, newFolder.ID);
819 } 833 }
820 834
821 // Give all the items 835 // Give all the items
822 foreach (InventoryItemBase item in contents.Items) 836 foreach (InventoryItemBase item in contents.Items)
823 { 837 {
824 GiveInventoryItem(recipientId, senderId, item.ID, newFolder.ID); 838 string message;
839 if (GiveInventoryItem(recipientId, senderId, item.ID, newFolder.ID, out message) == null)
840 {
841 if (client != null)
842 client.SendAgentAlertMessage(message, false);
843 }
825 } 844 }
826 845
827 return newFolder; 846 return newFolder;
@@ -1148,11 +1167,19 @@ namespace OpenSim.Region.Framework.Scenes
1148 1167
1149 InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder); 1168 InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder);
1150 1169
1151 // Move the item to trash. If this is a copiable item, only 1170 // Move the item to trash. If this is a copyable item, only
1152 // a copy will be moved and we will still need to delete 1171 // a copy will be moved and we will still need to delete
1153 // the item from the prim. If it was no copy, is will be 1172 // the item from the prim. If it was no copy, it will be
1154 // deleted by this method. 1173 // deleted by this method.
1155 MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID); 1174 string message;
1175 InventoryItemBase item2 = MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID, out message);
1176
1177 if (item2 == null)
1178 {
1179 m_log.WarnFormat("[SCENE INVENTORY]: RemoveTaskInventory of item {0} failed: {1}", itemID, message);
1180 remoteClient.SendAgentAlertMessage(message, false);
1181 return;
1182 }
1156 1183
1157 if (group.GetInventoryItem(localID, itemID) != null) 1184 if (group.GetInventoryItem(localID, itemID) != null)
1158 { 1185 {
@@ -1164,11 +1191,16 @@ namespace OpenSim.Region.Framework.Scenes
1164 1191
1165 group.RemoveInventoryItem(localID, itemID); 1192 group.RemoveInventoryItem(localID, itemID);
1166 } 1193 }
1194
1167 part.SendPropertiesToClient(remoteClient); 1195 part.SendPropertiesToClient(remoteClient);
1168 } 1196 }
1169 } 1197 }
1170 1198
1171 private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) 1199
1200 /// <summary>
1201 /// Creates (in memory only) a user inventory item that will contain a copy of a task inventory item.
1202 /// </summary>
1203 private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId, out string message)
1172 { 1204 {
1173 TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); 1205 TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId);
1174 1206
@@ -1179,12 +1211,13 @@ namespace OpenSim.Region.Framework.Scenes
1179 + " inventory item from a prim's inventory item " 1211 + " inventory item from a prim's inventory item "
1180 + " but the required item does not exist in the prim's inventory", 1212 + " but the required item does not exist in the prim's inventory",
1181 itemId, part.Name, part.UUID); 1213 itemId, part.Name, part.UUID);
1182 1214 message = "Item not found: " + itemId;
1183 return null; 1215 return null;
1184 } 1216 }
1185 1217
1186 if ((destAgent != taskItem.OwnerID) && ((taskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) 1218 if ((destAgent != taskItem.OwnerID) && ((taskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0))
1187 { 1219 {
1220 message = "Item doesn't have the Transfer permission.";
1188 return null; 1221 return null;
1189 } 1222 }
1190 1223
@@ -1230,11 +1263,24 @@ namespace OpenSim.Region.Framework.Scenes
1230 agentItem.GroupPermissions = taskItem.GroupPermissions; 1263 agentItem.GroupPermissions = taskItem.GroupPermissions;
1231 } 1264 }
1232 1265
1266 message = null;
1267 return agentItem;
1268 }
1269
1270 /// <summary>
1271 /// If the task item is not-copyable then remove it from the prim.
1272 /// </summary>
1273 private void RemoveNonCopyTaskItemFromPrim(SceneObjectPart part, UUID itemId)
1274 {
1275 TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId);
1276 if (taskItem == null)
1277 return;
1278
1233 if (!Permissions.BypassPermissions()) 1279 if (!Permissions.BypassPermissions())
1234 { 1280 {
1235 if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 1281 if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1236 { 1282 {
1237 if (taskItem.Type == 10) 1283 if (taskItem.Type == (int)AssetType.LSLText)
1238 { 1284 {
1239 part.RemoveScriptEvents(itemId); 1285 part.RemoveScriptEvents(itemId);
1240 EventManager.TriggerRemoveScript(part.LocalId, itemId); 1286 EventManager.TriggerRemoveScript(part.LocalId, itemId);
@@ -1243,8 +1289,6 @@ namespace OpenSim.Region.Framework.Scenes
1243 part.Inventory.RemoveInventoryItem(itemId); 1289 part.Inventory.RemoveInventoryItem(itemId);
1244 } 1290 }
1245 } 1291 }
1246
1247 return agentItem;
1248 } 1292 }
1249 1293
1250 /// <summary> 1294 /// <summary>
@@ -1254,19 +1298,22 @@ namespace OpenSim.Region.Framework.Scenes
1254 /// <param name="folderID"></param> 1298 /// <param name="folderID"></param>
1255 /// <param name="part"></param> 1299 /// <param name="part"></param>
1256 /// <param name="itemID"></param> 1300 /// <param name="itemID"></param>
1257 public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId) 1301 public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId, out string message)
1258 { 1302 {
1259 m_log.DebugFormat( 1303 m_log.DebugFormat(
1260 "[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}", 1304 "[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}",
1261 itemId, part.Name, folderId, remoteClient.Name); 1305 itemId, part.Name, folderId, remoteClient.Name);
1262 1306
1263 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId); 1307 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId, out message);
1264
1265 if (agentItem == null) 1308 if (agentItem == null)
1266 return null; 1309 return null;
1267 1310
1268 agentItem.Folder = folderId; 1311 agentItem.Folder = folderId;
1269 AddInventoryItem(remoteClient, agentItem); 1312 AddInventoryItem(remoteClient, agentItem);
1313
1314 RemoveNonCopyTaskItemFromPrim(part, itemId);
1315
1316 message = null;
1270 return agentItem; 1317 return agentItem;
1271 } 1318 }
1272 1319
@@ -1317,7 +1364,11 @@ namespace OpenSim.Region.Framework.Scenes
1317 return; 1364 return;
1318 } 1365 }
1319 1366
1320 MoveTaskInventoryItem(remoteClient, folderId, part, itemId); 1367 string message;
1368 InventoryItemBase item = MoveTaskInventoryItem(remoteClient, folderId, part, itemId, out message);
1369
1370 if (item == null)
1371 remoteClient.SendAgentAlertMessage(message, false);
1321 } 1372 }
1322 1373
1323 /// <summary> 1374 /// <summary>
@@ -1331,17 +1382,17 @@ namespace OpenSim.Region.Framework.Scenes
1331 /// </param> 1382 /// </param>
1332 /// <param name="part"></param> 1383 /// <param name="part"></param>
1333 /// <param name="itemID"></param> 1384 /// <param name="itemID"></param>
1334 public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId) 1385 public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId, out string message)
1335 { 1386 {
1336 ScenePresence avatar; 1387 ScenePresence avatar;
1337 1388
1338 if (TryGetScenePresence(avatarId, out avatar)) 1389 if (TryGetScenePresence(avatarId, out avatar))
1339 { 1390 {
1340 return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); 1391 return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId, out message);
1341 } 1392 }
1342 else 1393 else
1343 { 1394 {
1344 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId); 1395 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId, out message);
1345 1396
1346 if (agentItem == null) 1397 if (agentItem == null)
1347 return null; 1398 return null;
@@ -1350,6 +1401,8 @@ namespace OpenSim.Region.Framework.Scenes
1350 1401
1351 AddInventoryItem(agentItem); 1402 AddInventoryItem(agentItem);
1352 1403
1404 RemoveNonCopyTaskItemFromPrim(part, itemId);
1405
1353 return agentItem; 1406 return agentItem;
1354 } 1407 }
1355 } 1408 }
@@ -1455,6 +1508,11 @@ namespace OpenSim.Region.Framework.Scenes
1455 1508
1456 public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) 1509 public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items)
1457 { 1510 {
1511 ScenePresence avatar;
1512 IClientAPI remoteClient = null;
1513 if (TryGetScenePresence(destID, out avatar))
1514 remoteClient = avatar.ControllingClient;
1515
1458 InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); 1516 InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID);
1459 1517
1460 UUID newFolderID = UUID.Random(); 1518 UUID newFolderID = UUID.Random();
@@ -1464,26 +1522,28 @@ namespace OpenSim.Region.Framework.Scenes
1464 1522
1465 foreach (UUID itemID in items) 1523 foreach (UUID itemID in items)
1466 { 1524 {
1467 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID); 1525 string message;
1526 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID, out message);
1468 1527
1469 if (agentItem != null) 1528 if (agentItem != null)
1470 { 1529 {
1471 agentItem.Folder = newFolderID; 1530 agentItem.Folder = newFolderID;
1472 1531
1473 AddInventoryItem(agentItem); 1532 AddInventoryItem(agentItem);
1533
1534 RemoveNonCopyTaskItemFromPrim(host, itemID);
1535 }
1536 else
1537 {
1538 if (remoteClient != null)
1539 remoteClient.SendAgentAlertMessage(message, false);
1474 } 1540 }
1475 } 1541 }
1476 1542
1477 ScenePresence avatar = null; 1543 if (remoteClient != null)
1478 if (TryGetScenePresence(destID, out avatar))
1479 { 1544 {
1480 //profile.SendInventoryDecendents(avatar.ControllingClient, 1545 SendInventoryUpdate(remoteClient, rootFolder, true, false);
1481 // profile.RootFolder.ID, true, false); 1546 SendInventoryUpdate(remoteClient, newFolder, false, true);
1482 //profile.SendInventoryDecendents(avatar.ControllingClient,
1483 // newFolderID, false, true);
1484
1485 SendInventoryUpdate(avatar.ControllingClient, rootFolder, true, false);
1486 SendInventoryUpdate(avatar.ControllingClient, newFolder, false, true);
1487 } 1547 }
1488 1548
1489 return newFolderID; 1549 return newFolderID;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index 6e0ea7d..f809267 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -136,7 +136,8 @@ namespace OpenSim.Region.Framework.Tests
136 = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; 136 = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
137 137
138 // Perform test 138 // Perform test
139 scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); 139 string message;
140 scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID, out message);
140 141
141 InventoryItemBase ncUserItem 142 InventoryItemBase ncUserItem
142 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); 143 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem");
@@ -165,7 +166,8 @@ namespace OpenSim.Region.Framework.Tests
165 scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); 166 scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
166 167
167 // Perform test 168 // Perform test
168 scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); 169 string message;
170 scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID, out message);
169 171
170 InventoryItemBase ncUserItem 172 InventoryItemBase ncUserItem
171 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); 173 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem");
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
index e50b4da..0736278 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
@@ -95,7 +95,9 @@ namespace OpenSim.Region.Framework.Tests
95 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); 95 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
96 InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); 96 InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID);
97 97
98 scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); 98 string message;
99
100 scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID, out message);
99 101
100 InventoryItemBase retrievedItem1 102 InventoryItemBase retrievedItem1
101 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1"); 103 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1");
@@ -103,7 +105,7 @@ namespace OpenSim.Region.Framework.Tests
103 Assert.That(retrievedItem1, Is.Not.Null); 105 Assert.That(retrievedItem1, Is.Not.Null);
104 106
105 // Try giving back the freshly received item 107 // Try giving back the freshly received item
106 scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID); 108 scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID, out message);
107 109
108 List<InventoryItemBase> reretrievedItems 110 List<InventoryItemBase> reretrievedItems
109 = UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1"); 111 = UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1");
@@ -123,7 +125,7 @@ namespace OpenSim.Region.Framework.Tests
123 InventoryFolderBase folder1 125 InventoryFolderBase folder1
124 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false); 126 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false);
125 127
126 scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); 128 scene.GiveInventoryFolder(null, user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero);
127 129
128 InventoryFolderBase retrievedFolder1 130 InventoryFolderBase retrievedFolder1
129 = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1"); 131 = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1");
@@ -131,7 +133,7 @@ namespace OpenSim.Region.Framework.Tests
131 Assert.That(retrievedFolder1, Is.Not.Null); 133 Assert.That(retrievedFolder1, Is.Not.Null);
132 134
133 // Try giving back the freshly received folder 135 // Try giving back the freshly received folder
134 scene.GiveInventoryFolder(user1.PrincipalID, user2.PrincipalID, retrievedFolder1.ID, UUID.Zero); 136 scene.GiveInventoryFolder(null, user1.PrincipalID, user2.PrincipalID, retrievedFolder1.ID, UUID.Zero);
135 137
136 List<InventoryFolderBase> reretrievedFolders 138 List<InventoryFolderBase> reretrievedFolders
137 = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1"); 139 = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1");
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index fc8cae2..f34152c 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -560,12 +560,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
560 if (m_debugEnabled) 560 if (m_debugEnabled)
561 m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); 561 m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
562 562
563 string message;
563 InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, 564 InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
564 giver, attachmentUUID); 565 giver, attachmentUUID, out message);
565 566
566 if (itemCopy == null) 567 if (itemCopy == null)
567 { 568 {
568 remoteClient.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); 569 remoteClient.SendAgentAlertMessage(message, false);
569 return; 570 return;
570 } 571 }
571 572
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 4d20e13..d169912 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1884,9 +1884,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1884 part.Shape.LightColorR = Util.Clip((float)color.x, 0.0f, 1.0f); 1884 part.Shape.LightColorR = Util.Clip((float)color.x, 0.0f, 1.0f);
1885 part.Shape.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f); 1885 part.Shape.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f);
1886 part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f); 1886 part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f);
1887 part.Shape.LightIntensity = intensity; 1887 part.Shape.LightIntensity = Util.Clip((float)intensity, 0.0f, 1.0f);
1888 part.Shape.LightRadius = radius; 1888 part.Shape.LightRadius = Util.Clip((float)radius, 0.1f, 20.0f);
1889 part.Shape.LightFalloff = falloff; 1889 part.Shape.LightFalloff = Util.Clip((float)falloff, 0.01f, 2.0f);
1890 } 1890 }
1891 else 1891 else
1892 { 1892 {
@@ -4127,10 +4127,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4127 } 4127 }
4128 } 4128 }
4129 // destination is an avatar 4129 // destination is an avatar
4130 InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId); 4130 string message;
4131 InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId, out message);
4131 4132
4132 if (agentItem == null) 4133 if (agentItem == null)
4134 {
4135 llSay(0, message);
4133 return; 4136 return;
4137 }
4134 4138
4135 if (m_TransferModule != null) 4139 if (m_TransferModule != null)
4136 { 4140 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 6302455..de2c3f7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3397,14 +3397,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3397 if (sp == null) 3397 if (sp == null)
3398 return; 3398 return;
3399 3399
3400 InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID); 3400 string message;
3401 InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID, out message);
3401 3402
3402 if (newItem == null) 3403 if (newItem == null)
3403 { 3404 {
3404 m_log.ErrorFormat( 3405 m_log.ErrorFormat(
3405 "[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}", 3406 "[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}: {4}",
3406 itemName, m_host.Name, attachmentPoint, World.Name); 3407 itemName, m_host.Name, attachmentPoint, World.Name, message);
3407 3408 ((LSL_Api)m_LSL_Api).llSay(0, message);
3408 return; 3409 return;
3409 } 3410 }
3410 3411
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
index 5122a77..a77e67d 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Asset
64 { 64 {
65 asset = (AssetBase)xs.Deserialize(request); 65 asset = (AssetBase)xs.Deserialize(request);
66 } 66 }
67 catch (XmlException) 67 catch (Exception)
68 { 68 {
69 httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; 69 httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
70 return null; 70 return null;
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 0d7f259..06392f7 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -243,7 +243,7 @@ namespace OpenSim.Server.Handlers.Simulation
243 } 243 }
244 244
245 Stream inputStream = request; 245 Stream inputStream = request;
246 if ((httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) 246 if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
247 inputStream = new GZipStream(inputStream, CompressionMode.Decompress); 247 inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
248 248
249 StreamReader reader = new StreamReader(inputStream, encoding); 249 StreamReader reader = new StreamReader(inputStream, encoding);
@@ -454,7 +454,7 @@ namespace OpenSim.Server.Handlers.Simulation
454 keysvals.Add("querystringkeys", querystringkeys); 454 keysvals.Add("querystringkeys", querystringkeys);
455 455
456 Stream inputStream = request; 456 Stream inputStream = request;
457 if ((httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip")) 457 if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
458 inputStream = new GZipStream(inputStream, CompressionMode.Decompress); 458 inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
459 459
460 Encoding encoding = Encoding.UTF8; 460 Encoding encoding = Encoding.UTF8;
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
index 8269d36..3de2330 100644
--- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
+++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
@@ -156,9 +156,9 @@ namespace OpenSim.Services.HypergridService
156 if (suitcase == null) 156 if (suitcase == null)
157 { 157 {
158 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder. Creating it...", principalID); 158 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder. Creating it...", principalID);
159 // make one, and let's add it to the user's inventory as a direct child of the root folder 159 // Create the My Suitcase folder under the user's root folder.
160 // In the DB we tag it as type 100, but we use -1 (Unknown) outside 160 // In the DB we tag it as type 100, but we use type 8 (Folder) outside, as this affects the sort order.
161 suitcase = CreateFolder(principalID, root.folderID, 100, "My Suitcase"); 161 suitcase = CreateFolder(principalID, root.folderID, InventoryItemBase.SUITCASE_FOLDER_TYPE, InventoryItemBase.SUITCASE_FOLDER_NAME);
162 if (suitcase == null) 162 if (suitcase == null)
163 { 163 {
164 m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder"); 164 m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder");
@@ -248,7 +248,10 @@ namespace OpenSim.Services.HypergridService
248 InventoryCollection coll = null; 248 InventoryCollection coll = null;
249 249
250 if (!IsWithinSuitcaseTree(principalID, folderID)) 250 if (!IsWithinSuitcaseTree(principalID, folderID))
251 {
252 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent: folder {0} is not within Suitcase tree", folderID);
251 return new InventoryCollection(); 253 return new InventoryCollection();
254 }
252 255
253 coll = base.GetFolderContent(principalID, folderID); 256 coll = base.GetFolderContent(principalID, folderID);
254 257
@@ -265,7 +268,10 @@ namespace OpenSim.Services.HypergridService
265 // Let's do a bit of sanity checking, more than the base service does 268 // Let's do a bit of sanity checking, more than the base service does
266 // make sure the given folder exists under the suitcase tree of this user 269 // make sure the given folder exists under the suitcase tree of this user
267 if (!IsWithinSuitcaseTree(principalID, folderID)) 270 if (!IsWithinSuitcaseTree(principalID, folderID))
271 {
272 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderItems: folder {0} is not within Suitcase tree", folderID);
268 return new List<InventoryItemBase>(); 273 return new List<InventoryItemBase>();
274 }
269 275
270 return base.GetFolderItems(principalID, folderID); 276 return base.GetFolderItems(principalID, folderID);
271 } 277 }
@@ -277,7 +283,10 @@ namespace OpenSim.Services.HypergridService
277 // make sure the given folder's parent folder exists under the suitcase tree of this user 283 // make sure the given folder's parent folder exists under the suitcase tree of this user
278 284
279 if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) 285 if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID))
286 {
287 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder: folder {0} is not within Suitcase tree", folder.ParentID);
280 return false; 288 return false;
289 }
281 290
282 // OK, it's legit 291 // OK, it's legit
283 if (base.AddFolder(folder)) 292 if (base.AddFolder(folder))
@@ -297,7 +306,7 @@ namespace OpenSim.Services.HypergridService
297 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); 306 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version);
298 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) 307 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID))
299 { 308 {
300 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); 309 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateFolder: folder {0}/{1} is not within Suitcase tree", folder.Name, folder.ID);
301 return false; 310 return false;
302 } 311 }
303 312
@@ -307,9 +316,17 @@ namespace OpenSim.Services.HypergridService
307 316
308 public override bool MoveFolder(InventoryFolderBase folder) 317 public override bool MoveFolder(InventoryFolderBase folder)
309 { 318 {
310 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID) || 319 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID))
311 !IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) 320 {
321 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ID);
312 return false; 322 return false;
323 }
324
325 if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID))
326 {
327 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ParentID);
328 return false;
329 }
313 330
314 return base.MoveFolder(folder); 331 return base.MoveFolder(folder);
315 } 332 }
@@ -331,7 +348,10 @@ namespace OpenSim.Services.HypergridService
331 // Let's do a bit of sanity checking, more than the base service does 348 // Let's do a bit of sanity checking, more than the base service does
332 // make sure the given folder's parent folder exists under the suitcase tree of this user 349 // make sure the given folder's parent folder exists under the suitcase tree of this user
333 if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) 350 if (!IsWithinSuitcaseTree(item.Owner, item.Folder))
351 {
352 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddItem: folder {0} is not within Suitcase tree", item.Folder);
334 return false; 353 return false;
354 }
335 355
336 // OK, it's legit 356 // OK, it's legit
337 return base.AddItem(item); 357 return base.AddItem(item);
@@ -341,7 +361,10 @@ namespace OpenSim.Services.HypergridService
341 public override bool UpdateItem(InventoryItemBase item) 361 public override bool UpdateItem(InventoryItemBase item)
342 { 362 {
343 if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) 363 if (!IsWithinSuitcaseTree(item.Owner, item.Folder))
364 {
365 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateItem: folder {0} is not within Suitcase tree", item.Folder);
344 return false; 366 return false;
367 }
345 368
346 return base.UpdateItem(item); 369 return base.UpdateItem(item);
347 } 370 }
@@ -350,11 +373,28 @@ namespace OpenSim.Services.HypergridService
350 { 373 {
351 // Principal is b0rked. *sigh* 374 // Principal is b0rked. *sigh*
352 375
353 if (!IsWithinSuitcaseTree(items[0].Owner, items[0].Folder)) 376 // Check the items' destination folders
354 return false; 377 foreach (InventoryItemBase item in items)
378 {
379 if (!IsWithinSuitcaseTree(item.Owner, item.Folder))
380 {
381 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", item.Folder);
382 return false;
383 }
384 }
355 385
356 return base.MoveItems(principalID, items); 386 // Check the items' current folders
387 foreach (InventoryItemBase item in items)
388 {
389 InventoryItemBase originalItem = base.GetItem(item);
390 if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder))
391 {
392 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", originalItem.Folder);
393 return false;
394 }
395 }
357 396
397 return base.MoveItems(principalID, items);
358 } 398 }
359 399
360 public override bool DeleteItems(UUID principalID, List<UUID> itemIDs) 400 public override bool DeleteItems(UUID principalID, List<UUID> itemIDs)
@@ -374,8 +414,8 @@ namespace OpenSim.Services.HypergridService
374 414
375 if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) 415 if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID))
376 { 416 {
377 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", 417 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0}/{1} (folder {2}) is not within Suitcase tree or Appearance",
378 it.Name, it.Folder); 418 it.Name, it.ID, it.Folder);
379 return null; 419 return null;
380 } 420 }
381 421
@@ -396,7 +436,11 @@ namespace OpenSim.Services.HypergridService
396 if (f != null) 436 if (f != null)
397 { 437 {
398 if (!IsWithinSuitcaseTree(f.Owner, f.ID)) 438 if (!IsWithinSuitcaseTree(f.Owner, f.ID))
439 {
440 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Folder {0}/{1} is not within Suitcase tree",
441 f.Name, f.ID);
399 return null; 442 return null;
443 }
400 } 444 }
401 445
402 return f; 446 return f;
@@ -464,7 +508,7 @@ namespace OpenSim.Services.HypergridService
464 // Warp! Root folder for travelers 508 // Warp! Root folder for travelers
465 XInventoryFolder[] folders = m_Database.GetFolders( 509 XInventoryFolder[] folders = m_Database.GetFolders(
466 new string[] { "agentID", "type" }, 510 new string[] { "agentID", "type" },
467 new string[] { principalID.ToString(), "100" }); // This is a special folder type... 511 new string[] { principalID.ToString(), InventoryItemBase.SUITCASE_FOLDER_TYPE.ToString() }); // This is a special folder type...
468 512
469 if (folders != null && folders.Length > 0) 513 if (folders != null && folders.Length > 0)
470 return folders[0]; 514 return folders[0];
@@ -472,13 +516,13 @@ namespace OpenSim.Services.HypergridService
472 // check to see if we have the old Suitcase folder 516 // check to see if we have the old Suitcase folder
473 folders = m_Database.GetFolders( 517 folders = m_Database.GetFolders(
474 new string[] { "agentID", "folderName", "parentFolderID" }, 518 new string[] { "agentID", "folderName", "parentFolderID" },
475 new string[] { principalID.ToString(), "My Suitcase", UUID.Zero.ToString() }); 519 new string[] { principalID.ToString(), InventoryItemBase.SUITCASE_FOLDER_NAME, UUID.Zero.ToString() });
476 if (folders != null && folders.Length > 0) 520 if (folders != null && folders.Length > 0)
477 { 521 {
478 // Move it to under the root folder 522 // Move it to under the root folder
479 XInventoryFolder root = GetRootXFolder(principalID); 523 XInventoryFolder root = GetRootXFolder(principalID);
480 folders[0].parentFolderID = root.folderID; 524 folders[0].parentFolderID = root.folderID;
481 folders[0].type = 100; 525 folders[0].type = InventoryItemBase.SUITCASE_FOLDER_TYPE;
482 m_Database.StoreFolder(folders[0]); 526 m_Database.StoreFolder(folders[0]);
483 return folders[0]; 527 return folders[0];
484 } 528 }
@@ -488,7 +532,7 @@ namespace OpenSim.Services.HypergridService
488 532
489 private void SetAsNormalFolder(XInventoryFolder suitcase) 533 private void SetAsNormalFolder(XInventoryFolder suitcase)
490 { 534 {
491 suitcase.type = (short)AssetType.Folder; 535 suitcase.type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
492 } 536 }
493 537
494 private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder) 538 private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder)
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index 3bee433..7c16ca9 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -631,8 +631,8 @@ namespace OpenSim.Services.InventoryService
631 newFolder.ParentID = folder.parentFolderID; 631 newFolder.ParentID = folder.parentFolderID;
632 newFolder.Type = (short)folder.type; 632 newFolder.Type = (short)folder.type;
633 // Viewer can't understand anything that's not in it's LLFolderType enum 633 // Viewer can't understand anything that's not in it's LLFolderType enum
634 if (newFolder.Type == 100) 634 if (newFolder.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
635 newFolder.Type = -1; 635 newFolder.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
636 newFolder.Version = (ushort)folder.version; 636 newFolder.Version = (ushort)folder.version;
637 newFolder.Name = folder.folderName; 637 newFolder.Name = folder.folderName;
638 newFolder.Owner = folder.agentID; 638 newFolder.Owner = folder.agentID;
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 1395d72..8742313 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -996,6 +996,10 @@
996 ;; Used for V2 in HG only. If standalone, set this to local; if grided sim, set this to remote 996 ;; Used for V2 in HG only. If standalone, set this to local; if grided sim, set this to remote
997 ; LocalService = local 997 ; LocalService = local
998 998
999 ;# {SecretKey} {ServicesConnectorModule:Groups Remote Service Connector} {Secret key between sim and remote group service} {} ""
1000 ;; Used for V2 in Remote only.
1001 ; SecretKey = ""
1002
999 ;# {GroupsServerURI} {Module:GroupsModule (ServicesConnectorModule:Groups Remote Service Connector or (ServicesConnectorModule:Groups HG Service Connector and LocalService:remote))} {Groups Server URI} {} 1003 ;# {GroupsServerURI} {Module:GroupsModule (ServicesConnectorModule:Groups Remote Service Connector or (ServicesConnectorModule:Groups HG Service Connector and LocalService:remote))} {Groups Server URI} {}
1000 ;; URI for the groups services of this grid 1004 ;; URI for the groups services of this grid
1001 ;; e.g. http://yourxmlrpcserver.com/xmlrpc.php for Flotsam XmlRpc 1005 ;; e.g. http://yourxmlrpcserver.com/xmlrpc.php for Flotsam XmlRpc