diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 7bc59fc..cf0c28b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -94,6 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
94 | private static readonly string m_notecardUpdatePath = "0004/"; | 94 | private static readonly string m_notecardUpdatePath = "0004/"; |
95 | private static readonly string m_notecardTaskUpdatePath = "0005/"; | 95 | private static readonly string m_notecardTaskUpdatePath = "0005/"; |
96 | // private static readonly string m_fetchInventoryPath = "0006/"; | 96 | // private static readonly string m_fetchInventoryPath = "0006/"; |
97 | private static readonly string m_copyFromNotecardPath = "0007/"; | ||
97 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. | 98 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. |
98 | 99 | ||
99 | 100 | ||
@@ -180,6 +181,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
180 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); | 181 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); |
181 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); | 182 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); |
182 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); | 183 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); |
184 | m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); | ||
183 | 185 | ||
184 | // As of RC 1.22.9 of the Linden client this is | 186 | // As of RC 1.22.9 of the Linden client this is |
185 | // supported | 187 | // supported |
@@ -723,6 +725,75 @@ namespace OpenSim.Region.ClientStack.Linden | |||
723 | 725 | ||
724 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | 726 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); |
725 | } | 727 | } |
728 | |||
729 | /// <summary> | ||
730 | /// Called by the CopyInventoryFromNotecard caps handler. | ||
731 | /// </summary> | ||
732 | /// <param name="request"></param> | ||
733 | /// <param name="path"></param> | ||
734 | /// <param name="param"></param> | ||
735 | public string CopyInventoryFromNotecard(string request, string path, string param, | ||
736 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | ||
737 | { | ||
738 | Hashtable response = new Hashtable(); | ||
739 | response["int_response_code"] = 404; | ||
740 | response["content_type"] = "text/plain"; | ||
741 | response["keepalive"] = false; | ||
742 | response["str_response_string"] = ""; | ||
743 | |||
744 | try | ||
745 | { | ||
746 | OSDMap content = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
747 | UUID objectID = content["object-id"].AsUUID(); | ||
748 | UUID notecardID = content["notecard-id"].AsUUID(); | ||
749 | UUID folderID = content["folder-id"].AsUUID(); | ||
750 | UUID itemID = content["item-id"].AsUUID(); | ||
751 | |||
752 | // m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, FolderID:{0}, ItemID:{1}, NotecardID:{2}, ObjectID:{3}", folderID, itemID, notecardID, objectID); | ||
753 | |||
754 | if (objectID != UUID.Zero) | ||
755 | { | ||
756 | SceneObjectPart part = m_Scene.GetSceneObjectPart(objectID); | ||
757 | if (part != null) | ||
758 | { | ||
759 | TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(notecardID); | ||
760 | if (!m_Scene.Permissions.CanCopyObjectInventory(notecardID, objectID, m_HostCapsObj.AgentID)) | ||
761 | { | ||
762 | return LLSDHelpers.SerialiseLLSDReply(response); | ||
763 | } | ||
764 | } | ||
765 | } | ||
766 | |||
767 | InventoryItemBase item = null; | ||
768 | InventoryItemBase copyItem = null; | ||
769 | IClientAPI client = null; | ||
770 | |||
771 | m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); | ||
772 | item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID)); | ||
773 | if (item != null) | ||
774 | { | ||
775 | copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID); | ||
776 | if (copyItem != null && client != null) | ||
777 | { | ||
778 | m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder); | ||
779 | client.SendBulkUpdateInventory(copyItem); | ||
780 | } | ||
781 | } | ||
782 | else | ||
783 | { | ||
784 | m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID); | ||
785 | if (client != null) | ||
786 | client.SendAlertMessage("Failed to retrieve item"); | ||
787 | } | ||
788 | } | ||
789 | catch (Exception e) | ||
790 | { | ||
791 | m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard : {0}", e.ToString()); | ||
792 | } | ||
793 | |||
794 | response["int_response_code"] = 200; | ||
795 | return LLSDHelpers.SerialiseLLSDReply(response); | ||
796 | } | ||
726 | } | 797 | } |
727 | 798 | ||
728 | public class AssetUploader | 799 | public class AssetUploader |