diff options
author | Justin Clark-Casey (justincc) | 2014-05-06 17:22:47 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-05-06 17:22:47 +0100 |
commit | 95eeb4dde840a8b0d325dd0423dc7099aaed7dfa (patch) | |
tree | 139e7fd30e49d13cdb5c53ebcf82eb5cc22cc8e9 /OpenSim/Region | |
parent | minor: Comment out Cacheitems debug log lines for now (diff) | |
parent | Better error handling in AssetServerPostHandler. Invalid XML causes an Invali... (diff) | |
download | opensim-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
Diffstat (limited to 'OpenSim/Region')
9 files changed, 143 insertions, 63 deletions
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 | ||