aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs48
1 files changed, 38 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 8aa5b91..3a86a46 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -567,19 +567,45 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
567 567
568 private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) 568 private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
569 { 569 {
570 FriendsService.StoreFriend(requester, target.ToString(), rights); 570 if (!m_Friends.ContainsKey(remoteClient.AgentId))
571 return;
571 572
572 // 573 UserFriendData fd = m_Friends[remoteClient.AgentId];
573 // Notify the friend
574 //
575 574
576 IClientAPI friendClient = LocateClientObject(target); 575 FriendsService.StoreFriend(requester, target.ToString(), rights);
577 if (friendClient != null) 576
577 foreach (FriendInfo fi in fd.Friends)
578 { 578 {
579 // the prospective friend in this sim as root agent 579 if (fi.Friend == target.ToString())
580 //friendClient.???; 580 {
581 // we're done 581 IClientAPI friendClient = LocateClientObject(target);
582 return; 582
583 int delta = rights ^ fi.MyFlags;
584 if ((delta & ~1) != 0)
585 {
586 remoteClient.SendChangeUserRights(remoteClient.AgentId, target, rights & ~1);
587 //
588 // Notify the friend
589 //
590
591 if (friendClient != null)
592 {
593 friendClient.SendChangeUserRights(target, remoteClient.AgentId, rights & ~1);
594 }
595 }
596 if ((delta & 1) != 0)
597 {
598 if (friendClient != null)
599 {
600 if ((rights & 1) != 0)
601 friendClient.SendAgentOnline(new UUID[] { new UUID(remoteClient.AgentId) } );
602 else
603 friendClient.SendAgentOffline(new UUID[] { new UUID(remoteClient.AgentId) } );
604 }
605 }
606 if (friendClient != null) // Local, we're done
607 return;
608 }
583 } 609 }
584 610
585 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); 611 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
@@ -587,6 +613,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
587 if (friendSession != null) 613 if (friendSession != null)
588 { 614 {
589 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 615 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
616 // TODO: You might want to send the delta to save the lookup
617 // on the other end!!
590 m_FriendsSimConnector.GrantRights(region, requester, target); 618 m_FriendsSimConnector.GrantRights(region, requester, target);
591 } 619 }
592 } 620 }