aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs58
1 files changed, 50 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index 27b7376..fae1e05 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
141 if (avatar == null) 141 if (avatar == null)
142 return; 142 return;
143 143
144 if (avatar.UserLevel < m_levelHGFriends) 144 if (avatar.GodController.UserLevel < m_levelHGFriends)
145 { 145 {
146 client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false); 146 client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false);
147 return; 147 return;
@@ -214,7 +214,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
214 FriendInfo[] friends = GetFriendsFromCache(client.AgentId); 214 FriendInfo[] friends = GetFriendsFromCache(client.AgentId);
215 foreach (FriendInfo f in friends) 215 foreach (FriendInfo f in friends)
216 { 216 {
217 client.SendChangeUserRights(new UUID(f.Friend), client.AgentId, f.TheirFlags); 217 int rights = f.TheirFlags;
218 if(rights != -1 )
219 client.SendChangeUserRights(new UUID(f.Friend), client.AgentId, rights);
218 } 220 }
219 } 221 }
220 } 222 }
@@ -337,7 +339,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
337 if (UUID.TryParse(friendID, out id)) 339 if (UUID.TryParse(friendID, out id))
338 return base.FriendshipMessage(friendID); 340 return base.FriendshipMessage(friendID);
339 341
340 return "Please confirm this friendship you made while you were away."; 342 return "Please confirm this friendship you made while you where on another HG grid";
341 } 343 }
342 344
343 protected override FriendInfo GetFriend(FriendInfo[] friends, UUID friendID) 345 protected override FriendInfo GetFriend(FriendInfo[] friends, UUID friendID)
@@ -456,6 +458,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
456 { 458 {
457 // local grid users 459 // local grid users
458 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); 460 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local");
461 DeletePreviousHGRelations(agentID, friendID);
459 base.StoreFriendships(agentID, friendID); 462 base.StoreFriendships(agentID, friendID);
460 return; 463 return;
461 } 464 }
@@ -538,8 +541,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
538 // m_log.DebugFormat("[HGFRIENDS MODULE] HG Friendship! thisUUI={0}; friendUUI={1}; foreignThisFriendService={2}; foreignFriendFriendService={3}", 541 // m_log.DebugFormat("[HGFRIENDS MODULE] HG Friendship! thisUUI={0}; friendUUI={1}; foreignThisFriendService={2}; foreignFriendFriendService={3}",
539 // agentUUI, friendUUI, agentFriendService, friendFriendService); 542 // agentUUI, friendUUI, agentFriendService, friendFriendService);
540 543
541 } 544 }
542 545
543 // Delete any previous friendship relations 546 // Delete any previous friendship relations
544 DeletePreviousRelations(agentID, friendID); 547 DeletePreviousRelations(agentID, friendID);
545 548
@@ -624,6 +627,45 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
624 } 627 }
625 } 628 }
626 629
630 private void DeletePreviousHGRelations(UUID a1, UUID a2)
631 {
632 // Delete any previous friendship relations
633 FriendInfo[] finfos = null;
634 finfos = GetFriendsFromCache(a1);
635 if (finfos != null)
636 {
637 foreach (FriendInfo f in finfos)
638 {
639 if (f.TheirFlags == -1)
640 {
641 if (f.Friend.StartsWith(a2.ToString()))
642 {
643 FriendsService.Delete(a1, f.Friend);
644 // and also the converse
645 FriendsService.Delete(f.Friend, a1.ToString());
646 }
647 }
648 }
649 }
650
651 finfos = GetFriendsFromCache(a1);
652 if (finfos != null)
653 {
654 foreach (FriendInfo f in finfos)
655 {
656 if (f.TheirFlags == -1)
657 {
658 if (f.Friend.StartsWith(a1.ToString()))
659 {
660 FriendsService.Delete(a2, f.Friend);
661 // and also the converse
662 FriendsService.Delete(f.Friend, a2.ToString());
663 }
664 }
665 }
666 }
667 }
668
627 protected override bool DeleteFriendship(UUID agentID, UUID exfriendID) 669 protected override bool DeleteFriendship(UUID agentID, UUID exfriendID)
628 { 670 {
629 Boolean agentIsLocal = true; 671 Boolean agentIsLocal = true;
@@ -743,7 +785,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
743 m_log.DebugFormat("[HGFRIENDS MODULE]: Forwading friendship from {0} to {1} @ {2}", agentID, friendID, friendsURL); 785 m_log.DebugFormat("[HGFRIENDS MODULE]: Forwading friendship from {0} to {1} @ {2}", agentID, friendID, friendsURL);
744 GridRegion region = new GridRegion(); 786 GridRegion region = new GridRegion();
745 region.ServerURI = friendsURL; 787 region.ServerURI = friendsURL;
746 788
747 string name = im.fromAgentName; 789 string name = im.fromAgentName;
748 if (m_uMan.IsLocalGridUser(agentID)) 790 if (m_uMan.IsLocalGridUser(agentID))
749 { 791 {
@@ -775,7 +817,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
775 } 817 }
776 818
777 m_HGFriendsConnector.FriendshipOffered(region, agentID, friendID, im.message, name); 819 m_HGFriendsConnector.FriendshipOffered(region, agentID, friendID, im.message, name);
778 820
779 return true; 821 return true;
780 } 822 }
781 } 823 }
@@ -804,4 +846,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
804 return false; 846 return false;
805 } 847 }
806 } 848 }
807} \ No newline at end of file 849}