diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 175 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs | 4 |
2 files changed, 151 insertions, 28 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 568e216..774202e 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -44,11 +44,13 @@ using OpenSim.Region.Framework.Scenes; | |||
44 | using OpenSim.Region.Framework.Scenes.Serialization; | 44 | using OpenSim.Region.Framework.Scenes.Serialization; |
45 | using OpenSim.Framework.Servers; | 45 | using OpenSim.Framework.Servers; |
46 | using OpenSim.Framework.Servers.HttpServer; | 46 | using OpenSim.Framework.Servers.HttpServer; |
47 | using OpenSim.Framework.Client; | ||
47 | using OpenSim.Services.Interfaces; | 48 | using OpenSim.Services.Interfaces; |
48 | 49 | ||
49 | using Caps = OpenSim.Framework.Capabilities.Caps; | 50 | using Caps = OpenSim.Framework.Capabilities.Caps; |
50 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; | 51 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; |
51 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | 52 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; |
53 | using PermissionMask = OpenSim.Framework.PermissionMask; | ||
52 | 54 | ||
53 | namespace OpenSim.Region.ClientStack.Linden | 55 | namespace OpenSim.Region.ClientStack.Linden |
54 | { | 56 | { |
@@ -96,6 +98,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
96 | // private static readonly string m_fetchInventoryPath = "0006/"; | 98 | // private static readonly string m_fetchInventoryPath = "0006/"; |
97 | private static readonly string m_copyFromNotecardPath = "0007/"; | 99 | private static readonly string m_copyFromNotecardPath = "0007/"; |
98 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. | 100 | // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. |
101 | private static readonly string m_getObjectPhysicsDataPath = "0101/"; | ||
102 | /* 0102 - 0103 RESERVED */ | ||
99 | private static readonly string m_UpdateAgentInformationPath = "0500/"; | 103 | private static readonly string m_UpdateAgentInformationPath = "0500/"; |
100 | 104 | ||
101 | // These are callbacks which will be setup by the scene so that we can update scene data when we | 105 | // These are callbacks which will be setup by the scene so that we can update scene data when we |
@@ -204,7 +208,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
204 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); | 208 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); |
205 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); | 209 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); |
206 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); | 210 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); |
207 | IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler("POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation); | 211 | |
212 | IRequestHandler getObjectPhysicsDataHandler | ||
213 | = new RestStreamHandler( | ||
214 | "POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null); | ||
215 | m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); | ||
216 | |||
217 | IRequestHandler UpdateAgentInformationHandler | ||
218 | = new RestStreamHandler( | ||
219 | "POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation, "UpdateAgentInformation", null); | ||
208 | m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler); | 220 | m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler); |
209 | 221 | ||
210 | m_HostCapsObj.RegisterHandler( | 222 | m_HostCapsObj.RegisterHandler( |
@@ -256,8 +268,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
256 | public string SeedCapRequest(string request, string path, string param, | 268 | public string SeedCapRequest(string request, string path, string param, |
257 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 269 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
258 | { | 270 | { |
259 | m_log.DebugFormat( | 271 | // m_log.DebugFormat( |
260 | "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID); | 272 | // "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID); |
261 | 273 | ||
262 | if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) | 274 | if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) |
263 | { | 275 | { |
@@ -268,13 +280,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
268 | return string.Empty; | 280 | return string.Empty; |
269 | } | 281 | } |
270 | 282 | ||
271 | Hashtable caps = m_HostCapsObj.CapsHandlers.GetCapsDetails(true); | 283 | OSDArray capsRequested = (OSDArray)OSDParser.DeserializeLLSDXml(request); |
284 | List<string> validCaps = new List<string>(); | ||
272 | 285 | ||
273 | // Add the external too | 286 | foreach (OSD c in capsRequested) |
274 | foreach (KeyValuePair<string, string> kvp in m_HostCapsObj.ExternalCapsHandlers) | 287 | validCaps.Add(c.AsString()); |
275 | caps[kvp.Key] = kvp.Value; | ||
276 | 288 | ||
277 | string result = LLSDHelpers.SerialiseLLSDReply(caps); | 289 | string result = LLSDHelpers.SerialiseLLSDReply(m_HostCapsObj.GetCapsDetails(true, validCaps)); |
278 | 290 | ||
279 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); | 291 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); |
280 | 292 | ||
@@ -487,24 +499,28 @@ namespace OpenSim.Region.ClientStack.Linden | |||
487 | 499 | ||
488 | if (inventoryType == "sound") | 500 | if (inventoryType == "sound") |
489 | { | 501 | { |
490 | inType = 1; | 502 | inType = (sbyte)InventoryType.Sound; |
491 | assType = 1; | 503 | assType = (sbyte)AssetType.Sound; |
504 | } | ||
505 | else if (inventoryType == "snapshot") | ||
506 | { | ||
507 | inType = (sbyte)InventoryType.Snapshot; | ||
492 | } | 508 | } |
493 | else if (inventoryType == "animation") | 509 | else if (inventoryType == "animation") |
494 | { | 510 | { |
495 | inType = 19; | 511 | inType = (sbyte)InventoryType.Animation; |
496 | assType = 20; | 512 | assType = (sbyte)AssetType.Animation; |
497 | } | 513 | } |
498 | else if (inventoryType == "wearable") | 514 | else if (inventoryType == "wearable") |
499 | { | 515 | { |
500 | inType = 18; | 516 | inType = (sbyte)InventoryType.Wearable; |
501 | switch (assetType) | 517 | switch (assetType) |
502 | { | 518 | { |
503 | case "bodypart": | 519 | case "bodypart": |
504 | assType = 13; | 520 | assType = (sbyte)AssetType.Bodypart; |
505 | break; | 521 | break; |
506 | case "clothing": | 522 | case "clothing": |
507 | assType = 5; | 523 | assType = (sbyte)AssetType.Clothing; |
508 | break; | 524 | break; |
509 | } | 525 | } |
510 | } | 526 | } |
@@ -521,6 +537,41 @@ namespace OpenSim.Region.ClientStack.Linden | |||
521 | OSDArray texture_list = (OSDArray)request["texture_list"]; | 537 | OSDArray texture_list = (OSDArray)request["texture_list"]; |
522 | SceneObjectGroup grp = null; | 538 | SceneObjectGroup grp = null; |
523 | 539 | ||
540 | InventoryFolderBase textureUploadFolder = null; | ||
541 | |||
542 | List<InventoryFolderBase> foldersToUpdate = new List<InventoryFolderBase>(); | ||
543 | List<InventoryItemBase> itemsToUpdate = new List<InventoryItemBase>(); | ||
544 | IClientInventory clientInv = null; | ||
545 | |||
546 | if (texture_list.Count > 0) | ||
547 | { | ||
548 | ScenePresence avatar = null; | ||
549 | m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); | ||
550 | |||
551 | if (avatar != null) | ||
552 | { | ||
553 | IClientCore core = (IClientCore)avatar.ControllingClient; | ||
554 | |||
555 | if (core.TryGet<IClientInventory>(out clientInv)) | ||
556 | { | ||
557 | var systemTextureFolder = m_Scene.InventoryService.GetFolderForType(m_HostCapsObj.AgentID, FolderType.Texture); | ||
558 | textureUploadFolder = new InventoryFolderBase(UUID.Random(), assetName, m_HostCapsObj.AgentID, (short)FolderType.None, systemTextureFolder.ID, 1); | ||
559 | if (m_Scene.InventoryService.AddFolder(textureUploadFolder)) | ||
560 | { | ||
561 | foldersToUpdate.Add(textureUploadFolder); | ||
562 | |||
563 | m_log.DebugFormat( | ||
564 | "[BUNCH OF CAPS]: Created new folder '{0}' ({1}) for textures uploaded with mesh object {2}", | ||
565 | textureUploadFolder.Name, textureUploadFolder.ID, assetName); | ||
566 | } | ||
567 | else | ||
568 | { | ||
569 | textureUploadFolder = null; | ||
570 | } | ||
571 | } | ||
572 | } | ||
573 | } | ||
574 | |||
524 | List<UUID> textures = new List<UUID>(); | 575 | List<UUID> textures = new List<UUID>(); |
525 | for (int i = 0; i < texture_list.Count; i++) | 576 | for (int i = 0; i < texture_list.Count; i++) |
526 | { | 577 | { |
@@ -528,6 +579,38 @@ namespace OpenSim.Region.ClientStack.Linden | |||
528 | textureAsset.Data = texture_list[i].AsBinary(); | 579 | textureAsset.Data = texture_list[i].AsBinary(); |
529 | m_assetService.Store(textureAsset); | 580 | m_assetService.Store(textureAsset); |
530 | textures.Add(textureAsset.FullID); | 581 | textures.Add(textureAsset.FullID); |
582 | |||
583 | if (textureUploadFolder != null) | ||
584 | { | ||
585 | InventoryItemBase textureItem = new InventoryItemBase(); | ||
586 | textureItem.Owner = m_HostCapsObj.AgentID; | ||
587 | textureItem.CreatorId = m_HostCapsObj.AgentID.ToString(); | ||
588 | textureItem.CreatorData = String.Empty; | ||
589 | textureItem.ID = UUID.Random(); | ||
590 | textureItem.AssetID = textureAsset.FullID; | ||
591 | textureItem.Description = assetDescription; | ||
592 | textureItem.Name = assetName + " - Texture " + (i + 1).ToString(); | ||
593 | textureItem.AssetType = (int)AssetType.Texture; | ||
594 | textureItem.InvType = (int)InventoryType.Texture; | ||
595 | textureItem.Folder = textureUploadFolder.ID; | ||
596 | textureItem.CurrentPermissions | ||
597 | = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export); | ||
598 | textureItem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; | ||
599 | textureItem.EveryOnePermissions = 0; | ||
600 | textureItem.NextPermissions = (uint)PermissionMask.All; | ||
601 | textureItem.CreationDate = Util.UnixTimeSinceEpoch(); | ||
602 | m_Scene.InventoryService.AddItem(textureItem); | ||
603 | itemsToUpdate.Add(textureItem); | ||
604 | |||
605 | m_log.DebugFormat( | ||
606 | "[BUNCH OF CAPS]: Created new inventory item '{0}' ({1}) for texture uploaded with mesh object {2}", | ||
607 | textureItem.Name, textureItem.ID, assetName); | ||
608 | } | ||
609 | } | ||
610 | |||
611 | if (clientInv != null && (foldersToUpdate.Count > 0 || itemsToUpdate.Count > 0)) | ||
612 | { | ||
613 | clientInv.SendBulkUpdateInventory(foldersToUpdate.ToArray(), itemsToUpdate.ToArray()); | ||
531 | } | 614 | } |
532 | 615 | ||
533 | for (int i = 0; i < mesh_list.Count; i++) | 616 | for (int i = 0; i < mesh_list.Count; i++) |
@@ -701,9 +784,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
701 | // If we set PermissionMask.All then when we rez the item the next permissions will replace the current | 784 | // If we set PermissionMask.All then when we rez the item the next permissions will replace the current |
702 | // (owner) permissions. This becomes a problem if next permissions are changed. | 785 | // (owner) permissions. This becomes a problem if next permissions are changed. |
703 | item.CurrentPermissions | 786 | item.CurrentPermissions |
704 | = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); | 787 | = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export); |
705 | 788 | ||
706 | item.BasePermissions = (uint)PermissionMask.All; | 789 | item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; |
707 | item.EveryOnePermissions = 0; | 790 | item.EveryOnePermissions = 0; |
708 | item.NextPermissions = (uint)PermissionMask.All; | 791 | item.NextPermissions = (uint)PermissionMask.All; |
709 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 792 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
@@ -850,18 +933,26 @@ namespace OpenSim.Region.ClientStack.Linden | |||
850 | item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID)); | 933 | item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID)); |
851 | if (item != null) | 934 | if (item != null) |
852 | { | 935 | { |
853 | copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID); | 936 | string message; |
854 | if (copyItem != null && client != null) | 937 | copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID, out message); |
938 | if (client != null) | ||
855 | { | 939 | { |
856 | m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder); | 940 | if (copyItem != null) |
857 | client.SendBulkUpdateInventory(copyItem); | 941 | { |
942 | m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder); | ||
943 | client.SendBulkUpdateInventory(copyItem); | ||
944 | } | ||
945 | else | ||
946 | { | ||
947 | client.SendAgentAlertMessage(message, false); | ||
948 | } | ||
858 | } | 949 | } |
859 | } | 950 | } |
860 | else | 951 | else |
861 | { | 952 | { |
862 | m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID); | 953 | m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID); |
863 | if (client != null) | 954 | if (client != null) |
864 | client.SendAlertMessage("Failed to retrieve item"); | 955 | client.SendAgentAlertMessage("Failed to retrieve item", false); |
865 | } | 956 | } |
866 | } | 957 | } |
867 | catch (Exception e) | 958 | catch (Exception e) |
@@ -873,17 +964,49 @@ namespace OpenSim.Region.ClientStack.Linden | |||
873 | return LLSDHelpers.SerialiseLLSDReply(response); | 964 | return LLSDHelpers.SerialiseLLSDReply(response); |
874 | } | 965 | } |
875 | 966 | ||
876 | public string UpdateAgentInformation(string request, string path, | 967 | public string GetObjectPhysicsData(string request, string path, |
877 | string param, IOSHttpRequest httpRequest, | 968 | string param, IOSHttpRequest httpRequest, |
878 | IOSHttpResponse httpResponse) | 969 | IOSHttpResponse httpResponse) |
879 | { | 970 | { |
880 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | 971 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); |
881 | OSDMap resp = new OSDMap(); | 972 | OSDMap resp = new OSDMap(); |
973 | OSDArray object_ids = (OSDArray)req["object_ids"]; | ||
882 | 974 | ||
883 | OSDMap accessPrefs = new OSDMap(); | 975 | for (int i = 0 ; i < object_ids.Count ; i++) |
884 | accessPrefs["max"] = "A"; | 976 | { |
977 | UUID uuid = object_ids[i].AsUUID(); | ||
978 | |||
979 | SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid); | ||
980 | if (obj != null) | ||
981 | { | ||
982 | OSDMap object_data = new OSDMap(); | ||
885 | 983 | ||
886 | resp["access_prefs"] = accessPrefs; | 984 | object_data["PhysicsShapeType"] = obj.PhysicsShapeType; |
985 | object_data["Density"] = obj.Density; | ||
986 | object_data["Friction"] = obj.Friction; | ||
987 | object_data["Restitution"] = obj.Restitution; | ||
988 | object_data["GravityMultiplier"] = obj.GravityModifier; | ||
989 | |||
990 | resp[uuid.ToString()] = object_data; | ||
991 | } | ||
992 | } | ||
993 | |||
994 | string response = OSDParser.SerializeLLSDXmlString(resp); | ||
995 | return response; | ||
996 | } | ||
997 | |||
998 | public string UpdateAgentInformation(string request, string path, | ||
999 | string param, IOSHttpRequest httpRequest, | ||
1000 | IOSHttpResponse httpResponse) | ||
1001 | { | ||
1002 | OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
1003 | OSDMap accessPrefs = (OSDMap)req["access_prefs"]; | ||
1004 | string desiredMaturity = accessPrefs["max"]; | ||
1005 | |||
1006 | OSDMap resp = new OSDMap(); | ||
1007 | OSDMap respAccessPrefs = new OSDMap(); | ||
1008 | respAccessPrefs["max"] = desiredMaturity; // echoing the maturity back means success | ||
1009 | resp["access_prefs"] = respAccessPrefs; | ||
887 | 1010 | ||
888 | string response = OSDParser.SerializeLLSDXmlString(resp); | 1011 | string response = OSDParser.SerializeLLSDXmlString(resp); |
889 | return response; | 1012 | return response; |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs index b735dfa..c241075 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs | |||
@@ -40,8 +40,8 @@ using OpenSim.Region.Framework.Interfaces; | |||
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using Caps = OpenSim.Framework.Capabilities.Caps; | 41 | using Caps = OpenSim.Framework.Capabilities.Caps; |
42 | 42 | ||
43 | [assembly: Addin("LindenCaps", "0.1")] | 43 | [assembly: Addin("LindenCaps", OpenSim.VersionInfo.VersionNumber)] |
44 | [assembly: AddinDependency("OpenSim", "0.5")] | 44 | [assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] |
45 | namespace OpenSim.Region.ClientStack.Linden | 45 | namespace OpenSim.Region.ClientStack.Linden |
46 | { | 46 | { |
47 | 47 | ||