aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs6
2 files changed, 13 insertions, 7 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
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index e44a106..d30a1c4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -121,7 +121,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
121 Type = 0; 121 Type = 0;
122 Velocity = new LSL_Types.Vector3(); 122 Velocity = new LSL_Types.Vector3();
123 initializeSurfaceTouch(); 123 initializeSurfaceTouch();
124 Country = String.Empty;
125 } 124 }
126 125
127 public UUID Key; 126 public UUID Key;
@@ -153,8 +152,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
153 private int touchFace; 152 private int touchFace;
154 public int TouchFace { get { return touchFace; } } 153 public int TouchFace { get { return touchFace; } }
155 154
156 public string Country;
157
158 // This can be done in two places including the constructor 155 // This can be done in two places including the constructor
159 // so be carefull what gets added here 156 // so be carefull what gets added here
160 private void initializeSurfaceTouch() 157 private void initializeSurfaceTouch()
@@ -202,9 +199,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
202 return; 199 return;
203 200
204 Name = presence.Firstname + " " + presence.Lastname; 201 Name = presence.Firstname + " " + presence.Lastname;
205 UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, Key);
206 if (account != null)
207 Country = account.UserCountry;
208 202
209 Owner = Key; 203 Owner = Key;
210 Position = new LSL_Types.Vector3(presence.AbsolutePosition); 204 Position = new LSL_Types.Vector3(presence.AbsolutePosition);