diff options
Diffstat (limited to '')
7 files changed, 343 insertions, 11 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index eb678a0..a72abbe 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -42,21 +42,29 @@ namespace OpenSim.Region.Capabilities | |||
42 | string inventoryType, string assetType); | 42 | string inventoryType, string assetType); |
43 | 43 | ||
44 | public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); | 44 | public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); |
45 | |||
46 | public delegate LLUUID UpdateTaskScript(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data); | ||
45 | 47 | ||
46 | public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); | 48 | public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); |
47 | 49 | ||
48 | public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); | 50 | public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); |
51 | |||
52 | public delegate LLUUID TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID, | ||
53 | bool isScriptRunning, byte[] data); | ||
49 | 54 | ||
50 | public class Caps | 55 | public class Caps |
51 | { | 56 | { |
52 | private string m_httpListenerHostName; | 57 | private string m_httpListenerHostName; |
53 | private uint m_httpListenPort; | 58 | private uint m_httpListenPort; |
59 | |||
54 | private string m_capsObjectPath = "00001-"; | 60 | private string m_capsObjectPath = "00001-"; |
55 | private string m_requestPath = "0000/"; | 61 | private string m_requestPath = "0000/"; |
56 | private string m_mapLayerPath = "0001/"; | 62 | private string m_mapLayerPath = "0001/"; |
57 | private string m_newInventory = "0002/"; | 63 | private string m_newInventory = "0002/"; |
58 | //private string m_requestTexture = "0003/"; | 64 | //private string m_requestTexture = "0003/"; |
59 | private string m_notecardUpdatePath = "0004/"; | 65 | private string m_notecardUpdatePath = "0004/"; |
66 | private string m_notecardTaskUpdatePath = "0005/"; | ||
67 | |||
60 | //private string eventQueue = "0100/"; | 68 | //private string eventQueue = "0100/"; |
61 | private BaseHttpServer m_httpListener; | 69 | private BaseHttpServer m_httpListener; |
62 | private LLUUID m_agentID; | 70 | private LLUUID m_agentID; |
@@ -65,8 +73,11 @@ namespace OpenSim.Region.Capabilities | |||
65 | private Queue<string> m_capsEventQueue = new Queue<string>(); | 73 | private Queue<string> m_capsEventQueue = new Queue<string>(); |
66 | private bool m_dumpAssetsToFile; | 74 | private bool m_dumpAssetsToFile; |
67 | 75 | ||
76 | // These are callbacks which will be setup by the scene so that we can update scene data when we | ||
77 | // receive capability calls | ||
68 | public NewInventoryItem AddNewInventoryItem = null; | 78 | public NewInventoryItem AddNewInventoryItem = null; |
69 | public ItemUpdatedCallback ItemUpdatedCall = null; | 79 | public ItemUpdatedCallback ItemUpdatedCall = null; |
80 | public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; | ||
70 | 81 | ||
71 | public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, | 82 | public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, |
72 | LLUUID agent, bool dumpAssetsToFile) | 83 | LLUUID agent, bool dumpAssetsToFile) |
@@ -100,9 +111,11 @@ namespace OpenSim.Region.Capabilities | |||
100 | AddLegacyCapsHandler(m_httpListener, m_requestPath, CapsRequest); | 111 | AddLegacyCapsHandler(m_httpListener, m_requestPath, CapsRequest); |
101 | //AddLegacyCapsHandler(m_httpListener, m_requestTexture , RequestTexture); | 112 | //AddLegacyCapsHandler(m_httpListener, m_requestTexture , RequestTexture); |
102 | AddLegacyCapsHandler(m_httpListener, m_notecardUpdatePath, NoteCardAgentInventory); | 113 | AddLegacyCapsHandler(m_httpListener, m_notecardUpdatePath, NoteCardAgentInventory); |
114 | AddLegacyCapsHandler(m_httpListener, m_notecardTaskUpdatePath, ScriptTaskInventory); | ||
103 | } | 115 | } |
104 | catch | 116 | catch (Exception e) |
105 | { | 117 | { |
118 | MainLog.Instance.Error("CAPS", e.ToString()); | ||
106 | } | 119 | } |
107 | } | 120 | } |
108 | 121 | ||
@@ -117,7 +130,7 @@ namespace OpenSim.Region.Capabilities | |||
117 | } | 130 | } |
118 | 131 | ||
119 | /// <summary> | 132 | /// <summary> |
120 | /// | 133 | /// Construct a client response detailing all the capabilities this server can provide. |
121 | /// </summary> | 134 | /// </summary> |
122 | /// <param name="request"></param> | 135 | /// <param name="request"></param> |
123 | /// <param name="path"></param> | 136 | /// <param name="path"></param> |
@@ -131,7 +144,7 @@ namespace OpenSim.Region.Capabilities | |||
131 | } | 144 | } |
132 | 145 | ||
133 | /// <summary> | 146 | /// <summary> |
134 | /// | 147 | /// Return an LLSDCapsDetails listing all the capabilities this server can provide |
135 | /// </summary> | 148 | /// </summary> |
136 | /// <returns></returns> | 149 | /// <returns></returns> |
137 | protected LLSDCapsDetails GetCapabilities() | 150 | protected LLSDCapsDetails GetCapabilities() |
@@ -144,7 +157,7 @@ namespace OpenSim.Region.Capabilities | |||
144 | caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; | 157 | caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; |
145 | caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; | 158 | caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; |
146 | caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; | 159 | caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; |
147 | // caps.UpdateScriptTaskInventory = capsBaseUrl + m_requestTexture; | 160 | caps.UpdateScriptTaskInventory = capsBaseUrl + m_notecardTaskUpdatePath; |
148 | return caps; | 161 | return caps; |
149 | } | 162 | } |
150 | 163 | ||
@@ -249,9 +262,65 @@ namespace OpenSim.Region.Capabilities | |||
249 | } | 262 | } |
250 | 263 | ||
251 | #endregion | 264 | #endregion |
265 | |||
266 | /// <summary> | ||
267 | /// Callback for a client request for an upload url for a script task | ||
268 | /// inventory update | ||
269 | /// </summary> | ||
270 | /// <param name="request"></param> | ||
271 | /// <param name="path"></param> | ||
272 | /// <param name="param"></param> | ||
273 | /// <returns></returns> | ||
274 | public string ScriptTaskInventory(string request, string path, string param) | ||
275 | { | ||
276 | try | ||
277 | { | ||
278 | // MainLog.Instance.Debug("CAPS", "request: {0}, path: {1}, param: {2}", request, path, param); | ||
279 | |||
280 | Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); | ||
281 | LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); | ||
282 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdUpdateRequest); | ||
283 | |||
284 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
285 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
286 | |||
287 | TaskInventoryScriptUpdater uploader = | ||
288 | new TaskInventoryScriptUpdater( | ||
289 | llsdUpdateRequest.item_id, | ||
290 | llsdUpdateRequest.task_id, | ||
291 | llsdUpdateRequest.is_script_running, | ||
292 | capsBase + uploaderPath, | ||
293 | m_httpListener, | ||
294 | m_dumpAssetsToFile); | ||
295 | uploader.OnUpLoad += TaskScriptUpdated; | ||
296 | |||
297 | m_httpListener.AddStreamHandler( | ||
298 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | ||
299 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + | ||
300 | uploaderPath; | ||
301 | |||
302 | LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); | ||
303 | uploadResponse.uploader = uploaderURL; | ||
304 | uploadResponse.state = "upload"; | ||
305 | |||
306 | // MainLog.Instance.Verbose( | ||
307 | // "CAPS", | ||
308 | // "ScriptTaskInventory response: {0}", | ||
309 | // LLSDHelpers.SerialiseLLSDReply(uploadResponse)); | ||
310 | |||
311 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | ||
312 | } | ||
313 | catch (Exception e) | ||
314 | { | ||
315 | MainLog.Instance.Error("CAPS", e.ToString()); | ||
316 | } | ||
317 | |||
318 | return null; | ||
319 | } | ||
252 | 320 | ||
253 | /// <summary> | 321 | /// <summary> |
254 | /// | 322 | /// Callback for a client request for an upload url for a notecard (or script) |
323 | /// agent inventory update | ||
255 | /// </summary> | 324 | /// </summary> |
256 | /// <param name="request"></param> | 325 | /// <param name="request"></param> |
257 | /// <param name="path"></param> | 326 | /// <param name="path"></param> |
@@ -265,11 +334,10 @@ namespace OpenSim.Region.Capabilities | |||
265 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); | 334 | LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); |
266 | 335 | ||
267 | string capsBase = "/CAPS/" + m_capsObjectPath; | 336 | string capsBase = "/CAPS/" + m_capsObjectPath; |
268 | LLUUID newInvItem = llsdRequest.item_id; | ||
269 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 337 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
270 | 338 | ||
271 | ItemUpdater uploader = | 339 | ItemUpdater uploader = |
272 | new ItemUpdater(newInvItem, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile); | 340 | new ItemUpdater(llsdRequest.item_id, capsBase + uploaderPath, m_httpListener, m_dumpAssetsToFile); |
273 | uploader.OnUpLoad += ItemUpdated; | 341 | uploader.OnUpLoad += ItemUpdated; |
274 | 342 | ||
275 | m_httpListener.AddStreamHandler( | 343 | m_httpListener.AddStreamHandler( |
@@ -281,6 +349,8 @@ namespace OpenSim.Region.Capabilities | |||
281 | uploadResponse.uploader = uploaderURL; | 349 | uploadResponse.uploader = uploaderURL; |
282 | uploadResponse.state = "upload"; | 350 | uploadResponse.state = "upload"; |
283 | 351 | ||
352 | MainLog.Instance.Verbose("CAPS", "NoteCardAgentInventory response: {0}", LLSDHelpers.SerialiseLLSDReply(uploadResponse)); | ||
353 | |||
284 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); | 354 | return LLSDHelpers.SerialiseLLSDReply(uploadResponse); |
285 | } | 355 | } |
286 | 356 | ||
@@ -368,12 +438,36 @@ namespace OpenSim.Region.Capabilities | |||
368 | } | 438 | } |
369 | } | 439 | } |
370 | 440 | ||
441 | /// <summary> | ||
442 | /// Called when new asset data for an agent inventory item update has been uploaded. | ||
443 | /// </summary> | ||
444 | /// <param name="itemID">Item to update</param> | ||
445 | /// <param name="data">New asset data</param> | ||
446 | /// <returns></returns> | ||
371 | public LLUUID ItemUpdated(LLUUID itemID, byte[] data) | 447 | public LLUUID ItemUpdated(LLUUID itemID, byte[] data) |
372 | { | 448 | { |
373 | if (ItemUpdatedCall != null) | 449 | if (ItemUpdatedCall != null) |
374 | { | 450 | { |
375 | return ItemUpdatedCall(m_agentID, itemID, data); | 451 | return ItemUpdatedCall(m_agentID, itemID, data); |
376 | } | 452 | } |
453 | |||
454 | return LLUUID.Zero; | ||
455 | } | ||
456 | |||
457 | /// <summary> | ||
458 | /// Called when new asset data for an agent inventory item update has been uploaded. | ||
459 | /// </summary> | ||
460 | /// <param name="itemID">Item to update</param> | ||
461 | /// <param name="primID">Prim containing item to update</param> | ||
462 | /// <param name="isScriptRunning">Signals whether the script to update is currently running</param> | ||
463 | /// <param name="data">New asset data</param> | ||
464 | public LLUUID TaskScriptUpdated(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data) | ||
465 | { | ||
466 | if (TaskScriptUpdatedCall != null) | ||
467 | { | ||
468 | return TaskScriptUpdatedCall(m_agentID, itemID, primID, isScriptRunning, data); | ||
469 | } | ||
470 | |||
377 | return LLUUID.Zero; | 471 | return LLUUID.Zero; |
378 | } | 472 | } |
379 | 473 | ||
@@ -452,6 +546,10 @@ namespace OpenSim.Region.Capabilities | |||
452 | } | 546 | } |
453 | } | 547 | } |
454 | 548 | ||
549 | /// <summary> | ||
550 | /// This class is a callback invoked when a client sends asset data to | ||
551 | /// an agent inventory notecard update url | ||
552 | /// </summary> | ||
455 | public class ItemUpdater | 553 | public class ItemUpdater |
456 | { | 554 | { |
457 | public event UpdateItem OnUpLoad; | 555 | public event UpdateItem OnUpLoad; |
@@ -514,5 +612,96 @@ namespace OpenSim.Region.Capabilities | |||
514 | fs.Close(); | 612 | fs.Close(); |
515 | } | 613 | } |
516 | } | 614 | } |
615 | |||
616 | /// <summary> | ||
617 | /// This class is a callback invoked when a client sends asset data to | ||
618 | /// a task inventory script update url | ||
619 | /// </summary> | ||
620 | public class TaskInventoryScriptUpdater | ||
621 | { | ||
622 | public event UpdateTaskScript OnUpLoad; | ||
623 | |||
624 | private string uploaderPath = ""; | ||
625 | private LLUUID inventoryItemID; | ||
626 | private LLUUID primID; | ||
627 | private bool isScriptRunning; | ||
628 | private BaseHttpServer httpListener; | ||
629 | private bool m_dumpAssetToFile; | ||
630 | |||
631 | public TaskInventoryScriptUpdater(LLUUID inventoryItemID, LLUUID primID, int isScriptRunning, | ||
632 | string path, BaseHttpServer httpServer, bool dumpAssetToFile) | ||
633 | { | ||
634 | m_dumpAssetToFile = dumpAssetToFile; | ||
635 | |||
636 | this.inventoryItemID = inventoryItemID; | ||
637 | this.primID = primID; | ||
638 | |||
639 | // This comes in over the packet as an integer, but actually appears to be treated as a bool | ||
640 | this.isScriptRunning = (0 == isScriptRunning ? false : true); | ||
641 | |||
642 | uploaderPath = path; | ||
643 | httpListener = httpServer; | ||
644 | } | ||
645 | |||
646 | /// <summary> | ||
647 | /// | ||
648 | /// </summary> | ||
649 | /// <param name="data"></param> | ||
650 | /// <param name="path"></param> | ||
651 | /// <param name="param"></param> | ||
652 | /// <returns></returns> | ||
653 | public string uploaderCaps(byte[] data, string path, string param) | ||
654 | { | ||
655 | try | ||
656 | { | ||
657 | // MainLog.Instance.Verbose( | ||
658 | // "CAPS", | ||
659 | // "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", | ||
660 | // data, path, param); | ||
661 | |||
662 | string res = ""; | ||
663 | LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete(); | ||
664 | LLUUID assetID = LLUUID.Zero; | ||
665 | |||
666 | if (OnUpLoad != null) | ||
667 | { | ||
668 | assetID = OnUpLoad(inventoryItemID, primID, isScriptRunning, data); | ||
669 | } | ||
670 | |||
671 | uploadComplete.item_id = inventoryItemID; | ||
672 | uploadComplete.task_id = primID; | ||
673 | uploadComplete.state = "complete"; | ||
674 | |||
675 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | ||
676 | |||
677 | httpListener.RemoveStreamHandler("POST", uploaderPath); | ||
678 | |||
679 | if (m_dumpAssetToFile) | ||
680 | { | ||
681 | SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data); | ||
682 | } | ||
683 | |||
684 | // MainLog.Instance.Verbose("CAPS", "TaskInventoryScriptUpdater.uploaderCaps res: {0}", res); | ||
685 | |||
686 | return res; | ||
687 | } | ||
688 | catch (Exception e) | ||
689 | { | ||
690 | MainLog.Instance.Error("CAPS", e.ToString()); | ||
691 | } | ||
692 | |||
693 | // XXX Maybe this should be some meaningful error packet | ||
694 | return null; | ||
695 | } | ||
696 | |||
697 | private void SaveAssetToFile(string filename, byte[] data) | ||
698 | { | ||
699 | FileStream fs = File.Create(filename); | ||
700 | BinaryWriter bw = new BinaryWriter(fs); | ||
701 | bw.Write(data); | ||
702 | bw.Close(); | ||
703 | fs.Close(); | ||
704 | } | ||
705 | } | ||
517 | } | 706 | } |
518 | } | 707 | } |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs index c50d0a9..dfb1683 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Capabilities | |||
38 | // public string ChatSessionRequest = ""; | 38 | // public string ChatSessionRequest = ""; |
39 | public string UpdateNotecardAgentInventory = ""; | 39 | public string UpdateNotecardAgentInventory = ""; |
40 | public string UpdateScriptAgentInventory = ""; | 40 | public string UpdateScriptAgentInventory = ""; |
41 | // public string UpdateScriptTaskInventory = ""; | 41 | public string UpdateScriptTaskInventory = ""; |
42 | // public string ParcelVoiceInfoRequest = ""; | 42 | // public string ParcelVoiceInfoRequest = ""; |
43 | 43 | ||
44 | public LLSDCapsDetails() | 44 | public LLSDCapsDetails() |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs new file mode 100644 index 0000000..3703efc --- /dev/null +++ b/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using libsecondlife; | ||
29 | |||
30 | namespace OpenSim.Region.Capabilities | ||
31 | { | ||
32 | [LLSDMap] | ||
33 | public class LLSDTaskInventoryUploadComplete | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// The task inventory item that was updated | ||
37 | /// </summary> | ||
38 | public LLUUID item_id; | ||
39 | |||
40 | /// <summary> | ||
41 | /// The task that was updated | ||
42 | /// </summary> | ||
43 | public LLUUID task_id; | ||
44 | |||
45 | /// <summary> | ||
46 | /// State of the upload. So far have only even seen this set to "complete" | ||
47 | /// </summary> | ||
48 | public string state; | ||
49 | } | ||
50 | } | ||
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs new file mode 100644 index 0000000..6dcf2b5 --- /dev/null +++ b/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using libsecondlife; | ||
30 | |||
31 | namespace OpenSim.Region.Capabilities | ||
32 | { | ||
33 | [LLSDMap] | ||
34 | public class LLSDTaskScriptUpdate | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// The item containing the script to update | ||
38 | /// </summary> | ||
39 | public LLUUID item_id; | ||
40 | |||
41 | /// <summary> | ||
42 | /// The task containing the script | ||
43 | /// </summary> | ||
44 | public LLUUID task_id; | ||
45 | |||
46 | /// <summary> | ||
47 | /// Signals whether the script is currently active | ||
48 | /// </summary> | ||
49 | public int is_script_running; | ||
50 | } | ||
51 | } | ||
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index cc540e7..d946e00 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -260,7 +260,7 @@ namespace OpenSim.Framework.UserManagement | |||
260 | /// <param name="request">The users loginrequest</param> | 260 | /// <param name="request">The users loginrequest</param> |
261 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) | 261 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) |
262 | { | 262 | { |
263 | Hashtable requestData = (Hashtable) request.Params[0]; | 263 | //Hashtable requestData = (Hashtable) request.Params[0]; |
264 | 264 | ||
265 | UserAgentData agent = new UserAgentData(); | 265 | UserAgentData agent = new UserAgentData(); |
266 | 266 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 2d0ffd8..531e8de 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -74,6 +74,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
74 | return LLUUID.Zero; | 74 | return LLUUID.Zero; |
75 | } | 75 | } |
76 | 76 | ||
77 | /// <summary> | ||
78 | /// Capability originating call to update the asset of an item in an agent's inventory | ||
79 | /// </summary> | ||
80 | /// <param name="remoteClient"></param> | ||
81 | /// <param name="itemID"></param> | ||
82 | /// <param name="data"></param> | ||
83 | /// <returns></returns> | ||
77 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) | 84 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) |
78 | { | 85 | { |
79 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 86 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
@@ -106,6 +113,39 @@ namespace OpenSim.Region.Environment.Scenes | |||
106 | } | 113 | } |
107 | return LLUUID.Zero; | 114 | return LLUUID.Zero; |
108 | } | 115 | } |
116 | |||
117 | /// <summary> | ||
118 | /// Capability originating call to update the asset of a script in a prim's (task's) inventory | ||
119 | /// </summary> | ||
120 | /// <param name="remoteClient"></param> | ||
121 | /// <param name="itemID"></param> | ||
122 | /// <param name="primID">The prim which contains the item to update</param> | ||
123 | /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param> | ||
124 | /// <param name="data"></param> | ||
125 | /// <returns>Asset LLUID created</returns> | ||
126 | public LLUUID CapsUpdateTaskInventoryScriptAsset(LLUUID avatarID, LLUUID itemID, | ||
127 | LLUUID primID, bool isScriptRunning, byte[] data) | ||
128 | { | ||
129 | // TODO Not currently doing anything with the isScriptRunning bool | ||
130 | |||
131 | MainLog.Instance.Verbose( | ||
132 | "PRIMINVENTORY", | ||
133 | "Prim inventory script save functionality not yet implemented." | ||
134 | + " remoteClient: {0}, itemID: {1}, primID: {2}, isScriptRunning: {3}", | ||
135 | avatarID, itemID, primID, isScriptRunning); | ||
136 | |||
137 | // TODO | ||
138 | // Retrieve client LLUID | ||
139 | // Retrieve sog containing primID | ||
140 | // Retrieve item | ||
141 | // Create new asset and add to cache | ||
142 | // Update item with new asset | ||
143 | // Trigger SOG update (see RezScript) | ||
144 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) | ||
145 | // return new asset id | ||
146 | |||
147 | return null; | ||
148 | } | ||
109 | 149 | ||
110 | /// <summary> | 150 | /// <summary> |
111 | /// Update an item which is either already in the client's inventory or is within | 151 | /// Update an item which is either already in the client's inventory or is within |
@@ -470,7 +510,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
470 | if (rezAsset != null) | 510 | if (rezAsset != null) |
471 | { | 511 | { |
472 | string script = Util.FieldToString(rezAsset.Data); | 512 | string script = Util.FieldToString(rezAsset.Data); |
473 | //Console.WriteLine("rez script "+script); | ||
474 | EventManager.TriggerRezScript(localID, copyID, script); | 513 | EventManager.TriggerRezScript(localID, copyID, script); |
475 | rezzed = true; | 514 | rezzed = true; |
476 | } | 515 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index cf17686..2a25316 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1350,10 +1350,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1350 | agent.CapsPath, agent.AgentID, m_dumpAssetsToFile); | 1350 | agent.CapsPath, agent.AgentID, m_dumpAssetsToFile); |
1351 | 1351 | ||
1352 | Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + | 1352 | Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + |
1353 | "/CAPS/" + agent.CapsPath + "0000/"); | 1353 | "/CAPS/" + agent.CapsPath + "0000/"); |
1354 | cap.RegisterHandlers(); | 1354 | cap.RegisterHandlers(); |
1355 | |||
1355 | cap.AddNewInventoryItem = AddInventoryItem; | 1356 | cap.AddNewInventoryItem = AddInventoryItem; |
1356 | cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset; | 1357 | cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset; |
1358 | cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset; | ||
1359 | |||
1357 | if (m_capsHandlers.ContainsKey(agent.AgentID)) | 1360 | if (m_capsHandlers.ContainsKey(agent.AgentID)) |
1358 | { | 1361 | { |
1359 | //MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + | 1362 | //MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + |