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

ForwardFriendshipOffer() private method

private ForwardFriendshipOffer ( UUID agentID, UUID friendID, OpenSim.Framework.GridInstantMessage im ) : void
agentID UUID
friendID UUID
im OpenSim.Framework.GridInstantMessage
return void
        private void ForwardFriendshipOffer(UUID agentID, UUID friendID, GridInstantMessage im)
        {
            // !!!!!!!! This is a hack so that we don't have to keep state (transactionID/imSessionID)
            // We stick this agent's ID as imSession, so that it's directly available on the receiving end
            im.imSessionID = im.fromAgentID;

            // Try the local sim
            UserAccount account = UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, agentID);
            im.fromAgentName = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName;
            
            if (LocalFriendshipOffered(friendID, im))
                return;

            // The prospective friend is not here [as root]. Let's forward.
            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.FriendshipOffered(region, agentID, friendID, im.message);
                }
            }
            // If the prospective friend is not online, he'll get the message upon login.
        }