aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authordiva2009-04-03 16:08:07 +0000
committerdiva2009-04-03 16:08:07 +0000
commit7322e1921249f4b64a87a1825de1b3b5707b24d6 (patch)
treec337d13a5c84fe8ad2f5e79e4000412450f7b438 /OpenSim/Framework
parent- adding -logconfig option to allow configuration of log4net from (diff)
downloadopensim-SC-7322e1921249f4b64a87a1825de1b3b5707b24d6.zip
opensim-SC-7322e1921249f4b64a87a1825de1b3b5707b24d6.tar.gz
opensim-SC-7322e1921249f4b64a87a1825de1b3b5707b24d6.tar.bz2
opensim-SC-7322e1921249f4b64a87a1825de1b3b5707b24d6.tar.xz
Added one more delegate to Caps, and a few guards, so that these objects can be used from more than just Scenes. Added the NewFileAgentInvengory cap to HGInventoryService.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs42
-rw-r--r--OpenSim/Framework/Communications/Services/HGInventoryService.cs14
2 files changed, 42 insertions, 14 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index 94614a1..1423e3a 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -49,6 +49,8 @@ namespace OpenSim.Framework.Communications.Capabilities
49 49
50 public delegate void NewInventoryItem(UUID userID, InventoryItemBase item); 50 public delegate void NewInventoryItem(UUID userID, InventoryItemBase item);
51 51
52 public delegate void NewAsset(AssetBase asset);
53
52 public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data); 54 public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data);
53 55
54 public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID, 56 public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID,
@@ -120,6 +122,7 @@ namespace OpenSim.Framework.Communications.Capabilities
120 // These are callbacks which will be setup by the scene so that we can update scene data when we 122 // These are callbacks which will be setup by the scene so that we can update scene data when we
121 // receive capability calls 123 // receive capability calls
122 public NewInventoryItem AddNewInventoryItem = null; 124 public NewInventoryItem AddNewInventoryItem = null;
125 public NewAsset AddNewAsset = null;
123 public ItemUpdatedCallback ItemUpdatedCall = null; 126 public ItemUpdatedCallback ItemUpdatedCall = null;
124 public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; 127 public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null;
125 public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; 128 public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null;
@@ -674,30 +677,38 @@ namespace OpenSim.Framework.Communications.Capabilities
674 /// <returns></returns> 677 /// <returns></returns>
675 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) 678 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
676 { 679 {
680 //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString());
681 //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type);
682
677 if (llsdRequest.asset_type == "texture" || 683 if (llsdRequest.asset_type == "texture" ||
678 llsdRequest.asset_type == "animation" || 684 llsdRequest.asset_type == "animation" ||
679 llsdRequest.asset_type == "sound") 685 llsdRequest.asset_type == "sound")
680 { 686 {
681 IClientAPI client = GetClient(m_agentID); 687 IClientAPI client = null;
682 IScene scene = client.Scene; 688 IScene scene = null;
689 if (GetClient != null)
690 {
691 client = GetClient(m_agentID);
692 scene = client.Scene;
683 693
684 IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); 694 IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>();
685 695
686 if (mm != null) 696 if (mm != null)
687 {
688 if (!mm.UploadCovered(client))
689 { 697 {
690 client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); 698 if (!mm.UploadCovered(client))
691 699 {
692 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); 700 if (client != null)
693 errorResponse.uploader = ""; 701 client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
694 errorResponse.state = "error"; 702
695 return errorResponse; 703 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
704 errorResponse.uploader = "";
705 errorResponse.state = "error";
706 return errorResponse;
707 }
696 } 708 }
697 } 709 }
698 } 710 }
699 711
700 //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type);
701 712
702 string assetName = llsdRequest.name; 713 string assetName = llsdRequest.name;
703 string assetDes = llsdRequest.description; 714 string assetDes = llsdRequest.description;
@@ -771,7 +782,10 @@ namespace OpenSim.Framework.Communications.Capabilities
771 asset.Type = assType; 782 asset.Type = assType;
772 asset.Name = assetName; 783 asset.Name = assetName;
773 asset.Data = data; 784 asset.Data = data;
774 m_assetCache.AddAsset(asset); 785 if (AddNewAsset != null)
786 AddNewAsset(asset);
787 else if (m_assetCache != null)
788 m_assetCache.AddAsset(asset);
775 789
776 InventoryItemBase item = new InventoryItemBase(); 790 InventoryItemBase item = new InventoryItemBase();
777 item.Owner = m_agentID; 791 item.Owner = m_agentID;
diff --git a/OpenSim/Framework/Communications/Services/HGInventoryService.cs b/OpenSim/Framework/Communications/Services/HGInventoryService.cs
index 7eaed89..d59d1ae 100644
--- a/OpenSim/Framework/Communications/Services/HGInventoryService.cs
+++ b/OpenSim/Framework/Communications/Services/HGInventoryService.cs
@@ -234,6 +234,11 @@ namespace OpenSim.Framework.Communications.Services
234 } 234 }
235 } 235 }
236 236
237 public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item)
238 {
239 AddItem(item);
240 }
241
237 public InventoryItemBase UpdateItem(InventoryItemBase item) 242 public InventoryItemBase UpdateItem(InventoryItemBase item)
238 { 243 {
239 m_log.DebugFormat("[HGStandaloneInvService]: Update item {0} from {1}", item.ID, item.Owner); 244 m_log.DebugFormat("[HGStandaloneInvService]: Update item {0} from {1}", item.ID, item.Owner);
@@ -372,6 +377,11 @@ namespace OpenSim.Framework.Communications.Services
372 return true; 377 return true;
373 } 378 }
374 379
380 public void PostAnAsset(AssetBase asset)
381 {
382 PostAsset(asset);
383 }
384
375 /// <summary> 385 /// <summary>
376 /// <see>CapsUpdatedInventoryItemAsset(IClientAPI, UUID, byte[])</see> 386 /// <see>CapsUpdatedInventoryItemAsset(IClientAPI, UUID, byte[])</see>
377 /// </summary> 387 /// </summary>
@@ -598,6 +608,10 @@ namespace OpenSim.Framework.Communications.Services
598 Caps caps = new Caps(null, httpServer, m_thisHostname, m_thisPort, authToken, userID, false, "Inventory"); 608 Caps caps = new Caps(null, httpServer, m_thisHostname, m_thisPort, authToken, userID, false, "Inventory");
599 caps.RegisterInventoryServiceHandlers("/" + authToken + "/InventoryCap/"); 609 caps.RegisterInventoryServiceHandlers("/" + authToken + "/InventoryCap/");
600 caps.ItemUpdatedCall = UpdateInventoryItemAsset; 610 caps.ItemUpdatedCall = UpdateInventoryItemAsset;
611 caps.AddNewInventoryItem = AddUploadedInventoryItem;
612 caps.AddNewAsset = PostAnAsset;
613 //caps.GetClient =
614
601 Hashtable capsHandlers = caps.CapsHandlers.CapsDetails; 615 Hashtable capsHandlers = caps.CapsHandlers.CapsDetails;
602 616
603 httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<Guid, InventoryCollection>( 617 httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<Guid, InventoryCollection>(