aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-14 18:08:02 +0000
committerJustin Clark-Casey (justincc)2011-11-14 18:08:02 +0000
commit348d15707d129c99bc79cd35d544bc62b9a6f1b2 (patch)
treee1377950e09d753d2979134dd96e253ce83e5be9 /OpenSim/Region/CoreModules
parentAdd very simple FriendsModuleTests.TestNoFriends() (diff)
downloadopensim-SC_OLD-348d15707d129c99bc79cd35d544bc62b9a6f1b2.zip
opensim-SC_OLD-348d15707d129c99bc79cd35d544bc62b9a6f1b2.tar.gz
opensim-SC_OLD-348d15707d129c99bc79cd35d544bc62b9a6f1b2.tar.bz2
opensim-SC_OLD-348d15707d129c99bc79cd35d544bc62b9a6f1b2.tar.xz
Add test for adding a friend whilst online
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs21
2 files changed, 30 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 28a2f73..f4281e5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -576,9 +576,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
576 576
577 private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) 577 private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
578 { 578 {
579 m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID); 579 m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", client.AgentId, friendID);
580 580
581 StoreFriendships(agentID, friendID); 581 AddFriend(client, friendID);
582 }
583
584 public void AddFriend(IClientAPI client, UUID friendID)
585 {
586 StoreFriendships(client.AgentId, friendID);
582 587
583 // Update the local cache 588 // Update the local cache
584 RefetchFriends(client); 589 RefetchFriends(client);
@@ -588,7 +593,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
588 // 593 //
589 594
590 // Try Local 595 // Try Local
591 if (LocalFriendshipApproved(agentID, client.Name, friendID)) 596 if (LocalFriendshipApproved(client.AgentId, client.Name, friendID))
592 { 597 {
593 client.SendAgentOnline(new UUID[] { friendID }); 598 client.SendAgentOnline(new UUID[] { friendID });
594 return; 599 return;
@@ -602,7 +607,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
602 if (friendSession != null) 607 if (friendSession != null)
603 { 608 {
604 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 609 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
605 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); 610 m_FriendsSimConnector.FriendshipApproved(region, client.AgentId, client.Name, friendID);
606 client.SendAgentOnline(new UUID[] { friendID }); 611 client.SendAgentOnline(new UUID[] { friendID });
607 } 612 }
608 } 613 }
@@ -869,7 +874,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
869 } 874 }
870 875
871 /// <summary> 876 /// <summary>
872 /// Update loca cache only 877 /// Update local cache only
873 /// </summary> 878 /// </summary>
874 /// <param name="userID"></param> 879 /// <param name="userID"></param>
875 /// <param name="friendID"></param> 880 /// <param name="friendID"></param>
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
index b52093a..3ad691a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
@@ -70,9 +70,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
70 UUID userId = TestHelpers.ParseTail(0x1); 70 UUID userId = TestHelpers.ParseTail(0x1);
71 71
72 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); 72 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
73 73
74 Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0)); 74 Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0));
75 Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(0)); 75 Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(0));
76 } 76 }
77
78 [Test]
79 public void TestAddFriendWhileOnline()
80 {
81 TestHelpers.InMethod();
82// log4net.Config.XmlConfigurator.Configure();
83
84 UUID userId = TestHelpers.ParseTail(0x1);
85 UUID user2Id = TestHelpers.ParseTail(0x2);
86
87 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
88 ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, user2Id);
89
90 // This friendship is currently only one-way, which might be pathalogical in Second Life.
91 m_fm.AddFriend(sp.ControllingClient, user2Id);
92
93 Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0));
94 Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(1));
95 }
77 } 96 }
78} \ No newline at end of file 97} \ No newline at end of file