diff options
author | Melanie | 2013-01-23 19:31:27 +0000 |
---|---|---|
committer | Melanie | 2013-01-23 19:31:27 +0000 |
commit | fc1c77b42d6e35ecb6ad371484f355a3430018b1 (patch) | |
tree | e3c5fed0229a21902aa85a80b587e98fe397ac6c /OpenSim | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Remove the return value from llGiveMoney (it was a LSL extension of OpenSim) and (diff) | |
download | opensim-SC_OLD-fc1c77b42d6e35ecb6ad371484f355a3430018b1.zip opensim-SC_OLD-fc1c77b42d6e35ecb6ad371484f355a3430018b1.tar.gz opensim-SC_OLD-fc1c77b42d6e35ecb6ad371484f355a3430018b1.tar.bz2 opensim-SC_OLD-fc1c77b42d6e35ecb6ad371484f355a3430018b1.tar.xz |
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim')
9 files changed, 180 insertions, 83 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 822c50d..aa6203b 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -99,12 +99,23 @@ namespace OpenSim.Capabilities.Handlers | |||
99 | 99 | ||
100 | } | 100 | } |
101 | // OK, we have an array with preferred formats, possibly with only one entry | 101 | // OK, we have an array with preferred formats, possibly with only one entry |
102 | 102 | bool foundtexture = false; | |
103 | foreach (string f in formats) | 103 | foreach (string f in formats) |
104 | { | 104 | { |
105 | if (FetchTexture(request, ret, textureID, f)) | 105 | foundtexture = FetchTexture(request, ret, textureID, f); |
106 | if (foundtexture) | ||
106 | break; | 107 | break; |
107 | } | 108 | } |
109 | if (!foundtexture) | ||
110 | { | ||
111 | ret["int_response_code"] = 404; | ||
112 | ret["error_status_text"] = "not found"; | ||
113 | ret["str_response_string"] = "not found"; | ||
114 | ret["content_type"] = "text/plain"; | ||
115 | ret["keepalive"] = false; | ||
116 | ret["reusecontext"] = false; | ||
117 | ret["int_bytes"] = 0; | ||
118 | } | ||
108 | } | 119 | } |
109 | else | 120 | else |
110 | { | 121 | { |
@@ -176,9 +187,13 @@ namespace OpenSim.Capabilities.Handlers | |||
176 | return true; | 187 | return true; |
177 | } | 188 | } |
178 | 189 | ||
190 | //response = new Hashtable(); | ||
191 | |||
192 | |||
193 | //WriteTextureData(request,response,null,format); | ||
179 | // not found | 194 | // not found |
180 | // m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); | 195 | //m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); |
181 | return true; | 196 | return false; |
182 | } | 197 | } |
183 | 198 | ||
184 | private void WriteTextureData(Hashtable request, Hashtable response, AssetBase texture, string format) | 199 | private void WriteTextureData(Hashtable request, Hashtable response, AssetBase texture, string format) |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 7e72d47..cb09047 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -150,6 +150,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
150 | { | 150 | { |
151 | client.OnTeleportHomeRequest += TriggerTeleportHome; | 151 | client.OnTeleportHomeRequest += TriggerTeleportHome; |
152 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 152 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
153 | client.OnTeleportCancel += TeleportCancel; | ||
153 | } | 154 | } |
154 | 155 | ||
155 | public virtual void Close() {} | 156 | public virtual void Close() {} |
@@ -401,14 +402,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
401 | { | 402 | { |
402 | // Record that this agent is in transit so that we can prevent simultaneous requests and do later detection | 403 | // Record that this agent is in transit so that we can prevent simultaneous requests and do later detection |
403 | // of whether the destination region completes the teleport. | 404 | // of whether the destination region completes the teleport. |
404 | if (!m_entityTransferStateMachine.SetInTransit(sp.UUID)) | 405 | m_entityTransferStateMachine.SetInTransit(sp.UUID); |
405 | { | 406 | // if (!m_entityTransferStateMachine.SetInTransit(sp.UUID)) |
406 | m_log.DebugFormat( | 407 | // { |
407 | "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.", | 408 | // m_log.DebugFormat( |
408 | sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); | 409 | // "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.", |
409 | 410 | // sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); | |
410 | return; | 411 | // |
411 | } | 412 | // return; |
413 | // } | ||
412 | 414 | ||
413 | if (reg == null || finalDestination == null) | 415 | if (reg == null || finalDestination == null) |
414 | { | 416 | { |
@@ -993,6 +995,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
993 | return neighbourRegion; | 995 | return neighbourRegion; |
994 | } | 996 | } |
995 | 997 | ||
998 | private void TeleportCancel(IClientAPI remoteClient) | ||
999 | { | ||
1000 | m_entityTransferStateMachine.ResetFromTransit(remoteClient.AgentId); | ||
1001 | } | ||
1002 | |||
996 | public bool Cross(ScenePresence agent, bool isFlying) | 1003 | public bool Cross(ScenePresence agent, bool isFlying) |
997 | { | 1004 | { |
998 | uint x; | 1005 | uint x; |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index a0ae203..708b99d 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -42,6 +42,7 @@ using OpenSim.Framework.Servers.HttpServer; | |||
42 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
44 | using Mono.Addins; | 44 | using Mono.Addins; |
45 | using Amib.Threading; | ||
45 | 46 | ||
46 | /***************************************************** | 47 | /***************************************************** |
47 | * | 48 | * |
@@ -102,6 +103,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
102 | private Dictionary<UUID, HttpRequestClass> m_pendingRequests; | 103 | private Dictionary<UUID, HttpRequestClass> m_pendingRequests; |
103 | private Scene m_scene; | 104 | private Scene m_scene; |
104 | // private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>(); | 105 | // private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>(); |
106 | public static SmartThreadPool ThreadPool = null; | ||
105 | 107 | ||
106 | public HttpRequestModule() | 108 | public HttpRequestModule() |
107 | { | 109 | { |
@@ -279,7 +281,30 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
279 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); | 281 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); |
280 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); | 282 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); |
281 | 283 | ||
284 | int maxThreads = 50; | ||
285 | |||
286 | IConfig httpConfig = config.Configs["HttpRequestModule"]; | ||
287 | if (httpConfig != null) | ||
288 | { | ||
289 | maxThreads = httpConfig.GetInt("MaxPoolThreads", maxThreads); | ||
290 | } | ||
291 | |||
282 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); | 292 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); |
293 | |||
294 | // First instance sets this up for all sims | ||
295 | if (ThreadPool == null) | ||
296 | { | ||
297 | STPStartInfo startInfo = new STPStartInfo(); | ||
298 | startInfo.IdleTimeout = 20000; | ||
299 | startInfo.MaxWorkerThreads = maxThreads; | ||
300 | startInfo.MinWorkerThreads = 5; | ||
301 | startInfo.ThreadPriority = ThreadPriority.BelowNormal; | ||
302 | startInfo.StartSuspended = true; | ||
303 | |||
304 | ThreadPool = new SmartThreadPool(startInfo); | ||
305 | |||
306 | ThreadPool.Start(); | ||
307 | } | ||
283 | } | 308 | } |
284 | 309 | ||
285 | public void AddRegion(Scene scene) | 310 | public void AddRegion(Scene scene) |
@@ -340,7 +365,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
340 | public string HttpMIMEType = "text/plain;charset=utf-8"; | 365 | public string HttpMIMEType = "text/plain;charset=utf-8"; |
341 | public int HttpTimeout; | 366 | public int HttpTimeout; |
342 | public bool HttpVerifyCert = true; | 367 | public bool HttpVerifyCert = true; |
343 | private Thread httpThread; | 368 | public IWorkItemResult WorkItem = null; |
344 | 369 | ||
345 | // Request info | 370 | // Request info |
346 | private UUID _itemID; | 371 | private UUID _itemID; |
@@ -374,12 +399,16 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
374 | 399 | ||
375 | public void Process() | 400 | public void Process() |
376 | { | 401 | { |
377 | httpThread = new Thread(SendRequest); | ||
378 | httpThread.Name = "HttpRequestThread"; | ||
379 | httpThread.Priority = ThreadPriority.BelowNormal; | ||
380 | httpThread.IsBackground = true; | ||
381 | _finished = false; | 402 | _finished = false; |
382 | httpThread.Start(); | 403 | |
404 | lock (HttpRequestModule.ThreadPool) | ||
405 | WorkItem = HttpRequestModule.ThreadPool.QueueWorkItem(new WorkItemCallback(StpSendWrapper), null); | ||
406 | } | ||
407 | |||
408 | private object StpSendWrapper(object o) | ||
409 | { | ||
410 | SendRequest(); | ||
411 | return null; | ||
383 | } | 412 | } |
384 | 413 | ||
385 | /* | 414 | /* |
@@ -409,13 +438,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
409 | { | 438 | { |
410 | // We could hijack Connection Group Name to identify | 439 | // We could hijack Connection Group Name to identify |
411 | // a desired security exception. But at the moment we'll use a dummy header instead. | 440 | // a desired security exception. But at the moment we'll use a dummy header instead. |
412 | // Request.ConnectionGroupName = "NoVerify"; | ||
413 | Request.Headers.Add("NoVerifyCert", "true"); | 441 | Request.Headers.Add("NoVerifyCert", "true"); |
414 | } | 442 | } |
415 | // else | ||
416 | // { | ||
417 | // Request.ConnectionGroupName="Verify"; | ||
418 | // } | ||
419 | if (proxyurl != null && proxyurl.Length > 0) | 443 | if (proxyurl != null && proxyurl.Length > 0) |
420 | { | 444 | { |
421 | if (proxyexcepts != null && proxyexcepts.Length > 0) | 445 | if (proxyexcepts != null && proxyexcepts.Length > 0) |
@@ -485,9 +509,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
485 | 509 | ||
486 | ResponseBody = sb.ToString().Replace("\r", ""); | 510 | ResponseBody = sb.ToString().Replace("\r", ""); |
487 | } | 511 | } |
488 | catch (Exception e) | 512 | catch (WebException e) |
489 | { | 513 | { |
490 | if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError) | 514 | if (e.Status == WebExceptionStatus.ProtocolError) |
491 | { | 515 | { |
492 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; | 516 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; |
493 | Status = (int)webRsp.StatusCode; | 517 | Status = (int)webRsp.StatusCode; |
@@ -512,6 +536,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
512 | _finished = true; | 536 | _finished = true; |
513 | return; | 537 | return; |
514 | } | 538 | } |
539 | catch (Exception e) | ||
540 | { | ||
541 | // Don't crash on anything else | ||
542 | } | ||
515 | finally | 543 | finally |
516 | { | 544 | { |
517 | if (response != null) | 545 | if (response != null) |
@@ -525,7 +553,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
525 | { | 553 | { |
526 | try | 554 | try |
527 | { | 555 | { |
528 | httpThread.Abort(); | 556 | if (!WorkItem.Cancel()) |
557 | { | ||
558 | WorkItem.Abort(); | ||
559 | } | ||
529 | } | 560 | } |
530 | catch (Exception) | 561 | catch (Exception) |
531 | { | 562 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6ca7ef2..f229e33 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -352,7 +352,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
352 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing | 352 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing |
353 | private volatile bool m_backingup; | 353 | private volatile bool m_backingup; |
354 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); | 354 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); |
355 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); | 355 | private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>(); |
356 | 356 | ||
357 | private string m_defaultScriptEngine; | 357 | private string m_defaultScriptEngine; |
358 | 358 | ||
@@ -1723,7 +1723,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1723 | public void AddGroupTarget(SceneObjectGroup grp) | 1723 | public void AddGroupTarget(SceneObjectGroup grp) |
1724 | { | 1724 | { |
1725 | lock (m_groupsWithTargets) | 1725 | lock (m_groupsWithTargets) |
1726 | m_groupsWithTargets[grp.UUID] = grp; | 1726 | m_groupsWithTargets[grp.UUID] = 0; |
1727 | } | 1727 | } |
1728 | 1728 | ||
1729 | public void RemoveGroupTarget(SceneObjectGroup grp) | 1729 | public void RemoveGroupTarget(SceneObjectGroup grp) |
@@ -1734,18 +1734,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1734 | 1734 | ||
1735 | private void CheckAtTargets() | 1735 | private void CheckAtTargets() |
1736 | { | 1736 | { |
1737 | List<SceneObjectGroup> objs = null; | 1737 | List<UUID> objs = null; |
1738 | 1738 | ||
1739 | lock (m_groupsWithTargets) | 1739 | lock (m_groupsWithTargets) |
1740 | { | 1740 | { |
1741 | if (m_groupsWithTargets.Count != 0) | 1741 | if (m_groupsWithTargets.Count != 0) |
1742 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); | 1742 | objs = new List<UUID>(m_groupsWithTargets.Keys); |
1743 | } | 1743 | } |
1744 | 1744 | ||
1745 | if (objs != null) | 1745 | if (objs != null) |
1746 | { | 1746 | { |
1747 | foreach (SceneObjectGroup entry in objs) | 1747 | foreach (UUID entry in objs) |
1748 | entry.checkAtTargets(); | 1748 | { |
1749 | SceneObjectGroup grp = GetSceneObjectGroup(entry); | ||
1750 | if (grp == null) | ||
1751 | m_groupsWithTargets.Remove(entry); | ||
1752 | else | ||
1753 | grp.checkAtTargets(); | ||
1754 | } | ||
1749 | } | 1755 | } |
1750 | } | 1756 | } |
1751 | 1757 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9c6a94b..0f5d116 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -79,14 +79,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
79 | object_rez = 4194304 | 79 | object_rez = 4194304 |
80 | } | 80 | } |
81 | 81 | ||
82 | struct scriptPosTarget | 82 | public struct scriptPosTarget |
83 | { | 83 | { |
84 | public Vector3 targetPos; | 84 | public Vector3 targetPos; |
85 | public float tolerance; | 85 | public float tolerance; |
86 | public uint handle; | 86 | public uint handle; |
87 | } | 87 | } |
88 | 88 | ||
89 | struct scriptRotTarget | 89 | public struct scriptRotTarget |
90 | { | 90 | { |
91 | public Quaternion targetRot; | 91 | public Quaternion targetRot; |
92 | public float tolerance; | 92 | public float tolerance; |
@@ -329,8 +329,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
329 | protected SceneObjectPart m_rootPart; | 329 | protected SceneObjectPart m_rootPart; |
330 | // private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); | 330 | // private Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); |
331 | 331 | ||
332 | private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>(); | 332 | private SortedDictionary<uint, scriptPosTarget> m_targets = new SortedDictionary<uint, scriptPosTarget>(); |
333 | private Dictionary<uint, scriptRotTarget> m_rotTargets = new Dictionary<uint, scriptRotTarget>(); | 333 | private SortedDictionary<uint, scriptRotTarget> m_rotTargets = new SortedDictionary<uint, scriptRotTarget>(); |
334 | |||
335 | public SortedDictionary<uint, scriptPosTarget> AtTargets | ||
336 | { | ||
337 | get { return m_targets; } | ||
338 | } | ||
339 | |||
340 | public SortedDictionary<uint, scriptRotTarget> RotTargets | ||
341 | { | ||
342 | get { return m_rotTargets; } | ||
343 | } | ||
334 | 344 | ||
335 | private bool m_scriptListens_atTarget; | 345 | private bool m_scriptListens_atTarget; |
336 | private bool m_scriptListens_notAtTarget; | 346 | private bool m_scriptListens_notAtTarget; |
@@ -4141,6 +4151,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4141 | waypoint.handle = handle; | 4151 | waypoint.handle = handle; |
4142 | lock (m_rotTargets) | 4152 | lock (m_rotTargets) |
4143 | { | 4153 | { |
4154 | if (m_rotTargets.Count >= 8) | ||
4155 | m_rotTargets.Remove(m_rotTargets.ElementAt(0).Key); | ||
4144 | m_rotTargets.Add(handle, waypoint); | 4156 | m_rotTargets.Add(handle, waypoint); |
4145 | } | 4157 | } |
4146 | m_scene.AddGroupTarget(this); | 4158 | m_scene.AddGroupTarget(this); |
@@ -4166,6 +4178,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4166 | waypoint.handle = handle; | 4178 | waypoint.handle = handle; |
4167 | lock (m_targets) | 4179 | lock (m_targets) |
4168 | { | 4180 | { |
4181 | if (m_targets.Count >= 8) | ||
4182 | m_targets.Remove(m_targets.ElementAt(0).Key); | ||
4169 | m_targets.Add(handle, waypoint); | 4183 | m_targets.Add(handle, waypoint); |
4170 | } | 4184 | } |
4171 | m_scene.AddGroupTarget(this); | 4185 | m_scene.AddGroupTarget(this); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4ed6d75..9df04df 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3039,42 +3039,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3039 | return src.ToLower(); | 3039 | return src.ToLower(); |
3040 | } | 3040 | } |
3041 | 3041 | ||
3042 | public LSL_Integer llGiveMoney(string destination, int amount) | 3042 | public void llGiveMoney(string destination, int amount) |
3043 | { | 3043 | { |
3044 | m_host.AddScriptLPS(1); | 3044 | Util.FireAndForget(x => |
3045 | |||
3046 | if (m_item.PermsGranter == UUID.Zero) | ||
3047 | return 0; | ||
3048 | |||
3049 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) | ||
3050 | { | 3045 | { |
3051 | LSLError("No permissions to give money"); | 3046 | m_host.AddScriptLPS(1); |
3052 | return 0; | ||
3053 | } | ||
3054 | 3047 | ||
3055 | UUID toID = new UUID(); | 3048 | if (m_item.PermsGranter == UUID.Zero) |
3049 | return; | ||
3056 | 3050 | ||
3057 | if (!UUID.TryParse(destination, out toID)) | 3051 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) |
3058 | { | 3052 | { |
3059 | LSLError("Bad key in llGiveMoney"); | 3053 | LSLError("No permissions to give money"); |
3060 | return 0; | 3054 | return; |
3061 | } | 3055 | } |
3062 | 3056 | ||
3063 | IMoneyModule money = World.RequestModuleInterface<IMoneyModule>(); | 3057 | UUID toID = new UUID(); |
3064 | 3058 | ||
3065 | if (money == null) | 3059 | if (!UUID.TryParse(destination, out toID)) |
3066 | { | 3060 | { |
3067 | NotImplemented("llGiveMoney"); | 3061 | LSLError("Bad key in llGiveMoney"); |
3068 | return 0; | 3062 | return; |
3069 | } | 3063 | } |
3070 | 3064 | ||
3071 | bool result = money.ObjectGiveMoney( | 3065 | IMoneyModule money = World.RequestModuleInterface<IMoneyModule>(); |
3072 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero); | ||
3073 | 3066 | ||
3074 | if (result) | 3067 | if (money == null) |
3075 | return 1; | 3068 | { |
3069 | NotImplemented("llGiveMoney"); | ||
3070 | return; | ||
3071 | } | ||
3076 | 3072 | ||
3077 | return 0; | 3073 | money.ObjectGiveMoney( |
3074 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero); | ||
3075 | }); | ||
3078 | } | 3076 | } |
3079 | 3077 | ||
3080 | public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) | 3078 | public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) |
@@ -7330,7 +7328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7330 | { | 7328 | { |
7331 | m_host.AddScriptLPS(1); | 7329 | m_host.AddScriptLPS(1); |
7332 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7330 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7333 | if (xmlrpcMod.IsEnabled()) | 7331 | if (xmlrpcMod != null && xmlrpcMod.IsEnabled()) |
7334 | { | 7332 | { |
7335 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); | 7333 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); |
7336 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); | 7334 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); |
@@ -7362,6 +7360,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7362 | m_host.AddScriptLPS(1); | 7360 | m_host.AddScriptLPS(1); |
7363 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7361 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7364 | ScriptSleep(3000); | 7362 | ScriptSleep(3000); |
7363 | if (xmlrpcMod == null) | ||
7364 | return ""; | ||
7365 | return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); | 7365 | return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); |
7366 | } | 7366 | } |
7367 | 7367 | ||
@@ -7369,7 +7369,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7369 | { | 7369 | { |
7370 | m_host.AddScriptLPS(1); | 7370 | m_host.AddScriptLPS(1); |
7371 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7371 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7372 | xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); | 7372 | if (xmlrpcMod != null) |
7373 | xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); | ||
7373 | ScriptSleep(3000); | 7374 | ScriptSleep(3000); |
7374 | } | 7375 | } |
7375 | 7376 | ||
@@ -7384,7 +7385,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7384 | } | 7385 | } |
7385 | 7386 | ||
7386 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 7387 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
7387 | xmlrpcMod.CloseXMLRPCChannel((UUID)channel); | 7388 | if (xmlrpcMod != null) |
7389 | xmlrpcMod.CloseXMLRPCChannel((UUID)channel); | ||
7388 | ScriptSleep(1000); | 7390 | ScriptSleep(1000); |
7389 | } | 7391 | } |
7390 | 7392 | ||
@@ -7797,8 +7799,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7797 | m_host.AddScriptLPS(1); | 7799 | m_host.AddScriptLPS(1); |
7798 | 7800 | ||
7799 | setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); | 7801 | setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); |
7800 | |||
7801 | ScriptSleep(200); | ||
7802 | } | 7802 | } |
7803 | 7803 | ||
7804 | private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc) | 7804 | private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc) |
@@ -12677,7 +12677,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12677 | } | 12677 | } |
12678 | 12678 | ||
12679 | bool result = money.ObjectGiveMoney( | 12679 | bool result = money.ObjectGiveMoney( |
12680 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero); | 12680 | m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn); |
12681 | 12681 | ||
12682 | if (result) | 12682 | if (result) |
12683 | { | 12683 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index d6ce069..10ec34d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1857,17 +1857,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1857 | { | 1857 | { |
1858 | UUID assetID = UUID.Zero; | 1858 | UUID assetID = UUID.Zero; |
1859 | 1859 | ||
1860 | if (!UUID.TryParse(notecardNameOrUuid, out assetID)) | 1860 | bool notecardNameIsUUID = UUID.TryParse(notecardNameOrUuid, out assetID); |
1861 | |||
1862 | if (!notecardNameIsUUID) | ||
1861 | { | 1863 | { |
1862 | m_host.TaskInventory.LockItemsForRead(true); | 1864 | assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid); |
1863 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
1864 | { | ||
1865 | if (item.Type == 7 && item.Name == notecardNameOrUuid) | ||
1866 | { | ||
1867 | assetID = item.AssetID; | ||
1868 | } | ||
1869 | } | ||
1870 | m_host.TaskInventory.LockItemsForRead(false); | ||
1871 | } | 1865 | } |
1872 | 1866 | ||
1873 | if (assetID == UUID.Zero) | 1867 | if (assetID == UUID.Zero) |
@@ -1878,7 +1872,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1878 | AssetBase a = World.AssetService.Get(assetID.ToString()); | 1872 | AssetBase a = World.AssetService.Get(assetID.ToString()); |
1879 | 1873 | ||
1880 | if (a == null) | 1874 | if (a == null) |
1881 | return UUID.Zero; | 1875 | { |
1876 | // Whoops, it's still possible here that the notecard name was properly | ||
1877 | // formatted like a UUID but isn't an asset UUID so lets look it up by name after all | ||
1878 | assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid); | ||
1879 | if (assetID == UUID.Zero) | ||
1880 | return UUID.Zero; | ||
1881 | |||
1882 | if (!NotecardCache.IsCached(assetID)) | ||
1883 | { | ||
1884 | a = World.AssetService.Get(assetID.ToString()); | ||
1885 | |||
1886 | if (a == null) | ||
1887 | { | ||
1888 | return UUID.Zero; | ||
1889 | } | ||
1890 | } | ||
1891 | } | ||
1882 | 1892 | ||
1883 | string data = Encoding.UTF8.GetString(a.Data); | 1893 | string data = Encoding.UTF8.GetString(a.Data); |
1884 | NotecardCache.Cache(assetID, data); | 1894 | NotecardCache.Cache(assetID, data); |
@@ -1886,6 +1896,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1886 | 1896 | ||
1887 | return assetID; | 1897 | return assetID; |
1888 | } | 1898 | } |
1899 | protected UUID SearchTaskInventoryForAssetId(string name) | ||
1900 | { | ||
1901 | UUID assetId = UUID.Zero; | ||
1902 | m_host.TaskInventory.LockItemsForRead(true); | ||
1903 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
1904 | { | ||
1905 | if (item.Type == 7 && item.Name == name) | ||
1906 | { | ||
1907 | assetId = item.AssetID; | ||
1908 | } | ||
1909 | } | ||
1910 | m_host.TaskInventory.LockItemsForRead(false); | ||
1911 | return assetId; | ||
1912 | } | ||
1889 | 1913 | ||
1890 | /// <summary> | 1914 | /// <summary> |
1891 | /// Directly get an entire notecard at once. | 1915 | /// Directly get an entire notecard at once. |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 9bf6f9b..8eeb4d2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -208,7 +208,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
208 | LSL_Float llGetWallclock(); | 208 | LSL_Float llGetWallclock(); |
209 | void llGiveInventory(string destination, string inventory); | 209 | void llGiveInventory(string destination, string inventory); |
210 | void llGiveInventoryList(string destination, string category, LSL_List inventory); | 210 | void llGiveInventoryList(string destination, string category, LSL_List inventory); |
211 | LSL_Integer llGiveMoney(string destination, int amount); | 211 | void llGiveMoney(string destination, int amount); |
212 | LSL_String llTransferLindenDollars(string destination, int amount); | 212 | LSL_String llTransferLindenDollars(string destination, int amount); |
213 | void llGodLikeRezObject(string inventory, LSL_Vector pos); | 213 | void llGodLikeRezObject(string inventory, LSL_Vector pos); |
214 | LSL_Float llGround(LSL_Vector offset); | 214 | LSL_Float llGround(LSL_Vector offset); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 8ecc4f8..ef71d7b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -876,9 +876,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
876 | m_LSL_Functions.llGiveInventoryList(destination, category, inventory); | 876 | m_LSL_Functions.llGiveInventoryList(destination, category, inventory); |
877 | } | 877 | } |
878 | 878 | ||
879 | public LSL_Integer llGiveMoney(string destination, int amount) | 879 | public void llGiveMoney(string destination, int amount) |
880 | { | 880 | { |
881 | return m_LSL_Functions.llGiveMoney(destination, amount); | 881 | m_LSL_Functions.llGiveMoney(destination, amount); |
882 | } | 882 | } |
883 | 883 | ||
884 | public LSL_String llTransferLindenDollars(string destination, int amount) | 884 | public LSL_String llTransferLindenDollars(string destination, int amount) |