diff options
Diffstat (limited to 'OpenSim/Region')
3 files changed, 329 insertions, 221 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs index 59dd3bb..4c65ce3 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs | |||
@@ -54,14 +54,9 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
54 | 54 | ||
55 | protected Commander m_commander = new Commander("estate"); | 55 | protected Commander m_commander = new Commander("estate"); |
56 | 56 | ||
57 | // variable used in processing "estate set owner" | 57 | // used to prevent multiple processing of commands when called from root region |
58 | private static string[] m_ownerCmd = null; | 58 | private static string[] m_currentCmd = null; |
59 | 59 | private static EstateSettings m_estateSettings = null; | |
60 | // variable used in processing "estate set owner" | ||
61 | private static UserAccount m_ownerAccount; | ||
62 | |||
63 | // variable used in processing "estate set owner" | ||
64 | private static List<uint> m_ownerEstates; | ||
65 | 60 | ||
66 | public EstateManagementCommands(EstateManagementModule module) | 61 | public EstateManagementCommands(EstateManagementModule module) |
67 | { | 62 | { |
@@ -92,18 +87,22 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
92 | "Specify -1 in <x> or <y> to wildcard that coordinate.", | 87 | "Specify -1 in <x> or <y> to wildcard that coordinate.", |
93 | consoleSetWaterHeight); | 88 | consoleSetWaterHeight); |
94 | 89 | ||
95 | |||
96 | m_module.Scene.AddCommand( | 90 | m_module.Scene.AddCommand( |
97 | "Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", ShowEstatesCommand); | 91 | "Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", ShowEstatesCommand); |
98 | 92 | ||
99 | m_module.Scene.AddCommand( | 93 | m_module.Scene.AddCommand( |
100 | "Estates", m_module, "estate set owner", "estate set owner [ <UUID> | <Firstname> <Lastname> ]", | 94 | "Estates", m_module, "estate set owner", "estate set owner <estate-id>[ <UUID> | <Firstname> <Lastname> ]", |
101 | "Sets the owner of the current region's estate to the specified UUID or user. " + | 95 | "Sets the owner of the specified estate to the specified UUID or user. ", SetEstateOwnerCommand); |
102 | "If called from root region, all estates will be prompted for change.", SetEstateOwnerCommand); | 96 | |
97 | m_module.Scene.AddCommand( | ||
98 | "Estates", m_module, "estate set name", "estate set name <estate-id> <new name>", | ||
99 | "Sets the name of the specified estate to the specified value. " + | ||
100 | "New name must be unique.", SetEstateNameCommand); | ||
103 | } | 101 | } |
104 | 102 | ||
105 | public void Close() {} | 103 | public void Close() {} |
106 | 104 | ||
105 | #region CommandHandlers | ||
107 | protected void consoleSetTerrainTexture(string module, string[] args) | 106 | protected void consoleSetTerrainTexture(string module, string[] args) |
108 | { | 107 | { |
109 | string num = args[3]; | 108 | string num = args[3]; |
@@ -248,112 +247,170 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
248 | 247 | ||
249 | EstateSettings es = m_module.Scene.RegionInfo.EstateSettings; | 248 | EstateSettings es = m_module.Scene.RegionInfo.EstateSettings; |
250 | 249 | ||
251 | if(args != m_ownerCmd) | 250 | if (args == m_currentCmd) |
252 | { | 251 | { |
253 | // new command... clear out the old values | 252 | // HACK to propagate new estate info to Scene Regions |
254 | m_ownerCmd = args; | 253 | if (m_estateSettings != null && es.EstateID == m_estateSettings.EstateID) |
255 | m_ownerEstates = new List<uint>(); | 254 | es.EstateOwner = m_estateSettings.EstateOwner; |
256 | m_ownerAccount = null; | ||
257 | } | ||
258 | 255 | ||
259 | if (MainConsole.Instance.ConsoleScene == null) | 256 | return; |
260 | { | ||
261 | if(m_ownerEstates.Contains(es.EstateID)) | ||
262 | { | ||
263 | // already checked this one | ||
264 | return; | ||
265 | } | ||
266 | else if(m_ownerEstates.Count > 0 && m_ownerAccount == null) | ||
267 | { | ||
268 | // lookup will have been tried and not found. | ||
269 | return; | ||
270 | } | ||
271 | // flag this estate, so it is not tried multiple times | ||
272 | m_ownerEstates.Add(es.EstateID); | ||
273 | } | 257 | } |
274 | else if(MainConsole.Instance.ConsoleScene != m_module.Scene) | 258 | |
259 | // new command... clear out the old value | ||
260 | m_currentCmd = args; | ||
261 | |||
262 | if (args.Length == 3) | ||
275 | { | 263 | { |
276 | // trying to process a single region, and this isn't it | 264 | response = "No estate specified."; |
277 | return; | ||
278 | } | 265 | } |
279 | UserAccount account = null; | 266 | else |
280 | if(m_ownerAccount == null) | ||
281 | { | 267 | { |
282 | if(args.Length == 3) | 268 | int estateId; |
269 | if (!int.TryParse(args[3], out estateId)) | ||
283 | { | 270 | { |
284 | response = "No user specified."; | 271 | response = String.Format("\"{0}\" is not a valid ID for an Estate", args[3]); |
285 | } | 272 | } |
286 | else | 273 | else |
287 | { | 274 | { |
288 | // TODO: Is there a better choice here? | 275 | if (args.Length == 4) |
289 | UUID scopeID = UUID.Zero; | ||
290 | |||
291 | string s1 = args[3]; | ||
292 | if(args.Length == 4) | ||
293 | { | 276 | { |
294 | // attempt to get account by UUID | 277 | response = "No user specified."; |
295 | UUID u; | 278 | } |
296 | if(UUID.TryParse(s1, out u)) | 279 | else |
280 | { | ||
281 | UserAccount account = null; | ||
282 | |||
283 | // TODO: Is there a better choice here? | ||
284 | UUID scopeID = UUID.Zero; | ||
285 | |||
286 | string s1 = args[4]; | ||
287 | if (args.Length == 5) | ||
297 | { | 288 | { |
298 | account = m_module.Scene.UserAccountService.GetUserAccount(scopeID, u); | 289 | // attempt to get account by UUID |
299 | if(account == null) | 290 | UUID u; |
291 | if (UUID.TryParse(s1, out u)) | ||
292 | { | ||
293 | account = m_module.Scene.UserAccountService.GetUserAccount(scopeID, u); | ||
294 | if (account == null) | ||
295 | response = String.Format("Could not find user {0}", s1); | ||
296 | } | ||
297 | else | ||
300 | { | 298 | { |
301 | response = String.Format("Could not find user {0}", s1); | 299 | response = String.Format("Invalid UUID {0}", s1); |
302 | } | 300 | } |
303 | } | 301 | } |
304 | else | 302 | else |
305 | { | 303 | { |
306 | response = String.Format("Invalid UUID {0}", s1); | 304 | // attempt to get account by Firstname, Lastname |
307 | account = null; | 305 | string s2 = args[5]; |
306 | account = m_module.Scene.UserAccountService.GetUserAccount(scopeID, s1, s2); | ||
307 | if (account == null) | ||
308 | response = String.Format("Could not find user {0} {1}", s1, s2); | ||
308 | } | 309 | } |
309 | } | 310 | |
310 | else | 311 | // If it's valid, send it off for processing. |
311 | { | 312 | if (account != null) |
312 | // attempt to get account by Firstname, Lastname | 313 | response = m_module.SetEstateOwner(estateId, account); |
313 | string s2 = args[4]; | 314 | |
314 | account = m_module.Scene.UserAccountService.GetUserAccount(scopeID, s1, s2); | 315 | if (response == String.Empty) |
315 | if(account == null) | 316 | { |
317 | response = String.Format("Estate owner changed to {0} ({1} {2})", account.PrincipalID, account.FirstName, account.LastName); | ||
318 | |||
319 | // save data for propagation to other Scene Regions | ||
320 | m_estateSettings = new EstateSettings(); | ||
321 | m_estateSettings.EstateID = (uint)estateId; | ||
322 | m_estateSettings.EstateOwner = account.PrincipalID; | ||
323 | |||
324 | // update current Scene Region if appropriate | ||
325 | if (es.EstateID == estateId) | ||
326 | es.EstateOwner = account.PrincipalID; | ||
327 | } | ||
328 | else | ||
316 | { | 329 | { |
317 | response = String.Format("Could not find user {0} {1}", s1, s2); | 330 | m_estateSettings = null; |
318 | } | 331 | } |
319 | } | 332 | } |
320 | } | 333 | } |
321 | } | 334 | } |
322 | else | 335 | |
336 | // give the user some feedback | ||
337 | if (response != null) | ||
338 | MainConsole.Instance.Output(response); | ||
339 | } | ||
340 | |||
341 | protected void SetEstateNameCommand(string module, string[] args) | ||
342 | { | ||
343 | string response = null; | ||
344 | |||
345 | EstateSettings es = m_module.Scene.RegionInfo.EstateSettings; | ||
346 | |||
347 | if (args == m_currentCmd) | ||
323 | { | 348 | { |
324 | account = m_ownerAccount; | 349 | // HACK to propagate new estate info to Scene Regions |
350 | if (m_estateSettings != null && es.EstateID == m_estateSettings.EstateID) | ||
351 | es.EstateName = m_estateSettings.EstateName; | ||
352 | |||
353 | return; | ||
325 | } | 354 | } |
326 | if(account != null) | ||
327 | { | ||
328 | if (MainConsole.Instance.ConsoleScene == null) | ||
329 | m_ownerAccount = account; | ||
330 | 355 | ||
331 | string choice; | 356 | // new command... clear out the old value |
332 | do | 357 | m_currentCmd = args; |
333 | { | ||
334 | // Get user confirmation, in case there are multiple estates involved (from root) | ||
335 | choice = MainConsole.Instance.CmdPrompt( | ||
336 | string.Format("Change owner of Estate {0} ({1}) [y/n]? ",es.EstateID, es.EstateName), | ||
337 | "Y"); | ||
338 | 358 | ||
339 | if("y".Equals(choice, StringComparison.OrdinalIgnoreCase)) | 359 | if (args.Length == 3) |
360 | { | ||
361 | response = "No estate specified."; | ||
362 | } | ||
363 | else | ||
364 | { | ||
365 | int estateId; | ||
366 | if (!int.TryParse(args[3], out estateId)) | ||
367 | { | ||
368 | response = String.Format("\"{0}\" is not a valid ID for an Estate", args[3]); | ||
369 | } | ||
370 | else | ||
371 | { | ||
372 | if (args.Length == 4) | ||
340 | { | 373 | { |
341 | response = m_module.setEstateOwner((int)es.EstateID, account); | 374 | response = "No name specified."; |
342 | } | 375 | } |
343 | else if(!"n".Equals(choice, StringComparison.OrdinalIgnoreCase)) | 376 | else |
344 | { | 377 | { |
345 | MainConsole.Instance.Output("Invalid response. Please select y or n."); | 378 | // everything after the estate ID is "name" |
346 | choice = null; | 379 | StringBuilder sb = new StringBuilder(args[4]); |
380 | for (int i = 5; i < args.Length; i++) | ||
381 | sb.Append (" " + args[i]); | ||
382 | |||
383 | string estateName = sb.ToString(); | ||
384 | |||
385 | // send it off for processing. | ||
386 | response = m_module.SetEstateName(estateId, estateName); | ||
387 | |||
388 | if (response == String.Empty) | ||
389 | { | ||
390 | response = String.Format("Estate {0} renamed from \"{1}\" to \"{2}\"", estateId, es.EstateName, estateName); | ||
391 | |||
392 | // save data for propagation to other Scene Regions | ||
393 | m_estateSettings = new EstateSettings(); | ||
394 | m_estateSettings.EstateID = (uint)estateId; | ||
395 | m_estateSettings.EstateName = estateName; | ||
396 | |||
397 | // update current Scene Region if appropriate | ||
398 | if (es.EstateID == estateId) | ||
399 | es.EstateName = estateName; | ||
400 | } | ||
401 | else | ||
402 | { | ||
403 | m_estateSettings = null; | ||
404 | } | ||
347 | } | 405 | } |
348 | } | 406 | } |
349 | while(choice == null); | ||
350 | } | 407 | } |
351 | 408 | ||
352 | 409 | // give the user some feedback | |
353 | // Give the user some feedback | 410 | if (response != null) |
354 | if(response != null) | ||
355 | MainConsole.Instance.Output(response); | 411 | MainConsole.Instance.Output(response); |
356 | } | 412 | } |
357 | 413 | ||
414 | #endregion | ||
358 | } | 415 | } |
359 | } \ No newline at end of file | 416 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 9e6d0fc..ae956e6 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -68,8 +68,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
68 | public event ChangeDelegate OnEstateInfoChange; | 68 | public event ChangeDelegate OnEstateInfoChange; |
69 | public event MessageDelegate OnEstateMessage; | 69 | public event MessageDelegate OnEstateMessage; |
70 | 70 | ||
71 | private int m_delayCount = 0; | ||
72 | |||
73 | #region Region Module interface | 71 | #region Region Module interface |
74 | 72 | ||
75 | public string Name { get { return "EstateManagementModule"; } } | 73 | public string Name { get { return "EstateManagementModule"; } } |
@@ -117,6 +115,189 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
117 | 115 | ||
118 | #endregion | 116 | #endregion |
119 | 117 | ||
118 | #region IEstateModule Functions | ||
119 | public uint GetRegionFlags() | ||
120 | { | ||
121 | RegionFlags flags = RegionFlags.None; | ||
122 | |||
123 | // Fully implemented | ||
124 | // | ||
125 | if (Scene.RegionInfo.RegionSettings.AllowDamage) | ||
126 | flags |= RegionFlags.AllowDamage; | ||
127 | if (Scene.RegionInfo.RegionSettings.BlockTerraform) | ||
128 | flags |= RegionFlags.BlockTerraform; | ||
129 | if (!Scene.RegionInfo.RegionSettings.AllowLandResell) | ||
130 | flags |= RegionFlags.BlockLandResell; | ||
131 | if (Scene.RegionInfo.RegionSettings.DisableCollisions) | ||
132 | flags |= RegionFlags.SkipCollisions; | ||
133 | if (Scene.RegionInfo.RegionSettings.DisableScripts) | ||
134 | flags |= RegionFlags.SkipScripts; | ||
135 | if (Scene.RegionInfo.RegionSettings.DisablePhysics) | ||
136 | flags |= RegionFlags.SkipPhysics; | ||
137 | if (Scene.RegionInfo.RegionSettings.BlockFly) | ||
138 | flags |= RegionFlags.NoFly; | ||
139 | if (Scene.RegionInfo.RegionSettings.RestrictPushing) | ||
140 | flags |= RegionFlags.RestrictPushObject; | ||
141 | if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide) | ||
142 | flags |= RegionFlags.AllowParcelChanges; | ||
143 | if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) | ||
144 | flags |= RegionFlags.BlockParcelSearch; | ||
145 | |||
146 | if (Scene.RegionInfo.RegionSettings.FixedSun) | ||
147 | flags |= RegionFlags.SunFixed; | ||
148 | if (Scene.RegionInfo.RegionSettings.Sandbox) | ||
149 | flags |= RegionFlags.Sandbox; | ||
150 | if (Scene.RegionInfo.EstateSettings.AllowVoice) | ||
151 | flags |= RegionFlags.AllowVoice; | ||
152 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
153 | flags |= RegionFlags.AllowLandmark; | ||
154 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
155 | flags |= RegionFlags.AllowSetHome; | ||
156 | if (Scene.RegionInfo.EstateSettings.BlockDwell) | ||
157 | flags |= RegionFlags.BlockDwell; | ||
158 | if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) | ||
159 | flags |= RegionFlags.ResetHomeOnTeleport; | ||
160 | |||
161 | |||
162 | // TODO: SkipUpdateInterestList | ||
163 | |||
164 | // Omitted | ||
165 | // | ||
166 | // Omitted: NullLayer (what is that?) | ||
167 | // Omitted: SkipAgentAction (what does it do?) | ||
168 | |||
169 | return (uint)flags; | ||
170 | } | ||
171 | |||
172 | public bool IsManager(UUID avatarID) | ||
173 | { | ||
174 | if (avatarID == Scene.RegionInfo.EstateSettings.EstateOwner) | ||
175 | return true; | ||
176 | |||
177 | List<UUID> ems = new List<UUID>(Scene.RegionInfo.EstateSettings.EstateManagers); | ||
178 | if (ems.Contains(avatarID)) | ||
179 | return true; | ||
180 | |||
181 | return false; | ||
182 | } | ||
183 | |||
184 | public void sendRegionHandshakeToAll() | ||
185 | { | ||
186 | Scene.ForEachClient(sendRegionHandshake); | ||
187 | } | ||
188 | |||
189 | public void TriggerEstateInfoChange() | ||
190 | { | ||
191 | ChangeDelegate change = OnEstateInfoChange; | ||
192 | |||
193 | if (change != null) | ||
194 | change(Scene.RegionInfo.RegionID); | ||
195 | } | ||
196 | |||
197 | public void TriggerRegionInfoChange() | ||
198 | { | ||
199 | m_regionChangeTimer.Stop(); | ||
200 | m_regionChangeTimer.Start(); | ||
201 | |||
202 | ChangeDelegate change = OnRegionInfoChange; | ||
203 | |||
204 | if (change != null) | ||
205 | change(Scene.RegionInfo.RegionID); | ||
206 | } | ||
207 | |||
208 | public void setEstateTerrainBaseTexture(int level, UUID texture) | ||
209 | { | ||
210 | setEstateTerrainBaseTexture(null, level, texture); | ||
211 | sendRegionHandshakeToAll(); | ||
212 | } | ||
213 | |||
214 | public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue) | ||
215 | { | ||
216 | setEstateTerrainTextureHeights(null, corner, lowValue, highValue); | ||
217 | } | ||
218 | |||
219 | public bool IsTerrainXfer(ulong xferID) | ||
220 | { | ||
221 | lock (this) | ||
222 | { | ||
223 | if (TerrainUploader == null) | ||
224 | return false; | ||
225 | else | ||
226 | return TerrainUploader.XferID == xferID; | ||
227 | } | ||
228 | } | ||
229 | |||
230 | public string SetEstateOwner(int estateID, UserAccount account) | ||
231 | { | ||
232 | string response; | ||
233 | |||
234 | // get the current settings from DB | ||
235 | EstateSettings dbSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
236 | if (dbSettings.EstateID == 0) | ||
237 | { | ||
238 | response = String.Format("No estate found with ID {0}", estateID); | ||
239 | } | ||
240 | else if (account.PrincipalID == dbSettings.EstateOwner) | ||
241 | { | ||
242 | response = String.Format("Estate already belongs to {0} ({1} {2})", account.PrincipalID, account.FirstName, account.LastName); | ||
243 | } | ||
244 | else | ||
245 | { | ||
246 | dbSettings.EstateOwner = account.PrincipalID; | ||
247 | dbSettings.Save(); | ||
248 | response = String.Empty; | ||
249 | |||
250 | // make sure there's a log entry to document the change | ||
251 | m_log.InfoFormat("[ESTATE]: Estate Owner for {0} changed to {1} ({2} {3})", dbSettings.EstateName, | ||
252 | account.PrincipalID, account.FirstName, account.LastName); | ||
253 | |||
254 | TriggerEstateInfoChange(); | ||
255 | sendRegionHandshakeToAll(); | ||
256 | } | ||
257 | return response; | ||
258 | } | ||
259 | |||
260 | public string SetEstateName(int estateID, string newName) | ||
261 | { | ||
262 | string response; | ||
263 | |||
264 | // get the current settings from DB | ||
265 | EstateSettings dbSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
266 | |||
267 | if (dbSettings.EstateID == 0) | ||
268 | { | ||
269 | response = String.Format("No estate found with ID {0}", estateID); | ||
270 | } | ||
271 | else if (newName == dbSettings.EstateName) | ||
272 | { | ||
273 | response = String.Format("Estate {0} is already named \"{1}\"", estateID, newName); | ||
274 | } | ||
275 | else | ||
276 | { | ||
277 | List<int> estates = Scene.EstateDataService.GetEstates(newName); | ||
278 | if (estates.Count() > 0) | ||
279 | { | ||
280 | response = String.Format("An estate named \"{0}\" already exists.", newName); | ||
281 | } | ||
282 | else | ||
283 | { | ||
284 | string oldName = dbSettings.EstateName; | ||
285 | dbSettings.EstateName = newName; | ||
286 | dbSettings.Save(); | ||
287 | response = String.Empty; | ||
288 | |||
289 | // make sure there's a log entry to document the change | ||
290 | m_log.InfoFormat("[ESTATE]: Estate {0} renamed from \"{1}\" to \"{2}\"", estateID, oldName, newName); | ||
291 | |||
292 | TriggerEstateInfoChange(); | ||
293 | sendRegionHandshakeToAll(); | ||
294 | } | ||
295 | } | ||
296 | return response; | ||
297 | } | ||
298 | |||
299 | #endregion | ||
300 | |||
120 | #region Packet Data Responders | 301 | #region Packet Data Responders |
121 | 302 | ||
122 | private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) | 303 | private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) |
@@ -224,12 +405,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
224 | sendRegionInfoPacketToAll(); | 405 | sendRegionInfoPacketToAll(); |
225 | } | 406 | } |
226 | 407 | ||
227 | public void setEstateTerrainBaseTexture(int level, UUID texture) | ||
228 | { | ||
229 | setEstateTerrainBaseTexture(null, level, texture); | ||
230 | sendRegionHandshakeToAll(); | ||
231 | } | ||
232 | |||
233 | public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture) | 408 | public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture) |
234 | { | 409 | { |
235 | if (texture == UUID.Zero) | 410 | if (texture == UUID.Zero) |
@@ -256,11 +431,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
256 | sendRegionInfoPacketToAll(); | 431 | sendRegionInfoPacketToAll(); |
257 | } | 432 | } |
258 | 433 | ||
259 | public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue) | ||
260 | { | ||
261 | setEstateTerrainTextureHeights(null, corner, lowValue, highValue); | ||
262 | } | ||
263 | |||
264 | public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) | 434 | public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) |
265 | { | 435 | { |
266 | switch (corner) | 436 | switch (corner) |
@@ -925,17 +1095,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
925 | } | 1095 | } |
926 | } | 1096 | } |
927 | 1097 | ||
928 | public bool IsTerrainXfer(ulong xferID) | ||
929 | { | ||
930 | lock (this) | ||
931 | { | ||
932 | if (TerrainUploader == null) | ||
933 | return false; | ||
934 | else | ||
935 | return TerrainUploader.XferID == xferID; | ||
936 | } | ||
937 | } | ||
938 | |||
939 | private void handleTerrainRequest(IClientAPI remote_client, string clientFileName) | 1098 | private void handleTerrainRequest(IClientAPI remote_client, string clientFileName) |
940 | { | 1099 | { |
941 | // Save terrain here | 1100 | // Save terrain here |
@@ -1117,11 +1276,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1117 | remoteClient.SendRegionHandshake(Scene.RegionInfo,args); | 1276 | remoteClient.SendRegionHandshake(Scene.RegionInfo,args); |
1118 | } | 1277 | } |
1119 | 1278 | ||
1120 | public void sendRegionHandshakeToAll() | ||
1121 | { | ||
1122 | Scene.ForEachClient(sendRegionHandshake); | ||
1123 | } | ||
1124 | |||
1125 | public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) | 1279 | public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) |
1126 | { | 1280 | { |
1127 | if (parms2 == 0) | 1281 | if (parms2 == 0) |
@@ -1203,31 +1357,8 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1203 | sendRegionInfoPacketToAll(); | 1357 | sendRegionInfoPacketToAll(); |
1204 | } | 1358 | } |
1205 | 1359 | ||
1206 | public string setEstateOwner(int estateID, UserAccount account) | ||
1207 | { | ||
1208 | string response; | ||
1209 | 1360 | ||
1210 | // get the current settings from DB | 1361 | #endregion |
1211 | EstateSettings dbSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
1212 | if(account.PrincipalID != dbSettings.EstateOwner) { | ||
1213 | dbSettings.EstateOwner = account.PrincipalID; | ||
1214 | dbSettings.Save(); | ||
1215 | response = String.Format("Estate owner changed to {0} ({1} {2})", account.PrincipalID, account.FirstName, account.LastName); | ||
1216 | |||
1217 | // make sure there's a log entry to document the change | ||
1218 | m_log.InfoFormat("[ESTATE]: Estate Owner for {0} changed to {1} ({2} {3})", dbSettings.EstateName, | ||
1219 | account.PrincipalID, account.FirstName, account.LastName); | ||
1220 | |||
1221 | TriggerEstateInfoChange(); | ||
1222 | } | ||
1223 | else | ||
1224 | { | ||
1225 | response = String.Format("Estate already belongs to {0} ({1} {2})", account.PrincipalID, account.FirstName, account.LastName); | ||
1226 | } | ||
1227 | return response; | ||
1228 | } | ||
1229 | |||
1230 | #endregion | ||
1231 | 1362 | ||
1232 | private void EventManager_OnNewClient(IClientAPI client) | 1363 | private void EventManager_OnNewClient(IClientAPI client) |
1233 | { | 1364 | { |
@@ -1257,60 +1388,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1257 | sendRegionHandshake(client); | 1388 | sendRegionHandshake(client); |
1258 | } | 1389 | } |
1259 | 1390 | ||
1260 | public uint GetRegionFlags() | 1391 | private uint GetEstateFlags() |
1261 | { | ||
1262 | RegionFlags flags = RegionFlags.None; | ||
1263 | |||
1264 | // Fully implemented | ||
1265 | // | ||
1266 | if (Scene.RegionInfo.RegionSettings.AllowDamage) | ||
1267 | flags |= RegionFlags.AllowDamage; | ||
1268 | if (Scene.RegionInfo.RegionSettings.BlockTerraform) | ||
1269 | flags |= RegionFlags.BlockTerraform; | ||
1270 | if (!Scene.RegionInfo.RegionSettings.AllowLandResell) | ||
1271 | flags |= RegionFlags.BlockLandResell; | ||
1272 | if (Scene.RegionInfo.RegionSettings.DisableCollisions) | ||
1273 | flags |= RegionFlags.SkipCollisions; | ||
1274 | if (Scene.RegionInfo.RegionSettings.DisableScripts) | ||
1275 | flags |= RegionFlags.SkipScripts; | ||
1276 | if (Scene.RegionInfo.RegionSettings.DisablePhysics) | ||
1277 | flags |= RegionFlags.SkipPhysics; | ||
1278 | if (Scene.RegionInfo.RegionSettings.BlockFly) | ||
1279 | flags |= RegionFlags.NoFly; | ||
1280 | if (Scene.RegionInfo.RegionSettings.RestrictPushing) | ||
1281 | flags |= RegionFlags.RestrictPushObject; | ||
1282 | if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide) | ||
1283 | flags |= RegionFlags.AllowParcelChanges; | ||
1284 | if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) | ||
1285 | flags |= RegionFlags.BlockParcelSearch; | ||
1286 | |||
1287 | if (Scene.RegionInfo.RegionSettings.FixedSun) | ||
1288 | flags |= RegionFlags.SunFixed; | ||
1289 | if (Scene.RegionInfo.RegionSettings.Sandbox) | ||
1290 | flags |= RegionFlags.Sandbox; | ||
1291 | if (Scene.RegionInfo.EstateSettings.AllowVoice) | ||
1292 | flags |= RegionFlags.AllowVoice; | ||
1293 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1294 | flags |= RegionFlags.AllowLandmark; | ||
1295 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1296 | flags |= RegionFlags.AllowSetHome; | ||
1297 | if (Scene.RegionInfo.EstateSettings.BlockDwell) | ||
1298 | flags |= RegionFlags.BlockDwell; | ||
1299 | if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) | ||
1300 | flags |= RegionFlags.ResetHomeOnTeleport; | ||
1301 | |||
1302 | |||
1303 | // TODO: SkipUpdateInterestList | ||
1304 | |||
1305 | // Omitted | ||
1306 | // | ||
1307 | // Omitted: NullLayer (what is that?) | ||
1308 | // Omitted: SkipAgentAction (what does it do?) | ||
1309 | |||
1310 | return (uint)flags; | ||
1311 | } | ||
1312 | |||
1313 | public uint GetEstateFlags() | ||
1314 | { | 1392 | { |
1315 | RegionFlags flags = RegionFlags.None; | 1393 | RegionFlags flags = RegionFlags.None; |
1316 | 1394 | ||
@@ -1351,37 +1429,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1351 | return (uint)flags; | 1429 | return (uint)flags; |
1352 | } | 1430 | } |
1353 | 1431 | ||
1354 | public bool IsManager(UUID avatarID) | ||
1355 | { | ||
1356 | if (avatarID == Scene.RegionInfo.EstateSettings.EstateOwner) | ||
1357 | return true; | ||
1358 | |||
1359 | List<UUID> ems = new List<UUID>(Scene.RegionInfo.EstateSettings.EstateManagers); | ||
1360 | if (ems.Contains(avatarID)) | ||
1361 | return true; | ||
1362 | |||
1363 | return false; | ||
1364 | } | ||
1365 | |||
1366 | public void TriggerRegionInfoChange() | ||
1367 | { | ||
1368 | m_regionChangeTimer.Stop(); | ||
1369 | m_regionChangeTimer.Start(); | ||
1370 | |||
1371 | ChangeDelegate change = OnRegionInfoChange; | ||
1372 | |||
1373 | if (change != null) | ||
1374 | change(Scene.RegionInfo.RegionID); | ||
1375 | } | ||
1376 | |||
1377 | public void TriggerEstateInfoChange() | ||
1378 | { | ||
1379 | ChangeDelegate change = OnEstateInfoChange; | ||
1380 | |||
1381 | if (change != null) | ||
1382 | change(Scene.RegionInfo.RegionID); | ||
1383 | } | ||
1384 | |||
1385 | public void TriggerEstateMessage(UUID fromID, string fromName, string message) | 1432 | public void TriggerEstateMessage(UUID fromID, string fromName, string message) |
1386 | { | 1433 | { |
1387 | MessageDelegate onmessage = OnEstateMessage; | 1434 | MessageDelegate onmessage = OnEstateMessage; |
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 944c66b..600ecfe 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenMetaverse; | 28 | using OpenMetaverse; |
29 | using OpenSim.Services.Interfaces; | ||
29 | 30 | ||
30 | namespace OpenSim.Region.Framework.Interfaces | 31 | namespace OpenSim.Region.Framework.Interfaces |
31 | { | 32 | { |
@@ -41,6 +42,9 @@ namespace OpenSim.Region.Framework.Interfaces | |||
41 | uint GetRegionFlags(); | 42 | uint GetRegionFlags(); |
42 | bool IsManager(UUID avatarID); | 43 | bool IsManager(UUID avatarID); |
43 | 44 | ||
45 | string SetEstateOwner(int estateID, UserAccount account); | ||
46 | string SetEstateName(int estateID, string newName); | ||
47 | |||
44 | /// <summary> | 48 | /// <summary> |
45 | /// Tell all clients about the current state of the region (terrain textures, water height, etc.). | 49 | /// Tell all clients about the current state of the region (terrain textures, water height, etc.). |
46 | /// </summary> | 50 | /// </summary> |