diff options
Diffstat (limited to '')
6 files changed, 62 insertions, 31 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 1e36b06..869b069 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -296,9 +296,9 @@ namespace OpenSim.Framework | |||
296 | public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); | 296 | public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); |
297 | 297 | ||
298 | public delegate void FriendActionDelegate( | 298 | public delegate void FriendActionDelegate( |
299 | IClientAPI remoteClient, UUID agentID, UUID transactionID, List<UUID> callingCardFolders); | 299 | IClientAPI remoteClient, UUID transactionID, List<UUID> callingCardFolders); |
300 | 300 | ||
301 | public delegate void FriendshipTermination(IClientAPI remoteClient, UUID agentID, UUID ExID); | 301 | public delegate void FriendshipTermination(IClientAPI remoteClient, UUID ExID); |
302 | 302 | ||
303 | public delegate void MoneyTransferRequest( | 303 | public delegate void MoneyTransferRequest( |
304 | UUID sourceID, UUID destID, int amount, int transactionType, string description); | 304 | UUID sourceID, UUID destID, int amount, int transactionType, string description); |
@@ -458,7 +458,7 @@ namespace OpenSim.Framework | |||
458 | public delegate void AvatarNotesUpdate(IClientAPI client, UUID targetID, string notes); | 458 | public delegate void AvatarNotesUpdate(IClientAPI client, UUID targetID, string notes); |
459 | public delegate void MuteListRequest(IClientAPI client, uint muteCRC); | 459 | public delegate void MuteListRequest(IClientAPI client, uint muteCRC); |
460 | public delegate void AvatarInterestUpdate(IClientAPI client, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); | 460 | public delegate void AvatarInterestUpdate(IClientAPI client, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); |
461 | public delegate void GrantUserFriendRights(IClientAPI client, UUID requester, UUID target, int rights); | 461 | public delegate void GrantUserFriendRights(IClientAPI client, UUID target, int rights); |
462 | public delegate void PlacesQuery(UUID QueryID, UUID TransactionID, string QueryText, uint QueryFlags, byte Category, string SimName, IClientAPI client); | 462 | public delegate void PlacesQuery(UUID QueryID, UUID TransactionID, string QueryText, uint QueryFlags, byte Category, string SimName, IClientAPI client); |
463 | 463 | ||
464 | public delegate void AgentFOV(IClientAPI client, float verticalAngle); | 464 | public delegate void AgentFOV(IClientAPI client, float verticalAngle); |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9899669..f79597e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -5784,7 +5784,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5784 | // My guess is this is the folder to stick the calling card into | 5784 | // My guess is this is the folder to stick the calling card into |
5785 | List<UUID> callingCardFolders = new List<UUID>(); | 5785 | List<UUID> callingCardFolders = new List<UUID>(); |
5786 | 5786 | ||
5787 | UUID agentID = afriendpack.AgentData.AgentID; | ||
5788 | UUID transactionID = afriendpack.TransactionBlock.TransactionID; | 5787 | UUID transactionID = afriendpack.TransactionBlock.TransactionID; |
5789 | 5788 | ||
5790 | for (int fi = 0; fi < afriendpack.FolderData.Length; fi++) | 5789 | for (int fi = 0; fi < afriendpack.FolderData.Length; fi++) |
@@ -5795,10 +5794,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5795 | FriendActionDelegate handlerApproveFriendRequest = OnApproveFriendRequest; | 5794 | FriendActionDelegate handlerApproveFriendRequest = OnApproveFriendRequest; |
5796 | if (handlerApproveFriendRequest != null) | 5795 | if (handlerApproveFriendRequest != null) |
5797 | { | 5796 | { |
5798 | handlerApproveFriendRequest(this, agentID, transactionID, callingCardFolders); | 5797 | handlerApproveFriendRequest(this, transactionID, callingCardFolders); |
5799 | } | 5798 | } |
5800 | return true; | ||
5801 | 5799 | ||
5800 | return true; | ||
5802 | } | 5801 | } |
5803 | 5802 | ||
5804 | private bool HandlerDeclineFriendship(IClientAPI sender, Packet Pack) | 5803 | private bool HandlerDeclineFriendship(IClientAPI sender, Packet Pack) |
@@ -5817,7 +5816,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5817 | if (OnDenyFriendRequest != null) | 5816 | if (OnDenyFriendRequest != null) |
5818 | { | 5817 | { |
5819 | OnDenyFriendRequest(this, | 5818 | OnDenyFriendRequest(this, |
5820 | dfriendpack.AgentData.AgentID, | ||
5821 | dfriendpack.TransactionBlock.TransactionID, | 5819 | dfriendpack.TransactionBlock.TransactionID, |
5822 | null); | 5820 | null); |
5823 | } | 5821 | } |
@@ -5837,14 +5835,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5837 | } | 5835 | } |
5838 | #endregion | 5836 | #endregion |
5839 | 5837 | ||
5840 | UUID listOwnerAgentID = tfriendpack.AgentData.AgentID; | ||
5841 | UUID exFriendID = tfriendpack.ExBlock.OtherID; | 5838 | UUID exFriendID = tfriendpack.ExBlock.OtherID; |
5842 | FriendshipTermination TerminateFriendshipHandler = OnTerminateFriendship; | 5839 | FriendshipTermination TerminateFriendshipHandler = OnTerminateFriendship; |
5843 | if (TerminateFriendshipHandler != null) | 5840 | if (TerminateFriendshipHandler != null) |
5844 | { | 5841 | { |
5845 | TerminateFriendshipHandler(this, listOwnerAgentID, exFriendID); | 5842 | TerminateFriendshipHandler(this, exFriendID); |
5846 | return true; | 5843 | return true; |
5847 | } | 5844 | } |
5845 | |||
5848 | return false; | 5846 | return false; |
5849 | } | 5847 | } |
5850 | 5848 | ||
@@ -11162,12 +11160,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11162 | return true; | 11160 | return true; |
11163 | } | 11161 | } |
11164 | #endregion | 11162 | #endregion |
11163 | |||
11165 | GrantUserFriendRights GrantUserRightsHandler = OnGrantUserRights; | 11164 | GrantUserFriendRights GrantUserRightsHandler = OnGrantUserRights; |
11166 | if (GrantUserRightsHandler != null) | 11165 | if (GrantUserRightsHandler != null) |
11167 | GrantUserRightsHandler(this, | 11166 | GrantUserRightsHandler(this, |
11168 | GrantUserRights.AgentData.AgentID, | ||
11169 | GrantUserRights.Rights[0].AgentRelated, | 11167 | GrantUserRights.Rights[0].AgentRelated, |
11170 | GrantUserRights.Rights[0].RelatedRights); | 11168 | GrantUserRights.Rights[0].RelatedRights); |
11169 | |||
11171 | return true; | 11170 | return true; |
11172 | } | 11171 | } |
11173 | 11172 | ||
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 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index e50a84a..b666dae 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -105,12 +105,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
105 | 105 | ||
106 | #endregion | 106 | #endregion |
107 | 107 | ||
108 | protected override void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) | 108 | protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders) |
109 | { | 109 | { |
110 | // Update the local cache. Yes, we need to do it right here | 110 | // Update the local cache. Yes, we need to do it right here |
111 | // because the HGFriendsService placed something on the DB | 111 | // because the HGFriendsService placed something on the DB |
112 | // from under the sim | 112 | // from under the sim |
113 | base.OnApproveFriendRequest(client, agentID, friendID, callingCardFolders); | 113 | base.OnApproveFriendRequest(client, friendID, callingCardFolders); |
114 | } | 114 | } |
115 | 115 | ||
116 | protected override bool CacheFriends(IClientAPI client) | 116 | protected override bool CacheFriends(IClientAPI client) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs index 34c68cc..94a78cb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs | |||
@@ -120,6 +120,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests | |||
120 | Assert.That(((TestClient)sp1Redux.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(0)); | 120 | Assert.That(((TestClient)sp1Redux.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(0)); |
121 | } | 121 | } |
122 | 122 | ||
123 | // [Test] | ||
124 | // public void TestLoginWithOnlineFriends() | ||
125 | // { | ||
126 | // TestHelpers.InMethod(); | ||
127 | // log4net.Config.XmlConfigurator.Configure(); | ||
128 | // | ||
129 | // UUID user1Id = TestHelpers.ParseTail(0x1); | ||
130 | // UUID user2Id = TestHelpers.ParseTail(0x2); | ||
131 | // | ||
132 | //// UserAccountHelpers.CreateUserWithInventory(m_scene, user1Id); | ||
133 | //// UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id); | ||
134 | //// | ||
135 | //// m_fm.AddFriendship(user1Id, user2Id); | ||
136 | // | ||
137 | // ScenePresence sp1 = SceneHelpers.AddScenePresence(m_scene, user1Id); | ||
138 | // SceneHelpers.AddScenePresence(m_scene, user2Id); | ||
139 | // | ||
140 | // m_fm.AddFriendship(sp1.ControllingClient, user2Id); | ||
141 | //// m_fm.LocalGrantRights | ||
142 | // | ||
143 | // m_scene.RemoveClient(sp1.UUID, true); | ||
144 | // | ||
145 | // ScenePresence sp1Redux = SceneHelpers.AddScenePresence(m_scene, user1Id); | ||
146 | // | ||
147 | // Assert.That(((TestClient)sp1Redux.ControllingClient).ReceivedOfflineNotifications.Count, Is.EqualTo(0)); | ||
148 | // Assert.That(((TestClient)sp1Redux.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(1)); | ||
149 | // } | ||
150 | |||
123 | [Test] | 151 | [Test] |
124 | public void TestAddFriendshipWhileOnline() | 152 | public void TestAddFriendshipWhileOnline() |
125 | { | 153 | { |
diff --git a/OpenSim/Services/Interfaces/IFriendsService.cs b/OpenSim/Services/Interfaces/IFriendsService.cs index 1664f3b..fe94242 100644 --- a/OpenSim/Services/Interfaces/IFriendsService.cs +++ b/OpenSim/Services/Interfaces/IFriendsService.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Services.Interfaces | |||
51 | Friend = string.Empty; | 51 | Friend = string.Empty; |
52 | if (kvp.ContainsKey("Friend") && kvp["Friend"] != null) | 52 | if (kvp.ContainsKey("Friend") && kvp["Friend"] != null) |
53 | Friend = kvp["Friend"].ToString(); | 53 | Friend = kvp["Friend"].ToString(); |
54 | MyFlags = 0; | 54 | MyFlags = (int)FriendRights.None; |
55 | if (kvp.ContainsKey("MyFlags") && kvp["MyFlags"] != null) | 55 | if (kvp.ContainsKey("MyFlags") && kvp["MyFlags"] != null) |
56 | Int32.TryParse(kvp["MyFlags"].ToString(), out MyFlags); | 56 | Int32.TryParse(kvp["MyFlags"].ToString(), out MyFlags); |
57 | TheirFlags = 0; | 57 | TheirFlags = 0; |