aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2009-10-01 14:08:15 +0100
committerMelanie2009-10-01 14:08:15 +0100
commit41ff39414bc70ef645e2180693792c83d61a7539 (patch)
treedc711428d4c8fed07791263ff4dfea142d54e4e7 /OpenSim/Region
parentMerge branch 'vehicles' of ssh://opensim@tor.k-grid.com/home/opensim/opensim ... (diff)
parent- adding new LandDataSerializer testcase to "test-xml" target as well (diff)
downloadopensim-SC_OLD-41ff39414bc70ef645e2180693792c83d61a7539.zip
opensim-SC_OLD-41ff39414bc70ef645e2180693792c83d61a7539.tar.gz
opensim-SC_OLD-41ff39414bc70ef645e2180693792c83d61a7539.tar.bz2
opensim-SC_OLD-41ff39414bc70ef645e2180693792c83d61a7539.tar.xz
Merge branch 'master' into vehicles
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/Application.cs2
-rw-r--r--OpenSim/Region/Application/HGCommands.cs215
-rw-r--r--OpenSim/Region/Application/OpenSim.cs17
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs18
-rw-r--r--OpenSim/Region/ClientStack/ClientStackManager.cs8
-rw-r--r--OpenSim/Region/ClientStack/ClientStackUserSettings.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs4
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs4
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs6
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs8
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs8
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs38
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs52
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs3
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs12
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs4
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs6
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs10
-rw-r--r--OpenSim/Region/ClientStack/ThrottleSettings.cs12
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs13
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs11
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGGridServices.cs1024
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs159
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs259
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGUserServices.cs2
-rw-r--r--OpenSim/Region/Communications/Local/CommunicationsLocal.cs10
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs410
-rw-r--r--OpenSim/Region/Communications/Local/LocalUserServices.cs4
-rw-r--r--OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs4
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs937
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs6
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs10
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs2
-rw-r--r--OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs2
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs4
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs24
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs27
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs12
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs16
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs20
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs46
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs36
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs208
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs301
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs57
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs79
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs19
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs10
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs63
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs3
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs26
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs52
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs16
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/WindModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs98
-rw-r--r--OpenSim/Region/DataSnapshot/EstateSnapshot.cs2
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAgentAssetTransactions.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/ICommander.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IDialogModule.cs14
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityCreator.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs6
-rw-r--r--OpenSim/Region/Framework/Interfaces/IFriendsModule.cs6
-rw-r--r--OpenSim/Region/Framework/Interfaces/IGodsModule.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/ILandChannel.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs10
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISoundModule.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IVegetationModule.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/AvatarAnimations.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Border.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/EntityBase.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/EntityManager.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGHyperlink.cs232
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs27
-rw-r--r--OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs200
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs358
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs56
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Types/UpdateQueue.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs12
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs20
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs12
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs2
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs2
-rw-r--r--OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs4
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs4
-rw-r--r--OpenSim/Region/Physics/Manager/VehicleConstants.cs2
-rw-r--r--OpenSim/Region/Physics/Meshing/Mesh.cs2
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs30
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs25
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs50
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs8
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs4
180 files changed, 1662 insertions, 4620 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index 2fd26bf..241af53 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -91,7 +91,7 @@ namespace OpenSim
91 m_log.Info("[OPENSIM MAIN]: configured log4net using default OpenSim.exe.config"); 91 m_log.Info("[OPENSIM MAIN]: configured log4net using default OpenSim.exe.config");
92 } 92 }
93 93
94 // Check if the system is compatible with OpenSimulator. 94 // Check if the system is compatible with OpenSimulator.
95 // Ensures that the minimum system requirements are met 95 // Ensures that the minimum system requirements are met
96 m_log.Info("Performing compatibility checks... "); 96 m_log.Info("Performing compatibility checks... ");
97 string supported = String.Empty; 97 string supported = String.Empty;
diff --git a/OpenSim/Region/Application/HGCommands.cs b/OpenSim/Region/Application/HGCommands.cs
index 1786e54..f503db7 100644
--- a/OpenSim/Region/Application/HGCommands.cs
+++ b/OpenSim/Region/Application/HGCommands.cs
@@ -43,16 +43,11 @@ namespace OpenSim
43 public class HGCommands 43 public class HGCommands
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 public static IHyperlink HGServices = null;
47
48 private static uint m_autoMappingX = 0;
49 private static uint m_autoMappingY = 0;
50 private static bool m_enableAutoMapping = false;
51 46
52 public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager, 47 public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager,
53 StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version) 48 StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version)
54 { 49 {
55 HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices); 50 HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager);
56 51
57 return 52 return
58 new HGScene( 53 new HGScene(
@@ -61,213 +56,5 @@ namespace OpenSim
61 m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); 56 m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
62 } 57 }
63 58
64 public static void RunHGCommand(string command, string[] cmdparams, Scene scene)
65 {
66 if (command.Equals("link-mapping"))
67 {
68 if (cmdparams.Length == 2)
69 {
70 try
71 {
72 m_autoMappingX = Convert.ToUInt32(cmdparams[0]);
73 m_autoMappingY = Convert.ToUInt32(cmdparams[1]);
74 m_enableAutoMapping = true;
75 }
76 catch (Exception)
77 {
78 m_autoMappingX = 0;
79 m_autoMappingY = 0;
80 m_enableAutoMapping = false;
81 }
82 }
83 }
84 else if (command.Equals("link-region"))
85 {
86 if (cmdparams.Length < 3)
87 {
88 if ((cmdparams.Length == 1) || (cmdparams.Length == 2))
89 {
90 LoadXmlLinkFile(cmdparams, scene);
91 }
92 else
93 {
94 LinkRegionCmdUsage();
95 }
96 return;
97 }
98
99 if (cmdparams[2].Contains(":"))
100 {
101 // New format
102 uint xloc, yloc;
103 string mapName;
104 try
105 {
106 xloc = Convert.ToUInt32(cmdparams[0]);
107 yloc = Convert.ToUInt32(cmdparams[1]);
108 mapName = cmdparams[2];
109 if (cmdparams.Length > 3)
110 for (int i = 3; i < cmdparams.Length; i++)
111 mapName += " " + cmdparams[i];
112
113 m_log.Info(">> MapName: " + mapName);
114 //internalPort = Convert.ToUInt32(cmdparams[4]);
115 //remotingPort = Convert.ToUInt32(cmdparams[5]);
116 }
117 catch (Exception e)
118 {
119 m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message);
120 LinkRegionCmdUsage();
121 return;
122 }
123
124 HGHyperlink.TryLinkRegionToCoords(scene, null, mapName, xloc, yloc);
125 }
126 else
127 {
128 // old format
129 RegionInfo regInfo;
130 uint xloc, yloc;
131 uint externalPort;
132 string externalHostName;
133 try
134 {
135 xloc = Convert.ToUInt32(cmdparams[0]);
136 yloc = Convert.ToUInt32(cmdparams[1]);
137 externalPort = Convert.ToUInt32(cmdparams[3]);
138 externalHostName = cmdparams[2];
139 //internalPort = Convert.ToUInt32(cmdparams[4]);
140 //remotingPort = Convert.ToUInt32(cmdparams[5]);
141 }
142 catch (Exception e)
143 {
144 m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message);
145 LinkRegionCmdUsage();
146 return;
147 }
148
149 //if (TryCreateLink(xloc, yloc, externalPort, externalHostName, out regInfo))
150 if (HGHyperlink.TryCreateLink(scene, null, xloc, yloc, "", externalPort, externalHostName, out regInfo))
151 {
152 if (cmdparams.Length >= 5)
153 {
154 regInfo.RegionName = "";
155 for (int i = 4; i < cmdparams.Length; i++)
156 regInfo.RegionName += cmdparams[i] + " ";
157 }
158 }
159 }
160 return;
161 }
162 else if (command.Equals("unlink-region"))
163 {
164 if (cmdparams.Length < 1)
165 {
166 UnlinkRegionCmdUsage();
167 return;
168 }
169 if (HGHyperlink.TryUnlinkRegion(scene, cmdparams[0]))
170 m_log.InfoFormat("[HGrid]: Successfully unlinked {0}", cmdparams[0]);
171 else
172 m_log.InfoFormat("[HGrid]: Unable to unlink {0}, region not found", cmdparams[0]);
173 }
174 }
175
176 private static void LoadXmlLinkFile(string[] cmdparams, Scene scene)
177 {
178 //use http://www.hgurl.com/hypergrid.xml for test
179 try
180 {
181 XmlReader r = XmlReader.Create(cmdparams[0]);
182 XmlConfigSource cs = new XmlConfigSource(r);
183 string[] excludeSections = null;
184
185 if (cmdparams.Length == 2)
186 {
187 if (cmdparams[1].ToLower().StartsWith("excludelist:"))
188 {
189 string excludeString = cmdparams[1].ToLower();
190 excludeString = excludeString.Remove(0, 12);
191 char[] splitter = {';'};
192
193 excludeSections = excludeString.Split(splitter);
194 }
195 }
196
197 for (int i = 0; i < cs.Configs.Count; i++)
198 {
199 bool skip = false;
200 if ((excludeSections != null) && (excludeSections.Length > 0))
201 {
202 for (int n = 0; n < excludeSections.Length; n++)
203 {
204 if (excludeSections[n] == cs.Configs[i].Name.ToLower())
205 {
206 skip = true;
207 break;
208 }
209 }
210 }
211 if (!skip)
212 {
213 ReadLinkFromConfig(cs.Configs[i], scene);
214 }
215 }
216 }
217 catch (Exception e)
218 {
219 m_log.Error(e.ToString());
220 }
221 }
222
223
224 private static void ReadLinkFromConfig(IConfig config, Scene scene)
225 {
226 RegionInfo regInfo;
227 uint xloc, yloc;
228 uint externalPort;
229 string externalHostName;
230 uint realXLoc, realYLoc;
231
232 xloc = Convert.ToUInt32(config.GetString("xloc", "0"));
233 yloc = Convert.ToUInt32(config.GetString("yloc", "0"));
234 externalPort = Convert.ToUInt32(config.GetString("externalPort", "0"));
235 externalHostName = config.GetString("externalHostName", "");
236 realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0"));
237 realYLoc = Convert.ToUInt32(config.GetString("real-yloc", "0"));
238
239 if (m_enableAutoMapping)
240 {
241 xloc = (uint) ((xloc%100) + m_autoMappingX);
242 yloc = (uint) ((yloc%100) + m_autoMappingY);
243 }
244
245 if (((realXLoc == 0) && (realYLoc == 0)) ||
246 (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) &&
247 ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
248 {
249 if (
250 HGHyperlink.TryCreateLink(scene, null, xloc, yloc, "", externalPort,
251 externalHostName, out regInfo))
252 {
253 regInfo.RegionName = config.GetString("localName", "");
254 }
255 }
256 }
257
258
259 private static void LinkRegionCmdUsage()
260 {
261 m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]");
262 m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
263 m_log.Info("Usage: link-region <URI_of_xml> [<exclude>]");
264 }
265
266 private static void UnlinkRegionCmdUsage()
267 {
268 m_log.Info("Usage: unlink-region <HostName>:<HttpPort>");
269 m_log.Info("Usage: unlink-region <LocalName>");
270 }
271
272 } 59 }
273} 60}
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index e9c9dc1..f070812 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -497,7 +497,7 @@ namespace OpenSim
497 { 497 {
498 if (cmd.Length < 4) 498 if (cmd.Length < 4)
499 { 499 {
500 m_log.Error("Usage: create region <region name> <region_file.xml>"); 500 m_log.Error("Usage: create region <region name> <region_file.ini>");
501 return; 501 return;
502 } 502 }
503 if (cmd[3].EndsWith(".xml")) 503 if (cmd[3].EndsWith(".xml"))
@@ -524,7 +524,7 @@ namespace OpenSim
524 } 524 }
525 else 525 else
526 { 526 {
527 m_log.Error("Usage: create region <region name> <region_file.xml>"); 527 m_log.Error("Usage: create region <region name> <region_file.ini>");
528 return; 528 return;
529 } 529 }
530 } 530 }
@@ -755,11 +755,6 @@ namespace OpenSim
755 } 755 }
756 break; 756 break;
757 757
758 case "link-region":
759 case "unlink-region":
760 case "link-mapping":
761 HGCommands.RunHGCommand(command, cmdparams, m_sceneManager.CurrentOrFirstScene);
762 break;
763 } 758 }
764 } 759 }
765 760
@@ -1250,20 +1245,20 @@ namespace OpenSim
1250 protected void LoadOar(string module, string[] cmdparams) 1245 protected void LoadOar(string module, string[] cmdparams)
1251 { 1246 {
1252 try 1247 try
1253 { 1248 {
1254 if (cmdparams.Length > 2) 1249 if (cmdparams.Length > 2)
1255 { 1250 {
1256 m_sceneManager.LoadArchiveToCurrentScene(cmdparams[2]); 1251 m_sceneManager.LoadArchiveToCurrentScene(cmdparams[2]);
1257 } 1252 }
1258 else 1253 else
1259 { 1254 {
1260 m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME); 1255 m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME);
1261 } 1256 }
1262 } 1257 }
1263 catch (Exception e) 1258 catch (Exception e)
1264 { 1259 {
1265 m_log.Error(e.Message); 1260 m_log.Error(e.Message);
1266 } 1261 }
1267 } 1262 }
1268 1263
1269 /// <summary> 1264 /// <summary>
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 4d13e83..468c5d7 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -98,7 +98,7 @@ namespace OpenSim
98 98
99 /// <value> 99 /// <value>
100 /// The config information passed into the OpenSimulator region server. 100 /// The config information passed into the OpenSimulator region server.
101 /// </value> 101 /// </value>
102 public OpenSimConfigSource ConfigSource 102 public OpenSimConfigSource ConfigSource
103 { 103 {
104 get { return m_config; } 104 get { return m_config; }
@@ -383,14 +383,14 @@ namespace OpenSim
383 383
384 scene.SetModuleInterfaces(); 384 scene.SetModuleInterfaces();
385 385
386 // Prims have to be loaded after module configuration since some modules may be invoked during the load 386 // Prims have to be loaded after module configuration since some modules may be invoked during the load
387 scene.LoadPrimsFromStorage(regionInfo.originRegionID); 387 scene.LoadPrimsFromStorage(regionInfo.originRegionID);
388 388
389 // moved these here as the terrain texture has to be created after the modules are initialized 389 // moved these here as the terrain texture has to be created after the modules are initialized
390 // and has to happen before the region is registered with the grid. 390 // and has to happen before the region is registered with the grid.
391 scene.CreateTerrainTexture(false); 391 scene.CreateTerrainTexture(false);
392 392
393 // TODO : Try setting resource for region xstats here on scene 393 // TODO : Try setting resource for region xstats here on scene
394 MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); 394 MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo));
395 395
396 try 396 try
@@ -399,7 +399,7 @@ namespace OpenSim
399 } 399 }
400 catch (Exception e) 400 catch (Exception e)
401 { 401 {
402 m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e); 402 m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e.StackTrace);
403 403
404 // Carrying on now causes a lot of confusion down the 404 // Carrying on now causes a lot of confusion down the
405 // line - we need to get the user's attention 405 // line - we need to get the user's attention
@@ -507,7 +507,7 @@ namespace OpenSim
507 /// Remove a region from the simulator without deleting it permanently. 507 /// Remove a region from the simulator without deleting it permanently.
508 /// </summary> 508 /// </summary>
509 /// <param name="scene"></param> 509 /// <param name="scene"></param>
510 /// <returns></returns> 510 /// <returns></returns>
511 public void CloseRegion(Scene scene) 511 public void CloseRegion(Scene scene)
512 { 512 {
513 // only need to check this if we are not at the 513 // only need to check this if we are not at the
@@ -526,7 +526,7 @@ namespace OpenSim
526 /// Remove a region from the simulator without deleting it permanently. 526 /// Remove a region from the simulator without deleting it permanently.
527 /// </summary> 527 /// </summary>
528 /// <param name="name"></param> 528 /// <param name="name"></param>
529 /// <returns></returns> 529 /// <returns></returns>
530 public void CloseRegion(string name) 530 public void CloseRegion(string name)
531 { 531 {
532 Scene target; 532 Scene target;
@@ -539,7 +539,7 @@ namespace OpenSim
539 /// </summary> 539 /// </summary>
540 /// <param name="regionInfo"></param> 540 /// <param name="regionInfo"></param>
541 /// <param name="clientServer"> </param> 541 /// <param name="clientServer"> </param>
542 /// <returns></returns> 542 /// <returns></returns>
543 protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer) 543 protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer)
544 { 544 {
545 return SetupScene(regionInfo, 0, null, out clientServer); 545 return SetupScene(regionInfo, 0, null, out clientServer);
@@ -750,7 +750,7 @@ namespace OpenSim
750 } 750 }
751 751
752 public string Path 752 public string Path
753 { 753 {
754 // This is for the OpenSimulator instance and is the osSecret hashed 754 // This is for the OpenSimulator instance and is the osSecret hashed
755 get { return "/" + osXStatsURI + "/"; } 755 get { return "/" + osXStatsURI + "/"; }
756 } 756 }
@@ -791,7 +791,7 @@ namespace OpenSim
791 } 791 }
792 792
793 public string Path 793 public string Path
794 { 794 {
795 // This is for the OpenSimulator instance and is the user provided URI 795 // This is for the OpenSimulator instance and is the user provided URI
796 get { return "/" + osUXStatsURI + "/"; } 796 get { return "/" + osUXStatsURI + "/"; }
797 } 797 }
diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs
index 5667d64..84ea0b3 100644
--- a/OpenSim/Region/ClientStack/ClientStackManager.cs
+++ b/OpenSim/Region/ClientStack/ClientStackManager.cs
@@ -87,9 +87,9 @@ namespace OpenSim.Region.ClientStack
87 public IClientNetworkServer CreateServer( 87 public IClientNetworkServer CreateServer(
88 IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, 88 IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port,
89 AgentCircuitManager authenticateClass) 89 AgentCircuitManager authenticateClass)
90 { 90 {
91 return CreateServer( 91 return CreateServer(
92 _listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass); 92 _listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass);
93 } 93 }
94 94
95 /// <summary> 95 /// <summary>
@@ -104,11 +104,11 @@ namespace OpenSim.Region.ClientStack
104 /// </param> 104 /// </param>
105 /// <param name="assetCache"></param> 105 /// <param name="assetCache"></param>
106 /// <param name="authenticateClass"></param> 106 /// <param name="authenticateClass"></param>
107 /// <returns></returns> 107 /// <returns></returns>
108 public IClientNetworkServer CreateServer( 108 public IClientNetworkServer CreateServer(
109 IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, 109 IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource,
110 AgentCircuitManager authenticateClass) 110 AgentCircuitManager authenticateClass)
111 { 111 {
112 if (plugin != null) 112 if (plugin != null)
113 { 113 {
114 IClientNetworkServer server = 114 IClientNetworkServer server =
diff --git a/OpenSim/Region/ClientStack/ClientStackUserSettings.cs b/OpenSim/Region/ClientStack/ClientStackUserSettings.cs
index a3c23cc..231b3aa 100644
--- a/OpenSim/Region/ClientStack/ClientStackUserSettings.cs
+++ b/OpenSim/Region/ClientStack/ClientStackUserSettings.cs
@@ -32,7 +32,7 @@ namespace OpenSim.Region.ClientStack
32 /// 32 ///
33 /// At the moment this is very incomplete - other tweakable settings could be added. This is also somewhat LL client 33 /// At the moment this is very incomplete - other tweakable settings could be added. This is also somewhat LL client
34 /// oriented right now. 34 /// oriented right now.
35 /// </summary> 35 /// </summary>
36 public class ClientStackUserSettings 36 public class ClientStackUserSettings
37 { 37 {
38 /// <summary> 38 /// <summary>
diff --git a/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs
index 665c773..32a4ad4 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/ILLPacketHandler.cs
@@ -31,7 +31,7 @@ using OpenMetaverse.Packets;
31using OpenSim.Framework; 31using OpenSim.Framework;
32 32
33namespace OpenSim.Region.ClientStack.LindenUDP 33namespace OpenSim.Region.ClientStack.LindenUDP
34{ 34{
35 public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes); 35 public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes);
36 public delegate void PacketDrop(Packet pack, Object id); 36 public delegate void PacketDrop(Packet pack, Object id);
37 public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType); 37 public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, UUID agentID, ThrottleOutPacketType throttlePacketType);
@@ -61,7 +61,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
61 /// <summary> 61 /// <summary>
62 /// Take action depending on the type and contents of an received packet. 62 /// Take action depending on the type and contents of an received packet.
63 /// </summary> 63 /// </summary>
64 /// <param name="item"></param> 64 /// <param name="item"></param>
65 void ProcessInPacket(LLQueItem item); 65 void ProcessInPacket(LLQueItem item);
66 66
67 void ProcessOutPacket(LLQueItem item); 67 void ProcessOutPacket(LLQueItem item);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
index 6cffd70..638c765 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
@@ -127,7 +127,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
127 } 127 }
128 else 128 else
129 { 129 {
130 m_asset = asset; 130 m_asset = asset;
131 } 131 }
132 RunUpdate(); 132 RunUpdate();
133 } 133 }
@@ -198,7 +198,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
198 try 198 try
199 { 199 {
200 Buffer.BlockCopy(m_asset.Data, 0, firstImageData, 0, (int)cFirstPacketSize); 200 Buffer.BlockCopy(m_asset.Data, 0, firstImageData, 0, (int)cFirstPacketSize);
201 client.SendImageFirstPart(TexturePacketCount(), m_requestedUUID, (uint)m_asset.Data.Length, firstImageData, 2); 201 client.SendImageFirstPart(TexturePacketCount(), m_requestedUUID, (uint)m_asset.Data.Length, firstImageData, 2);
202 } 202 }
203 catch (Exception) 203 catch (Exception)
204 { 204 {
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 912cbf1..88ace6a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2332,7 +2332,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2332 return itemBlock; 2332 return itemBlock;
2333 } 2333 }
2334 2334
2335 public void SendBulkUpdateInventory(InventoryNodeBase node) 2335 public void SendBulkUpdateInventory(InventoryNodeBase node)
2336 { 2336 {
2337 if (node is InventoryItemBase) 2337 if (node is InventoryItemBase)
2338 SendBulkUpdateInventoryItem((InventoryItemBase)node); 2338 SendBulkUpdateInventoryItem((InventoryItemBase)node);
@@ -2937,7 +2937,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2937 else if (m_avatarTerseUpdates.Count == 1) 2937 else if (m_avatarTerseUpdates.Count == 1)
2938 { 2938 {
2939 lock (m_avatarTerseUpdateTimer) 2939 lock (m_avatarTerseUpdateTimer)
2940 m_avatarTerseUpdateTimer.Start(); 2940 m_avatarTerseUpdateTimer.Start();
2941 } 2941 }
2942 } 2942 }
2943 } 2943 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs
index 798c1e7..c427870 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs
@@ -143,7 +143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
143 TextureThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 2, 4000, userSettings.ClientThrottleMultipler); 143 TextureThrottle = new LLPacketThrottle(1000, throttleMaxBPS / 2, 4000, userSettings.ClientThrottleMultipler);
144 144
145 145
146 // Total Throttle trumps all - it is the number of bits in total that are allowed to go out per second. 146 // Total Throttle trumps all - it is the number of bits in total that are allowed to go out per second.
147 147
148 148
149 ThrottleSettings totalThrottleSettings = userSettings.TotalThrottleSettings; 149 ThrottleSettings totalThrottleSettings = userSettings.TotalThrottleSettings;
@@ -410,7 +410,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
410 { 410 {
411 LLQueItem qpack = ResendOutgoingPacketQueue.Dequeue(); 411 LLQueItem qpack = ResendOutgoingPacketQueue.Dequeue();
412 412
413 SendQueue.Enqueue(qpack); 413 SendQueue.Enqueue(qpack);
414 TotalThrottle.AddBytes(qpack.Length); 414 TotalThrottle.AddBytes(qpack.Length);
415 ResendThrottle.AddBytes(qpack.Length); 415 ResendThrottle.AddBytes(qpack.Length);
416 416
@@ -470,7 +470,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
470 { 470 {
471 LLQueItem qpack = TextureOutgoingPacketQueue.Dequeue(); 471 LLQueItem qpack = TextureOutgoingPacketQueue.Dequeue();
472 472
473 SendQueue.Enqueue(qpack); 473 SendQueue.Enqueue(qpack);
474 TotalThrottle.AddBytes(qpack.Length); 474 TotalThrottle.AddBytes(qpack.Length);
475 TextureThrottle.AddBytes(qpack.Length); 475 TextureThrottle.AddBytes(qpack.Length);
476 qchanged = true; 476 qchanged = true;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
index 56219d1..70d94e7 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
@@ -48,11 +48,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
48 /// <summary> 48 /// <summary>
49 /// Tweakable user settings 49 /// Tweakable user settings
50 /// </summary> 50 /// </summary>
51 private ClientStackUserSettings m_userSettings; 51 private ClientStackUserSettings m_userSettings;
52 52
53 public LLPacketServer(ILLClientStackNetworkHandler networkHandler, ClientStackUserSettings userSettings) 53 public LLPacketServer(ILLClientStackNetworkHandler networkHandler, ClientStackUserSettings userSettings)
54 { 54 {
55 m_userSettings = userSettings; 55 m_userSettings = userSettings;
56 m_networkHandler = networkHandler; 56 m_networkHandler = networkHandler;
57 57
58 m_networkHandler.RegisterPacketServer(this); 58 m_networkHandler.RegisterPacketServer(this);
@@ -114,7 +114,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
114 sessionInfo = circuitManager.AuthenticateSession(sessionId, agentId, circuitCode); 114 sessionInfo = circuitManager.AuthenticateSession(sessionId, agentId, circuitCode);
115 115
116 if (!sessionInfo.Authorised) 116 if (!sessionInfo.Authorised)
117 return false; 117 return false;
118 118
119 return true; 119 return true;
120 } 120 }
@@ -129,7 +129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
129 /// <param name="proxyEP"></param> 129 /// <param name="proxyEP"></param>
130 /// <returns> 130 /// <returns>
131 /// true if a new circuit was created, false if a circuit with the given circuit code already existed 131 /// true if a new circuit was created, false if a circuit with the given circuit code already existed
132 /// </returns> 132 /// </returns>
133 public virtual bool AddNewClient( 133 public virtual bool AddNewClient(
134 EndPoint epSender, UseCircuitCodePacket useCircuit, 134 EndPoint epSender, UseCircuitCodePacket useCircuit,
135 AuthenticateResponse sessionInfo, EndPoint proxyEP) 135 AuthenticateResponse sessionInfo, EndPoint proxyEP)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs
index 01bff6d..52effc5 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketThrottle.cs
@@ -26,7 +26,7 @@
26 */ 26 */
27 27
28namespace OpenSim.Region.ClientStack.LindenUDP 28namespace OpenSim.Region.ClientStack.LindenUDP
29{ 29{
30 public class LLPacketThrottle 30 public class LLPacketThrottle
31 { 31 {
32 private readonly int m_maxAllowableThrottle; 32 private readonly int m_maxAllowableThrottle;
@@ -49,7 +49,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
49 public int Min 49 public int Min
50 { 50 {
51 get { return m_minAllowableThrottle; } 51 get { return m_minAllowableThrottle; }
52 } 52 }
53 53
54 public int Current 54 public int Current
55 { 55 {
@@ -105,13 +105,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
105 105
106 public int Throttle 106 public int Throttle
107 { 107 {
108 get { return m_currentThrottle; } 108 get { return m_currentThrottle; }
109 set 109 set
110 { 110 {
111 if (value < m_minAllowableThrottle) 111 if (value < m_minAllowableThrottle)
112 { 112 {
113 m_currentThrottle = m_minAllowableThrottle; 113 m_currentThrottle = m_minAllowableThrottle;
114 } 114 }
115 else if (value > m_maxAllowableThrottle) 115 else if (value > m_maxAllowableThrottle)
116 { 116 {
117 m_currentThrottle = m_maxAllowableThrottle; 117 m_currentThrottle = m_maxAllowableThrottle;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 9ee8df5..c779b08 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -166,7 +166,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
166 userSettings.ClientThrottleMultipler = config.GetFloat("client_throttle_multiplier"); 166 userSettings.ClientThrottleMultipler = config.GetFloat("client_throttle_multiplier");
167 if (config.Contains("client_socket_rcvbuf_size")) 167 if (config.Contains("client_socket_rcvbuf_size"))
168 m_clientSocketReceiveBuffer = config.GetInt("client_socket_rcvbuf_size"); 168 m_clientSocketReceiveBuffer = config.GetInt("client_socket_rcvbuf_size");
169 } 169 }
170 170
171 m_log.DebugFormat("[CLIENT]: client_throttle_multiplier = {0}", userSettings.ClientThrottleMultipler); 171 m_log.DebugFormat("[CLIENT]: client_throttle_multiplier = {0}", userSettings.ClientThrottleMultipler);
172 m_log.DebugFormat("[CLIENT]: client_socket_rcvbuf_size = {0}", (m_clientSocketReceiveBuffer != 0 ? 172 m_log.DebugFormat("[CLIENT]: client_socket_rcvbuf_size = {0}", (m_clientSocketReceiveBuffer != 0 ?
@@ -228,7 +228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
228 { 228 {
229 m_log.Debug("[CLIENT]: " + e); 229 m_log.Debug("[CLIENT]: " + e);
230 } 230 }
231 } 231 }
232 232
233 233
234 if (proxyPortOffset != 0) 234 if (proxyPortOffset != 0)
@@ -254,7 +254,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
254 if (packet != null) 254 if (packet != null)
255 { 255 {
256 if (packet.Type == PacketType.UseCircuitCode) 256 if (packet.Type == PacketType.UseCircuitCode)
257 AddNewClient((UseCircuitCodePacket)packet, epSender, epProxy); 257 AddNewClient((UseCircuitCodePacket)packet, epSender, epProxy);
258 else 258 else
259 ProcessInPacket(packet, epSender); 259 ProcessInPacket(packet, epSender);
260 } 260 }
@@ -290,7 +290,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
290 catch (Exception e) 290 catch (Exception e)
291 { 291 {
292 m_log.Error("[CLIENT]: Exception in processing packet - ignoring: ", e); 292 m_log.Error("[CLIENT]: Exception in processing packet - ignoring: ", e);
293 } 293 }
294 } 294 }
295 295
296 /// <summary> 296 /// <summary>
@@ -299,7 +299,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
299 protected virtual void BeginReceive() 299 protected virtual void BeginReceive()
300 { 300 {
301 m_socket.BeginReceiveFrom( 301 m_socket.BeginReceiveFrom(
302 RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref reusedEpSender, ReceivedData, null); 302 RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref reusedEpSender, ReceivedData, null);
303 } 303 }
304 304
305 /// <summary> 305 /// <summary>
@@ -322,7 +322,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
322 // ENDLESS LOOP ON PURPOSE! 322 // ENDLESS LOOP ON PURPOSE!
323 // Reset connection and get next UDP packet off the buffer 323 // Reset connection and get next UDP packet off the buffer
324 // If the UDP packet is part of the same stream, this will happen several hundreds of times before 324 // If the UDP packet is part of the same stream, this will happen several hundreds of times before
325 // the next set of UDP data is for a valid client. 325 // the next set of UDP data is for a valid client.
326 326
327 try 327 try
328 { 328 {
@@ -347,7 +347,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
347 m_log.ErrorFormat("[CLIENT]: Exception thrown during BeginReceive(): {0}", ex); 347 m_log.ErrorFormat("[CLIENT]: Exception thrown during BeginReceive(): {0}", ex);
348 } 348 }
349 } 349 }
350 } 350 }
351 351
352 /// <summary> 352 /// <summary>
353 /// Close a client circuit. This is done in response to an exception on receive, and should not be called 353 /// Close a client circuit. This is done in response to an exception on receive, and should not be called
@@ -363,12 +363,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
363 { 363 {
364 m_packetServer.CloseCircuit(circuit); 364 m_packetServer.CloseCircuit(circuit);
365 365
366 if (e != null) 366 if (e != null)
367 m_log.ErrorFormat( 367 m_log.ErrorFormat(
368 "[CLIENT]: Closed circuit {0} {1} due to exception {2}", circuit, reusedEpSender, e); 368 "[CLIENT]: Closed circuit {0} {1} due to exception {2}", circuit, reusedEpSender, e);
369 } 369 }
370 } 370 }
371 } 371 }
372 372
373 /// <summary> 373 /// <summary>
374 /// Finish the process of asynchronously receiving the next bit of raw data 374 /// Finish the process of asynchronously receiving the next bit of raw data
@@ -410,7 +410,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
410 { 410 {
411 m_log.DebugFormat("[CLIENT]: ObjectDisposedException: Object {0} disposed.", e.ObjectName); 411 m_log.DebugFormat("[CLIENT]: ObjectDisposedException: Object {0} disposed.", e.ObjectName);
412 // Uhh, what object, and why? this needs better handling. 412 // Uhh, what object, and why? this needs better handling.
413 } 413 }
414 414
415 return hasReceivedOkay; 415 return hasReceivedOkay;
416 } 416 }
@@ -422,10 +422,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
422 /// <param name="epSender"></param> 422 /// <param name="epSender"></param>
423 /// <param name="epProxy"></param> 423 /// <param name="epProxy"></param>
424 protected virtual void AddNewClient(UseCircuitCodePacket useCircuit, EndPoint epSender, EndPoint epProxy) 424 protected virtual void AddNewClient(UseCircuitCodePacket useCircuit, EndPoint epSender, EndPoint epProxy)
425 { 425 {
426 //Slave regions don't accept new clients 426 //Slave regions don't accept new clients
427 if (m_localScene.RegionStatus != RegionStatus.SlaveScene) 427 if (m_localScene.RegionStatus != RegionStatus.SlaveScene)
428 { 428 {
429 AuthenticateResponse sessionInfo; 429 AuthenticateResponse sessionInfo;
430 bool isNewCircuit = false; 430 bool isNewCircuit = false;
431 431
@@ -441,8 +441,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
441 lock (clientCircuits) 441 lock (clientCircuits)
442 { 442 {
443 if (!clientCircuits.ContainsKey(epSender)) 443 if (!clientCircuits.ContainsKey(epSender))
444 { 444 {
445 clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 445 clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
446 isNewCircuit = true; 446 isNewCircuit = true;
447 } 447 }
448 } 448 }
@@ -461,9 +461,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
461 461
462 //m_log.DebugFormat( 462 //m_log.DebugFormat(
463 // "[CONNECTION SUCCESS]: Incoming client {0} (circuit code {1}) received and authenticated for {2}", 463 // "[CONNECTION SUCCESS]: Incoming client {0} (circuit code {1}) received and authenticated for {2}",
464 // useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code, m_localScene.RegionInfo.RegionName); 464 // useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code, m_localScene.RegionInfo.RegionName);
465 } 465 }
466 } 466 }
467 467
468 // Ack the UseCircuitCode packet 468 // Ack the UseCircuitCode packet
469 PacketAckPacket ack_it = (PacketAckPacket)PacketPool.Instance.GetPacket(PacketType.PacketAck); 469 PacketAckPacket ack_it = (PacketAckPacket)PacketPool.Instance.GetPacket(PacketType.PacketAck);
@@ -605,7 +605,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
605 useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code); 605 useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code);
606 606
607 return; 607 return;
608 } 608 }
609 609
610 lock (clientCircuits) 610 lock (clientCircuits)
611 { 611 {
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs
index f2a8bd2..c45d11f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUtil.cs
@@ -28,7 +28,7 @@
28using OpenMetaverse; 28using OpenMetaverse;
29 29
30namespace OpenSim.Region.ClientStack.LindenUDP 30namespace OpenSim.Region.ClientStack.LindenUDP
31{ 31{
32 public class LLUtil 32 public class LLUtil
33 { 33 {
34 /// <summary> 34 /// <summary>
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
index 9fb1041..daab84f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
54 catch 54 catch
55 { 55 {
56 // I don't care, just leave log4net off 56 // I don't care, just leave log4net off
57 } 57 }
58 } 58 }
59 59
60 /// <summary> 60 /// <summary>
@@ -63,20 +63,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
63 /// <param name="scene"></param> 63 /// <param name="scene"></param>
64 /// <param name="testLLUDPServer"></param> 64 /// <param name="testLLUDPServer"></param>
65 /// <param name="testPacketServer"></param> 65 /// <param name="testPacketServer"></param>
66 /// <param name="acm">Agent circuit manager used in setting up the stack</param> 66 /// <param name="acm">Agent circuit manager used in setting up the stack</param>
67 protected void SetupStack( 67 protected void SetupStack(
68 IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, 68 IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer,
69 out AgentCircuitManager acm) 69 out AgentCircuitManager acm)
70 { 70 {
71 IConfigSource configSource = new IniConfigSource(); 71 IConfigSource configSource = new IniConfigSource();
72 ClientStackUserSettings userSettings = new ClientStackUserSettings(); 72 ClientStackUserSettings userSettings = new ClientStackUserSettings();
73 testLLUDPServer = new TestLLUDPServer(); 73 testLLUDPServer = new TestLLUDPServer();
74 acm = new AgentCircuitManager(); 74 acm = new AgentCircuitManager();
75 75
76 uint port = 666; 76 uint port = 666;
77 testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm); 77 testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm);
78 testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings); 78 testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings);
79 testLLUDPServer.LocalScene = scene; 79 testLLUDPServer.LocalScene = scene;
80 } 80 }
81 81
82 /// <summary> 82 /// <summary>
@@ -124,7 +124,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
124 124
125 acm.AddNewCircuit(circuitCode, acd); 125 acm.AddNewCircuit(circuitCode, acd);
126 126
127 testLLUDPServer.LoadReceive(uccp, epSender); 127 testLLUDPServer.LoadReceive(uccp, epSender);
128 testLLUDPServer.ReceiveData(null); 128 testLLUDPServer.ReceiveData(null);
129 } 129 }
130 130
@@ -142,15 +142,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
142 onp.ObjectData = new ObjectNamePacket.ObjectDataBlock[] { odb }; 142 onp.ObjectData = new ObjectNamePacket.ObjectDataBlock[] { odb };
143 onp.Header.Zerocoded = false; 143 onp.Header.Zerocoded = false;
144 144
145 return onp; 145 return onp;
146 } 146 }
147 147
148 /// <summary> 148 /// <summary>
149 /// Test adding a client to the stack 149 /// Test adding a client to the stack
150 /// </summary> 150 /// </summary>
151 [Test, LongRunning] 151 [Test, LongRunning]
152 public void TestAddClient() 152 public void TestAddClient()
153 { 153 {
154 TestHelper.InMethod(); 154 TestHelper.InMethod();
155 155
156 uint myCircuitCode = 123456; 156 uint myCircuitCode = 123456;
@@ -177,7 +177,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
177 177
178 EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999); 178 EndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);
179 179
180 testLLUDPServer.LoadReceive(uccp, testEp); 180 testLLUDPServer.LoadReceive(uccp, testEp);
181 testLLUDPServer.ReceiveData(null); 181 testLLUDPServer.ReceiveData(null);
182 182
183 // Circuit shouildn't exist since the circuit manager doesn't know about this circuit for authentication yet 183 // Circuit shouildn't exist since the circuit manager doesn't know about this circuit for authentication yet
@@ -185,8 +185,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
185 185
186 acm.AddNewCircuit(myCircuitCode, acd); 186 acm.AddNewCircuit(myCircuitCode, acd);
187 187
188 testLLUDPServer.LoadReceive(uccp, testEp); 188 testLLUDPServer.LoadReceive(uccp, testEp);
189 testLLUDPServer.ReceiveData(null); 189 testLLUDPServer.ReceiveData(null);
190 190
191 // Should succeed now 191 // Should succeed now
192 Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode)); 192 Assert.IsTrue(testLLUDPServer.HasCircuit(myCircuitCode));
@@ -196,24 +196,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
196 /// <summary> 196 /// <summary>
197 /// Test removing a client from the stack 197 /// Test removing a client from the stack
198 /// </summary> 198 /// </summary>
199 [Test] 199 [Test]
200 public void TestRemoveClient() 200 public void TestRemoveClient()
201 { 201 {
202 TestHelper.InMethod(); 202 TestHelper.InMethod();
203 203
204 uint myCircuitCode = 123457; 204 uint myCircuitCode = 123457;
205 205
206 TestLLUDPServer testLLUDPServer; 206 TestLLUDPServer testLLUDPServer;
207 TestLLPacketServer testLLPacketServer; 207 TestLLPacketServer testLLPacketServer;
208 AgentCircuitManager acm; 208 AgentCircuitManager acm;
209 SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm); 209 SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm);
210 AddClient(myCircuitCode, new IPEndPoint(IPAddress.Loopback, 1000), testLLUDPServer, acm); 210 AddClient(myCircuitCode, new IPEndPoint(IPAddress.Loopback, 1000), testLLUDPServer, acm);
211 211
212 testLLUDPServer.RemoveClientCircuit(myCircuitCode); 212 testLLUDPServer.RemoveClientCircuit(myCircuitCode);
213 Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode)); 213 Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode));
214 214
215 // Check that removing a non-existant circuit doesn't have any bad effects 215 // Check that removing a non-existant circuit doesn't have any bad effects
216 testLLUDPServer.RemoveClientCircuit(101); 216 testLLUDPServer.RemoveClientCircuit(101);
217 Assert.IsFalse(testLLUDPServer.HasCircuit(101)); 217 Assert.IsFalse(testLLUDPServer.HasCircuit(101));
218 } 218 }
219 219
@@ -232,8 +232,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
232 TestLLUDPServer testLLUDPServer; 232 TestLLUDPServer testLLUDPServer;
233 TestLLPacketServer testLLPacketServer; 233 TestLLPacketServer testLLPacketServer;
234 AgentCircuitManager acm; 234 AgentCircuitManager acm;
235 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); 235 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
236 AddClient(myCircuitCode, testEp, testLLUDPServer, acm); 236 AddClient(myCircuitCode, testEp, testLLUDPServer, acm);
237 237
238 byte[] data = new byte[] { 0x01, 0x02, 0x03, 0x04 }; 238 byte[] data = new byte[] { 0x01, 0x02, 0x03, 0x04 };
239 239
@@ -252,7 +252,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
252 testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "helloooo"), testEp); 252 testLLUDPServer.LoadReceive(BuildTestObjectNamePacket(1, "helloooo"), testEp);
253 testLLUDPServer.ReceiveData(null); 253 testLLUDPServer.ReceiveData(null);
254 254
255 Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(1)); 255 Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(1));
256 Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(1)); 256 Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(1));
257 } 257 }
258 258
@@ -270,17 +270,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
270 uint circuitCodeA = 130000; 270 uint circuitCodeA = 130000;
271 EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300); 271 EndPoint epA = new IPEndPoint(IPAddress.Loopback, 1300);
272 UUID agentIdA = UUID.Parse("00000000-0000-0000-0000-000000001300"); 272 UUID agentIdA = UUID.Parse("00000000-0000-0000-0000-000000001300");
273 UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300"); 273 UUID sessionIdA = UUID.Parse("00000000-0000-0000-0000-000000002300");
274 274
275 uint circuitCodeB = 130001; 275 uint circuitCodeB = 130001;
276 EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301); 276 EndPoint epB = new IPEndPoint(IPAddress.Loopback, 1301);
277 UUID agentIdB = UUID.Parse("00000000-0000-0000-0000-000000001301"); 277 UUID agentIdB = UUID.Parse("00000000-0000-0000-0000-000000001301");
278 UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301"); 278 UUID sessionIdB = UUID.Parse("00000000-0000-0000-0000-000000002301");
279 279
280 TestLLUDPServer testLLUDPServer; 280 TestLLUDPServer testLLUDPServer;
281 TestLLPacketServer testLLPacketServer; 281 TestLLPacketServer testLLPacketServer;
282 AgentCircuitManager acm; 282 AgentCircuitManager acm;
283 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm); 283 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
284 AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm); 284 AddClient(circuitCodeA, epA, agentIdA, sessionIdA, testLLUDPServer, acm);
285 AddClient(circuitCodeB, epB, agentIdB, sessionIdB, testLLUDPServer, acm); 285 AddClient(circuitCodeB, epB, agentIdB, sessionIdB, testLLUDPServer, acm);
286 286
@@ -292,8 +292,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
292 292
293 Assert.IsFalse(testLLUDPServer.HasCircuit(circuitCodeA)); 293 Assert.IsFalse(testLLUDPServer.HasCircuit(circuitCodeA));
294 294
295 Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(3)); 295 Assert.That(testLLPacketServer.GetTotalPacketsReceived(), Is.EqualTo(3));
296 Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3)); 296 Assert.That(testLLPacketServer.GetPacketsReceivedFor(PacketType.ObjectName), Is.EqualTo(3));
297 } 297 }
298 } 298 }
299} 299}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs
index c831f68..34c21aa 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs
@@ -28,6 +28,7 @@
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenSim.Region.Framework.Scenes; 30using OpenSim.Region.Framework.Scenes;
31using GridRegion = OpenSim.Services.Interfaces.GridRegion;
31 32
32namespace OpenSim.Region.ClientStack.LindenUDP.Tests 33namespace OpenSim.Region.ClientStack.LindenUDP.Tests
33{ 34{
@@ -58,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
58 59
59 public override void RemoveClient(UUID agentID) {} 60 public override void RemoveClient(UUID agentID) {}
60 public override void CloseAllAgents(uint circuitcode) {} 61 public override void CloseAllAgents(uint circuitcode) {}
61 public override bool OtherRegionUp(RegionInfo thisRegion) { return false; } 62 public override void OtherRegionUp(GridRegion otherRegion) { }
62 63
63 /// <summary> 64 /// <summary>
64 /// Doesn't really matter what the call is - we're using this to test that a packet has actually been received 65 /// Doesn't really matter what the call is - we're using this to test that a packet has actually been received
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
index 8b11ccc..cde155b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
45 [Test] 45 [Test]
46 /// <summary> 46 /// <summary>
47 /// More a placeholder, really 47 /// More a placeholder, really
48 /// </summary> 48 /// </summary>
49 public void InPacketTest() 49 public void InPacketTest()
50 { 50 {
51 TestHelper.InMethod(); 51 TestHelper.InMethod();
@@ -87,20 +87,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
87 /// <param name="scene"></param> 87 /// <param name="scene"></param>
88 /// <param name="testLLUDPServer"></param> 88 /// <param name="testLLUDPServer"></param>
89 /// <param name="testPacketServer"></param> 89 /// <param name="testPacketServer"></param>
90 /// <param name="acm">Agent circuit manager used in setting up the stack</param> 90 /// <param name="acm">Agent circuit manager used in setting up the stack</param>
91 protected void SetupStack( 91 protected void SetupStack(
92 IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, 92 IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer,
93 out AgentCircuitManager acm) 93 out AgentCircuitManager acm)
94 { 94 {
95 IConfigSource configSource = new IniConfigSource(); 95 IConfigSource configSource = new IniConfigSource();
96 ClientStackUserSettings userSettings = new ClientStackUserSettings(); 96 ClientStackUserSettings userSettings = new ClientStackUserSettings();
97 testLLUDPServer = new TestLLUDPServer(); 97 testLLUDPServer = new TestLLUDPServer();
98 acm = new AgentCircuitManager(); 98 acm = new AgentCircuitManager();
99 99
100 uint port = 666; 100 uint port = 666;
101 testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm); 101 testLLUDPServer.Initialise(null, ref port, 0, false, configSource, acm);
102 testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings); 102 testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings);
103 testLLUDPServer.LocalScene = scene; 103 testLLUDPServer.LocalScene = scene;
104 } 104 }
105 } 105 }
106} 106}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs
index d055969..1fba847 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLPacketServer.cs
@@ -31,7 +31,7 @@ using OpenMetaverse.Packets;
31namespace OpenSim.Region.ClientStack.LindenUDP.Tests 31namespace OpenSim.Region.ClientStack.LindenUDP.Tests
32{ 32{
33 public class TestLLPacketServer : LLPacketServer 33 public class TestLLPacketServer : LLPacketServer
34 { 34 {
35 /// <summary> 35 /// <summary>
36 /// Record counts of packets received 36 /// Record counts of packets received
37 /// </summary> 37 /// </summary>
@@ -49,7 +49,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
49 m_packetsReceived[packet.Type]++; 49 m_packetsReceived[packet.Type]++;
50 else 50 else
51 m_packetsReceived[packet.Type] = 1; 51 m_packetsReceived[packet.Type] = 1;
52 } 52 }
53 53
54 public int GetTotalPacketsReceived() 54 public int GetTotalPacketsReceived()
55 { 55 {
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs
index 1dffefb..f98586d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/TestLLUDPServer.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
66 ChunkSenderTuple tuple = m_chunksToLoad.Dequeue(); 66 ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
67 RecvBuffer = tuple.Data; 67 RecvBuffer = tuple.Data;
68 numBytes = tuple.Data.Length; 68 numBytes = tuple.Data.Length;
69 epSender = tuple.Sender; 69 epSender = tuple.Sender;
70 70
71 return true; 71 return true;
72 } 72 }
@@ -114,7 +114,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
114 { 114 {
115 while (m_chunksToLoad.Count > 0) 115 while (m_chunksToLoad.Count > 0)
116 OnReceivedData(result); 116 OnReceivedData(result);
117 } 117 }
118 118
119 /// <summary> 119 /// <summary>
120 /// Has a circuit with the given code been established? 120 /// Has a circuit with the given code been established?
@@ -134,7 +134,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
134 /// Record the data and sender tuple 134 /// Record the data and sender tuple
135 /// </summary> 135 /// </summary>
136 public class ChunkSenderTuple 136 public class ChunkSenderTuple
137 { 137 {
138 public byte[] Data; 138 public byte[] Data;
139 public EndPoint Sender; 139 public EndPoint Sender;
140 public bool BeginReceiveException; 140 public bool BeginReceiveException;
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index a266a40..c7aeca14 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.ClientStack
61 get { return m_commsManager; } 61 get { return m_commsManager; }
62 set { m_commsManager = value; } 62 set { m_commsManager = value; }
63 } 63 }
64 protected CommunicationsManager m_commsManager; 64 protected CommunicationsManager m_commsManager;
65 65
66 protected StorageManager m_storageManager; 66 protected StorageManager m_storageManager;
67 67
@@ -80,15 +80,15 @@ namespace OpenSim.Region.ClientStack
80 /// </summary> 80 /// </summary>
81 /// 81 ///
82 /// <param name="osSceneIdentifier"> 82 /// <param name="osSceneIdentifier">
83 /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. 83 /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages.
84 /// </param> 84 /// </param>
85 /// <returns></returns> 85 /// <returns></returns>
86 protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier); 86 protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier);
87 87
88 protected abstract StorageManager CreateStorageManager(); 88 protected abstract StorageManager CreateStorageManager();
89 protected abstract ClientStackManager CreateClientStackManager(); 89 protected abstract ClientStackManager CreateClientStackManager();
90 protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, 90 protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
91 AgentCircuitManager circuitManager); 91 AgentCircuitManager circuitManager);
92 92
93 protected override void StartupSpecific() 93 protected override void StartupSpecific()
94 { 94 {
@@ -121,7 +121,7 @@ namespace OpenSim.Region.ClientStack
121 /// <param name="meshEngine">The name of the mesh engine to use</param> 121 /// <param name="meshEngine">The name of the mesh engine to use</param>
122 /// <param name="config">The configuration data to pass to the physics and mesh engines</param> 122 /// <param name="config">The configuration data to pass to the physics and mesh engines</param>
123 /// <param name="osSceneIdentifier"> 123 /// <param name="osSceneIdentifier">
124 /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. 124 /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages.
125 /// </param> 125 /// </param>
126 /// <returns></returns> 126 /// <returns></returns>
127 protected PhysicsScene GetPhysicsScene( 127 protected PhysicsScene GetPhysicsScene(
diff --git a/OpenSim/Region/ClientStack/ThrottleSettings.cs b/OpenSim/Region/ClientStack/ThrottleSettings.cs
index 5dcb706..fe4718c 100644
--- a/OpenSim/Region/ClientStack/ThrottleSettings.cs
+++ b/OpenSim/Region/ClientStack/ThrottleSettings.cs
@@ -26,12 +26,12 @@
26 */ 26 */
27 27
28namespace OpenSim.Region.ClientStack 28namespace OpenSim.Region.ClientStack
29{ 29{
30 /// <summary> 30 /// <summary>
31 /// Represent throttle settings for a client stack. These settings are in bytes per second 31 /// Represent throttle settings for a client stack. These settings are in bytes per second
32 /// </summary> 32 /// </summary>
33 public class ThrottleSettings 33 public class ThrottleSettings
34 { 34 {
35 /// <summary> 35 /// <summary>
36 /// Minimum bytes per second that the throttle can be set to. 36 /// Minimum bytes per second that the throttle can be set to.
37 /// </summary> 37 /// </summary>
@@ -39,13 +39,13 @@ namespace OpenSim.Region.ClientStack
39 39
40 /// <summary> 40 /// <summary>
41 /// Maximum bytes per second that the throttle can be set to. 41 /// Maximum bytes per second that the throttle can be set to.
42 /// </summary> 42 /// </summary>
43 public int Max; 43 public int Max;
44 44
45 /// <summary> 45 /// <summary>
46 /// Current bytes per second that the throttle should be set to. 46 /// Current bytes per second that the throttle should be set to.
47 /// </summary> 47 /// </summary>
48 public int Current; 48 public int Current;
49 49
50 public ThrottleSettings(int min, int max, int current) 50 public ThrottleSettings(int min, int max, int current)
51 { 51 {
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs
index 80f2e79..e80f6ab 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs
@@ -40,30 +40,21 @@ namespace OpenSim.Region.Communications.Hypergrid
40{ 40{
41 public class HGCommunicationsGridMode : CommunicationsManager // CommunicationsOGS1 41 public class HGCommunicationsGridMode : CommunicationsManager // CommunicationsOGS1
42 { 42 {
43 IHyperlink m_osw = null;
44 public IHyperlink HGServices
45 {
46 get { return m_osw; }
47 }
48 43
49 public HGCommunicationsGridMode( 44 public HGCommunicationsGridMode(
50 NetworkServersInfo serversInfo, 45 NetworkServersInfo serversInfo,
51 SceneManager sman, LibraryRootFolder libraryRootFolder) 46 SceneManager sman, LibraryRootFolder libraryRootFolder)
52 : base(serversInfo, libraryRootFolder) 47 : base(serversInfo, libraryRootFolder)
53 { 48 {
54 // From constructor at CommunicationsOGS1
55 HGGridServices gridInterComms = new HGGridServicesGridMode(serversInfo, sman, m_userProfileCacheService);
56 m_gridService = gridInterComms;
57 m_osw = gridInterComms;
58 49
59 HGUserServices userServices = new HGUserServices(this); 50 HGUserServices userServices = new HGUserServices(this);
60 // This plugin arrangement could eventually be configurable rather than hardcoded here. 51 // This plugin arrangement could eventually be configurable rather than hardcoded here.
61 userServices.AddPlugin(new TemporaryUserProfilePlugin()); 52 userServices.AddPlugin(new TemporaryUserProfilePlugin());
62 userServices.AddPlugin(new HGUserDataPlugin(this, userServices)); 53 userServices.AddPlugin(new HGUserDataPlugin(this, userServices));
63 54
64 m_userService = userServices; 55 m_userService = userServices;
65 m_messageService = userServices; 56 m_messageService = userServices;
66 m_avatarService = userServices; 57 m_avatarService = userServices;
67 } 58 }
68 } 59 }
69} 60}
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs
index e4e12d4..4e3f5a1 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs
@@ -41,14 +41,13 @@ namespace OpenSim.Region.Communications.Hypergrid
41 public class HGCommunicationsStandalone : CommunicationsManager 41 public class HGCommunicationsStandalone : CommunicationsManager
42 { 42 {
43 public HGCommunicationsStandalone( 43 public HGCommunicationsStandalone(
44 ConfigSettings configSettings, 44 ConfigSettings configSettings,
45 NetworkServersInfo serversInfo, 45 NetworkServersInfo serversInfo,
46 BaseHttpServer httpServer, 46 BaseHttpServer httpServer,
47 HGGridServices gridService,
48 LibraryRootFolder libraryRootFolder, 47 LibraryRootFolder libraryRootFolder,
49 bool dumpAssetsToFile) 48 bool dumpAssetsToFile)
50 : base(serversInfo, libraryRootFolder) 49 : base(serversInfo, libraryRootFolder)
51 { 50 {
52 LocalUserServices localUserService = 51 LocalUserServices localUserService =
53 new LocalUserServices( 52 new LocalUserServices(
54 serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this); 53 serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
@@ -59,13 +58,11 @@ namespace OpenSim.Region.Communications.Hypergrid
59 hgUserService.AddPlugin(new TemporaryUserProfilePlugin()); 58 hgUserService.AddPlugin(new TemporaryUserProfilePlugin());
60 hgUserService.AddPlugin(new HGUserDataPlugin(this, hgUserService)); 59 hgUserService.AddPlugin(new HGUserDataPlugin(this, hgUserService));
61 60
62 m_userService = hgUserService; 61 m_userService = hgUserService;
63 m_userAdminService = hgUserService; 62 m_userAdminService = hgUserService;
64 m_avatarService = hgUserService; 63 m_avatarService = hgUserService;
65 m_messageService = hgUserService; 64 m_messageService = hgUserService;
66 65
67 gridService.UserProfileCache = m_userProfileCacheService;
68 m_gridService = gridService;
69 } 66 }
70 } 67 }
71} 68}
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
deleted file mode 100644
index 54cde0f..0000000
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
+++ /dev/null
@@ -1,1024 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28
29using System;
30using System.Collections;
31using System.Collections.Generic;
32using System.Drawing;
33using System.Net;
34using System.Net.Sockets;
35using System.Reflection;
36using System.Runtime.Remoting;
37using System.Security.Authentication;
38using log4net;
39using Nwc.XmlRpc;
40using OpenMetaverse;
41using OpenMetaverse.Imaging;
42using OpenSim.Framework;
43using OpenSim.Framework.Communications;
44using OpenSim.Framework.Communications.Cache;
45using OpenSim.Framework.Servers;
46using OpenSim.Framework.Servers.HttpServer;
47using OpenSim.Region.Communications.OGS1;
48using OpenSim.Region.Framework.Scenes;
49using OpenSim.Services.Interfaces;
50// using OpenSim.Region.Environment.Modules.Framework;
51
52namespace OpenSim.Region.Communications.Hypergrid
53{
54 /// <summary>
55 /// This class encapsulates the main hypergrid functions related to creating and managing
56 /// hyperlinks, as well as processing all the inter-region comms between a region and
57 /// an hyperlinked region.
58 /// </summary>
59 public class HGGridServices : IGridServices, IHyperlink
60 {
61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
62
63
64 public BaseHttpServer httpListener;
65 public NetworkServersInfo serversInfo;
66
67 protected List<RegionInfo> m_regionsOnInstance = new List<RegionInfo>();
68
69 // Hyperlink regions are hyperlinks on the map
70 protected List<RegionInfo> m_hyperlinkRegions = new List<RegionInfo>();
71
72 // Known regions are home regions of visiting foreign users.
73 // They are not on the map as static hyperlinks. They are dynamic hyperlinks, they go away when
74 // the visitor goes away. They are mapped to X=0 on the map.
75 // This is key-ed on agent ID
76 protected Dictionary<UUID, RegionInfo> m_knownRegions = new Dictionary<UUID, RegionInfo>();
77
78 protected UserProfileCacheService m_userProfileCache;
79 protected SceneManager m_sceneman;
80
81 private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>();
82
83 public virtual string gdebugRegionName
84 {
85 get { return "Override me"; }
86 set { ; }
87 }
88
89 public string rdebugRegionName
90 {
91 get { return _rdebugRegionName; }
92 set { _rdebugRegionName = value; }
93 }
94 private string _rdebugRegionName = String.Empty;
95
96 public virtual bool RegionLoginsEnabled
97 {
98 get { return true; }
99 set { ; }
100 }
101
102 public UserProfileCacheService UserProfileCache
103 {
104 set { m_userProfileCache = value; }
105 }
106
107 private Random random;
108
109 /// <summary>
110 /// Contructor. Adds "expect_hg_user" and "check" xmlrpc method handlers
111 /// </summary>
112 /// <param name="servers_info"></param>
113 public HGGridServices(NetworkServersInfo servers_info, SceneManager sman)
114 {
115 serversInfo = servers_info;
116 m_sceneman = sman;
117
118 random = new Random();
119
120 MainServer.Instance.AddXmlRPCHandler("link_region", LinkRegionRequest);
121 MainServer.Instance.AddXmlRPCHandler("expect_hg_user", ExpectHGUser);
122
123 HGNetworkServersInfo.Init(servers_info.AssetURL, servers_info.InventoryURL, servers_info.UserURL);
124 }
125
126 // see IGridServices
127 public virtual RegionCommsListener RegisterRegion(RegionInfo regionInfo)
128 {
129 // Region doesn't exist here. Trying to link remote region
130
131 m_log.Info("[HGrid]: Linking remote region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort);
132 regionInfo.RegionID = LinkRegion(regionInfo); // UUID.Random();
133 if (!regionInfo.RegionID.Equals(UUID.Zero))
134 {
135 m_hyperlinkRegions.Add(regionInfo);
136 m_log.Info("[HGrid]: Successfully linked to region_uuid " + regionInfo.RegionID);
137
138 //Try get the map image
139 GetMapImage(regionInfo);
140 }
141 else
142 {
143 m_log.Info("[HGrid]: No such region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "(" + regionInfo.InternalEndPoint.Port + ")");
144 }
145 // Note that these remote regions aren't registered in localBackend, so return null, no local listeners
146 return null;
147 }
148
149 // see IGridServices
150 public virtual bool DeregisterRegion(RegionInfo regionInfo)
151 {
152 if (m_hyperlinkRegions.Contains(regionInfo))
153 {
154 m_hyperlinkRegions.Remove(regionInfo);
155 return true;
156 }
157 foreach (KeyValuePair<UUID, RegionInfo> kvp in m_knownRegions)
158 {
159 if (kvp.Value == regionInfo)
160 {
161 m_knownRegions.Remove(kvp.Key);
162 return true;
163 }
164 }
165 return false;
166 }
167
168 public virtual Dictionary<string, string> GetGridSettings()
169 {
170 Dictionary<string, string> returnGridSettings = new Dictionary<string, string>();
171 lock (m_queuedGridSettings)
172 {
173 foreach (string Dictkey in m_queuedGridSettings.Keys)
174 {
175 returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]);
176 }
177
178 m_queuedGridSettings.Clear();
179 }
180
181 return returnGridSettings;
182 }
183
184 // see IGridServices
185 public virtual List<SimpleRegionInfo> RequestNeighbours(uint x, uint y)
186 {
187 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
188 foreach (RegionInfo reg in m_hyperlinkRegions)
189 {
190 if (reg.RegionLocX != x || reg.RegionLocY != y)
191 {
192 //m_log.Debug("CommsManager- RequestNeighbours() - found a different region in list, checking location");
193 if ((reg.RegionLocX > (x - 2)) && (reg.RegionLocX < (x + 2)))
194 {
195 if ((reg.RegionLocY > (y - 2)) && (reg.RegionLocY < (y + 2)))
196 {
197 neighbours.Add(reg);
198 }
199 }
200 }
201 }
202
203 return neighbours;
204 }
205
206 /// <summary>
207 /// Request information about a region.
208 /// </summary>
209 /// <param name="regionHandle"></param>
210 /// <returns>
211 /// null on a failure to contact or get a response from the grid server
212 /// FIXME: Might be nicer to return a proper exception here since we could inform the client more about the
213 /// nature of the faiulre.
214 /// </returns>
215 public virtual RegionInfo RequestNeighbourInfo(UUID Region_UUID)
216 {
217 foreach (RegionInfo info in m_hyperlinkRegions)
218 {
219 if (info.RegionID == Region_UUID) return info;
220 }
221
222 // I don't trust region uuids to be unique...
223 //foreach (RegionInfo info in m_knownRegions.Values)
224 //{
225 // if (info.RegionID == Region_UUID) return info;
226 //}
227
228 return null;
229 }
230
231 /// <summary>
232 /// Request information about a region.
233 /// </summary>
234 /// <param name="regionHandle"></param>
235 /// <returns></returns>
236 public virtual RegionInfo RequestNeighbourInfo(ulong regionHandle)
237 {
238 //m_log.Debug(" >> RequestNeighbourInfo for " + regionHandle);
239 foreach (RegionInfo info in m_hyperlinkRegions)
240 {
241 //m_log.Debug(" .. " + info.RegionHandle);
242 if (info.RegionHandle == regionHandle) return info;
243 }
244
245 foreach (RegionInfo info in m_knownRegions.Values)
246 {
247 if (info.RegionHandle == regionHandle)
248 {
249 //m_log.Debug("XXX------ known region " + info.RegionHandle);
250 return info;
251 }
252 }
253
254 return null;
255 }
256
257 public virtual RegionInfo RequestNeighbourInfo(string name)
258 {
259 foreach (RegionInfo info in m_hyperlinkRegions)
260 {
261 //m_log.Debug(" .. " + info.RegionHandle);
262 if (info.RegionName == name) return info;
263 }
264
265 foreach (RegionInfo info in m_knownRegions.Values)
266 {
267 if (info.RegionName == name)
268 {
269 //m_log.Debug("XXX------ known region " + info.RegionHandle);
270 return info;
271 }
272 }
273
274 return null;
275 }
276
277 public virtual RegionInfo RequestNeighbourInfo(string hostName, uint port)
278 {
279 foreach (RegionInfo info in m_hyperlinkRegions)
280 {
281 //m_log.Debug(" .. " + info.RegionHandle);
282 if ((info.ExternalHostName == hostName) && (info.HttpPort == port))
283 return info;
284 }
285
286 foreach (RegionInfo info in m_knownRegions.Values)
287 {
288 if ((info.ExternalHostName == hostName) && (info.HttpPort == port))
289 {
290 //m_log.Debug("XXX------ known region " + info.RegionHandle);
291 return info;
292 }
293 }
294
295 return null;
296 }
297
298 public virtual RegionInfo RequestClosestRegion(string regionName)
299 {
300 foreach (RegionInfo info in m_hyperlinkRegions)
301 {
302 if (info.RegionName == regionName) return info;
303 }
304
305 return null;
306 }
307
308 /// <summary>
309 ///
310 /// </summary>
311 /// <param name="minX"></param>
312 /// <param name="minY"></param>
313 /// <param name="maxX"></param>
314 /// <param name="maxY"></param>
315 /// <returns></returns>
316 public virtual List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
317 {
318 List<MapBlockData> neighbours = new List<MapBlockData>();
319
320 foreach (RegionInfo regInfo in m_hyperlinkRegions)
321 {
322 if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) &&
323 ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY)))
324 {
325 MapBlockData map = new MapBlockData();
326 map.Name = regInfo.RegionName;
327 map.X = (ushort)regInfo.RegionLocX;
328 map.Y = (ushort)regInfo.RegionLocY;
329 map.WaterHeight = (byte)regInfo.RegionSettings.WaterHeight;
330 map.MapImageId = regInfo.RegionSettings.TerrainImageID;
331 // m_log.Debug("ImgID: " + map.MapImageId);
332 map.Agents = 1;
333 map.RegionFlags = 72458694;
334 map.Access = regInfo.AccessLevel;
335 neighbours.Add(map);
336 }
337 }
338
339 return neighbours;
340 }
341
342
343 protected virtual void GetMapImage(RegionInfo info)
344 {
345 try
346 {
347 string regionimage = "regionImage" + info.RegionID.ToString();
348 regionimage = regionimage.Replace("-", "");
349
350 WebClient c = new WebClient();
351 string uri = "http://" + info.ExternalHostName + ":" + info.HttpPort + "/index.php?method=" + regionimage;
352 //m_log.Debug("JPEG: " + uri);
353 c.DownloadFile(uri, info.RegionID.ToString() + ".jpg");
354 Bitmap m = new Bitmap(info.RegionID.ToString() + ".jpg");
355 //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
356 byte[] imageData = OpenJPEG.EncodeFromImage(m, true);
357 AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString());
358 info.RegionSettings.TerrainImageID = ass.FullID;
359 ass.Type = (int)AssetType.Texture;
360 ass.Temporary = false;
361 ass.Local = true;
362 ass.Data = imageData;
363
364 m_sceneman.CurrentOrFirstScene.AssetService.Store(ass);
365
366 }
367 catch // LEGIT: Catching problems caused by OpenJPEG p/invoke
368 {
369 m_log.Warn("[HGrid]: Failed getting/storing map image, because it is probably already in the cache");
370 }
371 }
372
373 // A little ugly, since this code is exactly the same as OSG1's, and we're already
374 // calling that for when the region in in grid mode... (for the grid regions)
375 //
376 public virtual LandData RequestLandData (ulong regionHandle, uint x, uint y)
377 {
378 m_log.DebugFormat("[HGrid]: requests land data in {0}, at {1}, {2}",
379 regionHandle, x, y);
380
381 // Remote region
382
383 Hashtable hash = new Hashtable();
384 hash["region_handle"] = regionHandle.ToString();
385 hash["x"] = x.ToString();
386 hash["y"] = y.ToString();
387
388 IList paramList = new ArrayList();
389 paramList.Add(hash);
390 LandData landData = null;
391
392 try
393 {
394 RegionInfo info = RequestNeighbourInfo(regionHandle);
395 if (info != null) // just to be sure
396 {
397 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
398 string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
399 XmlRpcResponse response = request.Send(uri, 10000);
400 if (response.IsFault)
401 {
402 m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString);
403 }
404 else
405 {
406 hash = (Hashtable)response.Value;
407 try
408 {
409 landData = new LandData();
410 landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]);
411 landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]);
412 landData.Area = Convert.ToInt32(hash["Area"]);
413 landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]);
414 landData.Description = (string)hash["Description"];
415 landData.Flags = Convert.ToUInt32(hash["Flags"]);
416 landData.GlobalID = new UUID((string)hash["GlobalID"]);
417 landData.Name = (string)hash["Name"];
418 landData.OwnerID = new UUID((string)hash["OwnerID"]);
419 landData.SalePrice = Convert.ToInt32(hash["SalePrice"]);
420 landData.SnapshotID = new UUID((string)hash["SnapshotID"]);
421 landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]);
422 m_log.DebugFormat("[HGrid]: Got land data for parcel {0}", landData.Name);
423 }
424 catch (Exception e)
425 {
426 m_log.Error("[HGrid]: Got exception while parsing land-data:", e);
427 }
428 }
429 }
430 else m_log.WarnFormat("[HGrid]: Couldn't find region with handle {0}", regionHandle);
431 }
432 catch (Exception e)
433 {
434 m_log.ErrorFormat("[HGrid]: Couldn't contact region {0}: {1}", regionHandle, e);
435 }
436
437 return landData;
438 }
439
440 // Grid Request Processing
441 public virtual List<RegionInfo> RequestNamedRegions (string name, int maxNumber)
442 {
443 List<RegionInfo> infos = new List<RegionInfo>();
444 foreach (RegionInfo info in m_hyperlinkRegions)
445 {
446 if (info.RegionName.ToLower().Contains(name))
447 {
448 infos.Add(info);
449 }
450 }
451 return infos;
452 }
453
454
455 private UUID LinkRegion(RegionInfo info)
456 {
457 UUID uuid = UUID.Zero;
458
459 Hashtable hash = new Hashtable();
460 hash["region_name"] = info.RegionName;
461
462 IList paramList = new ArrayList();
463 paramList.Add(hash);
464
465 XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
466 string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
467 m_log.Debug("[HGrid]: Linking to " + uri);
468 XmlRpcResponse response = request.Send(uri, 10000);
469 if (response.IsFault)
470 {
471 m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString);
472 }
473 else
474 {
475 hash = (Hashtable)response.Value;
476 //foreach (Object o in hash)
477 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
478 try
479 {
480 UUID.TryParse((string)hash["uuid"], out uuid);
481 info.RegionID = uuid;
482 if ((string)hash["handle"] != null)
483 {
484 info.regionSecret = (string)hash["handle"];
485 //m_log.Debug(">> HERE: " + info.regionSecret);
486 }
487 if (hash["region_image"] != null)
488 {
489 UUID img = UUID.Zero;
490 UUID.TryParse((string)hash["region_image"], out img);
491 info.RegionSettings.TerrainImageID = img;
492 }
493 if (hash["region_name"] != null)
494 {
495 info.RegionName = (string)hash["region_name"];
496 //m_log.Debug(">> " + info.RegionName);
497 }
498 if (hash["internal_port"] != null)
499 {
500 int port = Convert.ToInt32((string)hash["internal_port"]);
501 info.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
502 //m_log.Debug(">> " + info.InternalEndPoint.ToString());
503 }
504 if (hash["remoting_port"] != null)
505 {
506 info.RemotingPort = Convert.ToUInt32(hash["remoting_port"]);
507 //m_log.Debug(">> " + info.RemotingPort);
508 }
509
510 }
511 catch (Exception e)
512 {
513 m_log.Error("[HGrid]: Got exception while parsing hyperlink response " + e.StackTrace);
514 }
515 }
516 return uuid;
517 }
518
519 /// <summary>
520 /// Someone wants to link to us
521 /// </summary>
522 /// <param name="request"></param>
523 /// <returns></returns>
524 public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient)
525 {
526 Hashtable requestData = (Hashtable)request.Params[0];
527 //string host = (string)requestData["host"];
528 //string portstr = (string)requestData["port"];
529 string name = (string)requestData["region_name"];
530
531 m_log.DebugFormat("[HGrid]: Hyperlink request");
532
533
534 RegionInfo regInfo = null;
535 foreach (RegionInfo r in m_regionsOnInstance)
536 {
537 if ((r.RegionName != null) && (name != null) && (r.RegionName.ToLower() == name.ToLower()))
538 {
539 regInfo = r;
540 break;
541 }
542 }
543
544 if (regInfo == null)
545 regInfo = m_regionsOnInstance[0]; // Send out the first region
546
547 Hashtable hash = new Hashtable();
548 hash["uuid"] = regInfo.RegionID.ToString();
549 hash["handle"] = regInfo.RegionHandle.ToString();
550 //m_log.Debug(">> Here " + regInfo.RegionHandle);
551 hash["region_image"] = regInfo.RegionSettings.TerrainImageID.ToString();
552 hash["region_name"] = regInfo.RegionName;
553 hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
554 hash["remoting_port"] = ConfigSettings.DefaultRegionRemotingPort.ToString();
555 //m_log.Debug(">> Here: " + regInfo.InternalEndPoint.Port);
556
557
558 XmlRpcResponse response = new XmlRpcResponse();
559 response.Value = hash;
560 return response;
561 }
562
563 public bool InformRegionOfUser(RegionInfo regInfo, AgentCircuitData agentData)
564 {
565 //ulong regionHandle = regInfo.RegionHandle;
566 try
567 {
568 //regionHandle = Convert.ToUInt64(regInfo.regionSecret);
569 m_log.Info("[HGrid]: InformRegionOfUser: Remote hyperlinked region " + regInfo.regionSecret);
570 }
571 catch
572 {
573 m_log.Info("[HGrid]: InformRegionOfUser: Local grid region " + regInfo.regionSecret);
574 }
575
576 string capsPath = agentData.CapsPath;
577 Hashtable loginParams = new Hashtable();
578 loginParams["session_id"] = agentData.SessionID.ToString();
579 loginParams["secure_session_id"] = agentData.SecureSessionID.ToString();
580
581 loginParams["firstname"] = agentData.firstname;
582 loginParams["lastname"] = agentData.lastname;
583
584 loginParams["agent_id"] = agentData.AgentID.ToString();
585 loginParams["circuit_code"] = agentData.circuitcode.ToString();
586 loginParams["startpos_x"] = agentData.startpos.X.ToString();
587 loginParams["startpos_y"] = agentData.startpos.Y.ToString();
588 loginParams["startpos_z"] = agentData.startpos.Z.ToString();
589 loginParams["caps_path"] = capsPath;
590
591 CachedUserInfo u = m_userProfileCache.GetUserDetails(agentData.AgentID);
592 if (u != null && u.UserProfile != null)
593 {
594 loginParams["region_uuid"] = u.UserProfile.HomeRegionID.ToString(); // This seems to be always Zero
595 //m_log.Debug(" --------- Home Region UUID -------");
596 //m_log.Debug(" >> " + loginParams["region_uuid"] + " <<");
597 //m_log.Debug(" --------- ---------------- -------");
598
599 string serverURI = "";
600 if (u.UserProfile is ForeignUserProfileData)
601 serverURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)u.UserProfile).UserServerURI);
602 loginParams["userserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalUserServerURI : serverURI;
603
604 serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserAssetURI);
605 loginParams["assetserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalAssetServerURI : serverURI;
606
607 serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserInventoryURI);
608 loginParams["inventoryserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalInventoryServerURI : serverURI;
609
610 loginParams["root_folder_id"] = u.UserProfile.RootInventoryFolderID;
611
612 RegionInfo rinfo = RequestNeighbourInfo(u.UserProfile.HomeRegion);
613 if (rinfo != null)
614 {
615 loginParams["internal_port"] = rinfo.InternalEndPoint.Port.ToString();
616 if (!IsLocalUser(u))
617 {
618 loginParams["regionhandle"] = rinfo.regionSecret; // user.CurrentAgent.Handle.ToString();
619 //m_log.Debug("XXX--- informregionofuser (foreign user) here handle: " + rinfo.regionSecret);
620
621 loginParams["home_address"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomeAddress;
622 loginParams["home_port"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomePort;
623 loginParams["home_remoting"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomeRemotingPort;
624 }
625 else
626 {
627 //m_log.Debug("XXX--- informregionofuser (local user) here handle: " + rinfo.regionSecret);
628
629 //// local user about to jump out, let's process the name
630 // On second thoughts, let's not do this for the *user*; let's only do it for the *agent*
631 //loginParams["firstname"] = agentData.firstname + "." + agentData.lastname;
632 //loginParams["lastname"] = serversInfo.UserURL;
633
634 // local user, first time out. let's ask the grid about this user's home region
635 loginParams["regionhandle"] = u.UserProfile.HomeRegion.ToString(); // user.CurrentAgent.Handle.ToString();
636
637 loginParams["home_address"] = rinfo.ExternalHostName;
638 m_log.Debug(" --------- Home Address -------");
639 m_log.Debug(" >> " + loginParams["home_address"] + " <<");
640 m_log.Debug(" --------- ------------ -------");
641 loginParams["home_port"] = rinfo.HttpPort.ToString();
642 loginParams["home_remoting"] = ConfigSettings.DefaultRegionRemotingPort.ToString(); ;
643 }
644 }
645 else
646 {
647 m_log.Warn("[HGrid]: User's home region info not found: " + u.UserProfile.HomeRegionX + ", " + u.UserProfile.HomeRegionY);
648 }
649 }
650
651 ArrayList SendParams = new ArrayList();
652 SendParams.Add(loginParams);
653
654 // Send
655 string uri = "http://" + regInfo.ExternalHostName + ":" + regInfo.HttpPort + "/";
656 //m_log.Debug("XXX uri: " + uri);
657 XmlRpcRequest request = new XmlRpcRequest("expect_hg_user", SendParams);
658 XmlRpcResponse reply;
659 try
660 {
661 reply = request.Send(uri, 6000);
662 }
663 catch (Exception e)
664 {
665 m_log.Warn("[HGrid]: Failed to notify region about user. Reason: " + e.Message);
666 return false;
667 }
668
669 if (!reply.IsFault)
670 {
671 bool responseSuccess = true;
672 if (reply.Value != null)
673 {
674 Hashtable resp = (Hashtable)reply.Value;
675 if (resp.ContainsKey("success"))
676 {
677 if ((string)resp["success"] == "FALSE")
678 {
679 responseSuccess = false;
680 }
681 }
682 }
683 if (responseSuccess)
684 {
685 m_log.Info("[HGrid]: Successfully informed remote region about user " + agentData.AgentID);
686 return true;
687 }
688 else
689 {
690 m_log.ErrorFormat("[HGrid]: Region responded that it is not available to receive clients");
691 return false;
692 }
693 }
694 else
695 {
696 m_log.ErrorFormat("[HGrid]: XmlRpc request to region failed with message {0}, code {1} ", reply.FaultString, reply.FaultCode);
697 return false;
698 }
699 }
700
701
702 /// <summary>
703 /// Received from other HGrid nodes when a user wants to teleport here. This call allows
704 /// the region to prepare for direct communication from the client. Sends back an empty
705 /// xmlrpc response on completion.
706 /// This is somewhat similar to OGS1's ExpectUser, but with the additional task of
707 /// registering the user in the local user cache.
708 /// </summary>
709 /// <param name="request"></param>
710 /// <returns></returns>
711 public XmlRpcResponse ExpectHGUser(XmlRpcRequest request, IPEndPoint remoteClient)
712 {
713 Hashtable requestData = (Hashtable)request.Params[0];
714 ForeignUserProfileData userData = new ForeignUserProfileData();
715
716 userData.FirstName = (string)requestData["firstname"];
717 userData.SurName = (string)requestData["lastname"];
718 userData.ID = new UUID((string)requestData["agent_id"]);
719 userData.HomeLocation = new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]),
720 (float)Convert.ToDecimal((string)requestData["startpos_y"]),
721 (float)Convert.ToDecimal((string)requestData["startpos_z"]));
722
723 userData.UserServerURI = (string)requestData["userserver_id"];
724 userData.UserAssetURI = (string)requestData["assetserver_id"];
725 userData.UserInventoryURI = (string)requestData["inventoryserver_id"];
726
727 UUID rootID = UUID.Zero;
728 UUID.TryParse((string)requestData["root_folder_id"], out rootID);
729 userData.RootInventoryFolderID = rootID;
730
731 UUID uuid = UUID.Zero;
732 UUID.TryParse((string)requestData["region_uuid"], out uuid);
733 userData.HomeRegionID = uuid; // not quite comfortable about this...
734 ulong userRegionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
735 //userData.HomeRegion = userRegionHandle;
736 userData.UserHomeAddress = (string)requestData["home_address"];
737 userData.UserHomePort = (string)requestData["home_port"];
738 int userhomeinternalport = Convert.ToInt32((string)requestData["internal_port"]);
739 userData.UserHomeRemotingPort = (string)requestData["home_remoting"];
740
741
742 m_log.DebugFormat("[HGrid]: Prepare for connection from {0} {1} (@{2}) UUID={3}",
743 userData.FirstName, userData.SurName, userData.UserServerURI, userData.ID);
744 m_log.Debug("[HGrid]: home_address: " + userData.UserHomeAddress +
745 "; home_port: " + userData.UserHomePort + "; remoting: " + userData.UserHomeRemotingPort);
746
747 XmlRpcResponse resp = new XmlRpcResponse();
748
749 // Let's check if someone is trying to get in with a stolen local identity.
750 // The need for this test is a consequence of not having truly global names :-/
751 CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(userData.ID);
752 if ((uinfo != null) && !(uinfo.UserProfile is ForeignUserProfileData))
753 {
754 m_log.WarnFormat("[HGrid]: Foreign user trying to get in with local identity. Access denied.");
755 Hashtable respdata = new Hashtable();
756 respdata["success"] = "FALSE";
757 respdata["reason"] = "Foreign user has the same ID as a local user.";
758 resp.Value = respdata;
759 return resp;
760 }
761
762 if (!RegionLoginsEnabled)
763 {
764 m_log.InfoFormat(
765 "[HGrid]: Denying access for user {0} {1} because region login is currently disabled",
766 userData.FirstName, userData.SurName);
767
768 Hashtable respdata = new Hashtable();
769 respdata["success"] = "FALSE";
770 respdata["reason"] = "region login currently disabled";
771 resp.Value = respdata;
772 }
773 else
774 {
775 // Finally, everything looks ok
776 //m_log.Debug("XXX---- EVERYTHING OK ---XXX");
777
778 // 1 - Preload the user data
779 m_userProfileCache.PreloadUserCache(userData);
780
781 if (m_knownRegions.ContainsKey(userData.ID))
782 {
783 // This was left here when the user departed
784 m_knownRegions.Remove(userData.ID);
785 }
786
787 // 2 - Load the region info into list of known regions
788 RegionInfo rinfo = new RegionInfo();
789 rinfo.RegionID = userData.HomeRegionID;
790 rinfo.ExternalHostName = userData.UserHomeAddress;
791 rinfo.HttpPort = Convert.ToUInt32(userData.UserHomePort);
792 rinfo.RemotingPort = Convert.ToUInt32(userData.UserHomeRemotingPort);
793 rinfo.RegionID = userData.HomeRegionID;
794 // X=0 on the map
795 rinfo.RegionLocX = 0;
796 rinfo.RegionLocY = (uint)(random.Next(0, Int32.MaxValue)); //(uint)m_knownRegions.Count;
797 rinfo.regionSecret = userRegionHandle.ToString();
798 //m_log.Debug("XXX--- Here: handle = " + rinfo.regionSecret);
799 try
800 {
801 rinfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)userhomeinternalport);
802 }
803 catch (Exception e)
804 {
805 m_log.Warn("[HGrid]: Exception while constructing internal endpoint: " + e);
806 }
807 rinfo.RemotingAddress = rinfo.ExternalEndPoint.Address.ToString(); //userData.UserHomeAddress;
808
809 if (!IsComingHome(userData))
810 {
811 // Change the user's home region here!!!
812 userData.HomeRegion = rinfo.RegionHandle;
813 }
814
815 if (!m_knownRegions.ContainsKey(userData.ID))
816 m_knownRegions.Add(userData.ID, rinfo);
817
818 // 3 - Send the reply
819 Hashtable respdata = new Hashtable();
820 respdata["success"] = "TRUE";
821 resp.Value = respdata;
822
823 DumpUserData(userData);
824 DumpRegionData(rinfo);
825
826 }
827
828 return resp;
829 }
830
831 public bool SendUserInformation(RegionInfo regInfo, AgentCircuitData agentData)
832 {
833 CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID);
834
835 if ((IsLocalUser(uinfo) && IsHyperlinkRegion(regInfo.RegionHandle)) ||
836 (!IsLocalUser(uinfo) && !IsGoingHome(uinfo, regInfo)))
837 {
838 m_log.Info("[HGrid]: Local user is going to foreign region or foreign user is going elsewhere");
839 if (!InformRegionOfUser(regInfo, agentData))
840 {
841 m_log.Warn("[HGrid]: Could not inform remote region of transferring user.");
842 return false;
843 }
844 }
845 //if ((uinfo == null) || !IsGoingHome(uinfo, regInfo))
846 //{
847 // m_log.Info("[HGrid]: User seems to be going to foreign region.");
848 // if (!InformRegionOfUser(regInfo, agentData))
849 // {
850 // m_log.Warn("[HGrid]: Could not inform remote region of transferring user.");
851 // return false;
852 // }
853 //}
854 //else
855 // m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
856
857 // May need to change agent's name
858 if (IsLocalUser(uinfo) && IsHyperlinkRegion(regInfo.RegionHandle))
859 {
860 agentData.firstname = agentData.firstname + "." + agentData.lastname;
861 agentData.lastname = "@" + serversInfo.UserURL.Replace("http://", ""); ; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
862 }
863
864 return true;
865 }
866
867
868 #region Methods triggered by calls from external instances
869
870 /// <summary>
871 ///
872 /// </summary>
873 /// <param name="regionHandle"></param>
874 /// <param name="agentData"></param>
875 /// <returns></returns>
876 public void AdjustUserInformation(AgentCircuitData agentData)
877 {
878 CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID);
879 if ((uinfo != null) && (uinfo.UserProfile != null) &&
880 (IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData)))
881 {
882 //m_log.Debug("---------------> Local User!");
883 string[] parts = agentData.firstname.Split(new char[] { '.' });
884 if (parts.Length == 2)
885 {
886 agentData.firstname = parts[0];
887 agentData.lastname = parts[1];
888 }
889 }
890 //else
891 // m_log.Debug("---------------> Foreign User!");
892 }
893 #endregion
894
895
896 #region IHyperGrid interface
897
898 public virtual bool IsHyperlinkRegion(ulong ihandle)
899 {
900 if (GetHyperlinkRegion(ihandle) == null)
901 return false;
902 else
903 return true;
904 }
905
906 public virtual RegionInfo GetHyperlinkRegion(ulong ihandle)
907 {
908 foreach (RegionInfo info in m_hyperlinkRegions)
909 {
910 if (info.RegionHandle == ihandle)
911 return info;
912 }
913
914 foreach (RegionInfo info in m_knownRegions.Values)
915 {
916 if (info.RegionHandle == ihandle)
917 return info;
918 }
919
920 return null;
921 }
922
923 public virtual ulong FindRegionHandle(ulong ihandle)
924 {
925 long ohandle = -1;
926 List<RegionInfo> rlist = new List<RegionInfo>(m_hyperlinkRegions);
927 rlist.AddRange(m_knownRegions.Values);
928 foreach (RegionInfo info in rlist)
929 {
930 if (info.RegionHandle == ihandle)
931 {
932 try
933 {
934 ohandle = Convert.ToInt64(info.regionSecret);
935 m_log.Info("[HGrid] remote region " + ohandle);
936 }
937 catch
938 {
939 m_log.Error("[HGrid] Could not convert secret for " + ihandle + " (" + info.regionSecret + ")");
940 }
941 break;
942 }
943 }
944 return ohandle < 0 ? ihandle : (ulong)ohandle;
945 }
946 #endregion
947
948 #region Misc
949
950 protected bool IsComingHome(ForeignUserProfileData userData)
951 {
952 return (userData.UserServerURI == HGNetworkServersInfo.Singleton.LocalUserServerURI);
953 }
954
955 protected bool IsGoingHome(CachedUserInfo uinfo, RegionInfo rinfo)
956 {
957 if (uinfo.UserProfile == null)
958 return false;
959
960 string userUserServerURI = String.Empty;
961 if (uinfo.UserProfile is ForeignUserProfileData)
962 {
963 userUserServerURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
964 }
965
966 return ((uinfo.UserProfile.HomeRegionID == rinfo.RegionID) &&
967 (userUserServerURI != HGNetworkServersInfo.Singleton.LocalUserServerURI));
968 }
969
970 protected bool IsLocalUser(CachedUserInfo uinfo)
971 {
972 if (uinfo == null)
973 return true;
974
975 if (uinfo.UserProfile is ForeignUserProfileData)
976 return HGNetworkServersInfo.Singleton.IsLocalUser(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
977 else
978 return true;
979
980 }
981
982 protected bool IsLocalRegion(ulong handle)
983 {
984 foreach (RegionInfo reg in m_regionsOnInstance)
985 if (reg.RegionHandle == handle)
986 return true;
987 return false;
988 }
989
990 private void DumpUserData(ForeignUserProfileData userData)
991 {
992 m_log.Info(" ------------ User Data Dump ----------");
993 m_log.Info(" >> Name: " + userData.FirstName + " " + userData.SurName);
994 m_log.Info(" >> HomeID: " + userData.HomeRegionID);
995 m_log.Info(" >> HomeHandle: " + userData.HomeRegion);
996 m_log.Info(" >> HomeX: " + userData.HomeRegionX);
997 m_log.Info(" >> HomeY: " + userData.HomeRegionY);
998 m_log.Info(" >> UserServer: " + userData.UserServerURI);
999 m_log.Info(" >> InvServer: " + userData.UserInventoryURI);
1000 m_log.Info(" >> AssetServer: " + userData.UserAssetURI);
1001 m_log.Info(" ------------ -------------- ----------");
1002 }
1003
1004 private void DumpRegionData(RegionInfo rinfo)
1005 {
1006 m_log.Info(" ------------ Region Data Dump ----------");
1007 m_log.Info(" >> handle: " + rinfo.RegionHandle);
1008 m_log.Info(" >> coords: " + rinfo.RegionLocX + ", " + rinfo.RegionLocY);
1009 m_log.Info(" >> secret: " + rinfo.regionSecret);
1010 m_log.Info(" >> remoting address: " + rinfo.RemotingAddress);
1011 m_log.Info(" >> remoting port: " + rinfo.RemotingPort);
1012 m_log.Info(" >> external host name: " + rinfo.ExternalHostName);
1013 m_log.Info(" >> http port: " + rinfo.HttpPort);
1014 m_log.Info(" >> external EP address: " + rinfo.ExternalEndPoint.Address);
1015 m_log.Info(" >> external EP port: " + rinfo.ExternalEndPoint.Port);
1016 m_log.Info(" ------------ -------------- ----------");
1017 }
1018
1019
1020 #endregion
1021
1022
1023 }
1024}
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs
deleted file mode 100644
index 5ce1e79..0000000
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs
+++ /dev/null
@@ -1,159 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using OpenMetaverse;
33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Servers.HttpServer;
36using OpenSim.Region.Communications.OGS1;
37using OpenSim.Region.Framework.Scenes;
38
39namespace OpenSim.Region.Communications.Hypergrid
40{
41 public class HGGridServicesGridMode : HGGridServices
42 {
43 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44
45 /// <summary>
46 /// Encapsulate remote backend services for manipulation of grid regions
47 /// </summary>
48 private OGS1GridServices m_remoteBackend = null;
49
50 public OGS1GridServices RemoteBackend
51 {
52 get { return m_remoteBackend; }
53 }
54
55
56 public override string gdebugRegionName
57 {
58 get { return m_remoteBackend.gdebugRegionName; }
59 set { m_remoteBackend.gdebugRegionName = value; }
60 }
61
62 public override bool RegionLoginsEnabled
63 {
64 get { return m_remoteBackend.RegionLoginsEnabled; }
65 set { m_remoteBackend.RegionLoginsEnabled = value; }
66 }
67
68 public HGGridServicesGridMode(NetworkServersInfo servers_info,
69 SceneManager sman, UserProfileCacheService userv)
70 : base(servers_info, sman)
71 {
72 m_remoteBackend = new OGS1GridServices(servers_info);
73 m_userProfileCache = userv;
74 }
75
76 #region IGridServices interface
77
78 public override RegionCommsListener RegisterRegion(RegionInfo regionInfo)
79 {
80 if (!regionInfo.RegionID.Equals(UUID.Zero))
81 {
82 m_regionsOnInstance.Add(regionInfo);
83 return m_remoteBackend.RegisterRegion(regionInfo);
84 }
85 else
86 return base.RegisterRegion(regionInfo);
87 }
88
89 public override bool DeregisterRegion(RegionInfo regionInfo)
90 {
91 bool success = base.DeregisterRegion(regionInfo);
92 if (!success)
93 success = m_remoteBackend.DeregisterRegion(regionInfo);
94 return success;
95 }
96
97 public override List<SimpleRegionInfo> RequestNeighbours(uint x, uint y)
98 {
99 List<SimpleRegionInfo> neighbours = m_remoteBackend.RequestNeighbours(x, y);
100 //List<SimpleRegionInfo> remotes = base.RequestNeighbours(x, y);
101 //neighbours.AddRange(remotes);
102
103 return neighbours;
104 }
105
106 public override RegionInfo RequestNeighbourInfo(UUID Region_UUID)
107 {
108 RegionInfo info = m_remoteBackend.RequestNeighbourInfo(Region_UUID);
109 if (info == null)
110 info = base.RequestNeighbourInfo(Region_UUID);
111 return info;
112 }
113
114 public override RegionInfo RequestNeighbourInfo(ulong regionHandle)
115 {
116 RegionInfo info = base.RequestNeighbourInfo(regionHandle);
117 if (info == null)
118 info = m_remoteBackend.RequestNeighbourInfo(regionHandle);
119 return info;
120 }
121
122 public override RegionInfo RequestClosestRegion(string regionName)
123 {
124 RegionInfo info = m_remoteBackend.RequestClosestRegion(regionName);
125 if (info == null)
126 info = base.RequestClosestRegion(regionName);
127 return info;
128 }
129
130 public override List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
131 {
132 List<MapBlockData> neighbours = m_remoteBackend.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
133 List<MapBlockData> remotes = base.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
134 neighbours.AddRange(remotes);
135
136 return neighbours;
137 }
138
139 public override LandData RequestLandData(ulong regionHandle, uint x, uint y)
140 {
141 LandData land = m_remoteBackend.RequestLandData(regionHandle, x, y);
142 if (land == null)
143 land = base.RequestLandData(regionHandle, x, y);
144 return land;
145 }
146
147 public override List<RegionInfo> RequestNamedRegions(string name, int maxNumber)
148 {
149 List<RegionInfo> infos = m_remoteBackend.RequestNamedRegions(name, maxNumber);
150 List<RegionInfo> remotes = base.RequestNamedRegions(name, maxNumber);
151 infos.AddRange(remotes);
152 return infos;
153 }
154
155 #endregion
156
157
158 }
159}
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs
deleted file mode 100644
index 94cfc49..0000000
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs
+++ /dev/null
@@ -1,259 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Net.Sockets;
33using System.Reflection;
34using System.Runtime.Remoting;
35using System.Runtime.Remoting.Channels;
36using System.Runtime.Remoting.Channels.Tcp;
37using System.Security.Authentication;
38using log4net;
39using Nwc.XmlRpc;
40using OpenMetaverse;
41using OpenSim.Framework;
42using OpenSim.Framework.Servers;
43using OpenSim.Framework.Servers.HttpServer;
44using OpenSim.Region.Communications.Local;
45using OpenSim.Region.Communications.OGS1;
46using OpenSim.Region.Framework.Scenes;
47
48namespace OpenSim.Region.Communications.Hypergrid
49{
50 public class HGGridServicesStandalone : HGGridServices
51 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53
54 /// <summary>
55 /// Encapsulate local backend services for manipulation of local regions
56 /// </summary>
57 protected LocalBackEndServices m_localBackend = new LocalBackEndServices();
58
59 //private Dictionary<ulong, int> m_deadRegionCache = new Dictionary<ulong, int>();
60
61 public LocalBackEndServices LocalBackend
62 {
63 get { return m_localBackend; }
64 }
65
66 public override string gdebugRegionName
67 {
68 get { return m_localBackend.gdebugRegionName; }
69 set { m_localBackend.gdebugRegionName = value; }
70 }
71
72 public override bool RegionLoginsEnabled
73 {
74 get { return m_localBackend.RegionLoginsEnabled; }
75 set { m_localBackend.RegionLoginsEnabled = value; }
76 }
77
78
79 public HGGridServicesStandalone(NetworkServersInfo servers_info, BaseHttpServer httpServe, SceneManager sman)
80 : base(servers_info, sman)
81 {
82 //Respond to Grid Services requests
83 MainServer.Instance.AddXmlRPCHandler("logoff_user", LogOffUser);
84 MainServer.Instance.AddXmlRPCHandler("check", PingCheckReply);
85 MainServer.Instance.AddXmlRPCHandler("land_data", LandData);
86
87 }
88
89 #region IGridServices interface
90
91 public override RegionCommsListener RegisterRegion(RegionInfo regionInfo)
92 {
93 if (!regionInfo.RegionID.Equals(UUID.Zero))
94 {
95 m_regionsOnInstance.Add(regionInfo);
96 return m_localBackend.RegisterRegion(regionInfo);
97 }
98 else
99 return base.RegisterRegion(regionInfo);
100
101 }
102
103 public override bool DeregisterRegion(RegionInfo regionInfo)
104 {
105 bool success = m_localBackend.DeregisterRegion(regionInfo);
106 if (!success)
107 success = base.DeregisterRegion(regionInfo);
108 return success;
109 }
110
111 public override List<SimpleRegionInfo> RequestNeighbours(uint x, uint y)
112 {
113 List<SimpleRegionInfo> neighbours = m_localBackend.RequestNeighbours(x, y);
114 //List<SimpleRegionInfo> remotes = base.RequestNeighbours(x, y);
115 //neighbours.AddRange(remotes);
116
117 return neighbours;
118 }
119
120 public override RegionInfo RequestNeighbourInfo(UUID Region_UUID)
121 {
122 RegionInfo info = m_localBackend.RequestNeighbourInfo(Region_UUID);
123 if (info == null)
124 info = base.RequestNeighbourInfo(Region_UUID);
125 return info;
126 }
127
128 public override RegionInfo RequestNeighbourInfo(ulong regionHandle)
129 {
130 RegionInfo info = m_localBackend.RequestNeighbourInfo(regionHandle);
131 //m_log.Info("[HGrid] Request neighbor info, local backend returned " + info);
132 if (info == null)
133 info = base.RequestNeighbourInfo(regionHandle);
134 return info;
135 }
136
137 public override RegionInfo RequestClosestRegion(string regionName)
138 {
139 RegionInfo info = m_localBackend.RequestClosestRegion(regionName);
140 if (info == null)
141 info = base.RequestClosestRegion(regionName);
142 return info;
143 }
144
145 public override List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
146 {
147 //m_log.Info("[HGrid] Request map blocks " + minX + "-" + minY + "-" + maxX + "-" + maxY);
148 List<MapBlockData> neighbours = m_localBackend.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
149 List<MapBlockData> remotes = base.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
150 neighbours.AddRange(remotes);
151
152 return neighbours;
153 }
154
155 public override LandData RequestLandData(ulong regionHandle, uint x, uint y)
156 {
157 LandData land = m_localBackend.RequestLandData(regionHandle, x, y);
158 if (land == null)
159 land = base.RequestLandData(regionHandle, x, y);
160 return land;
161 }
162
163 public override List<RegionInfo> RequestNamedRegions(string name, int maxNumber)
164 {
165 List<RegionInfo> infos = m_localBackend.RequestNamedRegions(name, maxNumber);
166 List<RegionInfo> remotes = base.RequestNamedRegions(name, maxNumber);
167 infos.AddRange(remotes);
168 return infos;
169 }
170
171 #endregion
172
173 #region XML Request Handlers
174
175 /// <summary>
176 /// A ping / version check
177 /// </summary>
178 /// <param name="request"></param>
179 /// <returns></returns>
180 public virtual XmlRpcResponse PingCheckReply(XmlRpcRequest request, IPEndPoint remoteClient)
181 {
182 XmlRpcResponse response = new XmlRpcResponse();
183
184 Hashtable respData = new Hashtable();
185 respData["online"] = "true";
186
187 m_localBackend.PingCheckReply(respData);
188
189 response.Value = respData;
190
191 return response;
192 }
193
194
195 // Grid Request Processing
196 /// <summary>
197 /// Ooops, our Agent must be dead if we're getting this request!
198 /// </summary>
199 /// <param name="request"></param>
200 /// <returns></returns>
201 public XmlRpcResponse LogOffUser(XmlRpcRequest request, IPEndPoint remoteClient)
202 {
203 m_log.Debug("[HGrid]: LogOff User Called");
204
205 Hashtable requestData = (Hashtable)request.Params[0];
206 string message = (string)requestData["message"];
207 UUID agentID = UUID.Zero;
208 UUID RegionSecret = UUID.Zero;
209 UUID.TryParse((string)requestData["agent_id"], out agentID);
210 UUID.TryParse((string)requestData["region_secret"], out RegionSecret);
211
212 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
213
214 m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret, message);
215
216 return new XmlRpcResponse();
217 }
218
219 /// <summary>
220 /// Someone asked us about parcel-information
221 /// </summary>
222 /// <param name="request"></param>
223 /// <returns></returns>
224 public XmlRpcResponse LandData(XmlRpcRequest request, IPEndPoint remoteClient)
225 {
226 Hashtable requestData = (Hashtable)request.Params[0];
227 ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]);
228 uint x = Convert.ToUInt32(requestData["x"]);
229 uint y = Convert.ToUInt32(requestData["y"]);
230 m_log.DebugFormat("[HGrid]: Got XML reqeuest for land data at {0}, {1} in region {2}", x, y, regionHandle);
231
232 LandData landData = m_localBackend.RequestLandData(regionHandle, x, y);
233 Hashtable hash = new Hashtable();
234 if (landData != null)
235 {
236 // for now, only push out the data we need for answering a ParcelInfoReqeust
237 hash["AABBMax"] = landData.AABBMax.ToString();
238 hash["AABBMin"] = landData.AABBMin.ToString();
239 hash["Area"] = landData.Area.ToString();
240 hash["AuctionID"] = landData.AuctionID.ToString();
241 hash["Description"] = landData.Description;
242 hash["Flags"] = landData.Flags.ToString();
243 hash["GlobalID"] = landData.GlobalID.ToString();
244 hash["Name"] = landData.Name;
245 hash["OwnerID"] = landData.OwnerID.ToString();
246 hash["SalePrice"] = landData.SalePrice.ToString();
247 hash["SnapshotID"] = landData.SnapshotID.ToString();
248 hash["UserLocation"] = landData.UserLocation.ToString();
249 }
250
251 XmlRpcResponse response = new XmlRpcResponse();
252 response.Value = hash;
253 return response;
254 }
255
256 #endregion
257
258 }
259}
diff --git a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
index f1a56ef..49a2261 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Region.Communications.Hypergrid
87 return m_localUserServices.AddUserAgent(agentdata); 87 return m_localUserServices.AddUserAgent(agentdata);
88 88
89 return base.AddUserAgent(agentdata); 89 return base.AddUserAgent(agentdata);
90 } 90 }
91 91
92 public override UserAgentData GetAgentByUUID(UUID userId) 92 public override UserAgentData GetAgentByUUID(UUID userId)
93 { 93 {
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index a658416..eaf996d 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Region.Communications.Local
37 public class CommunicationsLocal : CommunicationsManager 37 public class CommunicationsLocal : CommunicationsManager
38 { 38 {
39 public CommunicationsLocal( 39 public CommunicationsLocal(
40 ConfigSettings configSettings, 40 ConfigSettings configSettings,
41 NetworkServersInfo serversInfo, 41 NetworkServersInfo serversInfo,
42 LibraryRootFolder libraryRootFolder) 42 LibraryRootFolder libraryRootFolder)
43 : base(serversInfo, libraryRootFolder) 43 : base(serversInfo, libraryRootFolder)
@@ -47,15 +47,13 @@ namespace OpenSim.Region.Communications.Local
47 = new LocalUserServices( 47 = new LocalUserServices(
48 serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this); 48 serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
49 lus.AddPlugin(new TemporaryUserProfilePlugin()); 49 lus.AddPlugin(new TemporaryUserProfilePlugin());
50 lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource); 50 lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);
51 m_userService = lus; 51 m_userService = lus;
52 m_userAdminService = lus; 52 m_userAdminService = lus;
53 m_avatarService = lus; 53 m_avatarService = lus;
54 m_messageService = lus; 54 m_messageService = lus;
55 55
56 m_gridService = new LocalBackEndServices(); 56 //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
57
58 //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
59 } 57 }
60 } 58 }
61} 59}
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
deleted file mode 100644
index 0ab9374..0000000
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ /dev/null
@@ -1,410 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32using log4net;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36
37namespace OpenSim.Region.Communications.Local
38{
39 public class LocalBackEndServices : IGridServices
40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42
43 protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>();
44
45 protected Dictionary<ulong, RegionCommsListener> m_regionListeners =
46 new Dictionary<ulong, RegionCommsListener>();
47
48 // private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
49
50 private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>();
51
52 public string _gdebugRegionName = String.Empty;
53
54 public bool RegionLoginsEnabled
55 {
56 get { return m_regionLoginsEnabled; }
57 set { m_regionLoginsEnabled = value; }
58 }
59 private bool m_regionLoginsEnabled;
60
61 public bool CheckRegion(string address, uint port)
62 {
63 return true;
64 }
65
66 public string gdebugRegionName
67 {
68 get { return _gdebugRegionName; }
69 set { _gdebugRegionName = value; }
70 }
71
72 public string _rdebugRegionName = String.Empty;
73
74 public string rdebugRegionName
75 {
76 get { return _rdebugRegionName; }
77 set { _rdebugRegionName = value; }
78 }
79
80 /// <summary>
81 /// Register a region method with the BackEnd Services.
82 /// </summary>
83 /// <param name="regionInfo"></param>
84 /// <returns></returns>
85 public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
86 {
87 //m_log.Debug("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
88 if (!m_regions.ContainsKey(regionInfo.RegionHandle))
89 {
90 //m_log.Debug("CommsManager - Adding Region " + regionInfo.RegionHandle);
91 m_regions.Add(regionInfo.RegionHandle, regionInfo);
92
93 RegionCommsListener regionHost = new RegionCommsListener();
94 if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
95 {
96 m_log.Error("[INTERREGION STANDALONE]: " +
97 "Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. " +
98 "In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up.");
99 m_regionListeners.Remove(regionInfo.RegionHandle);
100 }
101 m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
102
103 return regionHost;
104 }
105 else
106 {
107 // Already in our list, so the region went dead and restarted.
108 // don't replace the old regioninfo.. this might be a locking issue.. however we need to
109 // remove it and let it add normally below or we get extremely strange and intermittant
110 // connectivity errors.
111 // Don't change this line below to 'm_regions[regionInfo.RegionHandle] = regionInfo' unless you
112 // *REALLY* know what you are doing here.
113 m_regions[regionInfo.RegionHandle] = regionInfo;
114
115 m_log.Warn("[INTERREGION STANDALONE]: Region registered twice. Region went down and came back up.");
116
117 RegionCommsListener regionHost = new RegionCommsListener();
118 if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
119 {
120 m_regionListeners.Remove(regionInfo.RegionHandle);
121 }
122 m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
123
124 return regionHost;
125 }
126 }
127
128 public bool DeregisterRegion(RegionInfo regionInfo)
129 {
130 if (m_regions.ContainsKey(regionInfo.RegionHandle))
131 {
132 m_regions.Remove(regionInfo.RegionHandle);
133 if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
134 {
135 m_regionListeners.Remove(regionInfo.RegionHandle);
136 }
137 return true;
138 }
139 return false;
140 }
141
142 /// <summary>
143 /// </summary>
144 /// <param name="regionInfo"></param>
145 /// <returns></returns>
146 public List<SimpleRegionInfo> RequestNeighbours(uint x, uint y)
147 {
148 // m_log.Debug("Finding Neighbours to " + regionInfo.RegionHandle);
149 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
150
151 foreach (RegionInfo reg in m_regions.Values)
152 {
153 // m_log.Debug("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY);
154 if (reg.RegionLocX != x || reg.RegionLocY != y)
155 {
156 //m_log.Debug("CommsManager- RequestNeighbours() - found a different region in list, checking location");
157 if ((reg.RegionLocX > (x - 2)) && (reg.RegionLocX < (x + 2)))
158 {
159 if ((reg.RegionLocY > (y - 2)) && (reg.RegionLocY < (y + 2)))
160 {
161 neighbours.Add(reg);
162 }
163 }
164 }
165 }
166 return neighbours;
167 }
168
169 /// <summary>
170 /// Get information about a neighbouring region
171 /// </summary>
172 /// <param name="regionHandle"></param>
173 /// <returns></returns>
174 public RegionInfo RequestNeighbourInfo(ulong regionHandle)
175 {
176 if (m_regions.ContainsKey(regionHandle))
177 {
178 return m_regions[regionHandle];
179 }
180
181 return null;
182 }
183
184 /// <summary>
185 /// Get information about a neighbouring region
186 /// </summary>
187 /// <param name="regionHandle"></param>
188 /// <returns></returns>
189 public RegionInfo RequestNeighbourInfo(UUID regionID)
190 {
191 // TODO add a dictionary for faster lookup
192 foreach (RegionInfo info in m_regions.Values)
193 {
194 if (info.RegionID == regionID)
195 return info;
196 }
197
198 return null;
199 }
200
201 /// <summary>
202 /// Get information about a neighbouring region
203 /// </summary>
204 /// <param name="regionHandle"></param>
205 /// <returns></returns>
206 public RegionInfo RequestNeighbourInfo(string name)
207 {
208 foreach (RegionInfo info in m_regions.Values)
209 {
210 if (info.RegionName == name)
211 return info;
212 }
213
214 return null;
215 }
216
217 /// <summary>
218 /// Get information about a neighbouring region
219 /// </summary>
220 /// <param name="regionHandle"></param>
221 /// <returns></returns>
222 public RegionInfo RequestNeighbourInfo(string host, uint port)
223 {
224 foreach (RegionInfo info in m_regions.Values)
225 {
226 if ((info.ExternalHostName == host) && (info.HttpPort == port))
227 return info;
228 }
229
230 return null;
231 }
232
233 /// <summary>
234 /// Get information about the closet region given a region name.
235 /// </summary>
236 /// <param name="regionName"></param>
237 /// <returns></returns>
238 public RegionInfo RequestClosestRegion(string regionName)
239 {
240 foreach (RegionInfo regInfo in m_regions.Values)
241 {
242 if (regInfo.RegionName == regionName)
243 return regInfo;
244 }
245 return null;
246 }
247
248 /// <summary>
249 ///
250 /// </summary>
251 /// <param name="minX"></param>
252 /// <param name="minY"></param>
253 /// <param name="maxX"></param>
254 /// <param name="maxY"></param>
255 /// <returns></returns>
256 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
257 {
258 List<MapBlockData> mapBlocks = new List<MapBlockData>();
259 foreach (RegionInfo regInfo in m_regions.Values)
260 {
261 if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) &&
262 ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY)))
263 {
264 MapBlockData map = new MapBlockData();
265 map.Name = regInfo.RegionName;
266 map.X = (ushort) regInfo.RegionLocX;
267 map.Y = (ushort) regInfo.RegionLocY;
268 map.WaterHeight = (byte) regInfo.RegionSettings.WaterHeight;
269 map.MapImageId = regInfo.RegionSettings.TerrainImageID;
270 map.Agents = 1;
271 map.RegionFlags = 72458694;
272 map.Access = regInfo.AccessLevel;
273 mapBlocks.Add(map);
274 }
275 }
276 return mapBlocks;
277 }
278
279 // This function is only here to keep this class in line with the Grid Interface.
280 // It never gets called.
281 public virtual Dictionary<string, string> GetGridSettings()
282 {
283 Dictionary<string, string> returnGridSettings = new Dictionary<string, string>();
284 lock (m_queuedGridSettings)
285 {
286 returnGridSettings = m_queuedGridSettings;
287 m_queuedGridSettings.Clear();
288 }
289
290 return returnGridSettings;
291 }
292
293 public virtual void SetForcefulBanlistsDisallowed()
294 {
295 m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE");
296 }
297
298
299 /// <summary>
300 /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session
301 /// </summary>
302 /// <param name="regionHandle"></param>
303 /// <param name="loginData"></param>
304 /// <returns></returns>
305 public void AddNewSession(ulong regionHandle, Login loginData)
306 {
307 AgentCircuitData agent = new AgentCircuitData();
308 agent.AgentID = loginData.Agent;
309 agent.firstname = loginData.First;
310 agent.lastname = loginData.Last;
311 agent.SessionID = loginData.Session;
312 agent.SecureSessionID = loginData.SecureSession;
313 agent.circuitcode = loginData.CircuitCode;
314 agent.BaseFolder = loginData.BaseFolder;
315 agent.InventoryFolder = loginData.InventoryFolder;
316 agent.startpos = loginData.StartPos;
317 agent.CapsPath = loginData.CapsPath;
318 if (loginData.Appearance != null)
319 agent.Appearance = loginData.Appearance;
320 else
321 {
322 m_log.WarnFormat("[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname);
323 agent.Appearance = new AvatarAppearance(agent.AgentID);
324 }
325
326 TriggerExpectUser(regionHandle, agent);
327 }
328
329 public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
330 {
331 //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Other region is sending child agent our way: " + agent.firstname + " " + agent.lastname);
332
333 if (m_regionListeners.ContainsKey(regionHandle))
334 {
335 //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname);
336
337 m_regionListeners[regionHandle].TriggerExpectUser(agent);
338 }
339 }
340
341 public void TriggerLogOffUser(ulong regionHandle, UUID agentID, UUID RegionSecret, string message)
342 {
343 if (m_regionListeners.ContainsKey(regionHandle))
344 {
345 //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname);
346
347 m_regionListeners[regionHandle].TriggerLogOffUser(agentID, RegionSecret, message);
348 }
349 }
350
351 public void PingCheckReply(Hashtable respData)
352 {
353 foreach (ulong region in m_regions.Keys)
354 {
355 Hashtable regData = new Hashtable();
356 RegionInfo reg = m_regions[region];
357 regData["status"] = "active";
358 regData["handle"] = region.ToString();
359
360 respData[reg.RegionID.ToString()] = regData;
361 }
362 }
363
364
365 public LandData RequestLandData (ulong regionHandle, uint x, uint y)
366 {
367 m_log.DebugFormat("[INTERREGION STANDALONE] requests land data in {0}, at {1}, {2}",
368 regionHandle, x, y);
369
370 if (m_regionListeners.ContainsKey(regionHandle))
371 {
372 LandData land = m_regionListeners[regionHandle].TriggerGetLandData(x, y);
373 return land;
374 }
375
376 m_log.Debug("[INTERREGION STANDALONE] didn't find land data locally.");
377 return null;
378 }
379
380 public List<RegionInfo> RequestNamedRegions (string name, int maxNumber)
381 {
382 List<RegionInfo> lowercase_regions = new List<RegionInfo>();
383 List<RegionInfo> regions = new List<RegionInfo>();
384 foreach (RegionInfo info in m_regions.Values)
385 {
386 // Prioritizes exact match
387 if (info.RegionName.StartsWith(name))
388 {
389 regions.Add(info);
390 if (regions.Count >= maxNumber) break;
391 }
392 // But still saves lower case matches
393 else if (info.RegionName.ToLower().StartsWith(name))
394 {
395 if (lowercase_regions.Count < maxNumber)
396 {
397 lowercase_regions.Add(info);
398 }
399 }
400 }
401
402 // If no exact matches found, return lowercase matches (libOMV compatiblity)
403 if (regions.Count == 0 && lowercase_regions.Count != 0)
404 {
405 return lowercase_regions;
406 }
407 return regions;
408 }
409 }
410}
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index d18937e..89b55c4 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.Communications.Local
94 if (md5PasswordHash == userProfile.PasswordHash) 94 if (md5PasswordHash == userProfile.PasswordHash)
95 return true; 95 return true;
96 else 96 else
97 return false; 97 return false;
98 } 98 }
99 } 99 }
100} \ No newline at end of file 100} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
index 8b5779f..94e4ed2 100644
--- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
+++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
@@ -39,10 +39,8 @@ namespace OpenSim.Region.Communications.OGS1
39 LibraryRootFolder libraryRootFolder) 39 LibraryRootFolder libraryRootFolder)
40 : base(serversInfo, libraryRootFolder) 40 : base(serversInfo, libraryRootFolder)
41 { 41 {
42 OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo);
43 m_gridService = gridInterComms;
44 42
45 // This plugin arrangement could eventually be configurable rather than hardcoded here. 43 // This plugin arrangement could eventually be configurable rather than hardcoded here.
46 OGS1UserServices userServices = new OGS1UserServices(this); 44 OGS1UserServices userServices = new OGS1UserServices(this);
47 userServices.AddPlugin(new TemporaryUserProfilePlugin()); 45 userServices.AddPlugin(new TemporaryUserProfilePlugin());
48 userServices.AddPlugin(new OGS1UserDataPlugin(this)); 46 userServices.AddPlugin(new OGS1UserDataPlugin(this));
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
deleted file mode 100644
index 47c7fe4..0000000
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ /dev/null
@@ -1,937 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Net.Sockets;
33using System.Reflection;
34using log4net;
35using Nwc.XmlRpc;
36using OpenMetaverse;
37using OpenSim.Framework;
38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Region.Communications.Local;
41
42namespace OpenSim.Region.Communications.OGS1
43{
44 public class OGS1GridServices : IGridServices
45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 private bool m_useRemoteRegionCache = true;
49 /// <summary>
50 /// Encapsulate local backend services for manipulation of local regions
51 /// </summary>
52 private LocalBackEndServices m_localBackend = new LocalBackEndServices();
53
54 private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
55 // private List<SimpleRegionInfo> m_knownRegions = new List<SimpleRegionInfo>();
56 private Dictionary<ulong, int> m_deadRegionCache = new Dictionary<ulong, int>();
57 private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>();
58 private List<RegionInfo> m_regionsOnInstance = new List<RegionInfo>();
59
60 public BaseHttpServer httpListener;
61 public NetworkServersInfo serversInfo;
62
63 public string gdebugRegionName
64 {
65 get { return m_localBackend.gdebugRegionName; }
66 set { m_localBackend.gdebugRegionName = value; }
67 }
68
69 public string rdebugRegionName
70 {
71 get { return _rdebugRegionName; }
72 set { _rdebugRegionName = value; }
73 }
74 private string _rdebugRegionName = String.Empty;
75
76 public bool RegionLoginsEnabled
77 {
78 get { return m_localBackend.RegionLoginsEnabled; }
79 set { m_localBackend.RegionLoginsEnabled = value; }
80 }
81
82 /// <summary>
83 /// Contructor. Adds "expect_user" and "check" xmlrpc method handlers
84 /// </summary>
85 /// <param name="servers_info"></param>
86 /// <param name="httpServe"></param>
87 public OGS1GridServices(NetworkServersInfo servers_info)
88 {
89 serversInfo = servers_info;
90
91 //Respond to Grid Services requests
92 MainServer.Instance.AddXmlRPCHandler("check", PingCheckReply);
93 }
94
95 // see IGridServices
96 public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
97 {
98 if (m_regionsOnInstance.Contains(regionInfo))
99 {
100 m_log.Error("[OGS1 GRID SERVICES]: Foobar! Caller is confused, region already registered " + regionInfo.RegionName);
101 Exception e = new Exception(String.Format("Unable to register region"));
102
103 throw e;
104 }
105
106 m_log.InfoFormat(
107 "[OGS1 GRID SERVICES]: Registering region {0} with grid at {1}",
108 regionInfo.RegionName, serversInfo.GridURL);
109
110 m_regionsOnInstance.Add(regionInfo);
111
112 Hashtable GridParams = new Hashtable();
113 // Login / Authentication
114
115 GridParams["authkey"] = serversInfo.GridSendKey;
116 GridParams["recvkey"] = serversInfo.GridRecvKey;
117 GridParams["UUID"] = regionInfo.RegionID.ToString();
118 GridParams["sim_ip"] = regionInfo.ExternalHostName;
119 GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString();
120 GridParams["region_locx"] = regionInfo.RegionLocX.ToString();
121 GridParams["region_locy"] = regionInfo.RegionLocY.ToString();
122 GridParams["sim_name"] = regionInfo.RegionName;
123 GridParams["http_port"] = serversInfo.HttpListenerPort.ToString();
124 GridParams["remoting_port"] = ConfigSettings.DefaultRegionRemotingPort.ToString();
125 GridParams["map-image-id"] = regionInfo.RegionSettings.TerrainImageID.ToString();
126 GridParams["originUUID"] = regionInfo.originRegionID.ToString();
127 GridParams["server_uri"] = regionInfo.ServerURI;
128 GridParams["region_secret"] = regionInfo.regionSecret;
129 GridParams["major_interface_version"] = VersionInfo.MajorInterfaceVersion.ToString();
130
131 if (regionInfo.MasterAvatarAssignedUUID != UUID.Zero)
132 GridParams["master_avatar_uuid"] = regionInfo.MasterAvatarAssignedUUID.ToString();
133 else
134 GridParams["master_avatar_uuid"] = regionInfo.EstateSettings.EstateOwner.ToString();
135
136 GridParams["maturity"] = regionInfo.RegionSettings.Maturity.ToString();
137
138 // Package into an XMLRPC Request
139 ArrayList SendParams = new ArrayList();
140 SendParams.Add(GridParams);
141
142 // Send Request
143 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
144 XmlRpcResponse GridResp;
145
146 try
147 {
148 // The timeout should always be significantly larger than the timeout for the grid server to request
149 // the initial status of the region before confirming registration.
150 GridResp = GridReq.Send(serversInfo.GridURL, 9999999);
151 }
152 catch (Exception e)
153 {
154 Exception e2
155 = new Exception(
156 String.Format(
157 "Unable to register region with grid at {0}. Grid service not running?",
158 serversInfo.GridURL),
159 e);
160
161 throw e2;
162 }
163
164 Hashtable GridRespData = (Hashtable)GridResp.Value;
165 // Hashtable griddatahash = GridRespData;
166
167 // Process Response
168 if (GridRespData.ContainsKey("error"))
169 {
170 string errorstring = (string) GridRespData["error"];
171
172 Exception e = new Exception(
173 String.Format("Unable to connect to grid at {0}: {1}", serversInfo.GridURL, errorstring));
174
175 throw e;
176 }
177 else
178 {
179 // m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY);
180 if (GridRespData.ContainsKey("allow_forceful_banlines"))
181 {
182 if ((string) GridRespData["allow_forceful_banlines"] != "TRUE")
183 {
184 //m_localBackend.SetForcefulBanlistsDisallowed(regionInfo.RegionHandle);
185 if (!m_queuedGridSettings.ContainsKey("allow_forceful_banlines"))
186 m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE");
187 }
188 }
189
190 m_log.InfoFormat(
191 "[OGS1 GRID SERVICES]: Region {0} successfully registered with grid at {1}",
192 regionInfo.RegionName, serversInfo.GridURL);
193 }
194
195 return m_localBackend.RegisterRegion(regionInfo);
196 }
197
198 // see IGridServices
199 public bool DeregisterRegion(RegionInfo regionInfo)
200 {
201 Hashtable GridParams = new Hashtable();
202
203 GridParams["UUID"] = regionInfo.RegionID.ToString();
204
205 // Package into an XMLRPC Request
206 ArrayList SendParams = new ArrayList();
207 SendParams.Add(GridParams);
208
209 // Send Request
210 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_after_region_moved", SendParams);
211 XmlRpcResponse GridResp = null;
212
213 try
214 {
215 GridResp = GridReq.Send(serversInfo.GridURL, 10000);
216 }
217 catch (Exception e)
218 {
219 Exception e2
220 = new Exception(
221 String.Format(
222 "Unable to deregister region with grid at {0}. Grid service not running?",
223 serversInfo.GridURL),
224 e);
225
226 throw e2;
227 }
228
229 Hashtable GridRespData = (Hashtable) GridResp.Value;
230
231 // Hashtable griddatahash = GridRespData;
232
233 // Process Response
234 if (GridRespData != null && GridRespData.ContainsKey("error"))
235 {
236 string errorstring = (string)GridRespData["error"];
237 m_log.Error("Unable to connect to grid: " + errorstring);
238 return false;
239 }
240
241 return m_localBackend.DeregisterRegion(regionInfo);
242 }
243
244 public virtual Dictionary<string, string> GetGridSettings()
245 {
246 Dictionary<string, string> returnGridSettings = new Dictionary<string, string>();
247 lock (m_queuedGridSettings)
248 {
249 foreach (string Dictkey in m_queuedGridSettings.Keys)
250 {
251 returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]);
252 }
253
254 m_queuedGridSettings.Clear();
255 }
256
257 return returnGridSettings;
258 }
259
260 // see IGridServices
261 public List<SimpleRegionInfo> RequestNeighbours(uint x, uint y)
262 {
263 Hashtable respData = MapBlockQuery((int) x - 1, (int) y - 1, (int) x + 1, (int) y + 1);
264
265 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
266
267 foreach (ArrayList neighboursList in respData.Values)
268 {
269 foreach (Hashtable neighbourData in neighboursList)
270 {
271 uint regX = Convert.ToUInt32(neighbourData["x"]);
272 uint regY = Convert.ToUInt32(neighbourData["y"]);
273 if ((x != regX) || (y != regY))
274 {
275 string simIp = (string) neighbourData["sim_ip"];
276
277 uint port = Convert.ToUInt32(neighbourData["sim_port"]);
278 // string externalUri = (string) neighbourData["sim_uri"];
279
280 // string externalIpStr = String.Empty;
281 try
282 {
283 // externalIpStr = Util.GetHostFromDNS(simIp).ToString();
284 Util.GetHostFromDNS(simIp).ToString();
285 }
286 catch (SocketException e)
287 {
288 m_log.WarnFormat(
289 "[OGS1 GRID SERVICES]: RequestNeighbours(): Lookup of neighbour {0} failed! Not including in neighbours list. {1}",
290 simIp, e);
291
292 continue;
293 }
294
295 SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port);
296
297 sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]);
298
299 if (neighbourData.ContainsKey("http_port"))
300 {
301 sri.HttpPort = Convert.ToUInt32(neighbourData["http_port"]);
302 }
303 else
304 {
305 m_log.Error("[OGS1 GRID SERVICES]: Couldn't find httpPort, using default 9000; please upgrade your grid-server to r7621 or later");
306 sri.HttpPort = 9000; // that's the default and will probably be wrong
307 }
308
309 sri.RegionID = new UUID((string) neighbourData["uuid"]);
310
311 neighbours.Add(sri);
312 }
313 }
314 }
315
316 return neighbours;
317 }
318
319 /// <summary>
320 /// Request information about a region.
321 /// </summary>
322 /// <param name="regionHandle"></param>
323 /// <returns>
324 /// null on a failure to contact or get a response from the grid server
325 /// FIXME: Might be nicer to return a proper exception here since we could inform the client more about the
326 /// nature of the faiulre.
327 /// </returns>
328 public RegionInfo RequestNeighbourInfo(UUID Region_UUID)
329 {
330 // don't ask the gridserver about regions on this instance...
331 foreach (RegionInfo info in m_regionsOnInstance)
332 {
333 if (info.RegionID == Region_UUID) return info;
334 }
335
336 // didn't find it so far, we have to go the long way
337 RegionInfo regionInfo;
338 Hashtable requestData = new Hashtable();
339 requestData["region_UUID"] = Region_UUID.ToString();
340 requestData["authkey"] = serversInfo.GridSendKey;
341 ArrayList SendParams = new ArrayList();
342 SendParams.Add(requestData);
343 XmlRpcRequest gridReq = new XmlRpcRequest("simulator_data_request", SendParams);
344 XmlRpcResponse gridResp = null;
345
346 try
347 {
348 gridResp = gridReq.Send(serversInfo.GridURL, 3000);
349 }
350 catch (Exception e)
351 {
352 m_log.ErrorFormat(
353 "[OGS1 GRID SERVICES]: Communication with the grid server at {0} failed, {1}",
354 serversInfo.GridURL, e);
355
356 return null;
357 }
358
359 Hashtable responseData = (Hashtable)gridResp.Value;
360
361 if (responseData.ContainsKey("error"))
362 {
363 m_log.WarnFormat("[OGS1 GRID SERVICES]: Error received from grid server: {0}", responseData["error"]);
364 return null;
365 }
366
367 regionInfo = buildRegionInfo(responseData, String.Empty);
368 if ((m_useRemoteRegionCache) && (requestData.ContainsKey("regionHandle")))
369 {
370 m_remoteRegionInfoCache.Add(Convert.ToUInt64((string) requestData["regionHandle"]), regionInfo);
371 }
372
373 return regionInfo;
374 }
375
376 /// <summary>
377 /// Request information about a region.
378 /// </summary>
379 /// <param name="regionHandle"></param>
380 /// <returns></returns>
381 public RegionInfo RequestNeighbourInfo(ulong regionHandle)
382 {
383 RegionInfo regionInfo = m_localBackend.RequestNeighbourInfo(regionHandle);
384
385 if (regionInfo != null)
386 {
387 return regionInfo;
388 }
389
390 if ((!m_useRemoteRegionCache) || (!m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo)))
391 {
392 try
393 {
394 Hashtable requestData = new Hashtable();
395 requestData["region_handle"] = regionHandle.ToString();
396 requestData["authkey"] = serversInfo.GridSendKey;
397 ArrayList SendParams = new ArrayList();
398 SendParams.Add(requestData);
399 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
400 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
401
402 Hashtable responseData = (Hashtable) GridResp.Value;
403
404 if (responseData.ContainsKey("error"))
405 {
406 m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server: " + responseData["error"]);
407 return null;
408 }
409
410 uint regX = Convert.ToUInt32((string) responseData["region_locx"]);
411 uint regY = Convert.ToUInt32((string) responseData["region_locy"]);
412 string externalHostName = (string) responseData["sim_ip"];
413 uint simPort = Convert.ToUInt32(responseData["sim_port"]);
414 string regionName = (string)responseData["region_name"];
415 UUID regionID = new UUID((string)responseData["region_UUID"]);
416 uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
417
418 uint httpPort = 9000;
419 if (responseData.ContainsKey("http_port"))
420 {
421 httpPort = Convert.ToUInt32((string)responseData["http_port"]);
422 }
423
424 // Ok, so this is definitively the wrong place to do this, way too hard coded, but it doesn't seem we GET this info?
425
426 string simURI = "http://" + externalHostName + ":" + simPort;
427
428 // string externalUri = (string) responseData["sim_uri"];
429
430 //IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port);
431 regionInfo = RegionInfo.Create(regionID, regionName, regX, regY, externalHostName, httpPort, simPort, remotingPort, simURI);
432
433 if (m_useRemoteRegionCache)
434 {
435 lock (m_remoteRegionInfoCache)
436 {
437 if (!m_remoteRegionInfoCache.ContainsKey(regionHandle))
438 {
439 m_remoteRegionInfoCache.Add(regionHandle, regionInfo);
440 }
441 }
442 }
443 }
444 catch (Exception e)
445 {
446 m_log.Error("[OGS1 GRID SERVICES]: " +
447 "Region lookup failed for: " + regionHandle.ToString() +
448 " - Is the GridServer down?" + e.ToString());
449 return null;
450 }
451 }
452
453 return regionInfo;
454 }
455
456 /// <summary>
457 /// Get information about a neighbouring region
458 /// </summary>
459 /// <param name="regionHandle"></param>
460 /// <returns></returns>
461 public RegionInfo RequestNeighbourInfo(string name)
462 {
463 // Not implemented yet
464 return null;
465 }
466
467 /// <summary>
468 /// Get information about a neighbouring region
469 /// </summary>
470 /// <param name="regionHandle"></param>
471 /// <returns></returns>
472 public RegionInfo RequestNeighbourInfo(string host, uint port)
473 {
474 // Not implemented yet
475 return null;
476 }
477
478 public RegionInfo RequestClosestRegion(string regionName)
479 {
480 if (m_useRemoteRegionCache)
481 {
482 foreach (RegionInfo ri in m_remoteRegionInfoCache.Values)
483 {
484 if (ri.RegionName == regionName)
485 return ri;
486 }
487 }
488
489 RegionInfo regionInfo = null;
490 try
491 {
492 Hashtable requestData = new Hashtable();
493 requestData["region_name_search"] = regionName;
494 requestData["authkey"] = serversInfo.GridSendKey;
495 ArrayList SendParams = new ArrayList();
496 SendParams.Add(requestData);
497 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
498 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
499
500 Hashtable responseData = (Hashtable) GridResp.Value;
501
502 if (responseData.ContainsKey("error"))
503 {
504 m_log.ErrorFormat("[OGS1 GRID SERVICES]: Error received from grid server: ", responseData["error"]);
505 return null;
506 }
507
508 regionInfo = buildRegionInfo(responseData, "");
509
510 if ((m_useRemoteRegionCache) && (!m_remoteRegionInfoCache.ContainsKey(regionInfo.RegionHandle)))
511 m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo);
512 }
513 catch
514 {
515 m_log.Error("[OGS1 GRID SERVICES]: " +
516 "Region lookup failed for: " + regionName +
517 " - Is the GridServer down?");
518 }
519
520 return regionInfo;
521 }
522
523 /// <summary>
524 ///
525 /// </summary>
526 /// <param name="minX"></param>
527 /// <param name="minY"></param>
528 /// <param name="maxX"></param>
529 /// <param name="maxY"></param>
530 /// <returns></returns>
531 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
532 {
533 int temp = 0;
534
535 if (minX > maxX)
536 {
537 temp = minX;
538 minX = maxX;
539 maxX = temp;
540 }
541 if (minY > maxY)
542 {
543 temp = minY;
544 minY = maxY;
545 maxY = temp;
546 }
547
548 Hashtable respData = MapBlockQuery(minX, minY, maxX, maxY);
549
550 List<MapBlockData> neighbours = new List<MapBlockData>();
551
552 foreach (ArrayList a in respData.Values)
553 {
554 foreach (Hashtable n in a)
555 {
556 MapBlockData neighbour = new MapBlockData();
557
558 neighbour.X = Convert.ToUInt16(n["x"]);
559 neighbour.Y = Convert.ToUInt16(n["y"]);
560
561 neighbour.Name = (string) n["name"];
562 neighbour.Access = Convert.ToByte(n["access"]);
563 neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]);
564 neighbour.WaterHeight = Convert.ToByte(n["water-height"]);
565 neighbour.MapImageId = new UUID((string) n["map-image-id"]);
566
567 neighbours.Add(neighbour);
568 }
569 }
570
571 return neighbours;
572 }
573
574 /// <summary>
575 /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates
576 /// </summary>
577 /// <remarks>REDUNDANT - OGS1 is to be phased out in favour of OGS2</remarks>
578 /// <param name="minX">Minimum X value</param>
579 /// <param name="minY">Minimum Y value</param>
580 /// <param name="maxX">Maximum X value</param>
581 /// <param name="maxY">Maximum Y value</param>
582 /// <returns>Hashtable of hashtables containing map data elements</returns>
583 private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY)
584 {
585 Hashtable param = new Hashtable();
586 param["xmin"] = minX;
587 param["ymin"] = minY;
588 param["xmax"] = maxX;
589 param["ymax"] = maxY;
590 IList parameters = new ArrayList();
591 parameters.Add(param);
592
593 try
594 {
595 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
596 XmlRpcResponse resp = req.Send(serversInfo.GridURL, 10000);
597 Hashtable respData = (Hashtable) resp.Value;
598 return respData;
599 }
600 catch (Exception e)
601 {
602 m_log.Error("MapBlockQuery XMLRPC failure: " + e);
603 return new Hashtable();
604 }
605 }
606
607 /// <summary>
608 /// A ping / version check
609 /// </summary>
610 /// <param name="request"></param>
611 /// <returns></returns>
612 public XmlRpcResponse PingCheckReply(XmlRpcRequest request, IPEndPoint remoteClient)
613 {
614 XmlRpcResponse response = new XmlRpcResponse();
615
616 Hashtable respData = new Hashtable();
617 respData["online"] = "true";
618
619 m_localBackend.PingCheckReply(respData);
620
621 response.Value = respData;
622
623 return response;
624 }
625
626 /// <summary>
627 /// Received from the user server when a user starts logging in. This call allows
628 /// the region to prepare for direct communication from the client. Sends back an empty
629 /// xmlrpc response on completion.
630 /// </summary>
631 /// <param name="request"></param>
632 /// <returns></returns>
633 public XmlRpcResponse ExpectUser(XmlRpcRequest request)
634 {
635 Hashtable requestData = (Hashtable) request.Params[0];
636 AgentCircuitData agentData = new AgentCircuitData();
637 agentData.SessionID = new UUID((string) requestData["session_id"]);
638 agentData.SecureSessionID = new UUID((string) requestData["secure_session_id"]);
639 agentData.firstname = (string) requestData["firstname"];
640 agentData.lastname = (string) requestData["lastname"];
641 agentData.AgentID = new UUID((string) requestData["agent_id"]);
642 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
643 agentData.CapsPath = (string)requestData["caps_path"];
644 ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]);
645
646 // Appearance
647 if (requestData["appearance"] != null)
648 agentData.Appearance = new AvatarAppearance((Hashtable)requestData["appearance"]);
649
650 m_log.DebugFormat(
651 "[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}",
652 agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode);
653
654 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
655 {
656 //m_log.Debug("[CLIENT]: Child agent detected");
657 agentData.child = true;
658 }
659 else
660 {
661 //m_log.Debug("[CLIENT]: Main agent detected");
662 agentData.startpos =
663 new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]),
664 (float)Convert.ToDecimal((string)requestData["startpos_y"]),
665 (float)Convert.ToDecimal((string)requestData["startpos_z"]));
666 agentData.child = false;
667 }
668
669 XmlRpcResponse resp = new XmlRpcResponse();
670
671 if (!RegionLoginsEnabled)
672 {
673 m_log.InfoFormat(
674 "[CLIENT]: Denying access for user {0} {1} because region login is currently disabled",
675 agentData.firstname, agentData.lastname);
676
677 Hashtable respdata = new Hashtable();
678 respdata["success"] = "FALSE";
679 respdata["reason"] = "region login currently disabled";
680 resp.Value = respdata;
681 }
682 else
683 {
684 RegionInfo[] regions = m_regionsOnInstance.ToArray();
685 bool banned = false;
686
687 for (int i = 0; i < regions.Length; i++)
688 {
689 if (regions[i] != null)
690 {
691 if (regions[i].RegionHandle == regionHandle)
692 {
693 if (regions[i].EstateSettings.IsBanned(agentData.AgentID))
694 {
695 banned = true;
696 break;
697 }
698 }
699 }
700 }
701
702 if (banned)
703 {
704 m_log.InfoFormat(
705 "[CLIENT]: Denying access for user {0} {1} because user is banned",
706 agentData.firstname, agentData.lastname);
707
708 Hashtable respdata = new Hashtable();
709 respdata["success"] = "FALSE";
710 respdata["reason"] = "banned";
711 resp.Value = respdata;
712 }
713 else
714 {
715 m_localBackend.TriggerExpectUser(regionHandle, agentData);
716 Hashtable respdata = new Hashtable();
717 respdata["success"] = "TRUE";
718 resp.Value = respdata;
719 }
720 }
721
722 return resp;
723 }
724
725 // Grid Request Processing
726 /// <summary>
727 /// Ooops, our Agent must be dead if we're getting this request!
728 /// </summary>
729 /// <param name="request"></param>
730 /// <returns></returns>
731 public XmlRpcResponse LogOffUser(XmlRpcRequest request)
732 {
733 m_log.Debug("[CONNECTION DEBUGGING]: LogOff User Called");
734
735 Hashtable requestData = (Hashtable)request.Params[0];
736 string message = (string)requestData["message"];
737 UUID agentID = UUID.Zero;
738 UUID RegionSecret = UUID.Zero;
739 UUID.TryParse((string)requestData["agent_id"], out agentID);
740 UUID.TryParse((string)requestData["region_secret"], out RegionSecret);
741
742 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
743
744 m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret,message);
745
746 return new XmlRpcResponse();
747 }
748
749 public void NoteDeadRegion(ulong regionhandle)
750 {
751 lock (m_deadRegionCache)
752 {
753 if (m_deadRegionCache.ContainsKey(regionhandle))
754 {
755 m_deadRegionCache[regionhandle] = m_deadRegionCache[regionhandle] + 1;
756 }
757 else
758 {
759 m_deadRegionCache.Add(regionhandle, 1);
760 }
761 }
762 }
763
764 public LandData RequestLandData (ulong regionHandle, uint x, uint y)
765 {
766 m_log.DebugFormat("[OGS1 GRID SERVICES] requests land data in {0}, at {1}, {2}",
767 regionHandle, x, y);
768 LandData landData = m_localBackend.RequestLandData(regionHandle, x, y);
769 if (landData == null)
770 {
771 Hashtable hash = new Hashtable();
772 hash["region_handle"] = regionHandle.ToString();
773 hash["x"] = x.ToString();
774 hash["y"] = y.ToString();
775
776 IList paramList = new ArrayList();
777 paramList.Add(hash);
778
779 try
780 {
781 // this might be cached, as we probably requested it just a moment ago...
782 RegionInfo info = RequestNeighbourInfo(regionHandle);
783 if (info != null) // just to be sure
784 {
785 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
786 string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
787 XmlRpcResponse response = request.Send(uri, 10000);
788 if (response.IsFault)
789 {
790 m_log.ErrorFormat("[OGS1 GRID SERVICES] remote call returned an error: {0}", response.FaultString);
791 }
792 else
793 {
794 hash = (Hashtable)response.Value;
795 try
796 {
797 landData = new LandData();
798 landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]);
799 landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]);
800 landData.Area = Convert.ToInt32(hash["Area"]);
801 landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]);
802 landData.Description = (string)hash["Description"];
803 landData.Flags = Convert.ToUInt32(hash["Flags"]);
804 landData.GlobalID = new UUID((string)hash["GlobalID"]);
805 landData.Name = (string)hash["Name"];
806 landData.OwnerID = new UUID((string)hash["OwnerID"]);
807 landData.SalePrice = Convert.ToInt32(hash["SalePrice"]);
808 landData.SnapshotID = new UUID((string)hash["SnapshotID"]);
809 landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]);
810 m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name);
811 }
812 catch (Exception e)
813 {
814 m_log.Error("[OGS1 GRID SERVICES] Got exception while parsing land-data:", e);
815 }
816 }
817 }
818 else m_log.WarnFormat("[OGS1 GRID SERVICES] Couldn't find region with handle {0}", regionHandle);
819 }
820 catch (Exception e)
821 {
822 m_log.ErrorFormat("[OGS1 GRID SERVICES] Couldn't contact region {0}: {1}", regionHandle, e);
823 }
824 }
825 return landData;
826 }
827
828 // Grid Request Processing
829 /// <summary>
830 /// Someone asked us about parcel-information
831 /// </summary>
832 /// <param name="request"></param>
833 /// <returns></returns>
834 public XmlRpcResponse LandData(XmlRpcRequest request, IPEndPoint remoteClient)
835 {
836 Hashtable requestData = (Hashtable)request.Params[0];
837 ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]);
838 uint x = Convert.ToUInt32(requestData["x"]);
839 uint y = Convert.ToUInt32(requestData["y"]);
840 m_log.DebugFormat("[OGS1 GRID SERVICES]: Got XML reqeuest for land data at {0}, {1} in region {2}", x, y, regionHandle);
841
842 LandData landData = m_localBackend.RequestLandData(regionHandle, x, y);
843 Hashtable hash = new Hashtable();
844 if (landData != null)
845 {
846 // for now, only push out the data we need for answering a ParcelInfoReqeust
847 hash["AABBMax"] = landData.AABBMax.ToString();
848 hash["AABBMin"] = landData.AABBMin.ToString();
849 hash["Area"] = landData.Area.ToString();
850 hash["AuctionID"] = landData.AuctionID.ToString();
851 hash["Description"] = landData.Description;
852 hash["Flags"] = landData.Flags.ToString();
853 hash["GlobalID"] = landData.GlobalID.ToString();
854 hash["Name"] = landData.Name;
855 hash["OwnerID"] = landData.OwnerID.ToString();
856 hash["SalePrice"] = landData.SalePrice.ToString();
857 hash["SnapshotID"] = landData.SnapshotID.ToString();
858 hash["UserLocation"] = landData.UserLocation.ToString();
859 }
860
861 XmlRpcResponse response = new XmlRpcResponse();
862 response.Value = hash;
863 return response;
864 }
865
866 public List<RegionInfo> RequestNamedRegions (string name, int maxNumber)
867 {
868 // no asking of the local backend first, here, as we have to ask the gridserver anyway.
869 Hashtable hash = new Hashtable();
870 hash["name"] = name;
871 hash["maxNumber"] = maxNumber.ToString();
872
873 IList paramList = new ArrayList();
874 paramList.Add(hash);
875
876 Hashtable result = XmlRpcSearchForRegionByName(paramList);
877 if (result == null) return null;
878
879 uint numberFound = Convert.ToUInt32(result["numFound"]);
880 List<RegionInfo> infos = new List<RegionInfo>();
881 for (int i = 0; i < numberFound; ++i)
882 {
883 string prefix = "region" + i + ".";
884 RegionInfo info = buildRegionInfo(result, prefix);
885 infos.Add(info);
886 }
887 return infos;
888 }
889
890 private RegionInfo buildRegionInfo(Hashtable responseData, string prefix)
891 {
892 uint regX = Convert.ToUInt32((string) responseData[prefix + "region_locx"]);
893 uint regY = Convert.ToUInt32((string) responseData[prefix + "region_locy"]);
894 string internalIpStr = (string) responseData[prefix + "sim_ip"];
895 uint port = Convert.ToUInt32(responseData[prefix + "sim_port"]);
896
897 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(Util.GetHostFromDNS(internalIpStr), (int) port);
898
899 RegionInfo regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
900 regionInfo.RemotingPort = Convert.ToUInt32((string) responseData[prefix + "remoting_port"]);
901 regionInfo.RemotingAddress = internalIpStr;
902
903 if (responseData.ContainsKey(prefix + "http_port"))
904 {
905 regionInfo.HttpPort = Convert.ToUInt32((string) responseData[prefix + "http_port"]);
906 }
907
908 regionInfo.RegionID = new UUID((string) responseData[prefix + "region_UUID"]);
909 regionInfo.RegionName = (string) responseData[prefix + "region_name"];
910
911 regionInfo.RegionSettings.TerrainImageID = new UUID((string) responseData[prefix + "map_UUID"]);
912 return regionInfo;
913 }
914
915 private Hashtable XmlRpcSearchForRegionByName(IList parameters)
916 {
917 try
918 {
919 XmlRpcRequest request = new XmlRpcRequest("search_for_region_by_name", parameters);
920 XmlRpcResponse resp = request.Send(serversInfo.GridURL, 10000);
921 Hashtable respData = (Hashtable) resp.Value;
922 if (respData != null && respData.Contains("faultCode"))
923 {
924 m_log.WarnFormat("[OGS1 GRID SERVICES]: Got an error while contacting GridServer: {0}", respData["faultString"]);
925 return null;
926 }
927
928 return respData;
929 }
930 catch (Exception e)
931 {
932 m_log.Error("[OGS1 GRID SERVICES]: MapBlockQuery XMLRPC failure: ", e);
933 return null;
934 }
935 }
936 }
937}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
index 01d6ec8..2f9a45f 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
@@ -81,7 +81,7 @@ namespace OpenSim.Region.Communications.OGS1
81 public virtual void AddTemporaryUserProfile(UserProfileData userProfile) 81 public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
82 { 82 {
83 // Not interested 83 // Not interested
84 } 84 }
85 85
86 public UserProfileData GetUserByUri(Uri uri) 86 public UserProfileData GetUserByUri(Uri uri)
87 { 87 {
@@ -695,7 +695,7 @@ namespace OpenSim.Region.Communications.OGS1
695 userData.Partner = UUID.Zero; 695 userData.Partner = UUID.Zero;
696 696
697 return userData; 697 return userData;
698 } 698 }
699 699
700 protected AvatarAppearance ConvertXMLRPCDataToAvatarAppearance(Hashtable data) 700 protected AvatarAppearance ConvertXMLRPCDataToAvatarAppearance(Hashtable data)
701 { 701 {
@@ -766,6 +766,6 @@ namespace OpenSim.Region.Communications.OGS1
766 } 766 }
767 767
768 return buddylist; 768 return buddylist;
769 } 769 }
770 } 770 }
771} 771}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 51ba2e9..ed3526d 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -41,7 +41,7 @@ using OpenSim.Framework.Communications;
41using OpenSim.Framework.Communications.Clients; 41using OpenSim.Framework.Communications.Clients;
42 42
43namespace OpenSim.Region.Communications.OGS1 43namespace OpenSim.Region.Communications.OGS1
44{ 44{
45 public class OGS1UserServices : UserManagerBase 45 public class OGS1UserServices : UserManagerBase
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -94,7 +94,7 @@ namespace OpenSim.Region.Communications.OGS1
94 catch (WebException) 94 catch (WebException)
95 { 95 {
96 m_log.Warn("[LOGOFF]: Unable to notify grid server of user logoff"); 96 m_log.Warn("[LOGOFF]: Unable to notify grid server of user logoff");
97 } 97 }
98 } 98 }
99 99
100 /// <summary> 100 /// <summary>
@@ -150,10 +150,10 @@ namespace OpenSim.Region.Communications.OGS1
150 IList parameters = new ArrayList(); 150 IList parameters = new ArrayList();
151 parameters.Add(param); 151 parameters.Add(param);
152 XmlRpcRequest req = new XmlRpcRequest("authenticate_user_by_password", parameters); 152 XmlRpcRequest req = new XmlRpcRequest("authenticate_user_by_password", parameters);
153 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000); 153 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000);
154 154
155 // Temporary measure to deal with older services 155 // Temporary measure to deal with older services
156 if (resp.IsFault && resp.FaultCode == XmlRpcErrorCodes.SERVER_ERROR_METHOD) 156 if (resp.IsFault && resp.FaultCode == XmlRpcErrorCodes.SERVER_ERROR_METHOD)
157 { 157 {
158 throw new Exception( 158 throw new Exception(
159 String.Format( 159 String.Format(
@@ -170,7 +170,7 @@ namespace OpenSim.Region.Communications.OGS1
170 else 170 else
171 { 171 {
172 return false; 172 return false;
173 } 173 }
174 } 174 }
175 } 175 }
176} \ No newline at end of file 176} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs
index addc36b..9c646b6 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs
@@ -162,7 +162,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
162 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); 162 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
163 163
164 transactions.RequestUpdateTaskInventoryItem(remoteClient, part, transactionID, item); 164 transactions.RequestUpdateTaskInventoryItem(remoteClient, part, transactionID, item);
165 } 165 }
166 166
167 /// <summary> 167 /// <summary>
168 /// Request that a client (agent) begin an asset transfer. 168 /// Request that a client (agent) begin an asset transfer.
diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
index 0c6900d..2a1355b 100644
--- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
@@ -49,9 +49,9 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
49 /// </summary> 49 /// </summary>
50 protected Dictionary<UUID, Caps> m_capsHandlers = new Dictionary<UUID, Caps>(); 50 protected Dictionary<UUID, Caps> m_capsHandlers = new Dictionary<UUID, Caps>();
51 51
52 protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>(); 52 protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>();
53 protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds 53 protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds
54 = new Dictionary<UUID, Dictionary<ulong, string>>(); 54 = new Dictionary<UUID, Dictionary<ulong, string>>();
55 55
56 public void Initialise(IConfigSource source) 56 public void Initialise(IConfigSource source)
57 { 57 {
@@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
147 agentId, m_scene.RegionInfo.RegionName); 147 agentId, m_scene.RegionInfo.RegionName);
148 } 148 }
149 } 149 }
150 } 150 }
151 151
152 public Caps GetCapsHandlerForUser(UUID agentId) 152 public Caps GetCapsHandlerForUser(UUID agentId)
153 { 153 {
@@ -177,7 +177,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
177 } 177 }
178 178
179 return null; 179 return null;
180 } 180 }
181 181
182 public Dictionary<ulong, string> GetChildrenSeeds(UUID agentID) 182 public Dictionary<ulong, string> GetChildrenSeeds(UUID agentID)
183 { 183 {
@@ -225,6 +225,6 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
225 y = y / Constants.RegionSize; 225 y = y / Constants.RegionSize;
226 m_log.Info(" >> "+x+", "+y+": "+kvp.Value); 226 m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
227 } 227 }
228 } 228 }
229 } 229 }
230} 230}
diff --git a/OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs b/OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs
index 394b1bb..8502006 100644
--- a/OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs
+++ b/OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
51 { 51 {
52 // Only need to run through all this if there are entries in the ban list 52 // Only need to run through all this if there are entries in the ban list
53 if (bans.Count > 0) 53 if (bans.Count > 0)
54 { 54 {
55 IClientIPEndpoint ipEndpoint; 55 IClientIPEndpoint ipEndpoint;
56 if (client.TryGet(out ipEndpoint)) 56 if (client.TryGet(out ipEndpoint))
57 { 57 {
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 937f76b..1fdb003 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -361,7 +361,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
361 m_cacheddecode.Remove(AssetId); 361 m_cacheddecode.Remove(AssetId);
362 m_cacheddecode.Add(AssetId, layers); 362 m_cacheddecode.Add(AssetId, layers);
363 363
364 } 364 }
365 365
366 // Notify Interested Parties 366 // Notify Interested Parties
367 lock (m_notifyList) 367 lock (m_notifyList)
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index a1e27f1..5a5ad7e 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.CoreModules.Asset
42 /// <para> 42 /// <para>
43 /// Cache is enabled by setting "AssetCaching" configuration to value "CenomeMemoryAssetCache". 43 /// Cache is enabled by setting "AssetCaching" configuration to value "CenomeMemoryAssetCache".
44 /// When cache is successfully enable log should have message 44 /// When cache is successfully enable log should have message
45 /// "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = XXX bytes, MaxCount = XXX, ExpirationTime = XXX)". 45 /// "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = XXX bytes, MaxCount = XXX, ExpirationTime = XXX)".
46 /// </para> 46 /// </para>
47 /// <para> 47 /// <para>
48 /// Cache's size is limited by two parameters: 48 /// Cache's size is limited by two parameters:
@@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.Asset
113 113
114 /// <summary> 114 /// <summary>
115 /// Asset's default expiration time in the cache. 115 /// Asset's default expiration time in the cache.
116 /// </summary> 116 /// </summary>
117 public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0); 117 public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0);
118 118
119 /// <summary> 119 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 37cccc8..817e0d4 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -470,7 +470,7 @@ namespace Flotsam.RegionModules.AssetCache
470 else if (dirSize >= m_CacheWarnAt) 470 else if (dirSize >= m_CacheWarnAt)
471 { 471 {
472 m_log.WarnFormat("[FLOTSAM ASSET CACHE]: Cache folder exceeded CacheWarnAt limit {0} {1}. Suggest increasing tiers, tier length, or reducing cache expiration", dir, dirSize); 472 m_log.WarnFormat("[FLOTSAM ASSET CACHE]: Cache folder exceeded CacheWarnAt limit {0} {1}. Suggest increasing tiers, tier length, or reducing cache expiration", dir, dirSize);
473 } 473 }
474 } 474 }
475 475
476 private string GetFileName(string id) 476 private string GetFileName(string id)
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index fcc2673..66a9b5a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -114,7 +114,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
114 scene.EventManager.OnChatBroadcast -= OnChatBroadcast; 114 scene.EventManager.OnChatBroadcast -= OnChatBroadcast;
115 m_scenes.Remove(scene); 115 m_scenes.Remove(scene);
116 } 116 }
117 } 117 }
118 } 118 }
119 119
120 public virtual void Close() 120 public virtual void Close()
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index 046fc4a..ebebaf9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
52 this, "alert", "alert <first> <last> <message>", "Send an alert to a user", HandleAlertConsoleCommand); 52 this, "alert", "alert <first> <last> <message>", "Send an alert to a user", HandleAlertConsoleCommand);
53 53
54 m_scene.AddCommand( 54 m_scene.AddCommand(
55 this, "alert general", "alert general <message>", "Send an alert to everyone", HandleAlertConsoleCommand); 55 this, "alert general", "alert general <message>", "Send an alert to everyone", HandleAlertConsoleCommand);
56 } 56 }
57 57
58 public void PostInitialise() {} 58 public void PostInitialise() {}
@@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
63 public void SendAlertToUser(IClientAPI client, string message) 63 public void SendAlertToUser(IClientAPI client, string message)
64 { 64 {
65 SendAlertToUser(client, message, false); 65 SendAlertToUser(client, message, false);
66 } 66 }
67 67
68 public void SendAlertToUser(IClientAPI client, string message, bool modal) 68 public void SendAlertToUser(IClientAPI client, string message, bool modal)
69 { 69 {
@@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
73 public void SendAlertToUser(UUID agentID, string message) 73 public void SendAlertToUser(UUID agentID, string message)
74 { 74 {
75 SendAlertToUser(agentID, message, false); 75 SendAlertToUser(agentID, message, false);
76 } 76 }
77 77
78 public void SendAlertToUser(UUID agentID, string message, bool modal) 78 public void SendAlertToUser(UUID agentID, string message, bool modal)
79 { 79 {
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
81 81
82 if (sp != null) 82 if (sp != null)
83 sp.ControllingClient.SendAgentAlertMessage(message, modal); 83 sp.ControllingClient.SendAgentAlertMessage(message, modal);
84 } 84 }
85 85
86 public void SendAlertToUser(string firstName, string lastName, string message, bool modal) 86 public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
87 { 87 {
@@ -95,7 +95,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
95 break; 95 break;
96 } 96 }
97 } 97 }
98 } 98 }
99 99
100 public void SendGeneralAlert(string message) 100 public void SendGeneralAlert(string message)
101 { 101 {
@@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
106 if (!presence.IsChildAgent) 106 if (!presence.IsChildAgent)
107 presence.ControllingClient.SendAlertMessage(message); 107 presence.ControllingClient.SendAlertMessage(message);
108 } 108 }
109 } 109 }
110 110
111 public void SendDialogToUser( 111 public void SendDialogToUser(
112 UUID avatarID, string objectName, UUID objectID, UUID ownerID, 112 UUID avatarID, string objectName, UUID objectID, UUID ownerID,
@@ -135,9 +135,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
135 { 135 {
136 ScenePresence sp = m_scene.GetScenePresence(avatarID); 136 ScenePresence sp = m_scene.GetScenePresence(avatarID);
137 137
138 if (sp != null) 138 if (sp != null)
139 sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); 139 sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url);
140 } 140 }
141 141
142 public void SendNotificationToUsersInEstate( 142 public void SendNotificationToUsersInEstate(
143 UUID fromAvatarID, string fromAvatarName, string message) 143 UUID fromAvatarID, string fromAvatarName, string message)
@@ -145,11 +145,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
145 // TODO: This does not yet do what it says on the tin - it only sends the message to users in the same 145 // TODO: This does not yet do what it says on the tin - it only sends the message to users in the same
146 // region as the sending avatar. 146 // region as the sending avatar.
147 SendNotificationToUsersInRegion(fromAvatarID, fromAvatarName, message); 147 SendNotificationToUsersInRegion(fromAvatarID, fromAvatarName, message);
148 } 148 }
149 149
150 public void SendNotificationToUsersInRegion( 150 public void SendNotificationToUsersInRegion(
151 UUID fromAvatarID, string fromAvatarName, string message) 151 UUID fromAvatarID, string fromAvatarName, string message)
152 { 152 {
153 List<ScenePresence> presenceList = m_scene.GetScenePresences(); 153 List<ScenePresence> presenceList = m_scene.GetScenePresences();
154 154
155 foreach (ScenePresence presence in presenceList) 155 foreach (ScenePresence presence in presenceList)
@@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
185 185
186 m_log.InfoFormat( 186 m_log.InfoFormat(
187 "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", 187 "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}",
188 m_scene.RegionInfo.RegionName, firstName, lastName, message); 188 m_scene.RegionInfo.RegionName, firstName, lastName, message);
189 SendAlertToUser(firstName, lastName, message, false); 189 SendAlertToUser(firstName, lastName, message, false);
190 } 190 }
191 } 191 }
@@ -199,6 +199,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
199 } 199 }
200 200
201 return result; 201 return result;
202 } 202 }
203 } 203 }
204} 204}
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 49b2b5c..fc7d63a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -40,6 +40,7 @@ using OpenSim.Framework.Communications.Cache;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Services.Interfaces; 42using OpenSim.Services.Interfaces;
43using GridRegion = OpenSim.Services.Interfaces.GridRegion;
43 44
44namespace OpenSim.Region.CoreModules.Avatar.Friends 45namespace OpenSim.Region.CoreModules.Avatar.Friends
45{ 46{
@@ -108,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
108 private Dictionary<ulong, Scene> m_scenes = new Dictionary<ulong,Scene>(); 109 private Dictionary<ulong, Scene> m_scenes = new Dictionary<ulong,Scene>();
109 private IMessageTransferModule m_TransferModule = null; 110 private IMessageTransferModule m_TransferModule = null;
110 111
111 private IGridServices m_gridServices = null; 112 private IGridService m_gridServices = null;
112 113
113 #region IRegionModule Members 114 #region IRegionModule Members
114 115
@@ -142,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
142 if (m_scenes.Count > 0) 143 if (m_scenes.Count > 0)
143 { 144 {
144 m_TransferModule = m_initialScene.RequestModuleInterface<IMessageTransferModule>(); 145 m_TransferModule = m_initialScene.RequestModuleInterface<IMessageTransferModule>();
145 m_gridServices = m_initialScene.CommsManager.GridService; 146 m_gridServices = m_initialScene.GridService;
146 } 147 }
147 if (m_TransferModule == null) 148 if (m_TransferModule == null)
148 m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work"); 149 m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work");
@@ -171,7 +172,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
171 List<UUID> tpdAway = new List<UUID>(); 172 List<UUID> tpdAway = new List<UUID>();
172 173
173 // destRegionHandle is a region on another server 174 // destRegionHandle is a region on another server
174 RegionInfo info = m_gridServices.RequestNeighbourInfo(destRegionHandle); 175 uint x = 0, y = 0;
176 Utils.LongToUInts(destRegionHandle, out x, out y);
177 GridRegion info = m_gridServices.GetRegionByPosition(m_initialScene.RegionInfo.ScopeID, (int)x, (int)y);
175 if (info != null) 178 if (info != null)
176 { 179 {
177 string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk"; 180 string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk";
@@ -223,7 +226,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
223 public bool TriggerTerminateFriend(ulong destRegionHandle, UUID agentID, UUID exFriendID) 226 public bool TriggerTerminateFriend(ulong destRegionHandle, UUID agentID, UUID exFriendID)
224 { 227 {
225 // destRegionHandle is a region on another server 228 // destRegionHandle is a region on another server
226 RegionInfo info = m_gridServices.RequestNeighbourInfo(destRegionHandle); 229 uint x = 0, y = 0;
230 Utils.LongToUInts(destRegionHandle, out x, out y);
231 GridRegion info = m_gridServices.GetRegionByPosition(m_initialScene.RegionInfo.ScopeID, (int)x, (int)y);
227 if (info == null) 232 if (info == null)
228 { 233 {
229 m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}", destRegionHandle); 234 m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}", destRegionHandle);
@@ -492,7 +497,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
492 { 497 {
493 m_log.ErrorFormat("[FRIENDS]: No user found for id {0} in OfferFriendship()", fromUserId); 498 m_log.ErrorFormat("[FRIENDS]: No user found for id {0} in OfferFriendship()", fromUserId);
494 } 499 }
495 } 500 }
496 501
497 #region FriendRequestHandling 502 #region FriendRequestHandling
498 503
@@ -503,7 +508,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
503 508
504 if (im.dialog == (byte)InstantMessageDialog.FriendshipOffered) // 38 509 if (im.dialog == (byte)InstantMessageDialog.FriendshipOffered) // 38
505 { 510 {
506 // fromAgentName is the *destination* name (the friend we offer friendship to) 511 // fromAgentName is the *destination* name (the friend we offer friendship to)
507 ScenePresence initiator = GetAnyPresenceFromAgentID(new UUID(im.fromAgentID)); 512 ScenePresence initiator = GetAnyPresenceFromAgentID(new UUID(im.fromAgentID));
508 im.fromAgentName = initiator != null ? initiator.Name : "(hippo)"; 513 im.fromAgentName = initiator != null ? initiator.Name : "(hippo)";
509 514
@@ -523,13 +528,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
523 /// Invoked when a user offers a friendship. 528 /// Invoked when a user offers a friendship.
524 /// </summary> 529 /// </summary>
525 /// 530 ///
526 /// <param name="im"></param> 531 /// <param name="im"></param>
527 /// <param name="client"></param> 532 /// <param name="client"></param>
528 private void FriendshipOffered(GridInstantMessage im) 533 private void FriendshipOffered(GridInstantMessage im)
529 { 534 {
530 // this is triggered by the initiating agent: 535 // this is triggered by the initiating agent:
531 // A local agent offers friendship to some possibly remote friend. 536 // A local agent offers friendship to some possibly remote friend.
532 // A IM is triggered, processed here and sent to the friend (possibly in a remote region). 537 // A IM is triggered, processed here and sent to the friend (possibly in a remote region).
533 538
534 m_log.DebugFormat("[FRIEND]: Offer(38) - From: {0}, FromName: {1} To: {2}, Session: {3}, Message: {4}, Offline {5}", 539 m_log.DebugFormat("[FRIEND]: Offer(38) - From: {0}, FromName: {1} To: {2}, Session: {3}, Message: {4}, Offline {5}",
535 im.fromAgentID, im.fromAgentName, im.toAgentID, im.imSessionID, im.message, im.offline); 540 im.fromAgentID, im.fromAgentName, im.toAgentID, im.imSessionID, im.message, im.offline);
@@ -554,7 +559,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
554 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success); 559 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
555 } 560 }
556 ); 561 );
557 } 562 }
558 } 563 }
559 564
560 /// <summary> 565 /// <summary>
@@ -565,7 +570,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
565 private void FriendshipAccepted(IClientAPI client, GridInstantMessage im) 570 private void FriendshipAccepted(IClientAPI client, GridInstantMessage im)
566 { 571 {
567 m_log.DebugFormat("[FRIEND]: 39 - from client {0}, agent {2} {3}, imsession {4} to {5}: {6} (dialog {7})", 572 m_log.DebugFormat("[FRIEND]: 39 - from client {0}, agent {2} {3}, imsession {4} to {5}: {6} (dialog {7})",
568 client.AgentId, im.fromAgentID, im.fromAgentName, im.imSessionID, im.toAgentID, im.message, im.dialog); 573 client.AgentId, im.fromAgentID, im.fromAgentName, im.imSessionID, im.toAgentID, im.message, im.dialog);
569 } 574 }
570 575
571 /// <summary> 576 /// <summary>
@@ -597,7 +602,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
597 delegate(bool success) { 602 delegate(bool success) {
598 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success); 603 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
599 } 604 }
600 ); 605 );
601 } 606 }
602 607
603 private void OnGridInstantMessage(GridInstantMessage msg) 608 private void OnGridInstantMessage(GridInstantMessage msg)
diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
index ff12361..8ce5092 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
@@ -91,6 +91,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
91 else 91 else
92 m_log.ErrorFormat( 92 m_log.ErrorFormat(
93 "[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name); 93 "[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name);
94 } 94 }
95 } 95 }
96} \ No newline at end of file 96} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index 8926527..f941728 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
43 { 43 {
44 m_scene = scene; 44 m_scene = scene;
45 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); 45 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
46 m_scene.RegisterModuleInterface<IGodsModule>(this); 46 m_scene.RegisterModuleInterface<IGodsModule>(this);
47 } 47 }
48 48
49 public void PostInitialise() {} 49 public void PostInitialise() {}
@@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
84 m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); 84 m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied");
85 } 85 }
86 } 86 }
87 } 87 }
88 88
89 /// <summary> 89 /// <summary>
90 /// Kicks User specified from the simulator. This logs them off of the grid 90 /// Kicks User specified from the simulator. This logs them off of the grid
@@ -142,7 +142,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
142 } 142 }
143 } 143 }
144 else 144 else
145 { 145 {
146 m_dialogModule.SendAlertToUser(godID, "Kick request denied"); 146 m_dialogModule.SendAlertToUser(godID, "Kick request denied");
147 } 147 }
148 } 148 }
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
index 66f1e14..9a68749 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
38{ 38{
39 public class InstantMessageModule : IRegionModule 39 public class InstantMessageModule : IRegionModule
40 { 40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 /// <value> 43 /// <value>
44 /// Is this module enabled? 44 /// Is this module enabled?
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 4495303..e5159b3 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -36,6 +36,7 @@ using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39 40
40namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 41namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
41{ 42{
@@ -497,7 +498,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
497 { 498 {
498 if (upd.AgentOnline) 499 if (upd.AgentOnline)
499 { 500 {
500 RegionInfo reginfo = m_Scenes[0].SceneGridService.RequestNeighbouringRegionInfo(upd.Handle); 501 uint x = 0, y = 0;
502 Utils.LongToUInts(upd.Handle, out x, out y);
503 GridRegion reginfo = m_Scenes[0].GridService.GetRegionByPosition(m_Scenes[0].RegionInfo.ScopeID,
504 (int)x, (int)y);
501 if (reginfo != null) 505 if (reginfo != null)
502 { 506 {
503 Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im); 507 Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
@@ -559,7 +563,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
559 /// <param name="reginfo">RegionInfo we pull the data out of to send the request to</param> 563 /// <param name="reginfo">RegionInfo we pull the data out of to send the request to</param>
560 /// <param name="xmlrpcdata">The Instant Message data Hashtable</param> 564 /// <param name="xmlrpcdata">The Instant Message data Hashtable</param>
561 /// <returns>Bool if the message was successfully delivered at the other side.</returns> 565 /// <returns>Bool if the message was successfully delivered at the other side.</returns>
562 protected virtual bool doIMSending(RegionInfo reginfo, Hashtable xmlrpcdata) 566 protected virtual bool doIMSending(GridRegion reginfo, Hashtable xmlrpcdata)
563 { 567 {
564 568
565 ArrayList SendParams = new ArrayList(); 569 ArrayList SendParams = new ArrayList();
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
index ebd9a72..ad05bab 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
@@ -35,6 +35,7 @@ using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
38 39
39namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 40namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
40{ 41{
@@ -171,7 +172,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
171 { 172 {
172 // TODO this is the old messaging-server protocol; only the regionHandle is available. 173 // TODO this is the old messaging-server protocol; only the regionHandle is available.
173 // Fetch region-info to get the id 174 // Fetch region-info to get the id
174 RegionInfo regionInfo = m_initialScene.RequestNeighbouringRegionInfo(info.regionHandle); 175 uint x = 0, y = 0;
176 Utils.LongToUInts(info.regionHandle, out x, out y);
177 GridRegion regionInfo = m_initialScene.GridService.GetRegionByPosition(m_initialScene.RegionInfo.ScopeID,
178 (int)x, (int)y);
175 regionID = regionInfo.RegionID; 179 regionID = regionInfo.RegionID;
176 } 180 }
177 result[indices[i]] = new PresenceInfo(uuids[i], regionID); 181 result[indices[i]] = new PresenceInfo(uuids[i], regionID);
@@ -349,6 +353,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
349 353
350 private void NotifyMessageServerOfShutdown(Scene scene) 354 private void NotifyMessageServerOfShutdown(Scene scene)
351 { 355 {
356 if (m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL == string.Empty)
357 return;
358
352 Hashtable xmlrpcdata = new Hashtable(); 359 Hashtable xmlrpcdata = new Hashtable();
353 xmlrpcdata["RegionUUID"] = scene.RegionInfo.RegionID.ToString(); 360 xmlrpcdata["RegionUUID"] = scene.RegionInfo.RegionID.ToString();
354 ArrayList SendParams = new ArrayList(); 361 ArrayList SendParams = new ArrayList();
@@ -372,6 +379,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
372 379
373 private void NotifyMessageServerOfAgentLocation(UUID agentID, UUID region, ulong regionHandle) 380 private void NotifyMessageServerOfAgentLocation(UUID agentID, UUID region, ulong regionHandle)
374 { 381 {
382 if (m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL == string.Empty)
383 return;
384
375 Hashtable xmlrpcdata = new Hashtable(); 385 Hashtable xmlrpcdata = new Hashtable();
376 xmlrpcdata["AgentID"] = agentID.ToString(); 386 xmlrpcdata["AgentID"] = agentID.ToString();
377 xmlrpcdata["RegionUUID"] = region.ToString(); 387 xmlrpcdata["RegionUUID"] = region.ToString();
@@ -397,6 +407,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
397 407
398 private void NotifyMessageServerOfAgentLeaving(UUID agentID, UUID region, ulong regionHandle) 408 private void NotifyMessageServerOfAgentLeaving(UUID agentID, UUID region, ulong regionHandle)
399 { 409 {
410 if (m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL == string.Empty)
411 return;
412
400 Hashtable xmlrpcdata = new Hashtable(); 413 Hashtable xmlrpcdata = new Hashtable();
401 xmlrpcdata["AgentID"] = agentID.ToString(); 414 xmlrpcdata["AgentID"] = agentID.ToString();
402 xmlrpcdata["RegionUUID"] = region.ToString(); 415 xmlrpcdata["RegionUUID"] = region.ToString();
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 907e2d4..f761bf0 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
59 /// <value> 59 /// <value>
60 /// We only use this to request modules 60 /// We only use this to request modules
61 /// </value> 61 /// </value>
62 protected Scene m_scene; 62 protected Scene m_scene;
63 63
64 /// <value> 64 /// <value>
65 /// The stream from which the inventory archive will be loaded. 65 /// The stream from which the inventory archive will be loaded.
@@ -186,7 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
186 item.Folder = foundFolder.ID; 186 item.Folder = foundFolder.ID;
187 187
188 //m_userInfo.AddItem(item); 188 //m_userInfo.AddItem(item);
189 m_scene.InventoryService.AddItem(item); 189 m_scene.InventoryService.AddItem(item);
190 successfulItemRestores++; 190 successfulItemRestores++;
191 191
192 // If we're loading an item directly into the given destination folder then we need to record 192 // If we're loading an item directly into the given destination folder then we need to record
@@ -299,14 +299,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
299 = new InventoryFolderBase( 299 = new InventoryFolderBase(
300 newFolderId, newFolderName, m_userInfo.UserProfile.ID, 300 newFolderId, newFolderName, m_userInfo.UserProfile.ID,
301 (short)AssetType.Unknown, destFolder.ID, 1); 301 (short)AssetType.Unknown, destFolder.ID, 1);
302 m_scene.InventoryService.AddFolder(destFolder); 302 m_scene.InventoryService.AddFolder(destFolder);
303 303
304// UUID newFolderId = UUID.Random(); 304// UUID newFolderId = UUID.Random();
305// m_scene.InventoryService.AddFolder( 305// m_scene.InventoryService.AddFolder(
306// m_userInfo.CreateFolder( 306// m_userInfo.CreateFolder(
307// folderName, newFolderId, (ushort)AssetType.Folder, foundFolder.ID); 307// folderName, newFolderId, (ushort)AssetType.Folder, foundFolder.ID);
308 308
309// m_log.DebugFormat("[INVENTORY ARCHIVER]: Retrieving newly created folder {0}", folderName); 309// m_log.DebugFormat("[INVENTORY ARCHIVER]: Retrieving newly created folder {0}", folderName);
310// foundFolder = foundFolder.GetChildFolder(newFolderId); 310// foundFolder = foundFolder.GetChildFolder(newFolderId);
311// m_log.DebugFormat( 311// m_log.DebugFormat(
312// "[INVENTORY ARCHIVER]: Retrieved newly created folder {0} with ID {1}", 312// "[INVENTORY ARCHIVER]: Retrieved newly created folder {0} with ID {1}",
@@ -321,7 +321,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
321 nodesLoaded.Add(destFolder); 321 nodesLoaded.Add(destFolder);
322 322
323 i++; 323 i++;
324 } 324 }
325 325
326 return destFolder; 326 return destFolder;
327 327
@@ -357,7 +357,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
357 rawFolders[i++], newFolderId, (ushort)AssetType.Folder, foundFolder.ID); 357 rawFolders[i++], newFolderId, (ushort)AssetType.Folder, foundFolder.ID);
358 foundFolder = foundFolder.GetChildFolder(newFolderId); 358 foundFolder = foundFolder.GetChildFolder(newFolderId);
359 } 359 }
360 */ 360 */
361 } 361 }
362 362
363 /// <summary> 363 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index 5ebf2fa..a822d10 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
42 42
43 /// <summary> 43 /// <summary>
44 /// Find a folder given a PATH_DELIMITER delimited path starting from a user's root folder 44 /// Find a folder given a PATH_DELIMITER delimited path starting from a user's root folder
45 /// </summary> 45 /// </summary>
46 /// 46 ///
47 /// This method does not handle paths that contain multiple delimitors 47 /// This method does not handle paths that contain multiple delimitors
48 /// 48 ///
@@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
58 /// User id to search 58 /// User id to search
59 /// </param> 59 /// </param>
60 /// <param name="path"> 60 /// <param name="path">
61 /// The path to the required folder. 61 /// The path to the required folder.
62 /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. 62 /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
63 /// </param> 63 /// </param>
64 /// <returns>null if the folder is not found</returns> 64 /// <returns>null if the folder is not found</returns>
@@ -71,11 +71,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
71 return null; 71 return null;
72 72
73 return FindFolderByPath(inventoryService, rootFolder, path); 73 return FindFolderByPath(inventoryService, rootFolder, path);
74 } 74 }
75 75
76 /// <summary> 76 /// <summary>
77 /// Find a folder given a PATH_DELIMITER delimited path starting from this folder 77 /// Find a folder given a PATH_DELIMITER delimited path starting from this folder
78 /// </summary> 78 /// </summary>
79 /// 79 ///
80 /// This method does not handle paths that contain multiple delimitors 80 /// This method does not handle paths that contain multiple delimitors
81 /// 81 ///
@@ -91,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
91 /// The folder from which the path starts 91 /// The folder from which the path starts
92 /// </param> 92 /// </param>
93 /// <param name="path"> 93 /// <param name="path">
94 /// The path to the required folder. 94 /// The path to the required folder.
95 /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. 95 /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
96 /// </param> 96 /// </param>
97 /// <returns>null if the folder is not found</returns> 97 /// <returns>null if the folder is not found</returns>
@@ -154,7 +154,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
154 return null; 154 return null;
155 155
156 return FindItemByPath(inventoryService, rootFolder, path); 156 return FindItemByPath(inventoryService, rootFolder, path);
157 } 157 }
158 158
159 /// <summary> 159 /// <summary>
160 /// Find an item given a PATH_DELIMITOR delimited path starting from this folder. 160 /// Find an item given a PATH_DELIMITOR delimited path starting from this folder.
@@ -194,7 +194,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
194 } 194 }
195 else 195 else
196 { 196 {
197 InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); 197 InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID);
198 198
199 foreach (InventoryFolderBase folder in contents.Folders) 199 foreach (InventoryFolderBase folder in contents.Folders)
200 { 200 {
@@ -205,6 +205,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
205 205
206 // We didn't find an item or intermediate folder with the given name 206 // We didn't find an item or intermediate folder with the given name
207 return null; 207 return null;
208 } 208 }
209 } 209 }
210} \ No newline at end of file 210} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index c6ebb24..499c552 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
55 55
56 private InventoryArchiverModule m_module; 56 private InventoryArchiverModule m_module;
57 private CachedUserInfo m_userInfo; 57 private CachedUserInfo m_userInfo;
58 private string m_invPath; 58 private string m_invPath;
59 protected TarArchiveWriter m_archiveWriter; 59 protected TarArchiveWriter m_archiveWriter;
60 protected UuidGatherer m_assetGatherer; 60 protected UuidGatherer m_assetGatherer;
61 61
@@ -168,7 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
168 { 168 {
169 path += CreateArchiveFolderName(inventoryFolder); 169 path += CreateArchiveFolderName(inventoryFolder);
170 170
171 // We need to make sure that we record empty folders 171 // We need to make sure that we record empty folders
172 m_archiveWriter.WriteDir(path); 172 m_archiveWriter.WriteDir(path);
173 } 173 }
174 174
@@ -262,7 +262,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
262 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) 262 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
263 { 263 {
264 foundStar = true; 264 foundStar = true;
265 maxComponentIndex--; 265 maxComponentIndex--;
266 } 266 }
267 267
268 m_invPath = String.Empty; 268 m_invPath = String.Empty;
@@ -369,8 +369,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
369 /// <returns></returns> 369 /// <returns></returns>
370 public static string CreateArchiveFolderName(InventoryFolderBase folder) 370 public static string CreateArchiveFolderName(InventoryFolderBase folder)
371 { 371 {
372 return CreateArchiveFolderName(folder.Name, folder.ID); 372 return CreateArchiveFolderName(folder.Name, folder.ID);
373 } 373 }
374 374
375 /// <summary> 375 /// <summary>
376 /// Create the archive name for a particular item. 376 /// Create the archive name for a particular item.
@@ -383,7 +383,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
383 /// <returns></returns> 383 /// <returns></returns>
384 public static string CreateArchiveItemName(InventoryItemBase item) 384 public static string CreateArchiveItemName(InventoryItemBase item)
385 { 385 {
386 return CreateArchiveItemName(item.Name, item.ID); 386 return CreateArchiveItemName(item.Name, item.ID);
387 } 387 }
388 388
389 /// <summary> 389 /// <summary>
@@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
398 "{0}{1}{2}/", 398 "{0}{1}{2}/",
399 name, 399 name,
400 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, 400 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
401 id); 401 id);
402 } 402 }
403 403
404 /// <summary> 404 /// <summary>
@@ -406,14 +406,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
406 /// </summary> 406 /// </summary>
407 /// <param name="name"></param> 407 /// <param name="name"></param>
408 /// <param name="id"></param> 408 /// <param name="id"></param>
409 /// <returns></returns> 409 /// <returns></returns>
410 public static string CreateArchiveItemName(string name, UUID id) 410 public static string CreateArchiveItemName(string name, UUID id)
411 { 411 {
412 return string.Format( 412 return string.Format(
413 "{0}{1}{2}.xml", 413 "{0}{1}{2}.xml",
414 name, 414 name,
415 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, 415 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
416 id); 416 id);
417 } 417 }
418 418
419 /// <summary> 419 /// <summary>
@@ -438,6 +438,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
438 sw.Close(); 438 sw.Close();
439 439
440 return s; 440 return s;
441 } 441 }
442 } 442 }
443} \ No newline at end of file 443} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 55dce05..1228eb1 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -40,12 +40,12 @@ using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41 41
42namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver 42namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
43{ 43{
44 /// <summary> 44 /// <summary>
45 /// This module loads and saves OpenSimulator inventory archives 45 /// This module loads and saves OpenSimulator inventory archives
46 /// </summary> 46 /// </summary>
47 public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule 47 public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule
48 { 48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 50
51 public string Name { get { return "Inventory Archiver Module"; } } 51 public string Name { get { return "Inventory Archiver Module"; } }
@@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
57 /// </value> 57 /// </value>
58 public bool DisablePresenceChecks { get; set; } 58 public bool DisablePresenceChecks { get; set; }
59 59
60 public event InventoryArchiveSaved OnInventoryArchiveSaved; 60 public event InventoryArchiveSaved OnInventoryArchiveSaved;
61 61
62 /// <summary> 62 /// <summary>
63 /// The file to load and save inventory if no filename has been specified 63 /// The file to load and save inventory if no filename has been specified
@@ -83,7 +83,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
83 } 83 }
84 84
85 public void Initialise(Scene scene, IConfigSource source) 85 public void Initialise(Scene scene, IConfigSource source)
86 { 86 {
87 if (m_scenes.Count == 0) 87 if (m_scenes.Count == 0)
88 { 88 {
89 scene.RegisterModuleInterface<IInventoryArchiverModule>(this); 89 scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
102 m_aScene = scene; 102 m_aScene = scene;
103 } 103 }
104 104
105 m_scenes[scene.RegionInfo.RegionID] = scene; 105 m_scenes[scene.RegionInfo.RegionID] = scene;
106 } 106 }
107 107
108 public void PostInitialise() {} 108 public void PostInitialise() {}
@@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
119 InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; 119 InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved;
120 if (handlerInventoryArchiveSaved != null) 120 if (handlerInventoryArchiveSaved != null)
121 handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); 121 handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
122 } 122 }
123 123
124 public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) 124 public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream)
125 { 125 {
@@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
174 public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream) 174 public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream)
175 { 175 {
176 if (m_scenes.Count > 0) 176 if (m_scenes.Count > 0)
177 { 177 {
178 CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); 178 CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass);
179 179
180 if (userInfo != null) 180 if (userInfo != null)
@@ -182,7 +182,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
182 if (CheckPresence(userInfo.UserProfile.ID)) 182 if (CheckPresence(userInfo.UserProfile.ID))
183 { 183 {
184 InventoryArchiveReadRequest request = 184 InventoryArchiveReadRequest request =
185 new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream); 185 new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream);
186 UpdateClientWithLoadedNodes(userInfo, request.Execute()); 186 UpdateClientWithLoadedNodes(userInfo, request.Execute());
187 187
188 return true; 188 return true;
@@ -197,12 +197,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
197 } 197 }
198 198
199 return false; 199 return false;
200 } 200 }
201 201
202 public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, string loadPath) 202 public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, string loadPath)
203 { 203 {
204 if (m_scenes.Count > 0) 204 if (m_scenes.Count > 0)
205 { 205 {
206 CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass); 206 CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass);
207 207
208 if (userInfo != null) 208 if (userInfo != null)
@@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
210 if (CheckPresence(userInfo.UserProfile.ID)) 210 if (CheckPresence(userInfo.UserProfile.ID))
211 { 211 {
212 InventoryArchiveReadRequest request = 212 InventoryArchiveReadRequest request =
213 new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath); 213 new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath);
214 UpdateClientWithLoadedNodes(userInfo, request.Execute()); 214 UpdateClientWithLoadedNodes(userInfo, request.Execute());
215 215
216 return true; 216 return true;
@@ -221,11 +221,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
221 "[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator", 221 "[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator",
222 userInfo.UserProfile.Name, userInfo.UserProfile.ID); 222 userInfo.UserProfile.Name, userInfo.UserProfile.ID);
223 } 223 }
224 } 224 }
225 } 225 }
226 226
227 return false; 227 return false;
228 } 228 }
229 229
230 /// <summary> 230 /// <summary>
231 /// Load inventory from an inventory file archive 231 /// Load inventory from an inventory file archive
@@ -252,7 +252,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
252 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", 252 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
253 loadPath, invPath, firstName, lastName); 253 loadPath, invPath, firstName, lastName);
254 254
255 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath)) 255 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath))
256 m_log.InfoFormat( 256 m_log.InfoFormat(
257 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", 257 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
258 loadPath, firstName, lastName); 258 loadPath, firstName, lastName);
@@ -288,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
288 288
289 lock (m_pendingConsoleSaves) 289 lock (m_pendingConsoleSaves)
290 m_pendingConsoleSaves.Add(id); 290 m_pendingConsoleSaves.Add(id);
291 } 291 }
292 292
293 private void SaveInvConsoleCommandCompleted( 293 private void SaveInvConsoleCommandCompleted(
294 Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, 294 Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream,
@@ -322,7 +322,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
322 /// <param name="pass">User password</param> 322 /// <param name="pass">User password</param>
323 /// <returns></returns> 323 /// <returns></returns>
324 protected CachedUserInfo GetUserInfo(string firstName, string lastName, string pass) 324 protected CachedUserInfo GetUserInfo(string firstName, string lastName, string pass)
325 { 325 {
326 CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); 326 CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
327 //m_aScene.CommsManager.UserService.GetUserProfile(firstName, lastName); 327 //m_aScene.CommsManager.UserService.GetUserProfile(firstName, lastName);
328 if (null == userInfo) 328 if (null == userInfo)
@@ -334,7 +334,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
334 } 334 }
335 335
336 try 336 try
337 { 337 {
338 if (m_aScene.CommsManager.UserService.AuthenticateUserByPassword(userInfo.UserProfile.ID, pass)) 338 if (m_aScene.CommsManager.UserService.AuthenticateUserByPassword(userInfo.UserProfile.ID, pass))
339 { 339 {
340 return userInfo; 340 return userInfo;
@@ -343,7 +343,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
343 { 343 {
344 m_log.ErrorFormat( 344 m_log.ErrorFormat(
345 "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", 345 "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.",
346 firstName, lastName); 346 firstName, lastName);
347 return null; 347 return null;
348 } 348 }
349 } 349 }
@@ -359,7 +359,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
359 /// </summary> 359 /// </summary>
360 /// <param name="loadedNodes">Can be empty. In which case, nothing happens</param> 360 /// <param name="loadedNodes">Can be empty. In which case, nothing happens</param>
361 private void UpdateClientWithLoadedNodes(CachedUserInfo userInfo, List<InventoryNodeBase> loadedNodes) 361 private void UpdateClientWithLoadedNodes(CachedUserInfo userInfo, List<InventoryNodeBase> loadedNodes)
362 { 362 {
363 if (loadedNodes.Count == 0) 363 if (loadedNodes.Count == 0)
364 return; 364 return;
365 365
@@ -368,7 +368,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
368 ScenePresence user = scene.GetScenePresence(userInfo.UserProfile.ID); 368 ScenePresence user = scene.GetScenePresence(userInfo.UserProfile.ID);
369 369
370 if (user != null && !user.IsChildAgent) 370 if (user != null && !user.IsChildAgent)
371 { 371 {
372 foreach (InventoryNodeBase node in loadedNodes) 372 foreach (InventoryNodeBase node in loadedNodes)
373 { 373 {
374// m_log.DebugFormat( 374// m_log.DebugFormat(
@@ -379,8 +379,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
379 } 379 }
380 380
381 break; 381 break;
382 } 382 }
383 } 383 }
384 } 384 }
385 385
386 /// <summary> 386 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index ed293cd..b0fdcd6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -37,7 +37,7 @@ using OpenMetaverse;
37using OpenSim.Data; 37using OpenSim.Data;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Serialization; 39using OpenSim.Framework.Serialization;
40using OpenSim.Framework.Serialization.External; 40using OpenSim.Framework.Serialization.External;
41using OpenSim.Framework.Communications; 41using OpenSim.Framework.Communications;
42using OpenSim.Framework.Communications.Cache; 42using OpenSim.Framework.Communications.Cache;
43using OpenSim.Framework.Communications.Osp; 43using OpenSim.Framework.Communications.Osp;
@@ -70,7 +70,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
70 Exception reportedException) 70 Exception reportedException)
71 { 71 {
72 mre.Set(); 72 mre.Set();
73 } 73 }
74 74
75 /// <summary> 75 /// <summary>
76 /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). 76 /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet).
@@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
157 string expectedObject1FilePath = string.Format( 157 string expectedObject1FilePath = string.Format(
158 "{0}{1}{2}", 158 "{0}{1}{2}",
159 ArchiveConstants.INVENTORY_PATH, 159 ArchiveConstants.INVENTORY_PATH,
160 InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder), 160 InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
161 expectedObject1FileName); 161 expectedObject1FileName);
162 162
163 string filePath; 163 string filePath;
@@ -195,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
195 Assert.That(gotObject1File, Is.True, "No item1 file in archive"); 195 Assert.That(gotObject1File, Is.True, "No item1 file in archive");
196// Assert.That(gotObject2File, Is.True, "No object2 file in archive"); 196// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
197 197
198 // TODO: Test presence of more files and contents of files. 198 // TODO: Test presence of more files and contents of files.
199 } 199 }
200 200
201 /// <summary> 201 /// <summary>
@@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
206 /// This test also does some deeper probing of loading into nested inventory structures 206 /// This test also does some deeper probing of loading into nested inventory structures
207 [Test] 207 [Test]
208 public void TestLoadIarV0_1ExistingUsers() 208 public void TestLoadIarV0_1ExistingUsers()
209 { 209 {
210 TestHelper.InMethod(); 210 TestHelper.InMethod();
211 211
212 //log4net.Config.XmlConfigurator.Configure(); 212 //log4net.Config.XmlConfigurator.Configure();
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
238 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); 238 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
239 tar.Close(); 239 tar.Close();
240 240
241 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); 241 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
242 SerialiserModule serialiserModule = new SerialiserModule(); 242 SerialiserModule serialiserModule = new SerialiserModule();
243 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 243 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
244 244
@@ -271,9 +271,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
271 Assert.That(foundItem1.Owner, Is.EqualTo(userUuid), 271 Assert.That(foundItem1.Owner, Is.EqualTo(userUuid),
272 "Loaded item owner doesn't match inventory reciever"); 272 "Loaded item owner doesn't match inventory reciever");
273 273
274 // Now try loading to a root child folder 274 // Now try loading to a root child folder
275 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xA"); 275 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xA");
276 archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); 276 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
277 archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream); 277 archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream);
278 278
279 InventoryItemBase foundItem2 279 InventoryItemBase foundItem2
@@ -282,12 +282,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
282 282
283 // Now try loading to a more deeply nested folder 283 // Now try loading to a more deeply nested folder
284 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC"); 284 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC");
285 archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); 285 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
286 archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream); 286 archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream);
287 287
288 InventoryItemBase foundItem3 288 InventoryItemBase foundItem3
289 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC/" + itemName); 289 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC/" + itemName);
290 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); 290 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
291 } 291 }
292 292
293 /// <summary> 293 /// <summary>
@@ -299,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
299 /// (as tested in the a later commented out test) 299 /// (as tested in the a later commented out test)
300 [Test] 300 [Test]
301 public void TestLoadIarV0_1AbsentUsers() 301 public void TestLoadIarV0_1AbsentUsers()
302 { 302 {
303 TestHelper.InMethod(); 303 TestHelper.InMethod();
304 304
305 log4net.Config.XmlConfigurator.Configure(); 305 log4net.Config.XmlConfigurator.Configure();
@@ -331,7 +331,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
331 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); 331 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
332 tar.Close(); 332 tar.Close();
333 333
334 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); 334 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
335 SerialiserModule serialiserModule = new SerialiserModule(); 335 SerialiserModule serialiserModule = new SerialiserModule();
336 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 336 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
337 337
@@ -357,8 +357,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
357// "Loaded item non-uuid creator doesn't match that of the loading user"); 357// "Loaded item non-uuid creator doesn't match that of the loading user");
358 Assert.That( 358 Assert.That(
359 foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid), 359 foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid),
360 "Loaded item uuid creator doesn't match that of the loading user"); 360 "Loaded item uuid creator doesn't match that of the loading user");
361 } 361 }
362 362
363 /// <summary> 363 /// <summary>
364 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 364 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
@@ -367,7 +367,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
367 /// Disabled since temporary profiles have not yet been implemented. 367 /// Disabled since temporary profiles have not yet been implemented.
368 //[Test] 368 //[Test]
369 public void TestLoadIarV0_1TempProfiles() 369 public void TestLoadIarV0_1TempProfiles()
370 { 370 {
371 TestHelper.InMethod(); 371 TestHelper.InMethod();
372 372
373 log4net.Config.XmlConfigurator.Configure(); 373 log4net.Config.XmlConfigurator.Configure();
@@ -396,7 +396,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
396 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); 396 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
397 tar.Close(); 397 tar.Close();
398 398
399 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); 399 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
400 SerialiserModule serialiserModule = new SerialiserModule(); 400 SerialiserModule serialiserModule = new SerialiserModule();
401 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 401 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
402 402
@@ -436,7 +436,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
436 Assert.That(foundItem.Owner, Is.EqualTo(userUuid)); 436 Assert.That(foundItem.Owner, Is.EqualTo(userUuid));
437 437
438 Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod()); 438 Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod());
439 } 439 }
440 440
441 /// <summary> 441 /// <summary>
442 /// Test replication of an archive path to the user's inventory. 442 /// Test replication of an archive path to the user's inventory.
@@ -474,7 +474,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
474 string itemArchivePath 474 string itemArchivePath
475 = string.Format( 475 = string.Format(
476 "{0}{1}{2}{3}", 476 "{0}{1}{2}{3}",
477 ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName); 477 ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
478 478
479 //Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); 479 //Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder);
480 480
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 75976e2..d9a021f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -169,12 +169,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
169 byte[] copyIDBytes = copyID.GetBytes(); 169 byte[] copyIDBytes = copyID.GetBytes();
170 im.binaryBucket = new byte[1 + copyIDBytes.Length]; 170 im.binaryBucket = new byte[1 + copyIDBytes.Length];
171 im.binaryBucket[0] = (byte)AssetType.Folder; 171 im.binaryBucket[0] = (byte)AssetType.Folder;
172 Array.Copy(copyIDBytes, 0, im.binaryBucket, 1, copyIDBytes.Length); 172 Array.Copy(copyIDBytes, 0, im.binaryBucket, 1, copyIDBytes.Length);
173 173
174 if (user != null && !user.IsChildAgent) 174 if (user != null && !user.IsChildAgent)
175 { 175 {
176 user.ControllingClient.SendBulkUpdateInventory(folderCopy); 176 user.ControllingClient.SendBulkUpdateInventory(folderCopy);
177 } 177 }
178 } 178 }
179 else 179 else
180 { 180 {
@@ -199,10 +199,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
199 } 199 }
200 200
201 copyID = itemCopy.ID; 201 copyID = itemCopy.ID;
202 Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16); 202 Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16);
203 203
204 if (user != null && !user.IsChildAgent) 204 if (user != null && !user.IsChildAgent)
205 { 205 {
206 user.ControllingClient.SendBulkUpdateInventory(itemCopy); 206 user.ControllingClient.SendBulkUpdateInventory(itemCopy);
207 } 207 }
208 } 208 }
@@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
241 } 241 }
242 } 242 }
243 else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) 243 else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined)
244 { 244 {
245 // Here, the recipient is local and we can assume that the 245 // Here, the recipient is local and we can assume that the
246 // inventory is loaded. Courtesy of the above bulk update, 246 // inventory is loaded. Courtesy of the above bulk update,
247 // It will have been pushed to the client, too 247 // It will have been pushed to the client, too
@@ -284,7 +284,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
284 } 284 }
285 285
286 if ((null == item && null == folder) | null == trashFolder) 286 if ((null == item && null == folder) | null == trashFolder)
287 { 287 {
288 string reason = String.Empty; 288 string reason = String.Empty;
289 289
290 if (trashFolder == null) 290 if (trashFolder == null)
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 0cdd9a8..1b23d92 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -454,7 +454,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
454 responsedata["error_status_text"] = "Upstream error:"; 454 responsedata["error_status_text"] = "Upstream error:";
455 responsedata["http_protocol_version"] = "HTTP/1.0"; 455 responsedata["http_protocol_version"] = "HTTP/1.0";
456 return responsedata; 456 return responsedata;
457 } 457 }
458 458
459 OSDArray array = new OSDArray(); 459 OSDArray array = new OSDArray();
460 if (element == null) // didn't have an event in 15s 460 if (element == null) // didn't have an event in 15s
diff --git a/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs b/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs
deleted file mode 100644
index 8c92727..0000000
--- a/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs
+++ /dev/null
@@ -1,208 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using log4net;
34using Nini.Config;
35using OpenMetaverse;
36using OpenSim.Data;
37using OpenSim.Framework;
38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes;
43
44using Nwc.XmlRpc;
45
46
47namespace OpenSim.Region.CoreModules.Framework.Services
48{
49 public class RegionMapService : IRegionModule
50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 private static bool initialized = false;
53 private static bool enabled = false;
54
55 Scene m_scene;
56 //AssetService m_assetService;
57
58 #region IRegionModule interface
59
60 public void Initialise(Scene scene, IConfigSource config)
61 {
62 if (!initialized)
63 {
64 initialized = true;
65 m_scene = scene;
66
67 // This module is only on for hypergrid mode
68 enabled = config.Configs["Startup"].GetBoolean("hypergrid", false);
69 }
70 }
71
72 public void PostInitialise()
73 {
74 if (enabled)
75 {
76 m_log.Info("[RegionMapService]: Starting...");
77
78 //m_assetService = new AssetService(m_scene);
79 new GridService(m_scene);
80 }
81 }
82
83 public void Close()
84 {
85 }
86
87 public string Name
88 {
89 get { return "RegionMapService"; }
90 }
91
92 public bool IsSharedModule
93 {
94 get { return true; }
95 }
96
97 #endregion
98
99 }
100
101 public class GridService
102 {
103// private IUserService m_userService;
104 private IGridServices m_gridService;
105 private bool m_doLookup = false;
106
107 public bool DoLookup
108 {
109 get { return m_doLookup; }
110 set { m_doLookup = value; }
111 }
112 private static readonly ILog m_log
113 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
114
115 public GridService(Scene m_scene)
116 {
117 AddHandlers(m_scene);
118// m_userService = m_scene.CommsManager.UserService;
119 m_gridService = m_scene.CommsManager.GridService;
120 }
121
122 protected void AddHandlers(Scene m_scene)
123 {
124// IAssetDataPlugin m_assetProvider
125// = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin;
126
127 IHttpServer httpServer = MainServer.Instance;
128 httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod);
129 //m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod);
130 //m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod);
131
132 }
133
134 /// <summary>
135 /// Returns an XML RPC response to a simulator profile request
136 /// </summary>
137 /// <param name="request"></param>
138 /// <returns></returns>
139 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request, IPEndPoint remoteClient)
140 {
141 Hashtable requestData = (Hashtable)request.Params[0];
142 Hashtable responseData = new Hashtable();
143 RegionInfo simData = null;
144 if (requestData.ContainsKey("region_UUID"))
145 {
146 UUID regionID = new UUID((string)requestData["region_UUID"]);
147 simData = m_gridService.RequestNeighbourInfo(regionID); //.GetRegion(regionID);
148 if (simData == null)
149 {
150 m_log.WarnFormat("[HGGridService] didn't find region for regionID {0} from {1}",
151 regionID, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
152 }
153 }
154 else if (requestData.ContainsKey("region_handle"))
155 {
156 //CFK: The if/else below this makes this message redundant.
157 //CFK: m_log.Info("requesting data for region " + (string) requestData["region_handle"]);
158 ulong regionHandle = Convert.ToUInt64((string)requestData["region_handle"]);
159 simData = m_gridService.RequestNeighbourInfo(regionHandle); //m_gridDBService.GetRegion(regionHandle);
160 if (simData == null)
161 {
162 m_log.WarnFormat("[HGGridService] didn't find region for regionHandle {0} from {1}",
163 regionHandle, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
164 }
165 }
166 else if (requestData.ContainsKey("region_name_search"))
167 {
168 string regionName = (string)requestData["region_name_search"];
169 List<RegionInfo> regInfos = m_gridService.RequestNamedRegions(regionName, 1);//m_gridDBService.GetRegion(regionName);
170 if (regInfos != null)
171 simData = regInfos[0];
172
173 if (simData == null)
174 {
175 m_log.WarnFormat("[HGGridService] didn't find region for regionName {0} from {1}",
176 regionName, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
177 }
178 }
179 else m_log.Warn("[HGGridService] regionlookup without regionID, regionHandle or regionHame");
180
181 if (simData == null)
182 {
183 //Sim does not exist
184 responseData["error"] = "Sim does not exist";
185 }
186 else
187 {
188 m_log.Debug("[HGGridService]: found " + (string)simData.RegionName + " regionHandle = " +
189 (string)requestData["region_handle"]);
190 responseData["sim_ip"] = simData.ExternalEndPoint.Address.ToString();
191 responseData["sim_port"] = simData.ExternalEndPoint.Port.ToString();
192 //responseData["server_uri"] = simData.serverURI;
193 responseData["http_port"] = simData.HttpPort.ToString();
194 //responseData["remoting_port"] = simData.remotingPort.ToString();
195 responseData["region_locx"] = simData.RegionLocX.ToString();
196 responseData["region_locy"] = simData.RegionLocY.ToString();
197 responseData["region_UUID"] = simData.RegionID.ToString();
198 responseData["region_name"] = simData.RegionName;
199 responseData["region_secret"] = simData.regionSecret;
200 }
201
202 XmlRpcResponse response = new XmlRpcResponse();
203 response.Value = responseData;
204 return response;
205 }
206
207 }
208}
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
index 6774060..a0ccdc7 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
@@ -34,6 +34,7 @@ using OpenSim.Framework;
34using OpenSim.Region.CoreModules.World.WorldMap; 34using OpenSim.Region.CoreModules.World.WorldMap;
35using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using GridRegion = OpenSim.Services.Interfaces.GridRegion;
37 38
38namespace OpenSim.Region.CoreModules.Hypergrid 39namespace OpenSim.Region.CoreModules.Hypergrid
39{ 40{
@@ -59,7 +60,17 @@ namespace OpenSim.Region.CoreModules.Hypergrid
59 60
60 protected override void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 61 protected override void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
61 { 62 {
62 List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); 63 List<MapBlockData> mapBlocks = new List<MapBlockData>();
64 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
65 (minX - 4) * (int)Constants.RegionSize, (maxX + 4) * (int)Constants.RegionSize,
66 (minY - 4) * (int)Constants.RegionSize, (maxY + 4) * (int)Constants.RegionSize);
67
68 foreach (GridRegion r in regions)
69 {
70 MapBlockData block = new MapBlockData();
71 MapBlockFromGridRegion(block, r);
72 mapBlocks.Add(block);
73 }
63 74
64 // Different from super 75 // Different from super
65 FillInMap(mapBlocks, minX, minY, maxX, maxY); 76 FillInMap(mapBlocks, minX, minY, maxX, maxY);
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index e9c1e9d..7d6f150 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -353,11 +353,11 @@ namespace OpenSim.Region.CoreModules.InterGrid
353 return responseMap; 353 return responseMap;
354 } 354 }
355 355
356 // Using OpenSim.Framework.Capabilities.Caps here one time.. 356 // Using OpenSim.Framework.Capabilities.Caps here one time..
357 // so the long name is probably better then a using statement 357 // so the long name is probably better then a using statement
358 public void OnRegisterCaps(UUID agentID, Caps caps) 358 public void OnRegisterCaps(UUID agentID, Caps caps)
359 { 359 {
360 /* If we ever want to register our own caps here.... 360 /* If we ever want to register our own caps here....
361 * 361 *
362 string capsBase = "/CAPS/" + caps.CapsObjectPath; 362 string capsBase = "/CAPS/" + caps.CapsObjectPath;
363 caps.RegisterHandler("CAPNAME", 363 caps.RegisterHandler("CAPNAME",
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index bea6222..d57a8e5 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -184,7 +184,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
184 string value = ""; 184 string value = "";
185 185
186 if (nvp[0] != null) 186 if (nvp[0] != null)
187 { 187 {
188 name = nvp[0].Trim(); 188 name = nvp[0].Trim();
189 } 189 }
190 190
@@ -291,10 +291,10 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
291 temp = 128; 291 temp = 128;
292 292
293 width = temp; 293 width = temp;
294 height = temp; 294 height = temp;
295 } 295 }
296 } 296 }
297 break; 297 break;
298 } 298 }
299 } 299 }
300 300
@@ -410,7 +410,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
410 Font myFont = new Font(fontName, fontSize); 410 Font myFont = new Font(fontName, fontSize);
411 SolidBrush myBrush = new SolidBrush(Color.Black); 411 SolidBrush myBrush = new SolidBrush(Color.Black);
412 412
413 char[] lineDelimiter = {dataDelim}; 413 char[] lineDelimiter = {dataDelim};
414 char[] partsDelimiter = {','}; 414 char[] partsDelimiter = {','};
415 string[] lines = data.Split(lineDelimiter); 415 string[] lines = data.Split(lineDelimiter);
416 416
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
index 4fbee7f..92db15b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
@@ -37,6 +37,8 @@ using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 37using OpenSim.Server.Base;
38using OpenSim.Server.Handlers.Base; 38using OpenSim.Server.Handlers.Base;
39using OpenSim.Server.Handlers.Grid; 39using OpenSim.Server.Handlers.Grid;
40using OpenSim.Services.Interfaces;
41using GridRegion = OpenSim.Services.Interfaces.GridRegion;
40 42
41namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid 43namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
42{ 44{
@@ -94,20 +96,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
94 if (!m_Enabled) 96 if (!m_Enabled)
95 return; 97 return;
96 98
97 if (!m_Registered)
98 {
99 m_Registered = true;
100
101 m_log.Info("[HypergridService]: Starting...");
102
103 Object[] args = new Object[] { m_Config, MainServer.Instance };
104
105 m_HypergridHandler = new HypergridServiceInConnector(m_Config, MainServer.Instance);
106 //ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
107 }
108
109 SimpleRegionInfo rinfo = new SimpleRegionInfo(scene.RegionInfo);
110 m_HypergridHandler.AddRegion(rinfo);
111 } 99 }
112 100
113 public void RemoveRegion(Scene scene) 101 public void RemoveRegion(Scene scene)
@@ -115,12 +103,29 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
115 if (!m_Enabled) 103 if (!m_Enabled)
116 return; 104 return;
117 105
118 SimpleRegionInfo rinfo = new SimpleRegionInfo(scene.RegionInfo); 106 GridRegion rinfo = new GridRegion(scene.RegionInfo);
119 m_HypergridHandler.RemoveRegion(rinfo); 107 m_HypergridHandler.RemoveRegion(rinfo);
120 } 108 }
121 109
122 public void RegionLoaded(Scene scene) 110 public void RegionLoaded(Scene scene)
123 { 111 {
112 if (!m_Enabled)
113 return;
114
115 if (!m_Registered)
116 {
117 m_Registered = true;
118
119 m_log.Info("[HypergridService]: Starting...");
120
121 Object[] args = new Object[] { m_Config, MainServer.Instance };
122
123 m_HypergridHandler = new HypergridServiceInConnector(m_Config, MainServer.Instance, scene.RequestModuleInterface<IHyperlinkService>());
124 //ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
125 }
126
127 GridRegion rinfo = new GridRegion(scene.RegionInfo);
128 m_HypergridHandler.AddRegion(rinfo);
124 } 129 }
125 130
126 #endregion 131 #endregion
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
index a31ce8e..8a90370 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
@@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour
121 121
122 #region INeighbourService 122 #region INeighbourService
123 123
124 public bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) 124 public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
125 { 125 {
126 m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", 126 m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}",
127 thisRegion.RegionName, regionHandle, m_Scenes.Count); 127 thisRegion.RegionName, regionHandle, m_Scenes.Count);
@@ -134,7 +134,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour
134 } 134 }
135 } 135 }
136 m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: region handle {0} not found", regionHandle); 136 m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: region handle {0} not found", regionHandle);
137 return false; 137 return null;
138 } 138 }
139 139
140 #endregion INeighbourService 140 #endregion INeighbourService
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs
index e69613a..85a1ac3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs
@@ -134,7 +134,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
134 134
135 public bool IsAuthorizedForRegion(string userID, string regionID, out string message) 135 public bool IsAuthorizedForRegion(string userID, string regionID, out string message)
136 { 136 {
137 return m_AuthorizationService.IsAuthorizedForRegion(userID, regionID, out message); 137 return m_AuthorizationService.IsAuthorizedForRegion(userID, regionID, out message);
138 } 138 }
139 139
140 } 140 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
index a672f4f..fca2df2 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
146 else 146 else
147 { 147 {
148 m_log.ErrorFormat("[REMOTE AUTHORIZATION CONNECTOR] IsAuthorizedForRegion, can't find scene to match region id of {0} ",regionID); 148 m_log.ErrorFormat("[REMOTE AUTHORIZATION CONNECTOR] IsAuthorizedForRegion, can't find scene to match region id of {0} ",regionID);
149 } 149 }
150 150
151 151
152 return isAuthorized; 152 return isAuthorized;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs
index 36915ef..0974372 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
86 86
87 private void RunHGCommand(string command, string[] cmdparams) 87 private void RunHGCommand(string command, string[] cmdparams)
88 { 88 {
89 if (command.Equals("linkk-mapping")) 89 if (command.Equals("link-mapping"))
90 { 90 {
91 if (cmdparams.Length == 2) 91 if (cmdparams.Length == 2)
92 { 92 {
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
104 } 104 }
105 } 105 }
106 } 106 }
107 else if (command.Equals("linkk-region")) 107 else if (command.Equals("link-region"))
108 { 108 {
109 if (cmdparams.Length < 3) 109 if (cmdparams.Length < 3)
110 { 110 {
@@ -187,7 +187,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
187 } 187 }
188 return; 188 return;
189 } 189 }
190 else if (command.Equals("unlinkk-region")) 190 else if (command.Equals("unlink-region"))
191 { 191 {
192 if (cmdparams.Length < 1) 192 if (cmdparams.Length < 1)
193 { 193 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
index 0c2a835..148331b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
@@ -31,6 +31,7 @@ using System.Net;
31using System.Reflection; 31using System.Reflection;
32using System.Xml; 32using System.Xml;
33 33
34using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
@@ -47,15 +48,19 @@ using Nini.Config;
47 48
48namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid 49namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
49{ 50{
50 public class HGGridConnector : ISharedRegionModule, IGridService 51 public class HGGridConnector : ISharedRegionModule, IGridService, IHyperlinkService
51 { 52 {
52 private static readonly ILog m_log = 53 private static readonly ILog m_log =
53 LogManager.GetLogger( 54 LogManager.GetLogger(
54 MethodBase.GetCurrentMethod().DeclaringType); 55 MethodBase.GetCurrentMethod().DeclaringType);
56 private static string LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI;
55 57
56 private bool m_Enabled = false; 58 private bool m_Enabled = false;
57 private bool m_Initialized = false; 59 private bool m_Initialized = false;
58 60
61 private Scene m_aScene;
62 private Dictionary<ulong, Scene> m_LocalScenes = new Dictionary<ulong, Scene>();
63
59 private IGridService m_GridServiceConnector; 64 private IGridService m_GridServiceConnector;
60 private HypergridServiceConnector m_HypergridServiceConnector; 65 private HypergridServiceConnector m_HypergridServiceConnector;
61 66
@@ -130,6 +135,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
130 135
131 public void PostInitialise() 136 public void PostInitialise()
132 { 137 {
138 if (m_Enabled)
139 ((ISharedRegionModule)m_GridServiceConnector).PostInitialise();
133 } 140 }
134 141
135 public void Close() 142 public void Close()
@@ -141,12 +148,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
141 if (!m_Enabled) 148 if (!m_Enabled)
142 return; 149 return;
143 150
151 m_LocalScenes[scene.RegionInfo.RegionHandle] = scene;
144 scene.RegisterModuleInterface<IGridService>(this); 152 scene.RegisterModuleInterface<IGridService>(this);
153 scene.RegisterModuleInterface<IHyperlinkService>(this);
154
155 ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene);
145 156
146 } 157 }
147 158
148 public void RemoveRegion(Scene scene) 159 public void RemoveRegion(Scene scene)
149 { 160 {
161 if (m_Enabled)
162 {
163 m_LocalScenes.Remove(scene.RegionInfo.RegionHandle);
164 ((ISharedRegionModule)m_GridServiceConnector).RemoveRegion(scene);
165 }
150 } 166 }
151 167
152 public void RegionLoaded(Scene scene) 168 public void RegionLoaded(Scene scene)
@@ -156,29 +172,28 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
156 172
157 if (!m_Initialized) 173 if (!m_Initialized)
158 { 174 {
175 m_aScene = scene;
176 LocalAssetServerURI = m_aScene.CommsManager.NetworkServersInfo.UserURL;
177 LocalInventoryServerURI = m_aScene.CommsManager.NetworkServersInfo.InventoryURL;
178 LocalUserServerURI = m_aScene.CommsManager.NetworkServersInfo.UserURL;
179
159 m_HypergridServiceConnector = new HypergridServiceConnector(scene.AssetService); 180 m_HypergridServiceConnector = new HypergridServiceConnector(scene.AssetService);
181
160 HGCommands hgCommands = new HGCommands(this, scene); 182 HGCommands hgCommands = new HGCommands(this, scene);
161 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "linkk-region", 183 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-region",
162 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", 184 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
163 "Link a hypergrid region", hgCommands.RunCommand); 185 "Link a hypergrid region", hgCommands.RunCommand);
164 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "unlinkk-region", 186 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "unlink-region",
165 "unlink-region <local name> or <HostName>:<HttpPort> <cr>", 187 "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
166 "Unlink a hypergrid region", hgCommands.RunCommand); 188 "Unlink a hypergrid region", hgCommands.RunCommand);
167 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "linkk-mapping", "link-mapping [<x> <y>] <cr>", 189 MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
168 "Set local coordinate to map HG regions to", hgCommands.RunCommand); 190 "Set local coordinate to map HG regions to", hgCommands.RunCommand);
169 m_Initialized = true;
170 }
171 191
192 // Yikes!! Remove this as soon as user services get refactored
193 HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI);
172 194
173 //scene.AddCommand("HGGridServicesConnector", "linkk-region", 195 m_Initialized = true;
174 // "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", 196 }
175 // "Link a hypergrid region", hgCommands.RunCommand);
176 //scene.AddCommand("HGGridServicesConnector", "unlinkk-region",
177 // "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
178 // "Unlink a hypergrid region", hgCommands.RunCommand);
179 //scene.AddCommand("HGGridServicesConnector", "linkk-mapping", "link-mapping [<x> <y>] <cr>",
180 // "Set local coordinate to map HG regions to", hgCommands.RunCommand);
181
182 } 197 }
183 198
184 #endregion 199 #endregion
@@ -250,7 +265,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
250 // Try the foreign users home collection 265 // Try the foreign users home collection
251 foreach (GridRegion r in m_knownRegions.Values) 266 foreach (GridRegion r in m_knownRegions.Values)
252 if (r.RegionID == regionID) 267 if (r.RegionID == regionID)
253 return m_knownRegions[regionID]; 268 return r;
254 269
255 // Finally, try the normal route 270 // Finally, try the normal route
256 return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID); 271 return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
@@ -271,7 +286,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
271 foreach (GridRegion r in m_knownRegions.Values) 286 foreach (GridRegion r in m_knownRegions.Values)
272 { 287 {
273 if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY)) 288 if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY))
289 {
274 return r; 290 return r;
291 }
275 } 292 }
276 293
277 // Finally, try the normal route 294 // Finally, try the normal route
@@ -338,8 +355,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
338 355
339 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) 356 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
340 { 357 {
341 m_HyperlinkRegions.Add(regionInfo.RegionID, regionInfo); 358 m_HyperlinkRegions[regionInfo.RegionID] = regionInfo;
342 m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle); 359 m_HyperlinkHandles[regionInfo.RegionID] = regionHandle;
343 } 360 }
344 361
345 private void RemoveHyperlinkRegion(UUID regionID) 362 private void RemoveHyperlinkRegion(UUID regionID)
@@ -350,8 +367,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
350 367
351 private void AddHyperlinkHomeRegion(UUID userID, GridRegion regionInfo, ulong regionHandle) 368 private void AddHyperlinkHomeRegion(UUID userID, GridRegion regionInfo, ulong regionHandle)
352 { 369 {
353 m_knownRegions.Add(userID, regionInfo); 370 m_knownRegions[userID] = regionInfo;
354 m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle); 371 m_HyperlinkHandles[regionInfo.RegionID] = regionHandle;
355 } 372 }
356 373
357 private void RemoveHyperlinkHomeRegion(UUID regionID) 374 private void RemoveHyperlinkHomeRegion(UUID regionID)
@@ -367,10 +384,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
367 } 384 }
368 #endregion 385 #endregion
369 386
370 #region Hyperlinks 387 #region IHyperlinkService
371 388
372 private static Random random = new Random(); 389 private static Random random = new Random();
373 390
391
374 public GridRegion TryLinkRegionToCoords(Scene m_scene, IClientAPI client, string mapName, int xloc, int yloc) 392 public GridRegion TryLinkRegionToCoords(Scene m_scene, IClientAPI client, string mapName, int xloc, int yloc)
375 { 393 {
376 string host = "127.0.0.1"; 394 string host = "127.0.0.1";
@@ -417,10 +435,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
417 return null; 435 return null;
418 } 436 }
419 437
438
420 // From the map search and secondlife://blah 439 // From the map search and secondlife://blah
421 public GridRegion TryLinkRegion(Scene m_scene, IClientAPI client, string mapName) 440 public GridRegion TryLinkRegion(Scene m_scene, IClientAPI client, string mapName)
422 { 441 {
423 int xloc = random.Next(0, Int16.MaxValue); 442 int xloc = random.Next(0, Int16.MaxValue) * (int) Constants.RegionSize;
424 return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0); 443 return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0);
425 } 444 }
426 445
@@ -447,15 +466,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
447 } 466 }
448 467
449 // Finally, link it 468 // Finally, link it
450 try 469 if (!RegisterRegion(UUID.Zero, regInfo))
451 { 470 {
452 RegisterRegion(UUID.Zero, regInfo); 471 m_log.Warn("[HGrid]: Unable to link region");
453 } 472 return false;
454 catch (Exception e) 473 }
455 {
456 m_log.Warn("[HGrid]: Unable to link region: " + e.Message);
457 return false;
458 }
459 474
460 int x, y; 475 int x, y;
461 if (!Check4096(m_scene, regInfo, out x, out y)) 476 if (!Check4096(m_scene, regInfo, out x, out y))
@@ -539,8 +554,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
539 x = (int)(ux / Constants.RegionSize); 554 x = (int)(ux / Constants.RegionSize);
540 y = (int)(uy / Constants.RegionSize); 555 y = (int)(uy / Constants.RegionSize);
541 556
542 if ((Math.Abs((int)(m_scene.RegionInfo.RegionLocX / Constants.RegionSize) - x) >= 4096) || 557 if ((Math.Abs((int)m_scene.RegionInfo.RegionLocX - x) >= 4096) ||
543 (Math.Abs((int)(m_scene.RegionInfo.RegionLocY / Constants.RegionSize) - y) >= 4096)) 558 (Math.Abs((int)m_scene.RegionInfo.RegionLocY - y) >= 4096))
544 { 559 {
545 return false; 560 return false;
546 } 561 }
@@ -554,7 +569,227 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
554 return true; 569 return true;
555 } 570 }
556 571
572 public GridRegion TryLinkRegion(IClientAPI client, string regionDescriptor)
573 {
574 return TryLinkRegion((Scene)client.Scene, client, regionDescriptor);
575 }
576
577 public GridRegion GetHyperlinkRegion(ulong handle)
578 {
579 foreach (GridRegion r in m_HyperlinkRegions.Values)
580 if (r.RegionHandle == handle)
581 return r;
582 foreach (GridRegion r in m_knownRegions.Values)
583 if (r.RegionHandle == handle)
584 return r;
585 return null;
586 }
587
588 public ulong FindRegionHandle(ulong handle)
589 {
590 foreach (GridRegion r in m_HyperlinkRegions.Values)
591 if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID)))
592 return m_HyperlinkHandles[r.RegionID];
593
594 foreach (GridRegion r in m_knownRegions.Values)
595 if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID)))
596 return m_HyperlinkHandles[r.RegionID];
597
598 return handle;
599 }
600
601 public bool SendUserInformation(GridRegion regInfo, AgentCircuitData agentData)
602 {
603 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID);
604
605 if ((IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null)) ||
606 (!IsLocalUser(uinfo) && !IsGoingHome(uinfo, regInfo)))
607 {
608 m_log.Info("[HGrid]: Local user is going to foreign region or foreign user is going elsewhere");
609
610 // Set the position of the region on the remote grid
611 ulong realHandle = FindRegionHandle(regInfo.RegionHandle);
612 uint x = 0, y = 0;
613 Utils.LongToUInts(regInfo.RegionHandle, out x, out y);
614 GridRegion clonedRegion = new GridRegion(regInfo);
615 clonedRegion.RegionLocX = (int)x;
616 clonedRegion.RegionLocY = (int)y;
617
618 // Get the user's home region information
619 GridRegion home = m_aScene.GridService.GetRegionByUUID(m_aScene.RegionInfo.ScopeID, uinfo.UserProfile.HomeRegionID);
620
621 // Get the user's service URLs
622 string serverURI = "";
623 if (uinfo.UserProfile is ForeignUserProfileData)
624 serverURI = Util.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
625 string userServer = (serverURI == "") || (serverURI == null) ? LocalUserServerURI : serverURI;
626
627 string assetServer = Util.ServerURI(uinfo.UserProfile.UserAssetURI);
628 if ((assetServer == null) || (assetServer == ""))
629 assetServer = LocalAssetServerURI;
630
631 string inventoryServer = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
632 if ((inventoryServer == null) || (inventoryServer == ""))
633 inventoryServer = LocalInventoryServerURI;
634
635 if (!m_HypergridServiceConnector.InformRegionOfUser(clonedRegion, agentData, home, userServer, assetServer, inventoryServer))
636 {
637 m_log.Warn("[HGrid]: Could not inform remote region of transferring user.");
638 return false;
639 }
640 }
641 //if ((uinfo == null) || !IsGoingHome(uinfo, regInfo))
642 //{
643 // m_log.Info("[HGrid]: User seems to be going to foreign region.");
644 // if (!InformRegionOfUser(regInfo, agentData))
645 // {
646 // m_log.Warn("[HGrid]: Could not inform remote region of transferring user.");
647 // return false;
648 // }
649 //}
650 //else
651 // m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
652
653 // May need to change agent's name
654 if (IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null))
655 {
656 agentData.firstname = agentData.firstname + "." + agentData.lastname;
657 agentData.lastname = "@" + LocalUserServerURI.Replace("http://", ""); ; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
658 }
659
660 return true;
661 }
662
663 public void AdjustUserInformation(AgentCircuitData agentData)
664 {
665 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID);
666 if ((uinfo != null) && (uinfo.UserProfile != null) &&
667 (IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData)))
668 {
669 //m_log.Debug("---------------> Local User!");
670 string[] parts = agentData.firstname.Split(new char[] { '.' });
671 if (parts.Length == 2)
672 {
673 agentData.firstname = parts[0];
674 agentData.lastname = parts[1];
675 }
676 }
677 //else
678 // m_log.Debug("---------------> Foreign User!");
679 }
680
681 // Check if a local user exists with the same UUID as the incoming foreign user
682 public bool CheckUserAtEntry(UUID userID, UUID sessionID, out bool comingHome)
683 {
684 comingHome = false;
685 if (!m_aScene.SceneGridService.RegionLoginsEnabled)
686 return false;
687
688 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
689 if (uinfo != null)
690 {
691 // uh-oh we have a potential intruder
692 if (uinfo.SessionID != sessionID)
693 // can't have a foreigner with a local UUID
694 return false;
695 else
696 // oh, so it's you! welcome back
697 comingHome = true;
698 }
699
700 // OK, user can come in
701 return true;
702 }
703
704 public void AcceptUser(ForeignUserProfileData user, GridRegion home)
705 {
706 m_aScene.CommsManager.UserProfileCacheService.PreloadUserCache(user);
707 ulong realHandle = home.RegionHandle;
708 // Change the local coordinates
709 // X=0 on the map
710 home.RegionLocX = 0;
711 home.RegionLocY = random.Next(0, 10000) * (int)Constants.RegionSize;
712
713 AddHyperlinkHomeRegion(user.ID, home, realHandle);
714
715 DumpUserData(user);
716 DumpRegionData(home);
717
718 }
719
720 public bool IsLocalUser(UUID userID)
721 {
722 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
723 return IsLocalUser(uinfo);
724 }
725
557 #endregion 726 #endregion
558 727
728 #region IHyperlink Misc
729
730 protected bool IsComingHome(ForeignUserProfileData userData)
731 {
732 return (userData.UserServerURI == LocalUserServerURI);
733 }
734
735 // Is the user going back to the home region or the home grid?
736 protected bool IsGoingHome(CachedUserInfo uinfo, GridRegion rinfo)
737 {
738 if (uinfo.UserProfile == null)
739 return false;
740
741 if (!(uinfo.UserProfile is ForeignUserProfileData))
742 // it's a home user, can't be outside to return home
743 return false;
744
745 // OK, it's a foreign user with a ForeignUserProfileData
746 // and is going back to exactly the home region.
747 // We can't check if it's going back to a non-home region
748 // of the home grid. That will be dealt with in the
749 // receiving end
750 return (uinfo.UserProfile.HomeRegionID == rinfo.RegionID);
751 }
752
753 protected bool IsLocalUser(CachedUserInfo uinfo)
754 {
755 if (uinfo == null)
756 return false;
757
758 return !(uinfo.UserProfile is ForeignUserProfileData);
759
760 }
761
762 protected bool IsLocalRegion(ulong handle)
763 {
764 return m_LocalScenes.ContainsKey(handle);
765 }
766
767 private void DumpUserData(ForeignUserProfileData userData)
768 {
769 m_log.Info(" ------------ User Data Dump ----------");
770 m_log.Info(" >> Name: " + userData.FirstName + " " + userData.SurName);
771 m_log.Info(" >> HomeID: " + userData.HomeRegionID);
772 m_log.Info(" >> UserServer: " + userData.UserServerURI);
773 m_log.Info(" >> InvServer: " + userData.UserInventoryURI);
774 m_log.Info(" >> AssetServer: " + userData.UserAssetURI);
775 m_log.Info(" ------------ -------------- ----------");
776 }
777
778 private void DumpRegionData(GridRegion rinfo)
779 {
780 m_log.Info(" ------------ Region Data Dump ----------");
781 m_log.Info(" >> handle: " + rinfo.RegionHandle);
782 m_log.Info(" >> coords: " + rinfo.RegionLocX + ", " + rinfo.RegionLocY);
783 m_log.Info(" >> external host name: " + rinfo.ExternalHostName);
784 m_log.Info(" >> http port: " + rinfo.HttpPort);
785 m_log.Info(" >> external EP address: " + rinfo.ExternalEndPoint.Address);
786 m_log.Info(" >> external EP port: " + rinfo.ExternalEndPoint.Port);
787 m_log.Info(" ------------ -------------- ----------");
788 }
789
790
791 #endregion
792
793
559 } 794 }
560} 795}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 743d3b9..3ca4882 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -31,6 +31,7 @@ using System;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Console;
34using OpenSim.Server.Base; 35using OpenSim.Server.Base;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
@@ -47,7 +48,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
47 LogManager.GetLogger( 48 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType); 49 MethodBase.GetCurrentMethod().DeclaringType);
49 50
51 private static LocalGridServicesConnector m_MainInstance;
52
50 private IGridService m_GridService; 53 private IGridService m_GridService;
54 private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>();
51 55
52 private bool m_Enabled = false; 56 private bool m_Enabled = false;
53 57
@@ -58,6 +62,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
58 public LocalGridServicesConnector(IConfigSource source) 62 public LocalGridServicesConnector(IConfigSource source)
59 { 63 {
60 m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated"); 64 m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated");
65 m_MainInstance = this;
61 InitialiseService(source); 66 InitialiseService(source);
62 } 67 }
63 68
@@ -82,6 +87,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
82 if (name == Name) 87 if (name == Name)
83 { 88 {
84 InitialiseService(source); 89 InitialiseService(source);
90 m_MainInstance = this;
85 m_Enabled = true; 91 m_Enabled = true;
86 m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled"); 92 m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled");
87 } 93 }
@@ -120,6 +126,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
120 126
121 public void PostInitialise() 127 public void PostInitialise()
122 { 128 {
129 if (m_MainInstance == this)
130 {
131 MainConsole.Instance.Commands.AddCommand("LocalGridConnector", false, "show neighbours",
132 "show neighbours",
133 "Shows the local regions' neighbours", NeighboursCommand);
134 }
123 } 135 }
124 136
125 public void Close() 137 public void Close()
@@ -128,14 +140,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
128 140
129 public void AddRegion(Scene scene) 141 public void AddRegion(Scene scene)
130 { 142 {
131 if (!m_Enabled) 143 if (m_Enabled)
132 return; 144 scene.RegisterModuleInterface<IGridService>(this);
133 145
134 scene.RegisterModuleInterface<IGridService>(this); 146 if (m_MainInstance == this)
147 {
148 if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID))
149 m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!");
150 else
151 m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene));
152 }
135 } 153 }
136 154
137 public void RemoveRegion(Scene scene) 155 public void RemoveRegion(Scene scene)
138 { 156 {
157 if (m_MainInstance == this)
158 {
159 m_LocalCache[scene.RegionInfo.RegionID].Clear();
160 m_LocalCache.Remove(scene.RegionInfo.RegionID);
161 }
139 } 162 }
140 163
141 public void RegionLoaded(Scene scene) 164 public void RegionLoaded(Scene scene)
@@ -158,7 +181,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
158 181
159 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) 182 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
160 { 183 {
161 return m_GridService.GetNeighbours(scopeID, regionID); 184 if (m_LocalCache.ContainsKey(regionID))
185 {
186 List<GridRegion> neighbours = m_LocalCache[regionID].GetNeighbours();
187 if (neighbours.Count == 0)
188 // try the DB
189 neighbours = m_GridService.GetNeighbours(scopeID, regionID);
190 return neighbours;
191 }
192 else
193 {
194 m_log.WarnFormat("[LOCAL GRID CONNECTOR]: GetNeighbours: Requested region {0} is not on this sim", regionID);
195 return new List<GridRegion>();
196 }
197
198 // Don't go to the DB
199 //return m_GridService.GetNeighbours(scopeID, regionID);
162 } 200 }
163 201
164 public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) 202 public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
@@ -187,5 +225,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
187 } 225 }
188 226
189 #endregion 227 #endregion
228
229 public void NeighboursCommand(string module, string[] cmdparams)
230 {
231 foreach (KeyValuePair<UUID, RegionCache> kvp in m_LocalCache)
232 {
233 m_log.InfoFormat("*** Neighbours of {0} {1} ***", kvp.Key, kvp.Value.RegionName);
234 List<GridRegion> regions = kvp.Value.GetNeighbours();
235 foreach (GridRegion r in regions)
236 m_log.InfoFormat(" {0} @ {1}={2}", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize);
237 }
238 }
190 } 239 }
191} 240}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
new file mode 100644
index 0000000..2b336bb
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
@@ -0,0 +1,79 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31
32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Services.Interfaces;
34using GridRegion = OpenSim.Services.Interfaces.GridRegion;
35
36using log4net;
37
38namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
39{
40 public class RegionCache
41 {
42 private static readonly ILog m_log =
43 LogManager.GetLogger(
44 MethodBase.GetCurrentMethod().DeclaringType);
45
46 private Scene m_scene;
47 private Dictionary<ulong, GridRegion> m_neighbours = new Dictionary<ulong, GridRegion>();
48
49 public string RegionName
50 {
51 get { return m_scene.RegionInfo.RegionName; }
52 }
53
54 public RegionCache(Scene s)
55 {
56 m_scene = s;
57 m_scene.EventManager.OnRegionUp += OnRegionUp;
58 }
59
60 private void OnRegionUp(GridRegion otherRegion)
61 {
62 m_log.DebugFormat("[REGION CACHE]: (on region {0}) Region {1} is up @ {2}-{3}",
63 m_scene.RegionInfo.RegionName, otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY);
64
65 m_neighbours[otherRegion.RegionHandle] = otherRegion;
66 }
67
68 public void Clear()
69 {
70 m_scene.EventManager.OnRegionUp -= OnRegionUp;
71 m_neighbours.Clear();
72 }
73
74 public List<GridRegion> GetNeighbours()
75 {
76 return new List<GridRegion>(m_neighbours.Values);
77 }
78 }
79}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index 91a808b..72c00fc 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -104,6 +104,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
104 104
105 public void PostInitialise() 105 public void PostInitialise()
106 { 106 {
107 if (m_LocalGridService != null)
108 ((ISharedRegionModule)m_LocalGridService).PostInitialise();
107 } 109 }
108 110
109 public void Close() 111 public void Close()
@@ -112,14 +114,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
112 114
113 public void AddRegion(Scene scene) 115 public void AddRegion(Scene scene)
114 { 116 {
115 if (!m_Enabled) 117 if (m_Enabled)
116 return; 118 scene.RegisterModuleInterface<IGridService>(this);
117 119
118 scene.RegisterModuleInterface<IGridService>(this); 120 if (m_LocalGridService != null)
121 ((ISharedRegionModule)m_LocalGridService).AddRegion(scene);
119 } 122 }
120 123
121 public void RemoveRegion(Scene scene) 124 public void RemoveRegion(Scene scene)
122 { 125 {
126 if (m_LocalGridService != null)
127 ((ISharedRegionModule)m_LocalGridService).RemoveRegion(scene);
123 } 128 }
124 129
125 public void RegionLoaded(Scene scene) 130 public void RegionLoaded(Scene scene)
@@ -146,7 +151,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
146 return false; 151 return false;
147 } 152 }
148 153
149 // Let's not override GetNeighbours -- let's get them all from the grid server 154 // Let's override GetNeighbours completely -- never go to the grid server
155 // Neighbours are/should be cached locally
156 // For retrieval from the DB, caller should call GetRegionByPosition
157 public override List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
158 {
159 return m_LocalGridService.GetNeighbours(scopeID, regionID);
160 }
150 161
151 public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) 162 public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
152 { 163 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
index be32d6b..2ca90f8 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
@@ -78,6 +78,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
78 r1.ExternalHostName = "127.0.0.1"; 78 r1.ExternalHostName = "127.0.0.1";
79 r1.HttpPort = 9001; 79 r1.HttpPort = 9001;
80 r1.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); 80 r1.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
81 Scene s = new Scene(new RegionInfo());
82 s.RegionInfo.RegionID = r1.RegionID;
83 m_LocalConnector.AddRegion(s);
84
81 85
82 GridRegion r2 = new GridRegion(); 86 GridRegion r2 = new GridRegion();
83 r2.RegionName = "Test Region 2"; 87 r2.RegionName = "Test Region 2";
@@ -87,6 +91,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
87 r2.ExternalHostName = "127.0.0.1"; 91 r2.ExternalHostName = "127.0.0.1";
88 r2.HttpPort = 9002; 92 r2.HttpPort = 9002;
89 r2.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); 93 r2.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
94 s = new Scene(new RegionInfo());
95 s.RegionInfo.RegionID = r1.RegionID;
96 m_LocalConnector.AddRegion(s);
90 97
91 GridRegion r3 = new GridRegion(); 98 GridRegion r3 = new GridRegion();
92 r3.RegionName = "Test Region 3"; 99 r3.RegionName = "Test Region 3";
@@ -96,6 +103,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
96 r3.ExternalHostName = "127.0.0.1"; 103 r3.ExternalHostName = "127.0.0.1";
97 r3.HttpPort = 9003; 104 r3.HttpPort = 9003;
98 r3.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); 105 r3.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
106 s = new Scene(new RegionInfo());
107 s.RegionInfo.RegionID = r1.RegionID;
108 m_LocalConnector.AddRegion(s);
99 109
100 m_LocalConnector.RegisterRegion(UUID.Zero, r1); 110 m_LocalConnector.RegisterRegion(UUID.Zero, r1);
101 GridRegion result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test"); 111 GridRegion result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test");
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
index 9519e23..696225c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
@@ -42,6 +42,8 @@ using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Hypergrid; 43using OpenSim.Region.Framework.Scenes.Hypergrid;
44using OpenSim.Region.Framework.Scenes.Serialization; 44using OpenSim.Region.Framework.Scenes.Serialization;
45using OpenSim.Services.Interfaces;
46using GridRegion = OpenSim.Services.Interfaces.GridRegion;
45 47
46namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion 48namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
47{ 49{
@@ -59,6 +61,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
59 61
60 protected RegionToRegionClient m_regionClient; 62 protected RegionToRegionClient m_regionClient;
61 63
64 protected IHyperlinkService m_hyperlinkService;
65
62 protected bool m_safemode; 66 protected bool m_safemode;
63 protected IPAddress m_thisIP; 67 protected IPAddress m_thisIP;
64 68
@@ -134,7 +138,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
134 m_localBackend = new LocalInterregionComms(); 138 m_localBackend = new LocalInterregionComms();
135 m_commsManager = scene.CommsManager; 139 m_commsManager = scene.CommsManager;
136 m_aScene = scene; 140 m_aScene = scene;
137 m_regionClient = new RegionToRegionClient(m_aScene); 141 m_hyperlinkService = m_aScene.RequestModuleInterface<IHyperlinkService>();
142 m_regionClient = new RegionToRegionClient(m_aScene, m_hyperlinkService);
138 m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName); 143 m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName);
139 } 144 }
140 145
@@ -161,7 +166,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
161 // else do the remote thing 166 // else do the remote thing
162 if (!m_localBackend.IsLocalRegion(regionHandle)) 167 if (!m_localBackend.IsLocalRegion(regionHandle))
163 { 168 {
164 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 169 uint x = 0, y = 0;
170 Utils.LongToUInts(regionHandle, out x, out y);
171 GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
165 if (regInfo != null) 172 if (regInfo != null)
166 { 173 {
167 m_regionClient.SendUserInformation(regInfo, aCircuit); 174 m_regionClient.SendUserInformation(regInfo, aCircuit);
@@ -183,7 +190,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
183 // else do the remote thing 190 // else do the remote thing
184 if (!m_localBackend.IsLocalRegion(regionHandle)) 191 if (!m_localBackend.IsLocalRegion(regionHandle))
185 { 192 {
186 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 193 uint x = 0, y = 0;
194 Utils.LongToUInts(regionHandle, out x, out y);
195 GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
187 if (regInfo != null) 196 if (regInfo != null)
188 { 197 {
189 return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData); 198 return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData);
@@ -204,7 +213,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
204 // else do the remote thing 213 // else do the remote thing
205 if (!m_localBackend.IsLocalRegion(regionHandle)) 214 if (!m_localBackend.IsLocalRegion(regionHandle))
206 { 215 {
207 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 216 uint x = 0, y = 0;
217 Utils.LongToUInts(regionHandle, out x, out y);
218 GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
208 if (regInfo != null) 219 if (regInfo != null)
209 { 220 {
210 return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData); 221 return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData);
@@ -225,7 +236,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
225 // else do the remote thing 236 // else do the remote thing
226 if (!m_localBackend.IsLocalRegion(regionHandle)) 237 if (!m_localBackend.IsLocalRegion(regionHandle))
227 { 238 {
228 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 239 uint x = 0, y = 0;
240 Utils.LongToUInts(regionHandle, out x, out y);
241 GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
229 if (regInfo != null) 242 if (regInfo != null)
230 { 243 {
231 return m_regionClient.DoRetrieveRootAgentCall(regInfo, id, out agent); 244 return m_regionClient.DoRetrieveRootAgentCall(regInfo, id, out agent);
@@ -257,7 +270,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
257 // else do the remote thing 270 // else do the remote thing
258 if (!m_localBackend.IsLocalRegion(regionHandle)) 271 if (!m_localBackend.IsLocalRegion(regionHandle))
259 { 272 {
260 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 273 uint x = 0, y = 0;
274 Utils.LongToUInts(regionHandle, out x, out y);
275 GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
261 if (regInfo != null) 276 if (regInfo != null)
262 { 277 {
263 return m_regionClient.DoCloseAgentCall(regInfo, id); 278 return m_regionClient.DoCloseAgentCall(regInfo, id);
@@ -284,7 +299,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
284 // else do the remote thing 299 // else do the remote thing
285 if (!m_localBackend.IsLocalRegion(regionHandle)) 300 if (!m_localBackend.IsLocalRegion(regionHandle))
286 { 301 {
287 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 302 uint x = 0, y = 0;
303 Utils.LongToUInts(regionHandle, out x, out y);
304 GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
288 if (regInfo != null) 305 if (regInfo != null)
289 { 306 {
290 return m_regionClient.DoCreateObjectCall( 307 return m_regionClient.DoCreateObjectCall(
@@ -776,16 +793,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
776 protected class RegionToRegionClient : RegionClient 793 protected class RegionToRegionClient : RegionClient
777 { 794 {
778 Scene m_aScene = null; 795 Scene m_aScene = null;
796 IHyperlinkService m_hyperlinkService;
779 797
780 public RegionToRegionClient(Scene s) 798 public RegionToRegionClient(Scene s, IHyperlinkService hyperService)
781 { 799 {
782 m_aScene = s; 800 m_aScene = s;
801 m_hyperlinkService = hyperService;
783 } 802 }
784 803
785 public override ulong GetRegionHandle(ulong handle) 804 public override ulong GetRegionHandle(ulong handle)
786 { 805 {
787 if (m_aScene.SceneGridService is HGSceneCommunicationService) 806 if (m_aScene.SceneGridService is HGSceneCommunicationService)
788 return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.FindRegionHandle(handle); 807 {
808 if (m_hyperlinkService != null)
809 return m_hyperlinkService.FindRegionHandle(handle);
810 }
789 811
790 return handle; 812 return handle;
791 } 813 }
@@ -793,29 +815,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
793 public override bool IsHyperlink(ulong handle) 815 public override bool IsHyperlink(ulong handle)
794 { 816 {
795 if (m_aScene.SceneGridService is HGSceneCommunicationService) 817 if (m_aScene.SceneGridService is HGSceneCommunicationService)
796 return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.IsHyperlinkRegion(handle); 818 {
797 819 if ((m_hyperlinkService != null) && (m_hyperlinkService.GetHyperlinkRegion(handle) != null))
820 return true;
821 }
798 return false; 822 return false;
799 } 823 }
800 824
801 public override void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit) 825 public override void SendUserInformation(GridRegion regInfo, AgentCircuitData aCircuit)
802 { 826 {
803 try 827 if (m_hyperlinkService != null)
804 { 828 m_hyperlinkService.SendUserInformation(regInfo, aCircuit);
805 if (m_aScene.SceneGridService is HGSceneCommunicationService)
806 {
807 ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.SendUserInformation(regInfo, aCircuit);
808 }
809 }
810 catch // Bad cast
811 { }
812 829
813 } 830 }
814 831
815 public override void AdjustUserInformation(AgentCircuitData aCircuit) 832 public override void AdjustUserInformation(AgentCircuitData aCircuit)
816 { 833 {
817 if (m_aScene.SceneGridService is HGSceneCommunicationService) 834 if (m_hyperlinkService != null)
818 ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.AdjustUserInformation(aCircuit); 835 m_hyperlinkService.AdjustUserInformation(aCircuit);
819 } 836 }
820 } 837 }
821 838
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 1c66254..fd1a759 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -525,7 +525,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
525 return true; 525 return true;
526 } 526 }
527 527
528 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); 528 if ((uinfo.UserProfile.UserInventoryURI == null) || (uinfo.UserProfile.UserInventoryURI == ""))
529 // this happens in standalone profiles, apparently
530 return true;
531
532 string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
533
529 string uri = m_LocalGridInventoryURI.TrimEnd('/'); 534 string uri = m_LocalGridInventoryURI.TrimEnd('/');
530 535
531 if ((userInventoryServerURI == uri) || (userInventoryServerURI == "")) 536 if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
@@ -544,7 +549,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
544 if ((uinfo == null) || (uinfo.UserProfile == null)) 549 if ((uinfo == null) || (uinfo.UserProfile == null))
545 return invURI; 550 return invURI;
546 551
547 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); 552 string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
548 553
549 if ((userInventoryServerURI != null) && 554 if ((userInventoryServerURI != null) &&
550 (userInventoryServerURI != "")) 555 (userInventoryServerURI != ""))
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
index 0d32c77..69504df 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
107 public void AddRegion(Scene scene) 107 public void AddRegion(Scene scene)
108 { 108 {
109 m_Scene = scene; 109 m_Scene = scene;
110 m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); 110 //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName);
111 111
112 if (!m_Enabled) 112 if (!m_Enabled)
113 return; 113 return;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs
index a52c70b..b0ace39 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs
@@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using OpenSim.Server.Base; 38using OpenSim.Server.Base;
39 39
40
40namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land 41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
41{ 42{
42 public class RemoteLandServicesConnector : 43 public class RemoteLandServicesConnector :
@@ -89,7 +90,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
89 if (!m_Enabled) 90 if (!m_Enabled)
90 return; 91 return;
91 92
92 m_MapService = scene.CommsManager.GridService; 93 m_GridService = scene.GridService;
93 m_LocalService.AddRegion(scene); 94 m_LocalService.AddRegion(scene);
94 scene.RegisterModuleInterface<ILandService>(this); 95 scene.RegisterModuleInterface<ILandService>(this);
95 } 96 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
index 61bf481..daba0b3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
@@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
119 119
120 #region INeighbourService 120 #region INeighbourService
121 121
122 public bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) 122 public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
123 { 123 {
124 m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", 124 m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}",
125 thisRegion.RegionName, regionHandle, m_Scenes.Count); 125 thisRegion.RegionName, regionHandle, m_Scenes.Count);
@@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
132 } 132 }
133 } 133 }
134 m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle); 134 m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle);
135 return false; 135 return null;
136 } 136 }
137 137
138 #endregion INeighbourService 138 #endregion INeighbourService
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs
index c5bc03b..c6fc2a1 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs
@@ -118,7 +118,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
118 if (!m_Enabled) 118 if (!m_Enabled)
119 return; 119 return;
120 120
121 m_MapService = scene.CommsManager.GridService;
122 m_LocalService.AddRegion(scene); 121 m_LocalService.AddRegion(scene);
123 scene.RegisterModuleInterface<INeighbourService>(this); 122 scene.RegisterModuleInterface<INeighbourService>(this);
124 } 123 }
@@ -134,16 +133,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
134 if (!m_Enabled) 133 if (!m_Enabled)
135 return; 134 return;
136 135
136 m_GridService = scene.GridService;
137
137 m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled remote neighbours for region {0}", scene.RegionInfo.RegionName); 138 m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled remote neighbours for region {0}", scene.RegionInfo.RegionName);
138 139
139 } 140 }
140 141
141 #region INeighbourService 142 #region INeighbourService
142 143
143 public override bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) 144 public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
144 { 145 {
145 if (m_LocalService.HelloNeighbour(regionHandle, thisRegion)) 146 GridRegion region = m_LocalService.HelloNeighbour(regionHandle, thisRegion);
146 return true; 147 if (region != null)
148 return region;
147 149
148 return base.HelloNeighbour(regionHandle, thisRegion); 150 return base.HelloNeighbour(regionHandle, thisRegion);
149 } 151 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 376ea8a..65f83fd 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -110,12 +110,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
110 TarArchiveReader.TarEntryType entryType; 110 TarArchiveReader.TarEntryType entryType;
111 111
112 while ((data = archive.ReadEntry(out filePath, out entryType)) != null) 112 while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
113 { 113 {
114 //m_log.DebugFormat( 114 //m_log.DebugFormat(
115 // "[ARCHIVER]: Successfully read {0} ({1} bytes)", filePath, data.Length); 115 // "[ARCHIVER]: Successfully read {0} ({1} bytes)", filePath, data.Length);
116 116
117 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) 117 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
118 continue; 118 continue;
119 119
120 if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) 120 if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
121 { 121 {
@@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
173 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); 173 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
174 174
175 IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>(); 175 IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>();
176 int sceneObjectsLoadedCount = 0; 176 int sceneObjectsLoadedCount = 0;
177 177
178 foreach (string serialisedSceneObject in serialisedSceneObjects) 178 foreach (string serialisedSceneObject in serialisedSceneObjects)
179 { 179 {
@@ -499,7 +499,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
499 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); 499 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
500 500
501 XmlTextReader xtr 501 XmlTextReader xtr
502 = new XmlTextReader(m_asciiEncoding.GetString(data), XmlNodeType.Document, context); 502 = new XmlTextReader(m_asciiEncoding.GetString(data), XmlNodeType.Document, context);
503 503
504 RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; 504 RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
505 505
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 63608a8..9e4fbbe 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -74,14 +74,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
74 m_scene = scene; 74 m_scene = scene;
75 m_saveStream = saveStream; 75 m_saveStream = saveStream;
76 m_requestId = requestId; 76 m_requestId = requestId;
77 } 77 }
78 78
79 /// <summary> 79 /// <summary>
80 /// Archive the region requested. 80 /// Archive the region requested.
81 /// </summary> 81 /// </summary>
82 /// <exception cref="System.IO.IOException">if there was an io problem with creating the file</exception> 82 /// <exception cref="System.IO.IOException">if there was an io problem with creating the file</exception>
83 public void ArchiveRegion() 83 public void ArchiveRegion()
84 { 84 {
85 Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>(); 85 Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>();
86 86
87 List<EntityBase> entities = m_scene.GetEntities(); 87 List<EntityBase> entities = m_scene.GetEntities();
@@ -137,7 +137,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
137 m_scene.RequestModuleInterface<IRegionSerialiserModule>(), 137 m_scene.RequestModuleInterface<IRegionSerialiserModule>(),
138 m_scene, 138 m_scene,
139 archiveWriter, 139 archiveWriter,
140 m_requestId); 140 m_requestId);
141 141
142 new AssetsRequest( 142 new AssetsRequest(
143 new AssetsArchiver(archiveWriter), assetUuids.Keys, 143 new AssetsArchiver(archiveWriter), assetUuids.Keys,
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index 5c58b69..8d4f91b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -78,7 +78,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
78 78
79 public void Close() 79 public void Close()
80 { 80 {
81 } 81 }
82 82
83 public void ArchiveRegion(string savePath) 83 public void ArchiveRegion(string savePath)
84 { 84 {
@@ -90,7 +90,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
90 m_log.InfoFormat( 90 m_log.InfoFormat(
91 "[ARCHIVER]: Writing archive for region {0} to {1}", m_scene.RegionInfo.RegionName, savePath); 91 "[ARCHIVER]: Writing archive for region {0} to {1}", m_scene.RegionInfo.RegionName, savePath);
92 92
93 new ArchiveWriteRequestPreparation(m_scene, savePath, requestId).ArchiveRegion(); 93 new ArchiveWriteRequestPreparation(m_scene, savePath, requestId).ArchiveRegion();
94 } 94 }
95 95
96 public void ArchiveRegion(Stream saveStream) 96 public void ArchiveRegion(Stream saveStream)
@@ -101,7 +101,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
101 public void ArchiveRegion(Stream saveStream, Guid requestId) 101 public void ArchiveRegion(Stream saveStream, Guid requestId)
102 { 102 {
103 new ArchiveWriteRequestPreparation(m_scene, saveStream, requestId).ArchiveRegion(); 103 new ArchiveWriteRequestPreparation(m_scene, saveStream, requestId).ArchiveRegion();
104 } 104 }
105 105
106 public void DearchiveRegion(string loadPath) 106 public void DearchiveRegion(string loadPath)
107 { 107 {
@@ -114,7 +114,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
114 "[ARCHIVER]: Loading archive to region {0} from {1}", m_scene.RegionInfo.RegionName, loadPath); 114 "[ARCHIVER]: Loading archive to region {0} from {1}", m_scene.RegionInfo.RegionName, loadPath);
115 115
116 new ArchiveReadRequest(m_scene, loadPath, merge, requestId).DearchiveRegion(); 116 new ArchiveReadRequest(m_scene, loadPath, merge, requestId).DearchiveRegion();
117 } 117 }
118 118
119 public void DearchiveRegion(Stream loadStream) 119 public void DearchiveRegion(Stream loadStream)
120 { 120 {
@@ -124,6 +124,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
124 public void DearchiveRegion(Stream loadStream, bool merge, Guid requestId) 124 public void DearchiveRegion(Stream loadStream, bool merge, Guid requestId)
125 { 125 {
126 new ArchiveReadRequest(m_scene, loadStream, merge, requestId).DearchiveRegion(); 126 new ArchiveReadRequest(m_scene, loadStream, merge, requestId).DearchiveRegion();
127 } 127 }
128 } 128 }
129} 129}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs
index 330fa3f..95d109c 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
65 /// </summary> 65 /// </summary>
66 /// <param name="archive"></param> 66 /// <param name="archive"></param>
67 public void WriteAsset(AssetBase asset) 67 public void WriteAsset(AssetBase asset)
68 { 68 {
69 //WriteMetadata(archive); 69 //WriteMetadata(archive);
70 WriteData(asset); 70 WriteData(asset);
71 } 71 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index 82803bf..fe9c8d9 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -115,7 +115,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
115 115
116 m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT); 116 m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT);
117 m_requestCallbackTimer.AutoReset = false; 117 m_requestCallbackTimer.AutoReset = false;
118 m_requestCallbackTimer.Elapsed += new ElapsedEventHandler(OnRequestCallbackTimeout); 118 m_requestCallbackTimer.Elapsed += new ElapsedEventHandler(OnRequestCallbackTimeout);
119 } 119 }
120 120
121 protected internal void Execute() 121 protected internal void Execute()
@@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
143 protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args) 143 protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args)
144 { 144 {
145 try 145 try
146 { 146 {
147 lock (this) 147 lock (this)
148 { 148 {
149 // Take care of the possibilty that this thread started but was paused just outside the lock before 149 // Take care of the possibilty that this thread started but was paused just outside the lock before
@@ -155,7 +155,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
155 } 155 }
156 156
157 // Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure 157 // Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure
158 // case anyway. 158 // case anyway.
159 List<UUID> uuids = new List<UUID>(); 159 List<UUID> uuids = new List<UUID>();
160 foreach (UUID uuid in m_uuids) 160 foreach (UUID uuid in m_uuids)
161 { 161 {
@@ -188,7 +188,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
188 m_log.ErrorFormat( 188 m_log.ErrorFormat(
189 "[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT); 189 "[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT);
190 190
191 m_log.Error("[ARCHIVER]: OAR save aborted."); 191 m_log.Error("[ARCHIVER]: OAR save aborted.");
192 } 192 }
193 catch (Exception e) 193 catch (Exception e)
194 { 194 {
@@ -213,7 +213,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
213 { 213 {
214 //m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", id); 214 //m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", id);
215 215
216 m_requestCallbackTimer.Stop(); 216 m_requestCallbackTimer.Stop();
217 217
218 if (m_requestState == RequestState.Aborted) 218 if (m_requestState == RequestState.Aborted)
219 { 219 {
@@ -258,7 +258,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
258 } 258 }
259 catch (Exception e) 259 catch (Exception e)
260 { 260 {
261 m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e); 261 m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e);
262 } 262 }
263 } 263 }
264 264
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 5c42e94..edac4a4 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
59 m_lastErrorMessage = errorMessage; 59 m_lastErrorMessage = errorMessage;
60 Console.WriteLine("About to pulse ArchiverTests on LoadCompleted"); 60 Console.WriteLine("About to pulse ArchiverTests on LoadCompleted");
61 61
62 Monitor.PulseAll(this); 62 Monitor.PulseAll(this);
63 } 63 }
64 } 64 }
65 65
@@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
138 archiverModule.ArchiveRegion(archiveWriteStream, requestId); 138 archiverModule.ArchiveRegion(archiveWriteStream, requestId);
139 //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; 139 //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer;
140 //while (assetServer.HasWaitingRequests()) 140 //while (assetServer.HasWaitingRequests())
141 // assetServer.ProcessNextRequest(); 141 // assetServer.ProcessNextRequest();
142 142
143 Monitor.Wait(this, 60000); 143 Monitor.Wait(this, 60000);
144 } 144 }
@@ -213,7 +213,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
213 213
214 // Also check that direct entries which will also have a file entry containing that directory doesn't 214 // Also check that direct entries which will also have a file entry containing that directory doesn't
215 // upset load 215 // upset load
216 tar.WriteDir(ArchiveConstants.TERRAINS_PATH); 216 tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
217 217
218 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); 218 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
219 219
@@ -251,7 +251,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
251 { 251 {
252 scene.EventManager.OnOarFileLoaded += LoadCompleted; 252 scene.EventManager.OnOarFileLoaded += LoadCompleted;
253 archiverModule.DearchiveRegion(archiveReadStream); 253 archiverModule.DearchiveRegion(archiveReadStream);
254 } 254 }
255 255
256 Assert.That(m_lastErrorMessage, Is.Null); 256 Assert.That(m_lastErrorMessage, Is.Null);
257 257
@@ -271,7 +271,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
271 271
272 /// <summary> 272 /// <summary>
273 /// Test merging a V0.2 OpenSim Region Archive into an existing scene 273 /// Test merging a V0.2 OpenSim Region Archive into an existing scene
274 /// </summary> 274 /// </summary>
275 //[Test] 275 //[Test]
276 public void TestMergeOarV0_2() 276 public void TestMergeOarV0_2()
277 { 277 {
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 76ff6da..fdff61e 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -36,10 +36,12 @@ using OpenSim.Framework;
36using OpenSim.Framework.Capabilities; 36using OpenSim.Framework.Capabilities;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Framework.Servers.HttpServer; 38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Services.Interfaces;
39using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Physics.Manager; 42using OpenSim.Region.Physics.Manager;
42using Caps=OpenSim.Framework.Capabilities.Caps; 43using Caps=OpenSim.Framework.Capabilities.Caps;
44using GridRegion = OpenSim.Services.Interfaces.GridRegion;
43 45
44namespace OpenSim.Region.CoreModules.World.Land 46namespace OpenSim.Region.CoreModules.World.Land
45{ 47{
@@ -1301,7 +1303,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1301 else 1303 else
1302 { 1304 {
1303 // a parcel request for a parcel in another region. Ask the grid about the region 1305 // a parcel request for a parcel in another region. Ask the grid about the region
1304 RegionInfo info = m_scene.CommsManager.GridService.RequestNeighbourInfo(regionID); 1306 GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, regionID);
1305 if (info != null) 1307 if (info != null)
1306 parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y); 1308 parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y);
1307 } 1309 }
@@ -1359,9 +1361,10 @@ namespace OpenSim.Region.CoreModules.World.Land
1359 } 1361 }
1360 else 1362 else
1361 { 1363 {
1362 extLandData.landData = m_scene.CommsManager.GridService.RequestLandData(extLandData.regionHandle, 1364 ILandService landService = m_scene.RequestModuleInterface<ILandService>();
1363 extLandData.x, 1365 extLandData.landData = landService.GetLandData(extLandData.regionHandle,
1364 extLandData.y); 1366 extLandData.x,
1367 extLandData.y);
1365 if (extLandData.landData == null) 1368 if (extLandData.landData == null)
1366 { 1369 {
1367 // we didn't find the region/land => don't cache 1370 // we didn't find the region/land => don't cache
@@ -1373,20 +1376,27 @@ namespace OpenSim.Region.CoreModules.World.Land
1373 1376
1374 if (data != null) // if we found some data, send it 1377 if (data != null) // if we found some data, send it
1375 { 1378 {
1376 RegionInfo info; 1379 GridRegion info;
1377 if (data.regionHandle == m_scene.RegionInfo.RegionHandle) 1380 if (data.regionHandle == m_scene.RegionInfo.RegionHandle)
1378 { 1381 {
1379 info = m_scene.RegionInfo; 1382 info = new GridRegion(m_scene.RegionInfo);
1380 } 1383 }
1381 else 1384 else
1382 { 1385 {
1383 // most likely still cached from building the extLandData entry 1386 // most likely still cached from building the extLandData entry
1384 info = m_scene.CommsManager.GridService.RequestNeighbourInfo(data.regionHandle); 1387 uint x = 0, y = 0;
1388 Utils.LongToUInts(data.regionHandle, out x, out y);
1389 info = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
1385 } 1390 }
1386 // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. 1391 // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
1387 m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...", 1392 m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
1388 data.landData.Name, data.regionHandle); 1393 data.landData.Name, data.regionHandle);
1389 remoteClient.SendParcelInfo(info, data.landData, parcelID, data.x, data.y); 1394 // HACK for now
1395 RegionInfo r = new RegionInfo();
1396 r.RegionName = info.RegionName;
1397 r.RegionLocX = (uint)info.RegionLocX;
1398 r.RegionLocY = (uint)info.RegionLocY;
1399 remoteClient.SendParcelInfo(r, data.landData, parcelID, data.x, data.y);
1390 } 1400 }
1391 else 1401 else
1392 m_log.Debug("[LAND] got no parcelinfo; not sending"); 1402 m_log.Debug("[LAND] got no parcelinfo; not sending");
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 2701f60..3be5f45 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -954,7 +954,7 @@ namespace OpenSim.Region.CoreModules.World.Land
954 public void SetMediaUrl(string url) 954 public void SetMediaUrl(string url)
955 { 955 {
956 landData.MediaURL = url; 956 landData.MediaURL = url;
957 sendLandUpdateToAvatarsOverMe(); 957 sendLandUpdateToAvatarsOverMe();
958 } 958 }
959 959
960 /// <summary> 960 /// <summary>
@@ -964,7 +964,7 @@ namespace OpenSim.Region.CoreModules.World.Land
964 public void SetMusicUrl(string url) 964 public void SetMusicUrl(string url)
965 { 965 {
966 landData.MusicURL = url; 966 landData.MusicURL = url;
967 sendLandUpdateToAvatarsOverMe(); 967 sendLandUpdateToAvatarsOverMe();
968 } 968 }
969 } 969 }
970} 970}
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
index 65f22b1..2cbaf96 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
@@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Land
85 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, 85 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart,
86 UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, 86 UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem,
87 UUID fromtaskid) 87 UUID fromtaskid)
88 { 88 {
89 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; 89 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
90 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; 90 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
91 rayend.X += differenceX * (int)Constants.RegionSize; 91 rayend.X += differenceX * (int)Constants.RegionSize;
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index 181c5ae..05d19a2 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Framework.Client; 35using OpenSim.Framework.Client;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Framework.Console;
38 39
39namespace OpenSim.Region.CoreModules.World.Land 40namespace OpenSim.Region.CoreModules.World.Land
40{ 41{
@@ -61,7 +62,10 @@ namespace OpenSim.Region.CoreModules.World.Land
61 IConfig myConfig = source.Configs["Startup"]; 62 IConfig myConfig = source.Configs["Startup"];
62 enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false); 63 enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false);
63 //enabledYN = true; 64 //enabledYN = true;
64 } 65 if (enabledYN)
66 MainConsole.Instance.Commands.AddCommand("RegionCombinerModule", false, "fix-phantoms",
67 "Fix phantom objects", "Fixes phantom objects after an import to megaregions", FixPhantoms);
68 }
65 69
66 public void Close() 70 public void Close()
67 { 71 {
@@ -504,7 +508,7 @@ namespace OpenSim.Region.CoreModules.World.Land
504 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY; 508 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
505 } 509 }
506 510
507 /* 511 /*
508 else 512 else
509 { 513 {
510 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; 514 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
@@ -876,7 +880,7 @@ namespace OpenSim.Region.CoreModules.World.Land
876 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject; 880 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
877 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED 881 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
878 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED 882 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
879 VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED 883 VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED
880 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage; 884 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
881 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED 885 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
882 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED 886 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
@@ -895,11 +899,11 @@ namespace OpenSim.Region.CoreModules.World.Land
895 VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED 899 VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED
896 VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED 900 VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED
897 VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED 901 VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED
898 VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED 902 VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED
899 VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED 903 VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED
900 VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED 904 VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED
901 VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE 905 VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE
902 VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED 906 VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
903 VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED 907 VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED
904 VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED 908 VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED
905 VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript; 909 VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript;
@@ -910,5 +914,20 @@ namespace OpenSim.Region.CoreModules.World.Land
910 VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED 914 VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
911 VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED 915 VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED
912 } 916 }
917
918 #region console commands
919 public void FixPhantoms(string module, string[] cmdparams)
920 {
921 List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
922 foreach (Scene s in scenes)
923 {
924 s.ForEachSOG(delegate(SceneObjectGroup e)
925 {
926 e.AbsolutePosition = e.AbsolutePosition;
927 }
928 );
929 }
930 }
931 #endregion
913 } 932 }
914} 933}
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index f360577..a9e0b7f 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
103 //private uint PERM_MODIFY = (uint)16384; 103 //private uint PERM_MODIFY = (uint)16384;
104 private uint PERM_MOVE = (uint)524288; 104 private uint PERM_MOVE = (uint)524288;
105 private uint PERM_TRANS = (uint)8192; 105 private uint PERM_TRANS = (uint)8192;
106 private uint PERM_LOCKED = (uint)540672; 106 private uint PERM_LOCKED = (uint)540672;
107 107
108 /// <value> 108 /// <value>
109 /// Different user set names that come in from the configuration file. 109 /// Different user set names that come in from the configuration file.
@@ -114,7 +114,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
114 Administrators 114 Administrators
115 }; 115 };
116 116
117 #endregion 117 #endregion
118 118
119 #region Bypass Permissions / Debug Permissions Stuff 119 #region Bypass Permissions / Debug Permissions Stuff
120 120
@@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
136 /// <value> 136 /// <value>
137 /// The set of users that are allowed to edit (save) scripts. This is only active if 137 /// The set of users that are allowed to edit (save) scripts. This is only active if
138 /// permissions are not being bypassed. This overrides normal permissions.- 138 /// permissions are not being bypassed. This overrides normal permissions.-
139 /// </value> 139 /// </value>
140 private UserSet m_allowedScriptEditors = UserSet.All; 140 private UserSet m_allowedScriptEditors = UserSet.All;
141 141
142 private Dictionary<string, bool> GrantLSL = new Dictionary<string, bool>(); 142 private Dictionary<string, bool> GrantLSL = new Dictionary<string, bool>();
@@ -190,7 +190,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
190 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 190 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
191 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED 191 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED
192 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED 192 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED
193 m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED 193 m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED
194 m_scene.Permissions.OnInstantMessage += CanInstantMessage; 194 m_scene.Permissions.OnInstantMessage += CanInstantMessage;
195 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED 195 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED
196 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED 196 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED
@@ -210,12 +210,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
210 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED 210 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED
211 211
212 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED 212 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED
213 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED 213 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED
214 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED 214 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED
215 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED 215 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED
216 216
217 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE 217 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE
218 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED 218 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
219 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED 219 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED
220 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED 220 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED
221 m_scene.Permissions.OnResetScript += CanResetScript; 221 m_scene.Permissions.OnResetScript += CanResetScript;
@@ -249,7 +249,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
249 foreach (string uuidl in grant.Split(',')) { 249 foreach (string uuidl in grant.Split(',')) {
250 string uuid = uuidl.Trim(" \t".ToCharArray()); 250 string uuid = uuidl.Trim(" \t".ToCharArray());
251 GrantLSL.Add(uuid, true); 251 GrantLSL.Add(uuid, true);
252 } 252 }
253 } 253 }
254 254
255 grant = myConfig.GetString("GrantCS",""); 255 grant = myConfig.GetString("GrantCS","");
@@ -431,7 +431,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
431 m_log.ErrorFormat( 431 m_log.ErrorFormat(
432 "[PERMISSIONS]: {0} is not a valid {1} value, setting to {2}", 432 "[PERMISSIONS]: {0} is not a valid {1} value, setting to {2}",
433 rawSetting, settingName, userSet); 433 rawSetting, settingName, userSet);
434 } 434 }
435 435
436 m_log.DebugFormat("[PERMISSIONS]: {0} {1}", settingName, userSet); 436 m_log.DebugFormat("[PERMISSIONS]: {0} {1}", settingName, userSet);
437 437
@@ -942,7 +942,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
942 if (m_bypassPermissions) return m_bypassPermissionsValue; 942 if (m_bypassPermissions) return m_bypassPermissionsValue;
943 943
944 if (m_allowedScriptEditors == UserSet.Administrators && !IsAdministrator(user)) 944 if (m_allowedScriptEditors == UserSet.Administrators && !IsAdministrator(user))
945 return false; 945 return false;
946 946
947 // Ordinarily, if you can view it, you can edit it 947 // Ordinarily, if you can view it, you can edit it
948 // There is no viewing a no mod script 948 // There is no viewing a no mod script
@@ -957,7 +957,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
957 /// <param name="objectID"></param> 957 /// <param name="objectID"></param>
958 /// <param name="user"></param> 958 /// <param name="user"></param>
959 /// <param name="scene"></param> 959 /// <param name="scene"></param>
960 /// <returns></returns> 960 /// <returns></returns>
961 private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene) 961 private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene)
962 { 962 {
963 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 963 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1377,11 +1377,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1377 /// <param name="objectID"></param> 1377 /// <param name="objectID"></param>
1378 /// <param name="user"></param> 1378 /// <param name="user"></param>
1379 /// <param name="scene"></param> 1379 /// <param name="scene"></param>
1380 /// <returns></returns> 1380 /// <returns></returns>
1381 private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene) 1381 private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene)
1382 { 1382 {
1383 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1383 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1384 if (m_bypassPermissions) return m_bypassPermissionsValue; 1384 if (m_bypassPermissions) return m_bypassPermissionsValue;
1385 1385
1386 if (objectID == UUID.Zero) // User inventory 1386 if (objectID == UUID.Zero) // User inventory
1387 { 1387 {
@@ -1472,7 +1472,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1472 /// <param name="objectID"></param> 1472 /// <param name="objectID"></param>
1473 /// <param name="user"></param> 1473 /// <param name="user"></param>
1474 /// <param name="scene"></param> 1474 /// <param name="scene"></param>
1475 /// <returns></returns> 1475 /// <returns></returns>
1476 private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, Scene scene) 1476 private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, Scene scene)
1477 { 1477 {
1478 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1478 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1609,7 +1609,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1609 /// </summary> 1609 /// </summary>
1610 /// <param name="invType"></param> 1610 /// <param name="invType"></param>
1611 /// <param name="userID"></param> 1611 /// <param name="userID"></param>
1612 /// <returns></returns> 1612 /// <returns></returns>
1613 private bool CanCreateUserInventory(int invType, UUID userID) 1613 private bool CanCreateUserInventory(int invType, UUID userID)
1614 { 1614 {
1615 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1615 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1619,7 +1619,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1619 if (m_allowedScriptCreators == UserSet.Administrators && !IsAdministrator(userID)) 1619 if (m_allowedScriptCreators == UserSet.Administrators && !IsAdministrator(userID))
1620 return false; 1620 return false;
1621 1621
1622 return true; 1622 return true;
1623 } 1623 }
1624 1624
1625 /// <summary> 1625 /// <summary>
@@ -1627,27 +1627,27 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1627 /// </summary> 1627 /// </summary>
1628 /// <param name="itemID"></param> 1628 /// <param name="itemID"></param>
1629 /// <param name="userID"></param> 1629 /// <param name="userID"></param>
1630 /// <returns></returns> 1630 /// <returns></returns>
1631 private bool CanCopyUserInventory(UUID itemID, UUID userID) 1631 private bool CanCopyUserInventory(UUID itemID, UUID userID)
1632 { 1632 {
1633 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1633 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1634 if (m_bypassPermissions) return m_bypassPermissionsValue; 1634 if (m_bypassPermissions) return m_bypassPermissionsValue;
1635 1635
1636 return true; 1636 return true;
1637 } 1637 }
1638 1638
1639 /// <summary> 1639 /// <summary>
1640 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. 1640 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
1641 /// </summary> 1641 /// </summary>
1642 /// <param name="itemID"></param> 1642 /// <param name="itemID"></param>
1643 /// <param name="userID"></param> 1643 /// <param name="userID"></param>
1644 /// <returns></returns> 1644 /// <returns></returns>
1645 private bool CanEditUserInventory(UUID itemID, UUID userID) 1645 private bool CanEditUserInventory(UUID itemID, UUID userID)
1646 { 1646 {
1647 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1647 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1648 if (m_bypassPermissions) return m_bypassPermissionsValue; 1648 if (m_bypassPermissions) return m_bypassPermissionsValue;
1649 1649
1650 return true; 1650 return true;
1651 } 1651 }
1652 1652
1653 /// <summary> 1653 /// <summary>
@@ -1655,14 +1655,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1655 /// </summary> 1655 /// </summary>
1656 /// <param name="itemID"></param> 1656 /// <param name="itemID"></param>
1657 /// <param name="userID"></param> 1657 /// <param name="userID"></param>
1658 /// <returns></returns> 1658 /// <returns></returns>
1659 private bool CanDeleteUserInventory(UUID itemID, UUID userID) 1659 private bool CanDeleteUserInventory(UUID itemID, UUID userID)
1660 { 1660 {
1661 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1661 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1662 if (m_bypassPermissions) return m_bypassPermissionsValue; 1662 if (m_bypassPermissions) return m_bypassPermissionsValue;
1663 1663
1664 return true; 1664 return true;
1665 } 1665 }
1666 1666
1667 private bool CanTeleport(UUID userID, Scene scene) 1667 private bool CanTeleport(UUID userID, Scene scene)
1668 { 1668 {
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
index e0331d3..58e4261 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
@@ -153,7 +153,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
153 public void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) 153 public void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName)
154 { 154 {
155 SceneXmlLoader.SaveNamedPrimsToXml2(scene, primName, fileName); 155 SceneXmlLoader.SaveNamedPrimsToXml2(scene, primName, fileName);
156 } 156 }
157 157
158 public SceneObjectGroup DeserializeGroupFromXml2(string xmlString) 158 public SceneObjectGroup DeserializeGroupFromXml2(string xmlString)
159 { 159 {
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
index 373b6ab..799a448 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
238 { 238 {
239 m_serialiserModule = new SerialiserModule(); 239 m_serialiserModule = new SerialiserModule();
240 m_scene = SceneSetupHelpers.SetupScene(""); 240 m_scene = SceneSetupHelpers.SetupScene("");
241 SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); 241 SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule);
242 } 242 }
243 243
244 [Test] 244 [Test]
@@ -299,7 +299,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
299 continue; 299 continue;
300 300
301 switch (xtr.Name) 301 switch (xtr.Name)
302 { 302 {
303 case "UUID": 303 case "UUID":
304 xtr.ReadStartElement("UUID"); 304 xtr.ReadStartElement("UUID");
305 uuid = UUID.Parse(xtr.ReadElementString("Guid")); 305 uuid = UUID.Parse(xtr.ReadElementString("Guid"));
@@ -311,7 +311,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
311 case "CreatorID": 311 case "CreatorID":
312 xtr.ReadStartElement("CreatorID"); 312 xtr.ReadStartElement("CreatorID");
313 creatorId = UUID.Parse(xtr.ReadElementString("Guid")); 313 creatorId = UUID.Parse(xtr.ReadElementString("Guid"));
314 xtr.ReadEndElement(); 314 xtr.ReadEndElement();
315 break; 315 break;
316 } 316 }
317 } 317 }
@@ -325,8 +325,8 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
325 // TODO: More checks 325 // TODO: More checks
326 Assert.That(uuid, Is.EqualTo(rpUuid)); 326 Assert.That(uuid, Is.EqualTo(rpUuid));
327 Assert.That(name, Is.EqualTo(rpName)); 327 Assert.That(name, Is.EqualTo(rpName));
328 Assert.That(creatorId, Is.EqualTo(rpCreatorId)); 328 Assert.That(creatorId, Is.EqualTo(rpCreatorId));
329 } 329 }
330 330
331 [Test] 331 [Test]
332 public void TestDeserializeXml2() 332 public void TestDeserializeXml2()
@@ -372,7 +372,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
372 string xml2 = m_serialiserModule.SerializeGroupToXml2(so); 372 string xml2 = m_serialiserModule.SerializeGroupToXml2(so);
373 373
374 XmlTextReader xtr = new XmlTextReader(new StringReader(xml2)); 374 XmlTextReader xtr = new XmlTextReader(new StringReader(xml2));
375 xtr.ReadStartElement("SceneObjectGroup"); 375 xtr.ReadStartElement("SceneObjectGroup");
376 xtr.ReadStartElement("SceneObjectPart"); 376 xtr.ReadStartElement("SceneObjectPart");
377 377
378 UUID uuid = UUID.Zero; 378 UUID uuid = UUID.Zero;
@@ -385,7 +385,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
385 continue; 385 continue;
386 386
387 switch (xtr.Name) 387 switch (xtr.Name)
388 { 388 {
389 case "UUID": 389 case "UUID":
390 xtr.ReadStartElement("UUID"); 390 xtr.ReadStartElement("UUID");
391 uuid = UUID.Parse(xtr.ReadElementString("Guid")); 391 uuid = UUID.Parse(xtr.ReadElementString("Guid"));
@@ -397,7 +397,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
397 case "CreatorID": 397 case "CreatorID":
398 xtr.ReadStartElement("CreatorID"); 398 xtr.ReadStartElement("CreatorID");
399 creatorId = UUID.Parse(xtr.ReadElementString("Guid")); 399 creatorId = UUID.Parse(xtr.ReadElementString("Guid"));
400 xtr.ReadEndElement(); 400 xtr.ReadEndElement();
401 break; 401 break;
402 } 402 }
403 } 403 }
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index 6cc0ed9..37f1f2e 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -33,9 +33,9 @@ using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34 34
35namespace OpenSim.Region.CoreModules.World.Sound 35namespace OpenSim.Region.CoreModules.World.Sound
36{ 36{
37 public class SoundModule : IRegionModule, ISoundModule 37 public class SoundModule : IRegionModule, ISoundModule
38 { 38 {
39 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 40
41 protected Scene m_scene; 41 protected Scene m_scene;
@@ -68,11 +68,11 @@ namespace OpenSim.Region.CoreModules.World.Sound
68 if (dis > 100.0) // Max audio distance 68 if (dis > 100.0) // Max audio distance
69 continue; 69 continue;
70 70
71 // Scale by distance 71 // Scale by distance
72 gain = (float)((double)gain*((100.0 - dis) / 100.0)); 72 gain = (float)((double)gain*((100.0 - dis) / 100.0));
73 73
74 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); 74 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
75 } 75 }
76 } 76 }
77 77
78 public virtual void TriggerSound( 78 public virtual void TriggerSound(
@@ -84,12 +84,12 @@ namespace OpenSim.Region.CoreModules.World.Sound
84 if (dis > 100.0) // Max audio distance 84 if (dis > 100.0) // Max audio distance
85 continue; 85 continue;
86 86
87 // Scale by distance 87 // Scale by distance
88 gain = (float)((double)gain*((100.0 - dis) / 100.0)); 88 gain = (float)((double)gain*((100.0 - dis) / 100.0));
89 89
90 p.ControllingClient.SendTriggeredSound( 90 p.ControllingClient.SendTriggeredSound(
91 soundId, ownerID, objectID, parentID, handle, position, (float)gain); 91 soundId, ownerID, objectID, parentID, handle, position, (float)gain);
92 } 92 }
93 } 93 }
94 } 94 }
95} 95}
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index aa38c09..0712a7f 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -322,7 +322,7 @@ namespace OpenSim.Region.CoreModules
322 m_DayLengthHours = config.Configs["Sun"].GetDouble("day_length", d_day_length); 322 m_DayLengthHours = config.Configs["Sun"].GetDouble("day_length", d_day_length);
323 323
324 // Horizon shift, this is used to shift the sun's orbit, this affects the day / night ratio 324 // Horizon shift, this is used to shift the sun's orbit, this affects the day / night ratio
325 // must hard code to ~.5 to match sun position in LL based viewers 325 // must hard code to ~.5 to match sun position in LL based viewers
326 m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night); 326 m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night);
327 327
328 328
@@ -494,7 +494,7 @@ namespace OpenSim.Region.CoreModules
494 receivedEstateToolsSunUpdate = true; 494 receivedEstateToolsSunUpdate = true;
495 495
496 // Generate shared values 496 // Generate shared values
497 GenSunPos(); 497 GenSunPos();
498 498
499 // When sun settings are updated, we should update all clients with new settings. 499 // When sun settings are updated, we should update all clients with new settings.
500 SunUpdateToAllClients(); 500 SunUpdateToAllClients();
diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
index a09315a..c2ad7b8 100644
--- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
+++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
43 protected Scene m_scene; 43 protected Scene m_scene;
44 44
45 protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree }; 45 protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree };
46 public PCode[] CreationCapabilities { get { return creationCapabilities; } } 46 public PCode[] CreationCapabilities { get { return creationCapabilities; } }
47 47
48 public void Initialise(Scene scene, IConfigSource source) 48 public void Initialise(Scene scene, IConfigSource source)
49 { 49 {
@@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
73 UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) 73 UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
74 { 74 {
75 if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0) 75 if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0)
76 { 76 {
77 m_log.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name); 77 m_log.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name);
78 return null; 78 return null;
79 } 79 }
@@ -111,6 +111,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
111 tree.Scale = new Vector3(4, 4, 4); 111 tree.Scale = new Vector3(4, 4, 4);
112 break; 112 break;
113 } 113 }
114 } 114 }
115 } 115 }
116} 116}
diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs
index 41d2071..9d47e19 100644
--- a/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Region.CoreModules.World.Wind.Plugins
46 46
47 private float m_avgStrength = 5.0f; // Average magnitude of the wind vector 47 private float m_avgStrength = 5.0f; // Average magnitude of the wind vector
48 private float m_avgDirection = 0.0f; // Average direction of the wind in degrees 48 private float m_avgDirection = 0.0f; // Average direction of the wind in degrees
49 private float m_varStrength = 5.0f; // Max Strength Variance 49 private float m_varStrength = 5.0f; // Max Strength Variance
50 private float m_varDirection = 30.0f;// Max Direction Variance 50 private float m_varDirection = 30.0f;// Max Direction Variance
51 private float m_rateChange = 1.0f; // 51 private float m_rateChange = 1.0f; //
52 52
@@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Wind.Plugins
141 { 141 {
142 m_windSpeeds[y * 16 + x] = m_curPredominateWind; 142 m_windSpeeds[y * 16 + x] = m_curPredominateWind;
143 } 143 }
144 } 144 }
145 } 145 }
146 146
147 public Vector3 WindSpeed(float fX, float fY, float fZ) 147 public Vector3 WindSpeed(float fX, float fY, float fZ)
diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs
index 2c371da..071e20b 100644
--- a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Region.CoreModules.World.Wind.Plugins
95 m_windSpeeds[y * 16 + x].Y *= m_strength; 95 m_windSpeeds[y * 16 + x].Y *= m_strength;
96 } 96 }
97 } 97 }
98 } 98 }
99 } 99 }
100 100
101 public Vector3 WindSpeed(float fX, float fY, float fZ) 101 public Vector3 WindSpeed(float fX, float fY, float fZ)
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index b442f6f..3283c1f 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -418,7 +418,7 @@ namespace OpenSim.Region.CoreModules
418 } 418 }
419 419
420 avatar.ControllingClient.SendWindData(windSpeeds); 420 avatar.ControllingClient.SendWindData(windSpeeds);
421 } 421 }
422 } 422 }
423 423
424 private void SendWindAllClients() 424 private void SendWindAllClients()
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index 4783b35..436f332 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -33,6 +33,8 @@ using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Region.Framework.Scenes.Hypergrid; 35using OpenSim.Region.Framework.Scenes.Hypergrid;
36using OpenSim.Services.Interfaces;
37using GridRegion = OpenSim.Services.Interfaces.GridRegion;
36 38
37namespace OpenSim.Region.CoreModules.World.WorldMap 39namespace OpenSim.Region.CoreModules.World.WorldMap
38{ 40{
@@ -92,13 +94,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
92 } 94 }
93 95
94 // try to fetch from GridServer 96 // try to fetch from GridServer
95 List<RegionInfo> regionInfos = m_scene.SceneGridService.RequestNamedRegions(mapName, 20); 97 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(UUID.Zero, mapName, 20);
96 if (regionInfos == null) 98 if (regionInfos == null)
97 { 99 {
98 m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?"); 100 m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?");
99 // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region 101 // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region
100 regionInfos = new List<RegionInfo>(); 102 regionInfos = new List<GridRegion>();
101 RegionInfo info = m_scene.SceneGridService.RequestClosestRegion(mapName); 103 GridRegion info = m_scene.GridService.GetRegionByName(UUID.Zero, mapName);
102 if (info != null) regionInfos.Add(info); 104 if (info != null) regionInfos.Add(info);
103 } 105 }
104 106
@@ -109,11 +111,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
109 if (mapName.Contains(".") && mapName.Contains(":")) 111 if (mapName.Contains(".") && mapName.Contains(":"))
110 { 112 {
111 // It probably is a domain name. Try to link to it. 113 // It probably is a domain name. Try to link to it.
112 RegionInfo regInfo; 114 GridRegion regInfo;
113 Scene cScene = GetClientScene(remoteClient); 115 Scene cScene = GetClientScene(remoteClient);
114 regInfo = HGHyperlink.TryLinkRegion(cScene, remoteClient, mapName); 116 IHyperlinkService hyperService = cScene.RequestModuleInterface<IHyperlinkService>();
115 if (regInfo != null) 117 if (hyperService != null)
116 regionInfos.Add(regInfo); 118 {
119 regInfo = hyperService.TryLinkRegion(remoteClient, mapName);
120 if (regInfo != null)
121 regionInfos.Add(regInfo);
122 }
117 } 123 }
118 } 124 }
119 125
@@ -122,17 +128,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
122 MapBlockData data; 128 MapBlockData data;
123 if (regionInfos.Count > 0) 129 if (regionInfos.Count > 0)
124 { 130 {
125 foreach (RegionInfo info in regionInfos) 131 foreach (GridRegion info in regionInfos)
126 { 132 {
127 data = new MapBlockData(); 133 data = new MapBlockData();
128 data.Agents = 0; 134 data.Agents = 0;
129 data.Access = info.AccessLevel; 135 data.Access = info.Access;
130 data.MapImageId = info.RegionSettings.TerrainImageID; 136 data.MapImageId = info.TerrainImage;
131 data.Name = info.RegionName; 137 data.Name = info.RegionName;
132 data.RegionFlags = 0; // TODO not used? 138 data.RegionFlags = 0; // TODO not used?
133 data.WaterHeight = 0; // not used 139 data.WaterHeight = 0; // not used
134 data.X = (ushort)info.RegionLocX; 140 data.X = (ushort)(info.RegionLocX / Constants.RegionSize);
135 data.Y = (ushort)info.RegionLocY; 141 data.Y = (ushort)(info.RegionLocY / Constants.RegionSize);
136 blocks.Add(data); 142 blocks.Add(data);
137 } 143 }
138 } 144 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 1f25f28..05ed70a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -48,6 +48,7 @@ using OpenSim.Region.Framework.Scenes;
48using Caps=OpenSim.Framework.Capabilities.Caps; 48using Caps=OpenSim.Framework.Capabilities.Caps;
49using OSDArray=OpenMetaverse.StructuredData.OSDArray; 49using OSDArray=OpenMetaverse.StructuredData.OSDArray;
50using OSDMap=OpenMetaverse.StructuredData.OSDMap; 50using OSDMap=OpenMetaverse.StructuredData.OSDMap;
51using GridRegion = OpenSim.Services.Interfaces.GridRegion;
51 52
52namespace OpenSim.Region.CoreModules.World.WorldMap 53namespace OpenSim.Region.CoreModules.World.WorldMap
53{ 54{
@@ -232,10 +233,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
232 } 233 }
233 if (lookup) 234 if (lookup)
234 { 235 {
235 List<MapBlockData> mapBlocks; 236 List<MapBlockData> mapBlocks = new List<MapBlockData>(); ;
236 237
237 mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)m_scene.RegionInfo.RegionLocX - 8, (int)m_scene.RegionInfo.RegionLocY - 8, (int)m_scene.RegionInfo.RegionLocX + 8, (int)m_scene.RegionInfo.RegionLocY + 8); 238 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
238 avatarPresence.ControllingClient.SendMapBlock(mapBlocks,0); 239 (int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize,
240 (int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize,
241 (int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize,
242 (int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize);
243 foreach (GridRegion r in regions)
244 {
245 MapBlockData block = new MapBlockData();
246 MapBlockFromGridRegion(block, r);
247 mapBlocks.Add(block);
248 }
249 avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
239 250
240 lock (cachedMapBlocks) 251 lock (cachedMapBlocks)
241 cachedMapBlocks = mapBlocks; 252 cachedMapBlocks = mapBlocks;
@@ -579,7 +590,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
579 } 590 }
580 if (httpserver.Length == 0) 591 if (httpserver.Length == 0)
581 { 592 {
582 RegionInfo mreg = m_scene.SceneGridService.RequestNeighbouringRegionInfo(regionhandle); 593 uint x = 0, y = 0;
594 Utils.LongToUInts(regionhandle, out x, out y);
595 GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
583 596
584 if (mreg != null) 597 if (mreg != null)
585 { 598 {
@@ -719,15 +732,25 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
719 { 732 {
720 List<MapBlockData> response = new List<MapBlockData>(); 733 List<MapBlockData> response = new List<MapBlockData>();
721 734
722 // this should return one mapblock at most. But make sure: Look whether the one we requested is in there 735 // this should return one mapblock at most.
723 List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); 736 // (diva note: why?? in that case we should GetRegionByPosition)
724 if (mapBlocks != null) 737 // But make sure: Look whether the one we requested is in there
738 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
739 minX * (int)Constants.RegionSize,
740 maxX * (int)Constants.RegionSize,
741 minY * (int)Constants.RegionSize,
742 maxY * (int)Constants.RegionSize);
743
744 if (regions != null)
725 { 745 {
726 foreach (MapBlockData block in mapBlocks) 746 foreach (GridRegion r in regions)
727 { 747 {
728 if (block.X == minX && block.Y == minY) 748 if ((r.RegionLocX == minX * (int)Constants.RegionSize) &&
749 (r.RegionLocY == minY * (int)Constants.RegionSize))
729 { 750 {
730 // found it => add it to response 751 // found it => add it to response
752 MapBlockData block = new MapBlockData();
753 MapBlockFromGridRegion(block, r);
731 response.Add(block); 754 response.Add(block);
732 break; 755 break;
733 } 756 }
@@ -754,10 +777,30 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
754 777
755 protected virtual void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 778 protected virtual void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
756 { 779 {
757 List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); 780 List<MapBlockData> mapBlocks = new List<MapBlockData>();
781 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
782 (minX - 4) * (int)Constants.RegionSize,
783 (maxX + 4) * (int)Constants.RegionSize,
784 (minY - 4) * (int)Constants.RegionSize,
785 (maxY + 4) * (int)Constants.RegionSize);
786 foreach (GridRegion r in regions)
787 {
788 MapBlockData block = new MapBlockData();
789 MapBlockFromGridRegion(block, r);
790 mapBlocks.Add(block);
791 }
758 remoteClient.SendMapBlock(mapBlocks, flag); 792 remoteClient.SendMapBlock(mapBlocks, flag);
759 } 793 }
760 794
795 protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r)
796 {
797 block.Access = r.Access;
798 block.MapImageId = r.TerrainImage;
799 block.Name = r.RegionName;
800 block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
801 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
802 }
803
761 public Hashtable OnHTTPGetMapImage(Hashtable keysvals) 804 public Hashtable OnHTTPGetMapImage(Hashtable keysvals)
762 { 805 {
763 m_log.Debug("[WORLD MAP]: Sending map image jpeg"); 806 m_log.Debug("[WORLD MAP]: Sending map image jpeg");
@@ -874,31 +917,34 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
874 m_log.InfoFormat( 917 m_log.InfoFormat(
875 "[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath); 918 "[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath);
876 919
877 List<MapBlockData> mapBlocks = 920 List<MapBlockData> mapBlocks = new List<MapBlockData>();
878 m_scene.CommsManager.GridService.RequestNeighbourMapBlocks( 921 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
879 (int)(m_scene.RegionInfo.RegionLocX - 9), 922 (int)(m_scene.RegionInfo.RegionLocX - 9) * (int)Constants.RegionSize,
880 (int)(m_scene.RegionInfo.RegionLocY - 9), 923 (int)(m_scene.RegionInfo.RegionLocX + 9) * (int)Constants.RegionSize,
881 (int)(m_scene.RegionInfo.RegionLocX + 9), 924 (int)(m_scene.RegionInfo.RegionLocY - 9) * (int)Constants.RegionSize,
882 (int)(m_scene.RegionInfo.RegionLocY + 9)); 925 (int)(m_scene.RegionInfo.RegionLocY + 9) * (int)Constants.RegionSize);
883 List<AssetBase> textures = new List<AssetBase>(); 926 List<AssetBase> textures = new List<AssetBase>();
884 List<Image> bitImages = new List<Image>(); 927 List<Image> bitImages = new List<Image>();
885 928
886 foreach (MapBlockData mapBlock in mapBlocks) 929 foreach (GridRegion r in regions)
887 { 930 {
931 MapBlockData mapBlock = new MapBlockData();
932 MapBlockFromGridRegion(mapBlock, r);
888 AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); 933 AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
889 934
890 if (texAsset != null) 935 if (texAsset != null)
891 { 936 {
892 textures.Add(texAsset); 937 textures.Add(texAsset);
893 } 938 }
894 else 939 //else
895 { 940 //{
896 texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); 941 // // WHAT?!? This doesn't seem right. Commenting (diva)
897 if (texAsset != null) 942 // texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
898 { 943 // if (texAsset != null)
899 textures.Add(texAsset); 944 // {
900 } 945 // textures.Add(texAsset);
901 } 946 // }
947 //}
902 } 948 }
903 949
904 foreach (AssetBase asset in textures) 950 foreach (AssetBase asset in textures)
diff --git a/OpenSim/Region/DataSnapshot/EstateSnapshot.cs b/OpenSim/Region/DataSnapshot/EstateSnapshot.cs
index b45b923..5fff89f 100644
--- a/OpenSim/Region/DataSnapshot/EstateSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/EstateSnapshot.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
67 67
68 if (userInfo != null) 68 if (userInfo != null)
69 { 69 {
70 UserProfileData userProfile = userInfo.UserProfile; 70 UserProfileData userProfile = userInfo.UserProfile;
71 firstname = userProfile.FirstName; 71 firstname = userProfile.FirstName;
72 lastname = userProfile.SurName; 72 lastname = userProfile.SurName;
73 73
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index e9c35e9..f4526ae 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -789,7 +789,7 @@ namespace OpenSim.Region.Examples.SimpleModule
789 789
790 public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks) 790 public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
791 { 791 {
792 } 792 }
793 793
794 public void SendViewerTime(int phase) 794 public void SendViewerTime(int phase)
795 { 795 {
diff --git a/OpenSim/Region/Framework/Interfaces/IAgentAssetTransactions.cs b/OpenSim/Region/Framework/Interfaces/IAgentAssetTransactions.cs
index c1ed1ac..0cc8fb6 100644
--- a/OpenSim/Region/Framework/Interfaces/IAgentAssetTransactions.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAgentAssetTransactions.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Interfaces
41 sbyte type, byte wearableType, uint nextOwnerMask); 41 sbyte type, byte wearableType, uint nextOwnerMask);
42 42
43 void HandleTaskItemUpdateFromTransaction( 43 void HandleTaskItemUpdateFromTransaction(
44 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item); 44 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item);
45 45
46 void RemoveAgentAssetTransactions(UUID userID); 46 void RemoveAgentAssetTransactions(UUID userID);
47 } 47 }
diff --git a/OpenSim/Region/Framework/Interfaces/ICommander.cs b/OpenSim/Region/Framework/Interfaces/ICommander.cs
index 9371bea..6b872c1 100644
--- a/OpenSim/Region/Framework/Interfaces/ICommander.cs
+++ b/OpenSim/Region/Framework/Interfaces/ICommander.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Region.Framework.Interfaces
33 { 33 {
34 /// <value> 34 /// <value>
35 /// The name of this commander 35 /// The name of this commander
36 /// </value> 36 /// </value>
37 string Name { get; } 37 string Name { get; }
38 38
39 /// <value> 39 /// <value>
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Interfaces
44 /// <summary> 44 /// <summary>
45 /// The commands available for this commander 45 /// The commands available for this commander
46 /// </summary> 46 /// </summary>
47 Dictionary<string, ICommand> Commands { get; } 47 Dictionary<string, ICommand> Commands { get; }
48 48
49 void ProcessConsoleCommand(string function, string[] args); 49 void ProcessConsoleCommand(string function, string[] args);
50 void RegisterCommand(string commandName, ICommand command); 50 void RegisterCommand(string commandName, ICommand command);
diff --git a/OpenSim/Region/Framework/Interfaces/IDialogModule.cs b/OpenSim/Region/Framework/Interfaces/IDialogModule.cs
index a6ca7f1..ce57c44 100644
--- a/OpenSim/Region/Framework/Interfaces/IDialogModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IDialogModule.cs
@@ -37,15 +37,15 @@ namespace OpenSim.Region.Framework.Interfaces
37 /// small interval. 37 /// small interval.
38 /// </summary> 38 /// </summary>
39 /// <param name="client"></param> 39 /// <param name="client"></param>
40 /// <param name="message"></param> 40 /// <param name="message"></param>
41 void SendAlertToUser(IClientAPI client, string message); 41 void SendAlertToUser(IClientAPI client, string message);
42 42
43 /// <summary> 43 /// <summary>
44 /// Send an alert message to a particular user. 44 /// Send an alert message to a particular user.
45 /// </summary> 45 /// </summary>
46 /// <param name="client"></param> 46 /// <param name="client"></param>
47 /// <param name="message"></param> 47 /// <param name="message"></param>
48 /// <param name="modal"></param> 48 /// <param name="modal"></param>
49 void SendAlertToUser(IClientAPI client, string message, bool modal); 49 void SendAlertToUser(IClientAPI client, string message, bool modal);
50 50
51 /// <summary> 51 /// <summary>
@@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Interfaces
73 void SendAlertToUser(string firstName, string lastName, string message, bool modal); 73 void SendAlertToUser(string firstName, string lastName, string message, bool modal);
74 74
75 /// <summary> 75 /// <summary>
76 /// Send an alert message to all users in the scene. 76 /// Send an alert message to all users in the scene.
77 /// </summary> 77 /// </summary>
78 /// <param name="message"></param> 78 /// <param name="message"></param>
79 void SendGeneralAlert(string message); 79 void SendGeneralAlert(string message);
@@ -104,7 +104,7 @@ namespace OpenSim.Region.Framework.Interfaces
104 /// <param name="message"></param> 104 /// <param name="message"></param>
105 /// <param name="url"></param> 105 /// <param name="url"></param>
106 void SendUrlToUser( 106 void SendUrlToUser(
107 UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url); 107 UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url);
108 108
109 /// <summary> 109 /// <summary>
110 /// Send a notification to all users in the scene. This notification should remain around until the 110 /// Send a notification to all users in the scene. This notification should remain around until the
@@ -116,7 +116,7 @@ namespace OpenSim.Region.Framework.Interfaces
116 /// 116 ///
117 /// <param name="fromAvatarID">The user sending the message</param> 117 /// <param name="fromAvatarID">The user sending the message</param>
118 /// <param name="fromAvatarName">The name of the user doing the sending</param> 118 /// <param name="fromAvatarName">The name of the user doing the sending</param>
119 /// <param name="message">The message being sent to the user</param> 119 /// <param name="message">The message being sent to the user</param>
120 void SendNotificationToUsersInRegion(UUID fromAvatarID, string fromAvatarName, string message); 120 void SendNotificationToUsersInRegion(UUID fromAvatarID, string fromAvatarName, string message);
121 121
122 /// <summary> 122 /// <summary>
@@ -129,7 +129,7 @@ namespace OpenSim.Region.Framework.Interfaces
129 /// 129 ///
130 /// <param name="fromAvatarID">The user sending the message</param> 130 /// <param name="fromAvatarID">The user sending the message</param>
131 /// <param name="fromAvatarName">The name of the user doing the sending</param> 131 /// <param name="fromAvatarName">The name of the user doing the sending</param>
132 /// <param name="message">The message being sent to the user</param> 132 /// <param name="message">The message being sent to the user</param>
133 void SendNotificationToUsersInEstate(UUID fromAvatarID, string fromAvatarName, string message); 133 void SendNotificationToUsersInEstate(UUID fromAvatarID, string fromAvatarName, string message);
134 } 134 }
135} 135}
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityCreator.cs b/OpenSim/Region/Framework/Interfaces/IEntityCreator.cs
index f3a3747..c39627c 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityCreator.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityCreator.cs
@@ -29,13 +29,13 @@ using OpenMetaverse;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenSim.Region.Framework.Scenes; 30using OpenSim.Region.Framework.Scenes;
31 31
32namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
33{ 33{
34 /// <summary> 34 /// <summary>
35 /// Interface to a class that is capable of creating entities 35 /// Interface to a class that is capable of creating entities
36 /// </summary> 36 /// </summary>
37 public interface IEntityCreator 37 public interface IEntityCreator
38 { 38 {
39 /// <summary> 39 /// <summary>
40 /// The entities that this class is capable of creating. These match the PCode format. 40 /// The entities that this class is capable of creating. These match the PCode format.
41 /// </summary> 41 /// </summary>
@@ -51,6 +51,6 @@ namespace OpenSim.Region.Framework.Interfaces
51 /// <param name="rot"></param> 51 /// <param name="rot"></param>
52 /// <param name="shape"></param> 52 /// <param name="shape"></param>
53 /// <returns>The entity created, or null if the creation failed</returns> 53 /// <returns>The entity created, or null if the creation failed</returns>
54 SceneObjectGroup CreateEntity(UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape); 54 SceneObjectGroup CreateEntity(UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape);
55 } 55 }
56} 56}
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 1ed92fb..2c906a2 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Interfaces
64 /// <summary> 64 /// <summary>
65 /// Change every item in this inventory to a new group. 65 /// Change every item in this inventory to a new group.
66 /// </summary> 66 /// </summary>
67 /// <param name="groupID"></param> 67 /// <param name="groupID"></param>
68 void ChangeInventoryGroup(UUID groupID); 68 void ChangeInventoryGroup(UUID groupID);
69 69
70 /// <summary> 70 /// <summary>
@@ -94,7 +94,7 @@ namespace OpenSim.Region.Framework.Interfaces
94 /// <param name="startParam"></param> 94 /// <param name="startParam"></param>
95 /// <param name="postOnRez"></param> 95 /// <param name="postOnRez"></param>
96 /// <param name="engine"></param> 96 /// <param name="engine"></param>
97 /// <param name="stateSource"></param> 97 /// <param name="stateSource"></param>
98 void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource); 98 void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource);
99 99
100 /// <summary> 100 /// <summary>
@@ -150,7 +150,7 @@ namespace OpenSim.Region.Framework.Interfaces
150 150
151 /// <summary> 151 /// <summary>
152 /// Return the name with which a client can request a xfer of this prim's inventory metadata 152 /// Return the name with which a client can request a xfer of this prim's inventory metadata
153 /// </summary> 153 /// </summary>
154 string GetInventoryFileName(); 154 string GetInventoryFileName();
155 155
156 bool GetInventoryFileName(IClientAPI client, uint localID); 156 bool GetInventoryFileName(IClientAPI client, uint localID);
diff --git a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
index af54c76..7a8aba2 100644
--- a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs
@@ -29,7 +29,7 @@ using OpenMetaverse;
29using OpenSim.Framework; 29using OpenSim.Framework;
30 30
31namespace OpenSim.Region.Framework.Interfaces 31namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public interface IFriendsModule 33 public interface IFriendsModule
34 { 34 {
35 /// <summary> 35 /// <summary>
@@ -43,7 +43,7 @@ namespace OpenSim.Region.Framework.Interfaces
43 /// FIXME: This is somewhat too tightly coupled - it should arguably be possible to offer friendships even if the 43 /// FIXME: This is somewhat too tightly coupled - it should arguably be possible to offer friendships even if the
44 /// receiving user is not currently online. 44 /// receiving user is not currently online.
45 /// </param> 45 /// </param>
46 /// <param name="offerMessage"></param> 46 /// <param name="offerMessage"></param>
47 void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage); 47 void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage);
48 } 48 }
49} 49}
diff --git a/OpenSim/Region/Framework/Interfaces/IGodsModule.cs b/OpenSim/Region/Framework/Interfaces/IGodsModule.cs
index 02abb05..552ce01 100644
--- a/OpenSim/Region/Framework/Interfaces/IGodsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IGodsModule.cs
@@ -29,7 +29,7 @@ using OpenMetaverse;
29using OpenSim.Framework; 29using OpenSim.Framework;
30 30
31namespace OpenSim.Region.Framework.Interfaces 31namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// This interface provides god related methods 34 /// This interface provides god related methods
35 /// </summary> 35 /// </summary>
@@ -53,6 +53,6 @@ namespace OpenSim.Region.Framework.Interfaces
53 /// <param name="agentID">the person that is being kicked</param> 53 /// <param name="agentID">the person that is being kicked</param>
54 /// <param name="kickflags">This isn't used apparently</param> 54 /// <param name="kickflags">This isn't used apparently</param>
55 /// <param name="reason">The message to send to the user after it's been turned into a field</param> 55 /// <param name="reason">The message to send to the user after it's been turned into a field</param>
56 void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason); 56 void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason);
57 } 57 }
58} 58}
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
index 1622564..2d038ce 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
@@ -30,7 +30,7 @@ using System.IO;
30using OpenSim.Framework.Communications.Cache; 30using OpenSim.Framework.Communications.Cache;
31 31
32namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
33{ 33{
34 /// <summary> 34 /// <summary>
35 /// Used for the OnInventoryArchiveSaved event. 35 /// Used for the OnInventoryArchiveSaved event.
36 /// </summary> 36 /// </summary>
@@ -43,11 +43,11 @@ namespace OpenSim.Region.Framework.Interfaces
43 public delegate void InventoryArchiveSaved( 43 public delegate void InventoryArchiveSaved(
44 Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException); 44 Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException);
45 45
46 public interface IInventoryArchiverModule 46 public interface IInventoryArchiverModule
47 { 47 {
48 /// <summary> 48 /// <summary>
49 /// Fired when an archive inventory save has been completed. 49 /// Fired when an archive inventory save has been completed.
50 /// </summary> 50 /// </summary>
51 event InventoryArchiveSaved OnInventoryArchiveSaved; 51 event InventoryArchiveSaved OnInventoryArchiveSaved;
52 52
53 /// <summary> 53 /// <summary>
@@ -69,6 +69,6 @@ namespace OpenSim.Region.Framework.Interfaces
69 /// <param name="invPath">The inventory path from which the inventory should be saved.</param> 69 /// <param name="invPath">The inventory path from which the inventory should be saved.</param>
70 /// <param name="saveStream">The stream to which the inventory archive will be saved</param> 70 /// <param name="saveStream">The stream to which the inventory archive will be saved</param>
71 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> 71 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
72 bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream); 72 bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream);
73 } 73 }
74} 74}
diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs
index 19b8574..74f404f 100644
--- a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs
+++ b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Interfaces
41 /// </summary> 41 /// </summary>
42 /// <param name="x">Value between 0 - 256 on the x axis of the point</param> 42 /// <param name="x">Value between 0 - 256 on the x axis of the point</param>
43 /// <param name="y">Value between 0 - 256 on the y axis of the point</param> 43 /// <param name="y">Value between 0 - 256 on the y axis of the point</param>
44 /// <returns>Land object at the point supplied</returns> 44 /// <returns>Land object at the point supplied</returns>
45 ILandObject GetLandObject(int x, int y); 45 ILandObject GetLandObject(int x, int y);
46 46
47 ILandObject GetLandObject(int localID); 47 ILandObject GetLandObject(int localID);
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Interfaces
51 /// </summary> 51 /// </summary>
52 /// <param name="x">Value between 0 - 256 on the x axis of the point</param> 52 /// <param name="x">Value between 0 - 256 on the x axis of the point</param>
53 /// <param name="y">Value between 0 - 256 on the y axis of the point</param> 53 /// <param name="y">Value between 0 - 256 on the y axis of the point</param>
54 /// <returns>Land object at the point supplied</returns> 54 /// <returns>Land object at the point supplied</returns>
55 ILandObject GetLandObject(float x, float y); 55 ILandObject GetLandObject(float x, float y);
56 56
57 bool IsLandPrimCountTainted(); 57 bool IsLandPrimCountTainted();
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
index 78b5322..9ad2036 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
@@ -52,9 +52,9 @@ namespace OpenSim.Region.Framework.Interfaces
52 /// This method occurs asynchronously. If you want notification of when it has completed then subscribe to 52 /// This method occurs asynchronously. If you want notification of when it has completed then subscribe to
53 /// the EventManager.OnOarFileSaved event. 53 /// the EventManager.OnOarFileSaved event.
54 /// 54 ///
55 /// <param name="savePath"></param> 55 /// <param name="savePath"></param>
56 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param> 56 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param>
57 void ArchiveRegion(string savePath, Guid requestId); 57 void ArchiveRegion(string savePath, Guid requestId);
58 58
59 /// <summary> 59 /// <summary>
60 /// Archive the region to a stream. 60 /// Archive the region to a stream.
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Interfaces
88 /// settings in the archive will be ignored. 88 /// settings in the archive will be ignored.
89 /// </param> 89 /// </param>
90 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param> 90 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param>
91 void DearchiveRegion(string loadPath, bool merge, Guid requestId); 91 void DearchiveRegion(string loadPath, bool merge, Guid requestId);
92 92
93 /// <summary> 93 /// <summary>
94 /// Dearchive a region from a stream. This replaces the existing scene. 94 /// Dearchive a region from a stream. This replaces the existing scene.
@@ -109,8 +109,8 @@ namespace OpenSim.Region.Framework.Interfaces
109 /// <param name="merge"> 109 /// <param name="merge">
110 /// If true, the loaded region merges with the existing one rather than replacing it. Any terrain or region 110 /// If true, the loaded region merges with the existing one rather than replacing it. Any terrain or region
111 /// settings in the archive will be ignored. 111 /// settings in the archive will be ignored.
112 /// </param> 112 /// </param>
113 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param> 113 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param>
114 void DearchiveRegion(Stream loadStream, bool merge, Guid requestId); 114 void DearchiveRegion(Stream loadStream, bool merge, Guid requestId);
115 } 115 }
116} 116}
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
index 41a1e51..78bd622 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
@@ -71,21 +71,21 @@ namespace OpenSim.Region.Framework.Interfaces
71 /// Load persisted objects from region storage. 71 /// Load persisted objects from region storage.
72 /// </summary> 72 /// </summary>
73 /// <param name="regionUUID">the Region UUID</param> 73 /// <param name="regionUUID">the Region UUID</param>
74 /// <returns>List of loaded groups</returns> 74 /// <returns>List of loaded groups</returns>
75 List<SceneObjectGroup> LoadObjects(UUID regionUUID); 75 List<SceneObjectGroup> LoadObjects(UUID regionUUID);
76 76
77 /// <summary> 77 /// <summary>
78 /// Store a terrain revision in region storage 78 /// Store a terrain revision in region storage
79 /// </summary> 79 /// </summary>
80 /// <param name="ter">HeightField data</param> 80 /// <param name="ter">HeightField data</param>
81 /// <param name="regionID">region UUID</param> 81 /// <param name="regionID">region UUID</param>
82 void StoreTerrain(double[,] terrain, UUID regionID); 82 void StoreTerrain(double[,] terrain, UUID regionID);
83 83
84 /// <summary> 84 /// <summary>
85 /// Load the latest terrain revision from region storage 85 /// Load the latest terrain revision from region storage
86 /// </summary> 86 /// </summary>
87 /// <param name="regionID">the region UUID</param> 87 /// <param name="regionID">the region UUID</param>
88 /// <returns>Heightfield data</returns> 88 /// <returns>Heightfield data</returns>
89 double[,] LoadTerrain(UUID regionID); 89 double[,] LoadTerrain(UUID regionID);
90 90
91 void StoreLandObject(ILandObject Parcel); 91 void StoreLandObject(ILandObject Parcel);
@@ -96,7 +96,7 @@ namespace OpenSim.Region.Framework.Interfaces
96 /// <item>delete from landaccesslist where LandUUID=globalID</item> 96 /// <item>delete from landaccesslist where LandUUID=globalID</item>
97 /// </list> 97 /// </list>
98 /// </summary> 98 /// </summary>
99 /// <param name="globalID"></param> 99 /// <param name="globalID"></param>
100 void RemoveLandObject(UUID globalID); 100 void RemoveLandObject(UUID globalID);
101 101
102 List<LandData> LoadLandObjects(UUID regionUUID); 102 List<LandData> LoadLandObjects(UUID regionUUID);
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs
index bfd25d3..e7562a5 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs
@@ -117,6 +117,6 @@ namespace OpenSim.Region.Framework.Interfaces
117 /// </summary> 117 /// </summary>
118 /// <param name="grp"></param> 118 /// <param name="grp"></param>
119 /// <returns></returns> 119 /// <returns></returns>
120 string SerializeGroupToXml2(SceneObjectGroup grp); 120 string SerializeGroupToXml2(SceneObjectGroup grp);
121 } 121 }
122} 122}
diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
index 3d803ee..379fabd 100644
--- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
@@ -29,12 +29,12 @@ using System;
29using OpenMetaverse; 29using OpenMetaverse;
30 30
31namespace OpenSim.Region.Framework.Interfaces 31namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public interface ISoundModule 33 public interface ISoundModule
34 { 34 {
35 void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags); 35 void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags);
36 36
37 void TriggerSound( 37 void TriggerSound(
38 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle); 38 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle);
39 } 39 }
40} \ No newline at end of file 40} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IVegetationModule.cs b/OpenSim/Region/Framework/Interfaces/IVegetationModule.cs
index 344601f..403d542 100644
--- a/OpenSim/Region/Framework/Interfaces/IVegetationModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IVegetationModule.cs
@@ -29,7 +29,7 @@ using OpenMetaverse;
29using OpenSim.Region.Framework.Scenes; 29using OpenSim.Region.Framework.Scenes;
30 30
31namespace OpenSim.Region.Framework.Interfaces 31namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public interface IVegetationModule : IEntityCreator 33 public interface IVegetationModule : IEntityCreator
34 { 34 {
35 /// <summary> 35 /// <summary>
@@ -44,6 +44,6 @@ namespace OpenSim.Region.Framework.Interfaces
44 /// <param name="newTree"></param> 44 /// <param name="newTree"></param>
45 /// <returns></returns> 45 /// <returns></returns>
46 SceneObjectGroup AddTree( 46 SceneObjectGroup AddTree(
47 UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree); 47 UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree);
48 } 48 }
49} 49}
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
index a0b0888..de1bcd4 100644
--- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
@@ -26,9 +26,9 @@
26 */ 26 */
27 27
28namespace OpenSim.Region.Framework.Interfaces 28namespace OpenSim.Region.Framework.Interfaces
29{ 29{
30 public interface IWorldMapModule 30 public interface IWorldMapModule
31 { 31 {
32 void LazySaveGeneratedMaptile(byte[] data, bool temporary); 32 void LazySaveGeneratedMaptile(byte[] data, bool temporary);
33 } 33 }
34} 34}
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 7ac1e7e..5b571c7 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -34,7 +34,7 @@ using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35 35
36namespace OpenSim.Region.Framework.Scenes 36namespace OpenSim.Region.Framework.Scenes
37{ 37{
38 class DeleteToInventoryHolder 38 class DeleteToInventoryHolder
39 { 39 {
40 public DeRezAction action; 40 public DeRezAction action;
@@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes
49 /// up the main client thread. 49 /// up the main client thread.
50 /// </summary> 50 /// </summary>
51 public class AsyncSceneObjectGroupDeleter 51 public class AsyncSceneObjectGroupDeleter
52 { 52 {
53 private static readonly ILog m_log 53 private static readonly ILog m_log
54 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 55
@@ -58,16 +58,16 @@ namespace OpenSim.Region.Framework.Scenes
58 /// </value> 58 /// </value>
59 public bool Enabled; 59 public bool Enabled;
60 60
61 private Timer m_inventoryTicker = new Timer(2000); 61 private Timer m_inventoryTicker = new Timer(2000);
62 private readonly Queue<DeleteToInventoryHolder> m_inventoryDeletes = new Queue<DeleteToInventoryHolder>(); 62 private readonly Queue<DeleteToInventoryHolder> m_inventoryDeletes = new Queue<DeleteToInventoryHolder>();
63 private Scene m_scene; 63 private Scene m_scene;
64 64
65 public AsyncSceneObjectGroupDeleter(Scene scene) 65 public AsyncSceneObjectGroupDeleter(Scene scene)
66 { 66 {
67 m_scene = scene; 67 m_scene = scene;
68 68
69 m_inventoryTicker.AutoReset = false; 69 m_inventoryTicker.AutoReset = false;
70 m_inventoryTicker.Elapsed += InventoryRunDeleteTimer; 70 m_inventoryTicker.Elapsed += InventoryRunDeleteTimer;
71 } 71 }
72 72
73 /// <summary> 73 /// <summary>
@@ -113,7 +113,7 @@ namespace OpenSim.Region.Framework.Scenes
113 { 113 {
114 //m_log.Debug("[SCENE]: Sent item successfully to inventory, continuing..."); 114 //m_log.Debug("[SCENE]: Sent item successfully to inventory, continuing...");
115 } 115 }
116 } 116 }
117 117
118 /// <summary> 118 /// <summary>
119 /// Move the next object in the queue to inventory. Then delete it properly from the scene. 119 /// Move the next object in the queue to inventory. Then delete it properly from the scene.
@@ -121,7 +121,7 @@ namespace OpenSim.Region.Framework.Scenes
121 /// <returns></returns> 121 /// <returns></returns>
122 public bool InventoryDeQueueAndDelete() 122 public bool InventoryDeQueueAndDelete()
123 { 123 {
124 DeleteToInventoryHolder x = null; 124 DeleteToInventoryHolder x = null;
125 125
126 try 126 try
127 { 127 {
@@ -142,9 +142,9 @@ namespace OpenSim.Region.Framework.Scenes
142 142
143 try 143 try
144 { 144 {
145 m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient); 145 m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient);
146 if (x.permissionToDelete) 146 if (x.permissionToDelete)
147 m_scene.DeleteSceneObject(x.objectGroup, false); 147 m_scene.DeleteSceneObject(x.objectGroup, false);
148 } 148 }
149 catch (Exception e) 149 catch (Exception e)
150 { 150 {
@@ -166,6 +166,6 @@ namespace OpenSim.Region.Framework.Scenes
166 166
167 m_log.Debug("[SCENE]: No objects left in inventory send queue."); 167 m_log.Debug("[SCENE]: No objects left in inventory send queue.");
168 return false; 168 return false;
169 } 169 }
170 } 170 }
171} 171}
diff --git a/OpenSim/Region/Framework/Scenes/AvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/AvatarAnimations.cs
index 06b1d22..72d599a 100644
--- a/OpenSim/Region/Framework/Scenes/AvatarAnimations.cs
+++ b/OpenSim/Region/Framework/Scenes/AvatarAnimations.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes
47 { 47 {
48 if (nod.Attributes["name"] != null) 48 if (nod.Attributes["name"] != null)
49 { 49 {
50 string name = (string)nod.Attributes["name"].Value; 50 string name = (string)nod.Attributes["name"].Value;
51 UUID id = (UUID)nod.InnerText; 51 UUID id = (UUID)nod.InnerText;
52 string animState = (string)nod.Attributes["state"].Value; 52 string animState = (string)nod.Attributes["state"].Value;
53 53
diff --git a/OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs b/OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs
index 1dd9613..5f2eb0d 100644
--- a/OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs
+++ b/OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs
@@ -234,7 +234,7 @@ namespace OpenSim.Region.Framework.Scenes
234 234
235 235
236 /// <summary> 236 /// <summary>
237 /// Variable length strings seem to be null terminated in the animation asset.. but.. 237 /// Variable length strings seem to be null terminated in the animation asset.. but..
238 /// use with caution, home grown. 238 /// use with caution, home grown.
239 /// advances the index. 239 /// advances the index.
240 /// </summary> 240 /// </summary>
@@ -273,7 +273,7 @@ namespace OpenSim.Region.Framework.Scenes
273 byte[] interm = new byte[endpos-i]; 273 byte[] interm = new byte[endpos-i];
274 for (; i<endpos; i++) 274 for (; i<endpos; i++)
275 { 275 {
276 interm[i-startpos] = data[i]; 276 interm[i-startpos] = data[i];
277 } 277 }
278 i++; // advance past the null character 278 i++; // advance past the null character
279 279
@@ -624,7 +624,7 @@ switch (jointname)
624 case "mWristLeft": 624 case "mWristLeft":
625 case "mWristRight": 625 case "mWristRight":
626 case "mShoulderLeft": 626 case "mShoulderLeft":
627 case "mShoulderRight": 627 case "mShoulderRight":
628 // ZYX->ZXY 628 // ZYX->ZXY
629 t = y; 629 t = y;
630 y = z; 630 y = z;
diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
index 1488c5b..c6a6511 100644
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ b/OpenSim/Region/Framework/Scenes/Border.cs
@@ -55,11 +55,11 @@ namespace OpenSim.Region.Framework.Scenes
55 /// Creates a Border. The line is perpendicular to the direction cardinal. 55 /// Creates a Border. The line is perpendicular to the direction cardinal.
56 /// IE: if the direction cardinal is South, the line is West->East 56 /// IE: if the direction cardinal is South, the line is West->East
57 /// </summary> 57 /// </summary>
58 /// <param name="lineStart">The starting point for the line of the border. 58 /// <param name="lineStart">The starting point for the line of the border.
59 /// The position of an object must be greater then this for this border to trigger. 59 /// The position of an object must be greater then this for this border to trigger.
60 /// Perpendicular to the direction cardinal</param> 60 /// Perpendicular to the direction cardinal</param>
61 /// <param name="lineEnd">The ending point for the line of the border. 61 /// <param name="lineEnd">The ending point for the line of the border.
62 /// The position of an object must be less then this for this border to trigger. 62 /// The position of an object must be less then this for this border to trigger.
63 /// Perpendicular to the direction cardinal</param> 63 /// Perpendicular to the direction cardinal</param>
64 /// <param name="triggerCoordinate">The position that triggers border the border 64 /// <param name="triggerCoordinate">The position that triggers border the border
65 /// cross parallel to the direction cardinal. On the North cardinal, this 65 /// cross parallel to the direction cardinal. On the North cardinal, this
diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs
index 00c99c5..27a0785 100644
--- a/OpenSim/Region/Framework/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.Framework.Scenes
94 set { m_velocity = value; } 94 set { m_velocity = value; }
95 } 95 }
96 96
97 protected Quaternion m_rotation = new Quaternion(0f, 0f, 1f, 0f); 97 protected Quaternion m_rotation;
98 98
99 public virtual Quaternion Rotation 99 public virtual Quaternion Rotation
100 { 100 {
@@ -102,6 +102,14 @@ namespace OpenSim.Region.Framework.Scenes
102 set { m_rotation = value; } 102 set { m_rotation = value; }
103 } 103 }
104 104
105 protected Vector3 m_scale;
106
107 public virtual Vector3 Scale
108 {
109 get { return m_scale; }
110 set { m_scale = value; }
111 }
112
105 protected uint m_localId; 113 protected uint m_localId;
106 114
107 public virtual uint LocalId 115 public virtual uint LocalId
@@ -115,13 +123,9 @@ namespace OpenSim.Region.Framework.Scenes
115 /// </summary> 123 /// </summary>
116 public EntityBase() 124 public EntityBase()
117 { 125 {
118 m_uuid = UUID.Zero; 126 m_rotation = Quaternion.Identity;
119 127 m_scale = Vector3.One;
120 m_pos = Vector3.Zero;
121 m_velocity = Vector3.Zero;
122 Rotation = Quaternion.Identity;
123 m_name = "(basic entity)"; 128 m_name = "(basic entity)";
124 m_rotationalvelocity = Vector3.Zero;
125 } 129 }
126 130
127 /// <summary> 131 /// <summary>
@@ -130,7 +134,7 @@ namespace OpenSim.Region.Framework.Scenes
130 public abstract void UpdateMovement(); 134 public abstract void UpdateMovement();
131 135
132 /// <summary> 136 /// <summary>
133 /// Performs any updates that need to be done at each frame, as opposed to immediately. 137 /// Performs any updates that need to be done at each frame, as opposed to immediately.
134 /// These included scheduled updates and updates that occur due to physics processing. 138 /// These included scheduled updates and updates that occur due to physics processing.
135 /// </summary> 139 /// </summary>
136 public abstract void Update(); 140 public abstract void Update();
diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs
index 504b90a..0ceef39 100644
--- a/OpenSim/Region/Framework/Scenes/EntityManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes
144 { 144 {
145 m_log.ErrorFormat("Remove Entity failed for {0}", localID, e); 145 m_log.ErrorFormat("Remove Entity failed for {0}", localID, e);
146 return false; 146 return false;
147 } 147 }
148 } 148 }
149 } 149 }
150 150
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 287d8d9..753344d 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -32,6 +32,7 @@ using OpenSim.Framework;
32using OpenSim.Framework.Client; 32using OpenSim.Framework.Client;
33using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
34using Caps=OpenSim.Framework.Capabilities.Caps; 34using Caps=OpenSim.Framework.Capabilities.Caps;
35using GridRegion = OpenSim.Services.Interfaces.GridRegion;
35 36
36namespace OpenSim.Region.Framework.Scenes 37namespace OpenSim.Region.Framework.Scenes
37{ 38{
@@ -289,7 +290,7 @@ namespace OpenSim.Region.Framework.Scenes
289 /// Guid.Empty is returned. 290 /// Guid.Empty is returned.
290 /// </summary> 291 /// </summary>
291 public delegate void OarFileSaved(Guid guid, string message); 292 public delegate void OarFileSaved(Guid guid, string message);
292 public event OarFileSaved OnOarFileSaved; 293 public event OarFileSaved OnOarFileSaved;
293 294
294 /// <summary> 295 /// <summary>
295 /// Called when the script compile queue becomes empty 296 /// Called when the script compile queue becomes empty
@@ -305,6 +306,9 @@ namespace OpenSim.Region.Framework.Scenes
305 public delegate void Attach(uint localID, UUID itemID, UUID avatarID); 306 public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
306 public event Attach OnAttach; 307 public event Attach OnAttach;
307 308
309 public delegate void RegionUp(GridRegion region);
310 public event RegionUp OnRegionUp;
311
308 public class MoneyTransferArgs : EventArgs 312 public class MoneyTransferArgs : EventArgs
309 { 313 {
310 public UUID sender; 314 public UUID sender;
@@ -446,6 +450,7 @@ namespace OpenSim.Region.Framework.Scenes
446 private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null; 450 private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null;
447 451
448 private Attach handlerOnAttach = null; 452 private Attach handlerOnAttach = null;
453 private RegionUp handlerOnRegionUp = null;
449 454
450 public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) 455 public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
451 { 456 {
@@ -999,7 +1004,7 @@ namespace OpenSim.Region.Framework.Scenes
999 handlerOarFileSaved = OnOarFileSaved; 1004 handlerOarFileSaved = OnOarFileSaved;
1000 if (handlerOarFileSaved != null) 1005 if (handlerOarFileSaved != null)
1001 handlerOarFileSaved(requestId, message); 1006 handlerOarFileSaved(requestId, message);
1002 } 1007 }
1003 1008
1004 public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message) 1009 public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message)
1005 { 1010 {
@@ -1035,5 +1040,13 @@ namespace OpenSim.Region.Framework.Scenes
1035 if (handlerSetRootAgentScene != null) 1040 if (handlerSetRootAgentScene != null)
1036 handlerSetRootAgentScene(agentID, scene); 1041 handlerSetRootAgentScene(agentID, scene);
1037 } 1042 }
1043
1044 public void TriggerOnRegionUp(GridRegion otherRegion)
1045 {
1046 handlerOnRegionUp = OnRegionUp;
1047 if (handlerOnRegionUp != null)
1048 handlerOnRegionUp(otherRegion);
1049 }
1050
1038 } 1051 }
1039} 1052}
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
index 62efd60..b6fa41d 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Framework.Communications.Cache; 35using OpenSim.Framework.Communications.Cache;
36using OpenSim.Framework.Communications.Clients; 36using OpenSim.Framework.Communications.Clients;
37using OpenSim.Region.Framework.Scenes.Serialization; 37using OpenSim.Region.Framework.Scenes.Serialization;
38using OpenSim.Services.Interfaces;
38 39
39//using HyperGrid.Framework; 40//using HyperGrid.Framework;
40//using OpenSim.Region.Communications.Hypergrid; 41//using OpenSim.Region.Communications.Hypergrid;
@@ -50,6 +51,18 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
50// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>(); 51// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
51 52
52 private Scene m_scene; 53 private Scene m_scene;
54
55 private IHyperlinkService m_hyper;
56 IHyperlinkService HyperlinkService
57 {
58 get
59 {
60 if (m_hyper == null)
61 m_hyper = m_scene.RequestModuleInterface<IHyperlinkService>();
62 return m_hyper;
63 }
64 }
65
53 #endregion 66 #endregion
54 67
55 #region Constructor 68 #region Constructor
@@ -79,22 +92,6 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
79// return null; 92// return null;
80// } 93// }
81 94
82 private bool IsLocalUser(UUID userID)
83 {
84 CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
85
86 if (uinfo != null)
87 {
88 if (HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile))
89 {
90 m_log.Debug("[HGScene]: Home user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
91 return true;
92 }
93 }
94
95 m_log.Debug("[HGScene]: Foreign user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
96 return false;
97 }
98 95
99 public AssetBase FetchAsset(string url, UUID assetID) 96 public AssetBase FetchAsset(string url, UUID assetID)
100 { 97 {
@@ -170,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
170 167
171 public void Get(UUID assetID, UUID ownerID) 168 public void Get(UUID assetID, UUID ownerID)
172 { 169 {
173 if (!IsLocalUser(ownerID)) 170 if (!HyperlinkService.IsLocalUser(ownerID))
174 { 171 {
175 // Get the item from the remote asset server onto the local AssetCache 172 // Get the item from the remote asset server onto the local AssetCache
176 // and place an entry in m_assetMap 173 // and place an entry in m_assetMap
@@ -228,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
228 225
229 public void Post(UUID assetID, UUID ownerID) 226 public void Post(UUID assetID, UUID ownerID)
230 { 227 {
231 if (!IsLocalUser(ownerID)) 228 if (!HyperlinkService.IsLocalUser(ownerID))
232 { 229 {
233 // Post the item from the local AssetCache onto the remote asset server 230 // Post the item from the local AssetCache onto the remote asset server
234 // and place an entry in m_assetMap 231 // and place an entry in m_assetMap
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGHyperlink.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGHyperlink.cs
deleted file mode 100644
index a576feb..0000000
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGHyperlink.cs
+++ /dev/null
@@ -1,232 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Net;
30using System.Reflection;
31using log4net;
32using OpenMetaverse;
33using OpenSim.Framework;
34
35namespace OpenSim.Region.Framework.Scenes.Hypergrid
36{
37 public class HGHyperlink
38 {
39 private static readonly ILog m_log =
40 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 private static Random random = new Random();
42
43 public static RegionInfo TryLinkRegionToCoords(Scene m_scene, IClientAPI client, string mapName, uint xloc, uint yloc)
44 {
45 string host = "127.0.0.1";
46 string portstr;
47 string regionName = "";
48 uint port = 9000;
49 string[] parts = mapName.Split(new char[] { ':' });
50 if (parts.Length >= 1)
51 {
52 host = parts[0];
53 }
54 if (parts.Length >= 2)
55 {
56 portstr = parts[1];
57 if (!UInt32.TryParse(portstr, out port))
58 regionName = parts[1];
59 }
60 // always take the last one
61 if (parts.Length >= 3)
62 {
63 regionName = parts[2];
64 }
65
66 // Sanity check. Don't ever link to this sim.
67 IPAddress ipaddr = null;
68 try
69 {
70 ipaddr = Util.GetHostFromDNS(host);
71 }
72 catch { }
73
74 if ((ipaddr != null) &&
75 !((m_scene.RegionInfo.ExternalEndPoint.Address.Equals(ipaddr)) && (m_scene.RegionInfo.HttpPort == port)))
76 {
77 RegionInfo regInfo;
78 bool success = TryCreateLink(m_scene, client, xloc, yloc, regionName, port, host, out regInfo);
79 if (success)
80 {
81 regInfo.RegionName = mapName;
82 return regInfo;
83 }
84 }
85
86 return null;
87 }
88
89 public static RegionInfo TryLinkRegion(Scene m_scene, IClientAPI client, string mapName)
90 {
91 uint xloc = (uint)(random.Next(0, Int16.MaxValue));
92 return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0);
93 }
94
95 public static bool TryCreateLink(Scene m_scene, IClientAPI client, uint xloc, uint yloc,
96 string externalRegionName, uint externalPort, string externalHostName, out RegionInfo regInfo)
97 {
98 m_log.DebugFormat("[HGrid]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc);
99
100 regInfo = new RegionInfo();
101 regInfo.RegionName = externalRegionName;
102 regInfo.HttpPort = externalPort;
103 regInfo.ExternalHostName = externalHostName;
104 regInfo.RegionLocX = xloc;
105 regInfo.RegionLocY = yloc;
106
107 try
108 {
109 regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);
110 }
111 catch (Exception e)
112 {
113 m_log.Warn("[HGrid]: Wrong format for link-region: " + e.Message);
114 return false;
115 }
116 regInfo.RemotingAddress = regInfo.ExternalEndPoint.Address.ToString();
117
118 // Finally, link it
119 try
120 {
121 m_scene.CommsManager.GridService.RegisterRegion(regInfo);
122 }
123 catch (Exception e)
124 {
125 m_log.Warn("[HGrid]: Unable to link region: " + e.Message);
126 return false;
127 }
128
129 uint x, y;
130 if (!Check4096(m_scene, regInfo, out x, out y))
131 {
132 m_scene.CommsManager.GridService.DeregisterRegion(regInfo);
133 if (client != null)
134 client.SendAlertMessage("Region is too far (" + x + ", " + y + ")");
135 m_log.Info("[HGrid]: Unable to link, region is too far (" + x + ", " + y + ")");
136 return false;
137 }
138
139 if (!CheckCoords(m_scene.RegionInfo.RegionLocX, m_scene.RegionInfo.RegionLocY, x, y))
140 {
141 m_scene.CommsManager.GridService.DeregisterRegion(regInfo);
142 if (client != null)
143 client.SendAlertMessage("Region has incompatible coordinates (" + x + ", " + y + ")");
144 m_log.Info("[HGrid]: Unable to link, region has incompatible coordinates (" + x + ", " + y + ")");
145 return false;
146 }
147
148 m_log.Debug("[HGrid]: link region succeeded");
149 return true;
150 }
151
152 public static bool TryUnlinkRegion(Scene m_scene, string mapName)
153 {
154 RegionInfo regInfo = null;
155 if (mapName.Contains(":"))
156 {
157 string host = "127.0.0.1";
158 //string portstr;
159 //string regionName = "";
160 uint port = 9000;
161 string[] parts = mapName.Split(new char[] { ':' });
162 if (parts.Length >= 1)
163 {
164 host = parts[0];
165 }
166// if (parts.Length >= 2)
167// {
168// portstr = parts[1];
169// if (!UInt32.TryParse(portstr, out port))
170// regionName = parts[1];
171// }
172 // always take the last one
173// if (parts.Length >= 3)
174// {
175// regionName = parts[2];
176// }
177 regInfo = m_scene.CommsManager.GridService.RequestNeighbourInfo(host, port);
178 }
179 else
180 {
181 regInfo = m_scene.CommsManager.GridService.RequestNeighbourInfo(mapName);
182 }
183 if (regInfo != null)
184 {
185 return m_scene.CommsManager.GridService.DeregisterRegion(regInfo);
186 }
187 else
188 {
189 m_log.InfoFormat("[HGrid]: Region {0} not found", mapName);
190 return false;
191 }
192 }
193
194 /// <summary>
195 /// Cope with this viewer limitation.
196 /// </summary>
197 /// <param name="regInfo"></param>
198 /// <returns></returns>
199 public static bool Check4096(Scene m_scene, RegionInfo regInfo, out uint x, out uint y)
200 {
201 ulong realHandle;
202 if (UInt64.TryParse(regInfo.regionSecret, out realHandle))
203 {
204 Utils.LongToUInts(realHandle, out x, out y);
205 x = x / Constants.RegionSize;
206 y = y / Constants.RegionSize;
207
208 if ((Math.Abs((int)m_scene.RegionInfo.RegionLocX - (int)x) >= 4096) ||
209 (Math.Abs((int)m_scene.RegionInfo.RegionLocY - (int)y) >= 4096))
210 {
211 return false;
212 }
213 return true;
214 }
215 else
216 {
217 m_scene.CommsManager.GridService.RegisterRegion(regInfo);
218 m_log.Debug("[HGrid]: Gnomes. Region deregistered.");
219 x = y = 0;
220 return false;
221 }
222 }
223
224 public static bool CheckCoords(uint thisx, uint thisy, uint x, uint y)
225 {
226 if ((thisx == x) && (thisy == y))
227 return false;
228 return true;
229 }
230
231 }
232}
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs
index bf55df7..b1981b6 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs
@@ -29,6 +29,7 @@ using OpenMetaverse;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenSim.Framework.Communications.Cache; 30using OpenSim.Framework.Communications.Cache;
31using TPFlags = OpenSim.Framework.Constants.TeleportFlags; 31using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
32using GridRegion = OpenSim.Services.Interfaces.GridRegion;
32 33
33namespace OpenSim.Region.Framework.Scenes.Hypergrid 34namespace OpenSim.Region.Framework.Scenes.Hypergrid
34{ 35{
@@ -50,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
50 51
51 if (UserProfile != null) 52 if (UserProfile != null)
52 { 53 {
53 RegionInfo regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion); 54 GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID);
54 //if (regionInfo != null) 55 //if (regionInfo != null)
55 //{ 56 //{
56 // UserProfile.HomeRegionID = regionInfo.RegionID; 57 // UserProfile.HomeRegionID = regionInfo.RegionID;
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
index efc644d..d7e62a8 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
@@ -38,6 +38,8 @@ using OpenSim.Framework.Communications;
38using OpenSim.Framework.Communications.Cache; 38using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Capabilities; 39using OpenSim.Framework.Capabilities;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Services.Interfaces;
42using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41 43
42namespace OpenSim.Region.Framework.Scenes.Hypergrid 44namespace OpenSim.Region.Framework.Scenes.Hypergrid
43{ 45{
@@ -45,11 +47,19 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
45 { 47 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 49
48 public readonly IHyperlink m_hg; 50 private IHyperlinkService m_hg;
51 IHyperlinkService HyperlinkService
52 {
53 get
54 {
55 if (m_hg == null)
56 m_hg = m_scene.RequestModuleInterface<IHyperlinkService>();
57 return m_hg;
58 }
59 }
49 60
50 public HGSceneCommunicationService(CommunicationsManager commsMan, IHyperlink hg) : base(commsMan) 61 public HGSceneCommunicationService(CommunicationsManager commsMan) : base(commsMan)
51 { 62 {
52 m_hg = hg;
53 } 63 }
54 64
55 65
@@ -112,7 +122,10 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
112 } 122 }
113 else 123 else
114 { 124 {
115 RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle); 125 uint x = 0, y = 0;
126 Utils.LongToUInts(regionHandle, out x, out y);
127 GridRegion reg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
128
116 if (reg != null) 129 if (reg != null)
117 { 130 {
118 131
@@ -125,13 +138,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
125 /// Hypergrid mod start 138 /// Hypergrid mod start
126 /// 139 ///
127 /// 140 ///
128 bool isHyperLink = m_hg.IsHyperlinkRegion(reg.RegionHandle); 141 bool isHyperLink = (HyperlinkService.GetHyperlinkRegion(reg.RegionHandle) != null);
129 bool isHomeUser = true; 142 bool isHomeUser = true;
130 ulong realHandle = regionHandle; 143 ulong realHandle = regionHandle;
131 CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID); 144 CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID);
132 if (uinfo != null) 145 if (uinfo != null)
133 { 146 {
134 isHomeUser = HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile); 147 isHomeUser = HyperlinkService.IsLocalUser(uinfo.UserProfile.ID);
135 realHandle = m_hg.FindRegionHandle(regionHandle); 148 realHandle = m_hg.FindRegionHandle(regionHandle);
136 m_log.Debug("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString()); 149 m_log.Debug("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString());
137 } 150 }
@@ -344,7 +357,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
344 m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); 357 m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID);
345 m_log.DebugFormat( 358 m_log.DebugFormat(
346 "[HGSceneCommService]: User {0} is going to another region, profile cache removed", 359 "[HGSceneCommService]: User {0} is going to another region, profile cache removed",
347 avatar.UUID); 360 avatar.UUID);
348 } 361 }
349 } 362 }
350 else 363 else
diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
index 7c02f9a..73f918e 100644
--- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
+++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Region.Framework.Scenes
53 53
54 54
55 public class RegionStatsHandler : IStreamedRequestHandler 55 public class RegionStatsHandler : IStreamedRequestHandler
56 { 56 {
57 private string osRXStatsURI = String.Empty; 57 private string osRXStatsURI = String.Empty;
58 private string osXStatsURI = String.Empty; 58 private string osXStatsURI = String.Empty;
59 //private string osSecret = String.Empty; 59 //private string osSecret = String.Empty;
@@ -87,13 +87,13 @@ namespace OpenSim.Region.Framework.Scenes
87 } 87 }
88 88
89 public string Path 89 public string Path
90 { 90 {
91 // This is for the region and is the regionSecret hashed 91 // This is for the region and is the regionSecret hashed
92 get { return "/" + osRXStatsURI + "/"; } 92 get { return "/" + osRXStatsURI + "/"; }
93 } 93 }
94 94
95 private string Report() 95 private string Report()
96 { 96 {
97 OSDMap args = new OSDMap(30); 97 OSDMap args = new OSDMap(30);
98 //int time = Util.ToUnixTime(DateTime.Now); 98 //int time = Util.ToUnixTime(DateTime.Now);
99 args["OSStatsURI"] = OSD.FromString("http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/" + osXStatsURI + "/"); 99 args["OSStatsURI"] = OSD.FromString("http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/" + osXStatsURI + "/");
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index a6e137d..41141e0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1015,7 +1015,7 @@ namespace OpenSim.Region.Framework.Scenes
1015 return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); 1015 return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId);
1016 } 1016 }
1017 else 1017 else
1018 { 1018 {
1019 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId); 1019 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId);
1020 1020
1021 if (agentItem == null) 1021 if (agentItem == null)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index fddba86..e561efb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -413,7 +413,7 @@ namespace OpenSim.Region.Framework.Scenes
413 remoteClient.SendInventoryItemDetails(ownerID, item); 413 remoteClient.SendInventoryItemDetails(ownerID, item);
414 } 414 }
415 // else shouldn't we send an alert message? 415 // else shouldn't we send an alert message?
416 } 416 }
417 417
418 /// <summary> 418 /// <summary>
419 /// Tell the client about the various child items and folders contained in the requested folder. 419 /// Tell the client about the various child items and folders contained in the requested folder.
@@ -485,7 +485,7 @@ namespace OpenSim.Region.Framework.Scenes
485 485
486 // TODO: This code for looking in the folder for the library should be folded back into the 486 // TODO: This code for looking in the folder for the library should be folded back into the
487 // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc. 487 // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc.
488 // can be handled transparently). 488 // can be handled transparently).
489 InventoryFolderImpl fold; 489 InventoryFolderImpl fold;
490 if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) 490 if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null)
491 { 491 {
@@ -515,7 +515,7 @@ namespace OpenSim.Region.Framework.Scenes
515 515
516 return contents; 516 return contents;
517 517
518 } 518 }
519 519
520 /// <summary> 520 /// <summary>
521 /// Handle an inventory folder creation request from the client. 521 /// Handle an inventory folder creation request from the client.
@@ -535,7 +535,7 @@ namespace OpenSim.Region.Framework.Scenes
535 "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", 535 "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}",
536 remoteClient.Name, remoteClient.AgentId); 536 remoteClient.Name, remoteClient.AgentId);
537 } 537 }
538 } 538 }
539 539
540 /// <summary> 540 /// <summary>
541 /// Handle a client request to update the inventory folder 541 /// Handle a client request to update the inventory folder
@@ -544,7 +544,7 @@ namespace OpenSim.Region.Framework.Scenes
544 /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE 544 /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE
545 /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing, 545 /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing,
546 /// and needs to be changed. 546 /// and needs to be changed.
547 /// 547 ///
548 /// <param name="remoteClient"></param> 548 /// <param name="remoteClient"></param>
549 /// <param name="folderID"></param> 549 /// <param name="folderID"></param>
550 /// <param name="type"></param> 550 /// <param name="type"></param>
@@ -570,7 +570,7 @@ namespace OpenSim.Region.Framework.Scenes
570 remoteClient.Name, remoteClient.AgentId); 570 remoteClient.Name, remoteClient.AgentId);
571 } 571 }
572 } 572 }
573 } 573 }
574 574
575 public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) 575 public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID)
576 { 576 {
@@ -588,7 +588,7 @@ namespace OpenSim.Region.Framework.Scenes
588 { 588 {
589 m_log.WarnFormat("[AGENT INVENTORY]: request to move folder {0} but folder not found", folderID); 589 m_log.WarnFormat("[AGENT INVENTORY]: request to move folder {0} but folder not found", folderID);
590 } 590 }
591 } 591 }
592 592
593 /// <summary> 593 /// <summary>
594 /// This should delete all the items and folders in the given directory. 594 /// This should delete all the items and folders in the given directory.
@@ -609,7 +609,7 @@ namespace OpenSim.Region.Framework.Scenes
609 { 609 {
610 m_log.WarnFormat("[AGENT INVENTORY]: Exception on purge folder for user {0}: {1}", remoteClient.AgentId, e.Message); 610 m_log.WarnFormat("[AGENT INVENTORY]: Exception on purge folder for user {0}: {1}", remoteClient.AgentId, e.Message);
611 } 611 }
612 } 612 }
613 613
614 614
615 private void PurgeFolderAsync(UUID userID, UUID folderID) 615 private void PurgeFolderAsync(UUID userID, UUID folderID)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 226ec15..d01cef7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -805,7 +805,7 @@ namespace OpenSim.Region.Framework.Scenes
805 /// <param name="invType"></param> 805 /// <param name="invType"></param>
806 /// <param name="objectID"></param> 806 /// <param name="objectID"></param>
807 /// <param name="userID"></param> 807 /// <param name="userID"></param>
808 /// <returns></returns> 808 /// <returns></returns>
809 public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID) 809 public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID)
810 { 810 {
811 CreateObjectInventoryHandler handler = OnCreateObjectInventory; 811 CreateObjectInventoryHandler handler = OnCreateObjectInventory;
@@ -856,7 +856,7 @@ namespace OpenSim.Region.Framework.Scenes
856 /// </summary> 856 /// </summary>
857 /// <param name="invType"></param> 857 /// <param name="invType"></param>
858 /// <param name="userID"></param> 858 /// <param name="userID"></param>
859 /// <returns></returns> 859 /// <returns></returns>
860 public bool CanCreateUserInventory(int invType, UUID userID) 860 public bool CanCreateUserInventory(int invType, UUID userID)
861 { 861 {
862 CreateUserInventoryHandler handler = OnCreateUserInventory; 862 CreateUserInventoryHandler handler = OnCreateUserInventory;
@@ -877,7 +877,7 @@ namespace OpenSim.Region.Framework.Scenes
877 /// </summary> 877 /// </summary>
878 /// <param name="itemID"></param> 878 /// <param name="itemID"></param>
879 /// <param name="userID"></param> 879 /// <param name="userID"></param>
880 /// <returns></returns> 880 /// <returns></returns>
881 public bool CanEditUserInventory(UUID itemID, UUID userID) 881 public bool CanEditUserInventory(UUID itemID, UUID userID)
882 { 882 {
883 EditUserInventoryHandler handler = OnEditUserInventory; 883 EditUserInventoryHandler handler = OnEditUserInventory;
@@ -891,14 +891,14 @@ namespace OpenSim.Region.Framework.Scenes
891 } 891 }
892 } 892 }
893 return true; 893 return true;
894 } 894 }
895 895
896 /// <summary> 896 /// <summary>
897 /// Check whether the specified user is allowed to copy the given inventory item from their own inventory. 897 /// Check whether the specified user is allowed to copy the given inventory item from their own inventory.
898 /// </summary> 898 /// </summary>
899 /// <param name="itemID"></param> 899 /// <param name="itemID"></param>
900 /// <param name="userID"></param> 900 /// <param name="userID"></param>
901 /// <returns></returns> 901 /// <returns></returns>
902 public bool CanCopyUserInventory(UUID itemID, UUID userID) 902 public bool CanCopyUserInventory(UUID itemID, UUID userID)
903 { 903 {
904 CopyUserInventoryHandler handler = OnCopyUserInventory; 904 CopyUserInventoryHandler handler = OnCopyUserInventory;
@@ -912,14 +912,14 @@ namespace OpenSim.Region.Framework.Scenes
912 } 912 }
913 } 913 }
914 return true; 914 return true;
915 } 915 }
916 916
917 /// <summary> 917 /// <summary>
918 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. 918 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
919 /// </summary> 919 /// </summary>
920 /// <param name="itemID"></param> 920 /// <param name="itemID"></param>
921 /// <param name="userID"></param> 921 /// <param name="userID"></param>
922 /// <returns></returns> 922 /// <returns></returns>
923 public bool CanDeleteUserInventory(UUID itemID, UUID userID) 923 public bool CanDeleteUserInventory(UUID itemID, UUID userID)
924 { 924 {
925 DeleteUserInventoryHandler handler = OnDeleteUserInventory; 925 DeleteUserInventoryHandler handler = OnDeleteUserInventory;
@@ -933,7 +933,7 @@ namespace OpenSim.Region.Framework.Scenes
933 } 933 }
934 } 934 }
935 return true; 935 return true;
936 } 936 }
937 937
938 public bool CanTeleport(UUID userID) 938 public bool CanTeleport(UUID userID)
939 { 939 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index db107a9..55ec281 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -49,6 +49,7 @@ using OpenSim.Region.Framework.Scenes.Serialization;
49using OpenSim.Region.Physics.Manager; 49using OpenSim.Region.Physics.Manager;
50using Timer=System.Timers.Timer; 50using Timer=System.Timers.Timer;
51using TPFlags = OpenSim.Framework.Constants.TeleportFlags; 51using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
52using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52 53
53namespace OpenSim.Region.Framework.Scenes 54namespace OpenSim.Region.Framework.Scenes
54{ 55{
@@ -193,6 +194,26 @@ namespace OpenSim.Region.Framework.Scenes
193 } 194 }
194 } 195 }
195 196
197 protected IGridService m_GridService = null;
198
199 public IGridService GridService
200 {
201 get
202 {
203 if (m_GridService == null)
204 {
205 m_GridService = RequestModuleInterface<IGridService>();
206
207 if (m_GridService == null)
208 {
209 throw new Exception("No IGridService available. This could happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. Please also check that you have the correct version of your inventory service dll. Sometimes old versions of this dll will still exist. Do a clean checkout and re-create the opensim.ini from the opensim.ini.example.");
210 }
211 }
212
213 return m_GridService;
214 }
215 }
216
196 protected IXMLRPC m_xmlrpcModule; 217 protected IXMLRPC m_xmlrpcModule;
197 protected IWorldComm m_worldCommModule; 218 protected IWorldComm m_worldCommModule;
198 protected IAvatarFactory m_AvatarFactory; 219 protected IAvatarFactory m_AvatarFactory;
@@ -566,10 +587,7 @@ namespace OpenSim.Region.Framework.Scenes
566 } 587 }
567 588
568 /// <summary> 589 /// <summary>
569 /// Another region is up. Gets called from Grid Comms: 590 /// Another region is up.
570 /// (OGS1 -> LocalBackEnd -> RegionListened -> SceneCommunicationService)
571 /// We have to tell all our ScenePresences about it, and add it to the
572 /// neighbor list.
573 /// 591 ///
574 /// We only add it to the neighbor list if it's within 1 region from here. 592 /// We only add it to the neighbor list if it's within 1 region from here.
575 /// Agents may have draw distance values that cross two regions though, so 593 /// Agents may have draw distance values that cross two regions though, so
@@ -578,47 +596,30 @@ namespace OpenSim.Region.Framework.Scenes
578 /// </summary> 596 /// </summary>
579 /// <param name="otherRegion">RegionInfo handle for the new region.</param> 597 /// <param name="otherRegion">RegionInfo handle for the new region.</param>
580 /// <returns>True after all operations complete, throws exceptions otherwise.</returns> 598 /// <returns>True after all operations complete, throws exceptions otherwise.</returns>
581 public override bool OtherRegionUp(RegionInfo otherRegion) 599 public override void OtherRegionUp(GridRegion otherRegion)
582 { 600 {
583 m_log.InfoFormat("[SCENE]: Region {0} up in coords {1}-{2}", otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); 601 uint xcell = (uint)((int)otherRegion.RegionLocX / (int)Constants.RegionSize);
602 uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize);
603 m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}",
604 RegionInfo.RegionName, otherRegion.RegionName, xcell, ycell);
584 605
585 if (RegionInfo.RegionHandle != otherRegion.RegionHandle) 606 if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
586 { 607 {
587 for (int i = 0; i < m_neighbours.Count; i++)
588 {
589 // The purpose of this loop is to re-update the known neighbors
590 // when another region comes up on top of another one.
591 // The latest region in that location ends up in the
592 // 'known neighbors list'
593 // Additionally, the commFailTF property gets reset to false.
594 if (m_neighbours[i].RegionHandle == otherRegion.RegionHandle)
595 {
596 lock (m_neighbours)
597 {
598 m_neighbours[i] = otherRegion;
599
600 }
601 }
602 }
603
604 // If the value isn't in the neighbours, add it.
605 // If the RegionInfo isn't exact but is for the same XY World location,
606 // then the above loop will fix that.
607
608 if (!(CheckNeighborRegion(otherRegion)))
609 {
610 lock (m_neighbours)
611 {
612 m_neighbours.Add(otherRegion);
613 //m_log.Info("[UP]: " + otherRegion.RegionHandle.ToString());
614 }
615 }
616 608
617 // If these are cast to INT because long + negative values + abs returns invalid data 609 // If these are cast to INT because long + negative values + abs returns invalid data
618 int resultX = Math.Abs((int)otherRegion.RegionLocX - (int)RegionInfo.RegionLocX); 610 int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX);
619 int resultY = Math.Abs((int)otherRegion.RegionLocY - (int)RegionInfo.RegionLocY); 611 int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY);
620 if (resultX <= 1 && resultY <= 1) 612 if (resultX <= 1 && resultY <= 1)
621 { 613 {
614 // Let the grid service module know, so this can be cached
615 m_eventManager.TriggerOnRegionUp(otherRegion);
616
617 RegionInfo regInfo = new RegionInfo(xcell, ycell, otherRegion.InternalEndPoint, otherRegion.ExternalHostName);
618 regInfo.RegionID = otherRegion.RegionID;
619 regInfo.RegionName = otherRegion.RegionName;
620 regInfo.ScopeID = otherRegion.ScopeID;
621 regInfo.ExternalHostName = otherRegion.ExternalHostName;
622
622 try 623 try
623 { 624 {
624 ForEachScenePresence(delegate(ScenePresence agent) 625 ForEachScenePresence(delegate(ScenePresence agent)
@@ -632,7 +633,7 @@ namespace OpenSim.Region.Framework.Scenes
632 List<ulong> old = new List<ulong>(); 633 List<ulong> old = new List<ulong>();
633 old.Add(otherRegion.RegionHandle); 634 old.Add(otherRegion.RegionHandle);
634 agent.DropOldNeighbours(old); 635 agent.DropOldNeighbours(old);
635 InformClientOfNeighbor(agent, otherRegion); 636 InformClientOfNeighbor(agent, regInfo);
636 } 637 }
637 } 638 }
638 ); 639 );
@@ -643,6 +644,7 @@ namespace OpenSim.Region.Framework.Scenes
643 // This shouldn't happen too often anymore. 644 // This shouldn't happen too often anymore.
644 m_log.Error("[SCENE]: Couldn't inform client of regionup because we got a null reference exception"); 645 m_log.Error("[SCENE]: Couldn't inform client of regionup because we got a null reference exception");
645 } 646 }
647
646 } 648 }
647 else 649 else
648 { 650 {
@@ -651,7 +653,6 @@ namespace OpenSim.Region.Framework.Scenes
651 otherRegion.RegionLocY.ToString() + ")"); 653 otherRegion.RegionLocY.ToString() + ")");
652 } 654 }
653 } 655 }
654 return true;
655 } 656 }
656 657
657 public void AddNeighborRegion(RegionInfo region) 658 public void AddNeighborRegion(RegionInfo region)
@@ -683,9 +684,10 @@ namespace OpenSim.Region.Framework.Scenes
683 } 684 }
684 685
685 // Alias IncomingHelloNeighbour OtherRegionUp, for now 686 // Alias IncomingHelloNeighbour OtherRegionUp, for now
686 public bool IncomingHelloNeighbour(RegionInfo neighbour) 687 public GridRegion IncomingHelloNeighbour(RegionInfo neighbour)
687 { 688 {
688 return OtherRegionUp(neighbour); 689 OtherRegionUp(new GridRegion(neighbour));
690 return new GridRegion(RegionInfo);
689 } 691 }
690 692
691 /// <summary> 693 /// <summary>
@@ -994,7 +996,7 @@ namespace OpenSim.Region.Framework.Scenes
994 996
995 // Loop it 997 // Loop it
996 if (m_frame == Int32.MaxValue) 998 if (m_frame == Int32.MaxValue)
997 m_frame = 0; 999 m_frame = 0;
998 1000
999 otherMS = Environment.TickCount; 1001 otherMS = Environment.TickCount;
1000 // run through all entities looking for updates (slow) 1002 // run through all entities looking for updates (slow)
@@ -1336,24 +1338,31 @@ namespace OpenSim.Region.Framework.Scenes
1336 RegisterCommsEvents(); 1338 RegisterCommsEvents();
1337 1339
1338 // These two 'commands' *must be* next to each other or sim rebooting fails. 1340 // These two 'commands' *must be* next to each other or sim rebooting fails.
1339 m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); 1341 //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo);
1342
1343 GridRegion region = new GridRegion(RegionInfo);
1344 bool success = GridService.RegisterRegion(RegionInfo.ScopeID, region);
1345 if (!success)
1346 throw new Exception("Can't register with grid");
1347
1348 m_sceneGridService.SetScene(this);
1340 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); 1349 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
1341 1350
1342 Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings(); 1351 //Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings();
1343 1352
1344 if (dGridSettings.ContainsKey("allow_forceful_banlines")) 1353 //if (dGridSettings.ContainsKey("allow_forceful_banlines"))
1345 { 1354 //{
1346 if (dGridSettings["allow_forceful_banlines"] != "TRUE") 1355 // if (dGridSettings["allow_forceful_banlines"] != "TRUE")
1347 { 1356 // {
1348 m_log.Info("[GRID]: Grid is disabling forceful parcel banlists"); 1357 // m_log.Info("[GRID]: Grid is disabling forceful parcel banlists");
1349 EventManager.TriggerSetAllowForcefulBan(false); 1358 // EventManager.TriggerSetAllowForcefulBan(false);
1350 } 1359 // }
1351 else 1360 // else
1352 { 1361 // {
1353 m_log.Info("[GRID]: Grid is allowing forceful parcel banlists"); 1362 // m_log.Info("[GRID]: Grid is allowing forceful parcel banlists");
1354 EventManager.TriggerSetAllowForcefulBan(true); 1363 // EventManager.TriggerSetAllowForcefulBan(true);
1355 } 1364 // }
1356 } 1365 //}
1357 } 1366 }
1358 1367
1359 /// <summary> 1368 /// <summary>
@@ -2014,12 +2023,12 @@ namespace OpenSim.Region.Framework.Scenes
2014 return true; 2023 return true;
2015 } 2024 }
2016 break; 2025 break;
2017 case Cardinals.W: 2026 case Cardinals.W:
2018 foreach (Border b in WestBorders) 2027 foreach (Border b in WestBorders)
2019 { 2028 {
2020 if (b.TestCross(position)) 2029 if (b.TestCross(position))
2021 return true; 2030 return true;
2022 } 2031 }
2023 break; 2032 break;
2024 } 2033 }
2025 } 2034 }
@@ -2296,8 +2305,8 @@ namespace OpenSim.Region.Framework.Scenes
2296 "to avatar {0} at position {1}", 2305 "to avatar {0} at position {1}",
2297 sp.UUID.ToString(), grp.AbsolutePosition); 2306 sp.UUID.ToString(), grp.AbsolutePosition);
2298 AttachObject(sp.ControllingClient, 2307 AttachObject(sp.ControllingClient,
2299 grp.LocalId, (uint)0, 2308 grp.LocalId, 0,
2300 grp.GroupRotation, 2309 grp.Rotation,
2301 grp.AbsolutePosition, false); 2310 grp.AbsolutePosition, false);
2302 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2311 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2303 grp.SendGroupFullUpdate(); 2312 grp.SendGroupFullUpdate();
@@ -2717,10 +2726,12 @@ namespace OpenSim.Region.Framework.Scenes
2717 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); 2726 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId);
2718 if (UserProfile != null) 2727 if (UserProfile != null)
2719 { 2728 {
2720 RegionInfo regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegionID); 2729 GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID);
2721 if (regionInfo == null) 2730 if (regionInfo == null)
2722 { 2731 {
2723 regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion); 2732 uint x = 0, y = 0;
2733 Utils.LongToUInts(UserProfile.HomeRegion, out x, out y);
2734 regionInfo = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
2724 if (regionInfo != null) // home region can be away temporarily, too 2735 if (regionInfo != null) // home region can be away temporarily, too
2725 { 2736 {
2726 UserProfile.HomeRegionID = regionInfo.RegionID; 2737 UserProfile.HomeRegionID = regionInfo.RegionID;
@@ -3074,7 +3085,7 @@ namespace OpenSim.Region.Framework.Scenes
3074 m_sceneGridService.OnExpectUser += HandleNewUserConnection; 3085 m_sceneGridService.OnExpectUser += HandleNewUserConnection;
3075 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; 3086 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
3076 m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent; 3087 m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
3077 m_sceneGridService.OnRegionUp += OtherRegionUp; 3088 //m_eventManager.OnRegionUp += OtherRegionUp;
3078 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; 3089 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
3079 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; 3090 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
3080 //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; 3091 //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
@@ -3102,7 +3113,7 @@ namespace OpenSim.Region.Framework.Scenes
3102 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; 3113 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
3103 m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup; 3114 m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
3104 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; 3115 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
3105 m_sceneGridService.OnRegionUp -= OtherRegionUp; 3116 //m_eventManager.OnRegionUp -= OtherRegionUp;
3106 m_sceneGridService.OnExpectUser -= HandleNewUserConnection; 3117 m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
3107 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; 3118 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
3108 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; 3119 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
@@ -3111,7 +3122,11 @@ namespace OpenSim.Region.Framework.Scenes
3111 if (m_interregionCommsIn != null) 3122 if (m_interregionCommsIn != null)
3112 m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; 3123 m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
3113 3124
3125 // this does nothing; should be removed
3114 m_sceneGridService.Close(); 3126 m_sceneGridService.Close();
3127
3128 if (!GridService.DeregisterRegion(m_regInfo.RegionID))
3129 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName);
3115 } 3130 }
3116 3131
3117 /// <summary> 3132 /// <summary>
@@ -3255,7 +3270,7 @@ namespace OpenSim.Region.Framework.Scenes
3255 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", 3270 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
3256 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3271 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
3257 //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName); 3272 //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName);
3258 return false; 3273 return false;
3259 } 3274 }
3260 } 3275 }
3261 3276
@@ -3404,7 +3419,7 @@ namespace OpenSim.Region.Framework.Scenes
3404 /// We've got an update about an agent that sees into this region, 3419 /// We've got an update about an agent that sees into this region,
3405 /// send it to ScenePresence for processing It's the full data. 3420 /// send it to ScenePresence for processing It's the full data.
3406 /// </summary> 3421 /// </summary>
3407 /// <param name="cAgentData">Agent that contains all of the relevant things about an agent. 3422 /// <param name="cAgentData">Agent that contains all of the relevant things about an agent.
3408 /// Appearance, animations, position, etc.</param> 3423 /// Appearance, animations, position, etc.</param>
3409 /// <returns>true if we handled it.</returns> 3424 /// <returns>true if we handled it.</returns>
3410 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) 3425 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
@@ -3557,30 +3572,6 @@ namespace OpenSim.Region.Framework.Scenes
3557 } 3572 }
3558 3573
3559 /// <summary> 3574 /// <summary>
3560 /// Requests information about this region from gridcomms
3561 /// </summary>
3562 /// <param name="regionHandle"></param>
3563 /// <returns></returns>
3564 public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
3565 {
3566 return m_sceneGridService.RequestNeighbouringRegionInfo(regionHandle);
3567 }
3568
3569 /// <summary>
3570 /// Requests textures for map from minimum region to maximum region in world cordinates
3571 /// </summary>
3572 /// <param name="remoteClient"></param>
3573 /// <param name="minX"></param>
3574 /// <param name="minY"></param>
3575 /// <param name="maxX"></param>
3576 /// <param name="maxY"></param>
3577 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY)
3578 {
3579 m_log.DebugFormat("[MAPBLOCK]: {0}-{1}, {2}-{3}", minX, minY, maxX, maxY);
3580 m_sceneGridService.RequestMapBlocks(remoteClient, minX, minY, maxX, maxY);
3581 }
3582
3583 /// <summary>
3584 /// Tries to teleport agent to other region. 3575 /// Tries to teleport agent to other region.
3585 /// </summary> 3576 /// </summary>
3586 /// <param name="remoteClient"></param> 3577 /// <param name="remoteClient"></param>
@@ -3591,7 +3582,7 @@ namespace OpenSim.Region.Framework.Scenes
3591 public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, 3582 public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position,
3592 Vector3 lookat, uint teleportFlags) 3583 Vector3 lookat, uint teleportFlags)
3593 { 3584 {
3594 RegionInfo regionInfo = m_sceneGridService.RequestClosestRegion(regionName); 3585 GridRegion regionInfo = GridService.GetRegionByName(UUID.Zero, regionName);
3595 if (regionInfo == null) 3586 if (regionInfo == null)
3596 { 3587 {
3597 // can't find the region: Tell viewer and abort 3588 // can't find the region: Tell viewer and abort
@@ -3680,7 +3671,7 @@ namespace OpenSim.Region.Framework.Scenes
3680 /// <param name="position"></param> 3671 /// <param name="position"></param>
3681 public void RequestTeleportLandmark(IClientAPI remoteClient, UUID regionID, Vector3 position) 3672 public void RequestTeleportLandmark(IClientAPI remoteClient, UUID regionID, Vector3 position)
3682 { 3673 {
3683 RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(regionID); 3674 GridRegion info = GridService.GetRegionByUUID(UUID.Zero, regionID);
3684 3675
3685 if (info == null) 3676 if (info == null)
3686 { 3677 {
@@ -3864,10 +3855,6 @@ namespace OpenSim.Region.Framework.Scenes
3864 return LandChannel.GetLandObject((int)x, (int)y).landData; 3855 return LandChannel.GetLandObject((int)x, (int)y).landData;
3865 } 3856 }
3866 3857
3867 public RegionInfo RequestClosestRegion(string name)
3868 {
3869 return m_sceneGridService.RequestClosestRegion(name);
3870 }
3871 3858
3872 #endregion 3859 #endregion
3873 3860
@@ -4154,6 +4141,11 @@ namespace OpenSim.Region.Framework.Scenes
4154 m_sceneGraph.ForEachClient(action); 4141 m_sceneGraph.ForEachClient(action);
4155 } 4142 }
4156 4143
4144 public void ForEachSOG(Action<SceneObjectGroup> action)
4145 {
4146 m_sceneGraph.ForEachSOG(action);
4147 }
4148
4157 /// <summary> 4149 /// <summary>
4158 /// Returns a list of the entities in the scene. This is a new list so operations perform on the list itself 4150 /// Returns a list of the entities in the scene. This is a new list so operations perform on the list itself
4159 /// will not affect the original list of objects in the scene. 4151 /// will not affect the original list of objects in the scene.
@@ -4178,14 +4170,18 @@ namespace OpenSim.Region.Framework.Scenes
4178 4170
4179 public void RegionHandleRequest(IClientAPI client, UUID regionID) 4171 public void RegionHandleRequest(IClientAPI client, UUID regionID)
4180 { 4172 {
4181 RegionInfo info; 4173 ulong handle = 0;
4182 if (regionID == RegionInfo.RegionID) 4174 if (regionID == RegionInfo.RegionID)
4183 info = RegionInfo; 4175 handle = RegionInfo.RegionHandle;
4184 else 4176 else
4185 info = CommsManager.GridService.RequestNeighbourInfo(regionID); 4177 {
4178 GridRegion r = GridService.GetRegionByUUID(UUID.Zero, regionID);
4179 if (r != null)
4180 handle = r.RegionHandle;
4181 }
4186 4182
4187 if (info != null) 4183 if (handle != 0)
4188 client.SendRegionHandle(regionID, info.RegionHandle); 4184 client.SendRegionHandle(regionID, handle);
4189 } 4185 }
4190 4186
4191 public void TerrainUnAcked(IClientAPI client, int patchX, int patchY) 4187 public void TerrainUnAcked(IClientAPI client, int patchX, int patchY)
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 2a82237..0ac4ed4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -36,6 +36,7 @@ using OpenSim.Framework;
36using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37using OpenSim.Framework.Communications.Cache; 37using OpenSim.Framework.Communications.Cache;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39 40
40namespace OpenSim.Region.Framework.Scenes 41namespace OpenSim.Region.Framework.Scenes
41{ 42{
@@ -91,7 +92,7 @@ namespace OpenSim.Region.Framework.Scenes
91 /// <value> 92 /// <value>
92 /// Registered classes that are capable of creating entities. 93 /// Registered classes that are capable of creating entities.
93 /// </value> 94 /// </value>
94 protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>(); 95 protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>();
95 96
96 /// <summary> 97 /// <summary>
97 /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is 98 /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is
@@ -227,7 +228,7 @@ namespace OpenSim.Region.Framework.Scenes
227 return false; 228 return false;
228 } 229 }
229 230
230 public abstract bool OtherRegionUp(RegionInfo thisRegion); 231 public abstract void OtherRegionUp(GridRegion otherRegion);
231 232
232 public virtual string GetSimulatorVersion() 233 public virtual string GetSimulatorVersion()
233 { 234 {
@@ -278,7 +279,7 @@ namespace OpenSim.Region.Framework.Scenes
278 _primAllocateMutex.ReleaseMutex(); 279 _primAllocateMutex.ReleaseMutex();
279 280
280 return myID; 281 return myID;
281 } 282 }
282 283
283 #region Module Methods 284 #region Module Methods
284 285
@@ -472,7 +473,7 @@ namespace OpenSim.Region.Framework.Scenes
472 /// <summary> 473 /// <summary>
473 /// Shows various details about the sim based on the parameters supplied by the console command in openSimMain. 474 /// Shows various details about the sim based on the parameters supplied by the console command in openSimMain.
474 /// </summary> 475 /// </summary>
475 /// <param name="showParams">What to show</param> 476 /// <param name="showParams">What to show</param>
476 public virtual void Show(string[] showParams) 477 public virtual void Show(string[] showParams)
477 { 478 {
478 switch (showParams[0]) 479 switch (showParams[0])
@@ -488,7 +489,7 @@ namespace OpenSim.Region.Framework.Scenes
488 } 489 }
489 break; 490 break;
490 } 491 }
491 } 492 }
492 493
493 public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) 494 public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback)
494 { 495 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 5f2333e..4a2db5e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -41,6 +41,7 @@ using OpenSim.Framework.Capabilities;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Services.Interfaces; 42using OpenSim.Services.Interfaces;
43using OSD = OpenMetaverse.StructuredData.OSD; 43using OSD = OpenMetaverse.StructuredData.OSD;
44using GridRegion = OpenSim.Services.Interfaces.GridRegion;
44 45
45namespace OpenSim.Region.Framework.Scenes 46namespace OpenSim.Region.Framework.Scenes
46{ 47{
@@ -58,6 +59,7 @@ namespace OpenSim.Region.Framework.Scenes
58 protected CommunicationsManager m_commsProvider; 59 protected CommunicationsManager m_commsProvider;
59 protected IInterregionCommsOut m_interregionCommsOut; 60 protected IInterregionCommsOut m_interregionCommsOut;
60 protected RegionInfo m_regionInfo; 61 protected RegionInfo m_regionInfo;
62 protected Scene m_scene;
61 63
62 protected RegionCommsListener regionCommsHost; 64 protected RegionCommsListener regionCommsHost;
63 65
@@ -91,10 +93,10 @@ namespace OpenSim.Region.Framework.Scenes
91 /// </summary> 93 /// </summary>
92 public event PrimCrossing OnPrimCrossingIntoRegion; 94 public event PrimCrossing OnPrimCrossingIntoRegion;
93 95
94 /// <summary> 96 ///// <summary>
95 /// A New Region is up and available 97 ///// A New Region is up and available
96 /// </summary> 98 ///// </summary>
97 public event RegionUp OnRegionUp; 99 //public event RegionUp OnRegionUp;
98 100
99 /// <summary> 101 /// <summary>
100 /// We have a child agent for this avatar and we're getting a status update about it 102 /// We have a child agent for this avatar and we're getting a status update about it
@@ -117,7 +119,7 @@ namespace OpenSim.Region.Framework.Scenes
117 private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim; 119 private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
118 private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; 120 private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
119 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; 121 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
120 private RegionUp handlerRegionUp = null; // OnRegionUp; 122 //private RegionUp handlerRegionUp = null; // OnRegionUp;
121 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; 123 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
122 //private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar; 124 //private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar;
123 private LogOffUser handlerLogOffUser = null; 125 private LogOffUser handlerLogOffUser = null;
@@ -131,6 +133,13 @@ namespace OpenSim.Region.Framework.Scenes
131 m_agentsInTransit = new List<UUID>(); 133 m_agentsInTransit = new List<UUID>();
132 } 134 }
133 135
136 public void SetScene(Scene s)
137 {
138 m_scene = s;
139 m_regionInfo = s.RegionInfo;
140 m_interregionCommsOut = m_scene.RequestModuleInterface<IInterregionCommsOut>();
141 }
142
134 /// <summary> 143 /// <summary>
135 /// Register a region with the grid 144 /// Register a region with the grid
136 /// </summary> 145 /// </summary>
@@ -138,40 +147,30 @@ namespace OpenSim.Region.Framework.Scenes
138 /// <exception cref="System.Exception">Thrown if region registration fails.</exception> 147 /// <exception cref="System.Exception">Thrown if region registration fails.</exception>
139 public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos) 148 public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos)
140 { 149 {
141 m_interregionCommsOut = comms_out; 150 //m_interregionCommsOut = comms_out;
142 151
143 m_regionInfo = regionInfos; 152 //m_regionInfo = regionInfos;
144 m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName; 153 //m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName;
145 regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo); 154 //regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo);
146 155
147 if (regionCommsHost != null) 156 //if (regionCommsHost != null)
148 { 157 //{
149 //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString()); 158 // //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString());
150 159
151 regionCommsHost.debugRegionName = regionInfos.RegionName; 160 // regionCommsHost.debugRegionName = regionInfos.RegionName;
152 regionCommsHost.OnExpectPrim += IncomingPrimCrossing; 161 // regionCommsHost.OnExpectPrim += IncomingPrimCrossing;
153 regionCommsHost.OnExpectUser += NewUserConnection; 162 // regionCommsHost.OnExpectUser += NewUserConnection;
154 regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing; 163 // regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
155 regionCommsHost.OnCloseAgentConnection += CloseConnection; 164 // regionCommsHost.OnCloseAgentConnection += CloseConnection;
156 regionCommsHost.OnRegionUp += newRegionUp; 165 // regionCommsHost.OnRegionUp += newRegionUp;
157 regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; 166 // regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
158 regionCommsHost.OnLogOffUser += GridLogOffUser; 167 // regionCommsHost.OnLogOffUser += GridLogOffUser;
159 regionCommsHost.OnGetLandData += FetchLandData; 168 // regionCommsHost.OnGetLandData += FetchLandData;
160 } 169 //}
161 else 170 //else
162 { 171 //{
163 //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got null"); 172 // //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got null");
164 } 173 //}
165 }
166
167 /// <summary>
168 /// Returns a region with the name closest to string provided
169 /// </summary>
170 /// <param name="name">Partial Region Name for matching</param>
171 /// <returns>Region Information for the region</returns>
172 public RegionInfo RequestClosestRegion(string name)
173 {
174 return m_commsProvider.GridService.RequestClosestRegion(name);
175 } 174 }
176 175
177 /// <summary> 176 /// <summary>
@@ -180,30 +179,31 @@ namespace OpenSim.Region.Framework.Scenes
180 /// </summary> 179 /// </summary>
181 public void Close() 180 public void Close()
182 { 181 {
183 if (regionCommsHost != null) 182
184 { 183 //if (regionCommsHost != null)
185 regionCommsHost.OnLogOffUser -= GridLogOffUser; 184 //{
186 regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate; 185 // regionCommsHost.OnLogOffUser -= GridLogOffUser;
187 regionCommsHost.OnRegionUp -= newRegionUp; 186 // regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate;
188 regionCommsHost.OnExpectUser -= NewUserConnection; 187 // regionCommsHost.OnRegionUp -= newRegionUp;
189 regionCommsHost.OnExpectPrim -= IncomingPrimCrossing; 188 // regionCommsHost.OnExpectUser -= NewUserConnection;
190 regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing; 189 // regionCommsHost.OnExpectPrim -= IncomingPrimCrossing;
191 regionCommsHost.OnCloseAgentConnection -= CloseConnection; 190 // regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
192 regionCommsHost.OnGetLandData -= FetchLandData; 191 // regionCommsHost.OnCloseAgentConnection -= CloseConnection;
192 // regionCommsHost.OnGetLandData -= FetchLandData;
193 193
194 try 194 // try
195 { 195 // {
196 m_commsProvider.GridService.DeregisterRegion(m_regionInfo); 196 // m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
197 } 197 // }
198 catch (Exception e) 198 // catch (Exception e)
199 { 199 // {
200 m_log.ErrorFormat( 200 // m_log.ErrorFormat(
201 "[GRID]: Deregistration of region {0} from the grid failed - {1}. Continuing", 201 // "[GRID]: Deregistration of region {0} from the grid failed - {1}. Continuing",
202 m_regionInfo.RegionName, e); 202 // m_regionInfo.RegionName, e);
203 } 203 // }
204 204
205 regionCommsHost = null; 205 // regionCommsHost = null;
206 } 206 //}
207 } 207 }
208 208
209 #region CommsManager Event handlers 209 #region CommsManager Event handlers
@@ -239,22 +239,6 @@ namespace OpenSim.Region.Framework.Scenes
239 } 239 }
240 240
241 /// <summary> 241 /// <summary>
242 /// A New Region is now available. Inform the scene that there is a new region available.
243 /// </summary>
244 /// <param name="region">Information about the new region that is available</param>
245 /// <returns>True if the event was handled</returns>
246 protected bool newRegionUp(RegionInfo region)
247 {
248 handlerRegionUp = OnRegionUp;
249 if (handlerRegionUp != null)
250 {
251 //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName);
252 handlerRegionUp(region);
253 }
254 return true;
255 }
256
257 /// <summary>
258 /// Inform the scene that we've got an update about a child agent that we have 242 /// Inform the scene that we've got an update about a child agent that we have
259 /// </summary> 243 /// </summary>
260 /// <param name="cAgentData"></param> 244 /// <param name="cAgentData"></param>
@@ -337,7 +321,7 @@ namespace OpenSim.Region.Framework.Scenes
337 #region Inform Client of Neighbours 321 #region Inform Client of Neighbours
338 322
339 private delegate void InformClientOfNeighbourDelegate( 323 private delegate void InformClientOfNeighbourDelegate(
340 ScenePresence avatar, AgentCircuitData a, SimpleRegionInfo reg, IPEndPoint endPoint, bool newAgent); 324 ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent);
341 325
342 private void InformClientOfNeighbourCompleted(IAsyncResult iar) 326 private void InformClientOfNeighbourCompleted(IAsyncResult iar)
343 { 327 {
@@ -355,7 +339,7 @@ namespace OpenSim.Region.Framework.Scenes
355 /// <param name="a"></param> 339 /// <param name="a"></param>
356 /// <param name="regionHandle"></param> 340 /// <param name="regionHandle"></param>
357 /// <param name="endPoint"></param> 341 /// <param name="endPoint"></param>
358 private void InformClientOfNeighbourAsync(ScenePresence avatar, AgentCircuitData a, SimpleRegionInfo reg, 342 private void InformClientOfNeighbourAsync(ScenePresence avatar, AgentCircuitData a, GridRegion reg,
359 IPEndPoint endPoint, bool newAgent) 343 IPEndPoint endPoint, bool newAgent)
360 { 344 {
361 // Let's wait just a little to give time to originating regions to catch up with closing child agents 345 // Let's wait just a little to give time to originating regions to catch up with closing child agents
@@ -373,8 +357,7 @@ namespace OpenSim.Region.Framework.Scenes
373 357
374 string reason = String.Empty; 358 string reason = String.Empty;
375 359
376 //bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a); 360
377
378 bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, out reason); 361 bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, out reason);
379 362
380 if (regionAccepted && newAgent) 363 if (regionAccepted && newAgent)
@@ -407,17 +390,7 @@ namespace OpenSim.Region.Framework.Scenes
407 390
408 } 391 }
409 392
410 public void RequestNeighbors(RegionInfo region) 393 public List<GridRegion> RequestNeighbours(Scene pScene, uint pRegionLocX, uint pRegionLocY)
411 {
412 // List<SimpleRegionInfo> neighbours =
413 m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
414 //IPEndPoint blah = new IPEndPoint();
415
416 //blah.Address = region.RemotingAddress;
417 //blah.Port = region.RemotingPort;
418 }
419
420 public List<SimpleRegionInfo> RequestNeighbors(Scene pScene, uint pRegionLocX, uint pRegionLocY)
421 { 394 {
422 Border[] northBorders = pScene.NorthBorders.ToArray(); 395 Border[] northBorders = pScene.NorthBorders.ToArray();
423 Border[] southBorders = pScene.SouthBorders.ToArray(); 396 Border[] southBorders = pScene.SouthBorders.ToArray();
@@ -427,50 +400,34 @@ namespace OpenSim.Region.Framework.Scenes
427 // Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement. 400 // Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement.
428 if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) 401 if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1)
429 { 402 {
430 return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY); 403 return m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID);
431 } 404 }
432 else 405 else
433 { 406 {
434 Vector2 extent = Vector2.Zero; 407 Vector2 extent = Vector2.Zero;
435 for (int i=0;i<eastBorders.Length;i++) 408 for (int i = 0; i < eastBorders.Length; i++)
436 { 409 {
437 extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X; 410 extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X;
438 } 411 }
439 for (int i=0;i<northBorders.Length;i++) 412 for (int i = 0; i < northBorders.Length; i++)
440 { 413 {
441 extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y; 414 extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y;
442 } 415 }
443 416
444 List<SimpleRegionInfo> neighbourList = new List<SimpleRegionInfo>();
445
446 // Loss of fraction on purpose 417 // Loss of fraction on purpose
447 extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1; 418 extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1;
448 extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1; 419 extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1;
449 420
450 int startX = (int) pRegionLocX - 1; 421 int startX = (int)(pRegionLocX - 1) * (int)Constants.RegionSize;
451 int startY = (int) pRegionLocY - 1; 422 int startY = (int)(pRegionLocY - 1) * (int)Constants.RegionSize;
452 423
453 int endX = (int) pRegionLocX + (int)extent.X; 424 int endX = ((int)pRegionLocX + (int)extent.X) * (int)Constants.RegionSize;
454 int endY = (int) pRegionLocY + (int)extent.Y; 425 int endY = ((int)pRegionLocY + (int)extent.Y) * (int)Constants.RegionSize;
455 426
456 for (int i=startX;i<endX;i++) 427 List<GridRegion> neighbours = m_scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY);
457 { 428 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
458 for (int j=startY;j<endY;j++) 429
459 { 430 return neighbours;
460 // Skip CurrentRegion
461 if (i == (int)pRegionLocX && j == (int)pRegionLocY)
462 continue;
463
464 ulong regionHandle = Util.UIntsToLong((uint)(i * Constants.RegionSize),
465 (uint)(j * Constants.RegionSize));
466 RegionInfo neighborreg = m_commsProvider.GridService.RequestNeighbourInfo(regionHandle);
467 if (neighborreg != null)
468 {
469 neighbourList.Add(neighborreg);
470 }
471 }
472 }
473 return neighbourList;
474 //SimpleRegionInfo regionData = m_commsProvider.GridService.RequestNeighbourInfo() 431 //SimpleRegionInfo regionData = m_commsProvider.GridService.RequestNeighbourInfo()
475 //return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY); 432 //return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY);
476 } 433 }
@@ -482,29 +439,28 @@ namespace OpenSim.Region.Framework.Scenes
482 /// </summary> 439 /// </summary>
483 public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours) 440 public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours)
484 { 441 {
485 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); 442 //List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
443 List<GridRegion> neighbours = new List<GridRegion>();
486 444
487 //m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 445 ////m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
488 for (int i = 0; i < lstneighbours.Count; i++) 446 //for (int i = 0; i < lstneighbours.Count; i++)
489 { 447 //{
490 // We don't want to keep sending to regions that consistently fail on comms. 448 // // We don't want to keep sending to regions that consistently fail on comms.
491 if (!(lstneighbours[i].commFailTF)) 449 // if (!(lstneighbours[i].commFailTF))
492 { 450 // {
493 neighbours.Add(new SimpleRegionInfo(lstneighbours[i])); 451 // neighbours.Add(new SimpleRegionInfo(lstneighbours[i]));
494 } 452 // }
495 } 453 //}
496 // we're going to be using the above code once neighbour cache is correct. Currently it doesn't appear to be 454 // we're going to be using the above code once neighbour cache is correct. Currently it doesn't appear to be
497 // So we're temporarily going back to the old method of grabbing it from the Grid Server Every time :/ 455 // So we're temporarily going back to the old method of grabbing it from the Grid Server Every time :/
498 if (m_regionInfo != null) 456 if (m_regionInfo != null)
499 { 457 {
500 neighbours = 458 neighbours = RequestNeighbours(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
501 RequestNeighbors(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
502 } 459 }
503 else 460 else
504 { 461 {
505 m_log.Debug("[ENABLENEIGHBOURCHILDAGENTS]: m_regionInfo was null in EnableNeighbourChildAgents, is this a NPC?"); 462 m_log.Debug("[ENABLENEIGHBOURCHILDAGENTS]: m_regionInfo was null in EnableNeighbourChildAgents, is this a NPC?");
506 } 463 }
507
508 464
509 /// We need to find the difference between the new regions where there are no child agents 465 /// We need to find the difference between the new regions where there are no child agents
510 /// and the regions where there are already child agents. We only send notification to the former. 466 /// and the regions where there are already child agents. We only send notification to the former.
@@ -547,8 +503,9 @@ namespace OpenSim.Region.Framework.Scenes
547 503
548 /// Create the necessary child agents 504 /// Create the necessary child agents
549 List<AgentCircuitData> cagents = new List<AgentCircuitData>(); 505 List<AgentCircuitData> cagents = new List<AgentCircuitData>();
550 foreach (SimpleRegionInfo neighbour in neighbours) 506 //foreach (SimpleRegionInfo neighbour in neighbours)
551 { 507 foreach (GridRegion neighbour in neighbours)
508 {
552 if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle) 509 if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle)
553 { 510 {
554 511
@@ -588,7 +545,7 @@ namespace OpenSim.Region.Framework.Scenes
588 545
589 bool newAgent = false; 546 bool newAgent = false;
590 int count = 0; 547 int count = 0;
591 foreach (SimpleRegionInfo neighbour in neighbours) 548 foreach (GridRegion neighbour in neighbours)
592 { 549 {
593 // Don't do it if there's already an agent in that region 550 // Don't do it if there's already an agent in that region
594 if (newRegions.Contains(neighbour.RegionHandle)) 551 if (newRegions.Contains(neighbour.RegionHandle))
@@ -641,7 +598,7 @@ namespace OpenSim.Region.Framework.Scenes
641 /// This informs a single neighboring region about agent "avatar". 598 /// This informs a single neighboring region about agent "avatar".
642 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 599 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
643 /// </summary> 600 /// </summary>
644 public void InformNeighborChildAgent(ScenePresence avatar, SimpleRegionInfo region) 601 public void InformNeighborChildAgent(ScenePresence avatar, GridRegion region)
645 { 602 {
646 AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); 603 AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
647 agent.BaseFolder = UUID.Zero; 604 agent.BaseFolder = UUID.Zero;
@@ -672,61 +629,63 @@ namespace OpenSim.Region.Framework.Scenes
672 /// <param name="regionhandle"></param> 629 /// <param name="regionhandle"></param>
673 private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle) 630 private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle)
674 { 631 {
675 m_log.Info("[INTERGRID]: Starting to inform neighbors that I'm here"); 632 uint x = 0, y = 0;
676 //RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port); 633 Utils.LongToUInts(regionhandle, out x, out y);
677
678 //bool regionAccepted =
679 // m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region), regionhandle);
680 634
681 //bool regionAccepted = m_interregionCommsOut.SendHelloNeighbour(regionhandle, region); 635 GridRegion neighbour = null;
682 bool regionAccepted = false;
683 if (neighbourService != null) 636 if (neighbourService != null)
684 regionAccepted = neighbourService.HelloNeighbour(regionhandle, region); 637 neighbour = neighbourService.HelloNeighbour(regionhandle, region);
685 else 638 else
686 m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region"); 639 m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region");
687 640
688 if (regionAccepted) 641 if (neighbour != null)
689 { 642 {
690 m_log.Info("[INTERGRID]: Completed informing neighbors that I'm here"); 643 m_log.DebugFormat("[INTERGRID]: Successfully informed neighbour {0}-{1} that I'm here", x / Constants.RegionSize, y / Constants.RegionSize);
691 handlerRegionUp = OnRegionUp; 644 m_scene.EventManager.TriggerOnRegionUp(neighbour);
692
693 // yes, we're notifying ourselves.
694 if (handlerRegionUp != null)
695 handlerRegionUp(region);
696 } 645 }
697 else 646 else
698 { 647 {
699 m_log.Warn("[INTERGRID]: Failed to inform neighbors that I'm here."); 648 m_log.WarnFormat("[INTERGRID]: Failed to inform neighbour {0}-{1} that I'm here.", x / Constants.RegionSize, y / Constants.RegionSize);
700 } 649 }
701 } 650 }
702 651
703 /// <summary> 652
704 /// Called by scene when region is initialized (not always when it's listening for agents)
705 /// This is an inter-region message that informs the surrounding neighbors that the sim is up.
706 /// </summary>
707 public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region) 653 public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
708 { 654 {
709 //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); 655 //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
710 656
711 657 for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++)
712 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); 658 for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++)
713 // This stays uncached because we don't already know about our neighbors at this point. 659 if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region
714 neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 660 {
715 if (neighbours != null) 661 ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize);
716 { 662 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
717 for (int i = 0; i < neighbours.Count; i++)
718 {
719 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
720 663
721 d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle, 664 d.BeginInvoke(neighbourService, region, handle,
722 InformNeighborsThatRegionisUpCompleted, 665 InformNeighborsThatRegionisUpCompleted,
723 d); 666 d);
724 } 667 }
725 } 668
669 //List<GridRegion> neighbours = new List<GridRegion>();
670 //// This stays uncached because we don't already know about our neighbors at this point.
671
672 //neighbours = m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID);
673 //if (neighbours != null)
674 //{
675 // for (int i = 0; i < neighbours.Count; i++)
676 // {
677 // InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
678
679 // d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle,
680 // InformNeighborsThatRegionisUpCompleted,
681 // d);
682 // }
683 //}
726 684
727 //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region)); 685 //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
728 } 686 }
729 687
688
730 public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, ulong regionHandle); 689 public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, ulong regionHandle);
731 690
732 /// <summary> 691 /// <summary>
@@ -822,41 +781,6 @@ namespace OpenSim.Region.Framework.Scenes
822 } 781 }
823 } 782 }
824 783
825 /// <summary>
826 /// Helper function to request neighbors from grid-comms
827 /// </summary>
828 /// <param name="regionHandle"></param>
829 /// <returns></returns>
830 public virtual RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
831 {
832 //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionHandle.ToString());
833 return m_commsProvider.GridService.RequestNeighbourInfo(regionHandle);
834 }
835
836 /// <summary>
837 /// Helper function to request neighbors from grid-comms
838 /// </summary>
839 /// <param name="regionID"></param>
840 /// <returns></returns>
841 public virtual RegionInfo RequestNeighbouringRegionInfo(UUID regionID)
842 {
843 //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionID);
844 return m_commsProvider.GridService.RequestNeighbourInfo(regionID);
845 }
846
847 /// <summary>
848 /// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates
849 /// </summary>
850 /// <param name="minX"></param>
851 /// <param name="minY"></param>
852 /// <param name="maxX"></param>
853 /// <param name="maxY"></param>
854 public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY)
855 {
856 List<MapBlockData> mapBlocks;
857 mapBlocks = m_commsProvider.GridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, minX + 4, minY + 4);
858 remoteClient.SendMapBlock(mapBlocks, 0);
859 }
860 784
861 /// <summary> 785 /// <summary>
862 /// Try to teleport an agent to a new region. 786 /// Try to teleport an agent to a new region.
@@ -921,7 +845,10 @@ namespace OpenSim.Region.Framework.Scenes
921 } 845 }
922 else 846 else
923 { 847 {
924 RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle); 848 uint x = 0, y = 0;
849 Utils.LongToUInts(regionHandle, out x, out y);
850 GridRegion reg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
851
925 if (reg != null) 852 if (reg != null)
926 { 853 {
927 m_log.DebugFormat( 854 m_log.DebugFormat(
@@ -1228,10 +1155,10 @@ namespace OpenSim.Region.Framework.Scenes
1228 return false; 1155 return false;
1229 } 1156 }
1230 1157
1231 private List<ulong> NeighbourHandles(List<SimpleRegionInfo> neighbours) 1158 private List<ulong> NeighbourHandles(List<GridRegion> neighbours)
1232 { 1159 {
1233 List<ulong> handles = new List<ulong>(); 1160 List<ulong> handles = new List<ulong>();
1234 foreach (SimpleRegionInfo reg in neighbours) 1161 foreach (GridRegion reg in neighbours)
1235 { 1162 {
1236 handles.Add(reg.RegionHandle); 1163 handles.Add(reg.RegionHandle);
1237 } 1164 }
@@ -1482,7 +1409,10 @@ namespace OpenSim.Region.Framework.Scenes
1482 m_log.DebugFormat("[SCENE COMM]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury); 1409 m_log.DebugFormat("[SCENE COMM]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury);
1483 1410
1484 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); 1411 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
1485 SimpleRegionInfo neighbourRegion = RequestNeighbouringRegionInfo(neighbourHandle); 1412
1413 int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize);
1414 GridRegion neighbourRegion = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
1415
1486 if (neighbourRegion != null && agent.ValidateAttachments()) 1416 if (neighbourRegion != null && agent.ValidateAttachments())
1487 { 1417 {
1488 pos = pos + (agent.Velocity); 1418 pos = pos + (agent.Velocity);
@@ -1609,11 +1539,6 @@ namespace OpenSim.Region.Framework.Scenes
1609 } 1539 }
1610 1540
1611 1541
1612 public Dictionary<string, string> GetGridSettings()
1613 {
1614 return m_commsProvider.GridService.GetGridSettings();
1615 }
1616
1617 public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) 1542 public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
1618 { 1543 {
1619 m_commsProvider.LogOffUser(userid, regionid, regionhandle, position, lookat); 1544 m_commsProvider.LogOffUser(userid, regionid, regionhandle, position, lookat);
@@ -1650,19 +1575,14 @@ namespace OpenSim.Region.Framework.Scenes
1650 return m_commsProvider.GetUserFriendList(friendlistowner); 1575 return m_commsProvider.GetUserFriendList(friendlistowner);
1651 } 1576 }
1652 1577
1653 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
1654 {
1655 return m_commsProvider.GridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
1656 }
1657
1658 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) 1578 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query)
1659 { 1579 {
1660 return m_commsProvider.GenerateAgentPickerRequestResponse(queryID, query); 1580 return m_commsProvider.GenerateAgentPickerRequestResponse(queryID, query);
1661 } 1581 }
1662 1582
1663 public List<RegionInfo> RequestNamedRegions(string name, int maxNumber) 1583 public List<GridRegion> RequestNamedRegions(string name, int maxNumber)
1664 { 1584 {
1665 return m_commsProvider.GridService.RequestNamedRegions(name, maxNumber); 1585 return m_scene.GridService.GetRegionsByName(UUID.Zero, name, maxNumber);
1666 } 1586 }
1667 1587
1668 //private void Dump(string msg, List<ulong> handles) 1588 //private void Dump(string msg, List<ulong> handles)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 09116fa..cda0bfc 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -845,7 +845,7 @@ namespace OpenSim.Region.Framework.Scenes
845 ScenePresence sp; 845 ScenePresence sp;
846 846
847 lock (ScenePresences) 847 lock (ScenePresences)
848 { 848 {
849 ScenePresences.TryGetValue(agentID, out sp); 849 ScenePresences.TryGetValue(agentID, out sp);
850 } 850 }
851 851
@@ -1134,6 +1134,23 @@ namespace OpenSim.Region.Framework.Scenes
1134 } 1134 }
1135 } 1135 }
1136 1136
1137 protected internal void ForEachSOG(Action<SceneObjectGroup> action)
1138 {
1139 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
1140 foreach (SceneObjectGroup obj in objlist)
1141 {
1142 try
1143 {
1144 action(obj);
1145 }
1146 catch (Exception e)
1147 {
1148 // Catch it and move on. This includes situations where splist has inconsistent info
1149 m_log.WarnFormat("[SCENE]: Problem processing action in ForEachSOG: ", e.Message);
1150 }
1151 }
1152 }
1153
1137 #endregion 1154 #endregion
1138 1155
1139 #region Client Event handlers 1156 #region Client Event handlers
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index 0019b23..1d4efd0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -192,7 +192,7 @@ namespace OpenSim.Region.Framework.Scenes
192 public void SaveCurrentSceneToXml(string filename) 192 public void SaveCurrentSceneToXml(string filename)
193 { 193 {
194 IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>(); 194 IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
195 if (serialiser != null) 195 if (serialiser != null)
196 serialiser.SavePrimsToXml(CurrentOrFirstScene, filename); 196 serialiser.SavePrimsToXml(CurrentOrFirstScene, filename);
197 } 197 }
198 198
@@ -205,7 +205,7 @@ namespace OpenSim.Region.Framework.Scenes
205 public void LoadCurrentSceneFromXml(string filename, bool generateNewIDs, Vector3 loadOffset) 205 public void LoadCurrentSceneFromXml(string filename, bool generateNewIDs, Vector3 loadOffset)
206 { 206 {
207 IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>(); 207 IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
208 if (serialiser != null) 208 if (serialiser != null)
209 serialiser.LoadPrimsFromXml(CurrentOrFirstScene, filename, generateNewIDs, loadOffset); 209 serialiser.LoadPrimsFromXml(CurrentOrFirstScene, filename, generateNewIDs, loadOffset);
210 } 210 }
211 211
@@ -216,14 +216,14 @@ namespace OpenSim.Region.Framework.Scenes
216 public void SaveCurrentSceneToXml2(string filename) 216 public void SaveCurrentSceneToXml2(string filename)
217 { 217 {
218 IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>(); 218 IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
219 if (serialiser != null) 219 if (serialiser != null)
220 serialiser.SavePrimsToXml2(CurrentOrFirstScene, filename); 220 serialiser.SavePrimsToXml2(CurrentOrFirstScene, filename);
221 } 221 }
222 222
223 public void SaveNamedPrimsToXml2(string primName, string filename) 223 public void SaveNamedPrimsToXml2(string primName, string filename)
224 { 224 {
225 IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>(); 225 IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
226 if (serialiser != null) 226 if (serialiser != null)
227 serialiser.SaveNamedPrimsToXml2(CurrentOrFirstScene, primName, filename); 227 serialiser.SaveNamedPrimsToXml2(CurrentOrFirstScene, primName, filename);
228 } 228 }
229 229
@@ -233,7 +233,7 @@ namespace OpenSim.Region.Framework.Scenes
233 public void LoadCurrentSceneFromXml2(string filename) 233 public void LoadCurrentSceneFromXml2(string filename)
234 { 234 {
235 IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>(); 235 IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
236 if (serialiser != null) 236 if (serialiser != null)
237 serialiser.LoadPrimsFromXml2(CurrentOrFirstScene, filename); 237 serialiser.LoadPrimsFromXml2(CurrentOrFirstScene, filename);
238 } 238 }
239 239
@@ -257,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes
257 public void LoadArchiveToCurrentScene(string filename) 257 public void LoadArchiveToCurrentScene(string filename)
258 { 258 {
259 IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); 259 IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>();
260 if (archiver != null) 260 if (archiver != null)
261 archiver.DearchiveRegion(filename); 261 archiver.DearchiveRegion(filename);
262 } 262 }
263 263
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index a260653..6b4cc0d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -133,7 +133,7 @@ namespace OpenSim.Region.Framework.Scenes
133 /// Is this scene object acting as an attachment? 133 /// Is this scene object acting as an attachment?
134 /// 134 ///
135 /// We return false if the group has already been deleted. 135 /// We return false if the group has already been deleted.
136 /// 136 ///
137 /// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I 137 /// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I
138 /// presume either all or no parts in a linkset can be part of an attachment (in which 138 /// presume either all or no parts in a linkset can be part of an attachment (in which
139 /// case the value would get proprogated down into all the descendent parts). 139 /// case the value would get proprogated down into all the descendent parts).
@@ -204,9 +204,22 @@ namespace OpenSim.Region.Framework.Scenes
204 get { return m_parts.Count; } 204 get { return m_parts.Count; }
205 } 205 }
206 206
207 public Quaternion GroupRotation 207 public override Quaternion Rotation
208 { 208 {
209 get { return m_rootPart.RotationOffset; } 209 get { return m_rootPart.RotationOffset; }
210 set { m_rootPart.RotationOffset = value; }
211 }
212
213 public override Vector3 Scale
214 {
215 get { return m_rootPart.Scale; }
216 set { m_rootPart.Scale = value; }
217 }
218
219 public override Vector3 Velocity
220 {
221 get { return m_rootPart.Velocity; }
222 set { m_rootPart.Velocity = value; }
210 } 223 }
211 224
212 public UUID GroupID 225 public UUID GroupID
@@ -263,7 +276,7 @@ namespace OpenSim.Region.Framework.Scenes
263 if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) 276 if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
264 || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) 277 || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
265 && !IsAttachmentCheckFull()) 278 && !IsAttachmentCheckFull())
266 { 279 {
267 m_scene.CrossPrimGroupIntoNewRegion(val, this, true); 280 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
268 } 281 }
269 282
@@ -461,7 +474,7 @@ namespace OpenSim.Region.Framework.Scenes
461 /// <param name="scene"></param> 474 /// <param name="scene"></param>
462 public void AttachToScene(Scene scene) 475 public void AttachToScene(Scene scene)
463 { 476 {
464 m_scene = scene; 477 m_scene = scene;
465 RegionHandle = m_scene.RegionInfo.RegionHandle; 478 RegionHandle = m_scene.RegionInfo.RegionHandle;
466 479
467 if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0) 480 if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0)
@@ -486,9 +499,9 @@ namespace OpenSim.Region.Framework.Scenes
486 //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); 499 //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID);
487 } 500 }
488 501
489 ApplyPhysics(m_scene.m_physicalPrim); 502 ApplyPhysics(m_scene.m_physicalPrim);
490 503
491 ScheduleGroupForFullUpdate(); 504 ScheduleGroupForFullUpdate();
492 } 505 }
493 506
494 public Vector3 GroupScale() 507 public Vector3 GroupScale()
@@ -535,7 +548,7 @@ namespace OpenSim.Region.Framework.Scenes
535 // Temporary commented to stop compiler warning 548 // Temporary commented to stop compiler warning
536 //Vector3 partPosition = 549 //Vector3 partPosition =
537 // new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z); 550 // new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z);
538 Quaternion parentrotation = GroupRotation; 551 Quaternion parentrotation = Rotation;
539 552
540 // Telling the prim to raytrace. 553 // Telling the prim to raytrace.
541 //EntityIntersection inter = part.TestIntersection(hRay, parentrotation); 554 //EntityIntersection inter = part.TestIntersection(hRay, parentrotation);
@@ -1044,12 +1057,12 @@ namespace OpenSim.Region.Framework.Scenes
1044 m_rootPart = part; 1057 m_rootPart = part;
1045 if (!IsAttachment) 1058 if (!IsAttachment)
1046 part.ParentID = 0; 1059 part.ParentID = 0;
1047 part.LinkNum = 0; 1060 part.LinkNum = 0;
1048 1061
1049 // No locking required since the SOG should not be in the scene yet - one can't change root parts after 1062 // No locking required since the SOG should not be in the scene yet - one can't change root parts after
1050 // the scene object has been attached to the scene 1063 // the scene object has been attached to the scene
1051 m_parts.Add(m_rootPart.UUID, m_rootPart); 1064 m_parts.Add(m_rootPart.UUID, m_rootPart);
1052 } 1065 }
1053 1066
1054 /// <summary> 1067 /// <summary>
1055 /// Add a new part to this scene object. The part must already be correctly configured. 1068 /// Add a new part to this scene object. The part must already be correctly configured.
@@ -1167,7 +1180,7 @@ namespace OpenSim.Region.Framework.Scenes
1167 1180
1168 /// <summary> 1181 /// <summary>
1169 /// Delete this group from its scene and tell all the scene presences about that deletion. 1182 /// Delete this group from its scene and tell all the scene presences about that deletion.
1170 /// </summary> 1183 /// </summary>
1171 /// <param name="silent">Broadcast deletions to all clients.</param> 1184 /// <param name="silent">Broadcast deletions to all clients.</param>
1172 public void DeleteGroup(bool silent) 1185 public void DeleteGroup(bool silent)
1173 { 1186 {
@@ -1274,11 +1287,11 @@ namespace OpenSim.Region.Framework.Scenes
1274 if (part.LocalId != m_rootPart.LocalId) 1287 if (part.LocalId != m_rootPart.LocalId)
1275 { 1288 {
1276 part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive, m_physicalPrim); 1289 part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive, m_physicalPrim);
1277 } 1290 }
1278 } 1291 }
1279 1292
1280 // Hack to get the physics scene geometries in the right spot 1293 // Hack to get the physics scene geometries in the right spot
1281 ResetChildPrimPhysicsPositions(); 1294 ResetChildPrimPhysicsPositions();
1282 } 1295 }
1283 else 1296 else
1284 { 1297 {
@@ -1501,7 +1514,7 @@ namespace OpenSim.Region.Framework.Scenes
1501 List<SceneObjectPart> partList; 1514 List<SceneObjectPart> partList;
1502 1515
1503 lock (m_parts) 1516 lock (m_parts)
1504 { 1517 {
1505 partList = new List<SceneObjectPart>(m_parts.Values); 1518 partList = new List<SceneObjectPart>(m_parts.Values);
1506 } 1519 }
1507 1520
@@ -1751,7 +1764,7 @@ namespace OpenSim.Region.Framework.Scenes
1751 rootpart.PhysActor.PIDHoverActive = false; 1764 rootpart.PhysActor.PIDHoverActive = false;
1752 } 1765 }
1753 } 1766 }
1754 } 1767 }
1755 } 1768 }
1756 1769
1757 /// <summary> 1770 /// <summary>
@@ -1878,14 +1891,17 @@ namespace OpenSim.Region.Framework.Scenes
1878 1891
1879 checkAtTargets(); 1892 checkAtTargets();
1880 1893
1881 if (UsePhysics && ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) 1894 Quaternion rot = Rotation;
1882 || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) 1895
1883 || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) 1896 if (UsePhysics &&
1884 || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))) 1897 ((Math.Abs(lastPhysGroupRot.W - rot.W) > 0.1f)
1898 || (Math.Abs(lastPhysGroupRot.X - rot.X) > 0.1f)
1899 || (Math.Abs(lastPhysGroupRot.Y - rot.Y) > 0.1f)
1900 || (Math.Abs(lastPhysGroupRot.Z - rot.Z) > 0.1f)))
1885 { 1901 {
1886 m_rootPart.UpdateFlag = 1; 1902 m_rootPart.UpdateFlag = 1;
1887 1903
1888 lastPhysGroupRot = GroupRotation; 1904 lastPhysGroupRot = rot;
1889 } 1905 }
1890 1906
1891 foreach (SceneObjectPart part in m_parts.Values) 1907 foreach (SceneObjectPart part in m_parts.Values)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 9819163..b4cfc48 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -42,7 +42,7 @@ using OpenSim.Region.Framework.Scenes.Scripting;
42using OpenSim.Region.Physics.Manager; 42using OpenSim.Region.Physics.Manager;
43 43
44namespace OpenSim.Region.Framework.Scenes 44namespace OpenSim.Region.Framework.Scenes
45{ 45{
46 #region Enumerations 46 #region Enumerations
47 47
48 [Flags] 48 [Flags]
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes
142 public UUID FromItemID = UUID.Zero; 142 public UUID FromItemID = UUID.Zero;
143 143
144 /// <value> 144 /// <value>
145 /// The UUID of the user inventory item from which this object was rezzed if this is a root part. 145 /// The UUID of the user inventory item from which this object was rezzed if this is a root part.
146 /// If UUID.Zero then either this is not a root part or there is no connection with a user inventory item. 146 /// If UUID.Zero then either this is not a root part or there is no connection with a user inventory item.
147 /// </value> 147 /// </value>
148 private UUID m_fromUserInventoryItemID = UUID.Zero; 148 private UUID m_fromUserInventoryItemID = UUID.Zero;
@@ -187,7 +187,7 @@ namespace OpenSim.Region.Framework.Scenes
187 public IEntityInventory Inventory 187 public IEntityInventory Inventory
188 { 188 {
189 get { return m_inventory; } 189 get { return m_inventory; }
190 } 190 }
191 protected SceneObjectPartInventory m_inventory; 191 protected SceneObjectPartInventory m_inventory;
192 192
193 [XmlIgnore] 193 [XmlIgnore]
@@ -309,9 +309,9 @@ namespace OpenSim.Region.Framework.Scenes
309 RotationOffset = rotationOffset; 309 RotationOffset = rotationOffset;
310 Velocity = new Vector3(0, 0, 0); 310 Velocity = new Vector3(0, 0, 0);
311 AngularVelocity = new Vector3(0, 0, 0); 311 AngularVelocity = new Vector3(0, 0, 0);
312 Acceleration = new Vector3(0, 0, 0); 312 Acceleration = new Vector3(0, 0, 0);
313 m_TextureAnimation = new byte[0]; 313 m_TextureAnimation = new byte[0];
314 m_particleSystem = new byte[0]; 314 m_particleSystem = new byte[0];
315 315
316 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, 316 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
317 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from 317 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
@@ -363,7 +363,7 @@ namespace OpenSim.Region.Framework.Scenes
363 363
364 /// <summary> 364 /// <summary>
365 /// A relic from when we we thought that prims contained folder objects. In 365 /// A relic from when we we thought that prims contained folder objects. In
366 /// reality, prim == folder 366 /// reality, prim == folder
367 /// Exposing this is not particularly good, but it's one of the least evils at the moment to see 367 /// Exposing this is not particularly good, but it's one of the least evils at the moment to see
368 /// folder id from prim inventory item data, since it's not (yet) actually stored with the prim. 368 /// folder id from prim inventory item data, since it's not (yet) actually stored with the prim.
369 /// </summary> 369 /// </summary>
@@ -384,7 +384,7 @@ namespace OpenSim.Region.Framework.Scenes
384 384
385 /// <value> 385 /// <value>
386 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes 386 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes
387 /// </value> 387 /// </value>
388 public TaskInventoryDictionary TaskInventory 388 public TaskInventoryDictionary TaskInventory
389 { 389 {
390 get { return m_inventory.Items; } 390 get { return m_inventory.Items; }
@@ -3355,7 +3355,7 @@ if (m_shape != null) {
3355 } 3355 }
3356 else 3356 else
3357 { 3357 {
3358 IsPhantom = false; 3358 IsPhantom = false;
3359 // If volumedetect is active we don't want phantom to be applied. 3359 // If volumedetect is active we don't want phantom to be applied.
3360 // If this is a new call to VD out of the state "phantom" 3360 // If this is a new call to VD out of the state "phantom"
3361 // this will also cause the prim to be visible to physics 3361 // this will also cause the prim to be visible to physics
@@ -3451,7 +3451,7 @@ if (m_shape != null) {
3451 } 3451 }
3452 else // it already has a physical representation 3452 else // it already has a physical representation
3453 { 3453 {
3454 PhysActor.IsPhysical = UsePhysics; 3454 pa.IsPhysical = UsePhysics;
3455 3455
3456 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim 3456 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim
3457 if (m_parentGroup != null) 3457 if (m_parentGroup != null)
@@ -3480,7 +3480,6 @@ if (m_shape != null) {
3480 AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active 3480 AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
3481 this.VolumeDetectActive = true; 3481 this.VolumeDetectActive = true;
3482 } 3482 }
3483
3484 } 3483 }
3485 else 3484 else
3486 { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like 3485 { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
@@ -3739,7 +3738,7 @@ if (m_shape != null) {
3739 public override string ToString() 3738 public override string ToString()
3740 { 3739 {
3741 return String.Format("{0} {1} (parent {2}))", Name, UUID, ParentGroup); 3740 return String.Format("{0} {1} (parent {2}))", Name, UUID, ParentGroup);
3742 } 3741 }
3743 3742
3744 #endregion Public Methods 3743 #endregion Public Methods
3745 3744
@@ -3785,11 +3784,11 @@ if (m_shape != null) {
3785 _everyoneMask &= _nextOwnerMask; 3784 _everyoneMask &= _nextOwnerMask;
3786 3785
3787 Inventory.ApplyNextOwnerPermissions(); 3786 Inventory.ApplyNextOwnerPermissions();
3788 } 3787 }
3789 3788
3790 public bool CanBeDeleted() 3789 public bool CanBeDeleted()
3791 { 3790 {
3792 return Inventory.CanBeDeleted(); 3791 return Inventory.CanBeDeleted();
3793 } 3792 }
3794 } 3793 }
3795} 3794}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 76bcd7e..098e010 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Region.Framework.Scenes
105 public void ForceInventoryPersistence() 105 public void ForceInventoryPersistence()
106 { 106 {
107 HasInventoryChanged = true; 107 HasInventoryChanged = true;
108 } 108 }
109 109
110 /// <summary> 110 /// <summary>
111 /// Reset UUIDs for all the items in the prim's inventory. This involves either generating 111 /// Reset UUIDs for all the items in the prim's inventory. This involves either generating
@@ -164,7 +164,7 @@ namespace OpenSim.Region.Framework.Scenes
164 /// <summary> 164 /// <summary>
165 /// Change every item in this inventory to a new group. 165 /// Change every item in this inventory to a new group.
166 /// </summary> 166 /// </summary>
167 /// <param name="groupID"></param> 167 /// <param name="groupID"></param>
168 public void ChangeInventoryGroup(UUID groupID) 168 public void ChangeInventoryGroup(UUID groupID)
169 { 169 {
170 lock (Items) 170 lock (Items)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6772f75..66fefa3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -36,6 +36,7 @@ using OpenSim.Framework.Communications.Cache;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes.Types; 37using OpenSim.Region.Framework.Scenes.Types;
38using OpenSim.Region.Physics.Manager; 38using OpenSim.Region.Physics.Manager;
39using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39 40
40namespace OpenSim.Region.Framework.Scenes 41namespace OpenSim.Region.Framework.Scenes
41{ 42{
@@ -775,7 +776,7 @@ namespace OpenSim.Region.Framework.Scenes
775 // Moved this from SendInitialData to ensure that m_appearance is initialized 776 // Moved this from SendInitialData to ensure that m_appearance is initialized
776 // before the inventory is processed in MakeRootAgent. This fixes a race condition 777 // before the inventory is processed in MakeRootAgent. This fixes a race condition
777 // related to the handling of attachments 778 // related to the handling of attachments
778 //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); 779 //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
779 if (m_scene.TestBorderCross(pos, Cardinals.E)) 780 if (m_scene.TestBorderCross(pos, Cardinals.E))
780 { 781 {
781 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); 782 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E);
@@ -1234,7 +1235,7 @@ namespace OpenSim.Region.Framework.Scenes
1234 if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) 1235 if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
1235 { 1236 {
1236 StandUp(); 1237 StandUp();
1237 } 1238 }
1238 1239
1239 // Check if Client has camera in 'follow cam' or 'build' mode. 1240 // Check if Client has camera in 'follow cam' or 'build' mode.
1240 Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); 1241 Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation);
@@ -1488,7 +1489,7 @@ namespace OpenSim.Region.Framework.Scenes
1488 { 1489 {
1489// m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed)); 1490// m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed));
1490// m_log.DebugFormat( 1491// m_log.DebugFormat(
1491// "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); 1492// "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
1492 1493
1493 AddNewMovement(agent_control_v3, q); 1494 AddNewMovement(agent_control_v3, q);
1494 1495
@@ -2305,14 +2306,14 @@ namespace OpenSim.Region.Framework.Scenes
2305 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector 2306 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector
2306 /// </summary> 2307 /// </summary>
2307 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> 2308 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
2308 /// <param name="rotation">The direction in which this avatar should now face. 2309 /// <param name="rotation">The direction in which this avatar should now face.
2309 public void AddNewMovement(Vector3 vec, Quaternion rotation) 2310 public void AddNewMovement(Vector3 vec, Quaternion rotation)
2310 { 2311 {
2311 if (m_isChildAgent) 2312 if (m_isChildAgent)
2312 { 2313 {
2313 m_log.Debug("DEBUG: AddNewMovement: child agent, Making root agent!"); 2314 m_log.Debug("DEBUG: AddNewMovement: child agent, Making root agent!");
2314 2315
2315 // we have to reset the user's child agent connections. 2316 // we have to reset the user's child agent connections.
2316 // Likely, here they've lost the eventqueue for other regions so border 2317 // Likely, here they've lost the eventqueue for other regions so border
2317 // crossings will fail at this point unless we reset them. 2318 // crossings will fail at this point unless we reset them.
2318 2319
@@ -2648,7 +2649,7 @@ namespace OpenSim.Region.Framework.Scenes
2648 /// Tell the client for this scene presence what items it should be wearing now 2649 /// Tell the client for this scene presence what items it should be wearing now
2649 /// </summary> 2650 /// </summary>
2650 public void SendWearables() 2651 public void SendWearables()
2651 { 2652 {
2652 ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); 2653 ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
2653 } 2654 }
2654 2655
@@ -2934,8 +2935,9 @@ namespace OpenSim.Region.Framework.Scenes
2934 else if (dir > 3 && dir < 7) // Heading Sout 2935 else if (dir > 3 && dir < 7) // Heading Sout
2935 neighboury--; 2936 neighboury--;
2936 2937
2937 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); 2938 int x = (int)(neighbourx * Constants.RegionSize);
2938 SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); 2939 int y = (int)(neighboury * Constants.RegionSize);
2940 GridRegion neighbourRegion = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, x, y);
2939 2941
2940 if (neighbourRegion == null) 2942 if (neighbourRegion == null)
2941 { 2943 {
@@ -3173,7 +3175,7 @@ namespace OpenSim.Region.Framework.Scenes
3173 else 3175 else
3174 { 3176 {
3175 wears[i++] = UUID.Zero; 3177 wears[i++] = UUID.Zero;
3176 wears[i++] = UUID.Zero; 3178 wears[i++] = UUID.Zero;
3177 } 3179 }
3178 } 3180 }
3179 cAgent.Wearables = wears; 3181 cAgent.Wearables = wears;
@@ -3485,7 +3487,7 @@ namespace OpenSim.Region.Framework.Scenes
3485 3487
3486 public bool HasAttachments() 3488 public bool HasAttachments()
3487 { 3489 {
3488 return m_attachments.Count > 0; 3490 return m_attachments.Count > 0;
3489 } 3491 }
3490 3492
3491 public bool HasScriptedAttachments() 3493 public bool HasScriptedAttachments()
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index fe74158..f7544ac 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -122,13 +122,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
122 "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); 122 "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
123 return null; 123 return null;
124 } 124 }
125 } 125 }
126 126
127 /// <summary> 127 /// <summary>
128 /// Serialize a scene object to the original xml format 128 /// Serialize a scene object to the original xml format
129 /// </summary> 129 /// </summary>
130 /// <param name="sceneObject"></param> 130 /// <param name="sceneObject"></param>
131 /// <returns></returns> 131 /// <returns></returns>
132 public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject) 132 public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject)
133 { 133 {
134 using (StringWriter sw = new StringWriter()) 134 using (StringWriter sw = new StringWriter())
@@ -140,13 +140,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
140 140
141 return sw.ToString(); 141 return sw.ToString();
142 } 142 }
143 } 143 }
144 144
145 /// <summary> 145 /// <summary>
146 /// Serialize a scene object to the original xml format 146 /// Serialize a scene object to the original xml format
147 /// </summary> 147 /// </summary>
148 /// <param name="sceneObject"></param> 148 /// <param name="sceneObject"></param>
149 /// <returns></returns> 149 /// <returns></returns>
150 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer) 150 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer)
151 { 151 {
152 //m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name); 152 //m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name);
@@ -238,13 +238,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
238 m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); 238 m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
239 return null; 239 return null;
240 } 240 }
241 } 241 }
242 242
243 /// <summary> 243 /// <summary>
244 /// Serialize a scene object to the 'xml2' format. 244 /// Serialize a scene object to the 'xml2' format.
245 /// </summary> 245 /// </summary>
246 /// <param name="sceneObject"></param> 246 /// <param name="sceneObject"></param>
247 /// <returns></returns> 247 /// <returns></returns>
248 public static string ToXml2Format(SceneObjectGroup sceneObject) 248 public static string ToXml2Format(SceneObjectGroup sceneObject)
249 { 249 {
250 using (StringWriter sw = new StringWriter()) 250 using (StringWriter sw = new StringWriter())
@@ -262,7 +262,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
262 /// Serialize a scene object to the 'xml2' format. 262 /// Serialize a scene object to the 'xml2' format.
263 /// </summary> 263 /// </summary>
264 /// <param name="sceneObject"></param> 264 /// <param name="sceneObject"></param>
265 /// <returns></returns> 265 /// <returns></returns>
266 public static void ToXml2Format(SceneObjectGroup sceneObject, XmlTextWriter writer) 266 public static void ToXml2Format(SceneObjectGroup sceneObject, XmlTextWriter writer)
267 { 267 {
268 //m_log.DebugFormat("[SERIALIZER]: Starting serialization of SOG {0} to XML2", Name); 268 //m_log.DebugFormat("[SERIALIZER]: Starting serialization of SOG {0} to XML2", Name);
@@ -288,6 +288,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
288 writer.WriteEndElement(); // End of SceneObjectGroup 288 writer.WriteEndElement(); // End of SceneObjectGroup
289 289
290 //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0} to XML2, {1}ms", Name, System.Environment.TickCount - time); 290 //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0} to XML2, {1}ms", Name, System.Environment.TickCount - time);
291 } 291 }
292 } 292 }
293} 293}
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
index 7fa1b8c..cf0f345 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
@@ -236,7 +236,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
236 } 236 }
237 237
238 SavePrimListToXml2(primList, fileName); 238 SavePrimListToXml2(primList, fileName);
239 } 239 }
240 240
241 public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName) 241 public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName)
242 { 242 {
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 7f44bf1..ee288b3 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -450,7 +450,7 @@ namespace OpenSim.Region.Framework.Scenes
450 { 450 {
451 addFrameMS(ms); 451 addFrameMS(ms);
452 addAgentMS(ms); 452 addAgentMS(ms);
453 } 453 }
454 454
455 #endregion 455 #endregion
456 } 456 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index 3b0e77f..fc66c85 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
44{ 44{
45 [TestFixture, LongRunning] 45 [TestFixture, LongRunning]
46 public class EntityManagerTests 46 public class EntityManagerTests
47 { 47 {
48 static public Random random; 48 static public Random random;
49 SceneObjectGroup found; 49 SceneObjectGroup found;
50 Scene scene = SceneSetupHelpers.SetupScene(); 50 Scene scene = SceneSetupHelpers.SetupScene();
@@ -81,13 +81,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
81 81
82 Assert.That(entman.ContainsKey(obj1), Is.False); 82 Assert.That(entman.ContainsKey(obj1), Is.False);
83 Assert.That(entman.ContainsKey(li1), Is.False); 83 Assert.That(entman.ContainsKey(li1), Is.False);
84 Assert.That(entman.ContainsKey(obj2), Is.False); 84 Assert.That(entman.ContainsKey(obj2), Is.False);
85 Assert.That(entman.ContainsKey(li2), Is.False); 85 Assert.That(entman.ContainsKey(li2), Is.False);
86 } 86 }
87 87
88 [Test] 88 [Test]
89 public void T011_ThreadAddRemoveTest() 89 public void T011_ThreadAddRemoveTest()
90 { 90 {
91 TestHelper.InMethod(); 91 TestHelper.InMethod();
92 // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); 92 // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
93 93
@@ -148,12 +148,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
148 int size = random.Next(40,80); 148 int size = random.Next(40,80);
149 char ch ; 149 char ch ;
150 for (int i=0; i<size; i++) 150 for (int i=0; i<size; i++)
151 { 151 {
152 ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ; 152 ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
153 name.Append(ch); 153 name.Append(ch);
154 } 154 }
155 return name.ToString(); 155 return name.ToString();
156 } 156 }
157 } 157 }
158 158
159 public class NewTestThreads 159 public class NewTestThreads
@@ -179,4 +179,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
179 entman.Remove(sog.UUID); 179 entman.Remove(sog.UUID);
180 } 180 }
181 } 181 }
182} \ No newline at end of file 182} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs
index f6737a5..5c9e66f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs
@@ -29,6 +29,7 @@ using System;
29using NUnit.Framework; 29using NUnit.Framework;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using GridRegion = OpenSim.Services.Interfaces.GridRegion;
32 33
33namespace OpenSim.Region.Framework.Scenes.Tests 34namespace OpenSim.Region.Framework.Scenes.Tests
34{ 35{
@@ -65,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
65 throw new NotImplementedException(); 66 throw new NotImplementedException();
66 } 67 }
67 68
68 public override bool OtherRegionUp(RegionInfo thisRegion) 69 public override void OtherRegionUp(GridRegion otherRegion)
69 { 70 {
70 throw new NotImplementedException(); 71 throw new NotImplementedException();
71 } 72 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 105446d..0ed00de 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -46,13 +46,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
46 /// </summary> 46 /// </summary>
47 [TestFixture] 47 [TestFixture]
48 public class SceneObjectBasicTests 48 public class SceneObjectBasicTests
49 { 49 {
50 /// <summary> 50 /// <summary>
51 /// Test adding an object to a scene. 51 /// Test adding an object to a scene.
52 /// </summary> 52 /// </summary>
53 [Test, LongRunning] 53 [Test, LongRunning]
54 public void TestAddSceneObject() 54 public void TestAddSceneObject()
55 { 55 {
56 TestHelper.InMethod(); 56 TestHelper.InMethod();
57 57
58 Scene scene = SceneSetupHelpers.SetupScene(); 58 Scene scene = SceneSetupHelpers.SetupScene();
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
61 61
62 //m_log.Debug("retrievedPart : {0}", retrievedPart); 62 //m_log.Debug("retrievedPart : {0}", retrievedPart);
63 // If the parts have the same UUID then we will consider them as one and the same 63 // If the parts have the same UUID then we will consider them as one and the same
64 Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); 64 Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
65 } 65 }
66 66
67 /// <summary> 67 /// <summary>
@@ -72,11 +72,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
72 { 72 {
73 TestHelper.InMethod(); 73 TestHelper.InMethod();
74 74
75 TestScene scene = SceneSetupHelpers.SetupScene(); 75 TestScene scene = SceneSetupHelpers.SetupScene();
76 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 76 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene);
77 scene.DeleteSceneObject(part.ParentGroup, false); 77 scene.DeleteSceneObject(part.ParentGroup, false);
78 78
79 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 79 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
80 Assert.That(retrievedPart, Is.Null); 80 Assert.That(retrievedPart, Is.Null);
81 } 81 }
82 82
@@ -115,19 +115,19 @@ namespace OpenSim.Region.Framework.Scenes.Tests
115 //[Test] 115 //[Test]
116 //public void TestDeleteSceneObjectAsyncToUserInventory() 116 //public void TestDeleteSceneObjectAsyncToUserInventory()
117 //{ 117 //{
118 // TestHelper.InMethod(); 118 // TestHelper.InMethod();
119 // //log4net.Config.XmlConfigurator.Configure(); 119 // //log4net.Config.XmlConfigurator.Configure();
120 120
121 // UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); 121 // UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
122 // string myObjectName = "Fred"; 122 // string myObjectName = "Fred";
123 123
124 // TestScene scene = SceneSetupHelpers.SetupScene(); 124 // TestScene scene = SceneSetupHelpers.SetupScene();
125 // SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName); 125 // SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName);
126 126
127 // Assert.That( 127 // Assert.That(
128 // scene.CommsManager.UserAdminService.AddUser( 128 // scene.CommsManager.UserAdminService.AddUser(
129 // "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), 129 // "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
130 // Is.EqualTo(agentId)); 130 // Is.EqualTo(agentId));
131 131
132 // IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); 132 // IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId);
133 133
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index e74b18e..b3d10df 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
45 /// <summary> 45 /// <summary>
46 /// Linking tests 46 /// Linking tests
47 /// </summary> 47 /// </summary>
48 [TestFixture] 48 [TestFixture]
49 public class SceneObjectLinkingTests 49 public class SceneObjectLinkingTests
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -174,13 +174,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
174 // Link grp4 to grp3. 174 // Link grp4 to grp3.
175 grp3.LinkToGroup(grp4); 175 grp3.LinkToGroup(grp4);
176 176
177 // At this point we should have 4 parts total in two groups. 177 // At this point we should have 4 parts total in two groups.
178 Assert.That(grp1.Children.Count == 2); 178 Assert.That(grp1.Children.Count == 2);
179 Assert.That(grp2.IsDeleted, "Group 2 was not registered as deleted after link."); 179 Assert.That(grp2.IsDeleted, "Group 2 was not registered as deleted after link.");
180 Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained parts after delink."); 180 Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained parts after delink.");
181 Assert.That(grp3.Children.Count == 2); 181 Assert.That(grp3.Children.Count == 2);
182 Assert.That(grp4.IsDeleted, "Group 4 was not registered as deleted after link."); 182 Assert.That(grp4.IsDeleted, "Group 4 was not registered as deleted after link.");
183 Assert.That(grp4.Children.Count, Is.EqualTo(0), "Group 4 still contained parts after delink."); 183 Assert.That(grp4.Children.Count, Is.EqualTo(0), "Group 4 still contained parts after delink.");
184 184
185 if (debugtest) 185 if (debugtest)
186 { 186 {
@@ -194,7 +194,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
194 m_log.Debug("Group3: Pos:"+grp3.AbsolutePosition+", Rot:"+grp3.Rotation); 194 m_log.Debug("Group3: Pos:"+grp3.AbsolutePosition+", Rot:"+grp3.Rotation);
195 m_log.Debug("Group3: Prim1: OffsetPosition:"+part3.OffsetPosition+", OffsetRotation:"+part3.RotationOffset); 195 m_log.Debug("Group3: Prim1: OffsetPosition:"+part3.OffsetPosition+", OffsetRotation:"+part3.RotationOffset);
196 m_log.Debug("Group3: Prim2: OffsetPosition:"+part4.OffsetPosition+", OffsetRotation:"+part4.RotationOffset); 196 m_log.Debug("Group3: Prim2: OffsetPosition:"+part4.OffsetPosition+", OffsetRotation:"+part4.RotationOffset);
197 } 197 }
198 198
199 // Required for linking 199 // Required for linking
200 grp1.RootPart.UpdateFlag = 0; 200 grp1.RootPart.UpdateFlag = 0;
@@ -253,6 +253,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
253 && (part4.RotationOffset.Y - compareQuaternion.Y < 0.00003) 253 && (part4.RotationOffset.Y - compareQuaternion.Y < 0.00003)
254 && (part4.RotationOffset.Z - compareQuaternion.Z < 0.00003) 254 && (part4.RotationOffset.Z - compareQuaternion.Z < 0.00003)
255 && (part4.RotationOffset.W - compareQuaternion.W < 0.00003)); 255 && (part4.RotationOffset.W - compareQuaternion.W < 0.00003));
256 } 256 }
257 } 257 }
258} 258}
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index 1c9bce4..8a27b7b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -41,11 +41,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
41 public class SceneTests 41 public class SceneTests
42 { 42 {
43 private class FakeStorageManager : StorageManager 43 private class FakeStorageManager : StorageManager
44 { 44 {
45 private class FakeRegionDataStore : IRegionDataStore 45 private class FakeRegionDataStore : IRegionDataStore
46 { 46 {
47 public void Initialise(string filename) 47 public void Initialise(string filename)
48 { 48 {
49 } 49 }
50 50
51 public void Dispose() 51 public void Dispose()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
index 1d460dd..b46eb8e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
44{ 44{
45 /// <summary> 45 /// <summary>
46 /// Teleport tests in a standalone OpenSim 46 /// Teleport tests in a standalone OpenSim
47 /// </summary> 47 /// </summary>
48 [TestFixture] 48 [TestFixture]
49 public class StandaloneTeleportTests 49 public class StandaloneTeleportTests
50 { 50 {
@@ -52,7 +52,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
52 /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. 52 /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
53 /// </summary> 53 /// </summary>
54 /// Does not yet do what is says on the tin. 54 /// Does not yet do what is says on the tin.
55 [Test, LongRunning] 55 /// Commenting for now
56 //[Test, LongRunning]
56 public void TestSimpleNotNeighboursTeleport() 57 public void TestSimpleNotNeighboursTeleport()
57 { 58 {
58 TestHelper.InMethod(); 59 TestHelper.InMethod();
@@ -117,14 +118,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests
117 // shared module 118 // shared module
118 ISharedRegionModule interregionComms = new RESTInterregionComms(); 119 ISharedRegionModule interregionComms = new RESTInterregionComms();
119 120
120 Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm);
121 SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
122 sceneA.RegisterRegionWithGrid();
123 121
124 Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm); 122 Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm, "grid");
125 SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); 123 SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
126 sceneB.RegisterRegionWithGrid(); 124 sceneB.RegisterRegionWithGrid();
127 125
126 Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm, "grid");
127 SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
128 sceneA.RegisterRegionWithGrid();
129
128 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); 130 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
129 TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId); 131 TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId);
130 132
diff --git a/OpenSim/Region/Framework/Scenes/Types/UpdateQueue.cs b/OpenSim/Region/Framework/Scenes/Types/UpdateQueue.cs
index 21cda09..213e954 100644
--- a/OpenSim/Region/Framework/Scenes/Types/UpdateQueue.cs
+++ b/OpenSim/Region/Framework/Scenes/Types/UpdateQueue.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Scenes.Types
38 { 38 {
39 private Queue<SceneObjectPart> m_queue; 39 private Queue<SceneObjectPart> m_queue;
40 40
41 private List<UUID> m_ids; 41 private Dictionary<UUID, bool> m_ids;
42 42
43 private object m_syncObject = new object(); 43 private object m_syncObject = new object();
44 44
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Types
50 public UpdateQueue() 50 public UpdateQueue()
51 { 51 {
52 m_queue = new Queue<SceneObjectPart>(); 52 m_queue = new Queue<SceneObjectPart>();
53 m_ids = new List<UUID>(); 53 m_ids = new Dictionary<UUID, bool>();
54 } 54 }
55 55
56 public void Clear() 56 public void Clear()
@@ -66,9 +66,8 @@ namespace OpenSim.Region.Framework.Scenes.Types
66 { 66 {
67 lock (m_syncObject) 67 lock (m_syncObject)
68 { 68 {
69 if (!m_ids.Contains(part.UUID)) 69 if (!m_ids.ContainsKey(part.UUID)) {
70 { 70 m_ids.Add(part.UUID, true);
71 m_ids.Add(part.UUID);
72 m_queue.Enqueue(part); 71 m_queue.Enqueue(part);
73 } 72 }
74 } 73 }
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index f449e18..525a93a 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes
41{ 41{
42 /// <summary> 42 /// <summary>
43 /// Gather uuids for a given entity. 43 /// Gather uuids for a given entity.
44 /// </summary> 44 /// </summary>
45 /// 45 ///
46 /// This does a deep inspection of the entity to retrieve all the assets it uses (whether as textures, as scripts 46 /// This does a deep inspection of the entity to retrieve all the assets it uses (whether as textures, as scripts
47 /// contained in inventory, as scripts contained in objects contained in another object's inventory, etc. Assets 47 /// contained in inventory, as scripts contained in objects contained in another object's inventory, etc. Assets
@@ -82,7 +82,7 @@ namespace OpenSim.Region.Framework.Scenes
82 /// 82 ///
83 /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param> 83 /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param>
84 /// <param name="assetType">The type of the asset for the uuid given</param> 84 /// <param name="assetType">The type of the asset for the uuid given</param>
85 /// <param name="assetUuids">The assets gathered</param> 85 /// <param name="assetUuids">The assets gathered</param>
86 public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, int> assetUuids) 86 public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, int> assetUuids)
87 { 87 {
88 assetUuids[assetUuid] = 1; 88 assetUuids[assetUuid] = 1;
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes
142 142
143 // If the prim is a sculpt then preserve this information too 143 // If the prim is a sculpt then preserve this information too
144 if (part.Shape.SculptTexture != UUID.Zero) 144 if (part.Shape.SculptTexture != UUID.Zero)
145 assetUuids[part.Shape.SculptTexture] = 1; 145 assetUuids[part.Shape.SculptTexture] = 1;
146 146
147 TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); 147 TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
148 148
@@ -167,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes
167 167
168 /// <summary> 168 /// <summary>
169 /// The callback made when we request the asset for an object from the asset service. 169 /// The callback made when we request the asset for an object from the asset service.
170 /// </summary> 170 /// </summary>
171 protected void AssetReceived(string id, Object sender, AssetBase asset) 171 protected void AssetReceived(string id, Object sender, AssetBase asset)
172 { 172 {
173 lock (this) 173 lock (this)
@@ -242,7 +242,7 @@ namespace OpenSim.Region.Framework.Scenes
242 AssetBase assetBase = GetAsset(wearableAssetUuid); 242 AssetBase assetBase = GetAsset(wearableAssetUuid);
243 243
244 if (null != assetBase) 244 if (null != assetBase)
245 { 245 {
246 //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); 246 //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data));
247 AssetWearable wearableAsset = new AssetBodypart(wearableAssetUuid, assetBase.Data); 247 AssetWearable wearableAsset = new AssetBodypart(wearableAssetUuid, assetBase.Data);
248 wearableAsset.Decode(); 248 wearableAsset.Decode();
@@ -275,6 +275,6 @@ namespace OpenSim.Region.Framework.Scenes
275 SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml); 275 SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml);
276 GatherAssetUuids(sog, assetUuids); 276 GatherAssetUuids(sog, assetUuids);
277 } 277 }
278 } 278 }
279 } 279 }
280} \ No newline at end of file 280} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 4a2d7b5..605645b 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -601,7 +601,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
601 if (names.Length > 1) 601 if (names.Length > 1)
602 return names[1]; 602 return names[1];
603 return names[0]; 603 return names[0];
604 } 604 }
605 } 605 }
606 606
607 public IScene Scene 607 public IScene Scene
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs
index c49d942..773507c 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs
@@ -351,7 +351,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
351 { 351 {
352 m_log.DebugFormat("[IRC-Region {0}] dropping message {1} on channel {2}", Region, msg, msg.Channel); 352 m_log.DebugFormat("[IRC-Region {0}] dropping message {1} on channel {2}", Region, msg, msg.Channel);
353 return; 353 return;
354 } 354 }
355 355
356 ScenePresence avatar = null; 356 ScenePresence avatar = null;
357 string fromName = msg.From; 357 string fromName = msg.From;
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
index 9ba09ed..46ad30f 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDialplan.cs
@@ -97,8 +97,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
97 </document>", Context, Realm); 97 </document>", Context, Realm);
98 } 98 }
99 99
100 return response; 100 return response;
101 } 101 }
102 } 102 }
103 103
104} 104}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
index 5d90a8f..17cdf74 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchDirectory.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
93 { 93 {
94 response = HandleRegister(Context, Realm, request); 94 response = HandleRegister(Context, Realm, request);
95 } 95 }
96 else if (sipAuthMethod == "INVITE") 96 else if (sipAuthMethod == "INVITE")
97 { 97 {
98 response = HandleInvite(Context, Realm, request); 98 response = HandleInvite(Context, Realm, request);
99 } 99 }
@@ -138,7 +138,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
138 response["str_response_string"] = ""; 138 response["str_response_string"] = "";
139 } 139 }
140 } 140 }
141 return response; 141 return response;
142 } 142 }
143 143
144 private Hashtable HandleRegister(string Context, string Realm, Hashtable request) 144 private Hashtable HandleRegister(string Context, string Realm, Hashtable request)
@@ -309,17 +309,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
309 "</document>\r\n", 309 "</document>\r\n",
310 domain, Context); 310 domain, Context);
311 311
312 return response; 312 return response;
313 } 313 }
314 314
315 315
316// private Hashtable HandleLoadNetworkLists(Hashtable request) 316// private Hashtable HandleLoadNetworkLists(Hashtable request)
317// { 317// {
318// m_log.Info("[FreeSwitchDirectory] HandleLoadNetworkLists called"); 318// m_log.Info("[FreeSwitchDirectory] HandleLoadNetworkLists called");
319// 319//
320// // TODO the password we return needs to match that sent in the request, this is hard coded for now 320// // TODO the password we return needs to match that sent in the request, this is hard coded for now
321// string domain = (string) request["domain"]; 321// string domain = (string) request["domain"];
322// 322//
323// Hashtable response = new Hashtable(); 323// Hashtable response = new Hashtable();
324// response["content_type"] = "text/xml"; 324// response["content_type"] = "text/xml";
325// response["keepalive"] = false; 325// response["keepalive"] = false;
@@ -340,9 +340,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
340// "</section>\r\n" + 340// "</section>\r\n" +
341// "</document>\r\n", 341// "</document>\r\n",
342// domain); 342// domain);
343// 343//
344// 344//
345// return response; 345// return response;
346// } 346// }
347 } 347 }
348} 348}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 6b30959..c7bb56a 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -260,12 +260,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
260 260
261 public void PostInitialise() 261 public void PostInitialise()
262 { 262 {
263 if(m_pluginEnabled) 263 if (m_pluginEnabled)
264 { 264 {
265 m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); 265 m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
266 266
267 // register the voice interface for this module, so the script engine can call us 267 // register the voice interface for this module, so the script engine can call us
268 m_scene.RegisterModuleInterface<IVoiceModule>(this); 268 m_scene.RegisterModuleInterface<IVoiceModule>(this);
269 } 269 }
270 } 270 }
271 271
@@ -811,7 +811,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
811 811
812 lock (m_ParcelAddress) 812 lock (m_ParcelAddress)
813 { 813 {
814 if (m_ParcelAddress.ContainsKey( land.GlobalID.ToString() )) 814 if (m_ParcelAddress.ContainsKey(land.GlobalID.ToString()))
815 { 815 {
816 m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}", 816 m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}",
817 land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]); 817 land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]);
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
index febb491..cb76200 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
@@ -226,7 +226,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
226 m_log.DebugFormat("[VivoxVoice] plugin initialization failed: {0}", e.ToString()); 226 m_log.DebugFormat("[VivoxVoice] plugin initialization failed: {0}", e.ToString());
227 return; 227 return;
228 } 228 }
229 } 229 }
230 230
231 231
232 // Called to indicate that the module has been added to the region 232 // Called to indicate that the module has been added to the region
@@ -1144,7 +1144,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
1144 // Otherwise prepare the request 1144 // Otherwise prepare the request
1145 m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); 1145 m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl);
1146 1146
1147 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); 1147 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl);
1148 HttpWebResponse rsp = null; 1148 HttpWebResponse rsp = null;
1149 1149
1150 // We are sending just parameters, no content 1150 // We are sending just parameters, no content
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index d5cbfd4..2e89a24 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -477,7 +477,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
477 foreach (string key in binBucketOSD.Keys) 477 foreach (string key in binBucketOSD.Keys)
478 { 478 {
479 m_log.WarnFormat("{0}: {1}", key, binBucketOSD[key].ToString()); 479 m_log.WarnFormat("{0}: {1}", key, binBucketOSD[key].ToString());
480 } 480 }
481 } 481 }
482 482
483 // treat as if no attachment 483 // treat as if no attachment
@@ -1261,7 +1261,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1261 { 1261 {
1262 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1262 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1263 1263
1264 // TODO: Probably isn't nessesary to update every client in every scene. 1264 // TODO: Probably isn't nessesary to update every client in every scene.
1265 // Need to examine client updates and do only what's nessesary. 1265 // Need to examine client updates and do only what's nessesary.
1266 lock (m_sceneList) 1266 lock (m_sceneList)
1267 { 1267 {
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 805c3d4..964d0bb 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -871,7 +871,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
871 m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); 871 m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function);
872 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); 872 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString());
873 873
874 foreach( string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None)) 874 foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None))
875 { 875 {
876 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); 876 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine);
877 } 877 }
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs
index b5da6f7..7202601 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs
@@ -208,7 +208,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
208 // TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened 208 // TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened
209 m_log.ErrorFormat( 209 m_log.ErrorFormat(
210 "[CONTENT MANAGEMENT]: Content management thread terminating with exception. PLEASE REBOOT YOUR SIM - CONTENT MANAGEMENT WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}", 210 "[CONTENT MANAGEMENT]: Content management thread terminating with exception. PLEASE REBOOT YOUR SIM - CONTENT MANAGEMENT WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}",
211 e); 211 e);
212 } 212 }
213 } 213 }
214 214
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
index 52c4e03..0dc78c0 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
102 { 102 {
103 if (m_MetaEntityCollection.Auras.ContainsKey(((SceneObjectPart)missingPart).UUID)) 103 if (m_MetaEntityCollection.Auras.ContainsKey(((SceneObjectPart)missingPart).UUID))
104 continue; 104 continue;
105 newList.Add(m_MetaEntityCollection.CreateAuraForNewlyCreatedEntity((SceneObjectPart)missingPart)); 105 newList.Add(m_MetaEntityCollection.CreateAuraForNewlyCreatedEntity((SceneObjectPart)missingPart));
106 } 106 }
107 m_log.Info("Number of missing objects found: " + newList.Count); 107 m_log.Info("Number of missing objects found: " + newList.Count);
108 return newList; 108 return newList;
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index bf523dd..ce50f9e 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -136,7 +136,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
136 /// </exception> 136 /// </exception>
137 /// <returns>AppDomain with a restricted security policy</returns> 137 /// <returns>AppDomain with a restricted security policy</returns>
138 /// <remarks>Substantial portions of this function from: http://blogs.msdn.com/shawnfa/archive/2004/10/25/247379.aspx 138 /// <remarks>Substantial portions of this function from: http://blogs.msdn.com/shawnfa/archive/2004/10/25/247379.aspx
139 /// Valid permissionSetName values are: 139 /// Valid permissionSetName values are:
140 /// * FullTrust 140 /// * FullTrust
141 /// * SkipVerification 141 /// * SkipVerification
142 /// * Execution 142 /// * Execution
diff --git a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs
index c539280..fc1c608 100644
--- a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs
+++ b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Region.Modules.SvnSerialiser
117 public void LoadRegion(Scene scene) 117 public void LoadRegion(Scene scene)
118 { 118 {
119 IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>(); 119 IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>();
120 if (serialiser != null) 120 if (serialiser != null)
121 { 121 {
122 serialiser.LoadPrimsFromXml2( 122 serialiser.LoadPrimsFromXml2(
123 scene, 123 scene,
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index d4bba10..3044b17 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -92,7 +92,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
92 this.m_maximum_scale = cp.m_maximum_scale; 92 this.m_maximum_scale = cp.m_maximum_scale;
93 this.m_initial_scale = cp.m_initial_scale; 93 this.m_initial_scale = cp.m_initial_scale;
94 this.m_rate = cp.m_rate; 94 this.m_rate = cp.m_rate;
95 this.m_planted = planted; 95 this.m_planted = planted;
96 this.m_trees = new List<UUID>(); 96 this.m_trees = new List<UUID>();
97 } 97 }
98 98
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
index e0f856a..18d4bab 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
@@ -528,7 +528,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
528 { 528 {
529 // Teravus: Kitto, this code causes recurring errors that stall physics permenantly unless 529 // Teravus: Kitto, this code causes recurring errors that stall physics permenantly unless
530 // the values are checked, so checking below. 530 // the values are checked, so checking below.
531 // Is there any reason that we don't do this in ScenePresence? 531 // Is there any reason that we don't do this in ScenePresence?
532 // The only physics engine that benefits from it in the physics plugin is this one 532 // The only physics engine that benefits from it in the physics plugin is this one
533 533
534 if (x > (int)Constants.RegionSize || y > (int)Constants.RegionSize || 534 if (x > (int)Constants.RegionSize || y > (int)Constants.RegionSize ||
@@ -650,7 +650,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
650 650
651 if (iPropertiesNotSupportedDefault == 0) 651 if (iPropertiesNotSupportedDefault == 0)
652 { 652 {
653#if SPAM 653#if SPAM
654 m_log.Warn("NonMesh"); 654 m_log.Warn("NonMesh");
655#endif 655#endif
656 return false; 656 return false;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index ce52744..7130a3e 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Physics.Manager
55 plugHard = new ZeroMesherPlugin(); 55 plugHard = new ZeroMesherPlugin();
56 _MeshPlugins.Add(plugHard.GetName(), plugHard); 56 _MeshPlugins.Add(plugHard.GetName(), plugHard);
57 57
58 m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName()); 58 m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName());
59 } 59 }
60 60
61 /// <summary> 61 /// <summary>
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 8a07f71..6dd26bb 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -178,12 +178,12 @@ namespace OpenSim.Region.Physics.Manager
178 } 178 }
179 179
180 /// <summary> 180 /// <summary>
181 /// Queue a raycast against the physics scene. 181 /// Queue a raycast against the physics scene.
182 /// The provided callback method will be called when the raycast is complete 182 /// The provided callback method will be called when the raycast is complete
183 /// 183 ///
184 /// Many physics engines don't support collision testing at the same time as 184 /// Many physics engines don't support collision testing at the same time as
185 /// manipulating the physics scene, so we queue the request up and callback 185 /// manipulating the physics scene, so we queue the request up and callback
186 /// a custom method when the raycast is complete. 186 /// a custom method when the raycast is complete.
187 /// This allows physics engines that give an immediate result to callback immediately 187 /// This allows physics engines that give an immediate result to callback immediately
188 /// and ones that don't, to callback when it gets a result back. 188 /// and ones that don't, to callback when it gets a result back.
189 /// 189 ///
diff --git a/OpenSim/Region/Physics/Manager/VehicleConstants.cs b/OpenSim/Region/Physics/Manager/VehicleConstants.cs
index 97f66d3..532e55e 100644
--- a/OpenSim/Region/Physics/Manager/VehicleConstants.cs
+++ b/OpenSim/Region/Physics/Manager/VehicleConstants.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Region.Physics.Manager
93 BANKING_TIMESCALE = 40, 93 BANKING_TIMESCALE = 40,
94 REFERENCE_FRAME = 44 94 REFERENCE_FRAME = 44
95 95
96 } 96 }
97 97
98 [Flags] 98 [Flags]
99 public enum VehicleFlag 99 public enum VehicleFlag
diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs
index 7567556..aae8871 100644
--- a/OpenSim/Region/Physics/Meshing/Mesh.cs
+++ b/OpenSim/Region/Physics/Meshing/Mesh.cs
@@ -149,7 +149,7 @@ namespace OpenSim.Region.Physics.Meshing
149 149
150 public float[] getVertexListAsFloatLocked() 150 public float[] getVertexListAsFloatLocked()
151 { 151 {
152 if( pinnedVirtexes.IsAllocated ) 152 if (pinnedVirtexes.IsAllocated)
153 return (float[])(pinnedVirtexes.Target); 153 return (float[])(pinnedVirtexes.Target);
154 float[] result; 154 float[] result;
155 155
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 0873035..56eb359 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -171,7 +171,7 @@ namespace OpenSim.Region.Physics.Meshing
171 171
172 } 172 }
173 173
174 private ulong GetMeshKey( PrimitiveBaseShape pbs, PhysicsVector size, float lod ) 174 private ulong GetMeshKey(PrimitiveBaseShape pbs, PhysicsVector size, float lod)
175 { 175 {
176 ulong hash = 5381; 176 ulong hash = 5381;
177 177
diff --git a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
index d9f4951..c8ae229 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
@@ -228,7 +228,7 @@ namespace OpenSim.Region.Physics.OdePlugin
228 mono [0x81d28b6] 228 mono [0x81d28b6]
229 mono [0x81ea2c6] 229 mono [0x81ea2c6]
230 /lib/i686/cmov/libpthread.so.0 [0xb7e744c0] 230 /lib/i686/cmov/libpthread.so.0 [0xb7e744c0]
231 /lib/i686/cmov/libc.so.6(clone+0x5e) [0xb7dcd6de] 231 /lib/i686/cmov/libc.so.6(clone+0x5e) [0xb7dcd6de]
232 */ 232 */
233 233
234 // Exclude heightfield geom 234 // Exclude heightfield geom
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index b7afa27..06bae5a 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -2538,7 +2538,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2538 2538
2539 if (iPropertiesNotSupportedDefault == 0) 2539 if (iPropertiesNotSupportedDefault == 0)
2540 { 2540 {
2541#if SPAM 2541#if SPAM
2542 m_log.Warn("NonMesh"); 2542 m_log.Warn("NonMesh");
2543#endif 2543#endif
2544 return false; 2544 return false;
@@ -3346,7 +3346,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3346 { 3346 {
3347 // this._heightmap[i] = (double)heightMap[i]; 3347 // this._heightmap[i] = (double)heightMap[i];
3348 // dbm (danx0r) -- creating a buffer zone of one extra sample all around 3348 // dbm (danx0r) -- creating a buffer zone of one extra sample all around
3349 //_origheightmap = heightMap; 3349 //_origheightmap = heightMap;
3350 3350
3351 float[] _heightmap; 3351 float[] _heightmap;
3352 3352
@@ -3531,12 +3531,8 @@ namespace OpenSim.Region.Physics.OdePlugin
3531 } 3531 }
3532 3532
3533 d.GeomDestroy(g); 3533 d.GeomDestroy(g);
3534 removingHeightField = new float[0]; 3534 //removingHeightField = new float[0];
3535
3536
3537
3538 } 3535 }
3539
3540 } 3536 }
3541 3537
3542 } 3538 }
@@ -3545,14 +3541,10 @@ namespace OpenSim.Region.Physics.OdePlugin
3545 m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data."); 3541 m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data.");
3546 3542
3547 } 3543 }
3548
3549 } 3544 }
3550
3551 } 3545 }
3552 } 3546 }
3553 3547
3554
3555
3556 public override void SetWaterLevel(float baseheight) 3548 public override void SetWaterLevel(float baseheight)
3557 { 3549 {
3558 waterlevel = baseheight; 3550 waterlevel = baseheight;
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
index 569009e..0feb967 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueThreadClass.cs
@@ -225,7 +225,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
225 // TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened 225 // TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened
226 m_log.ErrorFormat( 226 m_log.ErrorFormat(
227 "[{0}]: Event queue thread terminating with exception. PLEASE REBOOT YOUR SIM - SCRIPT EVENTS WILL NOT WORK UNTIL YOU DO. Exception is {1}", 227 "[{0}]: Event queue thread terminating with exception. PLEASE REBOOT YOUR SIM - SCRIPT EVENTS WILL NOT WORK UNTIL YOU DO. Exception is {1}",
228 ScriptEngineName, e); 228 ScriptEngineName, e);
229 } 229 }
230 } 230 }
231 231
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index 8ad916c..3c91b29 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -418,7 +418,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
418 { 418 {
419 InstanceData id = m_ScriptManager.GetScript(localID, itemID); 419 InstanceData id = m_ScriptManager.GetScript(localID, itemID);
420 if (id == null) 420 if (id == null)
421 return; 421 return;
422 422
423 if (!id.Disabled) 423 if (!id.Disabled)
424 id.Running = true; 424 id.Running = true;
@@ -428,7 +428,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
428 { 428 {
429 InstanceData id = m_ScriptManager.GetScript(localID, itemID); 429 InstanceData id = m_ScriptManager.GetScript(localID, itemID);
430 if (id == null) 430 if (id == null)
431 return; 431 return;
432 432
433 id.Running = false; 433 id.Running = false;
434 } 434 }
@@ -442,7 +442,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
442 442
443 InstanceData id = m_ScriptManager.GetScript(localID, itemID); 443 InstanceData id = m_ScriptManager.GetScript(localID, itemID);
444 if (id == null) 444 if (id == null)
445 return; 445 return;
446 446
447 IEventQueue eq = World.RequestModuleInterface<IEventQueue>(); 447 IEventQueue eq = World.RequestModuleInterface<IEventQueue>();
448 if (eq == null) 448 if (eq == null)
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 9c1cd4d..6ac209e 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -520,13 +520,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
520 ExeStage = 5; // ;^) Ewe Loon, for debuging 520 ExeStage = 5; // ;^) Ewe Loon, for debuging
521 } 521 }
522 catch (Exception e) // ;^) Ewe Loon, From here down tis fix 522 catch (Exception e) // ;^) Ewe Loon, From here down tis fix
523 { 523 {
524 if ((ExeStage == 3)&&(qParams.Length>0)) 524 if ((ExeStage == 3)&&(qParams.Length>0))
525 detparms.Remove(id); 525 detparms.Remove(id);
526 SceneObjectPart ob = m_scriptEngine.World.GetSceneObjectPart(localID); 526 SceneObjectPart ob = m_scriptEngine.World.GetSceneObjectPart(localID);
527 m_log.InfoFormat("[Script Error] ,{0},{1},@{2},{3},{4},{5}", ob.Name , FunctionName, ExeStage, e.Message, qParams.Length, detparms.Count); 527 m_log.InfoFormat("[Script Error] ,{0},{1},@{2},{3},{4},{5}", ob.Name , FunctionName, ExeStage, e.Message, qParams.Length, detparms.Count);
528 if (ExeStage != 2) throw e; 528 if (ExeStage != 2) throw e;
529 } 529 }
530 } 530 }
531 531
532 public uint GetLocalID(UUID itemID) 532 public uint GetLocalID(UUID itemID)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c41f2a5..3051609 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -50,6 +50,9 @@ using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
50using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 50using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
51using OpenSim.Region.ScriptEngine.Interfaces; 51using OpenSim.Region.ScriptEngine.Interfaces;
52using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 52using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
53using OpenSim.Services.Interfaces;
54
55using GridRegion = OpenSim.Services.Interfaces.GridRegion;
53 56
54using AssetLandmark = OpenSim.Framework.AssetLandmark; 57using AssetLandmark = OpenSim.Framework.AssetLandmark;
55 58
@@ -2010,10 +2013,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2010 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate 2013 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
2011 } 2014 }
2012 else 2015 else
2013 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case 2016 q = part.ParentGroup.Rotation; // Likely never get here but just in case
2014 } 2017 }
2015 else 2018 else
2016 q = part.ParentGroup.GroupRotation; // just the group rotation 2019 q = part.ParentGroup.Rotation; // just the group rotation
2017 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 2020 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2018 } 2021 }
2019 q = part.GetWorldRotation(); 2022 q = part.GetWorldRotation();
@@ -5002,6 +5005,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5002 if (end > src.Length) 5005 if (end > src.Length)
5003 end = src.Length; 5006 end = src.Length;
5004 5007
5008 if (stride == 0)
5009 stride = 1;
5010
5005 // There may be one or two ranges to be considered 5011 // There may be one or two ranges to be considered
5006 5012
5007 if (start != end) 5013 if (start != end)
@@ -5028,9 +5034,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5028 // A negative stride reverses the direction of the 5034 // A negative stride reverses the direction of the
5029 // scan producing an inverted list as a result. 5035 // scan producing an inverted list as a result.
5030 5036
5031 if (stride == 0)
5032 stride = 1;
5033
5034 if (stride > 0) 5037 if (stride > 0)
5035 { 5038 {
5036 for (int i = 0; i < src.Length; i += stride) 5039 for (int i = 0; i < src.Length; i += stride)
@@ -5054,7 +5057,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5054 } 5057 }
5055 else 5058 else
5056 { 5059 {
5057 result.Add(src.Data[start]); 5060 if (start%stride == 0)
5061 {
5062 result.Add(src.Data[start]);
5063 }
5058 } 5064 }
5059 5065
5060 return result; 5066 return result;
@@ -5232,12 +5238,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5232 } 5238 }
5233 } 5239 }
5234 5240
5235 List<SimpleRegionInfo> neighbors = World.CommsManager.GridService.RequestNeighbours(World.RegionInfo.RegionLocX, World.RegionInfo.RegionLocY); 5241 List<GridRegion> neighbors = World.GridService.GetNeighbours(World.RegionInfo.ScopeID, World.RegionInfo.RegionID);
5236 5242
5237 uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x; 5243 uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x;
5238 uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y; 5244 uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y;
5239 5245
5240 foreach (SimpleRegionInfo sri in neighbors) 5246 foreach (GridRegion sri in neighbors)
5241 { 5247 {
5242 if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY) 5248 if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY)
5243 return 0; 5249 return 0;
@@ -7178,10 +7184,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7178 else 7184 else
7179 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate 7185 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
7180 else 7186 else
7181 q = m_host.ParentGroup.GroupRotation; // Likely never get here but just in case 7187 q = m_host.ParentGroup.Rotation; // Likely never get here but just in case
7182 } 7188 }
7183 else 7189 else
7184 q = m_host.ParentGroup.GroupRotation; // just the group rotation 7190 q = m_host.ParentGroup.Rotation; // just the group rotation
7185 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 7191 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
7186 } 7192 }
7187 7193
@@ -8184,7 +8190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8184 8190
8185 string reply = String.Empty; 8191 string reply = String.Empty;
8186 8192
8187 RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator); 8193 GridRegion info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator);
8188 8194
8189 switch (data) 8195 switch (data)
8190 { 8196 {
@@ -8211,7 +8217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8211 ConditionalScriptSleep(1000); 8217 ConditionalScriptSleep(1000);
8212 return UUID.Zero.ToString(); 8218 return UUID.Zero.ToString();
8213 } 8219 }
8214 int access = info.RegionSettings.Maturity; 8220 int access = info.Maturity;
8215 if (access == 0) 8221 if (access == 0)
8216 reply = "PG"; 8222 reply = "PG";
8217 else if (access == 1) 8223 else if (access == 1)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index ccdd4c5..0b95abc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -48,6 +48,8 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
48using OpenSim.Region.ScriptEngine.Interfaces; 48using OpenSim.Region.ScriptEngine.Interfaces;
49using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 49using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
50using TPFlags = OpenSim.Framework.Constants.TeleportFlags; 50using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
51using OpenSim.Services.Interfaces;
52using GridRegion = OpenSim.Services.Interfaces.GridRegion;
51using System.Text.RegularExpressions; 53using System.Text.RegularExpressions;
52 54
53using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; 55using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
@@ -599,17 +601,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
599 if (regionName.Contains(".") && regionName.Contains(":")) 601 if (regionName.Contains(".") && regionName.Contains(":"))
600 { 602 {
601 // Try to link the region 603 // Try to link the region
602 RegionInfo regInfo = HGHyperlink.TryLinkRegion(World, 604 IHyperlinkService hyperService = World.RequestModuleInterface<IHyperlinkService>();
603 presence.ControllingClient, 605 if (hyperService != null)
604 regionName);
605 // Get the region name
606 if (regInfo != null)
607 { 606 {
608 regionName = regInfo.RegionName; 607 GridRegion regInfo = hyperService.TryLinkRegion(presence.ControllingClient,
609 } 608 regionName);
610 else 609 // Get the region name
611 { 610 if (regInfo != null)
612 // Might need to ping the client here in case of failure?? 611 {
612 regionName = regInfo.RegionName;
613 }
614 else
615 {
616 // Might need to ping the client here in case of failure??
617 }
613 } 618 }
614 } 619 }
615 presence.ControllingClient.SendTeleportLocationStart(); 620 presence.ControllingClient.SendTeleportLocationStart();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index d0df390..8dcb1f5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
95 return m_OSSL_Functions.osWindActiveModelPluginName(); 95 return m_OSSL_Functions.osWindActiveModelPluginName();
96 } 96 }
97 97
98// Not yet plugged in as available OSSL functions, so commented out 98// Not yet plugged in as available OSSL functions, so commented out
99// void osWindParamSet(string plugin, string param, float value) 99// void osWindParamSet(string plugin, string param, float value)
100// { 100// {
101// m_OSSL_Functions.osWindParamSet(plugin, param, value); 101// m_OSSL_Functions.osWindParamSet(plugin, param, value);
@@ -329,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
329 329
330 public string osGetSimulatorVersion() 330 public string osGetSimulatorVersion()
331 { 331 {
332 return m_OSSL_Functions.osGetSimulatorVersion(); 332 return m_OSSL_Functions.osGetSimulatorVersion();
333 } 333 }
334 334
335 public Hashtable osParseJSON(string JSON) 335 public Hashtable osParseJSON(string JSON)
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 5a94957..fe26429 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -546,11 +546,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
546 bool retried = false; 546 bool retried = false;
547 do 547 do
548 { 548 {
549 lock (CScodeProvider) 549 lock (CScodeProvider)
550 { 550 {
551 results = CScodeProvider.CompileAssemblyFromSource( 551 results = CScodeProvider.CompileAssemblyFromSource(
552 parameters, Script); 552 parameters, Script);
553 } 553 }
554 // Deal with an occasional segv in the compiler. 554 // Deal with an occasional segv in the compiler.
555 // Rarely, if ever, occurs twice in succession. 555 // Rarely, if ever, occurs twice in succession.
556 // Line # == 0 and no file name are indications that 556 // Line # == 0 and no file name are indications that
@@ -573,20 +573,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
573 { 573 {
574 complete = true; 574 complete = true;
575 } 575 }
576 } 576 } while (!complete);
577 while(!complete);
578 break; 577 break;
579 case enumCompileType.js: 578 case enumCompileType.js:
580 results = JScodeProvider.CompileAssemblyFromSource( 579 results = JScodeProvider.CompileAssemblyFromSource(
581 parameters, Script); 580 parameters, Script);
582 break; 581 break;
583 case enumCompileType.yp: 582 case enumCompileType.yp:
584 results = YPcodeProvider.CompileAssemblyFromSource( 583 results = YPcodeProvider.CompileAssemblyFromSource(
585 parameters, Script); 584 parameters, Script);
586 break; 585 break;
587 default: 586 default:
588 throw new Exception("Compiler is not able to recongnize "+ 587 throw new Exception("Compiler is not able to recongnize "+
589 "language type \"" + lang.ToString() + "\""); 588 "language type \"" + lang.ToString() + "\"");
590 } 589 }
591 590
592 // Check result 591 // Check result
@@ -602,12 +601,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
602 { 601 {
603 foreach (CompilerError CompErr in results.Errors) 602 foreach (CompilerError CompErr in results.Errors)
604 { 603 {
605 604 string severity = CompErr.IsWarning ? "Warning" : "Error";
606 string severity = "Error";
607 if (CompErr.IsWarning)
608 {
609 severity = "Warning";
610 }
611 605
612 KeyValuePair<int, int> lslPos; 606 KeyValuePair<int, int> lslPos;
613 607
@@ -615,18 +609,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
615 609
616 if (severity == "Error") 610 if (severity == "Error")
617 { 611 {
618 lslPos = FindErrorPosition(CompErr.Line, CompErr.Column); 612 lslPos = FindErrorPosition(CompErr.Line, CompErr.Column);
619 string text = CompErr.ErrorText; 613 string text = CompErr.ErrorText;
620 614
621 // Use LSL type names 615 // Use LSL type names
622 if (lang == enumCompileType.lsl) 616 if (lang == enumCompileType.lsl)
623 text = ReplaceTypes(CompErr.ErrorText); 617 text = ReplaceTypes(CompErr.ErrorText);
624 618
625 // The Second Life viewer's script editor begins 619 // The Second Life viewer's script editor begins
626 // countingn lines and columns at 0, so we subtract 1. 620 // countingn lines and columns at 0, so we subtract 1.
627 errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", 621 errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n",
628 lslPos.Key - 1, lslPos.Value - 1, 622 lslPos.Key - 1, lslPos.Value - 1,
629 CompErr.ErrorNumber, text, severity); 623 CompErr.ErrorNumber, text, severity);
630 hadErrors = true; 624 hadErrors = true;
631 } 625 }
632 } 626 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index 4855d64..84ccafe 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -218,16 +218,14 @@ namespace OpenSim.Region.ScriptEngine.Shared
218 } 218 }
219 } 219 }
220 220
221 Position = new LSL_Types.Vector3(part.AbsolutePosition.X, 221 Vector3 absPos = part.AbsolutePosition;
222 part.AbsolutePosition.Y, 222 Position = new LSL_Types.Vector3(absPos.X, absPos.Y, absPos.Z);
223 part.AbsolutePosition.Z);
224 223
225 Quaternion wr = part.ParentGroup.GroupRotation; 224 Quaternion wr = part.ParentGroup.Rotation;
226 Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W); 225 Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W);
227 226
228 Velocity = new LSL_Types.Vector3(part.Velocity.X, 227 Vector3 vel = part.Velocity;
229 part.Velocity.Y, 228 Velocity = new LSL_Types.Vector3(vel.X, vel.Y, vel.Z);
230 part.Velocity.Z);
231 } 229 }
232 } 230 }
233 231
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 650d9fa..97166cf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
261 "SecondLife.Script"); 261 "SecondLife.Script");
262 262
263 //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); 263 //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
264 RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); 264 RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
265// lease.Register(this); 265// lease.Register(this);
266 } 266 }
267 catch (Exception) 267 catch (Exception)
@@ -430,7 +430,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
430 430
431 permsGranter = part.TaskInventory[m_ItemID].PermsGranter; 431 permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
432 permsMask = part.TaskInventory[m_ItemID].PermsMask; 432 permsMask = part.TaskInventory[m_ItemID].PermsMask;
433 } 433 }
434 434
435 if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) 435 if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
436 { 436 {
@@ -630,7 +630,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
630 /// <summary> 630 /// <summary>
631 /// Process the next event queued for this script 631 /// Process the next event queued for this script
632 /// </summary> 632 /// </summary>
633 /// <returns></returns> 633 /// <returns></returns>
634 public object EventProcessor() 634 public object EventProcessor()
635 { 635 {
636 lock (m_Script) 636 lock (m_Script)
@@ -925,7 +925,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
925 925
926 public override string ToString() 926 public override string ToString()
927 { 927 {
928 return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName); 928 return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName);
929 } 929 }
930 930
931 string FormatException(Exception e) 931 string FormatException(Exception e)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 9a972c2..e695133 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -554,7 +554,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
554 554
555 // We must look for the part outside the m_Scripts lock because GetSceneObjectPart later triggers the 555 // We must look for the part outside the m_Scripts lock because GetSceneObjectPart later triggers the
556 // m_parts lock on SOG. At the same time, a scene object that is being deleted will take the m_parts lock 556 // m_parts lock on SOG. At the same time, a scene object that is being deleted will take the m_parts lock
557 // and then later on try to take the m_scripts lock in this class when it calls OnRemoveScript() 557 // and then later on try to take the m_scripts lock in this class when it calls OnRemoveScript()
558 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); 558 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
559 if (part == null) 559 if (part == null)
560 { 560 {
@@ -562,7 +562,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
562 m_ScriptErrorMessage += "SceneObjectPart unavailable. Script NOT started.\n"; 562 m_ScriptErrorMessage += "SceneObjectPart unavailable. Script NOT started.\n";
563 m_ScriptFailCount++; 563 m_ScriptFailCount++;
564 return false; 564 return false;
565 } 565 }
566 566
567 TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID); 567 TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID);
568 if (item == null) 568 if (item == null)
@@ -692,7 +692,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
692 AppDomain.CreateDomain( 692 AppDomain.CreateDomain(
693 m_Scene.RegionInfo.RegionID.ToString(), 693 m_Scene.RegionInfo.RegionID.ToString(),
694 evidence, appSetup); 694 evidence, appSetup);
695/* 695/*
696 PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel(); 696 PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
697 AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition(); 697 AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
698 PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet"); 698 PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet");
@@ -925,7 +925,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
925 return new XWorkItem(m_ThreadPool.QueueWorkItem( 925 return new XWorkItem(m_ThreadPool.QueueWorkItem(
926 new WorkItemCallback(this.ProcessEventHandler), 926 new WorkItemCallback(this.ProcessEventHandler),
927 parms)); 927 parms));
928 } 928 }
929 929
930 /// <summary> 930 /// <summary>
931 /// Process a previously posted script event. 931 /// Process a previously posted script event.
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index 519668a..a03cc4c 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -76,7 +76,7 @@ namespace OpenSim.Region.UserStatistics
76 try 76 try
77 { 77 {
78 cnfg = config.Configs["WebStats"]; 78 cnfg = config.Configs["WebStats"];
79 enabled = cnfg.GetBoolean("enabled", false); 79 enabled = cnfg.GetBoolean("enabled", false);
80 } 80 }
81 catch (Exception) 81 catch (Exception)
82 { 82 {
@@ -137,7 +137,7 @@ namespace OpenSim.Region.UserStatistics
137 137
138 m_simstatsCounters.Add(scene.RegionInfo.RegionID, new USimStatsData(scene.RegionInfo.RegionID)); 138 m_simstatsCounters.Add(scene.RegionInfo.RegionID, new USimStatsData(scene.RegionInfo.RegionID));
139 scene.StatsReporter.OnSendStatsResult += ReceiveClassicSimStatsPacket; 139 scene.StatsReporter.OnSendStatsResult += ReceiveClassicSimStatsPacket;
140 } 140 }
141 } 141 }
142 142
143 public void ReceiveClassicSimStatsPacket(SimStats stats) 143 public void ReceiveClassicSimStatsPacket(SimStats stats)