コード例 #1
0
        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 });
                }
            }
        }
コード例 #2
0
        public void AddFriendship(IClientAPI client, UUID friendID)
        {
            StoreFriendships(client.AgentId, friendID);

            // Update the local cache
            RecacheFriends(client);

            //
            // Notify the friend
            //

            // Try Local
            if (LocalFriendshipApproved(client.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, client.AgentId, client.Name, friendID);
                    client.SendAgentOnline(new UUID[] { friendID });
                }
            }
        }
コード例 #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);
        }