aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Capabilities/CapsUtil.cs2
-rw-r--r--OpenSim/Framework/RegionInfo.cs39
-rw-r--r--OpenSim/Framework/Serialization/ArchiveConstants.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs4
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs43
-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.cs18
-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.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs35
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs8
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs2
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs35
-rw-r--r--OpenSim/Services/Connectors/Land/LandServiceConnector.cs3
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs4
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs55
-rw-r--r--OpenSim/Services/GridService/GridService.cs2
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs17
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs2
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs9
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs17
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs29
-rw-r--r--prebuild.xml1
31 files changed, 299 insertions, 156 deletions
diff --git a/OpenSim/Framework/Capabilities/CapsUtil.cs b/OpenSim/Framework/Capabilities/CapsUtil.cs
index faf2708..0334e4b 100644
--- a/OpenSim/Framework/Capabilities/CapsUtil.cs
+++ b/OpenSim/Framework/Capabilities/CapsUtil.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Framework.Capabilities
41 /// <returns></returns> 41 /// <returns></returns>
42 public static string GetCapsSeedPath(string capsObjectPath) 42 public static string GetCapsSeedPath(string capsObjectPath)
43 { 43 {
44 return "CAPS/" + capsObjectPath + "0000/"; 44 return "/CAPS/" + capsObjectPath + "0000/";
45 } 45 }
46 46
47 /// <summary> 47 /// <summary>
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index d57d4e9..a006f3e 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -116,20 +116,8 @@ namespace OpenSim.Framework
116 /// </summary> 116 /// </summary>
117 public string ServerURI 117 public string ServerURI
118 { 118 {
119 get { 119 get { return m_serverURI; }
120 if ( m_serverURI != string.Empty ) { 120 set { m_serverURI = value; }
121 return m_serverURI;
122 } else {
123 return "http://" + m_externalHostName + ":" + m_httpPort + "/";
124 }
125 }
126 set {
127 if ( value.EndsWith("/") ) {
128 m_serverURI = value;
129 } else {
130 m_serverURI = value + '/';
131 }
132 }
133 } 121 }
134 protected string m_serverURI; 122 protected string m_serverURI;
135 123
@@ -154,7 +142,6 @@ namespace OpenSim.Framework
154 142
155 public SimpleRegionInfo() 143 public SimpleRegionInfo()
156 { 144 {
157 m_serverURI = string.Empty;
158 } 145 }
159 146
160 public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 147 public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
@@ -164,7 +151,6 @@ namespace OpenSim.Framework
164 151
165 m_internalEndPoint = internalEndPoint; 152 m_internalEndPoint = internalEndPoint;
166 m_externalHostName = externalUri; 153 m_externalHostName = externalUri;
167 m_serverURI = string.Empty;
168 } 154 }
169 155
170 public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) 156 public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port)
@@ -175,7 +161,6 @@ namespace OpenSim.Framework
175 m_externalHostName = externalUri; 161 m_externalHostName = externalUri;
176 162
177 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); 163 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
178 m_serverURI = string.Empty;
179 } 164 }
180 165
181 public SimpleRegionInfo(RegionInfo ConvertFrom) 166 public SimpleRegionInfo(RegionInfo ConvertFrom)
@@ -465,7 +450,6 @@ namespace OpenSim.Framework
465 configMember = 450 configMember =
466 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); 451 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
467 configMember.performConfigurationRetrieve(); 452 configMember.performConfigurationRetrieve();
468 m_serverURI = string.Empty;
469 } 453 }
470 454
471 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 455 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
@@ -475,12 +459,10 @@ namespace OpenSim.Framework
475 459
476 m_internalEndPoint = internalEndPoint; 460 m_internalEndPoint = internalEndPoint;
477 m_externalHostName = externalUri; 461 m_externalHostName = externalUri;
478 m_serverURI = string.Empty;
479 } 462 }
480 463
481 public RegionInfo() 464 public RegionInfo()
482 { 465 {
483 m_serverURI = string.Empty;
484 } 466 }
485 467
486 public EstateSettings EstateSettings 468 public EstateSettings EstateSettings
@@ -570,23 +552,10 @@ namespace OpenSim.Framework
570 /// <summary> 552 /// <summary>
571 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) 553 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
572 /// </summary> 554 /// </summary>
573
574 public string ServerURI 555 public string ServerURI
575 { 556 {
576 get { 557 get { return m_serverURI; }
577 if ( m_serverURI != string.Empty ) { 558 set { m_serverURI = value; }
578 return m_serverURI;
579 } else {
580 return "http://" + m_externalHostName + ":" + m_httpPort + "/";
581 }
582 }
583 set {
584 if ( value.EndsWith("/") ) {
585 m_serverURI = value;
586 } else {
587 m_serverURI = value + '/';
588 }
589 }
590 } 559 }
591 560
592 public string RegionName 561 public string RegionName
diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs
index 7a9b33d..2c5e001 100644
--- a/OpenSim/Framework/Serialization/ArchiveConstants.cs
+++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs
@@ -112,6 +112,7 @@ namespace OpenSim.Framework.Serialization
112 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"; // Not sure if we'll ever see this 112 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"; // Not sure if we'll ever see this
113 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ASSET_EXTENSION_SEPARATOR + "bytecode.lso"; 113 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ASSET_EXTENSION_SEPARATOR + "bytecode.lso";
114 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ASSET_EXTENSION_SEPARATOR + "script.lsl"; 114 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ASSET_EXTENSION_SEPARATOR + "script.lsl";
115 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Mesh] = ASSET_EXTENSION_SEPARATOR + "mesh.llmesh";
115 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ASSET_EXTENSION_SEPARATOR + "notecard.txt"; 116 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ASSET_EXTENSION_SEPARATOR + "notecard.txt";
116 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ASSET_EXTENSION_SEPARATOR + "object.xml"; 117 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ASSET_EXTENSION_SEPARATOR + "object.xml";
117 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"; // Not sure if we'll ever see this 118 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"; // Not sure if we'll ever see this
@@ -135,6 +136,7 @@ namespace OpenSim.Framework.Serialization
135 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder; 136 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder;
136 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bytecode.lso"] = (sbyte)AssetType.LSLBytecode; 137 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bytecode.lso"] = (sbyte)AssetType.LSLBytecode;
137 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "script.lsl"] = (sbyte)AssetType.LSLText; 138 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "script.lsl"] = (sbyte)AssetType.LSLText;
139 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "mesh.llmesh"] = (sbyte)AssetType.Mesh;
138 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "notecard.txt"] = (sbyte)AssetType.Notecard; 140 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "notecard.txt"] = (sbyte)AssetType.Notecard;
139 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "object.xml"] = (sbyte)AssetType.Object; 141 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "object.xml"] = (sbyte)AssetType.Object;
140 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"] = (sbyte)AssetType.RootFolder; 142 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"] = (sbyte)AssetType.RootFolder;
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 0c1e5e0..ba8c194 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer
348 { 348 {
349 try 349 try
350 { 350 {
351 //m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); 351// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
352 352
353 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); 353 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
354 354
@@ -376,7 +376,7 @@ namespace OpenSim.Framework.Servers.HttpServer
376 string path = request.RawUrl; 376 string path = request.RawUrl;
377 string handlerKey = GetHandlerKey(request.HttpMethod, path); 377 string handlerKey = GetHandlerKey(request.HttpMethod, path);
378 378
379 //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); 379// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
380 380
381 if (TryGetStreamHandler(handlerKey, out requestHandler)) 381 if (TryGetStreamHandler(handlerKey, out requestHandler))
382 { 382 {
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 7e0a886..c5ee385 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -336,8 +336,8 @@ namespace OpenSim
336 //regionInfo.originRegionID = regionInfo.RegionID; 336 //regionInfo.originRegionID = regionInfo.RegionID;
337 337
338 // set initial ServerURI 338 // set initial ServerURI
339 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port;
339 regionInfo.HttpPort = m_httpServerPort; 340 regionInfo.HttpPort = m_httpServerPort;
340 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/";
341 341
342 regionInfo.osSecret = m_osSecret; 342 regionInfo.osSecret = m_osSecret;
343 343
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index 2a590f1..8ab4391 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
169 // sanity check: 169 // sanity check:
170 if (c.Sender == null) 170 if (c.Sender == null)
171 { 171 {
172 m_log.ErrorFormat("[CHAT] OnChatFromClient from {0} has empty Sender field!", sender); 172 m_log.ErrorFormat("[CHAT]: OnChatFromClient from {0} has empty Sender field!", sender);
173 return; 173 return;
174 } 174 }
175 175
@@ -234,8 +234,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
234 if (message.Length >= 1000) // libomv limit 234 if (message.Length >= 1000) // libomv limit
235 message = message.Substring(0, 1000); 235 message = message.Substring(0, 1000);
236 236
237 // m_log.DebugFormat("[CHAT]: DCTA: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, c.Type, sourceType); 237// m_log.DebugFormat(
238// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}",
239// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType);
238 240
241 HashSet<UUID> receiverIDs = new HashSet<UUID>();
242
239 foreach (Scene s in m_scenes) 243 foreach (Scene s in m_scenes)
240 { 244 {
241 s.ForEachScenePresence( 245 s.ForEachScenePresence(
@@ -250,13 +254,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
250 // objects on a parcel with access restrictions 254 // objects on a parcel with access restrictions
251 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) 255 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true)
252 { 256 {
253 TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType); 257 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType))
258 receiverIDs.Add(presence.UUID);
254 } 259 }
255 } 260 }
256 261
257 } 262 }
258 ); 263 );
259 } 264 }
265
266 (scene as Scene).EventManager.TriggerOnChatToClients(
267 fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully);
260 } 268 }
261 269
262 static private Vector3 CenterOfRegion = new Vector3(128, 128, 30); 270 static private Vector3 CenterOfRegion = new Vector3(128, 128, 30);
@@ -294,6 +302,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
294 } 302 }
295 303
296 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); 304 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
305 HashSet<UUID> receiverIDs = new HashSet<UUID>();
306
297 if (c.Scene != null) 307 if (c.Scene != null)
298 { 308 {
299 ((Scene)c.Scene).ForEachScenePresence 309 ((Scene)c.Scene).ForEachScenePresence
@@ -314,18 +324,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
314 324
315 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, 325 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
316 (byte)sourceType, (byte)ChatAudibleLevel.Fully); 326 (byte)sourceType, (byte)ChatAudibleLevel.Fully);
327 receiverIDs.Add(presence.UUID);
317 } 328 }
318 ); 329 );
330 (c.Scene as Scene).EventManager.TriggerOnChatToClients(
331 fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully);
319 } 332 }
320 } 333 }
321 334
322 335 /// <summary>
323 protected virtual void TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, 336 /// Try to send a message to the given presence
337 /// </summary>
338 /// <param name="presence">The receiver</param>
339 /// <param name="fromPos"></param>
340 /// <param name="regionPos">/param>
341 /// <param name="fromAgentID"></param>
342 /// <param name="fromName"></param>
343 /// <param name="type"></param>
344 /// <param name="message"></param>
345 /// <param name="src"></param>
346 /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a
347 /// precondition</returns>
348 protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
324 UUID fromAgentID, string fromName, ChatTypeEnum type, 349 UUID fromAgentID, string fromName, ChatTypeEnum type,
325 string message, ChatSourceType src) 350 string message, ChatSourceType src)
326 { 351 {
327 // don't send stuff to child agents 352 // don't send stuff to child agents
328 if (presence.IsChildAgent) return; 353 if (presence.IsChildAgent) return false;
329 354
330 Vector3 fromRegionPos = fromPos + regionPos; 355 Vector3 fromRegionPos = fromPos + regionPos;
331 Vector3 toRegionPos = presence.AbsolutePosition + 356 Vector3 toRegionPos = presence.AbsolutePosition +
@@ -338,12 +363,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
338 type == ChatTypeEnum.Say && dis > m_saydistance || 363 type == ChatTypeEnum.Say && dis > m_saydistance ||
339 type == ChatTypeEnum.Shout && dis > m_shoutdistance) 364 type == ChatTypeEnum.Shout && dis > m_shoutdistance)
340 { 365 {
341 return; 366 return false;
342 } 367 }
343 368
344 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView 369 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView
345 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, 370 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
346 fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); 371 fromAgentID, (byte)src, (byte)ChatAudibleLevel.Fully);
372
373 return true;
347 } 374 }
348 375
349 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); 376 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 80adc46..d8e0f96 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -598,7 +598,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
598 try 598 try
599 { 599 {
600 600
601 XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, 3000); 601 XmlRpcResponse GridResp = GridReq.Send("http://" + reginfo.ExternalHostName + ":" + reginfo.HttpPort, 3000);
602 602
603 Hashtable responseData = (Hashtable)GridResp.Value; 603 Hashtable responseData = (Hashtable)GridResp.Value;
604 604
@@ -620,8 +620,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
620 } 620 }
621 catch (WebException e) 621 catch (WebException e)
622 { 622 {
623 m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0}} the host didn't respond ({2})", 623 m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to http://{0}:{1} the host didn't respond ({2})",
624 reginfo.ServerURI, e.Message); 624 reginfo.ExternalHostName, reginfo.HttpPort, e.Message);
625 } 625 }
626 626
627 return false; 627 return false;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index c1df827..5500557 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..249a8b4 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)
@@ -216,7 +213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
216 public void Execute() 213 public void Execute()
217 { 214 {
218 try 215 try
219 { 216 {
220 InventoryFolderBase inventoryFolder = null; 217 InventoryFolderBase inventoryFolder = null;
221 InventoryItemBase inventoryItem = null; 218 InventoryItemBase inventoryItem = null;
222 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); 219 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
@@ -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 9a0e735..2921b0d 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.
@@ -495,8 +518,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
495 518
496 protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) 519 protected virtual void SetCallbackURL(AgentData agent, RegionInfo region)
497 { 520 {
498 agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; 521 agent.CallbackURI = "http://" + region.ExternalHostName + ":" + region.HttpPort +
499 m_log.Debug("Set callback URL to " + agent.CallbackURI); 522 "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/";
500 523
501 } 524 }
502 525
@@ -839,8 +862,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
839 cAgent.Position = pos; 862 cAgent.Position = pos;
840 if (isFlying) 863 if (isFlying)
841 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 864 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
842 cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + 865 cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort +
843 "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; 866 "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
844 867
845 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) 868 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
846 { 869 {
@@ -865,7 +888,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
865 neighbourRegion.RegionHandle); 888 neighbourRegion.RegionHandle);
866 return agent; 889 return agent;
867 } 890 }
868 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); 891 // TODO Should construct this behind a method
892 string capsPath =
893 "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort
894 + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/";
869 895
870 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); 896 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
871 897
@@ -1193,7 +1219,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1193 y = y / Constants.RegionSize; 1219 y = y / Constants.RegionSize;
1194 m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); 1220 m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")");
1195 1221
1196 string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); 1222 string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
1223 + "/CAPS/" + a.CapsPath + "0000/";
1197 1224
1198 string reason = String.Empty; 1225 string reason = String.Empty;
1199 1226
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 7d77a77..1f85278 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;
@@ -499,17 +499,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
499 /// </summary> 499 /// </summary>
500 /// <param name="path"></param> 500 /// <param name="path"></param>
501 /// <param name="data"></param> 501 /// <param name="data"></param>
502 private void LoadControlFile(string path, byte[] data) 502 protected void LoadControlFile(string path, byte[] data)
503 { 503 {
504 //Create the XmlNamespaceManager. 504 XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
505 NameTable nt = new NameTable();
506 XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
507
508 // Create the XmlParserContext.
509 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); 505 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
510 506 XmlTextReader xtr = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context);
511 XmlTextReader xtr
512 = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context);
513 507
514 RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; 508 RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
515 509
@@ -548,10 +542,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
548 currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString(); 542 currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString();
549 } 543 }
550 } 544 }
551
552 } 545 }
553 546
554 currentRegionSettings.Save(); 547 currentRegionSettings.Save();
555 } 548 }
556 } 549 }
557} 550} \ 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..1687d06 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
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/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))
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index e923932..33069da 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -297,6 +297,17 @@ namespace OpenSim.Region.Framework.Scenes
297 public event ChatFromClientEvent OnChatFromClient; 297 public event ChatFromClientEvent OnChatFromClient;
298 298
299 /// <summary> 299 /// <summary>
300 /// ChatToClientsEvent is triggered via ChatModule (or
301 /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a
302 /// received chat message if they satisfy various conditions (within audible range, etc.)
303 /// </summary>
304 public delegate void ChatToClientsEvent(
305 UUID senderID, HashSet<UUID> receiverIDs,
306 string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
307 ChatSourceType src, ChatAudibleLevel level);
308 public event ChatToClientsEvent OnChatToClients;
309
310 /// <summary>
300 /// ChatBroadcastEvent is called via Scene when a broadcast chat message 311 /// ChatBroadcastEvent is called via Scene when a broadcast chat message
301 /// from world comes in 312 /// from world comes in
302 /// </summary> 313 /// </summary>
@@ -1627,6 +1638,30 @@ namespace OpenSim.Region.Framework.Scenes
1627 } 1638 }
1628 } 1639 }
1629 } 1640 }
1641
1642 public void TriggerOnChatToClients(
1643 UUID senderID, HashSet<UUID> receiverIDs,
1644 string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
1645 ChatSourceType src, ChatAudibleLevel level)
1646 {
1647 ChatToClientsEvent handler = OnChatToClients;
1648 if (handler != null)
1649 {
1650 foreach (ChatToClientsEvent d in handler.GetInvocationList())
1651 {
1652 try
1653 {
1654 d(senderID, receiverIDs, message, type, fromPos, fromName, src, level);
1655 }
1656 catch (Exception e)
1657 {
1658 m_log.ErrorFormat(
1659 "[EVENT MANAGER]: Delegate for TriggerOnChatToClients failed - continuing. {0} {1}",
1660 e.Message, e.StackTrace);
1661 }
1662 }
1663 }
1664 }
1630 1665
1631 public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) 1666 public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
1632 { 1667 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 06e3c0e..618f425 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3329,8 +3329,6 @@ namespace OpenSim.Region.Framework.Scenes
3329 3329
3330 public void CopyTo(AgentData cAgent) 3330 public void CopyTo(AgentData cAgent)
3331 { 3331 {
3332 cAgent.CallbackURI = m_callbackURI;
3333
3334 cAgent.AgentID = UUID; 3332 cAgent.AgentID = UUID;
3335 cAgent.RegionID = Scene.RegionInfo.RegionID; 3333 cAgent.RegionID = Scene.RegionInfo.RegionID;
3336 3334
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f55bd12..3249ae2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9637,10 +9637,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9637 // do that one last, it will cause a ParcelPropertiesUpdate 9637 // do that one last, it will cause a ParcelPropertiesUpdate
9638 landObject.SetMediaUrl(url); 9638 landObject.SetMediaUrl(url);
9639 9639
9640 // now send to all (non-child) agents 9640 // now send to all (non-child) agents in the parcel
9641 World.ForEachScenePresence(delegate(ScenePresence sp) 9641 World.ForEachScenePresence(delegate(ScenePresence sp)
9642 { 9642 {
9643 if (!sp.IsChildAgent) 9643 if (!sp.IsChildAgent && (sp.currentParcelUUID == landData.GlobalID))
9644 { 9644 {
9645 sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, 9645 sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL,
9646 landData.MediaID, 9646 landData.MediaID,
@@ -9670,10 +9670,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9670 // the commandList contained a start/stop/... command, too 9670 // the commandList contained a start/stop/... command, too
9671 if (presence == null) 9671 if (presence == null)
9672 { 9672 {
9673 // send to all (non-child) agents 9673 // send to all (non-child) agents in the parcel
9674 World.ForEachScenePresence(delegate(ScenePresence sp) 9674 World.ForEachScenePresence(delegate(ScenePresence sp)
9675 { 9675 {
9676 if (!sp.IsChildAgent) 9676 if (!sp.IsChildAgent && (sp.currentParcelUUID == landData.GlobalID))
9677 { 9677 {
9678 sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? 9678 sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this?
9679 (ParcelMediaCommandEnum)commandToSend, 9679 (ParcelMediaCommandEnum)commandToSend,
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
index a1bcba6..f64a079 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -124,7 +124,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
124 UUID uuid = UUID.Zero; 124 UUID uuid = UUID.Zero;
125 string regionname = string.Empty; 125 string regionname = string.Empty;
126 string gatekeeper_host = string.Empty; 126 string gatekeeper_host = string.Empty;
127 string server_uri = string.Empty;
128 int gatekeeper_port = 0; 127 int gatekeeper_port = 0;
129 IPEndPoint client_ipaddress = null; 128 IPEndPoint client_ipaddress = null;
130 129
@@ -174,7 +173,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
174 destination.RegionLocX = x; 173 destination.RegionLocX = x;
175 destination.RegionLocY = y; 174 destination.RegionLocY = y;
176 destination.RegionName = regionname; 175 destination.RegionName = regionname;
177
178 176
179 AgentCircuitData aCircuit = new AgentCircuitData(); 177 AgentCircuitData aCircuit = new AgentCircuitData();
180 try 178 try
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 4231be1..479a80e 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -63,12 +63,12 @@ namespace OpenSim.Services.Connectors.Hypergrid
63 63
64 protected override string AgentPath() 64 protected override string AgentPath()
65 { 65 {
66 return "foreignagent/"; 66 return "/foreignagent/";
67 } 67 }
68 68
69 protected override string ObjectPath() 69 protected override string ObjectPath()
70 { 70 {
71 return "foreignobject/"; 71 return "/foreignobject/";
72 } 72 }
73 73
74 public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) 74 public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason)
@@ -86,11 +86,12 @@ namespace OpenSim.Services.Connectors.Hypergrid
86 paramList.Add(hash); 86 paramList.Add(hash);
87 87
88 XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); 88 XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
89 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI); 89 string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/");
90 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
90 XmlRpcResponse response = null; 91 XmlRpcResponse response = null;
91 try 92 try
92 { 93 {
93 response = request.Send(info.ServerURI, 10000); 94 response = request.Send(uri, 10000);
94 } 95 }
95 catch (Exception e) 96 catch (Exception e)
96 { 97 {
@@ -107,8 +108,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
107 } 108 }
108 109
109 hash = (Hashtable)response.Value; 110 hash = (Hashtable)response.Value;
110 foreach (Object o in hash) 111 //foreach (Object o in hash)
111 m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); 112 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
112 try 113 try
113 { 114 {
114 bool success = false; 115 bool success = false;
@@ -116,20 +117,16 @@ namespace OpenSim.Services.Connectors.Hypergrid
116 if (success) 117 if (success)
117 { 118 {
118 UUID.TryParse((string)hash["uuid"], out regionID); 119 UUID.TryParse((string)hash["uuid"], out regionID);
119 //m_log.Debug(">> HERE, uuid: " + regionID); 120 //m_log.Debug(">> HERE, uuid: " + uuid);
120 if ((string)hash["handle"] != null) 121 if ((string)hash["handle"] != null)
121 { 122 {
122 realHandle = Convert.ToUInt64((string)hash["handle"]); 123 realHandle = Convert.ToUInt64((string)hash["handle"]);
123 //m_log.Debug(">> HERE, realHandle: " + realHandle); 124 //m_log.Debug(">> HERE, realHandle: " + realHandle);
124 } 125 }
125 if (hash["region_image"] != null) { 126 if (hash["region_image"] != null)
126 imageURL = (string)hash["region_image"]; 127 imageURL = (string)hash["region_image"];
127 //m_log.Debug(">> HERE, imageURL: " + imageURL); 128 if (hash["external_name"] != null)
128 }
129 if (hash["external_name"] != null) {
130 externalName = (string)hash["external_name"]; 129 externalName = (string)hash["external_name"];
131 //m_log.Debug(">> HERE, externalName: " + externalName);
132 }
133 } 130 }
134 131
135 } 132 }
@@ -191,15 +188,16 @@ namespace OpenSim.Services.Connectors.Hypergrid
191 paramList.Add(hash); 188 paramList.Add(hash);
192 189
193 XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); 190 XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
194 //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); 191 string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/");
192 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri);
195 XmlRpcResponse response = null; 193 XmlRpcResponse response = null;
196 try 194 try
197 { 195 {
198 response = request.Send(gatekeeper.ServerURI, 10000); 196 response = request.Send(uri, 10000);
199 } 197 }
200 catch (Exception e) 198 catch (Exception e)
201 { 199 {
202 //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); 200 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message);
203 return null; 201 return null;
204 } 202 }
205 203
@@ -238,24 +236,21 @@ namespace OpenSim.Services.Connectors.Hypergrid
238 if (hash["region_name"] != null) 236 if (hash["region_name"] != null)
239 { 237 {
240 region.RegionName = (string)hash["region_name"]; 238 region.RegionName = (string)hash["region_name"];
241 //m_log.Debug(">> HERE, region_name: " + region.RegionName); 239 //m_log.Debug(">> HERE, name: " + region.RegionName);
242 } 240 }
243 if (hash["hostname"] != null) 241 if (hash["hostname"] != null)
244 region.ExternalHostName = (string)hash["hostname"]; 242 region.ExternalHostName = (string)hash["hostname"];
245 //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName);
246 if (hash["http_port"] != null) 243 if (hash["http_port"] != null)
247 { 244 {
248 uint p = 0; 245 uint p = 0;
249 UInt32.TryParse((string)hash["http_port"], out p); 246 UInt32.TryParse((string)hash["http_port"], out p);
250 region.HttpPort = p; 247 region.HttpPort = p;
251 //m_log.Debug(">> HERE, http_port: " + region.HttpPort);
252 } 248 }
253 if (hash["internal_port"] != null) 249 if (hash["internal_port"] != null)
254 { 250 {
255 int p = 0; 251 int p = 0;
256 Int32.TryParse((string)hash["internal_port"], out p); 252 Int32.TryParse((string)hash["internal_port"], out p);
257 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); 253 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
258 //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint);
259 } 254 }
260 255
261 // Successful return 256 // Successful return
diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
index 10499e2..539b2cc 100644
--- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
@@ -84,7 +84,8 @@ namespace OpenSim.Services.Connectors
84 if (info != null) // just to be sure 84 if (info != null) // just to be sure
85 { 85 {
86 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); 86 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
87 XmlRpcResponse response = request.Send(info.ServerURI, 10000); 87 string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
88 XmlRpcResponse response = request.Send(uri, 10000);
88 if (response.IsFault) 89 if (response.IsFault)
89 { 90 {
90 m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); 91 m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString);
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
index 9c57a40..0a982f8 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors
87 87
88 public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) 88 public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
89 { 89 {
90 string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/"; 90 string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/";
91 //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); 91 //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri);
92 92
93 WebRequest HelloNeighbourRequest = WebRequest.Create(uri); 93 WebRequest HelloNeighbourRequest = WebRequest.Create(uri);
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index f86eba3..4fc2a6d 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -147,6 +147,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
147 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); 147 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
148 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); 148 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
149 149
150 string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/";
151
150 OSDMap extraData = new OSDMap 152 OSDMap extraData = new OSDMap
151 { 153 {
152 { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, 154 { "ServerURI", OSD.FromString(regionInfo.ServerURI) },
@@ -168,7 +170,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
168 { "Name", regionInfo.RegionName }, 170 { "Name", regionInfo.RegionName },
169 { "MinPosition", minPosition.ToString() }, 171 { "MinPosition", minPosition.ToString() },
170 { "MaxPosition", maxPosition.ToString() }, 172 { "MaxPosition", maxPosition.ToString() },
171 { "Address", regionInfo.ServerURI }, 173 { "Address", httpAddress },
172 { "Enabled", "1" }, 174 { "Enabled", "1" },
173 { "ExtraData", OSDParser.SerializeJsonString(extraData) } 175 { "ExtraData", OSDParser.SerializeJsonString(extraData) }
174 }; 176 };
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index f855fde..385ba31 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Services.Connectors.Simulation
72 72
73 protected virtual string AgentPath() 73 protected virtual string AgentPath()
74 { 74 {
75 return "agent/"; 75 return "/agent/";
76 } 76 }
77 77
78 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) 78 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
@@ -104,7 +104,26 @@ namespace OpenSim.Services.Connectors.Simulation
104 return false; 104 return false;
105 } 105 }
106 106
107 string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; 107 string uri = string.Empty;
108
109 // HACK -- Simian grid make it work!!!
110 if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:"))
111 uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
112 else
113 {
114 try
115 {
116 uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/";
117 }
118 catch (Exception e)
119 {
120 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message);
121 reason = e.Message;
122 return false;
123 }
124 }
125
126 //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri);
108 127
109 AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); 128 AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri);
110 AgentCreateRequest.Method = "POST"; 129 AgentCreateRequest.Method = "POST";
@@ -258,7 +277,17 @@ namespace OpenSim.Services.Connectors.Simulation
258 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) 277 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData)
259 { 278 {
260 // Eventually, we want to use a caps url instead of the agentID 279 // Eventually, we want to use a caps url instead of the agentID
261 string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; 280 string uri = string.Empty;
281 try
282 {
283 uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/";
284 }
285 catch (Exception e)
286 {
287 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message);
288 return false;
289 }
290 //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri);
262 291
263 HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); 292 HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri);
264 ChildUpdateRequest.Method = "PUT"; 293 ChildUpdateRequest.Method = "PUT";
@@ -358,7 +387,8 @@ namespace OpenSim.Services.Connectors.Simulation
358 agent = null; 387 agent = null;
359 if (ext == null) return false; 388 if (ext == null) return false;
360 // Eventually, we want to use a caps url instead of the agentID 389 // Eventually, we want to use a caps url instead of the agentID
361 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 390 string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
391 //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri);
362 392
363 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); 393 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
364 request.Method = "GET"; 394 request.Method = "GET";
@@ -379,6 +409,7 @@ namespace OpenSim.Services.Connectors.Simulation
379 sr = new StreamReader(webResponse.GetResponseStream()); 409 sr = new StreamReader(webResponse.GetResponseStream());
380 reply = sr.ReadToEnd().Trim(); 410 reply = sr.ReadToEnd().Trim();
381 411
412 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply);
382 413
383 } 414 }
384 catch (WebException ex) 415 catch (WebException ex)
@@ -399,6 +430,7 @@ namespace OpenSim.Services.Connectors.Simulation
399 OSDMap args = Util.GetOSDMap(reply); 430 OSDMap args = Util.GetOSDMap(reply);
400 if (args == null) 431 if (args == null)
401 { 432 {
433 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply");
402 return false; 434 return false;
403 } 435 }
404 436
@@ -407,6 +439,7 @@ namespace OpenSim.Services.Connectors.Simulation
407 return true; 439 return true;
408 } 440 }
409 441
442 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode);
410 return false; 443 return false;
411 } 444 }
412 445
@@ -448,8 +481,18 @@ namespace OpenSim.Services.Connectors.Simulation
448 481
449 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) 482 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly)
450 { 483 {
451 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 484 string uri = string.Empty;
485 try
486 {
487 uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
488 }
489 catch (Exception e)
490 {
491 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message);
492 return false;
493 }
452 494
495 //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri);
453 496
454 WebRequest request = WebRequest.Create(uri); 497 WebRequest request = WebRequest.Create(uri);
455 request.Method = "DELETE"; 498 request.Method = "DELETE";
@@ -511,7 +554,7 @@ namespace OpenSim.Services.Connectors.Simulation
511 IPEndPoint ext = destination.ExternalEndPoint; 554 IPEndPoint ext = destination.ExternalEndPoint;
512 if (ext == null) return false; 555 if (ext == null) return false;
513 string uri 556 string uri
514 = destination.ServerURI + ObjectPath() + sog.UUID + "/"; 557 = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/";
515 //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); 558 //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri);
516 559
517 WebRequest ObjectCreateRequest = WebRequest.Create(uri); 560 WebRequest ObjectCreateRequest = WebRequest.Create(uri);
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 125c2be..e7988d6 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -479,7 +479,7 @@ namespace OpenSim.Services.GridService
479 OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); 479 OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
480 MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", 480 MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n",
481 r.RegionName, r.RegionID, 481 r.RegionName, r.RegionID,
482 String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], 482 String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(),
483 r.Data["owner_uuid"].ToString(), flags.ToString())); 483 r.Data["owner_uuid"].ToString(), flags.ToString()));
484 } 484 }
485 return; 485 return;
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 74e864b..b86fb6f 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -127,7 +127,7 @@ namespace OpenSim.Services.GridService
127 if (MainConsole.Instance != null) 127 if (MainConsole.Instance != null)
128 { 128 {
129 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", 129 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
130 "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RegionServerURI] [<RemoteRegionName>] <cr>", 130 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
131 "Link a hypergrid region", RunCommand); 131 "Link a hypergrid region", RunCommand);
132 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", 132 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
133 "unlink-region <local name> or <HostName>:<HttpPort> <cr>", 133 "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
@@ -198,7 +198,11 @@ namespace OpenSim.Services.GridService
198 198
199 return null; 199 return null;
200 } 200 }
201 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) 201
202
203 // From the command line and the 2 above
204 public bool TryCreateLink(UUID scopeID, int xloc, int yloc,
205 string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason)
202 { 206 {
203 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); 207 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc);
204 208
@@ -213,11 +217,8 @@ namespace OpenSim.Services.GridService
213 217
214 // Big HACK for Simian Grid !!! 218 // Big HACK for Simian Grid !!!
215 // We need to clean up all URLs used in OpenSim !!! 219 // We need to clean up all URLs used in OpenSim !!!
216 if (externalHostName.Contains("/")) { 220 if (externalHostName.Contains("/"))
217 regInfo.ServerURI = externalHostName; 221 regInfo.ServerURI = externalHostName;
218 } else {
219 regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString();
220 }
221 222
222 try 223 try
223 { 224 {
@@ -508,16 +509,12 @@ namespace OpenSim.Services.GridService
508 int xloc, yloc; 509 int xloc, yloc;
509 uint externalPort; 510 uint externalPort;
510 string externalHostName; 511 string externalHostName;
511 string serverURI;
512 try 512 try
513 { 513 {
514 xloc = Convert.ToInt32(cmdparams[0]); 514 xloc = Convert.ToInt32(cmdparams[0]);
515 yloc = Convert.ToInt32(cmdparams[1]); 515 yloc = Convert.ToInt32(cmdparams[1]);
516 externalPort = Convert.ToUInt32(cmdparams[3]); 516 externalPort = Convert.ToUInt32(cmdparams[3]);
517 externalHostName = cmdparams[2]; 517 externalHostName = cmdparams[2];
518 if ( cmdparams.Length == 4 ) {
519
520 }
521 //internalPort = Convert.ToUInt32(cmdparams[4]); 518 //internalPort = Convert.ToUInt32(cmdparams[4]);
522 //remotingPort = Convert.ToUInt32(cmdparams[5]); 519 //remotingPort = Convert.ToUInt32(cmdparams[5]);
523 } 520 }
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 9e96163..3f5c4f1 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -157,7 +157,7 @@ namespace OpenSim.Services.HypergridService
157 string regionimage = "regionImage" + region.RegionID.ToString(); 157 string regionimage = "regionImage" + region.RegionID.ToString();
158 regionimage = regionimage.Replace("-", ""); 158 regionimage = regionimage.Replace("-", "");
159 159
160 imageURL = region.ServerURI + "index.php?method=" + regionimage; 160 imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage;
161 161
162 return true; 162 return true;
163 } 163 }
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index aed2dc8..eb6433c 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -136,7 +136,6 @@ namespace OpenSim.Services.HypergridService
136 m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", 136 m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
137 agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), 137 agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()),
138 gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); 138 gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort);
139 m_log.Debug("gatekeeper serveruri -> " + gatekeeper.ServerURI );
140 139
141 // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination 140 // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
142 GridRegion region = new GridRegion(gatekeeper); 141 GridRegion region = new GridRegion(gatekeeper);
@@ -146,12 +145,12 @@ namespace OpenSim.Services.HypergridService
146 region.RegionLocY = finalDestination.RegionLocY; 145 region.RegionLocY = finalDestination.RegionLocY;
147 146
148 // Generate a new service session 147 // Generate a new service session
149 agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); 148 agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random();
150 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); 149 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);
151 150
152 bool success = false; 151 bool success = false;
153 string myExternalIP = string.Empty; 152 string myExternalIP = string.Empty;
154 string gridName = gatekeeper.ServerURI; 153 string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort;
155 if (m_GridName == gridName) 154 if (m_GridName == gridName)
156 success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); 155 success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
157 else 156 else
@@ -160,7 +159,7 @@ namespace OpenSim.Services.HypergridService
160 if (!success) 159 if (!success)
161 { 160 {
162 m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", 161 m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}",
163 agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); 162 agentCircuit.firstname, agentCircuit.lastname, region.ExternalHostName + ":" + region.HttpPort, reason);
164 163
165 // restore the old travel info 164 // restore the old travel info
166 lock (m_TravelingAgents) 165 lock (m_TravelingAgents)
@@ -211,7 +210,7 @@ namespace OpenSim.Services.HypergridService
211 m_TravelingAgents[agentCircuit.SessionID] = travel; 210 m_TravelingAgents[agentCircuit.SessionID] = travel;
212 } 211 }
213 travel.UserID = agentCircuit.AgentID; 212 travel.UserID = agentCircuit.AgentID;
214 travel.GridExternalName = region.ServerURI; 213 travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort;
215 travel.ServiceToken = agentCircuit.ServiceSessionID; 214 travel.ServiceToken = agentCircuit.ServiceSessionID;
216 if (old != null) 215 if (old != null)
217 travel.ClientIPAddress = old.ClientIPAddress; 216 travel.ClientIPAddress = old.ClientIPAddress;
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index a0d270c..cce8f2c 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -115,20 +115,8 @@ namespace OpenSim.Services.Interfaces
115 /// </summary> 115 /// </summary>
116 public string ServerURI 116 public string ServerURI
117 { 117 {
118 get { 118 get { return m_serverURI; }
119 if ( m_serverURI != string.Empty ) { 119 set { m_serverURI = value; }
120 return m_serverURI;
121 } else {
122 return "http://" + m_externalHostName + ":" + m_httpPort + "/";
123 }
124 }
125 set {
126 if ( value.EndsWith("/") ) {
127 m_serverURI = value;
128 } else {
129 m_serverURI = value + '/';
130 }
131 }
132 } 120 }
133 protected string m_serverURI; 121 protected string m_serverURI;
134 122
@@ -176,7 +164,6 @@ namespace OpenSim.Services.Interfaces
176 164
177 public GridRegion() 165 public GridRegion()
178 { 166 {
179 m_serverURI = string.Empty;
180 } 167 }
181 168
182 public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) 169 public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index e98cc22..011cad8 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -339,7 +339,34 @@ namespace OpenSim.Services.LLLoginService
339 339
340 private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) 340 private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient)
341 { 341 {
342 SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); 342 string capsSeedPath = String.Empty;
343
344 // Don't use the following! It Fails for logging into any region not on the same port as the http server!
345 // Kept here so it doesn't happen again!
346 // response.SeedCapability = regionInfo.ServerURI + capsSeedPath;
347
348 #region IP Translation for NAT
349 if (ipepClient != null)
350 {
351 capsSeedPath
352 = "http://"
353 + NetworkUtil.GetHostFor(ipepClient.Address, destination.ExternalHostName)
354 + ":"
355 + destination.HttpPort
356 + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
357 }
358 else
359 {
360 capsSeedPath
361 = "http://"
362 + destination.ExternalHostName
363 + ":"
364 + destination.HttpPort
365 + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
366 }
367 #endregion
368
369 SeedCapability = capsSeedPath;
343 } 370 }
344 371
345 private void SetDefaultValues() 372 private void SetDefaultValues()
diff --git a/prebuild.xml b/prebuild.xml
index 13a0bd3..1e2459b 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1417,6 +1417,7 @@
1417 <Reference name="System"/> 1417 <Reference name="System"/>
1418 <Reference name="System.Core"/> 1418 <Reference name="System.Core"/>
1419 <Reference name="System.Xml"/> 1419 <Reference name="System.Xml"/>
1420 <Reference name="System.Xml.Linq"/>
1420 <Reference name="System.Drawing"/> 1421 <Reference name="System.Drawing"/>
1421 <Reference name="System.Web"/> 1422 <Reference name="System.Web"/>
1422 <Reference name="NDesk.Options" path="../../../bin/"/> 1423 <Reference name="NDesk.Options" path="../../../bin/"/>