From 8b5bacc78bc83cc482712c226999f48708da1aeb Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 14 Nov 2011 20:31:16 +0000 Subject: [PATCH] Improved method doc for AddFriend() - it actually does set up a two-way relationship. Rename IFriendsModule.AddFriend() to AddFriendship() --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 4 ++-- .../CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs | 5 +++-- OpenSim/Region/Framework/Interfaces/IFriendsModule.cs | 7 ++----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index cc8ee5ac0c..6c207bdb22 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -580,10 +580,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends { m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", client.AgentId, friendID); - AddFriend(client, friendID); + AddFriendship(client, friendID); } - public void AddFriend(IClientAPI client, UUID friendID) + public void AddFriendship(IClientAPI client, UUID friendID) { StoreFriendships(client.AgentId, friendID); diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs index 3ad691a519..1e97c23454 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs @@ -87,8 +87,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, user2Id); - // This friendship is currently only one-way, which might be pathalogical in Second Life. - m_fm.AddFriend(sp.ControllingClient, user2Id); + // This fiendship is two-way but without a connector, only the first user will receive the online + // notification. + m_fm.AddFriendship(sp.ControllingClient, user2Id); Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0)); Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(1)); diff --git a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs index 8143164283..fdede340fc 100644 --- a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs @@ -34,18 +34,15 @@ namespace OpenSim.Region.Framework.Interfaces public interface IFriendsModule { /// - /// Add a friend for the given user. + /// Add a friendship between two users. /// /// - /// This is a one-way friendship. To make a two way friendship you will need to call this again with the - /// client and friend reversed. - /// /// Ultimately, it would be more useful to take in a user account here rather than having to have a user /// present in the scene. /// /// /// - void AddFriend(IClientAPI client, UUID friendID); + void AddFriendship(IClientAPI client, UUID friendID); uint GetFriendPerms(UUID PrincipalID, UUID FriendID); bool SendFriendsOnlineIfNeeded(IClientAPI client);