aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
diff options
context:
space:
mode:
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 febd4ca..0c81f44 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 }
@@ -462,11 +459,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
462 459
463 // The friend is not here [as root]. Let's forward. 460 // The friend is not here [as root]. Let's forward.
464 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 461 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
465 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 462 if (friendSessions != null && friendSessions.Length > 0)
466 if (friendSession != null)
467 { 463 {
468 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 464 PresenceInfo friendSession = friendSessions[0];
469 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); 465 if (friendSession != null)
466 {
467 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
468 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
469 }
470 } 470 }
471 471
472 // Friend is not online. Ignore. 472 // Friend is not online. Ignore.
@@ -504,13 +504,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
504 504
505 // The prospective friend is not here [as root]. Let's forward. 505 // The prospective friend is not here [as root]. Let's forward.
506 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 506 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
507 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 507 if (friendSessions != null && friendSessions.Length > 0)
508 if (friendSession != null)
509 { 508 {
510 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 509 PresenceInfo friendSession = friendSessions[0];
511 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); 510 if (friendSession != null)
511 {
512 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
513 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
514 }
512 } 515 }
513
514 // If the prospective friend is not online, he'll get the message upon login. 516 // If the prospective friend is not online, he'll get the message upon login.
515 } 517 }
516 518
@@ -536,14 +538,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
536 538
537 // The friend is not here 539 // The friend is not here
538 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 540 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
539 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 541 if (friendSessions != null && friendSessions.Length > 0)
540 if (friendSession != null)
541 { 542 {
542 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 543 PresenceInfo friendSession = friendSessions[0];
543 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); 544 if (friendSession != null)
544 client.SendAgentOnline(new UUID[] { friendID }); 545 {
546 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
547 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
548 client.SendAgentOnline(new UUID[] { friendID });
549 }
545 } 550 }
546
547 } 551 }
548 552
549 private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) 553 private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
@@ -562,11 +566,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
562 return; 566 return;
563 567
564 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 568 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
565 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 569 if (friendSessions != null && friendSessions.Length > 0)
566 if (friendSession != null)
567 { 570 {
568 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 571 PresenceInfo friendSession = friendSessions[0];
569 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); 572 if (friendSession != null)
573 {
574 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
575 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
576 }
570 } 577 }
571 } 578 }
572 579
@@ -589,11 +596,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
589 return; 596 return;
590 597
591 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); 598 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
592 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 599 if (friendSessions != null && friendSessions.Length > 0)
593 if (friendSession != null)
594 { 600 {
595 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 601 PresenceInfo friendSession = friendSessions[0];
596 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); 602 if (friendSession != null)
603 {
604 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
605 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
606 }
597 } 607 }
598 } 608 }
599 609
@@ -631,13 +641,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
631 return; 641 return;
632 642
633 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); 643 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
634 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 644 if (friendSessions != null && friendSessions.Length > 0)
635 if (friendSession != null)
636 { 645 {
637 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 646 PresenceInfo friendSession = friendSessions[0];
638 // TODO: You might want to send the delta to save the lookup 647 if (friendSession != null)
639 // on the other end!! 648 {
640 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); 649 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
650 // TODO: You might want to send the delta to save the lookup
651 // on the other end!!
652 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
653 }
641 } 654 }
642 } 655 }
643 } 656 }