public void DelayRestart(int seconds, string message)
        {
            if (m_CountdownTimer == null)
            {
                return;
            }

            MainConsole.Instance.Output("Region restart delayed for " + seconds.ToString() + " seconds");

            if (m_DialogModule != null)
            {
                m_DialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", "Region restart has been delayed.");
            }

            m_CountdownTimer.Stop();
            m_CountdownTimer = null;

            m_Alerts = new List <int>(m_CurrentAlerts);
            m_Alerts.Add(seconds);
            m_Alerts.Sort();
            m_Alerts.Reverse();

            int nextInterval = DoOneNotice(false);

            SetTimer(nextInterval);
        }
Пример #2
0
        private void OnEstateMessage(UUID RegionID, UUID FromID, string FromName, string Message)
        {
            Scene senderScenes = FindScene(RegionID);

            if (senderScenes == null)
            {
                return;
            }

            uint estateID = senderScenes.RegionInfo.EstateSettings.EstateID;

            foreach (Scene s in Scenes)
            {
                if (s.RegionInfo.EstateSettings.EstateID == estateID)
                {
                    IDialogModule dm = s.RequestModuleInterface <IDialogModule>();

                    if (dm != null)
                    {
                        dm.SendNotificationToUsersInRegion(FromID, FromName,
                                                           Message);
                    }
                }
            }
            if (!m_InInfoUpdate)
            {
                m_EstateConnector.SendEstateMessage(estateID, FromID, FromName, Message);
            }
        }
Пример #3
0
        private void SendSimulatorBlueBoxMessage(
            IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message)
        {
            IDialogModule dm = m_scene.RequestModuleInterface <IDialogModule>();

            if (dm != null)
            {
                dm.SendNotificationToUsersInRegion(senderID, senderName, message);
            }
        }
Пример #4
0
        byte[] EstateMessage(Dictionary <string, object> request)
        {
            UUID   FromID   = UUID.Zero;
            string FromName = String.Empty;
            string Message  = String.Empty;
            int    EstateID = 0;

            if (!request.ContainsKey("FromID") ||
                !request.ContainsKey("FromName") ||
                !request.ContainsKey("Message") ||
                !request.ContainsKey("EstateID"))
            {
                return(FailureResult());
            }

            if (!UUID.TryParse(request["FromID"].ToString(), out FromID))
            {
                return(FailureResult());
            }

            if (!Int32.TryParse(request["EstateID"].ToString(), out EstateID))
            {
                return(FailureResult());
            }

            FromName = request["FromName"].ToString();
            Message  = request["Message"].ToString();

            foreach (Scene s in m_EstateModule.Scenes)
            {
                if (s.RegionInfo.EstateSettings.EstateID == EstateID)
                {
                    IDialogModule dm = s.RequestModuleInterface <IDialogModule>();

                    if (dm != null)
                    {
                        dm.SendNotificationToUsersInRegion(FromID, FromName,
                                                           Message);
                    }
                }
            }

            return(SuccessResult());
        }
Пример #5
0
        public XmlRpcResponse GridWideMessage(XmlRpcRequest req, IPEndPoint remoteClient)
        {
            XmlRpcResponse response     = new XmlRpcResponse();
            Hashtable      responseData = new Hashtable();

            Hashtable requestData = (Hashtable)req.Params[0];

            // REFACTORING PROBLEM. This authorization needs to be replaced with some other
            //if ((!requestData.Contains("password") || (string)requestData["password"] != m_com.NetworkServersInfo.GridRecvKey))
            //{
            //    responseData["accepted"] = false;
            //    responseData["success"] = false;
            //    responseData["error"] = "Invalid Key";
            //    response.Value = responseData;
            //    return response;
            //}

            string message = (string)requestData["message"];
            string user    = (string)requestData["user"];

            m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);

            lock (m_scenes)
                foreach (Scene scene in m_scenes)
                {
                    IDialogModule dialogModule = scene.RequestModuleInterface <IDialogModule>();
                    if (dialogModule != null)
                    {
                        dialogModule.SendNotificationToUsersInRegion(UUID.Random(), user, message);
                    }
                }

            responseData["accepted"] = true;
            responseData["success"]  = true;
            response.Value           = responseData;

            return(response);
        }
Пример #6
0
        public int DoOneNotice()
        {
            if (m_Alerts.Count == 0 || m_Alerts [0] == 0)
            {
                RestartScene();
                return(0);
            }

            int nextAlert = 0;

            while (m_Alerts.Count > 1)
            {
                if (m_Alerts [1] == m_Alerts [0])
                {
                    m_Alerts.RemoveAt(0);
                    continue;
                }
                nextAlert = m_Alerts [1];
                break;
            }

            int currentAlert = m_Alerts [0];

            m_Alerts.RemoveAt(0);

            int    minutes            = currentAlert / 60;
            string currentAlertString = string.Empty;

            if (minutes > 0)
            {
                if (minutes == 1)
                {
                    currentAlertString += "1 minute";
                }
                else
                {
                    currentAlertString += string.Format("{0} minutes", minutes);
                }
                if ((currentAlert % 60) != 0)
                {
                    currentAlertString += " and ";
                }
            }
            if ((currentAlert % 60) != 0)
            {
                int seconds = currentAlert % 60;
                if (seconds == 1)
                {
                    currentAlertString += "1 second";
                }
                else
                {
                    currentAlertString += string.Format("{0} seconds", seconds);
                }
            }

            string msg = string.Format(m_Message, currentAlertString);

            if (m_DialogModule != null && msg != string.Empty)
            {
                if (m_Notice)
                {
                    m_DialogModule.SendGeneralAlert(msg);
                }
                else
                {
                    m_DialogModule.SendNotificationToUsersInRegion(m_Initiator, "System", msg);
                }
                MainConsole.Instance.WarnFormat("[Region Restart]: {0} will restart in {1}",
                                                m_scene.RegionInfo.RegionName, currentAlertString);
            }

            return(currentAlert - nextAlert);
        }
Пример #7
0
        public int DoOneNotice(bool sendOut)
        {
            if (m_Alerts.Count == 0 || m_Alerts[0] == 0)
            {
                CreateMarkerFile();
                m_Scene.RestartNow();
                return(0);
            }

            int nextAlert = 0;

            while (m_Alerts.Count > 1)
            {
                if (m_Alerts[1] == m_Alerts[0])
                {
                    m_Alerts.RemoveAt(0);
                    continue;
                }
                nextAlert = m_Alerts[1];
                break;
            }

            int currentAlert = m_Alerts[0];

            m_Alerts.RemoveAt(0);

            if (sendOut)
            {
                int    minutes            = currentAlert / 60;
                string currentAlertString = String.Empty;
                if (minutes > 0)
                {
                    if (minutes == 1)
                    {
                        currentAlertString += "1 minute";
                    }
                    else
                    {
                        currentAlertString += String.Format("{0} minutes", minutes);
                    }
                    if ((currentAlert % 60) != 0)
                    {
                        currentAlertString += " and ";
                    }
                }
                if ((currentAlert % 60) != 0)
                {
                    int seconds = currentAlert % 60;
                    if (seconds == 1)
                    {
                        currentAlertString += "1 second";
                    }
                    else
                    {
                        currentAlertString += String.Format("{0} seconds", seconds);
                    }
                }

                string msg = String.Format(m_Message, currentAlertString);

                if (m_DialogModule != null && msg != String.Empty)
                {
                    if (m_Notice)
                    {
                        m_DialogModule.SendGeneralAlert(msg);
                    }
                    else
                    {
                        m_DialogModule.SendNotificationToUsersInRegion(m_Initiator, "System", msg);
                    }
                }
            }

            return(currentAlert - nextAlert);
        }