aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs44
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs37
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs16
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs49
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs17
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs9
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs57
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs4
11 files changed, 156 insertions, 89 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index ef5efdd..4359c01 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
167 // sanity check: 167 // sanity check:
168 if (c.Sender == null) 168 if (c.Sender == null)
169 { 169 {
170 m_log.ErrorFormat("[CHAT] OnChatFromClient from {0} has empty Sender field!", sender); 170 m_log.ErrorFormat("[CHAT]: OnChatFromClient from {0} has empty Sender field!", sender);
171 return; 171 return;
172 } 172 }
173 173
@@ -220,17 +220,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
220 if (message.Length >= 1000) // libomv limit 220 if (message.Length >= 1000) // libomv limit
221 message = message.Substring(0, 1000); 221 message = message.Substring(0, 1000);
222 222
223 // m_log.DebugFormat("[CHAT]: DCTA: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, c.Type, sourceType); 223// m_log.DebugFormat(
224// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}",
225// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType);
224 226
227 HashSet<UUID> receiverIDs = new HashSet<UUID>();
228
225 foreach (Scene s in m_scenes) 229 foreach (Scene s in m_scenes)
226 { 230 {
227 s.ForEachScenePresence( 231 s.ForEachScenePresence(
228 delegate(ScenePresence presence) 232 delegate(ScenePresence presence)
229 { 233 {
230 TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType); 234 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType))
235 receiverIDs.Add(presence.UUID);
231 } 236 }
232 ); 237 );
233 } 238 }
239
240 (scene as Scene).EventManager.TriggerOnChatToClients(
241 fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully);
234 } 242 }
235 243
236 static private Vector3 CenterOfRegion = new Vector3(128, 128, 30); 244 static private Vector3 CenterOfRegion = new Vector3(128, 128, 30);
@@ -269,6 +277,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
269 277
270 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); 278 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
271 279
280 HashSet<UUID> receiverIDs = new HashSet<UUID>();
281
272 ((Scene)c.Scene).ForEachScenePresence( 282 ((Scene)c.Scene).ForEachScenePresence(
273 delegate(ScenePresence presence) 283 delegate(ScenePresence presence)
274 { 284 {
@@ -286,16 +296,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
286 296
287 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, 297 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
288 (byte)sourceType, (byte)ChatAudibleLevel.Fully); 298 (byte)sourceType, (byte)ChatAudibleLevel.Fully);
299 receiverIDs.Add(presence.UUID);
289 }); 300 });
301
302 (c.Scene as Scene).EventManager.TriggerOnChatToClients(
303 fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully);
290 } 304 }
291 305
292 306 /// <summary>
293 protected virtual void TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, 307 /// Try to send a message to the given presence
308 /// </summary>
309 /// <param name="presence">The receiver</param>
310 /// <param name="fromPos"></param>
311 /// <param name="regionPos">/param>
312 /// <param name="fromAgentID"></param>
313 /// <param name="fromName"></param>
314 /// <param name="type"></param>
315 /// <param name="message"></param>
316 /// <param name="src"></param>
317 /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a
318 /// precondition</returns>
319 protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
294 UUID fromAgentID, string fromName, ChatTypeEnum type, 320 UUID fromAgentID, string fromName, ChatTypeEnum type,
295 string message, ChatSourceType src) 321 string message, ChatSourceType src)
296 { 322 {
297 // don't send stuff to child agents 323 // don't send stuff to child agents
298 if (presence.IsChildAgent) return; 324 if (presence.IsChildAgent) return false;
299 325
300 Vector3 fromRegionPos = fromPos + regionPos; 326 Vector3 fromRegionPos = fromPos + regionPos;
301 Vector3 toRegionPos = presence.AbsolutePosition + 327 Vector3 toRegionPos = presence.AbsolutePosition +
@@ -308,12 +334,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
308 type == ChatTypeEnum.Say && dis > m_saydistance || 334 type == ChatTypeEnum.Say && dis > m_saydistance ||
309 type == ChatTypeEnum.Shout && dis > m_shoutdistance) 335 type == ChatTypeEnum.Shout && dis > m_shoutdistance)
310 { 336 {
311 return; 337 return false;
312 } 338 }
313 339
314 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView 340 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView
315 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, 341 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
316 fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); 342 fromAgentID, (byte)src, (byte)ChatAudibleLevel.Fully);
343
344 return true;
317 } 345 }
318 } 346 }
319} 347}
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index fdc48c6..918fa04 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -599,7 +599,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
599 try 599 try
600 { 600 {
601 601
602 XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, 3000); 602 XmlRpcResponse GridResp = GridReq.Send("http://" + reginfo.ExternalHostName + ":" + reginfo.HttpPort, 3000);
603 603
604 Hashtable responseData = (Hashtable)GridResp.Value; 604 Hashtable responseData = (Hashtable)GridResp.Value;
605 605
@@ -621,8 +621,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
621 } 621 }
622 catch (WebException e) 622 catch (WebException e)
623 { 623 {
624 m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0}} the host didn't respond ({2})", 624 m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to http://{0}:{1} the host didn't respond ({2})",
625 reginfo.ServerURI, e.Message); 625 reginfo.ExternalHostName, reginfo.HttpPort, e.Message);
626 } 626 }
627 627
628 return false; 628 return false;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index c1df827..046b05f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -33,6 +33,7 @@ using System.Reflection;
33using System.Threading; 33using System.Threading;
34using System.Text; 34using System.Text;
35using System.Xml; 35using System.Xml;
36using System.Xml.Linq;
36using log4net; 37using log4net;
37using OpenMetaverse; 38using OpenMetaverse;
38using OpenSim.Framework; 39using OpenSim.Framework;
@@ -50,6 +51,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
50 { 51 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 53
54 /// <summary>
55 /// The maximum major version of archive that we can read. Minor versions shouldn't need a max number since version
56 /// bumps here should be compatible.
57 /// </summary>
58 public static int MAX_MAJOR_VERSION = 0;
59
53 protected TarArchiveReader archive; 60 protected TarArchiveReader archive;
54 61
55 private UserAccount m_userInfo; 62 private UserAccount m_userInfo;
@@ -133,7 +140,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
133 140
134 while ((data = archive.ReadEntry(out filePath, out entryType)) != null) 141 while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
135 { 142 {
136 if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 143 if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
144 {
145 LoadControlFile(filePath, data);
146 }
147 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
137 { 148 {
138 if (LoadAsset(filePath, data)) 149 if (LoadAsset(filePath, data))
139 successfulAssetRestores++; 150 successfulAssetRestores++;
@@ -461,5 +472,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
461 return false; 472 return false;
462 } 473 }
463 } 474 }
475
476 /// <summary>
477 /// Load control file
478 /// </summary>
479 /// <param name="path"></param>
480 /// <param name="data"></param>
481 protected void LoadControlFile(string path, byte[] data)
482 {
483 XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data));
484 XElement archiveElement = doc.Element("archive");
485 int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value);
486 int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value);
487 string version = string.Format("{0}.{1}", majorVersion, minorVersion);
488
489 if (majorVersion > MAX_MAJOR_VERSION)
490 {
491 throw new Exception(
492 string.Format(
493 "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below",
494 majorVersion, MAX_MAJOR_VERSION));
495 }
496
497 m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
498 }
464 } 499 }
465} \ No newline at end of file 500} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index bae5a7a..9080e1c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -123,9 +123,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
123 123
124 try 124 try
125 { 125 {
126 // We're almost done. Just need to write out the control file now
127 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
128 m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
129 m_archiveWriter.Close(); 126 m_archiveWriter.Close();
130 } 127 }
131 catch (Exception e) 128 catch (Exception e)
@@ -277,6 +274,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
277 274
278 m_archiveWriter = new TarArchiveWriter(m_saveStream); 275 m_archiveWriter = new TarArchiveWriter(m_saveStream);
279 276
277 // Write out control file. This has to be done first so that subsequent loaders will see this file first
278 // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this
279 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
280 m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive.");
281
280 if (inventoryFolder != null) 282 if (inventoryFolder != null)
281 { 283 {
282 m_log.DebugFormat( 284 m_log.DebugFormat(
@@ -399,13 +401,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
399 /// <returns></returns> 401 /// <returns></returns>
400 public static string Create0p1ControlFile() 402 public static string Create0p1ControlFile()
401 { 403 {
404 int majorVersion = 0, minorVersion = 1;
405
406 m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion);
407
402 StringWriter sw = new StringWriter(); 408 StringWriter sw = new StringWriter();
403 XmlTextWriter xtw = new XmlTextWriter(sw); 409 XmlTextWriter xtw = new XmlTextWriter(sw);
404 xtw.Formatting = Formatting.Indented; 410 xtw.Formatting = Formatting.Indented;
405 xtw.WriteStartDocument(); 411 xtw.WriteStartDocument();
406 xtw.WriteStartElement("archive"); 412 xtw.WriteStartElement("archive");
407 xtw.WriteAttributeString("major_version", "0"); 413 xtw.WriteAttributeString("major_version", majorVersion.ToString());
408 xtw.WriteAttributeString("minor_version", "1"); 414 xtw.WriteAttributeString("minor_version", minorVersion.ToString());
409 xtw.WriteEndElement(); 415 xtw.WriteEndElement();
410 416
411 xtw.Flush(); 417 xtw.Flush();
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 54cc80f..38fff1c 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -327,21 +327,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
327 327
328 // OK, it got this agent. Let's close some child agents 328 // OK, it got this agent. Let's close some child agents
329 sp.CloseChildAgents(newRegionX, newRegionY); 329 sp.CloseChildAgents(newRegionX, newRegionY);
330 IClientIPEndpoint ipepClient; 330
331 if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) 331 if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY))
332 { 332 {
333 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); 333 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
334
334 #region IP Translation for NAT 335 #region IP Translation for NAT
335 // Uses ipepClient above 336 IClientIPEndpoint ipepClient;
336 if (sp.ClientView.TryGet(out ipepClient)) 337 if (sp.ClientView.TryGet(out ipepClient))
337 { 338 {
338 endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); 339 capsPath
340 = "http://"
341 + NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName)
342 + ":"
343 + finalDestination.HttpPort
344 + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
345 }
346 else
347 {
348 capsPath
349 = "http://"
350 + finalDestination.ExternalHostName
351 + ":"
352 + finalDestination.HttpPort
353 + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
339 } 354 }
340 #endregion 355 #endregion
341 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
342 356
343 if (eq != null) 357 if (eq != null)
344 { 358 {
359 #region IP Translation for NAT
360 // Uses ipepClient above
361 if (sp.ClientView.TryGet(out ipepClient))
362 {
363 endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
364 }
365 #endregion
366
345 eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); 367 eq.EnableSimulator(destinationHandle, endPoint, sp.UUID);
346 368
347 // ES makes the client send a UseCircuitCode message to the destination, 369 // ES makes the client send a UseCircuitCode message to the destination,
@@ -360,7 +382,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
360 else 382 else
361 { 383 {
362 agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); 384 agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle);
363 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); 385 capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort
386 + "/CAPS/" + agentCircuit.CapsPath + "0000/";
364 } 387 }
365 388
366 // Expect avatar crossing is a heavy-duty function at the destination. 389 // Expect avatar crossing is a heavy-duty function at the destination.
@@ -493,8 +516,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
493 516
494 protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) 517 protected virtual void SetCallbackURL(AgentData agent, RegionInfo region)
495 { 518 {
496 agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; 519 agent.CallbackURI = "http://" + region.ExternalHostName + ":" + region.HttpPort +
497 m_log.Debug("Set callback URL to " + agent.CallbackURI); 520 "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/";
498 521
499 } 522 }
500 523
@@ -819,8 +842,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
819 cAgent.Position = pos; 842 cAgent.Position = pos;
820 if (isFlying) 843 if (isFlying)
821 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 844 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
822 cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + 845 cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort +
823 "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; 846 "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
824 847
825 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) 848 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
826 { 849 {
@@ -845,7 +868,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
845 neighbourRegion.RegionHandle); 868 neighbourRegion.RegionHandle);
846 return agent; 869 return agent;
847 } 870 }
848 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); 871 // TODO Should construct this behind a method
872 string capsPath =
873 "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort
874 + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/";
849 875
850 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); 876 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
851 877
@@ -1164,7 +1190,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1164 y = y / Constants.RegionSize; 1190 y = y / Constants.RegionSize;
1165 m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); 1191 m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")");
1166 1192
1167 string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); 1193 string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
1194 + "/CAPS/" + a.CapsPath + "0000/";
1168 1195
1169 string reason = String.Empty; 1196 string reason = String.Empty;
1170 1197
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index 2dd7767..fd0e879 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -595,12 +595,12 @@ namespace OpenSim.Region.CoreModules.InterGrid
595 // DEPRECATED 595 // DEPRECATED
596 responseMap["seed_capability"] 596 responseMap["seed_capability"]
597 = OSD.FromString( 597 = OSD.FromString(
598 regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); 598 regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath));
599 599
600 // REPLACEMENT 600 // REPLACEMENT
601 responseMap["region_seed_capability"] 601 responseMap["region_seed_capability"]
602 = OSD.FromString( 602 = OSD.FromString(
603 regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); 603 regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath));
604 604
605 responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); 605 responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath);
606 responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); 606 responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index f1f5258..117b2fd 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 54
55 /// <summary> 55 /// <summary>
56 /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version 56 /// The maximum major version of OAR that we can read. Minor versions shouldn't need a max number since version
57 /// bumps here should be compatible. 57 /// bumps here should be compatible.
58 /// </summary> 58 /// </summary>
59 public static int MAX_MAJOR_VERSION = 0; 59 public static int MAX_MAJOR_VERSION = 0;
@@ -481,17 +481,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
481 /// </summary> 481 /// </summary>
482 /// <param name="path"></param> 482 /// <param name="path"></param>
483 /// <param name="data"></param> 483 /// <param name="data"></param>
484 private void LoadControlFile(string path, byte[] data) 484 protected void LoadControlFile(string path, byte[] data)
485 { 485 {
486 //Create the XmlNamespaceManager. 486 XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
487 NameTable nt = new NameTable();
488 XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
489
490 // Create the XmlParserContext.
491 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); 487 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
492 488 XmlTextReader xtr = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context);
493 XmlTextReader xtr
494 = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context);
495 489
496 RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; 490 RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
497 491
@@ -530,10 +524,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
530 currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString(); 524 currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString();
531 } 525 }
532 } 526 }
533
534 } 527 }
535 528
536 currentRegionSettings.Save(); 529 currentRegionSettings.Save();
537 } 530 }
538 } 531 }
539} 532} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 43789af..3182079 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -171,7 +171,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
171 171
172 m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); 172 m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time.");
173 173
174 // Write out control file 174 // Write out control file. This has to be done first so that subsequent loaders will see this file first
175 // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this
175 archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile(options)); 176 archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile(options));
176 m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); 177 m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
177 178
@@ -198,13 +199,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
198 { 199 {
199 majorVersion = 1; 200 majorVersion = 1;
200 minorVersion = 0; 201 minorVersion = 0;
201 } 202 }
202 */ 203 */
203 204
204 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); 205 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
205// if (majorVersion == 1) 206// if (majorVersion == 1)
206// { 207// {
207// m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); 208// m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR");
208// } 209// }
209 210
210 211
@@ -231,6 +232,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
231 sw.Close(); 232 sw.Close();
232 233
233 return s; 234 return s;
234 } 235 }
235 } 236 }
236} 237}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index a1451ce..d4a09b4 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -188,7 +188,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
188 m_log.ErrorFormat( 188 m_log.ErrorFormat(
189 "[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT); 189 "[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT);
190 190
191 m_log.Error("[ARCHIVER]: OAR save aborted."); 191 m_log.Error("[ARCHIVER]: OAR save aborted. PLEASE DO NOT USE THIS OAR, IT WILL BE INCOMPLETE.");
192 } 192 }
193 catch (Exception e) 193 catch (Exception e)
194 { 194 {
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index a6dc2ec..cea7c78 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules
44 /// it is not based on ~06:00 == Sun Rise. Rather it is based on 00:00 being sun-rise. 44 /// it is not based on ~06:00 == Sun Rise. Rather it is based on 00:00 being sun-rise.
45 /// </summary> 45 /// </summary>
46 46
47
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 48
50
51 // 49 //
52 // Global Constants used to determine where in the sky the sun is 50 // Global Constants used to determine where in the sky the sun is
53 // 51 //
@@ -108,26 +106,25 @@ namespace OpenSim.Region.CoreModules
108 private Scene m_scene = null; 106 private Scene m_scene = null;
109 107
110 // Calculated Once in the lifetime of a region 108 // Calculated Once in the lifetime of a region
111 private long TicksToEpoch; // Elapsed time for 1/1/1970 109 private long TicksToEpoch; // Elapsed time for 1/1/1970
112 private uint SecondsPerSunCycle; // Length of a virtual day in RW seconds 110 private uint SecondsPerSunCycle; // Length of a virtual day in RW seconds
113 private uint SecondsPerYear; // Length of a virtual year in RW seconds 111 private uint SecondsPerYear; // Length of a virtual year in RW seconds
114 private double SunSpeed; // Rate of passage in radians/second 112 private double SunSpeed; // Rate of passage in radians/second
115 private double SeasonSpeed; // Rate of change for seasonal effects 113 private double SeasonSpeed; // Rate of change for seasonal effects
116 // private double HoursToRadians; // Rate of change for seasonal effects 114 // private double HoursToRadians; // Rate of change for seasonal effects
117 private long TicksUTCOffset = 0; // seconds offset from UTC 115 private long TicksUTCOffset = 0; // seconds offset from UTC
118 // Calculated every update 116 // Calculated every update
119 private float OrbitalPosition; // Orbital placement at a point in time 117 private float OrbitalPosition; // Orbital placement at a point in time
120 private double HorizonShift; // Axis offset to skew day and night 118 private double HorizonShift; // Axis offset to skew day and night
121 private double TotalDistanceTravelled; // Distance since beginning of time (in radians) 119 private double TotalDistanceTravelled; // Distance since beginning of time (in radians)
122 private double SeasonalOffset; // Seaonal variation of tilt 120 private double SeasonalOffset; // Seaonal variation of tilt
123 private float Magnitude; // Normal tilt 121 private float Magnitude; // Normal tilt
124 // private double VWTimeRatio; // VW time as a ratio of real time 122 // private double VWTimeRatio; // VW time as a ratio of real time
125 123
126 // Working values 124 // Working values
127 private Vector3 Position = Vector3.Zero; 125 private Vector3 Position = Vector3.Zero;
128 private Vector3 Velocity = Vector3.Zero; 126 private Vector3 Velocity = Vector3.Zero;
129 private Quaternion Tilt = new Quaternion(1.0f, 0.0f, 0.0f, 0.0f); 127 private Quaternion Tilt = new Quaternion(1.0f, 0.0f, 0.0f, 0.0f);
130
131 128
132 // Used to fix the sun in the sky so it doesn't move based on current time 129 // Used to fix the sun in the sky so it doesn't move based on current time
133 private bool m_SunFixed = false; 130 private bool m_SunFixed = false;
@@ -135,8 +132,6 @@ namespace OpenSim.Region.CoreModules
135 132
136 private const int TICKS_PER_SECOND = 10000000; 133 private const int TICKS_PER_SECOND = 10000000;
137 134
138
139
140 // Current time in elapsed seconds since Jan 1st 1970 135 // Current time in elapsed seconds since Jan 1st 1970
141 private ulong CurrentTime 136 private ulong CurrentTime
142 { 137 {
@@ -149,8 +144,6 @@ namespace OpenSim.Region.CoreModules
149 // Time in seconds since UTC to use to calculate sun position. 144 // Time in seconds since UTC to use to calculate sun position.
150 ulong PosTime = 0; 145 ulong PosTime = 0;
151 146
152
153
154 /// <summary> 147 /// <summary>
155 /// Calculate the sun's orbital position and its velocity. 148 /// Calculate the sun's orbital position and its velocity.
156 /// </summary> 149 /// </summary>
@@ -202,7 +195,6 @@ namespace OpenSim.Region.CoreModules
202 PosTime += (ulong)(((CurDayPercentage - 0.5) / .5) * NightSeconds); 195 PosTime += (ulong)(((CurDayPercentage - 0.5) / .5) * NightSeconds);
203 } 196 }
204 } 197 }
205
206 } 198 }
207 199
208 TotalDistanceTravelled = SunSpeed * PosTime; // distance measured in radians 200 TotalDistanceTravelled = SunSpeed * PosTime; // distance measured in radians
@@ -251,7 +243,6 @@ namespace OpenSim.Region.CoreModules
251 Velocity.X = 0; 243 Velocity.X = 0;
252 Velocity.Y = 0; 244 Velocity.Y = 0;
253 Velocity.Z = 0; 245 Velocity.Z = 0;
254
255 } 246 }
256 else 247 else
257 { 248 {
@@ -271,9 +262,7 @@ namespace OpenSim.Region.CoreModules
271 private float GetCurrentTimeAsLindenSunHour() 262 private float GetCurrentTimeAsLindenSunHour()
272 { 263 {
273 if (m_SunFixed) 264 if (m_SunFixed)
274 {
275 return m_SunFixedHour + 6; 265 return m_SunFixedHour + 6;
276 }
277 266
278 return GetCurrentSunHour() + 6.0f; 267 return GetCurrentSunHour() + 6.0f;
279 } 268 }
@@ -297,8 +286,6 @@ namespace OpenSim.Region.CoreModules
297 m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); 286 m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand);
298 } 287 }
299 288
300
301
302 TimeZone local = TimeZone.CurrentTimeZone; 289 TimeZone local = TimeZone.CurrentTimeZone;
303 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; 290 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
304 m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); 291 m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset);
@@ -325,13 +312,11 @@ namespace OpenSim.Region.CoreModules
325 // must hard code to ~.5 to match sun position in LL based viewers 312 // must hard code to ~.5 to match sun position in LL based viewers
326 m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night); 313 m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night);
327 314
328
329 // Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours 315 // Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours
330 m_DayTimeSunHourScale = config.Configs["Sun"].GetDouble("day_time_sun_hour_scale", d_DayTimeSunHourScale); 316 m_DayTimeSunHourScale = config.Configs["Sun"].GetDouble("day_time_sun_hour_scale", d_DayTimeSunHourScale);
331 317
332 // Update frequency in frames 318 // Update frequency in frames
333 m_UpdateInterval = config.Configs["Sun"].GetInt("update_interval", d_frame_mod); 319 m_UpdateInterval = config.Configs["Sun"].GetInt("update_interval", d_frame_mod);
334
335 } 320 }
336 catch (Exception e) 321 catch (Exception e)
337 { 322 {
@@ -391,10 +376,8 @@ namespace OpenSim.Region.CoreModules
391 } 376 }
392 377
393 scene.RegisterModuleInterface<ISunModule>(this); 378 scene.RegisterModuleInterface<ISunModule>(this);
394
395 } 379 }
396 380
397
398 public void PostInitialise() 381 public void PostInitialise()
399 { 382 {
400 } 383 }
@@ -402,7 +385,7 @@ namespace OpenSim.Region.CoreModules
402 public void Close() 385 public void Close()
403 { 386 {
404 ready = false; 387 ready = false;
405 388
406 // Remove our hooks 389 // Remove our hooks
407 m_scene.EventManager.OnFrame -= SunUpdate; 390 m_scene.EventManager.OnFrame -= SunUpdate;
408 m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; 391 m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
@@ -419,6 +402,7 @@ namespace OpenSim.Region.CoreModules
419 { 402 {
420 get { return false; } 403 get { return false; }
421 } 404 }
405
422 #endregion 406 #endregion
423 407
424 #region EventManager Events 408 #region EventManager Events
@@ -446,9 +430,7 @@ namespace OpenSim.Region.CoreModules
446 public void SunUpdate() 430 public void SunUpdate()
447 { 431 {
448 if (((m_frame++ % m_UpdateInterval) != 0) || !ready || m_SunFixed || !receivedEstateToolsSunUpdate) 432 if (((m_frame++ % m_UpdateInterval) != 0) || !ready || m_SunFixed || !receivedEstateToolsSunUpdate)
449 {
450 return; 433 return;
451 }
452 434
453 GenSunPos(); // Generate shared values once 435 GenSunPos(); // Generate shared values once
454 436
@@ -467,7 +449,7 @@ namespace OpenSim.Region.CoreModules
467 } 449 }
468 450
469 /// <summary> 451 /// <summary>
470 /// 452 ///
471 /// </summary> 453 /// </summary>
472 /// <param name="regionHandle"></param> 454 /// <param name="regionHandle"></param>
473 /// <param name="FixedTime">Is the sun's position fixed?</param> 455 /// <param name="FixedTime">Is the sun's position fixed?</param>
@@ -484,7 +466,6 @@ namespace OpenSim.Region.CoreModules
484 while (FixedSunHour < 0) 466 while (FixedSunHour < 0)
485 FixedSunHour += 24; 467 FixedSunHour += 24;
486 468
487
488 m_SunFixedHour = FixedSunHour; 469 m_SunFixedHour = FixedSunHour;
489 m_SunFixed = FixedSun; 470 m_SunFixed = FixedSun;
490 471
@@ -499,14 +480,12 @@ namespace OpenSim.Region.CoreModules
499 // When sun settings are updated, we should update all clients with new settings. 480 // When sun settings are updated, we should update all clients with new settings.
500 SunUpdateToAllClients(); 481 SunUpdateToAllClients();
501 482
502
503 m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); 483 m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString());
504 } 484 }
505 } 485 }
506 486
507 #endregion 487 #endregion
508 488
509
510 private void SunUpdateToAllClients() 489 private void SunUpdateToAllClients()
511 { 490 {
512 m_scene.ForEachScenePresence(delegate(ScenePresence sp) 491 m_scene.ForEachScenePresence(delegate(ScenePresence sp)
@@ -553,7 +532,6 @@ namespace OpenSim.Region.CoreModules
553 { 532 {
554 float ticksleftover = CurrentTime % SecondsPerSunCycle; 533 float ticksleftover = CurrentTime % SecondsPerSunCycle;
555 534
556
557 return (24.0f * (ticksleftover / SecondsPerSunCycle)); 535 return (24.0f * (ticksleftover / SecondsPerSunCycle));
558 } 536 }
559 537
@@ -666,7 +644,6 @@ namespace OpenSim.Region.CoreModules
666 644
667 // When sun settings are updated, we should update all clients with new settings. 645 // When sun settings are updated, we should update all clients with new settings.
668 SunUpdateToAllClients(); 646 SunUpdateToAllClients();
669
670 } 647 }
671 648
672 return Output; 649 return Output;
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index fdbbccf..a182eea 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
147 147
148 string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString(); 148 string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString();
149 regionimage = regionimage.Replace("-", ""); 149 regionimage = regionimage.Replace("-", "");
150 m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "/index.php?method=" + regionimage); 150 m_log.Info("[WORLD MAP]: JPEG Map location: http://" + m_scene.RegionInfo.ExternalEndPoint.Address.ToString() + ":" + m_scene.RegionInfo.HttpPort.ToString() + "/index.php?method=" + regionimage);
151 151
152 MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage); 152 MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage);
153 MainServer.Instance.AddLLSDHandler( 153 MainServer.Instance.AddLLSDHandler(
@@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
579 579
580 if (mreg != null) 580 if (mreg != null)
581 { 581 {
582 httpserver = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString(); 582 httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString();
583 lock (m_cachedRegionMapItemsAddress) 583 lock (m_cachedRegionMapItemsAddress)
584 { 584 {
585 if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) 585 if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))