diff options
4 files changed, 161 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 7920748..54715a8 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -357,7 +357,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
357 | // Start the scripts. We delayed this because we want the OAR to finish loading ASAP, so | 357 | // Start the scripts. We delayed this because we want the OAR to finish loading ASAP, so |
358 | // that users can enter the scene. If we allow the scripts to start in the loop above | 358 | // that users can enter the scene. If we allow the scripts to start in the loop above |
359 | // then they significantly increase the time until the OAR finishes loading. | 359 | // then they significantly increase the time until the OAR finishes loading. |
360 | Util.FireAndForget(delegate(object o) | 360 | Util.RunThreadNoTimeout(delegate(object o) |
361 | { | 361 | { |
362 | Thread.Sleep(15000); | 362 | Thread.Sleep(15000); |
363 | m_log.Info("[ARCHIVER]: Starting scripts in scene objects"); | 363 | m_log.Info("[ARCHIVER]: Starting scripts in scene objects"); |
@@ -372,7 +372,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
372 | 372 | ||
373 | sceneContext.SceneObjects.Clear(); | 373 | sceneContext.SceneObjects.Clear(); |
374 | } | 374 | } |
375 | }); | 375 | }, "ReadArchiveStartScripts", null); |
376 | 376 | ||
377 | m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); | 377 | m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); |
378 | 378 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs index 1659493..59dd3bb 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs | |||
@@ -39,6 +39,7 @@ using OpenSim.Framework.Console; | |||
39 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | 39 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; |
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Services.Interfaces; | ||
42 | 43 | ||
43 | namespace OpenSim.Region.CoreModules.World.Estate | 44 | namespace OpenSim.Region.CoreModules.World.Estate |
44 | { | 45 | { |
@@ -50,9 +51,18 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 52 | ||
52 | protected EstateManagementModule m_module; | 53 | protected EstateManagementModule m_module; |
53 | 54 | ||
54 | protected Commander m_commander = new Commander("estate"); | 55 | protected Commander m_commander = new Commander("estate"); |
55 | 56 | ||
57 | // variable used in processing "estate set owner" | ||
58 | private static string[] m_ownerCmd = null; | ||
59 | |||
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 | |||
56 | public EstateManagementCommands(EstateManagementModule module) | 66 | public EstateManagementCommands(EstateManagementModule module) |
57 | { | 67 | { |
58 | m_module = module; | 68 | m_module = module; |
@@ -85,7 +95,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
85 | 95 | ||
86 | m_module.Scene.AddCommand( | 96 | m_module.Scene.AddCommand( |
87 | "Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", ShowEstatesCommand); | 97 | "Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", ShowEstatesCommand); |
88 | } | 98 | |
99 | m_module.Scene.AddCommand( | ||
100 | "Estates", m_module, "estate set owner", "estate set owner [ <UUID> | <Firstname> <Lastname> ]", | ||
101 | "Sets the owner of the current region's estate to the specified UUID or user. " + | ||
102 | "If called from root region, all estates will be prompted for change.", SetEstateOwnerCommand); | ||
103 | } | ||
89 | 104 | ||
90 | public void Close() {} | 105 | public void Close() {} |
91 | 106 | ||
@@ -226,5 +241,119 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
226 | 241 | ||
227 | MainConsole.Instance.Output(report.ToString()); | 242 | MainConsole.Instance.Output(report.ToString()); |
228 | } | 243 | } |
244 | |||
245 | protected void SetEstateOwnerCommand(string module, string[] args) | ||
246 | { | ||
247 | string response = null; | ||
248 | |||
249 | EstateSettings es = m_module.Scene.RegionInfo.EstateSettings; | ||
250 | |||
251 | if(args != m_ownerCmd) | ||
252 | { | ||
253 | // new command... clear out the old values | ||
254 | m_ownerCmd = args; | ||
255 | m_ownerEstates = new List<uint>(); | ||
256 | m_ownerAccount = null; | ||
257 | } | ||
258 | |||
259 | if (MainConsole.Instance.ConsoleScene == null) | ||
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 | } | ||
274 | else if(MainConsole.Instance.ConsoleScene != m_module.Scene) | ||
275 | { | ||
276 | // trying to process a single region, and this isn't it | ||
277 | return; | ||
278 | } | ||
279 | UserAccount account = null; | ||
280 | if(m_ownerAccount == null) | ||
281 | { | ||
282 | if(args.Length == 3) | ||
283 | { | ||
284 | response = "No user specified."; | ||
285 | } | ||
286 | else | ||
287 | { | ||
288 | // TODO: Is there a better choice here? | ||
289 | UUID scopeID = UUID.Zero; | ||
290 | |||
291 | string s1 = args[3]; | ||
292 | if(args.Length == 4) | ||
293 | { | ||
294 | // attempt to get account by UUID | ||
295 | UUID u; | ||
296 | if(UUID.TryParse(s1, out u)) | ||
297 | { | ||
298 | account = m_module.Scene.UserAccountService.GetUserAccount(scopeID, u); | ||
299 | if(account == null) | ||
300 | { | ||
301 | response = String.Format("Could not find user {0}", s1); | ||
302 | } | ||
303 | } | ||
304 | else | ||
305 | { | ||
306 | response = String.Format("Invalid UUID {0}", s1); | ||
307 | account = null; | ||
308 | } | ||
309 | } | ||
310 | else | ||
311 | { | ||
312 | // attempt to get account by Firstname, Lastname | ||
313 | string s2 = args[4]; | ||
314 | account = m_module.Scene.UserAccountService.GetUserAccount(scopeID, s1, s2); | ||
315 | if(account == null) | ||
316 | { | ||
317 | response = String.Format("Could not find user {0} {1}", s1, s2); | ||
318 | } | ||
319 | } | ||
320 | } | ||
321 | } | ||
322 | else | ||
323 | { | ||
324 | account = m_ownerAccount; | ||
325 | } | ||
326 | if(account != null) | ||
327 | { | ||
328 | if (MainConsole.Instance.ConsoleScene == null) | ||
329 | m_ownerAccount = account; | ||
330 | |||
331 | string choice; | ||
332 | do | ||
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 | |||
339 | if("y".Equals(choice, StringComparison.OrdinalIgnoreCase)) | ||
340 | { | ||
341 | response = m_module.setEstateOwner((int)es.EstateID, account); | ||
342 | } | ||
343 | else if(!"n".Equals(choice, StringComparison.OrdinalIgnoreCase)) | ||
344 | { | ||
345 | MainConsole.Instance.Output("Invalid response. Please select y or n."); | ||
346 | choice = null; | ||
347 | } | ||
348 | } | ||
349 | while(choice == null); | ||
350 | } | ||
351 | |||
352 | |||
353 | // Give the user some feedback | ||
354 | if(response != null) | ||
355 | MainConsole.Instance.Output(response); | ||
356 | } | ||
357 | |||
229 | } | 358 | } |
230 | } \ No newline at end of file | 359 | } \ 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 cb9ad4a..9e6d0fc 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -40,6 +40,7 @@ using OpenMetaverse; | |||
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
43 | using OpenSim.Services.Interfaces; | ||
43 | using RegionFlags = OpenMetaverse.RegionFlags; | 44 | using RegionFlags = OpenMetaverse.RegionFlags; |
44 | 45 | ||
45 | namespace OpenSim.Region.CoreModules.World.Estate | 46 | namespace OpenSim.Region.CoreModules.World.Estate |
@@ -1202,6 +1203,30 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1202 | sendRegionInfoPacketToAll(); | 1203 | sendRegionInfoPacketToAll(); |
1203 | } | 1204 | } |
1204 | 1205 | ||
1206 | public string setEstateOwner(int estateID, UserAccount account) | ||
1207 | { | ||
1208 | string response; | ||
1209 | |||
1210 | // get the current settings from DB | ||
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 | |||
1205 | #endregion | 1230 | #endregion |
1206 | 1231 | ||
1207 | private void EventManager_OnNewClient(IClientAPI client) | 1232 | private void EventManager_OnNewClient(IClientAPI client) |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index a93f3c8..85650d6 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -507,7 +507,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
507 | m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape); | 507 | m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape); |
508 | m_ShapeXmlProcessors.Add("SculptTexture", ProcessShpSculptTexture); | 508 | m_ShapeXmlProcessors.Add("SculptTexture", ProcessShpSculptTexture); |
509 | m_ShapeXmlProcessors.Add("SculptType", ProcessShpSculptType); | 509 | m_ShapeXmlProcessors.Add("SculptType", ProcessShpSculptType); |
510 | m_ShapeXmlProcessors.Add("SculptData", ProcessShpSculptData); | 510 | // Ignore "SculptData"; this element is deprecated |
511 | m_ShapeXmlProcessors.Add("FlexiSoftness", ProcessShpFlexiSoftness); | 511 | m_ShapeXmlProcessors.Add("FlexiSoftness", ProcessShpFlexiSoftness); |
512 | m_ShapeXmlProcessors.Add("FlexiTension", ProcessShpFlexiTension); | 512 | m_ShapeXmlProcessors.Add("FlexiTension", ProcessShpFlexiTension); |
513 | m_ShapeXmlProcessors.Add("FlexiDrag", ProcessShpFlexiDrag); | 513 | m_ShapeXmlProcessors.Add("FlexiDrag", ProcessShpFlexiDrag); |
@@ -1142,13 +1142,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1142 | shp.SculptType = (byte)reader.ReadElementContentAsInt("SculptType", String.Empty); | 1142 | shp.SculptType = (byte)reader.ReadElementContentAsInt("SculptType", String.Empty); |
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | private static void ProcessShpSculptData(PrimitiveBaseShape shp, XmlTextReader reader) | ||
1146 | { | ||
1147 | // m_log.DebugFormat("[SCENE OBJECT SERIALIZER]: Setting sculpt data length {0}", shp.SculptData.Length); | ||
1148 | |||
1149 | shp.SculptData = Convert.FromBase64String(reader.ReadElementString("SculptData")); | ||
1150 | } | ||
1151 | |||
1152 | private static void ProcessShpFlexiSoftness(PrimitiveBaseShape shp, XmlTextReader reader) | 1145 | private static void ProcessShpFlexiSoftness(PrimitiveBaseShape shp, XmlTextReader reader) |
1153 | { | 1146 | { |
1154 | shp.FlexiSoftness = reader.ReadElementContentAsInt("FlexiSoftness", String.Empty); | 1147 | shp.FlexiSoftness = reader.ReadElementContentAsInt("FlexiSoftness", String.Empty); |
@@ -1558,14 +1551,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1558 | 1551 | ||
1559 | WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); | 1552 | WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); |
1560 | writer.WriteElementString("SculptType", shp.SculptType.ToString()); | 1553 | writer.WriteElementString("SculptType", shp.SculptType.ToString()); |
1561 | writer.WriteStartElement("SculptData"); | 1554 | // Don't serialize SculptData. It's just a copy of the asset, which can be loaded separately using 'SculptTexture'. |
1562 | byte[] sd; | ||
1563 | if (shp.SculptData != null) | ||
1564 | sd = shp.SculptData; | ||
1565 | else | ||
1566 | sd = Utils.EmptyBytes; | ||
1567 | writer.WriteBase64(sd, 0, sd.Length); | ||
1568 | writer.WriteEndElement(); // SculptData | ||
1569 | 1555 | ||
1570 | writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString()); | 1556 | writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString()); |
1571 | writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString()); | 1557 | writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString()); |