diff options
author | UbitUmarov | 2018-11-15 20:29:12 +0000 |
---|---|---|
committer | UbitUmarov | 2018-11-15 20:29:25 +0000 |
commit | 7bcef500a94129aee9fdf8465f4327c6873e90db (patch) | |
tree | 48d9351601624710ee61997956ba02aef0d07364 /OpenSim | |
parent | Yengine: remove potencial log spam (diff) | |
download | opensim-SC-7bcef500a94129aee9fdf8465f4327c6873e90db.zip opensim-SC-7bcef500a94129aee9fdf8465f4327c6873e90db.tar.gz opensim-SC-7bcef500a94129aee9fdf8465f4327c6873e90db.tar.bz2 opensim-SC-7bcef500a94129aee9fdf8465f4327c6873e90db.tar.xz |
remove CM api, add replacement ossl functions, as i should had done on the merge of avination code contrib. (runprebuild)
Diffstat (limited to 'OpenSim')
6 files changed, 61 insertions, 246 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs deleted file mode 100644 index 001caa6..0000000 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Threading; | ||
30 | using System.Reflection; | ||
31 | using System.Collections; | ||
32 | using System.Collections.Generic; | ||
33 | using System.Runtime.Remoting.Lifetime; | ||
34 | using OpenMetaverse; | ||
35 | using Nini.Config; | ||
36 | using OpenSim; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Region.CoreModules.World.LightShare; | ||
39 | using OpenSim.Region.Framework.Interfaces; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | using OpenSim.Region.ScriptEngine.Shared; | ||
42 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | ||
43 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | ||
44 | using OpenSim.Region.ScriptEngine.Interfaces; | ||
45 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | ||
46 | using OpenSim.Services.Interfaces; | ||
47 | |||
48 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | ||
49 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | ||
50 | using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
51 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; | ||
52 | using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | ||
53 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
54 | using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | ||
55 | |||
56 | namespace OpenSim.Region.ScriptEngine.Shared.Api | ||
57 | { | ||
58 | [Serializable] | ||
59 | public class CM_Api : MarshalByRefObject, ICM_Api, IScriptApi | ||
60 | { | ||
61 | internal IScriptEngine m_ScriptEngine; | ||
62 | internal SceneObjectPart m_host; | ||
63 | internal TaskInventoryItem m_item; | ||
64 | internal bool m_CMFunctionsEnabled = false; | ||
65 | |||
66 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | ||
67 | { | ||
68 | m_ScriptEngine = ScriptEngine; | ||
69 | m_host = host; | ||
70 | m_item = item; | ||
71 | |||
72 | if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false)) | ||
73 | m_CMFunctionsEnabled = true; | ||
74 | } | ||
75 | |||
76 | public override Object InitializeLifetimeService() | ||
77 | { | ||
78 | ILease lease = (ILease)base.InitializeLifetimeService(); | ||
79 | |||
80 | if (lease.CurrentState == LeaseState.Initial) | ||
81 | { | ||
82 | lease.InitialLeaseTime = TimeSpan.FromMinutes(0); | ||
83 | // lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); | ||
84 | // lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); | ||
85 | } | ||
86 | return lease; | ||
87 | } | ||
88 | |||
89 | public Scene World | ||
90 | { | ||
91 | get { return m_ScriptEngine.World; } | ||
92 | } | ||
93 | |||
94 | public LSL_Key cmDetectedCountry(int number) | ||
95 | { | ||
96 | m_host.AddScriptLPS(1); | ||
97 | if(!m_CMFunctionsEnabled) | ||
98 | return String.Empty; | ||
99 | if(World.UserAccountService == null) | ||
100 | return String.Empty; | ||
101 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); | ||
102 | if (detectedParams == null) | ||
103 | return String.Empty; | ||
104 | UUID key = detectedParams.Key; | ||
105 | if(key == UUID.Zero) | ||
106 | return String.Empty; | ||
107 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, key); | ||
108 | return account.UserCountry; | ||
109 | } | ||
110 | |||
111 | public string cmGetAgentCountry(LSL_Key key) | ||
112 | { | ||
113 | if(! m_CMFunctionsEnabled) | ||
114 | return ""; | ||
115 | if(World.UserAccountService == null) | ||
116 | return String.Empty; | ||
117 | if (!World.Permissions.IsGod(m_host.OwnerID)) | ||
118 | return String.Empty; | ||
119 | |||
120 | UUID uuid; | ||
121 | |||
122 | if (!UUID.TryParse(key, out uuid)) | ||
123 | return String.Empty; | ||
124 | |||
125 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); | ||
126 | return account.UserCountry; | ||
127 | } | ||
128 | } | ||
129 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a032715..2e528f3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -5102,5 +5102,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5102 | return m_host.ParentGroup.GetLinkNumPart(linkType); | 5102 | return m_host.ParentGroup.GetLinkNumPart(linkType); |
5103 | } | 5103 | } |
5104 | } | 5104 | } |
5105 | |||
5106 | // funtions to retrieve user country | ||
5107 | // adaptation cm* counter parts from Avination Careminster extensions API | ||
5108 | // included in Avination code contribution | ||
5109 | // for now users country can only be set directly on DB | ||
5110 | |||
5111 | public LSL_String osDetectedCountry(LSL_Integer number) | ||
5112 | { | ||
5113 | m_host.AddScriptLPS(1); | ||
5114 | CheckThreatLevel(ThreatLevel.Moderate, "osDetectedCountry"); | ||
5115 | |||
5116 | if (World.UserAccountService == null) | ||
5117 | return String.Empty; | ||
5118 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); | ||
5119 | if (detectedParams == null) | ||
5120 | return String.Empty; | ||
5121 | UUID key = detectedParams.Key; | ||
5122 | if (key == UUID.Zero) | ||
5123 | return String.Empty; | ||
5124 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, key); | ||
5125 | return account.UserCountry; | ||
5126 | } | ||
5127 | |||
5128 | public LSL_String osGetAgentCountry(LSL_Key id) | ||
5129 | { | ||
5130 | m_host.AddScriptLPS(1); | ||
5131 | CheckThreatLevel(ThreatLevel.Moderate, "osGetAgentCountry"); | ||
5132 | |||
5133 | if (World.UserAccountService == null) | ||
5134 | return String.Empty; | ||
5135 | |||
5136 | UUID key; | ||
5137 | if (!UUID.TryParse(id, out key)) | ||
5138 | return String.Empty; | ||
5139 | if (key == UUID.Zero) | ||
5140 | return String.Empty; | ||
5141 | |||
5142 | //if owner is not god, target must be in region, or nearby regions | ||
5143 | if (!World.Permissions.IsGod(m_host.OwnerID)) | ||
5144 | { | ||
5145 | ScenePresence sp = World.GetScenePresence(key); | ||
5146 | if(sp == null) | ||
5147 | return String.Empty; | ||
5148 | } | ||
5149 | |||
5150 | UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, key); | ||
5151 | return account.UserCountry; | ||
5152 | } | ||
5105 | } | 5153 | } |
5106 | } | 5154 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs deleted file mode 100644 index a406c99..0000000 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections; | ||
29 | using OpenSim.Region.ScriptEngine.Interfaces; | ||
30 | |||
31 | using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
32 | using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | ||
33 | using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | ||
34 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; | ||
35 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
36 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | ||
37 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | ||
38 | |||
39 | namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | ||
40 | { | ||
41 | public interface ICM_Api | ||
42 | { | ||
43 | key cmDetectedCountry(int detectedNumber); | ||
44 | string cmGetAgentCountry(key agentId); | ||
45 | } | ||
46 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 9ef356d..fc7b237 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -528,5 +528,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
528 | void osTriggerSound(LSL_Integer linknum, LSL_String sound, LSL_Float volume); | 528 | void osTriggerSound(LSL_Integer linknum, LSL_String sound, LSL_Float volume); |
529 | void osTriggerSoundLimited(LSL_Integer linknum, LSL_String sound, LSL_Float volume, | 529 | void osTriggerSoundLimited(LSL_Integer linknum, LSL_String sound, LSL_Float volume, |
530 | vector top_north_east, vector bottom_south_west); | 530 | vector top_north_east, vector bottom_south_west); |
531 | |||
532 | LSL_String osDetectedCountry(LSL_Integer number); | ||
533 | LSL_String osGetAgentCountry(LSL_Key agentId); | ||
531 | } | 534 | } |
532 | } | 535 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs deleted file mode 100644 index 361cbcb..0000000 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Runtime.Remoting.Lifetime; | ||
30 | using System.Threading; | ||
31 | using System.Reflection; | ||
32 | using System.Collections; | ||
33 | using System.Collections.Generic; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.ScriptEngine.Interfaces; | ||
37 | using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; | ||
38 | using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | ||
39 | using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | ||
40 | using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | ||
41 | using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
42 | using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; | ||
43 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | ||
44 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | ||
45 | using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; | ||
46 | |||
47 | namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | ||
48 | { | ||
49 | public partial class ScriptBaseClass : MarshalByRefObject | ||
50 | { | ||
51 | public ICM_Api m_CM_Functions; | ||
52 | |||
53 | public void ApiTypeCM(IScriptApi api) | ||
54 | { | ||
55 | if (!(api is ICM_Api)) | ||
56 | return; | ||
57 | |||
58 | m_CM_Functions = (ICM_Api)api; | ||
59 | } | ||
60 | |||
61 | public key cmDetectedCountry(int num) | ||
62 | { | ||
63 | return m_CM_Functions.cmDetectedCountry(num); | ||
64 | } | ||
65 | |||
66 | public string cmGetAgentCountry(key key) | ||
67 | { | ||
68 | return m_CM_Functions.cmGetAgentCountry(key); | ||
69 | } | ||
70 | } | ||
71 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 0f438ef..b7a02d6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -1282,5 +1282,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1282 | { | 1282 | { |
1283 | m_OSSL_Functions.osPreloadSound(linknum, sound); | 1283 | m_OSSL_Functions.osPreloadSound(linknum, sound); |
1284 | } | 1284 | } |
1285 | |||
1286 | public LSL_String osDetectedCountry(LSL_Integer number) | ||
1287 | { | ||
1288 | return m_OSSL_Functions.osDetectedCountry(number); | ||
1289 | } | ||
1290 | |||
1291 | public LSL_String osGetAgentCountry(LSL_Key agentId) | ||
1292 | { | ||
1293 | return m_OSSL_Functions.osGetAgentCountry(agentId); | ||
1294 | } | ||
1285 | } | 1295 | } |
1286 | } | 1296 | } |