aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs26
1 files changed, 18 insertions, 8 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
index 5b7a79d..ec880a7 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
@@ -39,6 +39,7 @@ using OpenMetaverse.StructuredData;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Scenes.Scripting;
42using System.Collections.Generic; 43using System.Collections.Generic;
43using System.Text.RegularExpressions; 44using System.Text.RegularExpressions;
44 45
@@ -256,10 +257,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
256 /// </summary> 257 /// </summary>
257 // ----------------------------------------------------------------- 258 // -----------------------------------------------------------------
258 [ScriptInvocation] 259 [ScriptInvocation]
259 public UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID) 260 public UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, string notecardIdentifier)
260 { 261 {
261 UUID reqID = UUID.Random(); 262 UUID reqID = UUID.Random();
262 Util.FireAndForget(delegate(object o) { DoJsonReadNotecard(reqID,hostID,scriptID,storeID,path,assetID); }); 263 Util.FireAndForget(o => DoJsonReadNotecard(reqID, hostID, scriptID, storeID, path, notecardIdentifier));
263 return reqID; 264 return reqID;
264 } 265 }
265 266
@@ -463,14 +464,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
463 /// 464 ///
464 /// </summary> 465 /// </summary>
465 // ----------------------------------------------------------------- 466 // -----------------------------------------------------------------
466 private void DoJsonReadNotecard(UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID) 467 private void DoJsonReadNotecard(
468 UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, string notecardIdentifier)
467 { 469 {
470 UUID assetID;
471
472 if (!UUID.TryParse(notecardIdentifier, out assetID))
473 {
474 SceneObjectPart part = m_scene.GetSceneObjectPart(hostID);
475 assetID = ScriptUtils.GetAssetIdFromItemName(part, notecardIdentifier, (int)AssetType.Notecard);
476 }
477
468 AssetBase a = m_scene.AssetService.Get(assetID.ToString()); 478 AssetBase a = m_scene.AssetService.Get(assetID.ToString());
469 if (a == null) 479 if (a == null)
470 GenerateRuntimeError(String.Format("Unable to find notecard asset {0}",assetID)); 480 GenerateRuntimeError(String.Format("Unable to find notecard asset {0}", assetID));
471 481
472 if (a.Type != (sbyte)AssetType.Notecard) 482 if (a.Type != (sbyte)AssetType.Notecard)
473 GenerateRuntimeError(String.Format("Invalid notecard asset {0}",assetID)); 483 GenerateRuntimeError(String.Format("Invalid notecard asset {0}", assetID));
474 484
475 m_log.DebugFormat("[JsonStoreScripts]: read notecard in context {0}",storeID); 485 m_log.DebugFormat("[JsonStoreScripts]: read notecard in context {0}",storeID);
476 486
@@ -483,11 +493,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
483 } 493 }
484 catch (Exception e) 494 catch (Exception e)
485 { 495 {
486 m_log.WarnFormat("[JsonStoreScripts]: Json parsing failed; {0}",e.Message); 496 m_log.WarnFormat("[JsonStoreScripts]: Json parsing failed; {0}", e.Message);
487 } 497 }
488 498
489 GenerateRuntimeError(String.Format("Json parsing failed for {0}",assetID.ToString())); 499 GenerateRuntimeError(String.Format("Json parsing failed for {0}", assetID));
490 m_comms.DispatchReply(scriptID,0,"",reqID.ToString()); 500 m_comms.DispatchReply(scriptID, 0, "", reqID.ToString());
491 } 501 }
492 502
493 // ----------------------------------------------------------------- 503 // -----------------------------------------------------------------