コード例 #1
0
        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.
        }
コード例 #2
0
ファイル: FriendsModule.cs プロジェクト: BogusCurry/opensim-1
        protected virtual bool 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;
            im.fromAgentName = GetFriendshipRequesterName(agentID);

            // Try the local sim
            if (LocalFriendshipOffered(friendID, im))
            {
                return(true);
            }

            // 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);
                    return(true);
                }
            }
            // If the prospective friend is not online, he'll get the message upon login.
            return(false);
        }
コード例 #3
0
        private bool ForwardToSim(string op, UUID fromID, string name, String fromUUI, UUID toID, string message)
        {
            PresenceInfo session = null;
            GridRegion   region  = null;

            PresenceInfo[] sessions = m_PresenceService.GetAgents(new string[] { toID.ToString() });
            if (sessions != null && sessions.Length > 0)
            {
                session = sessions[0];
            }
            if (session != null)
            {
                region = m_GridService.GetRegionByUUID(UUID.Zero, session.RegionID);
            }

            switch (op)
            {
            case "FriendshipOffered":
                // Let's store backwards
                string secret = UUID.Random().ToString().Substring(0, 8);
                m_FriendsService.StoreFriend(toID.ToString(), fromUUI + ";" + secret, 0);
                if (m_FriendsLocalSimConnector != null)     // standalone
                {
                    GridInstantMessage im = new GridInstantMessage(null, fromID, name, toID,
                                                                   (byte)InstantMessageDialog.FriendshipOffered, message, false, Vector3.Zero);
                    // !! HACK
                    im.imSessionID = im.fromAgentID;
                    return(m_FriendsLocalSimConnector.LocalFriendshipOffered(toID, im));
                }
                else if (region != null)     // grid
                {
                    return(m_FriendsSimConnector.FriendshipOffered(region, fromID, toID, message, name));
                }
                break;

            case "ApproveFriendshipRequest":
                if (m_FriendsLocalSimConnector != null)     // standalone
                {
                    return(m_FriendsLocalSimConnector.LocalFriendshipApproved(fromID, name, toID));
                }
                else if (region != null)     //grid
                {
                    return(m_FriendsSimConnector.FriendshipApproved(region, fromID, name, toID));
                }
                break;
            }

            return(false);
        }