aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs164
1 files changed, 86 insertions, 78 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f5b7f5f..59e905e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4309,107 +4309,115 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4309 { 4309 {
4310 m_host.AddScriptLPS(1); 4310 m_host.AddScriptLPS(1);
4311 4311
4312 UUID uuid = (UUID)id; 4312 UUID uuid;
4313 PresenceInfo pinfo = null; 4313 if (UUID.TryParse(id, out uuid))
4314 UserAccount account;
4315
4316 UserInfoCacheEntry ce;
4317 if (!m_userInfoCache.TryGetValue(uuid, out ce))
4318 { 4314 {
4319 account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); 4315 PresenceInfo pinfo = null;
4320 if (account == null) 4316 UserAccount account;
4317
4318 UserInfoCacheEntry ce;
4319 if (!m_userInfoCache.TryGetValue(uuid, out ce))
4321 { 4320 {
4322 m_userInfoCache[uuid] = null; // Cache negative 4321 account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
4323 return UUID.Zero.ToString(); 4322 if (account == null)
4324 } 4323 {
4324 m_userInfoCache[uuid] = null; // Cache negative
4325 return UUID.Zero.ToString();
4326 }
4325 4327
4326 4328
4327 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); 4329 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
4328 if (pinfos != null && pinfos.Length > 0) 4330 if (pinfos != null && pinfos.Length > 0)
4329 {
4330 foreach (PresenceInfo p in pinfos)
4331 { 4331 {
4332 if (p.RegionID != UUID.Zero) 4332 foreach (PresenceInfo p in pinfos)
4333 { 4333 {
4334 pinfo = p; 4334 if (p.RegionID != UUID.Zero)
4335 {
4336 pinfo = p;
4337 }
4335 } 4338 }
4336 } 4339 }
4337 }
4338 4340
4339 ce = new UserInfoCacheEntry(); 4341 ce = new UserInfoCacheEntry();
4340 ce.time = Util.EnvironmentTickCount(); 4342 ce.time = Util.EnvironmentTickCount();
4341 ce.account = account; 4343 ce.account = account;
4342 ce.pinfo = pinfo; 4344 ce.pinfo = pinfo;
4343 m_userInfoCache[uuid] = ce; 4345 m_userInfoCache[uuid] = ce;
4344 } 4346 }
4345 else 4347 else
4346 { 4348 {
4347 if (ce == null) 4349 if (ce == null)
4348 return UUID.Zero.ToString(); 4350 return UUID.Zero.ToString();
4349 4351
4350 account = ce.account; 4352 account = ce.account;
4351 pinfo = ce.pinfo; 4353 pinfo = ce.pinfo;
4352 } 4354 }
4353 4355
4354 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) 4356 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000)
4355 {
4356 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
4357 if (pinfos != null && pinfos.Length > 0)
4358 { 4357 {
4359 foreach (PresenceInfo p in pinfos) 4358 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
4359 if (pinfos != null && pinfos.Length > 0)
4360 { 4360 {
4361 if (p.RegionID != UUID.Zero) 4361 foreach (PresenceInfo p in pinfos)
4362 { 4362 {
4363 pinfo = p; 4363 if (p.RegionID != UUID.Zero)
4364 {
4365 pinfo = p;
4366 }
4364 } 4367 }
4365 } 4368 }
4366 } 4369 else
4367 else 4370 pinfo = null;
4368 pinfo = null;
4369 4371
4370 ce.time = Util.EnvironmentTickCount(); 4372 ce.time = Util.EnvironmentTickCount();
4371 ce.pinfo = pinfo; 4373 ce.pinfo = pinfo;
4372 } 4374 }
4373 4375
4374 string reply = String.Empty; 4376 string reply = String.Empty;
4375 4377
4376 switch (data) 4378 switch (data)
4377 { 4379 {
4378 case 1: // DATA_ONLINE (0|1) 4380 case 1: // DATA_ONLINE (0|1)
4379 if (pinfo != null && pinfo.RegionID != UUID.Zero) 4381 if (pinfo != null && pinfo.RegionID != UUID.Zero)
4380 reply = "1"; 4382 reply = "1";
4381 else 4383 else
4382 reply = "0"; 4384 reply = "0";
4383 break; 4385 break;
4384 case 2: // DATA_NAME (First Last) 4386 case 2: // DATA_NAME (First Last)
4385 reply = account.FirstName + " " + account.LastName; 4387 reply = account.FirstName + " " + account.LastName;
4386 break; 4388 break;
4387 case 3: // DATA_BORN (YYYY-MM-DD) 4389 case 3: // DATA_BORN (YYYY-MM-DD)
4388 DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0); 4390 DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0);
4389 born = born.AddSeconds(account.Created); 4391 born = born.AddSeconds(account.Created);
4390 reply = born.ToString("yyyy-MM-dd"); 4392 reply = born.ToString("yyyy-MM-dd");
4391 break; 4393 break;
4392 case 4: // DATA_RATING (0,0,0,0,0,0) 4394 case 4: // DATA_RATING (0,0,0,0,0,0)
4393 reply = "0,0,0,0,0,0"; 4395 reply = "0,0,0,0,0,0";
4394 break; 4396 break;
4395 case 8: // DATA_PAYINFO (0|1|2|3) 4397 case 8: // DATA_PAYINFO (0|1|2|3)
4396 reply = "0"; 4398 reply = "0";
4397 break; 4399 break;
4398 default: 4400 default:
4399 return UUID.Zero.ToString(); // Raise no event 4401 return UUID.Zero.ToString(); // Raise no event
4400 } 4402 }
4401 4403
4402 UUID rq = UUID.Random(); 4404 UUID rq = UUID.Random();
4403 4405
4404 UUID tid = AsyncCommands. 4406 UUID tid = AsyncCommands.
4405 DataserverPlugin.RegisterRequest(m_localID, 4407 DataserverPlugin.RegisterRequest(m_localID,
4406 m_itemID, rq.ToString()); 4408 m_itemID, rq.ToString());
4407 4409
4408 AsyncCommands. 4410 AsyncCommands.
4409 DataserverPlugin.DataserverReply(rq.ToString(), reply); 4411 DataserverPlugin.DataserverReply(rq.ToString(), reply);
4410 4412
4411 ScriptSleep(100); 4413 ScriptSleep(100);
4412 return tid.ToString(); 4414 return tid.ToString();
4415 }
4416 else
4417 {
4418 ShoutError("Invalid UUID passed to llRequestAgentData.");
4419 }
4420 return "";
4413 } 4421 }
4414 4422
4415 public LSL_String llRequestInventoryData(string name) 4423 public LSL_String llRequestInventoryData(string name)