diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs index 81e30c9..3509968 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs | |||
@@ -94,14 +94,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
94 | public string cmDetectedCountry(int number) | 94 | public string cmDetectedCountry(int number) |
95 | { | 95 | { |
96 | m_host.AddScriptLPS(1); | 96 | m_host.AddScriptLPS(1); |
97 | if(!m_CMFunctionsEnabled) | ||
98 | return String.Empty; | ||
99 | if(World.UserAccountService == null) | ||
100 | return String.Empty; | ||
97 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); | 101 | DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); |
98 | if (detectedParams == null) | 102 | if (detectedParams == null) |
99 | return String.Empty; | 103 | return String.Empty; |
100 | return detectedParams.Country; | 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; | ||
101 | } | 109 | } |
102 | 110 | ||
103 | public string cmGetAgentCountry(LSL_Key key) | 111 | public string cmGetAgentCountry(LSL_Key key) |
104 | { | 112 | { |
113 | if(! m_CMFunctionsEnabled) | ||
114 | return ""; | ||
115 | if(World.UserAccountService == null) | ||
116 | return String.Empty; | ||
105 | if (!World.Permissions.IsGod(m_host.OwnerID)) | 117 | if (!World.Permissions.IsGod(m_host.OwnerID)) |
106 | return String.Empty; | 118 | return String.Empty; |
107 | 119 | ||