aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-02-06 01:37:22 +0000
committerJustin Clark-Casey (justincc)2013-02-06 01:37:22 +0000
commiteddfed3812354c5990631be0ac985cc25d5aa0e9 (patch)
tree10223d60590ab2ccb70b66edbd1abb8f13d57e9b /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-eddfed3812354c5990631be0ac985cc25d5aa0e9.zip
opensim-SC_OLD-eddfed3812354c5990631be0ac985cc25d5aa0e9.tar.gz
opensim-SC_OLD-eddfed3812354c5990631be0ac985cc25d5aa0e9.tar.bz2
opensim-SC_OLD-eddfed3812354c5990631be0ac985cc25d5aa0e9.tar.xz
Allow JsonReadNotecard() to accept the name of the notecard as well as the asset ID.
Agreed in discussion with cmickeyb. This is to make this consistent with similar existing LSL/OSSL functions such as llTriggerSound() and osNpcLoadAppearance() that allow an item name or an asset id.
Diffstat (limited to 'OpenSim')
-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 // -----------------------------------------------------------------