diff options
author | Melanie | 2012-06-07 16:32:07 +0200 |
---|---|---|
committer | Melanie | 2012-06-07 16:32:07 +0200 |
commit | e93308072ea8ec106e429dc8071795018b58a75a (patch) | |
tree | 51fbcd7bb9821166b0d87b0011841e3f8ffce740 /OpenSim | |
parent | Make timed bans / timed passes work as expected. Prevent transmission of media (diff) | |
download | opensim-SC_OLD-e93308072ea8ec106e429dc8071795018b58a75a.zip opensim-SC_OLD-e93308072ea8ec106e429dc8071795018b58a75a.tar.gz opensim-SC_OLD-e93308072ea8ec106e429dc8071795018b58a75a.tar.bz2 opensim-SC_OLD-e93308072ea8ec106e429dc8071795018b58a75a.tar.xz |
Make the "delay restart" button delay restart for 1 hour rather than aborting
it altogether. Allow a maximum of three uses before the restart goes through.
Diffstat (limited to 'OpenSim')
3 files changed, 61 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 1e743c3..97a2f4a 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -61,6 +61,8 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
61 | public event ChangeDelegate OnEstateInfoChange; | 61 | public event ChangeDelegate OnEstateInfoChange; |
62 | public event MessageDelegate OnEstateMessage; | 62 | public event MessageDelegate OnEstateMessage; |
63 | 63 | ||
64 | private int m_delayCount = 0; | ||
65 | |||
64 | #region Packet Data Responders | 66 | #region Packet Data Responders |
65 | 67 | ||
66 | private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) | 68 | private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) |
@@ -259,7 +261,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
259 | { | 261 | { |
260 | if (timeInSeconds == -1) | 262 | if (timeInSeconds == -1) |
261 | { | 263 | { |
262 | restartModule.AbortRestart("Restart aborted by region manager"); | 264 | m_delayCount++; |
265 | if (m_delayCount > 3) | ||
266 | return; | ||
267 | |||
268 | restartModule.DelayRestart(3600, "Restart delayed by region manager"); | ||
263 | return; | 269 | return; |
264 | } | 270 | } |
265 | 271 | ||
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index 65180b5a..287738a 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -59,6 +59,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
59 | protected bool m_Notice = false; | 59 | protected bool m_Notice = false; |
60 | protected IDialogModule m_DialogModule = null; | 60 | protected IDialogModule m_DialogModule = null; |
61 | protected string m_MarkerPath = String.Empty; | 61 | protected string m_MarkerPath = String.Empty; |
62 | private int[] m_CurrentAlerts = null; | ||
62 | 63 | ||
63 | public void Initialise(IConfigSource config) | 64 | public void Initialise(IConfigSource config) |
64 | { | 65 | { |
@@ -141,6 +142,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
141 | m_Message = message; | 142 | m_Message = message; |
142 | m_Initiator = initiator; | 143 | m_Initiator = initiator; |
143 | m_Notice = notice; | 144 | m_Notice = notice; |
145 | m_CurrentAlerts = alerts; | ||
144 | m_Alerts = new List<int>(alerts); | 146 | m_Alerts = new List<int>(alerts); |
145 | m_Alerts.Sort(); | 147 | m_Alerts.Sort(); |
146 | m_Alerts.Reverse(); | 148 | m_Alerts.Reverse(); |
@@ -152,12 +154,12 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
152 | return; | 154 | return; |
153 | } | 155 | } |
154 | 156 | ||
155 | int nextInterval = DoOneNotice(); | 157 | int nextInterval = DoOneNotice(true); |
156 | 158 | ||
157 | SetTimer(nextInterval); | 159 | SetTimer(nextInterval); |
158 | } | 160 | } |
159 | 161 | ||
160 | public int DoOneNotice() | 162 | public int DoOneNotice(bool sendOut) |
161 | { | 163 | { |
162 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) | 164 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) |
163 | { | 165 | { |
@@ -182,34 +184,37 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
182 | 184 | ||
183 | m_Alerts.RemoveAt(0); | 185 | m_Alerts.RemoveAt(0); |
184 | 186 | ||
185 | int minutes = currentAlert / 60; | 187 | if (sendOut) |
186 | string currentAlertString = String.Empty; | ||
187 | if (minutes > 0) | ||
188 | { | 188 | { |
189 | if (minutes == 1) | 189 | int minutes = currentAlert / 60; |
190 | currentAlertString += "1 minute"; | 190 | string currentAlertString = String.Empty; |
191 | else | 191 | if (minutes > 0) |
192 | currentAlertString += String.Format("{0} minutes", minutes); | 192 | { |
193 | if (minutes == 1) | ||
194 | currentAlertString += "1 minute"; | ||
195 | else | ||
196 | currentAlertString += String.Format("{0} minutes", minutes); | ||
197 | if ((currentAlert % 60) != 0) | ||
198 | currentAlertString += " and "; | ||
199 | } | ||
193 | if ((currentAlert % 60) != 0) | 200 | if ((currentAlert % 60) != 0) |
194 | currentAlertString += " and "; | 201 | { |
195 | } | 202 | int seconds = currentAlert % 60; |
196 | if ((currentAlert % 60) != 0) | 203 | if (seconds == 1) |
197 | { | 204 | currentAlertString += "1 second"; |
198 | int seconds = currentAlert % 60; | 205 | else |
199 | if (seconds == 1) | 206 | currentAlertString += String.Format("{0} seconds", seconds); |
200 | currentAlertString += "1 second"; | 207 | } |
201 | else | ||
202 | currentAlertString += String.Format("{0} seconds", seconds); | ||
203 | } | ||
204 | 208 | ||
205 | string msg = String.Format(m_Message, currentAlertString); | 209 | string msg = String.Format(m_Message, currentAlertString); |
206 | 210 | ||
207 | if (m_DialogModule != null && msg != String.Empty) | 211 | if (m_DialogModule != null && msg != String.Empty) |
208 | { | 212 | { |
209 | if (m_Notice) | 213 | if (m_Notice) |
210 | m_DialogModule.SendGeneralAlert(msg); | 214 | m_DialogModule.SendGeneralAlert(msg); |
211 | else | 215 | else |
212 | m_DialogModule.SendNotificationToUsersInRegion(m_Initiator, "System", msg); | 216 | m_DialogModule.SendNotificationToUsersInRegion(m_Initiator, "System", msg); |
217 | } | ||
213 | } | 218 | } |
214 | 219 | ||
215 | return currentAlert - nextAlert; | 220 | return currentAlert - nextAlert; |
@@ -226,7 +231,25 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
226 | 231 | ||
227 | private void OnTimer(object source, ElapsedEventArgs e) | 232 | private void OnTimer(object source, ElapsedEventArgs e) |
228 | { | 233 | { |
229 | int nextInterval = DoOneNotice(); | 234 | int nextInterval = DoOneNotice(true); |
235 | |||
236 | SetTimer(nextInterval); | ||
237 | } | ||
238 | |||
239 | public void DelayRestart(int seconds, string message) | ||
240 | { | ||
241 | if (m_CountdownTimer == null) | ||
242 | return; | ||
243 | |||
244 | m_CountdownTimer.Stop(); | ||
245 | m_CountdownTimer = null; | ||
246 | |||
247 | m_Alerts = new List<int>(m_CurrentAlerts); | ||
248 | m_Alerts.Add(seconds); | ||
249 | m_Alerts.Sort(); | ||
250 | m_Alerts.Reverse(); | ||
251 | |||
252 | int nextInterval = DoOneNotice(false); | ||
230 | 253 | ||
231 | SetTimer(nextInterval); | 254 | SetTimer(nextInterval); |
232 | } | 255 | } |
@@ -240,9 +263,9 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
240 | if (m_DialogModule != null && message != String.Empty) | 263 | if (m_DialogModule != null && message != String.Empty) |
241 | m_DialogModule.SendGeneralAlert(message); | 264 | m_DialogModule.SendGeneralAlert(message); |
242 | } | 265 | } |
243 | if (m_MarkerPath != String.Empty) | 266 | if (m_MarkerPath != String.Empty) |
244 | File.Delete(Path.Combine(m_MarkerPath, | 267 | File.Delete(Path.Combine(m_MarkerPath, |
245 | m_Scene.RegionInfo.RegionID.ToString())); | 268 | m_Scene.RegionInfo.RegionID.ToString())); |
246 | } | 269 | } |
247 | 270 | ||
248 | private void HandleRegionRestart(string module, string[] args) | 271 | private void HandleRegionRestart(string module, string[] args) |
diff --git a/OpenSim/Region/Framework/Interfaces/IRestartModule.cs b/OpenSim/Region/Framework/Interfaces/IRestartModule.cs index c68550f..9b25beb 100644 --- a/OpenSim/Region/Framework/Interfaces/IRestartModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRestartModule.cs | |||
@@ -35,5 +35,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
35 | TimeSpan TimeUntilRestart { get; } | 35 | TimeSpan TimeUntilRestart { get; } |
36 | void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice); | 36 | void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice); |
37 | void AbortRestart(string message); | 37 | void AbortRestart(string message); |
38 | void DelayRestart(int seconds, string message); | ||
38 | } | 39 | } |
39 | } | 40 | } |