コード例 #1
0
        public void TrackAgent(IClientAPI client, UUID hunter, UUID target)
        {
            bool isFriend = IsFriendOfUser(target, hunter);

            if (isFriend)
            {
                IFriendsModule module = m_Scenes[0].RequestModuleInterface <IFriendsModule>();
                if (module != null)
                {
                    int perms = module.GetFriendPerms(hunter, target);
                    if ((perms & (int)FriendRights.CanSeeOnMap) == (int)FriendRights.CanSeeOnMap)
                    {
                        UserInfo GUI =
                            client.Scene.RequestModuleInterface <IAgentInfoService>().GetUserInfo(target.ToString());
                        if (GUI != null)
                        {
                            GridRegion region = GetRegionUserIsIn(client.AgentId).GridService.GetRegionByUUID(
                                UUID.Zero, GUI.CurrentRegionID);

                            client.SendScriptTeleportRequest(client.Name, region.RegionName,
                                                             GUI.CurrentPosition,
                                                             GUI.CurrentLookAt);
                        }
                    }
                }
            }
        }
コード例 #2
0
        public void TrackAgent(IClientAPI client, UUID hunter, UUID target)
        {
            bool isFriend = IsFriendOfUser(target, hunter);

            if (isFriend)
            {
                IFriendsModule module = m_Scene.RequestModuleInterface <IFriendsModule> ();
                if (module != null)
                {
                    int perms = module.GetFriendPerms(hunter, target);
                    if ((perms & (int)FriendRights.CanSeeOnMap) == (int)FriendRights.CanSeeOnMap)
                    {
                        UserInfo GUI =
                            client.Scene.RequestModuleInterface <IAgentInfoService> ().GetUserInfo(target.ToString());
                        if (GUI != null && GUI.IsOnline)
                        {
                            GridRegion region = m_Scene.GridService.GetRegionByUUID(
                                client.AllScopeIDs, GUI.CurrentRegionID);
                            if (region != null)     // just being cautious here
                            {
                                client.SendScriptTeleportRequest(client.Name, region.RegionName,
                                                                 GUI.CurrentPosition, GUI.CurrentLookAt);
                            }
                            region = null;  // clean up
                        }
                    }
                }
            }
        }
コード例 #3
0
        protected OSDMap OnMessageReceived(OSDMap message)
        {
            //We need to check and see if this is an AgentStatusChange
            if (message.ContainsKey("Method") && message["Method"] == "AgentStatusChange")
            {
                OSDMap innerMessage = (OSDMap)message["Message"];
                //We got a message, now pass it on to the clients that need it
                UUID AgentID          = innerMessage["AgentID"].AsUUID();
                UUID FriendToInformID = innerMessage["FriendToInformID"].AsUUID();
                bool NewStatus        = innerMessage["NewStatus"].AsBoolean();

                //Do this since IFriendsModule is a scene module, not a ISimulationBase module (not interchangable)
                SceneManager manager = m_registry.RequestModuleInterface <SceneManager>();
                if (manager != null && manager.Scenes.Count > 0)
                {
                    IFriendsModule friendsModule = manager.Scenes[0].RequestModuleInterface <IFriendsModule>();
                    if (friendsModule != null)
                    {
                        //Send the message
                        friendsModule.SendFriendsStatusMessage(FriendToInformID, AgentID, NewStatus);
                    }
                }
            }
            return(null);
        }
コード例 #4
0
        private void DoPresenceUpdate(IScenePresence presence)
        {
            ReportAgent(presence);
            IFriendsModule    friendsModule = m_scene.RequestModuleInterface <IFriendsModule>();
            IAgentInfoService aservice      = m_scene.RequestModuleInterface <IAgentInfoService>();

            if (friendsModule != null)
            {
                Interfaces.FriendInfo[] friends = friendsModule.GetFriends(presence.UUID);
                List <string>           s       = new List <string>();
                for (int i = 0; i < friends.Length; i++)
                {
                    s.Add(friends[i].Friend);
                }
                List <UserInfo> infos = aservice.GetUserInfos(s);
                foreach (UserInfo u in infos)
                {
                    if (u != null && u.IsOnline)
                    {
                        friendsModule.SendFriendsStatusMessage(presence.UUID, UUID.Parse(u.UserID), true);
                    }
                }
                foreach (UserInfo u in infos)
                {
                    if (u != null && u.IsOnline)
                    {
                        if (!IsLocal(u, presence))
                        {
                            DoNonLocalPresenceUpdateCall(u, presence);
                        }
                        else
                        {
                            friendsModule.SendFriendsStatusMessage(UUID.Parse(u.UserID), presence.UUID, true);
                        }
                    }
                }
            }
        }
コード例 #5
0
        public void RegionLoaded(Scene scene)
        {
            //            m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);

            if (m_scene == null)
            {
                m_scene = scene;
            }

            m_friendsModule        = m_scene.RequestModuleInterface <IFriendsModule>();
            m_userManagementModule = m_scene.RequestModuleInterface <IUserManagement>();
            m_presenceService      = m_scene.RequestModuleInterface <IPresenceService>();

            if (m_friendsModule != null && m_userManagementModule != null && m_presenceService != null)
            {
                m_scene.AddCommand(
                    "Friends", this, "friends show",
                    "friends show [--cache] <first-name> <last-name>",
                    "Show the friends for the given user if they exist.",
                    "The --cache option will show locally cached information for that user.",
                    HandleFriendsShowCommand);
            }
        }
コード例 #6
0
 public void RegionLoaded(IScene scene)
 {
     m_friendsModule = scene.RequestModuleInterface<IFriendsModule>();
 }
コード例 #7
0
        public void PostInitialise()
        {
            m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();

            if (m_friendsModule == null)
                m_log.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work");

            m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();

            if (m_groupsModule == null)
                m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");        
        }
コード例 #8
0
 public void RegionLoaded(IScene scene)
 {
     m_friendsModule = scene.RequestModuleInterface <IFriendsModule> ();
 }
コード例 #9
0
        public void PostInitialise()
        {
            m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();

            if (m_friendsModule == null)
                m_log.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work");

            m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();

            if (m_groupsModule == null)
                m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");
            
            m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
            
            // This log line will be commented out when no longer required for debugging
//            if (m_moapModule == null)
//                m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work");
        }
コード例 #10
0
        protected OSDMap OnMessageReceived(OSDMap message)
        {
            if (!message.ContainsKey("Method"))
            {
                return(null);                        // nothing to do here...
            }
            var method = message ["Method"].AsString();

            ISyncMessagePosterService asyncPost = m_registry.RequestModuleInterface <ISyncMessagePosterService> ();

            //We need to check and see if this is an AgentStatusChange
            if (method == "AgentStatusChange")
            {
                OSDMap innerMessage = (OSDMap)message ["Message"];
                //We got a message, now pass it on to the clients that need it
                UUID AgentID          = innerMessage ["AgentID"].AsUUID();
                UUID FriendToInformID = innerMessage ["FriendToInformID"].AsUUID();
                bool NewStatus        = innerMessage ["NewStatus"].AsBoolean();

                //Do this since IFriendsModule is a scene module, not a ISimulationBase module (not interchangeable)
                ISceneManager manager = m_registry.RequestModuleInterface <ISceneManager> ();
                if (manager != null)
                {
                    foreach (IScene scene in manager.Scenes)
                    {
                        if (scene.GetScenePresence(FriendToInformID) != null &&
                            !scene.GetScenePresence(FriendToInformID).IsChildAgent)
                        {
                            IFriendsModule friendsModule = scene.RequestModuleInterface <IFriendsModule> ();
                            if (friendsModule != null)
                            {
                                //Send the message
                                friendsModule.SendFriendsStatusMessage(FriendToInformID, new [] { AgentID }, NewStatus);
                            }
                        }
                    }
                }
            }
            else if (method == "AgentStatusChanges")
            {
                OSDMap innerMessage = (OSDMap)message ["Message"];
                //We got a message, now pass it on to the clients that need it
                List <UUID> AgentIDs         = ((OSDArray)innerMessage ["AgentIDs"]).ConvertAll <UUID> ((o) => o);
                UUID        FriendToInformID = innerMessage ["FriendToInformID"].AsUUID();
                bool        NewStatus        = innerMessage ["NewStatus"].AsBoolean();

                //Do this since IFriendsModule is a scene module, not a ISimulationBase module (not interchangeable)
                ISceneManager manager = m_registry.RequestModuleInterface <ISceneManager> ();
                if (manager != null)
                {
                    foreach (IScene scene in manager.Scenes)
                    {
                        if (scene.GetScenePresence(FriendToInformID) != null &&
                            !scene.GetScenePresence(FriendToInformID).IsChildAgent)
                        {
                            IFriendsModule friendsModule = scene.RequestModuleInterface <IFriendsModule> ();
                            if (friendsModule != null)
                            {
                                //Send the message
                                friendsModule.SendFriendsStatusMessage(FriendToInformID, AgentIDs.ToArray(), NewStatus);
                            }
                        }
                    }
                }
            }
            else if (method == "FriendGrantRights")
            {
                OSDMap            body             = (OSDMap)message ["Message"];
                UUID              targetID         = body ["Target"].AsUUID();
                IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> ();
                UserInfo          info;
                if (agentInfoService != null && (info = agentInfoService.GetUserInfo(targetID.ToString())) != null &&
                    info.IsOnline)
                {
                    //Forward the message
                    asyncPost.Post(info.CurrentRegionURI, message);
                }
            }
            else if (method == "FriendshipOffered")
            {
                OSDMap            body             = (OSDMap)message ["Message"];
                UUID              targetID         = body ["Friend"].AsUUID();
                IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> ();
                UserInfo          info;
                if (agentInfoService != null &&
                    (info = agentInfoService.GetUserInfo(targetID.ToString())) != null &&
                    info.IsOnline)
                {
                    //Forward the message
                    asyncPost.Post(info.CurrentRegionURI, message);
                }
            }
            else if (method == "FriendTerminated")
            {
                OSDMap            body             = (OSDMap)message ["Message"];
                UUID              targetID         = body ["ExFriend"].AsUUID();
                IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> ();
                UserInfo          info;
                if (agentInfoService != null &&
                    (info = agentInfoService.GetUserInfo(targetID.ToString())) != null &&
                    info.IsOnline)
                {
                    //Forward the message
                    asyncPost.Post(info.CurrentRegionURI, message);
                }
            }
            else if (method == "FriendshipDenied")
            {
                OSDMap            body             = (OSDMap)message ["Message"];
                UUID              targetID         = body ["FriendID"].AsUUID();
                IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> ();
                UserInfo          info;
                if (agentInfoService != null &&
                    (info = agentInfoService.GetUserInfo(targetID.ToString())) != null &&
                    info.IsOnline)
                {
                    //Forward the message
                    asyncPost.Post(info.CurrentRegionURI, message);
                }
            }
            else if (method == "FriendshipApproved")
            {
                OSDMap            body             = (OSDMap)message ["Message"];
                UUID              targetID         = body ["FriendID"].AsUUID();
                IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> ();
                UserInfo          info;
                if (agentInfoService != null &&
                    (info = agentInfoService.GetUserInfo(targetID.ToString())) != null &&
                    info.IsOnline)
                {
                    //Forward the message
                    asyncPost.Post(info.CurrentRegionURI, message);
                }
            }
            return(null);
        }
コード例 #11
0
        public void RegionLoaded(Scene scene)
        {
//            m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);

            if (m_scene == null)
                m_scene = scene;

            m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
            m_userManagementModule = m_scene.RequestModuleInterface<IUserManagement>();
            m_presenceService = m_scene.RequestModuleInterface<IPresenceService>();

            if (m_friendsModule != null && m_userManagementModule != null && m_presenceService != null)
            {
                m_scene.AddCommand(
                    "Friends", this, "friends show",
                    "friends show [--cache] <first-name> <last-name>",
                    "Show the friends for the given user if they exist.\n",
                    "The --cache option will show locally cached information for that user.",
                    HandleFriendsShowCommand);
            }
        }
コード例 #12
0
        protected OSDMap OnMessageReceived(OSDMap message)
        {
            IGridService             gridService = m_registry.RequestModuleInterface <IGridService>();
            IAsyncMessagePostService asyncPost   = m_registry.RequestModuleInterface <IAsyncMessagePostService>();

            //We need to check and see if this is an AgentStatusChange
            if (message.ContainsKey("Method") && message["Method"] == "AgentStatusChange")
            {
                OSDMap innerMessage = (OSDMap)message["Message"];
                //We got a message, now pass it on to the clients that need it
                UUID AgentID          = innerMessage["AgentID"].AsUUID();
                UUID FriendToInformID = innerMessage["FriendToInformID"].AsUUID();
                bool NewStatus        = innerMessage["NewStatus"].AsBoolean();

                //Do this since IFriendsModule is a scene module, not a ISimulationBase module (not interchangable)
                SceneManager manager = m_registry.RequestModuleInterface <SceneManager>();
                if (manager != null && manager.Scenes.Count > 0)
                {
                    IFriendsModule friendsModule = manager.Scenes[0].RequestModuleInterface <IFriendsModule>();
                    if (friendsModule != null)
                    {
                        //Send the message
                        friendsModule.SendFriendsStatusMessage(FriendToInformID, AgentID, NewStatus);
                    }
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "FriendGrantRights")
            {
                OSDMap   body          = (OSDMap)message["Message"];
                UUID     targetID      = body["Target"].AsUUID();
                UserInfo friendSession =
                    m_registry.RequestModuleInterface <IAgentInfoService>().GetUserInfo(targetID.ToString());
                if (friendSession != null && friendSession.IsOnline)
                {
                    GridRegion region = gridService.GetRegionByUUID(UUID.Zero, friendSession.CurrentRegionID);
                    //Forward the message
                    asyncPost.Post(region.RegionHandle, message);
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "FriendshipOffered")
            {
                OSDMap   body          = (OSDMap)message["Message"];
                UUID     targetID      = body["Friend"].AsUUID();
                UserInfo friendSession =
                    m_registry.RequestModuleInterface <IAgentInfoService>().GetUserInfo(targetID.ToString());
                if (friendSession != null && friendSession.IsOnline)
                {
                    GridRegion region = gridService.GetRegionByUUID(UUID.Zero, friendSession.CurrentRegionID);
                    //Forward the message
                    asyncPost.Post(region.RegionHandle, message);
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "FriendTerminated")
            {
                OSDMap   body          = (OSDMap)message["Message"];
                UUID     targetID      = body["ExFriend"].AsUUID();
                UserInfo friendSession =
                    m_registry.RequestModuleInterface <IAgentInfoService>().GetUserInfo(targetID.ToString());
                if (friendSession != null && friendSession.IsOnline)
                {
                    GridRegion region = gridService.GetRegionByUUID(UUID.Zero, friendSession.CurrentRegionID);
                    //Forward the message
                    asyncPost.Post(region.RegionHandle, message);
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "FriendshipDenied")
            {
                OSDMap   body          = (OSDMap)message["Message"];
                UUID     targetID      = body["FriendID"].AsUUID();
                UserInfo friendSession =
                    m_registry.RequestModuleInterface <IAgentInfoService>().GetUserInfo(targetID.ToString());
                if (friendSession != null && friendSession.IsOnline)
                {
                    GridRegion region = gridService.GetRegionByUUID(UUID.Zero, friendSession.CurrentRegionID);
                    //Forward the message
                    asyncPost.Post(region.RegionHandle, message);
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "FriendshipApproved")
            {
                OSDMap   body          = (OSDMap)message["Message"];
                UUID     targetID      = body["FriendID"].AsUUID();
                UserInfo friendSession =
                    m_registry.RequestModuleInterface <IAgentInfoService>().GetUserInfo(targetID.ToString());
                if (friendSession != null && friendSession.IsOnline)
                {
                    GridRegion region = gridService.GetRegionByUUID(UUID.Zero, friendSession.CurrentRegionID);
                    //Forward the message
                    asyncPost.Post(region.RegionHandle, message);
                }
            }
            return(null);
        }
コード例 #13
0
        public void PostInitialise()
        {
            m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();

            if (m_friendsModule == null)
                m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work");
            else
                m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled");
        }