aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
62 files changed, 878 insertions, 558 deletions
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)