diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index c266fe5..f6a31b5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -550,7 +550,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
550 | UUID principalID = new UUID(im.fromAgentID); | 550 | UUID principalID = new UUID(im.fromAgentID); |
551 | UUID friendID = new UUID(im.toAgentID); | 551 | UUID friendID = new UUID(im.toAgentID); |
552 | 552 | ||
553 | m_log.DebugFormat("[FRIENDS]: {0} ({1}) offered friendship to {2}", principalID, im.fromAgentName, friendID); | 553 | m_log.DebugFormat("[FRIENDS]: {0} ({1}) offered friendship to {2} ({3})", principalID, client.FirstName + client.LastName, friendID, im.fromAgentName); |
554 | |||
555 | // Check that the friendship doesn't exist yet | ||
556 | FriendInfo[] finfos = GetFriends(principalID); | ||
557 | if (finfos != null) | ||
558 | { | ||
559 | FriendInfo f = GetFriend(finfos, friendID); | ||
560 | if (f != null) | ||
561 | { | ||
562 | client.SendAgentAlertMessage("This person is already your friend. Please delete it first if you want to reestablish the friendship.", false); | ||
563 | return; | ||
564 | } | ||
565 | } | ||
554 | 566 | ||
555 | // This user wants to be friends with the other user. | 567 | // This user wants to be friends with the other user. |
556 | // Let's add the relation backwards, in case the other is not online | 568 | // Let's add the relation backwards, in case the other is not online |
@@ -561,7 +573,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
561 | } | 573 | } |
562 | } | 574 | } |
563 | 575 | ||
564 | private void ForwardFriendshipOffer(UUID agentID, UUID friendID, GridInstantMessage im) | 576 | protected virtual bool ForwardFriendshipOffer(UUID agentID, UUID friendID, GridInstantMessage im) |
565 | { | 577 | { |
566 | // !!!!!!!! This is a hack so that we don't have to keep state (transactionID/imSessionID) | 578 | // !!!!!!!! This is a hack so that we don't have to keep state (transactionID/imSessionID) |
567 | // We stick this agent's ID as imSession, so that it's directly available on the receiving end | 579 | // We stick this agent's ID as imSession, so that it's directly available on the receiving end |
@@ -570,7 +582,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
570 | 582 | ||
571 | // Try the local sim | 583 | // Try the local sim |
572 | if (LocalFriendshipOffered(friendID, im)) | 584 | if (LocalFriendshipOffered(friendID, im)) |
573 | return; | 585 | { |
586 | m_log.DebugFormat("[XXX]: LocalFriendshipOffered successes"); | ||
587 | return true; | ||
588 | } | ||
574 | 589 | ||
575 | // The prospective friend is not here [as root]. Let's forward. | 590 | // The prospective friend is not here [as root]. Let's forward. |
576 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | 591 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); |
@@ -581,9 +596,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
581 | { | 596 | { |
582 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 597 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
583 | m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); | 598 | m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); |
599 | return true; | ||
584 | } | 600 | } |
585 | } | 601 | } |
586 | // If the prospective friend is not online, he'll get the message upon login. | 602 | // If the prospective friend is not online, he'll get the message upon login. |
603 | return false; | ||
587 | } | 604 | } |
588 | 605 | ||
589 | protected virtual string GetFriendshipRequesterName(UUID agentID) | 606 | protected virtual string GetFriendshipRequesterName(UUID agentID) |
@@ -592,7 +609,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
592 | return (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; | 609 | return (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; |
593 | } | 610 | } |
594 | 611 | ||
595 | private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) | 612 | protected virtual void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) |
596 | { | 613 | { |
597 | m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", client.AgentId, friendID); | 614 | m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", client.AgentId, friendID); |
598 | 615 | ||
@@ -603,7 +620,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
603 | { | 620 | { |
604 | StoreFriendships(client.AgentId, friendID); | 621 | StoreFriendships(client.AgentId, friendID); |
605 | 622 | ||
606 | // Update the local cache | 623 | // Update the local cache. |
607 | RecacheFriends(client); | 624 | RecacheFriends(client); |
608 | 625 | ||
609 | // | 626 | // |
@@ -756,7 +773,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
756 | 773 | ||
757 | #region Local | 774 | #region Local |
758 | 775 | ||
759 | public bool LocalFriendshipOffered(UUID toID, GridInstantMessage im) | 776 | public virtual bool LocalFriendshipOffered(UUID toID, GridInstantMessage im) |
760 | { | 777 | { |
761 | IClientAPI friendClient = LocateClientObject(toID); | 778 | IClientAPI friendClient = LocateClientObject(toID); |
762 | if (friendClient != null) | 779 | if (friendClient != null) |
@@ -912,7 +929,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
912 | return FriendsService.GetFriends(client.AgentId); | 929 | return FriendsService.GetFriends(client.AgentId); |
913 | } | 930 | } |
914 | 931 | ||
915 | private void RecacheFriends(IClientAPI client) | 932 | protected void RecacheFriends(IClientAPI client) |
916 | { | 933 | { |
917 | // FIXME: Ideally, we want to avoid doing this here since it sits the EventManager.OnMakeRootAgent event | 934 | // FIXME: Ideally, we want to avoid doing this here since it sits the EventManager.OnMakeRootAgent event |
918 | // is on the critical path for transferring an avatar from one region to another. | 935 | // is on the critical path for transferring an avatar from one region to another. |