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.cs40
1 files changed, 22 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 0c83679..86e04b9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -258,7 +258,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
258 client.OnInstantMessage += OnInstantMessage; 258 client.OnInstantMessage += OnInstantMessage;
259 client.OnApproveFriendRequest += OnApproveFriendRequest; 259 client.OnApproveFriendRequest += OnApproveFriendRequest;
260 client.OnDenyFriendRequest += OnDenyFriendRequest; 260 client.OnDenyFriendRequest += OnDenyFriendRequest;
261 client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID); 261 client.OnTerminateFriendship += RemoveFriendship;
262 client.OnGrantUserRights += OnGrantUserRights; 262 client.OnGrantUserRights += OnGrantUserRights;
263 263
264 // We need to cache information for child agents as well as root agents so that friend edit/move/delete 264 // We need to cache information for child agents as well as root agents so that friend edit/move/delete
@@ -355,14 +355,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
355 355
356 // Send the friends online 356 // Send the friends online
357 List<UUID> online = GetOnlineFriends(agentID); 357 List<UUID> online = GetOnlineFriends(agentID);
358 if (online.Count > 0)
359 {
360 m_log.DebugFormat(
361 "[FRIENDS MODULE]: User {0} in region {1} has {2} friends online",
362 client.Name, client.Scene.RegionInfo.RegionName, online.Count);
363 358
359// m_log.DebugFormat(
360// "[FRIENDS MODULE]: User {0} in region {1} has {2} friends online",
361// client.Name, client.Scene.RegionInfo.RegionName, online.Count);
362
363 if (online.Count > 0)
364 client.SendAgentOnline(online.ToArray()); 364 client.SendAgentOnline(online.ToArray());
365 }
366 365
367 // Send outstanding friendship offers 366 // Send outstanding friendship offers
368 List<string> outstanding = new List<string>(); 367 List<string> outstanding = new List<string>();
@@ -495,7 +494,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
495 List<FriendInfo> friendList = new List<FriendInfo>(); 494 List<FriendInfo> friendList = new List<FriendInfo>();
496 foreach (FriendInfo fi in friends) 495 foreach (FriendInfo fi in friends)
497 { 496 {
498 if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) 497 if (((fi.MyFlags & (int)FriendRights.CanSeeOnline) != 0) && (fi.TheirFlags != -1))
499 friendList.Add(fi); 498 friendList.Add(fi);
500 } 499 }
501 500
@@ -614,7 +613,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
614 return (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; 613 return (account == null) ? "Unknown" : account.FirstName + " " + account.LastName;
615 } 614 }
616 615
617 protected virtual void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) 616 protected virtual void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders)
618 { 617 {
619 m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", client.AgentId, friendID); 618 m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", client.AgentId, friendID);
620 619
@@ -659,18 +658,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
659 } 658 }
660 } 659 }
661 660
662 private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) 661 private void OnDenyFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders)
663 { 662 {
664 m_log.DebugFormat("[FRIENDS]: {0} denied friendship to {1}", agentID, friendID); 663 m_log.DebugFormat("[FRIENDS]: {0} denied friendship to {1}", client.AgentId, friendID);
665 664
666 DeleteFriendship(agentID, friendID); 665 DeleteFriendship(client.AgentId, friendID);
667 666
668 // 667 //
669 // Notify the friend 668 // Notify the friend
670 // 669 //
671 670
672 // Try local 671 // Try local
673 if (LocalFriendshipDenied(agentID, client.Name, friendID)) 672 if (LocalFriendshipDenied(client.AgentId, client.Name, friendID))
674 return; 673 return;
675 674
676 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 675 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
@@ -681,7 +680,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
681 { 680 {
682 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 681 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
683 if (region != null) 682 if (region != null)
684 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); 683 m_FriendsSimConnector.FriendshipDenied(region, client.AgentId, client.Name, friendID);
685 else 684 else
686 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); 685 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
687 } 686 }
@@ -718,11 +717,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
718 } 717 }
719 } 718 }
720 719
721 private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) 720 private void OnGrantUserRights(IClientAPI remoteClient, UUID target, int rights)
722 { 721 {
723 m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); 722 UUID requester = remoteClient.AgentId;
724 723
725 FriendInfo[] friends = GetFriends(remoteClient.AgentId); 724 m_log.DebugFormat(
725 "[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}",
726 requester, rights, target);
727
728 FriendInfo[] friends = GetFriends(requester);
726 if (friends.Length == 0) 729 if (friends.Length == 0)
727 { 730 {
728 return; 731 return;
@@ -769,7 +772,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
769 } 772 }
770 } 773 }
771 else 774 else
775 {
772 m_log.DebugFormat("[FRIENDS MODULE]: friend {0} not found for {1}", target, requester); 776 m_log.DebugFormat("[FRIENDS MODULE]: friend {0} not found for {1}", target, requester);
777 }
773 } 778 }
774 779
775 protected virtual FriendInfo GetFriend(FriendInfo[] friends, UUID friendID) 780 protected virtual FriendInfo GetFriend(FriendInfo[] friends, UUID friendID)
@@ -813,7 +818,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
813 ccm.CreateCallingCard(friendID, userID, UUID.Zero); 818 ccm.CreateCallingCard(friendID, userID, UUID.Zero);
814 } 819 }
815 820
816
817 // Update the local cache 821 // Update the local cache
818 RecacheFriends(friendClient); 822 RecacheFriends(friendClient);
819 823