diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 27b737632c..995474910e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -337,7 +337,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (UUID.TryParse(friendID, out id)) return base.FriendshipMessage(friendID); - return "Please confirm this friendship you made while you were away."; + return "Please confirm this friendship you made while you where on another HG grid"; } protected override FriendInfo GetFriend(FriendInfo[] friends, UUID friendID) @@ -456,6 +456,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends { // local grid users m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); + DeletePreviousHGRelations(agentID, friendID); base.StoreFriendships(agentID, friendID); return; } @@ -624,6 +625,45 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } } + private void DeletePreviousHGRelations(UUID a1, UUID a2) + { + // Delete any previous friendship relations + FriendInfo[] finfos = null; + finfos = GetFriendsFromCache(a1); + if (finfos != null) + { + foreach (FriendInfo f in finfos) + { + if (f.TheirFlags == -1) + { + if (f.Friend.StartsWith(a2.ToString())) + { + FriendsService.Delete(a1, f.Friend); + // and also the converse + FriendsService.Delete(f.Friend, a1.ToString()); + } + } + } + } + + finfos = GetFriendsFromCache(a1); + if (finfos != null) + { + foreach (FriendInfo f in finfos) + { + if (f.TheirFlags == -1) + { + if (f.Friend.StartsWith(a1.ToString())) + { + FriendsService.Delete(a2, f.Friend); + // and also the converse + FriendsService.Delete(f.Friend, a2.ToString()); + } + } + } + } + } + protected override bool DeleteFriendship(UUID agentID, UUID exfriendID) { Boolean agentIsLocal = true;