aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-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/ClientStack/LindenUDP/LLClientView.cs2
-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
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs35
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs40
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs21
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs12
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs42
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs3
-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.cs60
-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
40 files changed, 439 insertions, 248 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 73b8bd0..08d5398 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -115,20 +115,8 @@ namespace OpenSim.Framework
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
@@ -153,7 +141,6 @@ namespace OpenSim.Framework
153 141
154 public SimpleRegionInfo() 142 public SimpleRegionInfo()
155 { 143 {
156 m_serverURI = string.Empty;
157 } 144 }
158 145
159 public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 146 public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
@@ -163,7 +150,6 @@ namespace OpenSim.Framework
163 150
164 m_internalEndPoint = internalEndPoint; 151 m_internalEndPoint = internalEndPoint;
165 m_externalHostName = externalUri; 152 m_externalHostName = externalUri;
166 m_serverURI = string.Empty;
167 } 153 }
168 154
169 public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) 155 public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port)
@@ -174,7 +160,6 @@ namespace OpenSim.Framework
174 m_externalHostName = externalUri; 160 m_externalHostName = externalUri;
175 161
176 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); 162 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
177 m_serverURI = string.Empty;
178 } 163 }
179 164
180 public SimpleRegionInfo(RegionInfo ConvertFrom) 165 public SimpleRegionInfo(RegionInfo ConvertFrom)
@@ -464,7 +449,6 @@ namespace OpenSim.Framework
464 configMember = 449 configMember =
465 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); 450 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
466 configMember.performConfigurationRetrieve(); 451 configMember.performConfigurationRetrieve();
467 m_serverURI = string.Empty;
468 } 452 }
469 453
470 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 454 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
@@ -474,12 +458,10 @@ namespace OpenSim.Framework
474 458
475 m_internalEndPoint = internalEndPoint; 459 m_internalEndPoint = internalEndPoint;
476 m_externalHostName = externalUri; 460 m_externalHostName = externalUri;
477 m_serverURI = string.Empty;
478 } 461 }
479 462
480 public RegionInfo() 463 public RegionInfo()
481 { 464 {
482 m_serverURI = string.Empty;
483 } 465 }
484 466
485 public EstateSettings EstateSettings 467 public EstateSettings EstateSettings
@@ -569,23 +551,10 @@ namespace OpenSim.Framework
569 /// <summary> 551 /// <summary>
570 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) 552 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
571 /// </summary> 553 /// </summary>
572
573 public string ServerURI 554 public string ServerURI
574 { 555 {
575 get { 556 get { return m_serverURI; }
576 if ( m_serverURI != string.Empty ) { 557 set { m_serverURI = value; }
577 return m_serverURI;
578 } else {
579 return "http://" + m_externalHostName + ":" + m_httpPort + "/";
580 }
581 }
582 set {
583 if ( value.EndsWith("/") ) {
584 m_serverURI = value;
585 } else {
586 m_serverURI = value + '/';
587 }
588 }
589 } 558 }
590 559
591 public string RegionName 560 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 904a50c..74ad168 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -327,8 +327,8 @@ namespace OpenSim
327 //regionInfo.originRegionID = regionInfo.RegionID; 327 //regionInfo.originRegionID = regionInfo.RegionID;
328 328
329 // set initial ServerURI 329 // set initial ServerURI
330 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port;
330 regionInfo.HttpPort = m_httpServerPort; 331 regionInfo.HttpPort = m_httpServerPort;
331 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/";
332 332
333 regionInfo.osSecret = m_osSecret; 333 regionInfo.osSecret = m_osSecret;
334 334
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 426e1df..14f923d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3423,7 +3423,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3423 3423
3424 avp.Sender.IsTrial = false; 3424 avp.Sender.IsTrial = false;
3425 avp.Sender.ID = agentID; 3425 avp.Sender.ID = agentID;
3426 m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); 3426 //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
3427 OutPacket(avp, ThrottleOutPacketType.Task); 3427 OutPacket(avp, ThrottleOutPacketType.Task);
3428 } 3428 }
3429 3429
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))
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 437b91a..c321a15 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -293,6 +293,17 @@ namespace OpenSim.Region.Framework.Scenes
293 public event ChatFromClientEvent OnChatFromClient; 293 public event ChatFromClientEvent OnChatFromClient;
294 294
295 /// <summary> 295 /// <summary>
296 /// ChatToClientsEvent is triggered via ChatModule (or
297 /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a
298 /// received chat message if they satisfy various conditions (within audible range, etc.)
299 /// </summary>
300 public delegate void ChatToClientsEvent(
301 UUID senderID, HashSet<UUID> receiverIDs,
302 string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
303 ChatSourceType src, ChatAudibleLevel level);
304 public event ChatToClientsEvent OnChatToClients;
305
306 /// <summary>
296 /// ChatBroadcastEvent is called via Scene when a broadcast chat message 307 /// ChatBroadcastEvent is called via Scene when a broadcast chat message
297 /// from world comes in 308 /// from world comes in
298 /// </summary> 309 /// </summary>
@@ -1603,6 +1614,30 @@ namespace OpenSim.Region.Framework.Scenes
1603 } 1614 }
1604 } 1615 }
1605 } 1616 }
1617
1618 public void TriggerOnChatToClients(
1619 UUID senderID, HashSet<UUID> receiverIDs,
1620 string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
1621 ChatSourceType src, ChatAudibleLevel level)
1622 {
1623 ChatToClientsEvent handler = OnChatToClients;
1624 if (handler != null)
1625 {
1626 foreach (ChatToClientsEvent d in handler.GetInvocationList())
1627 {
1628 try
1629 {
1630 d(senderID, receiverIDs, message, type, fromPos, fromName, src, level);
1631 }
1632 catch (Exception e)
1633 {
1634 m_log.ErrorFormat(
1635 "[EVENT MANAGER]: Delegate for TriggerOnChatToClients failed - continuing. {0} {1}",
1636 e.Message, e.StackTrace);
1637 }
1638 }
1639 }
1640 }
1606 1641
1607 public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) 1642 public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
1608 { 1643 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 6ed08f3..6367fcf 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2388,7 +2388,7 @@ namespace OpenSim.Region.Framework.Scenes
2388 } 2388 }
2389 catch (Exception e) 2389 catch (Exception e)
2390 { 2390 {
2391 m_log.WarnFormat("[SCENE]: Problem casting object: {0}", e.Message); 2391 m_log.WarnFormat("[SCENE]: Problem casting object: " + e.ToString());
2392 return false; 2392 return false;
2393 } 2393 }
2394 2394
@@ -3271,7 +3271,6 @@ namespace OpenSim.Region.Framework.Scenes
3271 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName); 3271 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName);
3272 } 3272 }
3273 3273
3274
3275 /// <summary> 3274 /// <summary>
3276 /// Do the work necessary to initiate a new user connection for a particular scene. 3275 /// Do the work necessary to initiate a new user connection for a particular scene.
3277 /// At the moment, this consists of setting up the caps infrastructure 3276 /// At the moment, this consists of setting up the caps infrastructure
@@ -3284,6 +3283,23 @@ namespace OpenSim.Region.Framework.Scenes
3284 /// also return a reason.</returns> 3283 /// also return a reason.</returns>
3285 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) 3284 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
3286 { 3285 {
3286 return NewUserConnection(agent, teleportFlags, out reason, true);
3287 }
3288
3289 /// <summary>
3290 /// Do the work necessary to initiate a new user connection for a particular scene.
3291 /// At the moment, this consists of setting up the caps infrastructure
3292 /// The return bool should allow for connections to be refused, but as not all calling paths
3293 /// take proper notice of it let, we allowed banned users in still.
3294 /// </summary>
3295 /// <param name="agent">CircuitData of the agent who is connecting</param>
3296 /// <param name="reason">Outputs the reason for the false response on this string</param>
3297 /// <param name="requirePresenceLookup">True for normal presence. False for NPC
3298 /// or other applications where a full grid/Hypergrid presence may not be required.</param>
3299 /// <returns>True if the region accepts this agent. False if it does not. False will
3300 /// also return a reason.</returns>
3301 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup)
3302 {
3287 bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || 3303 bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
3288 (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); 3304 (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
3289 reason = String.Empty; 3305 reason = String.Empty;
@@ -3332,16 +3348,18 @@ namespace OpenSim.Region.Framework.Scenes
3332 3348
3333 if (sp == null) // We don't have an [child] agent here already 3349 if (sp == null) // We don't have an [child] agent here already
3334 { 3350 {
3335 3351 if (requirePresenceLookup)
3336 try
3337 { 3352 {
3338 if (!VerifyUserPresence(agent, out reason)) 3353 try
3354 {
3355 if (!VerifyUserPresence(agent, out reason))
3356 return false;
3357 }
3358 catch (Exception e)
3359 {
3360 m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString());
3339 return false; 3361 return false;
3340 } 3362 }
3341 catch (Exception e)
3342 {
3343 m_log.DebugFormat("[CONNECTION BEGIN]: Exception verifying presence {0}", e.Message);
3344 return false;
3345 } 3363 }
3346 3364
3347 try 3365 try
@@ -3351,7 +3369,7 @@ namespace OpenSim.Region.Framework.Scenes
3351 } 3369 }
3352 catch (Exception e) 3370 catch (Exception e)
3353 { 3371 {
3354 m_log.DebugFormat("[CONNECTION BEGIN]: Exception authorizing user {0}", e.Message); 3372 m_log.ErrorFormat("[CONNECTION BEGIN]: Exception authorizing user " + e.ToString());
3355 return false; 3373 return false;
3356 } 3374 }
3357 3375
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index f81c551..24d7334 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -406,11 +406,14 @@ namespace OpenSim.Region.Framework.Scenes
406 public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) 406 public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
407 { 407 {
408 EntityBase entity; 408 EntityBase entity;
409 if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup) 409 if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup)))
410 return false; 410 return false;
411 411
412 SceneObjectGroup grp = (SceneObjectGroup)entity; 412 SceneObjectGroup grp = (SceneObjectGroup)entity;
413 413
414 if (entity == null)
415 return false;
416
414 if (!resultOfObjectLinked) 417 if (!resultOfObjectLinked)
415 { 418 {
416 m_numPrim -= grp.PrimCount; 419 m_numPrim -= grp.PrimCount;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 8541121..6576e64 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2897,9 +2897,6 @@ namespace OpenSim.Region.Framework.Scenes
2897 2897
2898 public void CopyTo(AgentData cAgent) 2898 public void CopyTo(AgentData cAgent)
2899 { 2899 {
2900// DEBUG ON
2901 m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYTO");
2902// DEBUG OFF
2903 cAgent.CallbackURI = m_callbackURI; 2900 cAgent.CallbackURI = m_callbackURI;
2904 2901
2905 cAgent.AgentID = UUID; 2902 cAgent.AgentID = UUID;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 044b599..e661ca9 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -804,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
804 private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader) 804 private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader)
805 { 805 {
806 byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry")); 806 byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry"));
807 shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); 807 shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length);
808 } 808 }
809 809
810 private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader) 810 private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader)
@@ -1426,7 +1426,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1426 1426
1427 reader.ReadStartElement(name); 1427 reader.ReadStartElement(name);
1428 vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x 1428 vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x
1429 vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or Y 1429 vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or y
1430 vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z 1430 vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z
1431 reader.ReadEndElement(); 1431 reader.ReadEndElement();
1432 1432
@@ -1501,15 +1501,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1501 1501
1502 reader.ReadStartElement(name, String.Empty); // Shape 1502 reader.ReadStartElement(name, String.Empty); // Shape
1503 1503
1504 string nodeName = string.Empty;
1504 while (reader.NodeType != XmlNodeType.EndElement) 1505 while (reader.NodeType != XmlNodeType.EndElement)
1505 { 1506 {
1507 nodeName = reader.Name;
1506 //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name); 1508 //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
1507 ShapeXmlProcessor p = null; 1509 ShapeXmlProcessor p = null;
1508 if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p)) 1510 if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p))
1509 p(shape, reader); 1511 {
1512 try
1513 {
1514 p(shape, reader);
1515 }
1516 catch (Exception e)
1517 {
1518 m_log.DebugFormat("[SceneObjectSerializer]: exception while parsing Shape {0}: {1}", nodeName, e);
1519 if (reader.NodeType == XmlNodeType.EndElement)
1520 reader.Read();
1521 }
1522 }
1510 else 1523 else
1511 { 1524 {
1512// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name); 1525 // m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name);
1513 reader.ReadOuterXml(); 1526 reader.ReadOuterXml();
1514 } 1527 }
1515 } 1528 }
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
index 25dba7f..3d34441 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
@@ -220,7 +220,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
220 groupID, groupMembers.Count); 220 groupID, groupMembers.Count);
221 221
222 foreach (GroupMembersData member in groupMembers) 222 foreach (GroupMembersData member in groupMembers)
223 { 223 {
224 if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) 224 if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID))
225 { 225 {
226 // Don't deliver messages to people who have dropped this session 226 // Don't deliver messages to people who have dropped this session
@@ -266,7 +266,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
266 266
267 void OnClientLogin(IClientAPI client) 267 void OnClientLogin(IClientAPI client)
268 { 268 {
269 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name); 269 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name);
270 } 270 }
271 271
272 private void OnNewClient(IClientAPI client) 272 private void OnNewClient(IClientAPI client)
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs
index d8f7a84..3f1bd54 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ExtensionHandler.cs
@@ -32,7 +32,7 @@ using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces;
32 32
33namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 33namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
34{ 34{
35 class ExtensionHandler : IExtension 35 class ExtensionHandler : IExtension
36 { 36 {
37 private readonly Dictionary<Type, object> m_instances; 37 private readonly Dictionary<Type, object> m_instances;
38 38
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index 2ddc31b..df60709 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 private Scene m_scene; 52 private Scene m_scene;
53 53
54 private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>(); 54 private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>();
55 55
56 private readonly Dictionary<Type,object> m_extensions = new Dictionary<Type, object>(); 56 private readonly Dictionary<Type,object> m_extensions = new Dictionary<Type, object>();
@@ -77,7 +77,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
77 { 77 {
78 m_log.Info("[MRM] Enabling MRM Module"); 78 m_log.Info("[MRM] Enabling MRM Module");
79 m_scene = scene; 79 m_scene = scene;
80 80
81 // when hidden, we don't listen for client initiated script events 81 // when hidden, we don't listen for client initiated script events
82 // only making the MRM engine available for region modules 82 // only making the MRM engine available for region modules
83 if (!source.Configs["MRM"].GetBoolean("Hidden", false)) 83 if (!source.Configs["MRM"].GetBoolean("Hidden", false))
@@ -85,7 +85,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
85 scene.EventManager.OnRezScript += EventManager_OnRezScript; 85 scene.EventManager.OnRezScript += EventManager_OnRezScript;
86 scene.EventManager.OnStopScript += EventManager_OnStopScript; 86 scene.EventManager.OnStopScript += EventManager_OnStopScript;
87 } 87 }
88 88
89 scene.EventManager.OnFrame += EventManager_OnFrame; 89 scene.EventManager.OnFrame += EventManager_OnFrame;
90 90
91 scene.RegisterModuleInterface<IMRMModule>(this); 91 scene.RegisterModuleInterface<IMRMModule>(this);
@@ -291,7 +291,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
291 291
292 public void InitializeMRM(MRMBase mmb, uint localID, UUID itemID) 292 public void InitializeMRM(MRMBase mmb, uint localID, UUID itemID)
293 { 293 {
294
295 m_log.Info("[MRM] Created MRM Instance"); 294 m_log.Info("[MRM] Created MRM Instance");
296 295
297 IWorld world; 296 IWorld world;
@@ -304,7 +303,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
304 303
305 public void PostInitialise() 304 public void PostInitialise()
306 { 305 {
307
308 } 306 }
309 307
310 public void Close() 308 public void Close()
@@ -350,7 +348,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
350 if (!Directory.Exists(tmp)) 348 if (!Directory.Exists(tmp))
351 Directory.CreateDirectory(tmp); 349 Directory.CreateDirectory(tmp);
352 350
353
354 m_log.Info("MRM 2"); 351 m_log.Info("MRM 2");
355 352
356 try 353 try
@@ -396,8 +393,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
396 393
397 parameters.IncludeDebugInformation = true; 394 parameters.IncludeDebugInformation = true;
398 395
399 string rootPath = 396 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
400 Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
401 397
402 List<string> libraries = new List<string>(); 398 List<string> libraries = new List<string>();
403 string[] lines = Script.Split(new string[] {"\n"}, StringSplitOptions.RemoveEmptyEntries); 399 string[] lines = Script.Split(new string[] {"\n"}, StringSplitOptions.RemoveEmptyEntries);
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 1257804..d770ad1 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -287,7 +287,7 @@ namespace OpenSim.Region.Physics.Meshing
287 long start = 0; 287 long start = 0;
288 using (MemoryStream data = new MemoryStream(primShape.SculptData)) 288 using (MemoryStream data = new MemoryStream(primShape.SculptData))
289 { 289 {
290 meshOsd = (OSDMap)OSDParser.DeserializeLLSDBinary(data, true); 290 meshOsd = (OSDMap)OSDParser.DeserializeLLSDBinary(data);
291 start = data.Position; 291 start = data.Position;
292 } 292 }
293 293
@@ -324,7 +324,7 @@ namespace OpenSim.Region.Physics.Meshing
324 324
325 byte[] decompressedBuf = outMs.GetBuffer(); 325 byte[] decompressedBuf = outMs.GetBuffer();
326 326
327 decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf, true); 327 decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf);
328 } 328 }
329 } 329 }
330 } 330 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 92523d4..1a13dea 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6892,7 +6892,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6892 6892
6893 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) 6893 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
6894 { 6894 {
6895 llSetLinkPrimitiveParams(linknumber, rules); 6895 m_host.AddScriptLPS(1);
6896
6897 List<SceneObjectPart> parts = GetLinkParts(linknumber);
6898
6899 foreach (SceneObjectPart part in parts)
6900 SetPrimParams(part, rules);
6896 } 6901 }
6897 6902
6898 protected void SetPrimParams(SceneObjectPart part, LSL_List rules) 6903 protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
@@ -7263,6 +7268,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7263 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); 7268 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
7264 7269
7265 break; 7270 break;
7271 case (int)ScriptBaseClass.PRIM_NAME:
7272 if (remain < 1)
7273 return;
7274 string primName = rules.GetLSLStringItem(idx++);
7275 part.Name = primName;
7276 break;
7277 case (int)ScriptBaseClass.PRIM_DESC:
7278 if (remain < 1)
7279 return;
7280 string primDesc = rules.GetLSLStringItem(idx++);
7281 part.Description = primDesc;
7282 break;
7283 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
7284 if (remain < 1)
7285 return;
7286 LSL_Rotation lr = rules.GetQuaternionItem(idx++);
7287 SetRot(part, Rot2Quaternion(lr));
7288 break;
7266 } 7289 }
7267 } 7290 }
7268 } 7291 }
@@ -7808,6 +7831,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7808 textColor.B)); 7831 textColor.B));
7809 res.Add(new LSL_Float(textColor.A)); 7832 res.Add(new LSL_Float(textColor.A));
7810 break; 7833 break;
7834 case (int)ScriptBaseClass.PRIM_NAME:
7835 res.Add(part.Name);
7836 break;
7837 case (int)ScriptBaseClass.PRIM_DESC:
7838 res.Add(part.Description);
7839 break;
7840 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
7841 res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W));
7842 break;
7811 } 7843 }
7812 } 7844 }
7813 return res; 7845 return res;
@@ -9096,10 +9128,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9096 // do that one last, it will cause a ParcelPropertiesUpdate 9128 // do that one last, it will cause a ParcelPropertiesUpdate
9097 landObject.SetMediaUrl(url); 9129 landObject.SetMediaUrl(url);
9098 9130
9099 // now send to all (non-child) agents 9131 // now send to all (non-child) agents in the parcel
9100 World.ForEachScenePresence(delegate(ScenePresence sp) 9132 World.ForEachScenePresence(delegate(ScenePresence sp)
9101 { 9133 {
9102 if (!sp.IsChildAgent) 9134 if (!sp.IsChildAgent && (sp.currentParcelUUID == landData.GlobalID))
9103 { 9135 {
9104 sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, 9136 sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL,
9105 landData.MediaID, 9137 landData.MediaID,
@@ -9129,10 +9161,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9129 // the commandList contained a start/stop/... command, too 9161 // the commandList contained a start/stop/... command, too
9130 if (presence == null) 9162 if (presence == null)
9131 { 9163 {
9132 // send to all (non-child) agents 9164 // send to all (non-child) agents in the parcel
9133 World.ForEachScenePresence(delegate(ScenePresence sp) 9165 World.ForEachScenePresence(delegate(ScenePresence sp)
9134 { 9166 {
9135 if (!sp.IsChildAgent) 9167 if (!sp.IsChildAgent && (sp.currentParcelUUID == landData.GlobalID))
9136 { 9168 {
9137 sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this? 9169 sp.ControllingClient.SendParcelMediaCommand(0x4, // TODO what is this?
9138 (ParcelMediaCommandEnum)commandToSend, 9170 (ParcelMediaCommandEnum)commandToSend,
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 5da6bb9..b96e977 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -316,6 +316,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
316 public const int PRIM_POINT_LIGHT = 23; // Huh? 316 public const int PRIM_POINT_LIGHT = 23; // Huh?
317 public const int PRIM_GLOW = 25; 317 public const int PRIM_GLOW = 25;
318 public const int PRIM_TEXT = 26; 318 public const int PRIM_TEXT = 26;
319 public const int PRIM_NAME = 27;
320 public const int PRIM_DESC = 28;
321 public const int PRIM_ROT_LOCAL = 29;
319 public const int PRIM_TEXGEN_DEFAULT = 0; 322 public const int PRIM_TEXGEN_DEFAULT = 0;
320 public const int PRIM_TEXGEN_PLANAR = 1; 323 public const int PRIM_TEXGEN_PLANAR = 1;
321 324
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 4b25ac8..8143b5a 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 8076fab..168b233 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -145,6 +145,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
145 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); 145 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
146 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); 146 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
147 147
148 string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/";
149
148 OSDMap extraData = new OSDMap 150 OSDMap extraData = new OSDMap
149 { 151 {
150 { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, 152 { "ServerURI", OSD.FromString(regionInfo.ServerURI) },
@@ -166,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
166 { "Name", regionInfo.RegionName }, 168 { "Name", regionInfo.RegionName },
167 { "MinPosition", minPosition.ToString() }, 169 { "MinPosition", minPosition.ToString() },
168 { "MaxPosition", maxPosition.ToString() }, 170 { "MaxPosition", maxPosition.ToString() },
169 { "Address", regionInfo.ServerURI }, 171 { "Address", httpAddress },
170 { "Enabled", "1" }, 172 { "Enabled", "1" },
171 { "ExtraData", OSDParser.SerializeJsonString(extraData) } 173 { "ExtraData", OSDParser.SerializeJsonString(extraData) }
172 }; 174 };
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index c4284eb..a5f748f 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";
@@ -356,7 +385,8 @@ namespace OpenSim.Services.Connectors.Simulation
356 { 385 {
357 agent = null; 386 agent = null;
358 // Eventually, we want to use a caps url instead of the agentID 387 // Eventually, we want to use a caps url instead of the agentID
359 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 388 string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
389 //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri);
360 390
361 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); 391 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
362 request.Method = "GET"; 392 request.Method = "GET";
@@ -377,6 +407,7 @@ namespace OpenSim.Services.Connectors.Simulation
377 sr = new StreamReader(webResponse.GetResponseStream()); 407 sr = new StreamReader(webResponse.GetResponseStream());
378 reply = sr.ReadToEnd().Trim(); 408 reply = sr.ReadToEnd().Trim();
379 409
410 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply);
380 411
381 } 412 }
382 catch (WebException ex) 413 catch (WebException ex)
@@ -397,6 +428,7 @@ namespace OpenSim.Services.Connectors.Simulation
397 OSDMap args = Util.GetOSDMap(reply); 428 OSDMap args = Util.GetOSDMap(reply);
398 if (args == null) 429 if (args == null)
399 { 430 {
431 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply");
400 return false; 432 return false;
401 } 433 }
402 434
@@ -405,6 +437,7 @@ namespace OpenSim.Services.Connectors.Simulation
405 return true; 437 return true;
406 } 438 }
407 439
440 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode);
408 return false; 441 return false;
409 } 442 }
410 443
@@ -446,8 +479,18 @@ namespace OpenSim.Services.Connectors.Simulation
446 479
447 public bool CloseAgent(GridRegion destination, UUID id) 480 public bool CloseAgent(GridRegion destination, UUID id)
448 { 481 {
449 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 482 string uri = string.Empty;
483 try
484 {
485 uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
486 }
487 catch (Exception e)
488 {
489 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message);
490 return false;
491 }
450 492
493 //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri);
451 494
452 WebRequest request = WebRequest.Create(uri); 495 WebRequest request = WebRequest.Create(uri);
453 request.Method = "DELETE"; 496 request.Method = "DELETE";
@@ -495,7 +538,7 @@ namespace OpenSim.Services.Connectors.Simulation
495 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) 538 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
496 { 539 {
497 string uri 540 string uri
498 = destination.ServerURI + ObjectPath() + sog.UUID + "/"; 541 = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/";
499 //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); 542 //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri);
500 543
501 WebRequest ObjectCreateRequest = WebRequest.Create(uri); 544 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..a67404f 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Linq;
30using System.Net; 31using System.Net;
31using System.Reflection; 32using System.Reflection;
32using System.Xml; 33using System.Xml;
@@ -127,7 +128,7 @@ namespace OpenSim.Services.GridService
127 if (MainConsole.Instance != null) 128 if (MainConsole.Instance != null)
128 { 129 {
129 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", 130 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
130 "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RegionServerURI] [<RemoteRegionName>] <cr>", 131 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
131 "Link a hypergrid region", RunCommand); 132 "Link a hypergrid region", RunCommand);
132 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", 133 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
133 "unlink-region <local name> or <HostName>:<HttpPort> <cr>", 134 "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
@@ -154,6 +155,11 @@ namespace OpenSim.Services.GridService
154 // From the command line link-region 155 // From the command line link-region
155 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) 156 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
156 { 157 {
158 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
159 }
160
161 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
162 {
157 reason = string.Empty; 163 reason = string.Empty;
158 string host = "127.0.0.1"; 164 string host = "127.0.0.1";
159 string portstr; 165 string portstr;
@@ -189,7 +195,7 @@ namespace OpenSim.Services.GridService
189 //} 195 //}
190 196
191 GridRegion regInfo; 197 GridRegion regInfo;
192 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason); 198 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
193 if (success) 199 if (success)
194 { 200 {
195 regInfo.RegionName = mapName; 201 regInfo.RegionName = mapName;
@@ -198,7 +204,12 @@ namespace OpenSim.Services.GridService
198 204
199 return null; 205 return null;
200 } 206 }
201 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) 207
208
209 // From the command line and the 2 above
210 public bool TryCreateLink(UUID scopeID, int xloc, int yloc,
211 string externalRegionName, uint externalPort, string externalHostName, UUID ownerID,
212 out GridRegion regInfo, out string reason)
202 { 213 {
203 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); 214 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc);
204 215
@@ -210,13 +221,20 @@ namespace OpenSim.Services.GridService
210 regInfo.RegionLocX = xloc; 221 regInfo.RegionLocX = xloc;
211 regInfo.RegionLocY = yloc; 222 regInfo.RegionLocY = yloc;
212 regInfo.ScopeID = scopeID; 223 regInfo.ScopeID = scopeID;
224 regInfo.EstateOwner = ownerID;
213 225
214 // Big HACK for Simian Grid !!! 226 // Big HACK for Simian Grid !!!
215 // We need to clean up all URLs used in OpenSim !!! 227 // We need to clean up all URLs used in OpenSim !!!
216 if (externalHostName.Contains("/")) { 228 if (externalHostName.Contains("/"))
217 regInfo.ServerURI = externalHostName; 229 regInfo.ServerURI = externalHostName;
218 } else { 230
219 regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString(); 231 // Check for free coordinates
232 GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);
233 if (region != null)
234 {
235 m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", regInfo.RegionLocX, regInfo.RegionLocY, region.RegionName, region.RegionID);
236 reason = "Coordinates are already in use";
237 return false;
220 } 238 }
221 239
222 try 240 try
@@ -240,11 +258,11 @@ namespace OpenSim.Services.GridService
240 258
241 if (regionID != UUID.Zero) 259 if (regionID != UUID.Zero)
242 { 260 {
243 GridRegion r = m_GridService.GetRegionByUUID(scopeID, regionID); 261 region = m_GridService.GetRegionByUUID(scopeID, regionID);
244 if (r != null) 262 if (region != null)
245 { 263 {
246 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); 264 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize);
247 regInfo = r; 265 regInfo = region;
248 return true; 266 return true;
249 } 267 }
250 268
@@ -354,17 +372,8 @@ namespace OpenSim.Services.GridService
354 { 372 {
355 // Check for regions which are not linked regions 373 // Check for regions which are not linked regions
356 List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); 374 List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
357 // would like to use .Except, but doesn't seem to exist 375 IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
358 //IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); 376 if (availableRegions.Count() == 0)
359 List<GridRegion> availableRegions = regions.FindAll(delegate(GridRegion region)
360 {
361 // Ewww! n^2
362 if (hyperlinks.Find(delegate(GridRegion r) { return r.RegionID == region.RegionID; }) == null) // not hyperlink. good.
363 return true;
364
365 return false;
366 });
367 if (availableRegions.Count == 0)
368 return false; 377 return false;
369 } 378 }
370 379
@@ -508,16 +517,12 @@ namespace OpenSim.Services.GridService
508 int xloc, yloc; 517 int xloc, yloc;
509 uint externalPort; 518 uint externalPort;
510 string externalHostName; 519 string externalHostName;
511 string serverURI;
512 try 520 try
513 { 521 {
514 xloc = Convert.ToInt32(cmdparams[0]); 522 xloc = Convert.ToInt32(cmdparams[0]);
515 yloc = Convert.ToInt32(cmdparams[1]); 523 yloc = Convert.ToInt32(cmdparams[1]);
516 externalPort = Convert.ToUInt32(cmdparams[3]); 524 externalPort = Convert.ToUInt32(cmdparams[3]);
517 externalHostName = cmdparams[2]; 525 externalHostName = cmdparams[2];
518 if ( cmdparams.Length == 4 ) {
519
520 }
521 //internalPort = Convert.ToUInt32(cmdparams[4]); 526 //internalPort = Convert.ToUInt32(cmdparams[4]);
522 //remotingPort = Convert.ToUInt32(cmdparams[5]); 527 //remotingPort = Convert.ToUInt32(cmdparams[5]);
523 } 528 }
@@ -532,7 +537,7 @@ namespace OpenSim.Services.GridService
532 xloc = xloc * (int)Constants.RegionSize; 537 xloc = xloc * (int)Constants.RegionSize;
533 yloc = yloc * (int)Constants.RegionSize; 538 yloc = yloc * (int)Constants.RegionSize;
534 string reason = string.Empty; 539 string reason = string.Empty;
535 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason)) 540 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
536 { 541 {
537 if (cmdparams.Length >= 5) 542 if (cmdparams.Length >= 5)
538 { 543 {
@@ -634,8 +639,7 @@ namespace OpenSim.Services.GridService
634 xloc = xloc * (int)Constants.RegionSize; 639 xloc = xloc * (int)Constants.RegionSize;
635 yloc = yloc * (int)Constants.RegionSize; 640 yloc = yloc * (int)Constants.RegionSize;
636 string reason = string.Empty; 641 string reason = string.Empty;
637 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, 642 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
638 externalHostName, out regInfo, out reason))
639 { 643 {
640 regInfo.RegionName = config.GetString("localName", ""); 644 regInfo.RegionName = config.GetString("localName", "");
641 } 645 }
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 6d3bff7..77230a3 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 f985ab2..0da1715 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -333,7 +333,34 @@ namespace OpenSim.Services.LLLoginService
333 333
334 private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) 334 private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient)
335 { 335 {
336 SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); 336 string capsSeedPath = String.Empty;
337
338 // Don't use the following! It Fails for logging into any region not on the same port as the http server!
339 // Kept here so it doesn't happen again!
340 // response.SeedCapability = regionInfo.ServerURI + capsSeedPath;
341
342 #region IP Translation for NAT
343 if (ipepClient != null)
344 {
345 capsSeedPath
346 = "http://"
347 + NetworkUtil.GetHostFor(ipepClient.Address, destination.ExternalHostName)
348 + ":"
349 + destination.HttpPort
350 + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
351 }
352 else
353 {
354 capsSeedPath
355 = "http://"
356 + destination.ExternalHostName
357 + ":"
358 + destination.HttpPort
359 + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
360 }
361 #endregion
362
363 SeedCapability = capsSeedPath;
337 } 364 }
338 365
339 private void SetDefaultValues() 366 private void SetDefaultValues()