diff options
author | Melanie | 2011-11-17 19:04:27 +0000 |
---|---|---|
committer | Melanie | 2011-11-17 19:04:27 +0000 |
commit | 31736b1aac0387e51fe37ea9bab2e2e8c86988b6 (patch) | |
tree | 14fbdc5f9b677185db1fe8080dafe28796c09336 /OpenSim/Region/CoreModules/Avatar | |
parent | Merge branch 'master' into bigmerge (diff) | |
parent | Stop OdePrim and OdeCharacter insanely overriding set LocalID to set their ow... (diff) | |
download | opensim-SC-31736b1aac0387e51fe37ea9bab2e2e8c86988b6.zip opensim-SC-31736b1aac0387e51fe37ea9bab2e2e8c86988b6.tar.gz opensim-SC-31736b1aac0387e51fe37ea9bab2e2e8c86988b6.tar.bz2 opensim-SC-31736b1aac0387e51fe37ea9bab2e2e8c86988b6.tar.xz |
Merge branch 'master' into bigmerge
Conflicts:
OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
3 files changed, 104 insertions, 38 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 0c81bb2..5d94ff7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | ||
32 | using log4net; | 33 | using log4net; |
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
@@ -79,10 +80,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
79 | protected IFriendsService m_FriendsService = null; | 80 | protected IFriendsService m_FriendsService = null; |
80 | protected FriendsSimConnector m_FriendsSimConnector; | 81 | protected FriendsSimConnector m_FriendsSimConnector; |
81 | 82 | ||
82 | protected Dictionary<UUID, UserFriendData> m_Friends = | 83 | /// <summary> |
83 | new Dictionary<UUID, UserFriendData>(); | 84 | /// Cache friends lists for users. |
85 | /// </summary> | ||
86 | /// <remarks> | ||
87 | /// This is a complex and error-prone thing to do. At the moment, we assume that the efficiency gained in | ||
88 | /// permissions checks outweighs the disadvantages of that complexity. | ||
89 | /// </remarks> | ||
90 | protected Dictionary<UUID, UserFriendData> m_Friends = new Dictionary<UUID, UserFriendData>(); | ||
84 | 91 | ||
85 | protected HashSet<UUID> m_NeedsListOfFriends = new HashSet<UUID>(); | 92 | /// <summary> |
93 | /// Maintain a record of viewers that need to be sent notifications for friends that are online. This only | ||
94 | /// needs to be done on login. Subsequent online/offline friend changes are sent by a different mechanism. | ||
95 | /// </summary> | ||
96 | protected HashSet<UUID> m_NeedsListOfOnlineFriends = new HashSet<UUID>(); | ||
86 | 97 | ||
87 | protected IPresenceService PresenceService | 98 | protected IPresenceService PresenceService |
88 | { | 99 | { |
@@ -189,6 +200,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
189 | { | 200 | { |
190 | if (!m_Enabled) | 201 | if (!m_Enabled) |
191 | return; | 202 | return; |
203 | |||
192 | m_log.DebugFormat("[FRIENDS MODULE]: AddRegion on {0}", Name); | 204 | m_log.DebugFormat("[FRIENDS MODULE]: AddRegion on {0}", Name); |
193 | 205 | ||
194 | m_Scenes.Add(scene); | 206 | m_Scenes.Add(scene); |
@@ -241,16 +253,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
241 | client.OnInstantMessage += OnInstantMessage; | 253 | client.OnInstantMessage += OnInstantMessage; |
242 | client.OnApproveFriendRequest += OnApproveFriendRequest; | 254 | client.OnApproveFriendRequest += OnApproveFriendRequest; |
243 | client.OnDenyFriendRequest += OnDenyFriendRequest; | 255 | client.OnDenyFriendRequest += OnDenyFriendRequest; |
244 | client.OnTerminateFriendship += OnTerminateFriendship; | 256 | client.OnTerminateFriendship += (thisClient, agentID, exfriendID) => RemoveFriendship(thisClient, exfriendID); |
245 | client.OnGrantUserRights += OnGrantUserRights; | 257 | client.OnGrantUserRights += OnGrantUserRights; |
246 | 258 | ||
247 | Util.FireAndForget(delegate { FetchFriendslist(client); }); | 259 | // Do not do this asynchronously. If we do, then subsequent code can outrace CacheFriends() and |
260 | // return misleading results from the still empty friends cache. | ||
261 | // If we absolutely need to do this asynchronously, then a signalling mechanism is needed so that calls | ||
262 | // to GetFriends() will wait until CacheFriends() completes. Locks are insufficient. | ||
263 | CacheFriends(client); | ||
248 | } | 264 | } |
249 | 265 | ||
250 | /// Fetch the friends list or increment the refcount for the existing | 266 | /// <summary> |
251 | /// friends list | 267 | /// Cache the friends list or increment the refcount for the existing friends list. |
268 | /// </summary> | ||
269 | /// <param name="client"> | ||
270 | /// </param> | ||
271 | /// <returns> | ||
252 | /// Returns true if the list was fetched, false if it wasn't | 272 | /// Returns true if the list was fetched, false if it wasn't |
253 | protected virtual bool FetchFriendslist(IClientAPI client) | 273 | /// </returns> |
274 | protected virtual bool CacheFriends(IClientAPI client) | ||
254 | { | 275 | { |
255 | UUID agentID = client.AgentId; | 276 | UUID agentID = client.AgentId; |
256 | lock (m_Friends) | 277 | lock (m_Friends) |
@@ -297,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
297 | 318 | ||
298 | private void OnMakeRootAgent(ScenePresence sp) | 319 | private void OnMakeRootAgent(ScenePresence sp) |
299 | { | 320 | { |
300 | RefetchFriends(sp.ControllingClient); | 321 | RecacheFriends(sp.ControllingClient); |
301 | } | 322 | } |
302 | 323 | ||
303 | private void OnClientLogin(IClientAPI client) | 324 | private void OnClientLogin(IClientAPI client) |
@@ -309,8 +330,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
309 | StatusChange(agentID, true); | 330 | StatusChange(agentID, true); |
310 | 331 | ||
311 | // Register that we need to send the list of online friends to this user | 332 | // Register that we need to send the list of online friends to this user |
312 | lock (m_NeedsListOfFriends) | 333 | lock (m_NeedsListOfOnlineFriends) |
313 | m_NeedsListOfFriends.Add(agentID); | 334 | m_NeedsListOfOnlineFriends.Add(agentID); |
314 | } | 335 | } |
315 | 336 | ||
316 | public virtual bool SendFriendsOnlineIfNeeded(IClientAPI client) | 337 | public virtual bool SendFriendsOnlineIfNeeded(IClientAPI client) |
@@ -318,9 +339,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
318 | UUID agentID = client.AgentId; | 339 | UUID agentID = client.AgentId; |
319 | 340 | ||
320 | // Check if the online friends list is needed | 341 | // Check if the online friends list is needed |
321 | lock (m_NeedsListOfFriends) | 342 | lock (m_NeedsListOfOnlineFriends) |
322 | { | 343 | { |
323 | if (!m_NeedsListOfFriends.Remove(agentID)) | 344 | if (!m_NeedsListOfOnlineFriends.Remove(agentID)) |
324 | return false; | 345 | return false; |
325 | } | 346 | } |
326 | 347 | ||
@@ -328,7 +349,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
328 | List<UUID> online = GetOnlineFriends(agentID); | 349 | List<UUID> online = GetOnlineFriends(agentID); |
329 | if (online.Count > 0) | 350 | if (online.Count > 0) |
330 | { | 351 | { |
331 | m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count); | 352 | m_log.DebugFormat( |
353 | "[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", | ||
354 | client.Name, client.Scene.RegionInfo.RegionName, online.Count); | ||
355 | |||
332 | client.SendAgentOnline(online.ToArray()); | 356 | client.SendAgentOnline(online.ToArray()); |
333 | } | 357 | } |
334 | 358 | ||
@@ -586,7 +610,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
586 | } | 610 | } |
587 | 611 | ||
588 | // Update the local cache | 612 | // Update the local cache |
589 | RefetchFriends(client); | 613 | RecacheFriends(client); |
590 | 614 | ||
591 | // | 615 | // |
592 | // Notify the friend | 616 | // Notify the friend |
@@ -641,14 +665,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
641 | } | 665 | } |
642 | } | 666 | } |
643 | } | 667 | } |
644 | 668 | ||
645 | private void OnTerminateFriendship(IClientAPI client, UUID agentID, UUID exfriendID) | 669 | public void RemoveFriendship(IClientAPI client, UUID exfriendID) |
646 | { | 670 | { |
647 | if (!DeleteFriendship(agentID, exfriendID)) | 671 | if (!DeleteFriendship(client.AgentId, exfriendID)) |
648 | client.SendAlertMessage("Unable to terminate friendship on this sim."); | 672 | client.SendAlertMessage("Unable to terminate friendship on this sim."); |
649 | 673 | ||
650 | // Update local cache | 674 | // Update local cache |
651 | RefetchFriends(client); | 675 | RecacheFriends(client); |
652 | 676 | ||
653 | client.SendTerminateFriend(exfriendID); | 677 | client.SendTerminateFriend(exfriendID); |
654 | 678 | ||
@@ -667,9 +691,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
667 | if (friendSession != null) | 691 | if (friendSession != null) |
668 | { | 692 | { |
669 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 693 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
670 | m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); | 694 | m_FriendsSimConnector.FriendshipTerminated(region, client.AgentId, exfriendID); |
671 | } | 695 | } |
672 | } | 696 | } |
673 | } | 697 | } |
674 | 698 | ||
675 | private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) | 699 | private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) |
@@ -769,7 +793,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
769 | 793 | ||
770 | 794 | ||
771 | // Update the local cache | 795 | // Update the local cache |
772 | RefetchFriends(friendClient); | 796 | RecacheFriends(friendClient); |
773 | 797 | ||
774 | // we're done | 798 | // we're done |
775 | return true; | 799 | return true; |
@@ -802,7 +826,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
802 | // the friend in this sim as root agent | 826 | // the friend in this sim as root agent |
803 | friendClient.SendTerminateFriend(exfriendID); | 827 | friendClient.SendTerminateFriend(exfriendID); |
804 | // update local cache | 828 | // update local cache |
805 | RefetchFriends(friendClient); | 829 | RecacheFriends(friendClient); |
806 | // we're done | 830 | // we're done |
807 | return true; | 831 | return true; |
808 | } | 832 | } |
@@ -819,16 +843,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
819 | if (onlineBitChanged) | 843 | if (onlineBitChanged) |
820 | { | 844 | { |
821 | if ((rights & (int)FriendRights.CanSeeOnline) == 1) | 845 | if ((rights & (int)FriendRights.CanSeeOnline) == 1) |
822 | friendClient.SendAgentOnline(new UUID[] { new UUID(userID) }); | 846 | friendClient.SendAgentOnline(new UUID[] { userID }); |
823 | else | 847 | else |
824 | friendClient.SendAgentOffline(new UUID[] { new UUID(userID) }); | 848 | friendClient.SendAgentOffline(new UUID[] { userID }); |
825 | } | 849 | } |
826 | else | 850 | else |
827 | { | 851 | { |
828 | bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0; | 852 | bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0; |
829 | if (canEditObjectsChanged) | 853 | if (canEditObjectsChanged) |
830 | friendClient.SendChangeUserRights(userID, friendID, rights); | 854 | friendClient.SendChangeUserRights(userID, friendID, rights); |
831 | |||
832 | } | 855 | } |
833 | 856 | ||
834 | // Update local cache | 857 | // Update local cache |
@@ -847,7 +870,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
847 | IClientAPI friendClient = LocateClientObject(friendID); | 870 | IClientAPI friendClient = LocateClientObject(friendID); |
848 | if (friendClient != null) | 871 | if (friendClient != null) |
849 | { | 872 | { |
850 | // the friend in this sim as root agent | 873 | // the friend in this sim as root agent |
851 | if (online) | 874 | if (online) |
852 | friendClient.SendAgentOnline(new UUID[] { userID }); | 875 | friendClient.SendAgentOnline(new UUID[] { userID }); |
853 | else | 876 | else |
@@ -902,8 +925,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
902 | return FriendsService.GetFriends(client.AgentId); | 925 | return FriendsService.GetFriends(client.AgentId); |
903 | } | 926 | } |
904 | 927 | ||
905 | private void RefetchFriends(IClientAPI client) | 928 | private void RecacheFriends(IClientAPI client) |
906 | { | 929 | { |
930 | // FIXME: Ideally, we want to avoid doing this here since it sits the EventManager.OnMakeRootAgent event | ||
931 | // is on the critical path for transferring an avatar from one region to another. | ||
907 | UUID agentID = client.AgentId; | 932 | UUID agentID = client.AgentId; |
908 | lock (m_Friends) | 933 | lock (m_Friends) |
909 | { | 934 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 02b417f..9a97925 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -30,7 +30,6 @@ using System.Collections; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | |||
34 | using log4net; | 33 | using log4net; |
35 | using Nini.Config; | 34 | using Nini.Config; |
36 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
@@ -84,9 +83,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
84 | 83 | ||
85 | #endregion | 84 | #endregion |
86 | 85 | ||
87 | protected override bool FetchFriendslist(IClientAPI client) | 86 | protected override bool CacheFriends(IClientAPI client) |
88 | { | 87 | { |
89 | if (base.FetchFriendslist(client)) | 88 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Entered CacheFriends for {0}", client.Name); |
89 | |||
90 | if (base.CacheFriends(client)) | ||
90 | { | 91 | { |
91 | UUID agentID = client.AgentId; | 92 | UUID agentID = client.AgentId; |
92 | // we do this only for the root agent | 93 | // we do this only for the root agent |
@@ -110,14 +111,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
110 | } | 111 | } |
111 | } | 112 | } |
112 | } | 113 | } |
114 | |||
115 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting CacheFriends for {0} since detected root agent", client.Name); | ||
113 | return true; | 116 | return true; |
114 | } | 117 | } |
115 | } | 118 | } |
119 | |||
120 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting CacheFriends for {0} since detected not root agent", client.Name); | ||
116 | return false; | 121 | return false; |
117 | } | 122 | } |
118 | 123 | ||
119 | public override bool SendFriendsOnlineIfNeeded(IClientAPI client) | 124 | public override bool SendFriendsOnlineIfNeeded(IClientAPI client) |
120 | { | 125 | { |
126 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering SendFriendsOnlineIfNeeded for {0}", client.Name); | ||
127 | |||
121 | if (base.SendFriendsOnlineIfNeeded(client)) | 128 | if (base.SendFriendsOnlineIfNeeded(client)) |
122 | { | 129 | { |
123 | AgentCircuitData aCircuit = ((Scene)client.Scene).AuthenticateHandler.GetAgentCircuitData(client.AgentId); | 130 | AgentCircuitData aCircuit = ((Scene)client.Scene).AuthenticateHandler.GetAgentCircuitData(client.AgentId); |
@@ -134,11 +141,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
134 | } | 141 | } |
135 | } | 142 | } |
136 | } | 143 | } |
144 | |||
145 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting SendFriendsOnlineIfNeeded for {0}", client.Name); | ||
137 | return false; | 146 | return false; |
138 | } | 147 | } |
139 | 148 | ||
140 | protected override void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online) | 149 | protected override void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online) |
141 | { | 150 | { |
151 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetOnlineFriends for {0}", userID); | ||
152 | |||
142 | List<string> fList = new List<string>(); | 153 | List<string> fList = new List<string>(); |
143 | foreach (string s in friendList) | 154 | foreach (string s in friendList) |
144 | { | 155 | { |
@@ -157,6 +168,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
157 | if (UUID.TryParse(pi.UserID, out presenceID)) | 168 | if (UUID.TryParse(pi.UserID, out presenceID)) |
158 | online.Add(presenceID); | 169 | online.Add(presenceID); |
159 | } | 170 | } |
171 | |||
172 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetOnlineFriends for {0}", userID); | ||
160 | } | 173 | } |
161 | 174 | ||
162 | //protected override void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online) | 175 | //protected override void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online) |
@@ -246,6 +259,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
246 | 259 | ||
247 | protected override void StatusNotify(List<FriendInfo> friendList, UUID userID, bool online) | 260 | protected override void StatusNotify(List<FriendInfo> friendList, UUID userID, bool online) |
248 | { | 261 | { |
262 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering StatusNotify for {0}", userID); | ||
263 | |||
249 | // First, let's divide the friends on a per-domain basis | 264 | // First, let's divide the friends on a per-domain basis |
250 | Dictionary<string, List<FriendInfo>> friendsPerDomain = new Dictionary<string, List<FriendInfo>>(); | 265 | Dictionary<string, List<FriendInfo>> friendsPerDomain = new Dictionary<string, List<FriendInfo>>(); |
251 | foreach (FriendInfo friend in friendList) | 266 | foreach (FriendInfo friend in friendList) |
@@ -298,6 +313,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
298 | } | 313 | } |
299 | } | 314 | } |
300 | } | 315 | } |
316 | |||
317 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting StatusNotify for {0}", userID); | ||
301 | } | 318 | } |
302 | 319 | ||
303 | protected override bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last) | 320 | protected override bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last) |
@@ -351,6 +368,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
351 | 368 | ||
352 | protected override FriendInfo[] GetFriendsFromService(IClientAPI client) | 369 | protected override FriendInfo[] GetFriendsFromService(IClientAPI client) |
353 | { | 370 | { |
371 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); | ||
372 | |||
354 | UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, client.AgentId); | 373 | UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, client.AgentId); |
355 | if (account1 != null) | 374 | if (account1 != null) |
356 | return base.GetFriendsFromService(client); | 375 | return base.GetFriendsFromService(client); |
@@ -365,6 +384,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
365 | finfos = FriendsService.GetFriends(agentUUI); | 384 | finfos = FriendsService.GetFriends(agentUUI); |
366 | m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, agentUUI); | 385 | m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, agentUUI); |
367 | } | 386 | } |
387 | |||
388 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name); | ||
389 | |||
368 | return finfos; | 390 | return finfos; |
369 | } | 391 | } |
370 | 392 | ||
@@ -401,7 +423,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
401 | } | 423 | } |
402 | 424 | ||
403 | return false; | 425 | return false; |
404 | |||
405 | } | 426 | } |
406 | 427 | ||
407 | protected override void StoreBackwards(UUID friendID, UUID agentID) | 428 | protected override void StoreBackwards(UUID friendID, UUID agentID) |
@@ -627,4 +648,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
627 | } | 648 | } |
628 | } | 649 | } |
629 | } | 650 | } |
630 | } | 651 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs index c945dcf..682fbab 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs | |||
@@ -71,12 +71,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests | |||
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).ReceivedOfflineNotifications.Count, Is.EqualTo(0)); |
75 | Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(0)); | 75 | Assert.That(((TestClient)sp.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(0)); |
76 | } | 76 | } |
77 | 77 | ||
78 | [Test] | 78 | [Test] |
79 | public void TestAddFriendWhileOnline() | 79 | public void TestAddFriendshipWhileOnline() |
80 | { | 80 | { |
81 | TestHelpers.InMethod(); | 81 | TestHelpers.InMethod(); |
82 | // log4net.Config.XmlConfigurator.Configure(); | 82 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -91,8 +91,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests | |||
91 | // notification. | 91 | // notification. |
92 | m_fm.AddFriendship(sp.ControllingClient, user2Id); | 92 | m_fm.AddFriendship(sp.ControllingClient, user2Id); |
93 | 93 | ||
94 | Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0)); | 94 | Assert.That(((TestClient)sp.ControllingClient).ReceivedOfflineNotifications.Count, Is.EqualTo(0)); |
95 | Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(1)); | 95 | Assert.That(((TestClient)sp.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(1)); |
96 | } | ||
97 | |||
98 | [Test] | ||
99 | public void TestRemoveFriendshipWhileOnline() | ||
100 | { | ||
101 | TestHelpers.InMethod(); | ||
102 | // log4net.Config.XmlConfigurator.Configure(); | ||
103 | |||
104 | UUID user1Id = TestHelpers.ParseTail(0x1); | ||
105 | UUID user2Id = TestHelpers.ParseTail(0x2); | ||
106 | |||
107 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, user1Id); | ||
108 | SceneHelpers.AddScenePresence(m_scene, user2Id); | ||
109 | |||
110 | m_fm.AddFriendship(sp.ControllingClient, user2Id); | ||
111 | m_fm.RemoveFriendship(sp.ControllingClient, user2Id); | ||
112 | |||
113 | TestClient user1Client = sp.ControllingClient as TestClient; | ||
114 | Assert.That(user1Client.ReceivedFriendshipTerminations.Count, Is.EqualTo(1)); | ||
115 | Assert.That(user1Client.ReceivedFriendshipTerminations[0], Is.EqualTo(user2Id)); | ||
96 | } | 116 | } |
97 | } | 117 | } |
98 | } \ No newline at end of file | 118 | } \ No newline at end of file |