diff options
author | ft@noemail | 2015-03-04 00:17:24 +0100 |
---|---|---|
committer | BlueWall | 2015-03-03 18:39:49 -0500 |
commit | fb48ee1cb608f5facdcd257f13a7e49c2ce52946 (patch) | |
tree | fac8f7d3437031fe7e6e4fed9e1cf13562cb3f78 /OpenSim/Region | |
parent | Revert "corrected osMakeNotecard(string data) text length was calculated wron... (diff) | |
download | opensim-SC-fb48ee1cb608f5facdcd257f13a7e49c2ce52946.zip opensim-SC-fb48ee1cb608f5facdcd257f13a7e49c2ce52946.tar.gz opensim-SC-fb48ee1cb608f5facdcd257f13a7e49c2ce52946.tar.bz2 opensim-SC-fb48ee1cb608f5facdcd257f13a7e49c2ce52946.tar.xz |
corrected script notecard parser. It now handles notecards with inventory as well.
Signed-off-by: BlueWall <jamesh@bluewallgroup.com>
Diffstat (limited to 'OpenSim/Region')
3 files changed, 18 insertions, 10 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index b69676b..edf51a2 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | |||
@@ -595,11 +595,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
595 | 595 | ||
596 | try | 596 | try |
597 | { | 597 | { |
598 | string jsondata = SLUtil.ParseNotecardToString(Encoding.UTF8.GetString(a.Data)); | 598 | string jsondata = SLUtil.ParseNotecardToString(a.Data); |
599 | int result = m_store.SetValue(storeID, path, jsondata,true) ? 1 : 0; | 599 | int result = m_store.SetValue(storeID, path, jsondata,true) ? 1 : 0; |
600 | m_comms.DispatchReply(scriptID, result, "", reqID.ToString()); | 600 | m_comms.DispatchReply(scriptID, result, "", reqID.ToString()); |
601 | return; | 601 | return; |
602 | } | 602 | } |
603 | catch(SLUtil.NotANotecardFormatException e) | ||
604 | { | ||
605 | m_log.WarnFormat("[JsonStoreScripts]: Notecard parsing failed; assetId {0} at line number {1}", assetID.ToString(), e.lineNumber); | ||
606 | } | ||
603 | catch (Exception e) | 607 | catch (Exception e) |
604 | { | 608 | { |
605 | m_log.WarnFormat("[JsonStoreScripts]: Json parsing failed; {0}", e.Message); | 609 | m_log.WarnFormat("[JsonStoreScripts]: Json parsing failed; {0}", e.Message); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bb8ec9c..6a30da2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -11632,9 +11632,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11632 | return; | 11632 | return; |
11633 | } | 11633 | } |
11634 | 11634 | ||
11635 | string data = Encoding.UTF8.GetString(a.Data); | 11635 | NotecardCache.Cache(id, a.Data); |
11636 | //m_log.Debug(data); | ||
11637 | NotecardCache.Cache(id, data); | ||
11638 | AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(id).ToString()); | 11636 | AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(id).ToString()); |
11639 | }); | 11637 | }); |
11640 | 11638 | ||
@@ -11688,7 +11686,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11688 | 11686 | ||
11689 | string data = Encoding.UTF8.GetString(a.Data); | 11687 | string data = Encoding.UTF8.GetString(a.Data); |
11690 | //m_log.Debug(data); | 11688 | //m_log.Debug(data); |
11691 | NotecardCache.Cache(id, data); | 11689 | NotecardCache.Cache(id, a.Data); |
11692 | AsyncCommands.DataserverPlugin.DataserverReply( | 11690 | AsyncCommands.DataserverPlugin.DataserverReply( |
11693 | reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); | 11691 | reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); |
11694 | }); | 11692 | }); |
@@ -12461,10 +12459,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12461 | public DateTime lastRef; | 12459 | public DateTime lastRef; |
12462 | } | 12460 | } |
12463 | 12461 | ||
12464 | protected static Dictionary<UUID, Notecard> m_Notecards = | 12462 | private static Dictionary<UUID, Notecard> m_Notecards = |
12465 | new Dictionary<UUID, Notecard>(); | 12463 | new Dictionary<UUID, Notecard>(); |
12466 | 12464 | ||
12467 | public static void Cache(UUID assetID, string text) | 12465 | public static void Cache(UUID assetID, byte[] text) |
12468 | { | 12466 | { |
12469 | CheckCache(); | 12467 | CheckCache(); |
12470 | 12468 | ||
@@ -12475,7 +12473,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12475 | 12473 | ||
12476 | Notecard nc = new Notecard(); | 12474 | Notecard nc = new Notecard(); |
12477 | nc.lastRef = DateTime.Now; | 12475 | nc.lastRef = DateTime.Now; |
12478 | nc.text = SLUtil.ParseNotecardToList(text).ToArray(); | 12476 | try |
12477 | { | ||
12478 | nc.text = SLUtil.ParseNotecardToArray(text); | ||
12479 | } | ||
12480 | catch(SLUtil.NotANotecardFormatException) | ||
12481 | { | ||
12482 | nc.text = new string[0]; | ||
12483 | } | ||
12479 | m_Notecards[assetID] = nc; | 12484 | m_Notecards[assetID] = nc; |
12480 | } | 12485 | } |
12481 | } | 12486 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 10ddf14..3afebe2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1926,8 +1926,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1926 | if (a == null) | 1926 | if (a == null) |
1927 | return UUID.Zero; | 1927 | return UUID.Zero; |
1928 | 1928 | ||
1929 | string data = Encoding.UTF8.GetString(a.Data); | 1929 | NotecardCache.Cache(assetID, a.Data); |
1930 | NotecardCache.Cache(assetID, data); | ||
1931 | }; | 1930 | }; |
1932 | 1931 | ||
1933 | return assetID; | 1932 | return assetID; |