aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2009-04-22 01:43:07 +0000
committerMelanie Thielker2009-04-22 01:43:07 +0000
commit338655e9d59d85556cbc4b8ebcd8542bb818d81d (patch)
tree2f1dc3bb7ae14c5fead5518d2fef6f7ee0e60935
parentAdd copyright headers. Formatting cleanup. (diff)
downloadopensim-SC-338655e9d59d85556cbc4b8ebcd8542bb818d81d.zip
opensim-SC-338655e9d59d85556cbc4b8ebcd8542bb818d81d.tar.gz
opensim-SC-338655e9d59d85556cbc4b8ebcd8542bb818d81d.tar.bz2
opensim-SC-338655e9d59d85556cbc4b8ebcd8542bb818d81d.tar.xz
Fix loading notecards from LSL. The first time a notecard was accessed, the
ID returned from the call would differ from the one later sent via dataserver(), causing AOs to fail.
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs70
1 files changed, 21 insertions, 49 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ae4fcbc..deb4dae 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9190,16 +9190,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9190 { 9190 {
9191 // => complain loudly, as specified by the LSL docs 9191 // => complain loudly, as specified by the LSL docs
9192 ShoutError("Notecard '" + name + "' could not be found."); 9192 ShoutError("Notecard '" + name + "' could not be found.");
9193
9194 return UUID.Zero.ToString();
9193 } 9195 }
9194 9196
9195 UUID tid = UUID.Zero; 9197 UUID tid = tid = AsyncCommands.
9198 DataserverPlugin.RegisterRequest(m_localID,
9199 m_itemID, assetID.ToString());
9196 9200
9197 if (NotecardCache.IsCached(assetID)) 9201 if (NotecardCache.IsCached(assetID))
9198 { 9202 {
9199 tid = AsyncCommands.
9200 DataserverPlugin.RegisterRequest(m_localID,
9201 m_itemID, assetID.ToString());
9202
9203 AsyncCommands. 9203 AsyncCommands.
9204 DataserverPlugin.DataserverReply(assetID.ToString(), 9204 DataserverPlugin.DataserverReply(assetID.ToString(),
9205 NotecardCache.GetLines(assetID).ToString()); 9205 NotecardCache.GetLines(assetID).ToString());
@@ -9209,16 +9209,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9209 9209
9210 WithNotecard(assetID, delegate (UUID id, AssetBase a) 9210 WithNotecard(assetID, delegate (UUID id, AssetBase a)
9211 { 9211 {
9212 if (a == null) 9212 if (a == null || a.Type != 7)
9213 return; 9213 {
9214 9214 ShoutError("Notecard '" + name + "' could not be found.");
9215 if (a.Type != 7)
9216 return; 9215 return;
9216 }
9217 9217
9218 tid = AsyncCommands.
9219 DataserverPlugin.RegisterRequest(m_localID,
9220 m_itemID, assetID.ToString());
9221
9222 System.Text.ASCIIEncoding enc = 9218 System.Text.ASCIIEncoding enc =
9223 new System.Text.ASCIIEncoding(); 9219 new System.Text.ASCIIEncoding();
9224 string data = enc.GetString(a.Data); 9220 string data = enc.GetString(a.Data);
@@ -9229,18 +9225,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9229 NotecardCache.GetLines(id).ToString()); 9225 NotecardCache.GetLines(id).ToString());
9230 }); 9226 });
9231 9227
9232 if (tid != UUID.Zero)
9233 {
9234 // ScriptSleep(100);
9235 return tid.ToString();
9236 }
9237
9238 // if we got to here, we didn't find the notecard the script was asking for
9239 // => complain loudly, as specified by the LSL docs
9240 ShoutError("Notecard '" + name + "' could not be found.");
9241
9242 // ScriptSleep(100); 9228 // ScriptSleep(100);
9243 return UUID.Zero.ToString(); 9229 return tid.ToString();
9244 } 9230 }
9245 9231
9246 public LSL_String llGetNotecardLine(string name, int line) 9232 public LSL_String llGetNotecardLine(string name, int line)
@@ -9267,16 +9253,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9267 { 9253 {
9268 // => complain loudly, as specified by the LSL docs 9254 // => complain loudly, as specified by the LSL docs
9269 ShoutError("Notecard '" + name + "' could not be found."); 9255 ShoutError("Notecard '" + name + "' could not be found.");
9270 }
9271 9256
9272 UUID tid = UUID.Zero; 9257 return UUID.Zero.ToString();
9258 }
9273 9259
9260 UUID tid = tid = AsyncCommands.
9261 DataserverPlugin.RegisterRequest(m_localID,
9262 m_itemID, assetID.ToString());
9263
9274 if (NotecardCache.IsCached(assetID)) 9264 if (NotecardCache.IsCached(assetID))
9275 { 9265 {
9276 tid = AsyncCommands.
9277 DataserverPlugin.RegisterRequest(m_localID,
9278 m_itemID, assetID.ToString());
9279
9280 AsyncCommands. 9266 AsyncCommands.
9281 DataserverPlugin.DataserverReply(assetID.ToString(), 9267 DataserverPlugin.DataserverReply(assetID.ToString(),
9282 NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); 9268 NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
@@ -9286,16 +9272,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9286 9272
9287 WithNotecard(assetID, delegate (UUID id, AssetBase a) 9273 WithNotecard(assetID, delegate (UUID id, AssetBase a)
9288 { 9274 {
9289 if (a == null) 9275 if (a == null || a.Type != 7)
9290 return; 9276 {
9291 9277 ShoutError("Notecard '" + name + "' could not be found.");
9292 if (a.Type != 7)
9293 return; 9278 return;
9279 }
9294 9280
9295 tid = AsyncCommands.
9296 DataserverPlugin.RegisterRequest(m_localID,
9297 m_itemID, assetID.ToString());
9298
9299 System.Text.ASCIIEncoding enc = 9281 System.Text.ASCIIEncoding enc =
9300 new System.Text.ASCIIEncoding(); 9282 new System.Text.ASCIIEncoding();
9301 string data = enc.GetString(a.Data); 9283 string data = enc.GetString(a.Data);
@@ -9306,18 +9288,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9306 NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); 9288 NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax));
9307 }); 9289 });
9308 9290
9309 if (tid != UUID.Zero)
9310 {
9311 // ScriptSleep(100);
9312 return tid.ToString();
9313 }
9314
9315 // if we got to here, we didn't find the notecard the script was asking for
9316 // => complain loudly, as specified by the LSL docs
9317 ShoutError("Notecard '" + name + "' could not be found.");
9318
9319 // ScriptSleep(100); 9291 // ScriptSleep(100);
9320 return UUID.Zero.ToString(); 9292 return tid.ToString();
9321 } 9293 }
9322 9294
9323 } 9295 }