aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
diff options
context:
space:
mode:
authorTom Grimshaw2010-05-10 05:44:24 -0700
committerTom Grimshaw2010-05-10 05:44:24 -0700
commit2e94c757296973e07529ad6ae927d9d9251627b6 (patch)
tree5fb348ddf750087898a6fcdfe0a492c305b35d3b /OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
parentGreatly improve login time for users with large friends lists by requesting a... (diff)
parentMerge branch 'master' into careminster-presence-refactor (diff)
downloadopensim-SC-2e94c757296973e07529ad6ae927d9d9251627b6.zip
opensim-SC-2e94c757296973e07529ad6ae927d9d9251627b6.tar.gz
opensim-SC-2e94c757296973e07529ad6ae927d9d9251627b6.tar.bz2
opensim-SC-2e94c757296973e07529ad6ae927d9d9251627b6.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs87
1 files changed, 50 insertions, 37 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 57dde76..8f84d81 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -345,8 +345,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
345 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); 345 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID));
346 im.fromAgentName = account.FirstName + " " + account.LastName; 346 im.fromAgentName = account.FirstName + " " + account.LastName;
347 347
348 PresenceInfo presence = null;
348 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); 349 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
349 PresenceInfo presence = PresenceInfo.GetOnlinePresence(presences); 350 if (presences != null && presences.Length > 0)
351 presence = presences[0];
350 if (presence != null) 352 if (presence != null)
351 im.offline = 0; 353 im.offline = 0;
352 354
@@ -380,13 +382,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
380 PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); 382 PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
381 383
382 foreach (PresenceInfo pi in presence) 384 foreach (PresenceInfo pi in presence)
383 { 385 online.Add(new UUID(pi.UserID));
384 if (pi.Online) 386 //m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID);
385 {
386 online.Add(new UUID(pi.UserID));
387 //m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID);
388 }
389 }
390 387
391 return online; 388 return online;
392 } 389 }
@@ -495,11 +492,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
495 492
496 // The friend is not here [as root]. Let's forward. 493 // The friend is not here [as root]. Let's forward.
497 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 494 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
498 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 495 if (friendSessions != null && friendSessions.Length > 0)
499 if (friendSession != null)
500 { 496 {
501 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 497 PresenceInfo friendSession = friendSessions[0];
502 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); 498 if (friendSession != null)
499 {
500 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
501 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
502 }
503 } 503 }
504 504
505 // Friend is not online. Ignore. 505 // Friend is not online. Ignore.
@@ -537,13 +537,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
537 537
538 // The prospective friend is not here [as root]. Let's forward. 538 // The prospective friend is not here [as root]. Let's forward.
539 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 539 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
540 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 540 if (friendSessions != null && friendSessions.Length > 0)
541 if (friendSession != null)
542 { 541 {
543 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 542 PresenceInfo friendSession = friendSessions[0];
544 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); 543 if (friendSession != null)
544 {
545 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
546 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
547 }
545 } 548 }
546
547 // If the prospective friend is not online, he'll get the message upon login. 549 // If the prospective friend is not online, he'll get the message upon login.
548 } 550 }
549 551
@@ -569,14 +571,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
569 571
570 // The friend is not here 572 // The friend is not here
571 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 573 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
572 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 574 if (friendSessions != null && friendSessions.Length > 0)
573 if (friendSession != null)
574 { 575 {
575 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 576 PresenceInfo friendSession = friendSessions[0];
576 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); 577 if (friendSession != null)
577 client.SendAgentOnline(new UUID[] { friendID }); 578 {
579 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
580 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
581 client.SendAgentOnline(new UUID[] { friendID });
582 }
578 } 583 }
579
580 } 584 }
581 585
582 private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) 586 private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
@@ -595,11 +599,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
595 return; 599 return;
596 600
597 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 601 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
598 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 602 if (friendSessions != null && friendSessions.Length > 0)
599 if (friendSession != null)
600 { 603 {
601 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 604 PresenceInfo friendSession = friendSessions[0];
602 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); 605 if (friendSession != null)
606 {
607 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
608 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
609 }
603 } 610 }
604 } 611 }
605 612
@@ -622,11 +629,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
622 return; 629 return;
623 630
624 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); 631 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
625 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 632 if (friendSessions != null && friendSessions.Length > 0)
626 if (friendSession != null)
627 { 633 {
628 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 634 PresenceInfo friendSession = friendSessions[0];
629 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); 635 if (friendSession != null)
636 {
637 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
638 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
639 }
630 } 640 }
631 } 641 }
632 642
@@ -664,13 +674,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
664 return; 674 return;
665 675
666 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); 676 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
667 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 677 if (friendSessions != null && friendSessions.Length > 0)
668 if (friendSession != null)
669 { 678 {
670 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 679 PresenceInfo friendSession = friendSessions[0];
671 // TODO: You might want to send the delta to save the lookup 680 if (friendSession != null)
672 // on the other end!! 681 {
673 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); 682 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
683 // TODO: You might want to send the delta to save the lookup
684 // on the other end!!
685 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
686 }
674 } 687 }
675 } 688 }
676 } 689 }