OpenSim.Region.CoreModules.Avatar.Friends.FriendsModule.OnApproveFriendRequest C# (CSharp) Method

OnApproveFriendRequest() private method

private OnApproveFriendRequest ( IClientAPI client, UUID agentID, UUID friendID, List callingCardFolders ) : void
client IClientAPI
agentID UUID
friendID UUID
callingCardFolders List
return void
        private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
        {
            m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID);
            
            FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
            FriendsService.StoreFriend(friendID, agentID.ToString(), 1);

            // Update the local cache
            UpdateFriendsCache(agentID);

            //
            // Notify the friend
            //

            // Try Local
            if (LocalFriendshipApproved(agentID, client.Name, friendID))
            {
                client.SendAgentOnline(new UUID[] { friendID });
                return;
            }

            // The friend is not here
            PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
            if (friendSessions != null && friendSessions.Length > 0)
            {
                PresenceInfo friendSession = friendSessions[0];
                if (friendSession != null)
                {
                    GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                    m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
                    client.SendAgentOnline(new UUID[] { friendID });
                }
            }
        }