aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorroot2010-09-17 01:50:48 +0200
committerroot2010-09-17 01:50:48 +0200
commit251f2444d049ed525ef41c4c4792ec446c53b973 (patch)
tree6d32c9b3716d181672fe162a882f09590f31ac0d /OpenSim
parentRemoving debug (diff)
downloadopensim-SC-251f2444d049ed525ef41c4c4792ec446c53b973.zip
opensim-SC-251f2444d049ed525ef41c4c4792ec446c53b973.tar.gz
opensim-SC-251f2444d049ed525ef41c4c4792ec446c53b973.tar.bz2
opensim-SC-251f2444d049ed525ef41c4c4792ec446c53b973.tar.xz
Revert "* Changed 11 calls for session info to the more optimized API method"
This reverts commit 5dc9ea2f2487804d788b4b80d40d91bd792de4c2. Also makes online indicators and IM more robust
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs103
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs26
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs4
4 files changed, 109 insertions, 37 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index a49e71e..21ed9dc 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -317,7 +317,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
317 continue; 317 continue;
318 318
319 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID); 319 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
320 PresenceInfo presence = PresenceService.GetAgent(fromAgentID); 320
321 PresenceInfo presence = null;
322 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
323 if (presences != null && presences.Length > 0)
324 presence = presences[0];
325 if (presence != null)
326 im.offline = 0;
321 327
322 im.fromAgentID = fromAgentID.Guid; 328 im.fromAgentID = fromAgentID.Guid;
323 im.fromAgentName = account.FirstName + " " + account.LastName; 329 im.fromAgentName = account.FirstName + " " + account.LastName;
@@ -430,13 +436,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
430 return; 436 return;
431 437
432 // The friend is not here [as root]. Let's forward. 438 // The friend is not here [as root]. Let's forward.
433 PresenceInfo friendSession = PresenceService.GetAgent(friendID); 439 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
434 if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check 440 if (friendSessions != null && friendSessions.Length > 0)
435 { 441 {
436 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 442 PresenceInfo friendSession = null;
437 //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); 443 foreach (PresenceInfo pinfo in friendSessions)
438 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); 444 if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad
445 {
446 friendSession = pinfo;
447 break;
448 }
449
450 if (friendSession != null)
451 {
452 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
453 //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
454 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
455 }
439 } 456 }
457
458 // Friend is not online. Ignore.
440 } 459 }
441 else 460 else
442 { 461 {
@@ -477,11 +496,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
477 return; 496 return;
478 497
479 // The prospective friend is not here [as root]. Let's forward. 498 // The prospective friend is not here [as root]. Let's forward.
480 PresenceInfo friendSession = PresenceService.GetAgent(friendID); 499 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
481 if (friendSession != null) 500 if (friendSessions != null && friendSessions.Length > 0)
482 { 501 {
483 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 502 PresenceInfo friendSession = friendSessions[0];
484 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); 503 if (friendSession != null)
504 {
505 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
506 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
507 }
485 } 508 }
486 // If the prospective friend is not online, he'll get the message upon login. 509 // If the prospective friend is not online, he'll get the message upon login.
487 } 510 }
@@ -508,12 +531,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
508 } 531 }
509 532
510 // The friend is not here 533 // The friend is not here
511 PresenceInfo friendSession = PresenceService.GetAgent(friendID); 534 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
512 if (friendSession != null) 535 if (friendSessions != null && friendSessions.Length > 0)
513 { 536 {
514 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 537 PresenceInfo friendSession = friendSessions[0];
515 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); 538 if (friendSession != null)
516 client.SendAgentOnline(new UUID[] { friendID }); 539 {
540 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
541 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
542 client.SendAgentOnline(new UUID[] { friendID });
543 }
517 } 544 }
518 } 545 }
519 546
@@ -532,14 +559,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
532 if (LocalFriendshipDenied(agentID, client.Name, friendID)) 559 if (LocalFriendshipDenied(agentID, client.Name, friendID))
533 return; 560 return;
534 561
535 PresenceInfo friendSession = PresenceService.GetAgent(friendID); 562 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
536 if (friendSession != null) 563 if (friendSessions != null && friendSessions.Length > 0)
537 { 564 {
538 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 565 PresenceInfo friendSession = friendSessions[0];
539 if (region != null) 566 if (friendSession != null)
540 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); 567 {
541 else 568 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
542 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); 569 if (region != null)
570 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
571 else
572 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
573 }
543 } 574 }
544 } 575 }
545 576
@@ -561,11 +592,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
561 if (LocalFriendshipTerminated(exfriendID)) 592 if (LocalFriendshipTerminated(exfriendID))
562 return; 593 return;
563 594
564 PresenceInfo friendSession = PresenceService.GetAgent(exfriendID); 595 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
565 if (friendSession != null) 596 if (friendSessions != null && friendSessions.Length > 0)
566 { 597 {
567 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 598 PresenceInfo friendSession = friendSessions[0];
568 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); 599 if (friendSession != null)
600 {
601 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
602 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
603 }
569 } 604 }
570 } 605 }
571 606
@@ -604,13 +639,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
604 if (LocalGrantRights(requester, target, myFlags, rights)) 639 if (LocalGrantRights(requester, target, myFlags, rights))
605 return; 640 return;
606 641
607 PresenceInfo friendSession = PresenceService.GetAgent(target); 642 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
608 if (friendSession != null) 643 if (friendSessions != null && friendSessions.Length > 0)
609 { 644 {
610 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 645 PresenceInfo friendSession = friendSessions[0];
611 // TODO: You might want to send the delta to save the lookup 646 if (friendSession != null)
612 // on the other end!! 647 {
613 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); 648 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
649 // TODO: You might want to send the delta to save the lookup
650 // on the other end!!
651 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
652 }
614 } 653 }
615 } 654 }
616 } 655 }
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index a6894ff..2a405ac 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -497,7 +497,18 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
497 if (lookupAgent) 497 if (lookupAgent)
498 { 498 {
499 // Non-cached user agent lookup. 499 // Non-cached user agent lookup.
500 upd = PresenceService.GetAgent(toAgentID); 500 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
501 if (presences != null && presences.Length > 0)
502 {
503 foreach (PresenceInfo p in presences)
504 {
505 if (p.RegionID != UUID.Zero)
506 {
507 upd = p;
508 break;
509 }
510 }
511 }
501 512
502 if (upd != null) 513 if (upd != null)
503 { 514 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index e299f96..0dd1787 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4296,7 +4296,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4296 } 4296 }
4297 4297
4298 4298
4299 pinfo = World.PresenceService.GetAgent(uuid); 4299 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
4300 if (pinfos != null && pinfos.Length > 0)
4301 {
4302 foreach (PresenceInfo p in pinfos)
4303 {
4304 if (p.RegionID != UUID.Zero)
4305 {
4306 pinfo = p;
4307 }
4308 }
4309 }
4300 4310
4301 ce = new UserInfoCacheEntry(); 4311 ce = new UserInfoCacheEntry();
4302 ce.time = Util.EnvironmentTickCount(); 4312 ce.time = Util.EnvironmentTickCount();
@@ -4315,7 +4325,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4315 4325
4316 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) 4326 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000)
4317 { 4327 {
4318 pinfo = World.PresenceService.GetAgent(uuid); 4328 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
4329 if (pinfos != null && pinfos.Length > 0)
4330 {
4331 foreach (PresenceInfo p in pinfos)
4332 {
4333 if (p.RegionID != UUID.Zero)
4334 {
4335 pinfo = p;
4336 }
4337 }
4338 }
4339 else
4340 pinfo = null;
4319 4341
4320 ce.time = Util.EnvironmentTickCount(); 4342 ce.time = Util.EnvironmentTickCount();
4321 ce.pinfo = pinfo; 4343 ce.pinfo = pinfo;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
index b7e8538..0ef4974 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
@@ -291,8 +291,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
291 // Check if the user is online 291 // Check if the user is online
292 if (client.Scene is Scene) 292 if (client.Scene is Scene)
293 { 293 {
294 OpenSim.Services.Interfaces.PresenceInfo presence = ((Scene)client.Scene).PresenceService.GetAgent(avatarID); 294 OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() });
295 if (presence != null) 295 if (presences != null && presences.Length > 0)
296 flags |= ProfileFlags.Online; 296 flags |= ProfileFlags.Online;
297 } 297 }
298 298