示例#1
0
        /// <summary>
        /// Check that the required groups structure is in place.
        /// </summary>
        /// <exception cref="GroupsException">Thrown if there is something wrong with the groups setup</exception>
        public void CheckForRequiredSetup()
        {
            if (!WaterWarsConstants.ENABLE_GROUPS)
            {
                return;
            }

            if (null == m_groupsModule)
            {
                m_groupsModule = m_controller.Scenes[0].RequestModuleInterface <IGroupsModule>();

                if (null == m_groupsModule)
                {
                    throw new GroupsSetupException("No groups module present on server");
                }
            }

            if (null == m_groupsMessagingModule)
            {
                m_groupsMessagingModule = m_controller.Scenes[0].RequestModuleInterface <IGroupsMessagingModule>();

                if (null == m_groupsMessagingModule)
                {
                    throw new GroupsSetupException("No groups messaging module present on server");
                }
            }

            if (null == WaterWarsGroup)
            {
                WaterWarsGroup = GetGroup(WaterWarsConstants.GROUP_NAME);
            }

            if (null == WaterWarsAdminGroup)
            {
                WaterWarsAdminGroup = GetGroup(WaterWarsConstants.ADMIN_GROUP_NAME);
            }

            m_systemAccount
                = m_controller.Scenes[0].UserAccountService.GetUserAccount(
                      UUID.Zero, WaterWarsConstants.SYSTEM_PLAYER_FIRST_NAME, WaterWarsConstants.SYSTEM_PLAYER_LAST_NAME);

            string name
                = string.Format(
                      "{0} {1}", WaterWarsConstants.SYSTEM_PLAYER_FIRST_NAME, WaterWarsConstants.SYSTEM_PLAYER_LAST_NAME);

            if (null == m_systemAccount)
            {
                throw new GroupsSetupException(
                          string.Format(
                              "System player {0} not present.  Please create this player before restarting OpenSim", name));
            }

            if (!IsPlayerInRequiredGroup(m_systemAccount))
            {
                throw new GroupsSetupException(
                          string.Format(
                              "System player {0} is not in group {1}.  Please correct this.",
                              name, WaterWarsGroup.GroupName));
            }
        }
        void EventManager_OnMakeRootAgent(ScenePresence sp)
        {
            IClientAPI client       = SceneHandler.Instance.LocateClientObject(sp.UUID);
            Scene      currentScene = SceneHandler.Instance.LocateSceneClientIn(sp.UUID);

            DateTime Born   = new DateTime(1970, 1, 1, 0, 0, 0, 0);
            DateTime LastOn = new DateTime(1970, 1, 1, 0, 0, 0, 0);


            IUserAccountService UAS = sp.Scene.RequestModuleInterface <IUserAccountService>();

            if (UAS == null)
            {
                m_log.ErrorFormat("[Mentor]: Get USer Account Service Failed");
            }
            UserAccount UA = UAS.GetUserAccount(sp.Scene.RegionInfo.ScopeID, sp.UUID);

            if (UA == null)
            {
                m_log.ErrorFormat("[Mentor]: Get User Account Failed");
            }
            else
            {
                Born = Born.AddSeconds(UA.Created);
            }
            m_log.InfoFormat("[MENTOR] Enter Sim: {0}({3})-{1}   {2}", sp.Name, sp.Grouptitle, sp.Viewer, Born.ToString("yyyy-MM-dd"));
            TimeSpan AGE = DateTime.Now - Born;

            if (AGE.Days < 32)
            {
                IGroupsMessagingModule GIM = sp.Scene.RequestModuleInterface <IGroupsMessagingModule>();
                if (GIM == null)
                {
                    m_log.Debug("[MENTOR] No group Interface?");
                }
                else
                {
                    if (GIM.StartGroupChatSession(UUID.Random(), UUID.Parse(GroupUUID)))
                    {
                        string sGM = string.Format("{0} Has entered region: {1}  Born: {2}({3} days)",
                                                   sp.Name,
                                                   sp.Scene.RegionInfo.RegionName,
                                                   Born.ToString("yyyy-MM-dd"),
                                                   AGE.Days);
                        m_log.DebugFormat("[MENTOR] {0}", sGM);
                        GIM.SendMessageToGroup(new GridInstantMessage(null, sp.UUID, FromName, UUID.Parse(GroupUUID), (byte)InstantMessageDialog.SessionSend, sGM, false, Vector3.Zero), UUID.Parse(GroupUUID));
                    }
                    else
                    {
                        m_log.Error("[Mentor] Group Session Failed");
                    }
                }
            }
        }
示例#3
0
        public void RegionLoaded(Scene scene)
        {
            if (!m_groupsEnabled)
                return;

            if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            if (m_groupData == null)
            {
                m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>();

                // No Groups Service Connector, then nothing works...
                if (m_groupData == null)
                {
                    m_groupsEnabled = false;
                    m_log.Error("[GROUPS]: Could not get IGroupsServicesConnector");
                    Close();
                    return;
                }

                m_groupsMessagingModule = scene.RequestModuleInterface<IGroupsMessagingModule>();
            }

            if (m_msgTransferModule == null)
            {
                m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>();

                // No message transfer module, no notices, group invites, rejects, ejects, etc
                if (m_msgTransferModule == null)
                {
                    m_groupsEnabled = false;
                    m_log.Error("[GROUPS]: Could not get MessageTransferModule");
                    Close();
                    return;
                }
            }

            lock (m_sceneList)
            {
                m_sceneList.Add(scene);
            }

            scene.EventManager.OnNewClient += OnNewClient;
            scene.EventManager.OnClosingClient += OnClosingClient;
            scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
            scene.EventManager.OnClientLogin += EventManager_OnClientLogin;
            scene.EventManager.OnRegisterCaps += OnRegisterCaps;
            // The InstantMessageModule itself doesn't do this, 
            // so lets see if things explode if we don't do it
            // scene.EventManager.OnClientClosed += OnClientClosed;

        }
示例#4
0
        public void RegionLoaded(Scene scene)
        {
            if (!m_groupsEnabled)
                return;

            if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            if (m_groupData == null)
            {
                m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>();

                // No Groups Service Connector, then nothing works...
                if (m_groupData == null)
                {
                    m_groupsEnabled = false;
                    m_log.Error("[GROUPS]: Could not get IGroupsServicesConnector");
                    Close();
                    return;
                }
            }

            if (m_msgTransferModule == null)
            {
                m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>();

                // No message transfer module, no notices, group invites, rejects, ejects, etc
                if (m_msgTransferModule == null)
                {
                    m_groupsEnabled = false;
                    m_log.Warn("[GROUPS]: Could not get IMessageTransferModule");
                }
            }

            if (m_groupsMessagingModule == null)
            {
                m_groupsMessagingModule = scene.RequestModuleInterface<IGroupsMessagingModule>();

                // No message transfer module, no notices, group invites, rejects, ejects, etc
                if (m_groupsMessagingModule == null)
                    m_log.Warn("[GROUPS]: Could not get IGroupsMessagingModule");
            }

            lock (m_sceneList)
            {
                m_sceneList.Add(scene);
            }

            scene.EventManager.OnNewClient += OnNewClient;
            scene.EventManager.OnMakeRootAgent += OnMakeRoot;
            scene.EventManager.OnMakeChildAgent += OnMakeChild;
            scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
            scene.EventManager.OnClientClosed += OnClientClosed;

        }
        /// <summary>
        /// Check that the required groups structure is in place.
        /// </summary>
        /// <exception cref="GroupsException">Thrown if there is something wrong with the groups setup</exception>
        public void CheckForRequiredSetup()
        {
            if (!WaterWarsConstants.ENABLE_GROUPS)
                return;

            if (null == m_groupsModule)
            {
                m_groupsModule = m_controller.Scenes[0].RequestModuleInterface<IGroupsModule>();

                if (null == m_groupsModule)
                    throw new GroupsSetupException("No groups module present on server");
            }

            if (null == m_groupsMessagingModule)
            {
                m_groupsMessagingModule = m_controller.Scenes[0].RequestModuleInterface<IGroupsMessagingModule>();

                if (null == m_groupsMessagingModule)
                    throw new GroupsSetupException("No groups messaging module present on server");
            }

            if (null == WaterWarsGroup)
                WaterWarsGroup = GetGroup(WaterWarsConstants.GROUP_NAME);

            if (null == WaterWarsAdminGroup)
                WaterWarsAdminGroup = GetGroup(WaterWarsConstants.ADMIN_GROUP_NAME);

            m_systemAccount
                = m_controller.Scenes[0].UserAccountService.GetUserAccount(
                    UUID.Zero, WaterWarsConstants.SYSTEM_PLAYER_FIRST_NAME, WaterWarsConstants.SYSTEM_PLAYER_LAST_NAME);

            string name
                = string.Format(
                    "{0} {1}", WaterWarsConstants.SYSTEM_PLAYER_FIRST_NAME, WaterWarsConstants.SYSTEM_PLAYER_LAST_NAME);

            if (null == m_systemAccount)
                throw new GroupsSetupException(
                    string.Format(
                        "System player {0} not present.  Please create this player before restarting OpenSim", name));

            if (!IsPlayerInRequiredGroup(m_systemAccount))
                throw new GroupsSetupException(
                    string.Format(
                        "System player {0} is not in group {1}.  Please correct this.",
                        name, WaterWarsGroup.GroupName));
        }