aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs53
-rw-r--r--OpenSim/Client/MXP/ClientStack/MXPClientView.cs176
-rw-r--r--OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs5
-rw-r--r--OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs6
-rw-r--r--OpenSim/Data/MySQL/MySQLLegacyRegionData.cs6
-rw-r--r--OpenSim/Data/SQLite/Resources/019_RegionStore.sql5
-rw-r--r--OpenSim/Data/SQLite/Resources/020_RegionStore.sql6
-rw-r--r--OpenSim/Data/SQLite/Resources/RegionStore.migrations17
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs3
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs3
-rw-r--r--OpenSim/Framework/LandData.cs14
-rw-r--r--OpenSim/Framework/RegionInfo.cs15
-rw-r--r--OpenSim/Framework/Serialization/External/LandDataSerializer.cs5
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs12
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs109
-rw-r--r--OpenSim/Framework/Util.cs44
-rw-r--r--OpenSim/Region/Application/OpenSim.cs8
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs5
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs65
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs110
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs6
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs12
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs28
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs26
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs27
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs2
-rw-r--r--OpenSim/Region/DataSnapshot/LandSnapshot.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs59
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs21
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs30
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs26
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs4
-rw-r--r--OpenSim/Server/Handlers/Login/LLLoginHandlers.cs12
-rw-r--r--OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs5
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs19
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs16
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs50
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs40
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs41
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs39
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs58
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs14
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs44
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs62
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs38
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs54
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs37
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs24
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs29
-rw-r--r--OpenSim/Services/InventoryService/HGInventoryService.cs2
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs24
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs2
62 files changed, 912 insertions, 668 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 826a1b0..0608f66 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -588,6 +588,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
588 /// <item><term>estate_name</term> 588 /// <item><term>estate_name</term>
589 /// <description>the name of the estate to join (or to create if it doesn't 589 /// <description>the name of the estate to join (or to create if it doesn't
590 /// already exist)</description></item> 590 /// already exist)</description></item>
591 /// <item><term>region_file</term>
592 /// <description>The name of the file to persist the region specifications to.
593 /// If omitted, the region_file_template setting from OpenSim.ini will be used. (optional)</description></item>
591 /// </list> 594 /// </list>
592 /// 595 ///
593 /// XmlRpcCreateRegionMethod returns 596 /// XmlRpcCreateRegionMethod returns
@@ -701,7 +704,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
701 bool persist = Convert.ToBoolean((string) requestData["persist"]); 704 bool persist = Convert.ToBoolean((string) requestData["persist"]);
702 if (persist) 705 if (persist)
703 { 706 {
704 // default place for region XML files is in the 707 // default place for region configuration files is in the
705 // Regions directory of the config dir (aka /bin) 708 // Regions directory of the config dir (aka /bin)
706 string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); 709 string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
707 try 710 try
@@ -714,19 +717,36 @@ namespace OpenSim.ApplicationPlugins.RemoteController
714 { 717 {
715 // No INI setting recorded. 718 // No INI setting recorded.
716 } 719 }
717 string regionXmlPath = Path.Combine(regionConfigPath, 720
721 string regionIniPath;
722
723 if (requestData.Contains("region_file"))
724 {
725 // Make sure that the file to be created is in a subdirectory of the region storage directory.
726 string requestedFilePath = Path.Combine(regionConfigPath, (string) requestData["region_file"]);
727 string requestedDirectory = Path.GetDirectoryName(Path.GetFullPath(requestedFilePath));
728 if (requestedDirectory.StartsWith(Path.GetFullPath(regionConfigPath)))
729 regionIniPath = requestedFilePath;
730 else
731 throw new Exception("Invalid location for region file.");
732 }
733 else
734 {
735 regionIniPath = Path.Combine(regionConfigPath,
718 String.Format( 736 String.Format(
719 m_config.GetString("region_file_template", 737 m_config.GetString("region_file_template",
720 "{0}x{1}-{2}.xml"), 738 "{0}x{1}-{2}.ini"),
721 region.RegionLocX.ToString(), 739 region.RegionLocX.ToString(),
722 region.RegionLocY.ToString(), 740 region.RegionLocY.ToString(),
723 regionID.ToString(), 741 regionID.ToString(),
724 region.InternalEndPoint.Port.ToString(), 742 region.InternalEndPoint.Port.ToString(),
725 region.RegionName.Replace(" ", "_").Replace(":", "_"). 743 region.RegionName.Replace(" ", "_").Replace(":", "_").
726 Replace("/", "_"))); 744 Replace("/", "_")));
745 }
746
727 m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", 747 m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
728 region.RegionID, regionXmlPath); 748 region.RegionID, regionIniPath);
729 region.SaveRegionToFile("dynamic region", regionXmlPath); 749 region.SaveRegionToFile("dynamic region", regionIniPath);
730 } 750 }
731 else 751 else
732 { 752 {
@@ -1700,8 +1720,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1700 destinationItem.CreationDate = item.CreationDate; 1720 destinationItem.CreationDate = item.CreationDate;
1701 destinationItem.Folder = destinationFolder.ID; 1721 destinationItem.Folder = destinationFolder.ID;
1702 1722
1703 inventoryService.AddItem(destinationItem); 1723 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
1704 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); 1724 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
1705 1725
1706 // Wear item 1726 // Wear item
1707 AvatarWearable newWearable = new AvatarWearable(); 1727 AvatarWearable newWearable = new AvatarWearable();
@@ -1711,7 +1731,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1711 } 1731 }
1712 else 1732 else
1713 { 1733 {
1714 m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); 1734 m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID);
1715 } 1735 }
1716 } 1736 }
1717 } 1737 }
@@ -1753,16 +1773,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1753 destinationItem.CreationDate = item.CreationDate; 1773 destinationItem.CreationDate = item.CreationDate;
1754 destinationItem.Folder = destinationFolder.ID; 1774 destinationItem.Folder = destinationFolder.ID;
1755 1775
1756 inventoryService.AddItem(destinationItem); 1776 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
1757 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); 1777 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
1758 1778
1759 // Attach item 1779 // Attach item
1760 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); 1780 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
1761 m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); 1781 m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
1762 } 1782 }
1763 else 1783 else
1764 { 1784 {
1765 m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, destinationFolder.ID); 1785 m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", itemID, destinationFolder.ID);
1766 } 1786 }
1767 } 1787 }
1768 } 1788 }
@@ -1860,16 +1880,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1860 destinationItem.CreationDate = item.CreationDate; 1880 destinationItem.CreationDate = item.CreationDate;
1861 destinationItem.Folder = extraFolder.ID; 1881 destinationItem.Folder = extraFolder.ID;
1862 1882
1863 inventoryService.AddItem(destinationItem); 1883 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
1864 inventoryMap.Add(item.ID, destinationItem.ID); 1884 inventoryMap.Add(item.ID, destinationItem.ID);
1865 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID); 1885 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);
1866 1886
1867 // Attach item, if original is attached 1887 // Attach item, if original is attached
1868 int attachpoint = avatarAppearance.GetAttachpoint(item.ID); 1888 int attachpoint = avatarAppearance.GetAttachpoint(item.ID);
1869 if (attachpoint != 0) 1889 if (attachpoint != 0)
1870 { 1890 {
1871 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); 1891 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
1872 m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); 1892 m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
1873 } 1893 }
1874 } 1894 }
1875 } 1895 }
@@ -1888,7 +1908,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1888 private bool CreateDefaultAvatars() 1908 private bool CreateDefaultAvatars()
1889 { 1909 {
1890 // Only load once 1910 // Only load once
1891
1892 if (m_defaultAvatarsLoaded) 1911 if (m_defaultAvatarsLoaded)
1893 { 1912 {
1894 return false; 1913 return false;
@@ -2146,7 +2165,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2146 inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); 2165 inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch());
2147 inventoryItem.Folder = extraFolder.ID; // Parent folder 2166 inventoryItem.Folder = extraFolder.ID; // Parent folder
2148 2167
2149 inventoryService.AddItem(inventoryItem); 2168 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem);
2150 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID); 2169 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID);
2151 } 2170 }
2152 2171
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
index faab371..87b99e0 100644
--- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
+++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
@@ -305,94 +305,94 @@ namespace OpenSim.Client.MXP.ClientStack
305 305
306 #region MXP Outgoing Message Processing 306 #region MXP Outgoing Message Processing
307 307
308 private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim) 308// private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim)
309 { 309// {
310 String typeName = ToOmType(primShape.PCode); 310// String typeName = ToOmType(primShape.PCode);
311 m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName); 311// m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName);
312 312//
313 PerceptionEventMessage pe = new PerceptionEventMessage(); 313// PerceptionEventMessage pe = new PerceptionEventMessage();
314 pe.ObjectFragment.ObjectId = objectID.Guid; 314// pe.ObjectFragment.ObjectId = objectID.Guid;
315 315//
316 pe.ObjectFragment.ParentObjectId = Guid.Empty; 316// pe.ObjectFragment.ParentObjectId = Guid.Empty;
317 317//
318 // Resolving parent UUID. 318// // Resolving parent UUID.
319 OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene; 319// OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene;
320 if (scene.Entities.ContainsKey(parentID)) 320// if (scene.Entities.ContainsKey(parentID))
321 { 321// {
322 pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid; 322// pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid;
323 } 323// }
324 324//
325 pe.ObjectFragment.ObjectIndex = localID; 325// pe.ObjectFragment.ObjectIndex = localID;
326 pe.ObjectFragment.ObjectName = typeName + " Object"; 326// pe.ObjectFragment.ObjectName = typeName + " Object";
327 pe.ObjectFragment.OwnerId = ownerID.Guid; 327// pe.ObjectFragment.OwnerId = ownerID.Guid;
328 pe.ObjectFragment.TypeId = Guid.Empty; 328// pe.ObjectFragment.TypeId = Guid.Empty;
329 pe.ObjectFragment.TypeName = typeName; 329// pe.ObjectFragment.TypeName = typeName;
330 pe.ObjectFragment.Acceleration = ToOmVector(acc); 330// pe.ObjectFragment.Acceleration = ToOmVector(acc);
331 pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f(); 331// pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f();
332 pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel); 332// pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel);
333 pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length(); 333// pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length();
334 334//
335 pe.ObjectFragment.Location = ToOmVector(pos); 335// pe.ObjectFragment.Location = ToOmVector(pos);
336 336//
337 pe.ObjectFragment.Mass = 1.0f; 337// pe.ObjectFragment.Mass = 1.0f;
338 pe.ObjectFragment.Orientation = ToOmQuaternion(rotation); 338// pe.ObjectFragment.Orientation = ToOmQuaternion(rotation);
339 pe.ObjectFragment.Velocity =ToOmVector(vel); 339// pe.ObjectFragment.Velocity =ToOmVector(vel);
340 340//
341 OmSlPrimitiveExt ext = new OmSlPrimitiveExt(); 341// OmSlPrimitiveExt ext = new OmSlPrimitiveExt();
342 342//
343 if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass))) 343// if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass)))
344 { 344// {
345 345//
346 ext.PathBegin = primShape.PathBegin; 346// ext.PathBegin = primShape.PathBegin;
347 ext.PathEnd = primShape.PathEnd; 347// ext.PathEnd = primShape.PathEnd;
348 ext.PathScaleX = primShape.PathScaleX; 348// ext.PathScaleX = primShape.PathScaleX;
349 ext.PathScaleY = primShape.PathScaleY; 349// ext.PathScaleY = primShape.PathScaleY;
350 ext.PathShearX = primShape.PathShearX; 350// ext.PathShearX = primShape.PathShearX;
351 ext.PathShearY = primShape.PathShearY; 351// ext.PathShearY = primShape.PathShearY;
352 ext.PathSkew = primShape.PathSkew; 352// ext.PathSkew = primShape.PathSkew;
353 ext.ProfileBegin = primShape.ProfileBegin; 353// ext.ProfileBegin = primShape.ProfileBegin;
354 ext.ProfileEnd = primShape.ProfileEnd; 354// ext.ProfileEnd = primShape.ProfileEnd;
355 ext.PathCurve = primShape.PathCurve; 355// ext.PathCurve = primShape.PathCurve;
356 ext.ProfileCurve = primShape.ProfileCurve; 356// ext.ProfileCurve = primShape.ProfileCurve;
357 ext.ProfileHollow = primShape.ProfileHollow; 357// ext.ProfileHollow = primShape.ProfileHollow;
358 ext.PathRadiusOffset = primShape.PathRadiusOffset; 358// ext.PathRadiusOffset = primShape.PathRadiusOffset;
359 ext.PathRevolutions = primShape.PathRevolutions; 359// ext.PathRevolutions = primShape.PathRevolutions;
360 ext.PathTaperX = primShape.PathTaperX; 360// ext.PathTaperX = primShape.PathTaperX;
361 ext.PathTaperY = primShape.PathTaperY; 361// ext.PathTaperY = primShape.PathTaperY;
362 ext.PathTwist = primShape.PathTwist; 362// ext.PathTwist = primShape.PathTwist;
363 ext.PathTwistBegin = primShape.PathTwistBegin; 363// ext.PathTwistBegin = primShape.PathTwistBegin;
364 364//
365 365//
366 } 366// }
367 367//
368 ext.UpdateFlags = flags; 368// ext.UpdateFlags = flags;
369 ext.ExtraParams = primShape.ExtraParams; 369// ext.ExtraParams = primShape.ExtraParams;
370 ext.State = primShape.State; 370// ext.State = primShape.State;
371 ext.TextureEntry = primShape.TextureEntry; 371// ext.TextureEntry = primShape.TextureEntry;
372 ext.TextureAnim = textureanim; 372// ext.TextureAnim = textureanim;
373 ext.Scale = ToOmVector(primShape.Scale); 373// ext.Scale = ToOmVector(primShape.Scale);
374 ext.Text = text; 374// ext.Text = text;
375 ext.TextColor = ToOmColor(textColor); 375// ext.TextColor = ToOmColor(textColor);
376 ext.PSBlock = particleSystem; 376// ext.PSBlock = particleSystem;
377 ext.ClickAction = clickAction; 377// ext.ClickAction = clickAction;
378 ext.Material = material; 378// ext.Material = material;
379 379//
380 pe.SetExtension<OmSlPrimitiveExt>(ext); 380// pe.SetExtension<OmSlPrimitiveExt>(ext);
381 381//
382 Session.Send(pe); 382// Session.Send(pe);
383 383//
384 if (m_objectsSynchronized != -1) 384// if (m_objectsSynchronized != -1)
385 { 385// {
386 m_objectsSynchronized++; 386// m_objectsSynchronized++;
387 387//
388 if (m_objectsToSynchronize >= m_objectsSynchronized) 388// if (m_objectsToSynchronize >= m_objectsSynchronized)
389 { 389// {
390 SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage(); 390// SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage();
391 Session.Send(synchronizationEndEventMessage); 391// Session.Send(synchronizationEndEventMessage);
392 m_objectsSynchronized = -1; 392// m_objectsSynchronized = -1;
393 } 393// }
394 } 394// }
395 } 395// }
396 396
397 public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation) 397 public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation)
398 { 398 {
diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
index 2098625..7056e01 100644
--- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
+++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Client.MXP.PacketHandler
63 private readonly IList<MXPClientView> m_sessionsToRemove = new List<MXPClientView>(); 63 private readonly IList<MXPClientView> m_sessionsToRemove = new List<MXPClientView>();
64 64
65 private readonly int m_port; 65 private readonly int m_port;
66 private readonly bool m_accountsAuthenticate; 66// private readonly bool m_accountsAuthenticate;
67 67
68 private readonly String m_programName; 68 private readonly String m_programName;
69 private readonly byte m_programMajorVersion; 69 private readonly byte m_programMajorVersion;
@@ -76,7 +76,7 @@ namespace OpenSim.Client.MXP.PacketHandler
76 public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes, bool accountsAuthenticate) 76 public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes, bool accountsAuthenticate)
77 { 77 {
78 m_port = port; 78 m_port = port;
79 m_accountsAuthenticate = accountsAuthenticate; 79// m_accountsAuthenticate = accountsAuthenticate;
80 80
81 m_scenes = scenes; 81 m_scenes = scenes;
82 82
@@ -491,7 +491,6 @@ namespace OpenSim.Client.MXP.PacketHandler
491 491
492 public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UserAccount account) 492 public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UserAccount account)
493 { 493 {
494 UUID userId = UUID.Zero;
495 string firstName = ""; 494 string firstName = "";
496 string lastName = ""; 495 string lastName = "";
497 account = null; 496 account = null;
diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
index 7ff8737..77b8a10 100644
--- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
@@ -638,9 +638,9 @@ ELSE
638 638
639 //Insert new values 639 //Insert new values
640 string sql = @"INSERT INTO [land] 640 string sql = @"INSERT INTO [land]
641([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime],[Dwell]) 641([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime])
642VALUES 642VALUES
643(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime,@Dwell)"; 643(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)";
644 644
645 using (SqlConnection conn = new SqlConnection(m_connectionString)) 645 using (SqlConnection conn = new SqlConnection(m_connectionString))
646 using (SqlCommand cmd = new SqlCommand(sql, conn)) 646 using (SqlCommand cmd = new SqlCommand(sql, conn))
@@ -954,7 +954,6 @@ VALUES
954 newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); 954 newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]);
955 955
956 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); 956 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
957 newData.Dwell = Convert.ToInt32(row["Dwell"]);
958 957
959 try 958 try
960 { 959 {
@@ -1357,7 +1356,6 @@ VALUES
1357 parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); 1356 parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z));
1358 parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); 1357 parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID));
1359 parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); 1358 parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime));
1360 parameters.Add(_Database.CreateParameter("Dwell", land.Dwell));
1361 1359
1362 return parameters.ToArray(); 1360 return parameters.ToArray();
1363 } 1361 }
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index 04446ce..30253c3 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -677,7 +677,7 @@ namespace OpenSim.Data.MySQL
677 "MusicURL, PassHours, PassPrice, SnapshotUUID, " + 677 "MusicURL, PassHours, PassPrice, SnapshotUUID, " +
678 "UserLocationX, UserLocationY, UserLocationZ, " + 678 "UserLocationX, UserLocationY, UserLocationZ, " +
679 "UserLookAtX, UserLookAtY, UserLookAtZ, " + 679 "UserLookAtX, UserLookAtY, UserLookAtZ, " +
680 "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + 680 "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " +
681 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + 681 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
682 "?UUID, ?RegionUUID, " + 682 "?UUID, ?RegionUUID, " +
683 "?LocalLandID, ?Bitmap, ?Name, ?Description, " + 683 "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
@@ -688,7 +688,7 @@ namespace OpenSim.Data.MySQL
688 "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + 688 "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " +
689 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + 689 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
690 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + 690 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
691 "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ 691 "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+
692 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; 692 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
693 693
694 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); 694 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
@@ -1329,7 +1329,6 @@ namespace OpenSim.Data.MySQL
1329 UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer); 1329 UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer);
1330 UUID.TryParse((string)row["SnapshotUUID"], out snapshotID); 1330 UUID.TryParse((string)row["SnapshotUUID"], out snapshotID);
1331 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); 1331 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
1332 newData.Dwell = Convert.ToInt32(row["Dwell"]);
1333 1332
1334 newData.AuthBuyerID = authedbuyer; 1333 newData.AuthBuyerID = authedbuyer;
1335 newData.SnapshotID = snapshotID; 1334 newData.SnapshotID = snapshotID;
@@ -1660,7 +1659,6 @@ namespace OpenSim.Data.MySQL
1660 cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z); 1659 cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z);
1661 cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); 1660 cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID);
1662 cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); 1661 cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime);
1663 cmd.Parameters.AddWithValue("Dwell", land.Dwell);
1664 cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription); 1662 cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription);
1665 cmd.Parameters.AddWithValue("MediaType", land.MediaType); 1663 cmd.Parameters.AddWithValue("MediaType", land.MediaType);
1666 cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth); 1664 cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth);
diff --git a/OpenSim/Data/SQLite/Resources/019_RegionStore.sql b/OpenSim/Data/SQLite/Resources/019_RegionStore.sql
deleted file mode 100644
index d62f848..0000000
--- a/OpenSim/Data/SQLite/Resources/019_RegionStore.sql
+++ /dev/null
@@ -1,5 +0,0 @@
1BEGIN;
2
3ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
4
5COMMIT; \ No newline at end of file
diff --git a/OpenSim/Data/SQLite/Resources/020_RegionStore.sql b/OpenSim/Data/SQLite/Resources/020_RegionStore.sql
deleted file mode 100644
index 39cb752..0000000
--- a/OpenSim/Data/SQLite/Resources/020_RegionStore.sql
+++ /dev/null
@@ -1,6 +0,0 @@
1BEGIN;
2
3ALTER TABLE prims ADD COLUMN MediaURL varchar(255);
4ALTER TABLE primshapes ADD COLUMN Media TEXT;
5
6COMMIT; \ No newline at end of file
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
index 0c421ec..5e2045b 100644
--- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
@@ -448,11 +448,22 @@ update land
448COMMIT; 448COMMIT;
449 449
450:VERSION 19 450:VERSION 19
451BEGIN ; 451BEGIN;
452ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none' ; 452ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
453COMMIT;
454
455:VERSION 20
456BEGIN;
457ALTER TABLE prims ADD COLUMN MediaURL varchar(255);
458ALTER TABLE primshapes ADD COLUMN Media TEXT;
459COMMIT;
460
461:VERSION 21
462BEGIN;
463ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none';
453ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT ''; 464ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT '';
454ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0'; 465ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0';
455ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE; 466ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE;
456ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE; 467ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE;
457ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE; 468ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE;
458COMMIT ; \ No newline at end of file 469COMMIT; \ No newline at end of file
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 8432e74..88699a7 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -1111,7 +1111,6 @@ namespace OpenSim.Data.SQLite
1111 createCol(land, "UserLookAtZ", typeof (Double)); 1111 createCol(land, "UserLookAtZ", typeof (Double));
1112 createCol(land, "AuthbuyerID", typeof(String)); 1112 createCol(land, "AuthbuyerID", typeof(String));
1113 createCol(land, "OtherCleanTime", typeof(Int32)); 1113 createCol(land, "OtherCleanTime", typeof(Int32));
1114 createCol(land, "Dwell", typeof(Int32));
1115 1114
1116 land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; 1115 land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
1117 1116
@@ -1449,7 +1448,6 @@ namespace OpenSim.Data.SQLite
1449 UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); 1448 UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
1450 1449
1451 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); 1450 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
1452 newData.Dwell = Convert.ToInt32(row["Dwell"]);
1453 1451
1454 return newData; 1452 return newData;
1455 } 1453 }
@@ -1761,7 +1759,6 @@ namespace OpenSim.Data.SQLite
1761 row["UserLookAtZ"] = land.UserLookAt.Z; 1759 row["UserLookAtZ"] = land.UserLookAt.Z;
1762 row["AuthbuyerID"] = land.AuthBuyerID.ToString(); 1760 row["AuthbuyerID"] = land.AuthBuyerID.ToString();
1763 row["OtherCleanTime"] = land.OtherCleanTime; 1761 row["OtherCleanTime"] = land.OtherCleanTime;
1764 row["Dwell"] = land.Dwell;
1765 row["MediaType"] = land.MediaType; 1762 row["MediaType"] = land.MediaType;
1766 row["MediaDescription"] = land.MediaDescription; 1763 row["MediaDescription"] = land.MediaDescription;
1767 row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); 1764 row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
index 289fd94..b5ce4c0 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
@@ -1069,7 +1069,6 @@ namespace OpenSim.Data.SQLiteLegacy
1069 createCol(land, "UserLookAtZ", typeof (Double)); 1069 createCol(land, "UserLookAtZ", typeof (Double));
1070 createCol(land, "AuthbuyerID", typeof(String)); 1070 createCol(land, "AuthbuyerID", typeof(String));
1071 createCol(land, "OtherCleanTime", typeof(Int32)); 1071 createCol(land, "OtherCleanTime", typeof(Int32));
1072 createCol(land, "Dwell", typeof(Int32));
1073 1072
1074 land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; 1073 land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
1075 1074
@@ -1400,7 +1399,6 @@ namespace OpenSim.Data.SQLiteLegacy
1400 UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); 1399 UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
1401 1400
1402 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); 1401 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
1403 newData.Dwell = Convert.ToInt32(row["Dwell"]);
1404 1402
1405 return newData; 1403 return newData;
1406 } 1404 }
@@ -1711,7 +1709,6 @@ namespace OpenSim.Data.SQLiteLegacy
1711 row["UserLookAtZ"] = land.UserLookAt.Z; 1709 row["UserLookAtZ"] = land.UserLookAt.Z;
1712 row["AuthbuyerID"] = land.AuthBuyerID.ToString(); 1710 row["AuthbuyerID"] = land.AuthBuyerID.ToString();
1713 row["OtherCleanTime"] = land.OtherCleanTime; 1711 row["OtherCleanTime"] = land.OtherCleanTime;
1714 row["Dwell"] = land.Dwell;
1715 } 1712 }
1716 1713
1717 /// <summary> 1714 /// <summary>
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index 4440c94..5bb0413 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -88,7 +88,6 @@ namespace OpenSim.Framework
88 private UUID _snapshotID = UUID.Zero; 88 private UUID _snapshotID = UUID.Zero;
89 private Vector3 _userLocation = new Vector3(); 89 private Vector3 _userLocation = new Vector3();
90 private Vector3 _userLookAt = new Vector3(); 90 private Vector3 _userLookAt = new Vector3();
91 private int _dwell = 0;
92 private int _otherCleanTime = 0; 91 private int _otherCleanTime = 0;
93 private string _mediaType = "none/none"; 92 private string _mediaType = "none/none";
94 private string _mediaDescription = ""; 93 private string _mediaDescription = "";
@@ -620,18 +619,6 @@ namespace OpenSim.Framework
620 } 619 }
621 620
622 /// <summary> 621 /// <summary>
623 /// Deprecated idea. Number of visitors ~= free money
624 /// </summary>
625 public int Dwell {
626 get {
627 return _dwell;
628 }
629 set {
630 _dwell = value;
631 }
632 }
633
634 /// <summary>
635 /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own 622 /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
636 /// the parcel and isn't set to the same 'group' as the parcel. 623 /// the parcel and isn't set to the same 'group' as the parcel.
637 /// </summary> 624 /// </summary>
@@ -703,7 +690,6 @@ namespace OpenSim.Framework
703 landData._userLocation = _userLocation; 690 landData._userLocation = _userLocation;
704 landData._userLookAt = _userLookAt; 691 landData._userLookAt = _userLookAt;
705 landData._otherCleanTime = _otherCleanTime; 692 landData._otherCleanTime = _otherCleanTime;
706 landData._dwell = _dwell;
707 landData._mediaType = _mediaType; 693 landData._mediaType = _mediaType;
708 landData._mediaDescription = _mediaDescription; 694 landData._mediaDescription = _mediaDescription;
709 landData._mediaWidth = _mediaWidth; 695 landData._mediaWidth = _mediaWidth;
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index ec25118..e36a72b 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -806,7 +806,7 @@ namespace OpenSim.Framework
806 IConfig config = source.Configs[RegionName]; 806 IConfig config = source.Configs[RegionName];
807 807
808 if (config != null) 808 if (config != null)
809 source.Configs.Remove(RegionName); 809 source.Configs.Remove(config);
810 810
811 config = source.AddConfig(RegionName); 811 config = source.AddConfig(RegionName);
812 812
@@ -865,10 +865,15 @@ namespace OpenSim.Framework
865 865
866 return; 866 return;
867 } 867 }
868 configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, 868 else if (filename.ToLower().EndsWith(".xml"))
869 ignoreIncomingConfiguration, false); 869 {
870 configMember.performConfigurationRetrieve(); 870 configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
871 RegionFile = filename; 871 ignoreIncomingConfiguration, false);
872 configMember.performConfigurationRetrieve();
873 RegionFile = filename;
874 }
875 else
876 throw new Exception("Invalid file type for region persistence.");
872 } 877 }
873 878
874 public void loadConfigurationOptionsFromMe() 879 public void loadConfigurationOptionsFromMe()
diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
index ff0afc8..fc0387b 100644
--- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
@@ -118,7 +118,8 @@ namespace OpenSim.Framework.Serialization.External
118 landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID")); 118 landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID"));
119 landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation")); 119 landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation"));
120 landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt")); 120 landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt"));
121 landData.Dwell = Convert.ToInt32( xtr.ReadElementString("Dwell")); 121 // No longer used here
122 xtr.ReadElementString("Dwell");
122 landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime")); 123 landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime"));
123 124
124 xtr.ReadEndElement(); 125 xtr.ReadEndElement();
@@ -177,7 +178,7 @@ namespace OpenSim.Framework.Serialization.External
177 xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); 178 xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString());
178 xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); 179 xtw.WriteElementString("UserLocation", landData.UserLocation.ToString());
179 xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); 180 xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString());
180 xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell)); 181 xtw.WriteElementString("Dwell", "0");
181 xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime)); 182 xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime));
182 183
183 xtw.WriteEndElement(); 184 xtw.WriteEndElement();
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 016ab73..d20f8c9 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Collections.Specialized;
31using System.IO; 32using System.IO;
32using System.Net; 33using System.Net;
33using System.Net.Sockets; 34using System.Net.Sockets;
@@ -338,19 +339,25 @@ namespace OpenSim.Framework.Servers.HttpServer
338 // HandleRequest(request,resp); 339 // HandleRequest(request,resp);
339 // } 340 // }
340 341
342 /// <summary>
343 /// This methods is the start of incoming HTTP request handling.
344 /// </summary>
345 /// <param name="request"></param>
346 /// <param name="response"></param>
341 public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) 347 public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response)
342 { 348 {
343 try 349 try
344 { 350 {
351// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
352
345 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); 353 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
354
346 // This is the REST agent interface. We require an agent to properly identify 355 // This is the REST agent interface. We require an agent to properly identify
347 // itself. If the REST handler recognizes the prefix it will attempt to 356 // itself. If the REST handler recognizes the prefix it will attempt to
348 // satisfy the request. If it is not recognizable, and no damage has occurred 357 // satisfy the request. If it is not recognizable, and no damage has occurred
349 // the request can be passed through to the other handlers. This is a low 358 // the request can be passed through to the other handlers. This is a low
350 // probability event; if a request is matched it is normally expected to be 359 // probability event; if a request is matched it is normally expected to be
351 // handled 360 // handled
352// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
353
354 IHttpAgentHandler agentHandler; 361 IHttpAgentHandler agentHandler;
355 362
356 if (TryGetAgentHandler(request, response, out agentHandler)) 363 if (TryGetAgentHandler(request, response, out agentHandler))
@@ -731,6 +738,7 @@ namespace OpenSim.Framework.Servers.HttpServer
731 if (methodWasFound) 738 if (methodWasFound)
732 { 739 {
733 xmlRprcRequest.Params.Add(request.Url); // Param[2] 740 xmlRprcRequest.Params.Add(request.Url); // Param[2]
741 xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3]
734 742
735 try 743 try
736 { 744 {
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
index f955df7..41ece86 100644
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
+++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
@@ -57,80 +57,73 @@ namespace OpenSim.Framework.Servers.HttpServer
57 { 57 {
58 WebRequest request = WebRequest.Create(requestUrl); 58 WebRequest request = WebRequest.Create(requestUrl);
59 request.Method = verb; 59 request.Method = verb;
60 string respstring = String.Empty;
60 61
61 if ((verb == "POST") || (verb == "PUT")) 62 using (MemoryStream buffer = new MemoryStream())
62 { 63 {
63 request.ContentType = "text/www-form-urlencoded"; 64 if ((verb == "POST") || (verb == "PUT"))
64
65 MemoryStream buffer = new MemoryStream();
66 int length = 0;
67 using (StreamWriter writer = new StreamWriter(buffer))
68 { 65 {
69 writer.Write(obj); 66 request.ContentType = "text/www-form-urlencoded";
70 writer.Flush();
71 }
72 67
73 length = (int)obj.Length; 68 int length = 0;
74 request.ContentLength = length; 69 using (StreamWriter writer = new StreamWriter(buffer))
70 {
71 writer.Write(obj);
72 writer.Flush();
73 }
75 74
76 Stream requestStream = null; 75 length = (int)obj.Length;
77 try 76 request.ContentLength = length;
78 {
79 requestStream = request.GetRequestStream();
80 requestStream.Write(buffer.ToArray(), 0, length);
81 }
82 catch (Exception e)
83 {
84 m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
85 }
86 finally
87 {
88 // If this is closed, it will be disposed internally,
89 // but the above write is asynchronous and may hit after
90 // we're through here. So the thread handling that will
91 // throw and put us back into the catch above. Isn't
92 // .NET great?
93 //if (requestStream != null)
94 // requestStream.Close();
95 // Let's not close this
96 //buffer.Close();
97 77
78 Stream requestStream = null;
79 try
80 {
81 requestStream = request.GetRequestStream();
82 requestStream.Write(buffer.ToArray(), 0, length);
83 }
84 catch (Exception e)
85 {
86 m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
87 }
88 finally
89 {
90 if (requestStream != null)
91 requestStream.Close();
92 }
98 } 93 }
99 }
100
101 string respstring = String.Empty;
102 94
103 try 95 try
104 {
105 using (WebResponse resp = request.GetResponse())
106 { 96 {
107 if (resp.ContentLength != 0) 97 using (WebResponse resp = request.GetResponse())
108 { 98 {
109 Stream respStream = null; 99 if (resp.ContentLength != 0)
110 try
111 { 100 {
112 respStream = resp.GetResponseStream(); 101 Stream respStream = null;
113 using (StreamReader reader = new StreamReader(respStream)) 102 try
114 { 103 {
115 respstring = reader.ReadToEnd(); 104 respStream = resp.GetResponseStream();
105 using (StreamReader reader = new StreamReader(respStream))
106 {
107 respstring = reader.ReadToEnd();
108 }
109 }
110 catch (Exception e)
111 {
112 m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
113 }
114 finally
115 {
116 if (respStream != null)
117 respStream.Close();
116 } 118 }
117 }
118 catch (Exception e)
119 {
120 m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
121 }
122 finally
123 {
124 if (respStream != null)
125 respStream.Close();
126 } 119 }
127 } 120 }
128 } 121 }
129 } 122 catch (System.InvalidOperationException)
130 catch (System.InvalidOperationException) 123 {
131 { 124 // This is what happens when there is invalid XML
132 // This is what happens when there is invalid XML 125 m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
133 m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); 126 }
134 } 127 }
135 return respstring; 128 return respstring;
136 } 129 }
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index af5a0ce..b66d826 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1495,5 +1495,49 @@ namespace OpenSim.Framework
1495 } 1495 }
1496 } 1496 }
1497 1497
1498 /// <summary>
1499 /// Gets the client IP address
1500 /// </summary>
1501 /// <param name="xff"></param>
1502 /// <returns></returns>
1503 public static IPEndPoint GetClientIPFromXFF(string xff)
1504 {
1505 if (xff == string.Empty)
1506 return null;
1507
1508 string[] parts = xff.Split(new char[] { ',' });
1509 if (parts.Length > 0)
1510 {
1511 try
1512 {
1513 return new IPEndPoint(IPAddress.Parse(parts[0]), 0);
1514 }
1515 catch (Exception e)
1516 {
1517 m_log.WarnFormat("[UTIL]: Exception parsing XFF header {0}: {1}", xff, e.Message);
1518 }
1519 }
1520
1521 return null;
1522 }
1523
1524 public static string GetCallerIP(Hashtable req)
1525 {
1526 if (req.ContainsKey("headers"))
1527 {
1528 try
1529 {
1530 Hashtable headers = (Hashtable)req["headers"];
1531 if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null)
1532 return headers["remote_addr"].ToString();
1533 }
1534 catch (Exception e)
1535 {
1536 m_log.WarnFormat("[UTIL]: exception in GetCallerIP: {0}", e.Message);
1537 }
1538 }
1539 return string.Empty;
1540 }
1541
1498 } 1542 }
1499} 1543}
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 072e4d3..945da7d 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -218,7 +218,13 @@ namespace OpenSim
218 218
219 m_console.Commands.AddCommand("region", false, "debug packet", 219 m_console.Commands.AddCommand("region", false, "debug packet",
220 "debug packet <level>", 220 "debug packet <level>",
221 "Turn on packet debugging", Debug); 221 "Turn on packet debugging",
222 "If level > 255 then all incoming and outgoing packets are logged.\n"
223 + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
224 + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
225 + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
226 + "If level <= 0 then no packets are logged.",
227 Debug);
222 228
223 m_console.Commands.AddCommand("region", false, "debug scene", 229 m_console.Commands.AddCommand("region", false, "debug scene",
224 "debug scene <cripting> <collisions> <physics>", 230 "debug scene <cripting> <collisions> <physics>",
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 4ef0b1b..ec3193c 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -36,7 +36,6 @@ using Nini.Config;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39
40using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
41using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
42using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
@@ -403,7 +402,9 @@ namespace OpenSim
403 } 402 }
404 catch (Exception e) 403 catch (Exception e)
405 { 404 {
406 m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e.StackTrace); 405 m_log.ErrorFormat(
406 "[STARTUP]: Registration of region with grid failed, aborting startup due to {0} {1}",
407 e.Message, e.StackTrace);
407 408
408 if (scene.SnmpService != null) 409 if (scene.SnmpService != null)
409 { 410 {
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index aa7de05..3dea40c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
60 public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector 60 public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector
61 { 61 {
62 /// <value> 62 /// <value>
63 /// Debug packet level. At the moment, only 255 does anything (prints out all in and out packets). 63 /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details.
64 /// </value> 64 /// </value>
65 protected int m_debugPacketLevel = 0; 65 protected int m_debugPacketLevel = 0;
66 66
@@ -2687,6 +2687,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2687 2687
2688 public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) 2688 public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
2689 { 2689 {
2690 float dwell = 0.0f;
2691 IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
2692 if (dwellModule != null)
2693 dwell = dwellModule.GetDwell(land.GlobalID);
2690 ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); 2694 ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply);
2691 reply.AgentData.AgentID = m_agentId; 2695 reply.AgentData.AgentID = m_agentId;
2692 reply.Data.ParcelID = parcelID; 2696 reply.Data.ParcelID = parcelID;
@@ -2711,7 +2715,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2711 reply.Data.GlobalZ = pos.Z; 2715 reply.Data.GlobalZ = pos.Z;
2712 reply.Data.SimName = Utils.StringToBytes(info.RegionName); 2716 reply.Data.SimName = Utils.StringToBytes(info.RegionName);
2713 reply.Data.SnapshotID = land.SnapshotID; 2717 reply.Data.SnapshotID = land.SnapshotID;
2714 reply.Data.Dwell = land.Dwell; 2718 reply.Data.Dwell = dwell;
2715 reply.Data.SalePrice = land.SalePrice; 2719 reply.Data.SalePrice = land.SalePrice;
2716 reply.Data.AuctionID = (int)land.AuctionID; 2720 reply.Data.AuctionID = (int)land.AuctionID;
2717 2721
@@ -11229,8 +11233,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11229 /// handles splitting manually</param> 11233 /// handles splitting manually</param>
11230 protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) 11234 protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting)
11231 { 11235 {
11232 if (m_debugPacketLevel >= 255) 11236 if (m_debugPacketLevel > 0)
11233 m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); 11237 {
11238 bool outputPacket = true;
11239
11240 if (m_debugPacketLevel <= 255
11241 && (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage))
11242 outputPacket = false;
11243
11244 if (m_debugPacketLevel <= 200
11245 &&
11246 (packet.Type == PacketType.ImagePacket
11247 || packet.Type == PacketType.ImageData
11248 || packet.Type == PacketType.LayerData
11249 || packet.Type == PacketType.CoarseLocationUpdate))
11250 outputPacket = false;
11251
11252 if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect))
11253 outputPacket = false;
11254
11255 if (outputPacket)
11256 m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type);
11257 }
11234 11258
11235 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); 11259 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting);
11236 } 11260 }
@@ -11316,26 +11340,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11316 /// Entryway from the client to the simulator. All UDP packets from the client will end up here 11340 /// Entryway from the client to the simulator. All UDP packets from the client will end up here
11317 /// </summary> 11341 /// </summary>
11318 /// <param name="Pack">OpenMetaverse.packet</param> 11342 /// <param name="Pack">OpenMetaverse.packet</param>
11319 public void ProcessInPacket(Packet Pack) 11343 public void ProcessInPacket(Packet packet)
11320 { 11344 {
11321 if (!m_IsPresenceReady) 11345 if (m_debugPacketLevel > 0)
11322 { 11346 {
11323 if (m_pendingPackets == null) 11347 bool outputPacket = true;
11324 { 11348
11325 m_pendingPackets = new List<Packet>(); 11349 if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate)
11326 } 11350 outputPacket = false;
11327 m_pendingPackets.Add(Pack); 11351
11352 if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage)
11353 outputPacket = false;
11354
11355 if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation))
11356 outputPacket = false;
11357
11358 if (outputPacket)
11359 m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type);
11328 } 11360 }
11329 else
11330 {
11331 if (m_debugPacketLevel >= 255)
11332 m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type);
11333 11361
11334 if (!ProcessPacketMethod(Pack)) 11362 if (!ProcessPacketMethod(packet))
11335 m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); 11363 m_log.Warn("[CLIENT]: unhandled packet " + packet.Type);
11336 11364
11337 PacketPool.Instance.ReturnPacket(Pack); 11365 PacketPool.Instance.ReturnPacket(packet);
11338 }
11339 } 11366 }
11340 11367
11341 private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) 11368 private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket)
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index c791cb4..4609738 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -214,8 +214,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
214 { 214 {
215 m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); 215 m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
216 216
217 IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService;
218
219 InventoryItemBase item = new InventoryItemBase(); 217 InventoryItemBase item = new InventoryItemBase();
220 item.Owner = ourClient.AgentId; 218 item.Owner = ourClient.AgentId;
221 item.CreatorId = ourClient.AgentId.ToString(); 219 item.CreatorId = ourClient.AgentId.ToString();
@@ -234,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
234 item.Flags = (uint) wearableType; 232 item.Flags = (uint) wearableType;
235 item.CreationDate = Util.UnixTimeSinceEpoch(); 233 item.CreationDate = Util.UnixTimeSinceEpoch();
236 234
237 if (invService.AddItem(item)) 235 if (m_userTransactions.Manager.MyScene.AddInventoryItem(item))
238 ourClient.SendInventoryItemCreateUpdate(item, callbackID); 236 ourClient.SendInventoryItemCreateUpdate(item, callbackID);
239 else 237 else
240 ourClient.SendAlertMessage("Unable to create inventory item"); 238 ourClient.SendAlertMessage("Unable to create inventory item");
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 38152cc..100b55c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -174,16 +174,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
174 UUID itemID = UUID.Zero; 174 UUID itemID = UUID.Zero;
175 if (sp != null) 175 if (sp != null)
176 { 176 {
177 foreach(SceneObjectGroup grp in sp.Attachments) 177 foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt))
178 { 178 {
179 if (grp.GetAttachmentPoint() == (byte)AttachmentPt) 179 itemID = grp.GetFromItemID();
180 { 180 if (itemID != UUID.Zero)
181 itemID = grp.GetFromItemID(); 181 DetachSingleAttachmentToInv(itemID, remoteClient);
182 break; 182 }
183 }
184 }
185 if (itemID != UUID.Zero)
186 DetachSingleAttachmentToInv(itemID, remoteClient);
187 } 183 }
188 184
189 if (group.GetFromItemID() == UUID.Zero) 185 if (group.GetFromItemID() == UUID.Zero)
@@ -197,12 +193,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
197 193
198 SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group); 194 SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group);
199 195
200 group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); 196 AttachToAgent(sp, group, AttachmentPt, attachPos, silent);
201
202 // In case it is later dropped again, don't let
203 // it get cleaned up
204 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
205 group.HasGroupChanged = false;
206 } 197 }
207 else 198 else
208 { 199 {
@@ -280,8 +271,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
280 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) 271 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
281 tainted = true; 272 tainted = true;
282 273
283 AttachObject(remoteClient, objatt, AttachmentPt, false); 274 // This will throw if the attachment fails
284 //objatt.ScheduleGroupForFullUpdate(); 275 try
276 {
277 AttachObject(remoteClient, objatt, AttachmentPt, false);
278 }
279 catch
280 {
281 // Make sure the object doesn't stick around and bail
282 m_scene.DeleteSceneObject(objatt, false);
283 return null;
284 }
285 285
286 if (tainted) 286 if (tainted)
287 objatt.HasGroupChanged = true; 287 objatt.HasGroupChanged = true;
@@ -551,6 +551,78 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
551 remoteClient.SendInventoryItemCreateUpdate(item, 0); 551 remoteClient.SendInventoryItemCreateUpdate(item, 0);
552 } 552 }
553 } 553 }
554 } 554 }
555
556 /// <summary>
557 /// Attach this scene object to the given avatar.
558 /// </summary>
559 ///
560 /// This isn't publicly available since attachments should always perform the corresponding inventory
561 /// operation (to show the attach in user inventory and update the asset with positional information).
562 ///
563 /// <param name="sp"></param>
564 /// <param name="so"></param>
565 /// <param name="attachmentpoint"></param>
566 /// <param name="AttachOffset"></param>
567 /// <param name="silent"></param>
568 protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 AttachOffset, bool silent)
569 {
570 // don't attach attachments to child agents
571 if (avatar.IsChildAgent) return;
572
573// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name);
574
575 so.DetachFromBackup();
576
577 // Remove from database and parcel prim count
578 m_scene.DeleteFromStorage(so.UUID);
579 m_scene.EventManager.TriggerParcelPrimCountTainted();
580
581 so.RootPart.AttachedAvatar = avatar.UUID;
582
583 //Anakin Lohner bug #3839
584 lock (so.Children)
585 {
586 foreach (SceneObjectPart p in so.Children.Values)
587 {
588 p.AttachedAvatar = avatar.UUID;
589 }
590 }
591
592 if (so.RootPart.PhysActor != null)
593 {
594 m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
595 so.RootPart.PhysActor = null;
596 }
597
598 so.AbsolutePosition = AttachOffset;
599 so.RootPart.AttachedPos = AttachOffset;
600 so.RootPart.IsAttachment = true;
601
602 so.RootPart.SetParentLocalId(avatar.LocalId);
603 so.SetAttachmentPoint(Convert.ToByte(attachmentpoint));
604
605 avatar.AddAttachment(so);
606
607 if (!silent)
608 {
609 // Killing it here will cause the client to deselect it
610 // It then reappears on the avatar, deselected
611 // through the full update below
612 //
613 if (so.IsSelected)
614 {
615 m_scene.SendKillObject(so.RootPart.LocalId);
616 }
617
618 so.IsSelected = false; // fudge....
619 so.ScheduleGroupForFullUpdate();
620 }
621
622 // In case it is later dropped again, don't let
623 // it get cleaned up
624 so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
625 so.HasGroupChanged = false;
626 }
555 } 627 }
556} \ No newline at end of file 628}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 22c84e9..52342ec 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -406,8 +406,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
406 // Reset folder ID to the one in which we want to load it 406 // Reset folder ID to the one in which we want to load it
407 item.Folder = loadFolder.ID; 407 item.Folder = loadFolder.ID;
408 408
409 //m_userInfo.AddItem(item); 409 m_scene.AddInventoryItem(item);
410 m_scene.InventoryService.AddItem(item);
411 410
412 return item; 411 return item;
413 } 412 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index 8343091..47e34dc 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
41 /// </summary> 41 /// </summary>
42 public static class InventoryArchiveUtils 42 public static class InventoryArchiveUtils
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings 46 // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings
47 public static readonly char ESCAPE_CHARACTER = '\\'; 47 public static readonly char ESCAPE_CHARACTER = '\\';
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 0218f86..d66a1d0 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -163,7 +163,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
163 InventoryFolderBase objsFolder 163 InventoryFolderBase objsFolder
164 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; 164 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
165 item1.Folder = objsFolder.ID; 165 item1.Folder = objsFolder.ID;
166 scene.AddInventoryItem(userId, item1); 166 scene.AddInventoryItem(item1);
167 167
168 MemoryStream archiveWriteStream = new MemoryStream(); 168 MemoryStream archiveWriteStream = new MemoryStream();
169 archiverModule.OnInventoryArchiveSaved += SaveCompleted; 169 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
@@ -282,7 +282,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
282 InventoryFolderBase objsFolder 282 InventoryFolderBase objsFolder
283 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; 283 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
284 item1.Folder = objsFolder.ID; 284 item1.Folder = objsFolder.ID;
285 scene.AddInventoryItem(userId, item1); 285 scene.AddInventoryItem(item1);
286 286
287 MemoryStream archiveWriteStream = new MemoryStream(); 287 MemoryStream archiveWriteStream = new MemoryStream();
288 archiverModule.OnInventoryArchiveSaved += SaveCompleted; 288 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
@@ -485,7 +485,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
485 InventoryFolderBase objsFolder 485 InventoryFolderBase objsFolder
486 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; 486 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
487 item1.Folder = objsFolder.ID; 487 item1.Folder = objsFolder.ID;
488 scene.AddInventoryItem(userId, item1); 488 scene.AddInventoryItem(item1);
489 489
490 MemoryStream archiveWriteStream = new MemoryStream(); 490 MemoryStream archiveWriteStream = new MemoryStream();
491 archiverModule.OnInventoryArchiveSaved += SaveCompleted; 491 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
index 6294935..b62df18 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
@@ -54,12 +54,12 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
54 }; 54 };
55 } 55 }
56 56
57 private static byte[] uintToByteArray(uint uIntValue) 57// private static byte[] uintToByteArray(uint uIntValue)
58 { 58// {
59 byte[] result = new byte[4]; 59// byte[] result = new byte[4];
60 Utils.UIntToBytesBig(uIntValue, result, 0); 60// Utils.UIntToBytesBig(uIntValue, result, 0);
61 return result; 61// return result;
62 } 62// }
63 63
64 public static OSD buildEvent(string eventName, OSD eventBody) 64 public static OSD buildEvent(string eventName, OSD eventBody)
65 { 65 {
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index c673b31..125a397 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
132 } 132 }
133 133
134 // DO NOT OVERRIDE THE BASE METHOD 134 // DO NOT OVERRIDE THE BASE METHOD
135 public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, 135 public new virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
136 SceneObjectGroup objectGroup, IClientAPI remoteClient) 136 SceneObjectGroup objectGroup, IClientAPI remoteClient)
137 { 137 {
138 UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient); 138 UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient);
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 4159610..37f6ea0 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -430,7 +430,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
430 item.Name = asset.Name; 430 item.Name = asset.Name;
431 item.AssetType = asset.Type; 431 item.AssetType = asset.Type;
432 432
433 m_Scene.InventoryService.AddItem(item); 433 m_Scene.AddInventoryItem(item);
434 434
435 if (remoteClient != null && item.Owner == remoteClient.AgentId) 435 if (remoteClient != null && item.Owner == remoteClient.AgentId)
436 { 436 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 97161fc..5b4fecb 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 915b59e..cbd9e05 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -221,34 +221,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
221// m_log.DebugFormat( 221// m_log.DebugFormat(
222// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", 222// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
223// item.Name, item.Owner, item.Folder); 223// item.Name, item.Owner, item.Folder);
224
225 if (UUID.Zero == item.Folder)
226 {
227 InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
228 if (f != null)
229 {
230// m_log.DebugFormat(
231// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}",
232// f.Name, (AssetType)f.Type, item.Name);
233
234 item.Folder = f.ID;
235 }
236 else
237 {
238 f = m_InventoryService.GetRootFolder(item.Owner);
239 if (f != null)
240 {
241 item.Folder = f.ID;
242 }
243 else
244 {
245// m_log.WarnFormat(
246// "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
247// item.Owner, item.Name);
248 return false;
249 }
250 }
251 }
252 224
253 return m_InventoryService.AddItem(item); 225 return m_InventoryService.AddItem(item);
254 } 226 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index 4211fa9..4ab6947 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -227,31 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
227 public bool AddItem(InventoryItemBase item) 227 public bool AddItem(InventoryItemBase item)
228 { 228 {
229 if (item == null) 229 if (item == null)
230 return false; 230 return false;
231
232 if (UUID.Zero == item.Folder)
233 {
234 InventoryFolderBase f = m_RemoteConnector.GetFolderForType(item.Owner, (AssetType)item.AssetType);
235 if (f != null)
236 {
237 item.Folder = f.ID;
238 }
239 else
240 {
241 f = m_RemoteConnector.GetRootFolder(item.Owner);
242 if (f != null)
243 {
244 item.Folder = f.ID;
245 }
246 else
247 {
248 m_log.WarnFormat(
249 "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
250 item.Owner, item.Name);
251 return false;
252 }
253 }
254 }
255 231
256 return m_RemoteConnector.AddItem(item); 232 return m_RemoteConnector.AddItem(item);
257 } 233 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 776fe30..f62ec1b 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -171,7 +171,6 @@ namespace OpenSim.Region.CoreModules.World.Land
171 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; 171 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner;
172 client.OnParcelReclaim += ClientOnParcelReclaim; 172 client.OnParcelReclaim += ClientOnParcelReclaim;
173 client.OnParcelInfoRequest += ClientOnParcelInfoRequest; 173 client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
174// client.OnParcelDwellRequest += ClientOnParcelDwellRequest;
175 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; 174 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
176 client.OnPreAgentUpdate += ClientOnPreAgentUpdate; 175 client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
177 176
@@ -1116,7 +1115,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1116 m_landList.TryGetValue(localID, out land); 1115 m_landList.TryGetValue(localID, out land);
1117 } 1116 }
1118 1117
1119 if (land != null) land.UpdateLandProperties(args, remote_client); 1118 if (land != null)
1119 {
1120 land.UpdateLandProperties(args, remote_client);
1121 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client);
1122 }
1120 } 1123 }
1121 1124
1122 public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) 1125 public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client)
@@ -1434,9 +1437,13 @@ namespace OpenSim.Region.CoreModules.World.Land
1434 m_landList.TryGetValue(parcelID, out land); 1437 m_landList.TryGetValue(parcelID, out land);
1435 } 1438 }
1436 1439
1437 if (land != null) { 1440 if (land != null)
1441 {
1438 land.UpdateLandProperties(land_update, client); 1442 land.UpdateLandProperties(land_update, client);
1439 } else { 1443 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client);
1444 }
1445 else
1446 {
1440 m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); 1447 m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
1441 } 1448 }
1442 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); 1449 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
@@ -1512,18 +1519,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1512 1519
1513 #endregion 1520 #endregion
1514 1521
1515 private void ClientOnParcelDwellRequest(int localID, IClientAPI remoteClient)
1516 {
1517 ILandObject selectedParcel = null;
1518 lock (m_landList)
1519 {
1520 if (!m_landList.TryGetValue(localID, out selectedParcel))
1521 return;
1522 }
1523
1524 remoteClient.SendParcelDwellReply(localID, selectedParcel.LandData.GlobalID, selectedParcel.LandData.Dwell);
1525 }
1526
1527 private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID) 1522 private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID)
1528 { 1523 {
1529 if (parcelID == UUID.Zero) 1524 if (parcelID == UUID.Zero)
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 8ce6daf..12750c5 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
219 item.CurrentPermissions |= 16; // Slam! 219 item.CurrentPermissions |= 16; // Slam!
220 item.CreationDate = Util.UnixTimeSinceEpoch(); 220 item.CreationDate = Util.UnixTimeSinceEpoch();
221 221
222 if (m_scene.InventoryService.AddItem(item)) 222 if (m_scene.AddInventoryItem(item))
223 { 223 {
224 remoteClient.SendInventoryItemCreateUpdate(item, 0); 224 remoteClient.SendInventoryItemCreateUpdate(item, 0);
225 } 225 }
diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/DataSnapshot/LandSnapshot.cs
index 64d29f2..b8c90cd 100644
--- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/LandSnapshot.cs
@@ -123,6 +123,8 @@ namespace OpenSim.Region.DataSnapshot.Providers
123 ILandChannel landChannel = m_scene.LandChannel; 123 ILandChannel landChannel = m_scene.LandChannel;
124 List<ILandObject> parcels = landChannel.AllParcels(); 124 List<ILandObject> parcels = landChannel.AllParcels();
125 125
126 IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
127
126 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); 128 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", "");
127 if (parcels != null) 129 if (parcels != null)
128 { 130 {
@@ -208,7 +210,10 @@ namespace OpenSim.Region.DataSnapshot.Providers
208 xmlparcel.AppendChild(infouuid); 210 xmlparcel.AppendChild(infouuid);
209 211
210 XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", ""); 212 XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", "");
211 dwell.InnerText = parcel.Dwell.ToString(); 213 if (dwellModule != null)
214 dwell.InnerText = dwellModule.GetDwell(parcel.GlobalID).ToString();
215 else
216 dwell.InnerText = "0";
212 xmlparcel.AppendChild(dwell); 217 xmlparcel.AppendChild(dwell);
213 218
214 //TODO: figure how to figure out teleport system landData.landingType 219 //TODO: figure how to figure out teleport system landData.landingType
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 52e6e92..d4e2736 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -113,6 +113,8 @@ namespace OpenSim.Region.Framework.Scenes
113 113
114 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; 114 public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
115 115
116 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
117
116 /// <summary> 118 /// <summary>
117 /// Fired when an object is touched/grabbed. 119 /// Fired when an object is touched/grabbed.
118 /// </summary> 120 /// </summary>
@@ -2128,5 +2130,27 @@ namespace OpenSim.Region.Framework.Scenes
2128 } 2130 }
2129 } 2131 }
2130 } 2132 }
2133
2134 public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
2135 int local_id, IClientAPI remote_client)
2136 {
2137 ParcelPropertiesUpdateRequest handler = OnParcelPropertiesUpdateRequest;
2138 if (handler != null)
2139 {
2140 foreach (ParcelPropertiesUpdateRequest d in handler.GetInvocationList())
2141 {
2142 try
2143 {
2144 d(args, local_id, remote_client);
2145 }
2146 catch (Exception e)
2147 {
2148 m_log.ErrorFormat(
2149 "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}",
2150 e.Message, e.StackTrace);
2151 }
2152 }
2153 }
2154 }
2131 } 2155 }
2132} \ No newline at end of file 2156}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 0d9682e..5ee8955 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -70,18 +70,18 @@ namespace OpenSim.Region.Framework.Scenes
70 70
71 public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) 71 public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item)
72 { 72 {
73 IMoneyModule money=RequestModuleInterface<IMoneyModule>(); 73 IMoneyModule money = RequestModuleInterface<IMoneyModule>();
74 if (money != null) 74 if (money != null)
75 { 75 {
76 money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); 76 money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload");
77 } 77 }
78 78
79 AddInventoryItem(agentID, item); 79 AddInventoryItem(item);
80 } 80 }
81 81
82 public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item) 82 public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item)
83 { 83 {
84 if (InventoryService.AddItem(item)) 84 if (AddInventoryItem(item))
85 return true; 85 return true;
86 else 86 else
87 { 87 {
@@ -92,19 +92,23 @@ namespace OpenSim.Region.Framework.Scenes
92 } 92 }
93 } 93 }
94 94
95 public void AddInventoryItem(UUID AgentID, InventoryItemBase item) 95 /// <summary>
96 /// Add the given inventory item to a user's inventory.
97 /// </summary>
98 /// <param name="item"></param>
99 public bool AddInventoryItem(InventoryItemBase item)
96 { 100 {
97 InventoryFolderBase folder; 101 InventoryFolderBase folder;
98 102
99 if (item.Folder == UUID.Zero) 103 if (item.Folder == UUID.Zero)
100 { 104 {
101 folder = InventoryService.GetFolderForType(AgentID, (AssetType)item.AssetType); 105 folder = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
102 if (folder == null) 106 if (folder == null)
103 { 107 {
104 folder = InventoryService.GetRootFolder(AgentID); 108 folder = InventoryService.GetRootFolder(item.Owner);
105 109
106 if (folder == null) 110 if (folder == null)
107 return; 111 return false;
108 } 112 }
109 113
110 item.Folder = folder.ID; 114 item.Folder = folder.ID;
@@ -113,20 +117,37 @@ namespace OpenSim.Region.Framework.Scenes
113 if (InventoryService.AddItem(item)) 117 if (InventoryService.AddItem(item))
114 { 118 {
115 int userlevel = 0; 119 int userlevel = 0;
116 if (Permissions.IsGod(AgentID)) 120 if (Permissions.IsGod(item.Owner))
117 { 121 {
118 userlevel = 1; 122 userlevel = 1;
119 } 123 }
120 EventManager.TriggerOnNewInventoryItemUploadComplete(AgentID, item.AssetID, item.Name, userlevel); 124 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel);
125
126 return true;
121 } 127 }
122 else 128 else
123 { 129 {
124 m_log.WarnFormat( 130 m_log.WarnFormat(
125 "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}", 131 "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}",
126 AgentID, item.Name, item.ID); 132 item.Owner, item.Name, item.ID);
127 133
128 return; 134 return false;
129 } 135 }
136 }
137
138 /// <summary>
139 /// Add the given inventory item to a user's inventory.
140 /// </summary>
141 /// <param name="AgentID">
142 /// A <see cref="UUID"/>
143 /// </param>
144 /// <param name="item">
145 /// A <see cref="InventoryItemBase"/>
146 /// </param>
147 [Obsolete("Use AddInventoryItem(InventoryItemBase item) instead. This was deprecated in OpenSim 0.7.1")]
148 public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
149 {
150 AddInventoryItem(item);
130 } 151 }
131 152
132 /// <summary> 153 /// <summary>
@@ -137,7 +158,7 @@ namespace OpenSim.Region.Framework.Scenes
137 /// in which the item is to be placed.</param> 158 /// in which the item is to be placed.</param>
138 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) 159 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
139 { 160 {
140 AddInventoryItem(remoteClient.AgentId, item); 161 AddInventoryItem(item);
141 remoteClient.SendInventoryItemCreateUpdate(item, 0); 162 remoteClient.SendInventoryItemCreateUpdate(item, 0);
142 } 163 }
143 164
@@ -529,7 +550,7 @@ namespace OpenSim.Region.Framework.Scenes
529 itemCopy.SalePrice = item.SalePrice; 550 itemCopy.SalePrice = item.SalePrice;
530 itemCopy.SaleType = item.SaleType; 551 itemCopy.SaleType = item.SaleType;
531 552
532 if (InventoryService.AddItem(itemCopy)) 553 if (AddInventoryItem(itemCopy))
533 { 554 {
534 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); 555 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
535 if (invAccess != null) 556 if (invAccess != null)
@@ -775,8 +796,10 @@ namespace OpenSim.Region.Framework.Scenes
775 item.BasePermissions = baseMask; 796 item.BasePermissions = baseMask;
776 item.CreationDate = creationDate; 797 item.CreationDate = creationDate;
777 798
778 if (InventoryService.AddItem(item)) 799 if (AddInventoryItem(item))
800 {
779 remoteClient.SendInventoryItemCreateUpdate(item, callbackID); 801 remoteClient.SendInventoryItemCreateUpdate(item, callbackID);
802 }
780 else 803 else
781 { 804 {
782 m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item"); 805 m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item");
@@ -1142,7 +1165,7 @@ namespace OpenSim.Region.Framework.Scenes
1142 1165
1143 agentItem.Folder = folderId; 1166 agentItem.Folder = folderId;
1144 1167
1145 AddInventoryItem(avatarId, agentItem); 1168 AddInventoryItem(agentItem);
1146 1169
1147 return agentItem; 1170 return agentItem;
1148 } 1171 }
@@ -1266,7 +1289,7 @@ namespace OpenSim.Region.Framework.Scenes
1266 { 1289 {
1267 agentItem.Folder = newFolderID; 1290 agentItem.Folder = newFolderID;
1268 1291
1269 AddInventoryItem(destID, agentItem); 1292 AddInventoryItem(agentItem);
1270 } 1293 }
1271 } 1294 }
1272 1295
@@ -1908,7 +1931,7 @@ namespace OpenSim.Region.Framework.Scenes
1908 // sets itemID so client can show item as 'attached' in inventory 1931 // sets itemID so client can show item as 'attached' in inventory
1909 grp.SetFromItemID(item.ID); 1932 grp.SetFromItemID(item.ID);
1910 1933
1911 if (InventoryService.AddItem(item)) 1934 if (AddInventoryItem(item))
1912 remoteClient.SendInventoryItemCreateUpdate(item, 0); 1935 remoteClient.SendInventoryItemCreateUpdate(item, 0);
1913 else 1936 else
1914 m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); 1937 m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 400f4c0..94a9dab 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2729,6 +2729,8 @@ namespace OpenSim.Region.Framework.Scenes
2729 try 2729 try
2730 { 2730 {
2731 ScenePresence sp = GetScenePresence(agentID); 2731 ScenePresence sp = GetScenePresence(agentID);
2732 PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
2733
2732 if (sp != null) 2734 if (sp != null)
2733 sp.ControllingClient.Close(); 2735 sp.ControllingClient.Close();
2734 2736
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 8823df1..86842b3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1619,11 +1619,6 @@ namespace OpenSim.Region.Framework.Scenes
1619 1619
1620 if (child != null) 1620 if (child != null)
1621 { 1621 {
1622 // Make sure no child prim is set for sale
1623 // So that, on delink, no prims are unwittingly
1624 // left for sale and sold off
1625 child.RootPart.ObjectSaleType = 0;
1626 child.RootPart.SalePrice = 10;
1627 childGroups.Add(child); 1622 childGroups.Add(child);
1628 } 1623 }
1629 } 1624 }
@@ -1907,9 +1902,6 @@ namespace OpenSim.Region.Framework.Scenes
1907 child.ApplyNextOwnerPermissions(); 1902 child.ApplyNextOwnerPermissions();
1908 } 1903 }
1909 } 1904 }
1910
1911 copy.RootPart.ObjectSaleType = 0;
1912 copy.RootPart.SalePrice = 10;
1913 } 1905 }
1914 1906
1915 Entities.Add(copy); 1907 Entities.Add(copy);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index c5994b2..1959427 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes
278 278
279 if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts) 279 if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts)
280 { 280 {
281 if (stateSource == 1 && // Prim crossing 281 if (stateSource == 2 && // Prim crossing
282 m_part.ParentGroup.Scene.m_trustBinaries) 282 m_part.ParentGroup.Scene.m_trustBinaries)
283 { 283 {
284 m_items.LockItemsForWrite(true); 284 m_items.LockItemsForWrite(true);
@@ -1263,4 +1263,4 @@ namespace OpenSim.Region.Framework.Scenes
1263 Items.LockItemsForRead(false); 1263 Items.LockItemsForRead(false);
1264 } 1264 }
1265 } 1265 }
1266} \ No newline at end of file 1266}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index faf6354..d88f2cc 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3913,6 +3913,27 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
3913 m_attachments.Add(gobj); 3913 m_attachments.Add(gobj);
3914 } 3914 }
3915 } 3915 }
3916
3917 /// <summary>
3918 /// Get the scene object attached to the given point.
3919 /// </summary>
3920 /// <param name="attachmentPoint"></param>
3921 /// <returns>Returns an empty list if there were no attachments at the point.</returns>
3922 public List<SceneObjectGroup> GetAttachments(uint attachmentPoint)
3923 {
3924 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>();
3925
3926 lock (m_attachments)
3927 {
3928 foreach (SceneObjectGroup so in m_attachments)
3929 {
3930 if (attachmentPoint == so.RootPart.AttachmentPoint)
3931 attachments.Add(so);
3932 }
3933 }
3934
3935 return attachments;
3936 }
3916 3937
3917 public bool HasAttachments() 3938 public bool HasAttachments()
3918 { 3939 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index 358ce22..dfc9aa3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -134,5 +134,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
134 134
135 #endregion 135 #endregion
136 136
137 [Test]
138 // llRot2Euler test.
139 public void TestllRot2Euler()
140 {
141 // 180, 90 and zero degree rotations.
142 CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 0.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, 0.0f));
143 CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 1.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, Math.PI));
144 CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 1.0f, 0.0f), new LSL_Types.Vector3(0.0f, 0.0f, Math.PI));
145 CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f), new LSL_Types.Vector3(0.0f, 0.0f, 0.0f));
146 CheckllRot2Euler(new LSL_Types.Quaternion(-0.5f, -0.5f, 0.5f, 0.5f), new LSL_Types.Vector3(0, -Math.PI / 2.0f, Math.PI / 2.0f));
147 CheckllRot2Euler(new LSL_Types.Quaternion(-0.707107f, 0.0f, 0.0f, -0.707107f), new LSL_Types.Vector3(Math.PI / 2.0f, 0.0f, 0.0f));
148 // A couple of messy rotations.
149 CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 5.651f, -3.1f, 67.023f), new LSL_Types.Vector3(0.037818f, 0.166447f, -0.095595f));
150 CheckllRot2Euler(new LSL_Types.Quaternion(0.719188f, -0.408934f, -0.363998f, -0.427841f), new LSL_Types.Vector3(-1.954769f, -0.174533f, 1.151917f));
151 }
152
153 private void CheckllRot2Euler(LSL_Types.Quaternion rot, LSL_Types.Vector3 eulerCheck)
154 {
155 // Call LSL function to convert quaternion rotaion to euler radians.
156 LSL_Types.Vector3 eulerCalc = m_lslApi.llRot2Euler(rot);
157 // Check upper and lower bounds of x, y and z.
158 // This type of check is performed as opposed to comparing for equal numbers, in order to allow slight
159 // differences in accuracy.
160 Assert.Greater(eulerCalc.x, eulerCheck.x - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X lower bounds check fail");
161 Assert.Less(eulerCalc.x, eulerCheck.x + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X upper bounds check fail");
162 Assert.Greater(eulerCalc.y, eulerCheck.y - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y lower bounds check fail");
163 Assert.Less(eulerCalc.y, eulerCheck.y + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y upper bounds check fail");
164 Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail");
165 Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail");
166 }
137 } 167 }
138} 168}
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
index e50481a..d10d6fc 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -54,9 +54,12 @@ namespace OpenSim.Server.Handlers.Hypergrid
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private IUserAgentService m_UserAgentService; 55 private IUserAgentService m_UserAgentService;
56 56
57 public HomeAgentHandler(IUserAgentService userAgentService) 57 private string m_LoginServerIP;
58
59 public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP)
58 { 60 {
59 m_UserAgentService = userAgentService; 61 m_UserAgentService = userAgentService;
62 m_LoginServerIP = loginServerIP;
60 } 63 }
61 64
62 public Hashtable Handler(Hashtable request) 65 public Hashtable Handler(Hashtable request)
@@ -120,6 +123,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
120 string regionname = string.Empty; 123 string regionname = string.Empty;
121 string gatekeeper_host = string.Empty; 124 string gatekeeper_host = string.Empty;
122 int gatekeeper_port = 0; 125 int gatekeeper_port = 0;
126 IPEndPoint client_ipaddress = null;
123 127
124 if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null) 128 if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null)
125 gatekeeper_host = args["gatekeeper_host"].AsString(); 129 gatekeeper_host = args["gatekeeper_host"].AsString();
@@ -144,6 +148,24 @@ namespace OpenSim.Server.Handlers.Hypergrid
144 if (args.ContainsKey("destination_name") && args["destination_name"] != null) 148 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
145 regionname = args["destination_name"].ToString(); 149 regionname = args["destination_name"].ToString();
146 150
151 if (args.ContainsKey("client_ip") && args["client_ip"] != null)
152 {
153 string ip_str = args["client_ip"].ToString();
154 try
155 {
156 string callerIP = Util.GetCallerIP(request);
157 // Verify if this caller has authority to send the client IP
158 if (callerIP == m_LoginServerIP)
159 client_ipaddress = new IPEndPoint(IPAddress.Parse(ip_str), 0);
160 else
161 m_log.WarnFormat("[HOME AGENT HANDLER]: Unauthorized machine {0} tried to set client ip to {1}", callerIP, ip_str);
162 }
163 catch
164 {
165 m_log.DebugFormat("[HOME AGENT HANDLER]: Exception parsing client ip address from {0}", ip_str);
166 }
167 }
168
147 GridRegion destination = new GridRegion(); 169 GridRegion destination = new GridRegion();
148 destination.RegionID = uuid; 170 destination.RegionID = uuid;
149 destination.RegionLocX = x; 171 destination.RegionLocX = x;
@@ -166,7 +188,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
166 OSDMap resp = new OSDMap(2); 188 OSDMap resp = new OSDMap(2);
167 string reason = String.Empty; 189 string reason = String.Empty;
168 190
169 bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason); 191 bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, client_ipaddress, out reason);
170 192
171 resp["reason"] = OSD.FromString(reason); 193 resp["reason"] = OSD.FromString(reason);
172 resp["success"] = OSD.FromBoolean(result); 194 resp["success"] = OSD.FromBoolean(result);
diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
index 6b1152b..70157d5 100644
--- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs
@@ -66,13 +66,15 @@ namespace OpenSim.Server.Handlers.Hypergrid
66 if (m_HomeUsersService == null) 66 if (m_HomeUsersService == null)
67 throw new Exception("UserAgent server connector cannot proceed because of missing service"); 67 throw new Exception("UserAgent server connector cannot proceed because of missing service");
68 68
69 string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1");
70
69 server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false); 71 server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false);
70 server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false); 72 server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false);
71 server.AddXmlRPCHandler("verify_agent", VerifyAgent, false); 73 server.AddXmlRPCHandler("verify_agent", VerifyAgent, false);
72 server.AddXmlRPCHandler("verify_client", VerifyClient, false); 74 server.AddXmlRPCHandler("verify_client", VerifyClient, false);
73 server.AddXmlRPCHandler("logout_agent", LogoutAgent, false); 75 server.AddXmlRPCHandler("logout_agent", LogoutAgent, false);
74 76
75 server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService).Handler); 77 server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP).Handler);
76 } 78 }
77 79
78 public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient) 80 public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient)
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
index 5bb529c..30dc65e 100644
--- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
+++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
@@ -52,15 +52,24 @@ namespace OpenSim.Server.Handlers.Login
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 private ILoginService m_LocalService; 54 private ILoginService m_LocalService;
55 private bool m_Proxy;
55 56
56 public LLLoginHandlers(ILoginService service) 57 public LLLoginHandlers(ILoginService service, bool hasProxy)
57 { 58 {
58 m_LocalService = service; 59 m_LocalService = service;
60 m_Proxy = hasProxy;
59 } 61 }
60 62
61 public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient) 63 public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient)
62 { 64 {
63 Hashtable requestData = (Hashtable)request.Params[0]; 65 Hashtable requestData = (Hashtable)request.Params[0];
66 if (m_Proxy && request.Params[3] != null)
67 {
68 IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]);
69 if (ep != null)
70 // Bang!
71 remoteClient = ep;
72 }
64 73
65 if (requestData != null) 74 if (requestData != null)
66 { 75 {
@@ -189,6 +198,7 @@ namespace OpenSim.Server.Handlers.Login
189 198
190 return map; 199 return map;
191 } 200 }
201
192 } 202 }
193 203
194} 204}
diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs
index 67e8392..16c93c8 100644
--- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs
+++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs
@@ -43,6 +43,7 @@ namespace OpenSim.Server.Handlers.Login
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 private ILoginService m_LoginService; 45 private ILoginService m_LoginService;
46 private bool m_Proxy;
46 47
47 public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : 48 public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
48 base(config, server, String.Empty) 49 base(config, server, String.Empty)
@@ -81,12 +82,14 @@ namespace OpenSim.Server.Handlers.Login
81 if (loginService == string.Empty) 82 if (loginService == string.Empty)
82 throw new Exception(String.Format("No LocalServiceModule for LoginService in config file")); 83 throw new Exception(String.Format("No LocalServiceModule for LoginService in config file"));
83 84
85 m_Proxy = serverConfig.GetBoolean("HasProxy", false);
86
84 return loginService; 87 return loginService;
85 } 88 }
86 89
87 private void InitializeHandlers(IHttpServer server) 90 private void InitializeHandlers(IHttpServer server)
88 { 91 {
89 LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService); 92 LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy);
90 server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); 93 server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false);
91 server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); 94 server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false);
92 server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); 95 server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 05b00e5..42ea296 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -184,7 +184,7 @@ namespace OpenSim.Server.Handlers.Simulation
184 resp["reason"] = OSD.FromString(reason); 184 resp["reason"] = OSD.FromString(reason);
185 resp["success"] = OSD.FromBoolean(result); 185 resp["success"] = OSD.FromBoolean(result);
186 // Let's also send out the IP address of the caller back to the caller (HG 1.5) 186 // Let's also send out the IP address of the caller back to the caller (HG 1.5)
187 resp["your_ip"] = OSD.FromString(GetCallerIP(request)); 187 resp["your_ip"] = OSD.FromString(Util.GetCallerIP(request));
188 188
189 // TODO: add reason if not String.Empty? 189 // TODO: add reason if not String.Empty?
190 responsedata["int_response_code"] = HttpStatusCode.OK; 190 responsedata["int_response_code"] = HttpStatusCode.OK;
@@ -378,23 +378,6 @@ namespace OpenSim.Server.Handlers.Simulation
378 m_SimulationService.ReleaseAgent(regionID, id, ""); 378 m_SimulationService.ReleaseAgent(regionID, id, "");
379 } 379 }
380 380
381 private string GetCallerIP(Hashtable req)
382 {
383 if (req.ContainsKey("headers"))
384 {
385 try
386 {
387 Hashtable headers = (Hashtable)req["headers"];
388 if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null)
389 return headers["remote_addr"].ToString();
390 }
391 catch (Exception e)
392 {
393 m_log.WarnFormat("[AGENT HANDLER]: exception in GetCallerIP: {0}", e.Message);
394 }
395 }
396 return string.Empty;
397 }
398 } 381 }
399 382
400} 383}
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 8d0f7be..f5b5982 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -86,13 +86,8 @@ 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 IPEndPoint ext = info.ExternalEndPoint; 89 string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" );
90 string uri = ""; 90 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
91 if (ext != null)
92 {
93 uri = "http://" + ext.Address + ":" + info.HttpPort + "/";
94 }
95 //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
96 XmlRpcResponse response = null; 91 XmlRpcResponse response = null;
97 try 92 try
98 { 93 {
@@ -193,12 +188,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
193 paramList.Add(hash); 188 paramList.Add(hash);
194 189
195 XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); 190 XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
196 IPEndPoint ext = gatekeeper.ExternalEndPoint; 191 string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/");
197 string uri = "";
198 if (ext != null)
199 {
200 uri = "http://" + ext.Address + ":" + gatekeeper.HttpPort + "/";
201 }
202 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); 192 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri);
203 XmlRpcResponse response = null; 193 XmlRpcResponse response = null;
204 try 194 try
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 4501937..6d3c64a 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -51,34 +51,49 @@ namespace OpenSim.Services.Connectors.Hypergrid
51 MethodBase.GetCurrentMethod().DeclaringType); 51 MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 string m_ServerURL; 53 string m_ServerURL;
54 Uri m_Uri;
55 public UserAgentServiceConnector(string url) 54 public UserAgentServiceConnector(string url)
56 { 55 {
57 m_ServerURL = url; 56 m_ServerURL = url;
57 // Doing this here, because XML-RPC or mono have some strong ideas about
58 // caching DNS translations.
58 try 59 try
59 { 60 {
60 m_Uri = new Uri(m_ServerURL); 61 Uri m_Uri = new Uri(m_ServerURL);
61 IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); 62 IPAddress ip = Util.GetHostFromDNS(m_Uri.Host);
62 m_ServerURL = "http://" + ip.ToString() + ":" + m_Uri.Port; 63 m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); ;
63 } 64 }
64 catch (Exception e) 65 catch (Exception e)
65 { 66 {
66 m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); 67 m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message);
67 } 68 }
69 m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL);
68 } 70 }
69 71
70 public UserAgentServiceConnector(IConfigSource config) 72 public UserAgentServiceConnector(IConfigSource config)
71 { 73 {
72 } 74 IConfig serviceConfig = config.Configs["UserAgentService"];
75 if (serviceConfig == null)
76 {
77 m_log.Error("[USER AGENT CONNECTOR]: UserAgentService missing from ini");
78 throw new Exception("UserAgent connector init error");
79 }
73 80
74 public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason) 81 string serviceURI = serviceConfig.GetString("UserAgentServerURI",
75 { 82 String.Empty);
76 // not available over remote calls 83
77 reason = "Method not available over remote calls"; 84 if (serviceURI == String.Empty)
78 return false; 85 {
86 m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService");
87 throw new Exception("UserAgent connector init error");
88 }
89 m_ServerURL = serviceURI;
90
91 m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL);
79 } 92 }
80 93
81 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) 94
95 // The Login service calls this interface with a non-null [client] ipaddress
96 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress, out string reason)
82 { 97 {
83 reason = String.Empty; 98 reason = String.Empty;
84 99
@@ -89,7 +104,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
89 return false; 104 return false;
90 } 105 }
91 106
92 string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/"; 107 string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/";
93 108
94 Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri); 109 Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri);
95 110
@@ -101,7 +116,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
101 //AgentCreateRequest.Headers.Add("Authorization", authKey); 116 //AgentCreateRequest.Headers.Add("Authorization", authKey);
102 117
103 // Fill it in 118 // Fill it in
104 OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination); 119 OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination, ipaddress);
105 120
106 string strBuffer = ""; 121 string strBuffer = "";
107 byte[] buffer = new byte[1]; 122 byte[] buffer = new byte[1];
@@ -198,7 +213,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
198 213
199 } 214 }
200 215
201 protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination) 216
217 // The simulators call this interface
218 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
219 {
220 return LoginAgentToGrid(aCircuit, gatekeeper, destination, null, out reason);
221 }
222
223 protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress)
202 { 224 {
203 OSDMap args = null; 225 OSDMap args = null;
204 try 226 try
@@ -216,6 +238,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
216 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); 238 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
217 args["destination_name"] = OSD.FromString(destination.RegionName); 239 args["destination_name"] = OSD.FromString(destination.RegionName);
218 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 240 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
241 if (ipaddress != null)
242 args["client_ip"] = OSD.FromString(ipaddress.Address.ToString());
219 243
220 return args; 244 return args;
221 } 245 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 616b5a7..99e6983 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
55 55
56 private string m_serverUrl = String.Empty; 56 private string m_serverUrl = String.Empty;
57 private IImprovedAssetCache m_cache; 57 private IImprovedAssetCache m_cache;
58 private bool m_Enabled = false;
58 59
59 #region ISharedRegionModule 60 #region ISharedRegionModule
60 61
@@ -73,8 +74,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
73 74
74 public SimianAssetServiceConnector() { } 75 public SimianAssetServiceConnector() { }
75 public string Name { get { return "SimianAssetServiceConnector"; } } 76 public string Name { get { return "SimianAssetServiceConnector"; } }
76 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAssetService>(this); } } 77 public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IAssetService>(this); } }
77 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAssetService>(this); } } 78 public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IAssetService>(this); } }
78 79
79 #endregion ISharedRegionModule 80 #endregion ISharedRegionModule
80 81
@@ -85,26 +86,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
85 86
86 public void Initialise(IConfigSource source) 87 public void Initialise(IConfigSource source)
87 { 88 {
88 if (Simian.IsSimianEnabled(source, "AssetServices", this.Name)) 89 IConfig moduleConfig = source.Configs["Modules"];
90 if (moduleConfig != null)
89 { 91 {
90 IConfig gridConfig = source.Configs["AssetService"]; 92 string name = moduleConfig.GetString("AssetServices", "");
91 if (gridConfig == null) 93 if (name == Name)
92 { 94 {
93 m_log.Error("[SIMIAN ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); 95 IConfig gridConfig = source.Configs["AssetService"];
94 throw new Exception("Asset connector init error"); 96 if (gridConfig != null)
95 } 97 {
98 string serviceUrl = gridConfig.GetString("AssetServerURI");
99 if (!String.IsNullOrEmpty(serviceUrl))
100 {
101 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
102 serviceUrl = serviceUrl + '/';
103 m_serverUrl = serviceUrl;
104 }
105 }
96 106
97 string serviceUrl = gridConfig.GetString("AssetServerURI"); 107 if (String.IsNullOrEmpty(m_serverUrl))
98 if (String.IsNullOrEmpty(serviceUrl)) 108 m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector");
99 { 109 else
100 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI in section AssetService"); 110 m_Enabled = true;
101 throw new Exception("Asset connector init error");
102 } 111 }
103
104 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
105 serviceUrl = serviceUrl + '/';
106
107 m_serverUrl = serviceUrl;
108 } 112 }
109 } 113 }
110 114
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
index 7a96a05..68f73ee 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -51,6 +51,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
51 MethodBase.GetCurrentMethod().DeclaringType); 51 MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 private string m_serverUrl = String.Empty; 53 private string m_serverUrl = String.Empty;
54 private bool m_Enabled = false;
54 55
55 #region ISharedRegionModule 56 #region ISharedRegionModule
56 57
@@ -61,8 +62,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
61 62
62 public SimianAuthenticationServiceConnector() { } 63 public SimianAuthenticationServiceConnector() { }
63 public string Name { get { return "SimianAuthenticationServiceConnector"; } } 64 public string Name { get { return "SimianAuthenticationServiceConnector"; } }
64 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAuthenticationService>(this); } } 65 public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IAuthenticationService>(this); } }
65 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAuthenticationService>(this); } } 66 public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IAuthenticationService>(this); } }
66 67
67 #endregion ISharedRegionModule 68 #endregion ISharedRegionModule
68 69
@@ -73,23 +74,28 @@ namespace OpenSim.Services.Connectors.SimianGrid
73 74
74 public void Initialise(IConfigSource source) 75 public void Initialise(IConfigSource source)
75 { 76 {
76 if (Simian.IsSimianEnabled(source, "AuthenticationServices", this.Name)) 77 IConfig moduleConfig = source.Configs["Modules"];
78 if (moduleConfig != null)
77 { 79 {
78 IConfig assetConfig = source.Configs["AuthenticationService"]; 80 string name = moduleConfig.GetString("AuthenticationServices", "");
79 if (assetConfig == null) 81 if (name == Name)
80 { 82 {
81 m_log.Error("[SIMIAN AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini"); 83 IConfig gridConfig = source.Configs["AuthenticationService"];
82 throw new Exception("Authentication connector init error"); 84 if (gridConfig != null)
83 } 85 {
86 string serviceUrl = gridConfig.GetString("AuthenticationServerURI");
87 if (!String.IsNullOrEmpty(serviceUrl))
88 {
89 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
90 serviceUrl = serviceUrl + '/';
91 m_serverUrl = serviceUrl;
92 m_Enabled = true;
93 }
94 }
84 95
85 string serviceURI = assetConfig.GetString("AuthenticationServerURI"); 96 if (String.IsNullOrEmpty(m_serverUrl))
86 if (String.IsNullOrEmpty(serviceURI)) 97 m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector");
87 {
88 m_log.Error("[SIMIAN AUTH CONNECTOR]: No Server URI named in section AuthenticationService");
89 throw new Exception("Authentication connector init error");
90 } 98 }
91
92 m_serverUrl = serviceURI;
93 } 99 }
94 } 100 }
95 101
@@ -253,7 +259,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
253 if (password == simianGridCredential || 259 if (password == simianGridCredential ||
254 "$1$" + password == simianGridCredential || 260 "$1$" + password == simianGridCredential ||
255 "$1$" + Utils.MD5String(password) == simianGridCredential || 261 "$1$" + Utils.MD5String(password) == simianGridCredential ||
256 Utils.MD5String(password) == simianGridCredential) 262 Utils.MD5String(password) == simianGridCredential ||
263 "$1$" + Utils.MD5String(password + ":") == simianGridCredential)
257 { 264 {
258 authorizeResult = Authorize(userID); 265 authorizeResult = Authorize(userID);
259 return true; 266 return true;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index 734bdd2..7e56bd1 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -56,6 +56,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
56// private static string ZeroID = UUID.Zero.ToString(); 56// private static string ZeroID = UUID.Zero.ToString();
57 57
58 private string m_serverUrl = String.Empty; 58 private string m_serverUrl = String.Empty;
59 private bool m_Enabled = false;
59 60
60 #region ISharedRegionModule 61 #region ISharedRegionModule
61 62
@@ -66,8 +67,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
66 67
67 public SimianAvatarServiceConnector() { } 68 public SimianAvatarServiceConnector() { }
68 public string Name { get { return "SimianAvatarServiceConnector"; } } 69 public string Name { get { return "SimianAvatarServiceConnector"; } }
69 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAvatarService>(this); } } 70 public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IAvatarService>(this); } }
70 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAvatarService>(this); } } 71 public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IAvatarService>(this); } }
71 72
72 #endregion ISharedRegionModule 73 #endregion ISharedRegionModule
73 74
@@ -78,26 +79,28 @@ namespace OpenSim.Services.Connectors.SimianGrid
78 79
79 public void Initialise(IConfigSource source) 80 public void Initialise(IConfigSource source)
80 { 81 {
81 if (Simian.IsSimianEnabled(source, "AvatarServices", this.Name)) 82 IConfig moduleConfig = source.Configs["Modules"];
83 if (moduleConfig != null)
82 { 84 {
83 IConfig gridConfig = source.Configs["AvatarService"]; 85 string name = moduleConfig.GetString("AvatarServices", "");
84 if (gridConfig == null) 86 if (name == Name)
85 { 87 {
86 m_log.Error("[SIMIAN AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini"); 88 IConfig gridConfig = source.Configs["AvatarService"];
87 throw new Exception("Avatar connector init error"); 89 if (gridConfig != null)
88 } 90 {
91 string serviceUrl = gridConfig.GetString("AvatarServerURI");
92 if (!String.IsNullOrEmpty(serviceUrl))
93 {
94 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
95 serviceUrl = serviceUrl + '/';
96 m_serverUrl = serviceUrl;
97 m_Enabled = true;
98 }
99 }
89 100
90 string serviceUrl = gridConfig.GetString("AvatarServerURI"); 101 if (String.IsNullOrEmpty(m_serverUrl))
91 if (String.IsNullOrEmpty(serviceUrl)) 102 m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector");
92 {
93 m_log.Error("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService");
94 throw new Exception("Avatar connector init error");
95 } 103 }
96
97 if (!serviceUrl.EndsWith("/"))
98 serviceUrl = serviceUrl + '/';
99
100 m_serverUrl = serviceUrl;
101 } 104 }
102 } 105 }
103 106
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
index 89f3594..5b18aef 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
@@ -46,8 +46,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
46 /// <summary> 46 /// <summary>
47 /// Stores and retrieves friend lists from the SimianGrid backend 47 /// Stores and retrieves friend lists from the SimianGrid backend
48 /// </summary> 48 /// </summary>
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 49 public class SimianFriendsServiceConnector : IFriendsService
50 public class SimianFriendsServiceConnector : IFriendsService, ISharedRegionModule
51 { 50 {
52 private static readonly ILog m_log = 51 private static readonly ILog m_log =
53 LogManager.GetLogger( 52 LogManager.GetLogger(
@@ -55,20 +54,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
55 54
56 private string m_serverUrl = String.Empty; 55 private string m_serverUrl = String.Empty;
57 56
58 #region ISharedRegionModule
59
60 public Type ReplaceableInterface { get { return null; } }
61 public void RegionLoaded(Scene scene) { }
62 public void PostInitialise() { }
63 public void Close() { }
64
65 public SimianFriendsServiceConnector() { }
66 public string Name { get { return "SimianFriendsServiceConnector"; } }
67 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IFriendsService>(this); } }
68 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IFriendsService>(this); } }
69
70 #endregion ISharedRegionModule
71
72 public SimianFriendsServiceConnector(IConfigSource source) 57 public SimianFriendsServiceConnector(IConfigSource source)
73 { 58 {
74 Initialise(source); 59 Initialise(source);
@@ -76,38 +61,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
76 61
77 public void Initialise(IConfigSource source) 62 public void Initialise(IConfigSource source)
78 { 63 {
79 bool isSimianEnabled = false; 64 IConfig gridConfig = source.Configs["FriendsService"];
80 65 if (gridConfig != null)
81 if (source.Configs["Friends"] != null)
82 {
83 string module = source.Configs["Friends"].GetString("Connector");
84 isSimianEnabled = !String.IsNullOrEmpty(module) && module.EndsWith(this.Name);
85 }
86
87 if (isSimianEnabled)
88 { 66 {
89 IConfig assetConfig = source.Configs["FriendsService"]; 67 string serviceUrl = gridConfig.GetString("FriendsServerURI");
90 if (assetConfig == null) 68 if (!String.IsNullOrEmpty(serviceUrl))
91 { 69 {
92 m_log.Error("[SIMIAN FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini"); 70 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
93 throw new Exception("Friends connector init error"); 71 serviceUrl = serviceUrl + '/';
72 m_serverUrl = serviceUrl;
94 } 73 }
95
96 string serviceURI = assetConfig.GetString("FriendsServerURI");
97 if (String.IsNullOrEmpty(serviceURI))
98 {
99 m_log.Error("[SIMIAN FRIENDS CONNECTOR]: No Server URI named in section FriendsService");
100 throw new Exception("Friends connector init error");
101 }
102
103 m_serverUrl = serviceURI;
104 } 74 }
75
76 if (String.IsNullOrEmpty(m_serverUrl))
77 m_log.Info("[SIMIAN FRIENDS CONNECTOR]: No FriendsServerURI specified, disabling connector");
105 } 78 }
106 79
107 #region IFriendsService 80 #region IFriendsService
108 81
109 public FriendInfo[] GetFriends(UUID principalID) 82 public FriendInfo[] GetFriends(UUID principalID)
110 { 83 {
84 if (String.IsNullOrEmpty(m_serverUrl))
85 return new FriendInfo[0];
86
111 Dictionary<UUID, FriendInfo> friends = new Dictionary<UUID, FriendInfo>(); 87 Dictionary<UUID, FriendInfo> friends = new Dictionary<UUID, FriendInfo>();
112 88
113 OSDArray friendsArray = GetFriended(principalID); 89 OSDArray friendsArray = GetFriended(principalID);
@@ -156,6 +132,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
156 132
157 public bool StoreFriend(UUID principalID, string friend, int flags) 133 public bool StoreFriend(UUID principalID, string friend, int flags)
158 { 134 {
135 if (String.IsNullOrEmpty(m_serverUrl))
136 return true;
137
159 NameValueCollection requestArgs = new NameValueCollection 138 NameValueCollection requestArgs = new NameValueCollection
160 { 139 {
161 { "RequestMethod", "AddGeneric" }, 140 { "RequestMethod", "AddGeneric" },
@@ -176,6 +155,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
176 155
177 public bool Delete(UUID principalID, string friend) 156 public bool Delete(UUID principalID, string friend)
178 { 157 {
158 if (String.IsNullOrEmpty(m_serverUrl))
159 return true;
160
179 NameValueCollection requestArgs = new NameValueCollection 161 NameValueCollection requestArgs = new NameValueCollection
180 { 162 {
181 { "RequestMethod", "RemoveGeneric" }, 163 { "RequestMethod", "RemoveGeneric" },
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
index 7d97aaa..847319c 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
@@ -31,17 +31,3 @@ using Nini.Config;
31 31
32[assembly: Addin("SimianGrid", "1.0")] 32[assembly: Addin("SimianGrid", "1.0")]
33[assembly: AddinDependency("OpenSim", "0.5")] 33[assembly: AddinDependency("OpenSim", "0.5")]
34
35public static class Simian
36{
37 public static bool IsSimianEnabled(IConfigSource config, string moduleName, string connectorName)
38 {
39 if (config.Configs["Modules"] != null)
40 {
41 string module = config.Configs["Modules"].GetString(moduleName);
42 return !String.IsNullOrEmpty(module) && module.EndsWith(connectorName);
43 }
44
45 return false;
46 }
47} \ No newline at end of file
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 1ddcc75..4fceef6 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -60,6 +60,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
60 60
61 private string m_serverUrl = String.Empty; 61 private string m_serverUrl = String.Empty;
62 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); 62 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
63 private bool m_Enabled = false;
63 64
64 #region ISharedRegionModule 65 #region ISharedRegionModule
65 66
@@ -72,21 +73,25 @@ namespace OpenSim.Services.Connectors.SimianGrid
72 public string Name { get { return "SimianGridServiceConnector"; } } 73 public string Name { get { return "SimianGridServiceConnector"; } }
73 public void AddRegion(Scene scene) 74 public void AddRegion(Scene scene)
74 { 75 {
76 if (!m_Enabled)
77 return;
78
75 // Every shared region module has to maintain an indepedent list of 79 // Every shared region module has to maintain an indepedent list of
76 // currently running regions 80 // currently running regions
77 lock (m_scenes) 81 lock (m_scenes)
78 m_scenes[scene.RegionInfo.RegionID] = scene; 82 m_scenes[scene.RegionInfo.RegionID] = scene;
79 83
80 if (!String.IsNullOrEmpty(m_serverUrl)) 84 scene.RegisterModuleInterface<IGridService>(this);
81 scene.RegisterModuleInterface<IGridService>(this);
82 } 85 }
83 public void RemoveRegion(Scene scene) 86 public void RemoveRegion(Scene scene)
84 { 87 {
88 if (!m_Enabled)
89 return;
90
85 lock (m_scenes) 91 lock (m_scenes)
86 m_scenes.Remove(scene.RegionInfo.RegionID); 92 m_scenes.Remove(scene.RegionInfo.RegionID);
87 93
88 if (!String.IsNullOrEmpty(m_serverUrl)) 94 scene.UnregisterModuleInterface<IGridService>(this);
89 scene.UnregisterModuleInterface<IGridService>(this);
90 } 95 }
91 96
92 #endregion ISharedRegionModule 97 #endregion ISharedRegionModule
@@ -98,23 +103,28 @@ namespace OpenSim.Services.Connectors.SimianGrid
98 103
99 public void Initialise(IConfigSource source) 104 public void Initialise(IConfigSource source)
100 { 105 {
101 if (Simian.IsSimianEnabled(source, "GridServices", this.Name)) 106 IConfig moduleConfig = source.Configs["Modules"];
107 if (moduleConfig != null)
102 { 108 {
103 IConfig gridConfig = source.Configs["GridService"]; 109 string name = moduleConfig.GetString("GridServices", "");
104 if (gridConfig == null) 110 if (name == Name)
105 { 111 {
106 m_log.Error("[SIMIAN GRID CONNECTOR]: GridService missing from OpenSim.ini"); 112 IConfig gridConfig = source.Configs["GridService"];
107 throw new Exception("Grid connector init error"); 113 if (gridConfig != null)
108 } 114 {
115 string serviceUrl = gridConfig.GetString("GridServerURI");
116 if (!String.IsNullOrEmpty(serviceUrl))
117 {
118 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
119 serviceUrl = serviceUrl + '/';
120 m_serverUrl = serviceUrl;
121 m_Enabled = true;
122 }
123 }
109 124
110 string serviceUrl = gridConfig.GetString("GridServerURI"); 125 if (String.IsNullOrEmpty(m_serverUrl))
111 if (String.IsNullOrEmpty(serviceUrl)) 126 m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector");
112 {
113 m_log.Error("[SIMIAN GRID CONNECTOR]: No Server URI named in section GridService");
114 throw new Exception("Grid connector init error");
115 } 127 }
116
117 m_serverUrl = serviceUrl;
118 } 128 }
119 } 129 }
120 130
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 89c1a5a..eb118ae 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -70,6 +70,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
70 private string m_serverUrl = String.Empty; 70 private string m_serverUrl = String.Empty;
71 private string m_userServerUrl = String.Empty; 71 private string m_userServerUrl = String.Empty;
72// private object m_gestureSyncRoot = new object(); 72// private object m_gestureSyncRoot = new object();
73 private bool m_Enabled = false;
73 74
74 #region ISharedRegionModule 75 #region ISharedRegionModule
75 76
@@ -80,8 +81,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
80 81
81 public SimianInventoryServiceConnector() { } 82 public SimianInventoryServiceConnector() { }
82 public string Name { get { return "SimianInventoryServiceConnector"; } } 83 public string Name { get { return "SimianInventoryServiceConnector"; } }
83 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IInventoryService>(this); } } 84 public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IInventoryService>(this); } }
84 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IInventoryService>(this); } } 85 public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IInventoryService>(this); } }
85 86
86 #endregion ISharedRegionModule 87 #endregion ISharedRegionModule
87 88
@@ -92,36 +93,39 @@ namespace OpenSim.Services.Connectors.SimianGrid
92 93
93 public void Initialise(IConfigSource source) 94 public void Initialise(IConfigSource source)
94 { 95 {
95 if (Simian.IsSimianEnabled(source, "InventoryServices", this.Name)) 96 IConfig moduleConfig = source.Configs["Modules"];
97 if (moduleConfig != null)
96 { 98 {
97 IConfig gridConfig = source.Configs["InventoryService"]; 99 string name = moduleConfig.GetString("InventoryServices", "");
98 if (gridConfig == null) 100 if (name == Name)
99 { 101 {
100 m_log.Error("[SIMIAN INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); 102 IConfig gridConfig = source.Configs["InventoryService"];
101 throw new Exception("Inventory connector init error"); 103 if (gridConfig != null)
102 } 104 {
103 105 string serviceUrl = gridConfig.GetString("InventoryServerURI");
104 string serviceUrl = gridConfig.GetString("InventoryServerURI"); 106 if (!String.IsNullOrEmpty(serviceUrl))
105 if (String.IsNullOrEmpty(serviceUrl)) 107 {
106 { 108 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
107 m_log.Error("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); 109 serviceUrl = serviceUrl + '/';
108 throw new Exception("Inventory connector init error"); 110 m_serverUrl = serviceUrl;
109 } 111
110 112 gridConfig = source.Configs["UserAccountService"];
111 m_serverUrl = serviceUrl; 113 if (gridConfig != null)
114 {
115 serviceUrl = gridConfig.GetString("UserAccountServerURI");
116 if (!String.IsNullOrEmpty(serviceUrl))
117 {
118 m_userServerUrl = serviceUrl;
119 m_Enabled = true;
120 }
121 }
122 }
123 }
112 124
113 gridConfig = source.Configs["UserAccountService"]; 125 if (String.IsNullOrEmpty(m_serverUrl))
114 if (gridConfig != null) 126 m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector");
115 { 127 else if (String.IsNullOrEmpty(m_userServerUrl))
116 serviceUrl = gridConfig.GetString("UserAccountServerURI"); 128 m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector");
117 if (!String.IsNullOrEmpty(serviceUrl))
118 m_userServerUrl = serviceUrl;
119 else
120 m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section UserAccountService");
121 }
122 else
123 {
124 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: UserAccountService missing from OpenSim.ini");
125 } 129 }
126 } 130 }
127 } 131 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index ca23e27..074c80f 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
59 59
60 private string m_serverUrl = String.Empty; 60 private string m_serverUrl = String.Empty;
61 private SimianActivityDetector m_activityDetector; 61 private SimianActivityDetector m_activityDetector;
62 private bool m_Enabled = false;
62 63
63 #region ISharedRegionModule 64 #region ISharedRegionModule
64 65
@@ -71,7 +72,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
71 public string Name { get { return "SimianPresenceServiceConnector"; } } 72 public string Name { get { return "SimianPresenceServiceConnector"; } }
72 public void AddRegion(Scene scene) 73 public void AddRegion(Scene scene)
73 { 74 {
74 if (!String.IsNullOrEmpty(m_serverUrl)) 75 if (m_Enabled)
75 { 76 {
76 scene.RegisterModuleInterface<IPresenceService>(this); 77 scene.RegisterModuleInterface<IPresenceService>(this);
77 scene.RegisterModuleInterface<IGridUserService>(this); 78 scene.RegisterModuleInterface<IGridUserService>(this);
@@ -83,7 +84,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
83 } 84 }
84 public void RemoveRegion(Scene scene) 85 public void RemoveRegion(Scene scene)
85 { 86 {
86 if (!String.IsNullOrEmpty(m_serverUrl)) 87 if (m_Enabled)
87 { 88 {
88 scene.UnregisterModuleInterface<IPresenceService>(this); 89 scene.UnregisterModuleInterface<IPresenceService>(this);
89 scene.UnregisterModuleInterface<IGridUserService>(this); 90 scene.UnregisterModuleInterface<IGridUserService>(this);
@@ -103,23 +104,28 @@ namespace OpenSim.Services.Connectors.SimianGrid
103 104
104 public void Initialise(IConfigSource source) 105 public void Initialise(IConfigSource source)
105 { 106 {
106 if (Simian.IsSimianEnabled(source, "PresenceServices", this.Name)) 107 IConfig moduleConfig = source.Configs["Modules"];
108 if (moduleConfig != null)
107 { 109 {
108 IConfig gridConfig = source.Configs["PresenceService"]; 110 string name = moduleConfig.GetString("PresenceServices", "");
109 if (gridConfig == null) 111 if (name == Name)
110 { 112 {
111 m_log.Error("[SIMIAN PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini"); 113 IConfig gridConfig = source.Configs["PresenceService"];
112 throw new Exception("Presence connector init error"); 114 if (gridConfig != null)
115 {
116 string serviceUrl = gridConfig.GetString("PresenceServerURI");
117 if (!String.IsNullOrEmpty(serviceUrl))
118 {
119 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
120 serviceUrl = serviceUrl + '/';
121 m_serverUrl = serviceUrl;
122 m_Enabled = true;
123 }
124 }
125
126 if (String.IsNullOrEmpty(m_serverUrl))
127 m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector");
113 } 128 }
114
115 string serviceUrl = gridConfig.GetString("PresenceServerURI");
116 if (String.IsNullOrEmpty(serviceUrl))
117 {
118 m_log.Error("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI in section PresenceService");
119 throw new Exception("Presence connector init error");
120 }
121
122 m_serverUrl = serviceUrl;
123 } 129 }
124 } 130 }
125 131
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
index d30d880..0ef4974 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
@@ -67,6 +67,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
67 MethodBase.GetCurrentMethod().DeclaringType); 67 MethodBase.GetCurrentMethod().DeclaringType);
68 68
69 private string m_serverUrl = String.Empty; 69 private string m_serverUrl = String.Empty;
70 private bool m_Enabled = false;
70 71
71 #region INonSharedRegionModule 72 #region INonSharedRegionModule
72 73
@@ -76,8 +77,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
76 77
77 public SimianProfiles() { } 78 public SimianProfiles() { }
78 public string Name { get { return "SimianProfiles"; } } 79 public string Name { get { return "SimianProfiles"; } }
79 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } } 80 public void AddRegion(Scene scene) { if (m_Enabled) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } }
80 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } } 81 public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } }
81 82
82 #endregion INonSharedRegionModule 83 #endregion INonSharedRegionModule
83 84
@@ -88,44 +89,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
88 89
89 public void Initialise(IConfigSource source) 90 public void Initialise(IConfigSource source)
90 { 91 {
91 if (Simian.IsSimianEnabled(source, "UserAccountServices", "SimianUserAccountServiceConnector")) 92 IConfig profileConfig = source.Configs["Profile"];
92 { 93 if (profileConfig == null)
93 IConfig gridConfig = source.Configs["UserAccountService"]; 94 return;
94 if (gridConfig == null)
95 {
96 m_log.Error("[SIMIAN PROFILES]: UserAccountService missing from OpenSim.ini");
97 throw new Exception("Profiles init error");
98 }
99
100 string serviceUrl = gridConfig.GetString("UserAccountServerURI");
101 if (String.IsNullOrEmpty(serviceUrl))
102 {
103 m_log.Error("[SIMIAN PROFILES]: No UserAccountServerURI in section UserAccountService");
104 throw new Exception("Profiles init error");
105 }
106 95
107 if (!serviceUrl.EndsWith("/")) 96 if (profileConfig.GetString("Module", String.Empty) != Name)
108 serviceUrl = serviceUrl + '/'; 97 return;
109 98
110 m_serverUrl = serviceUrl; 99 IConfig gridConfig = source.Configs["UserAccountService"];
111 IConfig profilesConfig = source.Configs["Profiles"]; 100 if (gridConfig != null)
112 if (profilesConfig == null) 101 {
102 string serviceUrl = gridConfig.GetString("UserAccountServerURI");
103 if (!String.IsNullOrEmpty(serviceUrl))
113 { 104 {
114 // Do not run this module by default. 105 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
115 return; 106 serviceUrl = serviceUrl + '/';
116 } 107 m_serverUrl = serviceUrl;
117 else
118 {
119 // if profiles aren't enabled, we're not needed.
120 // if we're not specified as the connector to use, then we're not wanted
121 if (profilesConfig.GetString("Module", String.Empty) != Name)
122 {
123
124 return;
125 }
126 m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Initializing {0}", this.Name);
127 } 108 }
128 } 109 }
110
111 if (String.IsNullOrEmpty(m_serverUrl))
112 m_log.Info("[SIMIAN PROFILES]: No UserAccountServerURI specified, disabling connector");
129 } 113 }
130 114
131 private void ClientConnectHandler(IClientCore clientCore) 115 private void ClientConnectHandler(IClientCore clientCore)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 56c73ec..deb8695 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
55 55
56 private string m_serverUrl = String.Empty; 56 private string m_serverUrl = String.Empty;
57 private ExpiringCache<UUID, UserAccount> m_accountCache; 57 private ExpiringCache<UUID, UserAccount> m_accountCache;
58 private bool m_Enabled = false;
58 59
59 #region ISharedRegionModule 60 #region ISharedRegionModule
60 61
@@ -65,8 +66,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
65 66
66 public SimianUserAccountServiceConnector() { } 67 public SimianUserAccountServiceConnector() { }
67 public string Name { get { return "SimianUserAccountServiceConnector"; } } 68 public string Name { get { return "SimianUserAccountServiceConnector"; } }
68 public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IUserAccountService>(this); } } 69 public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IUserAccountService>(this); } }
69 public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IUserAccountService>(this); } } 70 public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IUserAccountService>(this); } }
70 71
71 #endregion ISharedRegionModule 72 #endregion ISharedRegionModule
72 73
@@ -77,24 +78,28 @@ namespace OpenSim.Services.Connectors.SimianGrid
77 78
78 public void Initialise(IConfigSource source) 79 public void Initialise(IConfigSource source)
79 { 80 {
80 if (Simian.IsSimianEnabled(source, "UserAccountServices", this.Name)) 81 IConfig moduleConfig = source.Configs["Modules"];
82 if (moduleConfig != null)
81 { 83 {
82 IConfig assetConfig = source.Configs["UserAccountService"]; 84 string name = moduleConfig.GetString("UserAccountServices", "");
83 if (assetConfig == null) 85 if (name == Name)
84 { 86 {
85 m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini"); 87 IConfig gridConfig = source.Configs["UserAccountService"];
86 throw new Exception("User account connector init error"); 88 if (gridConfig != null)
87 } 89 {
90 string serviceUrl = gridConfig.GetString("UserAccountServerURI");
91 if (!String.IsNullOrEmpty(serviceUrl))
92 {
93 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
94 serviceUrl = serviceUrl + '/';
95 m_serverUrl = serviceUrl;
96 m_Enabled = true;
97 }
98 }
88 99
89 string serviceURI = assetConfig.GetString("UserAccountServerURI"); 100 if (String.IsNullOrEmpty(m_serverUrl))
90 if (String.IsNullOrEmpty(serviceURI)) 101 m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector");
91 {
92 m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector");
93 throw new Exception("User account connector init error");
94 } 102 }
95
96 m_accountCache = new ExpiringCache<UUID, UserAccount>();
97 m_serverUrl = serviceURI;
98 } 103 }
99 } 104 }
100 105
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 9e30044..a8ed66d 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -104,17 +104,23 @@ namespace OpenSim.Services.Connectors.Simulation
104 return false; 104 return false;
105 } 105 }
106 106
107 // Eventually, we want to use a caps url instead of the agentID
108 string uri = string.Empty; 107 string uri = string.Empty;
109 try 108
110 { 109 // HACK -- Simian grid make it work!!!
111 uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; 110 if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:"))
112 } 111 uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
113 catch (Exception e) 112 else
114 { 113 {
115 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); 114 try
116 reason = e.Message; 115 {
117 return false; 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 }
118 } 124 }
119 125
120 //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); 126 //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri);
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 3d722ec..b86fb6f 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -158,7 +158,7 @@ namespace OpenSim.Services.GridService
158 string host = "127.0.0.1"; 158 string host = "127.0.0.1";
159 string portstr; 159 string portstr;
160 string regionName = ""; 160 string regionName = "";
161 uint port = 9000; 161 uint port = 0;
162 string[] parts = mapName.Split(new char[] { ':' }); 162 string[] parts = mapName.Split(new char[] { ':' });
163 if (parts.Length >= 1) 163 if (parts.Length >= 1)
164 { 164 {
@@ -177,18 +177,16 @@ namespace OpenSim.Services.GridService
177 regionName = parts[2]; 177 regionName = parts[2];
178 } 178 }
179 179
180 // Sanity check. 180 //// Sanity check.
181 //IPAddress ipaddr = null; 181 //try
182 try 182 //{
183 { 183 // Util.GetHostFromDNS(host);
184 //ipaddr = Util.GetHostFromDNS(host); 184 //}
185 Util.GetHostFromDNS(host); 185 //catch
186 } 186 //{
187 catch 187 // reason = "Malformed hostname";
188 { 188 // return null;
189 reason = "Malformed hostname"; 189 //}
190 return null;
191 }
192 190
193 GridRegion regInfo; 191 GridRegion regInfo;
194 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason); 192 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason);
@@ -217,6 +215,11 @@ namespace OpenSim.Services.GridService
217 regInfo.RegionLocY = yloc; 215 regInfo.RegionLocY = yloc;
218 regInfo.ScopeID = scopeID; 216 regInfo.ScopeID = scopeID;
219 217
218 // Big HACK for Simian Grid !!!
219 // We need to clean up all URLs used in OpenSim !!!
220 if (externalHostName.Contains("/"))
221 regInfo.ServerURI = externalHostName;
222
220 try 223 try
221 { 224 {
222 regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); 225 regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);
diff --git a/OpenSim/Services/InventoryService/HGInventoryService.cs b/OpenSim/Services/InventoryService/HGInventoryService.cs
index 6e6b019..d62c008 100644
--- a/OpenSim/Services/InventoryService/HGInventoryService.cs
+++ b/OpenSim/Services/InventoryService/HGInventoryService.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Services.InventoryService
44 LogManager.GetLogger( 44 LogManager.GetLogger(
45 MethodBase.GetCurrentMethod().DeclaringType); 45 MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 protected IXInventoryData m_Database; 47 protected new IXInventoryData m_Database;
48 48
49 public HGInventoryService(IConfigSource config) 49 public HGInventoryService(IConfigSource config)
50 : base(config) 50 : base(config)
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index 84306e7..fb395ec 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -293,13 +293,35 @@ namespace OpenSim.Services.InventoryService
293 293
294 public virtual bool AddFolder(InventoryFolderBase folder) 294 public virtual bool AddFolder(InventoryFolderBase folder)
295 { 295 {
296 InventoryFolderBase check = GetFolder(folder);
297 if (check != null)
298 return false;
299
296 XInventoryFolder xFolder = ConvertFromOpenSim(folder); 300 XInventoryFolder xFolder = ConvertFromOpenSim(folder);
297 return m_Database.StoreFolder(xFolder); 301 return m_Database.StoreFolder(xFolder);
298 } 302 }
299 303
300 public virtual bool UpdateFolder(InventoryFolderBase folder) 304 public virtual bool UpdateFolder(InventoryFolderBase folder)
301 { 305 {
302 return AddFolder(folder); 306 XInventoryFolder xFolder = ConvertFromOpenSim(folder);
307 InventoryFolderBase check = GetFolder(folder);
308 if (check == null)
309 return AddFolder(folder);
310
311 if (check.Type != -1 || xFolder.type != -1)
312 {
313 if (xFolder.version > check.Version)
314 return false;
315 check.Version = (ushort)xFolder.version;
316 xFolder = ConvertFromOpenSim(check);
317 return m_Database.StoreFolder(xFolder);
318 }
319
320 if (xFolder.version < check.Version)
321 xFolder.version = check.Version;
322 xFolder.folderID = check.ID;
323
324 return m_Database.StoreFolder(xFolder);
303 } 325 }
304 326
305 public virtual bool MoveFolder(InventoryFolderBase folder) 327 public virtual bool MoveFolder(InventoryFolderBase folder)
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 09be4a2..5ccb912 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -104,7 +104,7 @@ namespace OpenSim.Services.LLLoginService
104 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); 104 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
105 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); 105 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
106 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); 106 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
107 107
108 // These are required; the others aren't 108 // These are required; the others aren't
109 if (accountService == string.Empty || authService == string.Empty) 109 if (accountService == string.Empty || authService == string.Empty)
110 throw new Exception("LoginService is missing service specifications"); 110 throw new Exception("LoginService is missing service specifications");