aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs5
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs19
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs124
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs120
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs78
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs112
-rw-r--r--OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs55
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml1
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs40
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs94
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs125
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs163
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs939
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs275
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionConnections.cs65
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs43
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionData.cs39
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs29
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs10
29 files changed, 471 insertions, 1924 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index e192b81..f698ea1 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -112,11 +112,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
112 bool storeLocal, bool tempFile) 112 bool storeLocal, bool tempFile)
113 { 113 {
114 ourClient = remoteClient; 114 ourClient = remoteClient;
115 m_asset = new AssetBase(); 115 m_asset = new AssetBase(assetID, "blank", type);
116 m_asset.FullID = assetID;
117 m_asset.Type = type;
118 m_asset.Data = data; 116 m_asset.Data = data;
119 m_asset.Name = "blank";
120 m_asset.Description = "empty"; 117 m_asset.Description = "empty";
121 m_asset.Local = storeLocal; 118 m_asset.Local = storeLocal;
122 m_asset.Temporary = tempFile; 119 m_asset.Temporary = tempFile;
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 7456e8c..7ac8bed 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -144,8 +144,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
144 /// <param name="j2kData">JPEG2000 data</param> 144 /// <param name="j2kData">JPEG2000 data</param>
145 private void DoJ2KDecode(UUID assetID, byte[] j2kData) 145 private void DoJ2KDecode(UUID assetID, byte[] j2kData)
146 { 146 {
147 int DecodeTime = 0; 147// int DecodeTime = 0;
148 DecodeTime = Environment.TickCount; 148// DecodeTime = Environment.TickCount;
149 OpenJPEG.J2KLayerInfo[] layers; 149 OpenJPEG.J2KLayerInfo[] layers;
150 150
151 if (!TryLoadCacheForAsset(assetID, out layers)) 151 if (!TryLoadCacheForAsset(assetID, out layers))
@@ -238,12 +238,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
238 238
239 if (m_cache != null) 239 if (m_cache != null)
240 { 240 {
241 AssetBase layerDecodeAsset = new AssetBase(); 241 string assetID = "j2kCache_" + AssetId.ToString();
242 layerDecodeAsset.ID = "j2kCache_" + AssetId.ToString(); 242
243 AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard);
243 layerDecodeAsset.Local = true; 244 layerDecodeAsset.Local = true;
244 layerDecodeAsset.Name = layerDecodeAsset.ID;
245 layerDecodeAsset.Temporary = true; 245 layerDecodeAsset.Temporary = true;
246 layerDecodeAsset.Type = (sbyte)AssetType.Notecard;
247 246
248 #region Serialize Layer Data 247 #region Serialize Layer Data
249 248
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index c6af806..adcf6bd 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -831,7 +831,7 @@ namespace Flotsam.RegionModules.AssetCache
831 831
832 public string Store(AssetBase asset) 832 public string Store(AssetBase asset)
833 { 833 {
834 if ((asset.FullID == null) || (asset.FullID == UUID.Zero)) 834 if (asset.FullID == UUID.Zero)
835 { 835 {
836 asset.FullID = UUID.Random(); 836 asset.FullID = UUID.Random();
837 } 837 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index fc7d63a..bb4e032 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -395,6 +395,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
395 395
396 // if it leaves, we want to know, too 396 // if it leaves, we want to know, too
397 client.OnLogout += OnLogout; 397 client.OnLogout += OnLogout;
398 client.OnGrantUserRights += GrantUserFriendRights;
399
398 } 400 }
399 401
400 private void ClientClosed(UUID AgentId, Scene scene) 402 private void ClientClosed(UUID AgentId, Scene scene)
@@ -1108,7 +1110,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
1108 // tell everyone that we are offline 1110 // tell everyone that we are offline
1109 SendPresenceState(remoteClient, fl, false); 1111 SendPresenceState(remoteClient, fl, false);
1110 } 1112 }
1111 } 1113 private void GrantUserFriendRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
1114 {
1115 ((Scene)remoteClient.Scene).CommsManager.UpdateUserFriendPerms(requester, target, (uint)rights);
1116 }
1112 1117
1118 public List<FriendListItem> GetUserFriends(UUID agentID)
1119 {
1120 List<FriendListItem> fl;
1121 lock (m_friendLists)
1122 {
1123 fl = (List<FriendListItem>)m_friendLists.Get(agentID.ToString(),
1124 m_initialScene.GetFriendList);
1125 }
1126
1127 return fl;
1128 }
1129 }
1113 #endregion 1130 #endregion
1114} 1131}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index f761bf0..aafcfa2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -99,36 +99,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
99 int failedAssetRestores = 0; 99 int failedAssetRestores = 0;
100 int successfulItemRestores = 0; 100 int successfulItemRestores = 0;
101 List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); 101 List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
102
103 /*
104 if (!m_userInfo.HasReceivedInventory)
105 {
106 // If the region server has access to the user admin service (by which users are created),
107 // then we'll assume that it's okay to fiddle with the user's inventory even if they are not on the
108 // server.
109 //
110 // FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might
111 // use a remote inventory service, though this is vanishingly rare at the moment.
112 if (null == m_scene.CommsManager.UserAdminService)
113 {
114 m_log.ErrorFormat(
115 "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
116 m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID);
117
118 return nodesLoaded;
119 }
120 else
121 {
122 m_userInfo.FetchInventory();
123 for (int i = 0 ; i < 50 ; i++)
124 {
125 if (m_userInfo.HasReceivedInventory == true)
126 break;
127 Thread.Sleep(200);
128 }
129 }
130 }
131 */
132 102
133 //InventoryFolderImpl rootDestinationFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath); 103 //InventoryFolderImpl rootDestinationFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
134 InventoryFolderBase rootDestinationFolder 104 InventoryFolderBase rootDestinationFolder
@@ -159,9 +129,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
159 successfulAssetRestores++; 129 successfulAssetRestores++;
160 else 130 else
161 failedAssetRestores++; 131 failedAssetRestores++;
132
133 if ((successfulAssetRestores) % 50 == 0)
134 m_log.DebugFormat(
135 "[INVENTORY ARCHIVER]: Loaded {0} assets...",
136 successfulAssetRestores);
162 } 137 }
163 else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH)) 138 else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
164 { 139 {
165 InventoryFolderBase foundFolder 140 InventoryFolderBase foundFolder
166 = ReplicateArchivePathToUserInventory( 141 = ReplicateArchivePathToUserInventory(
167 filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType, 142 filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType,
@@ -169,38 +144,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
169 144
170 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) 145 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
171 { 146 {
172 InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data); 147 InventoryItemBase item = LoadItem(data, foundFolder);
173
174 // Don't use the item ID that's in the file
175 item.ID = UUID.Random();
176
177 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager);
178 if (UUID.Zero != ospResolvedId)
179 item.CreatorIdAsUuid = ospResolvedId;
180 else
181 item.CreatorIdAsUuid = m_userInfo.UserProfile.ID;
182
183 item.Owner = m_userInfo.UserProfile.ID;
184
185 // Reset folder ID to the one in which we want to load it
186 item.Folder = foundFolder.ID;
187 148
188 //m_userInfo.AddItem(item); 149 if (item != null)
189 m_scene.InventoryService.AddItem(item); 150 {
190 successfulItemRestores++; 151 successfulItemRestores++;
191 152
192 // If we're loading an item directly into the given destination folder then we need to record 153 // If we're loading an item directly into the given destination folder then we need to record
193 // it separately from any loaded root folders 154 // it separately from any loaded root folders
194 if (rootDestinationFolder == foundFolder) 155 if (rootDestinationFolder == foundFolder)
195 nodesLoaded.Add(item); 156 nodesLoaded.Add(item);
157 }
196 } 158 }
197 } 159 }
198 } 160 }
199 161
200 archive.Close(); 162 archive.Close();
201 163
202 m_log.DebugFormat("[INVENTORY ARCHIVER]: Restored {0} assets", successfulAssetRestores); 164 m_log.DebugFormat(
203 m_log.InfoFormat("[INVENTORY ARCHIVER]: Restored {0} items", successfulItemRestores); 165 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
166 successfulAssetRestores, failedAssetRestores);
167 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
204 168
205 return nodesLoaded; 169 return nodesLoaded;
206 } 170 }
@@ -234,8 +198,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
234 198
235 string originalArchivePath = archivePath; 199 string originalArchivePath = archivePath;
236 200
237 m_log.DebugFormat( 201// m_log.DebugFormat(
238 "[INVENTORY ARCHIVER]: Loading to folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID); 202// "[INVENTORY ARCHIVER]: Loading folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID);
239 203
240 InventoryFolderBase destFolder = null; 204 InventoryFolderBase destFolder = null;
241 205
@@ -246,8 +210,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
246 { 210 {
247 if (foldersCreated.ContainsKey(archivePath)) 211 if (foldersCreated.ContainsKey(archivePath))
248 { 212 {
249 m_log.DebugFormat( 213// m_log.DebugFormat(
250 "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath); 214// "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
251 destFolder = foldersCreated[archivePath]; 215 destFolder = foldersCreated[archivePath];
252 } 216 }
253 else 217 else
@@ -289,6 +253,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
289 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); 253 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
290 254
291 string newFolderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex); 255 string newFolderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex);
256
257 newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName);
292 UUID newFolderId = UUID.Random(); 258 UUID newFolderId = UUID.Random();
293 259
294 // Asset type has to be Unknown here rather than Folder, otherwise the created folder can't be 260 // Asset type has to be Unknown here rather than Folder, otherwise the created folder can't be
@@ -361,6 +327,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
361 } 327 }
362 328
363 /// <summary> 329 /// <summary>
330 /// Load an item from the archive
331 /// </summary>
332 /// <param name="filePath">The archive path for the item</param>
333 /// <param name="data">The raw item data</param>
334 /// <param name="rootDestinationFolder">The root destination folder for loaded items</param>
335 /// <param name="nodesLoaded">All the inventory nodes (items and folders) loaded so far</param>
336 protected InventoryItemBase LoadItem(byte[] data, InventoryFolderBase loadFolder)
337 {
338 InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data);
339
340 // Don't use the item ID that's in the file
341 item.ID = UUID.Random();
342
343 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager);
344 if (UUID.Zero != ospResolvedId)
345 item.CreatorIdAsUuid = ospResolvedId;
346 else
347 item.CreatorIdAsUuid = m_userInfo.UserProfile.ID;
348
349 item.Owner = m_userInfo.UserProfile.ID;
350
351 // Reset folder ID to the one in which we want to load it
352 item.Folder = loadFolder.ID;
353
354 //m_userInfo.AddItem(item);
355 m_scene.InventoryService.AddItem(item);
356
357 return item;
358 }
359
360 /// <summary>
364 /// Load an asset 361 /// Load an asset
365 /// </summary> 362 /// </summary>
366 /// <param name="assetFilename"></param> 363 /// <param name="assetFilename"></param>
@@ -389,11 +386,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
389 { 386 {
390 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; 387 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
391 388
392 //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); 389 if (assetType == (sbyte)AssetType.Unknown)
390 m_log.WarnFormat("[INVENTORY ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid);
393 391
394 AssetBase asset = new AssetBase(new UUID(uuid), "RandomName"); 392 //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
395 393
396 asset.Type = assetType; 394 AssetBase asset = new AssetBase(new UUID(uuid), "RandomName", assetType);
397 asset.Data = data; 395 asset.Data = data;
398 396
399 m_scene.AssetService.Store(asset); 397 m_scene.AssetService.Store(asset);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index a822d10..247cee4 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -27,6 +27,9 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using log4net;
30using OpenMetaverse; 33using OpenMetaverse;
31using OpenSim.Framework; 34using OpenSim.Framework;
32using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
@@ -38,7 +41,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
38 /// </summary> 41 /// </summary>
39 public static class InventoryArchiveUtils 42 public static class InventoryArchiveUtils
40 { 43 {
41 public static readonly string PATH_DELIMITER = "/"; 44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
46 // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings
47 public static readonly char ESCAPE_CHARACTER = '\\';
48
49 // The character used to separate inventory path components (different folders and items)
50 public static readonly char PATH_DELIMITER = '/';
42 51
43 /// <summary> 52 /// <summary>
44 /// Find a folder given a PATH_DELIMITER delimited path starting from a user's root folder 53 /// Find a folder given a PATH_DELIMITER delimited path starting from a user's root folder
@@ -103,10 +112,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
103 112
104 path = path.Trim(); 113 path = path.Trim();
105 114
106 if (path == PATH_DELIMITER) 115 if (path == PATH_DELIMITER.ToString())
107 return startFolder; 116 return startFolder;
108 117
109 string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); 118 string[] components = SplitEscapedPath(path);
119 components[0] = UnescapePath(components[0]);
120
121 //string[] components = path.Split(new string[] { PATH_DELIMITER.ToString() }, 2, StringSplitOptions.None);
122
110 InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); 123 InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID);
111 124
112 foreach (InventoryFolderBase folder in contents.Folders) 125 foreach (InventoryFolderBase folder in contents.Folders)
@@ -181,10 +194,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
181 public static InventoryItemBase FindItemByPath( 194 public static InventoryItemBase FindItemByPath(
182 IInventoryService inventoryService, InventoryFolderBase startFolder, string path) 195 IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
183 { 196 {
184 string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); 197 string[] components = SplitEscapedPath(path);
198 components[0] = UnescapePath(components[0]);
199
200 //string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
185 201
186 if (components.Length == 1) 202 if (components.Length == 1)
187 { 203 {
204// m_log.DebugFormat("FOUND SINGLE COMPONENT [{0}]", components[0]);
205
188 List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID); 206 List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID);
189 foreach (InventoryItemBase item in items) 207 foreach (InventoryItemBase item in items)
190 { 208 {
@@ -194,6 +212,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
194 } 212 }
195 else 213 else
196 { 214 {
215// m_log.DebugFormat("FOUND COMPONENTS [{0}] and [{1}]", components[0], components[1]);
216
197 InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID); 217 InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID);
198 218
199 foreach (InventoryFolderBase folder in contents.Folders) 219 foreach (InventoryFolderBase folder in contents.Folders)
@@ -206,5 +226,97 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
206 // We didn't find an item or intermediate folder with the given name 226 // We didn't find an item or intermediate folder with the given name
207 return null; 227 return null;
208 } 228 }
229
230 /// <summary>
231 /// Split a human escaped path into two components if it contains an unescaped path delimiter, or one component
232 /// if no delimiter is present
233 /// </summary>
234 /// <param name="path"></param>
235 /// <returns>
236 /// The split path. We leave the components in their originally unescaped state (though we remove the delimiter
237 /// which originally split them if applicable).
238 /// </returns>
239 public static string[] SplitEscapedPath(string path)
240 {
241// m_log.DebugFormat("SPLITTING PATH {0}", path);
242
243 bool singleEscapeChar = false;
244
245 for (int i = 0; i < path.Length; i++)
246 {
247 if (path[i] == ESCAPE_CHARACTER && !singleEscapeChar)
248 {
249 singleEscapeChar = true;
250 }
251 else
252 {
253 if (PATH_DELIMITER == path[i] && !singleEscapeChar)
254 return new string[2] { path.Remove(i), path.Substring(i + 1) };
255 else
256 singleEscapeChar = false;
257 }
258 }
259
260 // We didn't find a delimiter
261 return new string[1] { path };
262 }
263
264 /// <summary>
265 /// Unescapes a human escaped path. This means that "\\" goes to "\", and "\/" goes to "/"
266 /// </summary>
267 /// <param name="path"></param>
268 /// <returns></returns>
269 public static string UnescapePath(string path)
270 {
271// m_log.DebugFormat("ESCAPING PATH {0}", path);
272
273 StringBuilder sb = new StringBuilder();
274
275 bool singleEscapeChar = false;
276 for (int i = 0; i < path.Length; i++)
277 {
278 if (path[i] == ESCAPE_CHARACTER && !singleEscapeChar)
279 singleEscapeChar = true;
280 else
281 singleEscapeChar = false;
282
283 if (singleEscapeChar)
284 {
285 if (PATH_DELIMITER == path[i])
286 sb.Append(PATH_DELIMITER);
287 }
288 else
289 {
290 sb.Append(path[i]);
291 }
292 }
293
294// m_log.DebugFormat("ESCAPED PATH TO {0}", sb);
295
296 return sb.ToString();
297 }
298
299 /// <summary>
300 /// Escape an archive path.
301 /// </summary>
302 /// This has to be done differently from human paths because we can't leave in any "/" characters (due to
303 /// problems if the archive is built from or extracted to a filesystem
304 /// <param name="path"></param>
305 /// <returns></returns>
306 public static string EscapeArchivePath(string path)
307 {
308 // Only encode ampersands (for escaping anything) and / (since this is used as general dir separator).
309 return path.Replace("&", "&amp;").Replace("/", "&#47;");
310 }
311
312 /// <summary>
313 /// Unescape an archive path.
314 /// </summary>
315 /// <param name="path"></param>
316 /// <returns></returns>
317 public static string UnescapeArchivePath(string path)
318 {
319 return path.Replace("&#47;", "/").Replace("&amp;", "&");
320 }
209 } 321 }
210} \ No newline at end of file 322} \ 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 499c552..bbb49f6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -217,37 +217,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
217 InventoryItemBase inventoryItem = null; 217 InventoryItemBase inventoryItem = null;
218 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.UserProfile.ID); 218 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.UserProfile.ID);
219 219
220 // XXX: Very temporarily, drop and refetch inventory to make sure we have any newly created items in cache
221 // This will disappear very soon once we stop using the old cached inventory.
222 /*
223 m_userInfo.DropInventory();
224 m_userInfo.FetchInventory();
225 */
226
227 /*
228 if (!m_userInfo.HasReceivedInventory)
229 {
230 // If the region server has access to the user admin service (by which users are created),
231 // then we'll assume that it's okay to fiddle with the user's inventory even if they are not on the
232 // server.
233 //
234 // FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might
235 // use a remote inventory service, though this is vanishingly rare at the moment.
236 if (null == m_scene.CommsManager.UserAdminService)
237 {
238 m_log.ErrorFormat(
239 "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
240 m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID);
241
242 return;
243 }
244 else
245 {
246 m_userInfo.FetchInventory();
247 }
248 }
249 */
250
251 bool foundStar = false; 220 bool foundStar = false;
252 221
253 // Eliminate double slashes and any leading / on the path. 222 // Eliminate double slashes and any leading / on the path.
@@ -294,34 +263,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
294 263
295 m_archiveWriter = new TarArchiveWriter(m_saveStream); 264 m_archiveWriter = new TarArchiveWriter(m_saveStream);
296 265
297 if (null == inventoryFolder) 266 if (inventoryFolder != null)
298 {
299 if (null == inventoryItem)
300 {
301 // We couldn't find the path indicated
302 m_saveStream.Close();
303 m_module.TriggerInventoryArchiveSaved(
304 m_id, false, m_userInfo, m_invPath, m_saveStream,
305 new Exception(string.Format("Could not find inventory entry at path {0}", m_invPath)));
306 return;
307 }
308 else
309 {
310 m_log.DebugFormat(
311 "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}",
312 inventoryItem.Name, inventoryItem.ID, m_invPath);
313
314 SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH);
315 }
316 }
317 else
318 { 267 {
319 m_log.DebugFormat( 268 m_log.DebugFormat(
320 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", 269 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
321 inventoryFolder.Name, inventoryFolder.ID, m_invPath); 270 inventoryFolder.Name, inventoryFolder.ID, m_invPath);
322 271
323 //recurse through all dirs getting dirs and files 272 //recurse through all dirs getting dirs and files
324 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar); 273 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar);
274 }
275 else if (inventoryItem != null)
276 {
277 m_log.DebugFormat(
278 "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}",
279 inventoryItem.Name, inventoryItem.ID, m_invPath);
280
281 SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH);
282 }
283 else
284 {
285 // We couldn't find the path indicated
286 m_saveStream.Close();
287 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
288 m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage);
289 m_module.TriggerInventoryArchiveSaved(
290 m_id, false, m_userInfo, m_invPath, m_saveStream,
291 new Exception(errorMessage));
292 return;
325 } 293 }
326 294
327 // Don't put all this profile information into the archive right now. 295 // Don't put all this profile information into the archive right now.
@@ -396,7 +364,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
396 { 364 {
397 return string.Format( 365 return string.Format(
398 "{0}{1}{2}/", 366 "{0}{1}{2}/",
399 name, 367 InventoryArchiveUtils.EscapeArchivePath(name),
400 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, 368 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
401 id); 369 id);
402 } 370 }
@@ -411,7 +379,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
411 { 379 {
412 return string.Format( 380 return string.Format(
413 "{0}{1}{2}.xml", 381 "{0}{1}{2}.xml",
414 name, 382 InventoryArchiveUtils.EscapeArchivePath(name),
415 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, 383 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
416 id); 384 id);
417 } 385 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index b0fdcd6..f8a010c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Text;
33using System.Threading; 32using System.Threading;
34using NUnit.Framework; 33using NUnit.Framework;
35using NUnit.Framework.SyntaxHelpers; 34using NUnit.Framework.SyntaxHelpers;
@@ -122,9 +121,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
122 } 121 }
123 122
124 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 123 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
125 AssetBase asset1 = new AssetBase(); 124 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
126 asset1.FullID = asset1Id;
127 asset1.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(object1));
128 scene.AssetService.Store(asset1); 125 scene.AssetService.Store(asset1);
129 126
130 // Create item 127 // Create item
@@ -136,7 +133,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
136 InventoryFolderBase objsFolder 133 InventoryFolderBase objsFolder
137 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects"); 134 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
138 item1.Folder = objsFolder.ID; 135 item1.Folder = objsFolder.ID;
139 scene.AddInventoryItem(userId, item1); 136 scene.AddInventoryItem(userId, item1);
140 137
141 MemoryStream archiveWriteStream = new MemoryStream(); 138 MemoryStream archiveWriteStream = new MemoryStream();
142 archiverModule.OnInventoryArchiveSaved += SaveCompleted; 139 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
@@ -218,14 +215,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
218 string userItemCreatorLastName = "Lucan"; 215 string userItemCreatorLastName = "Lucan";
219 UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); 216 UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
220 217
221 string itemName = "b.lsl"; 218 string item1Name = "b.lsl";
222 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); 219 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1Name, UUID.Random());
223 220
224 MemoryStream archiveWriteStream = new MemoryStream(); 221 MemoryStream archiveWriteStream = new MemoryStream();
225 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); 222 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
226 223
227 InventoryItemBase item1 = new InventoryItemBase(); 224 InventoryItemBase item1 = new InventoryItemBase();
228 item1.Name = itemName; 225 item1.Name = item1Name;
229 item1.AssetID = UUID.Random(); 226 item1.AssetID = UUID.Random();
230 item1.GroupID = UUID.Random(); 227 item1.GroupID = UUID.Random();
231 item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName); 228 item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
@@ -259,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
259 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); 256 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
260 257
261 InventoryItemBase foundItem1 258 InventoryItemBase foundItem1
262 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName); 259 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, item1Name);
263 260
264 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); 261 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
265 Assert.That( 262 Assert.That(
@@ -277,7 +274,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
277 archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream); 274 archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream);
278 275
279 InventoryItemBase foundItem2 276 InventoryItemBase foundItem2
280 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xA/" + itemName); 277 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xA/" + item1Name);
281 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); 278 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
282 279
283 // Now try loading to a more deeply nested folder 280 // Now try loading to a more deeply nested folder
@@ -286,10 +283,99 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
286 archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream); 283 archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream);
287 284
288 InventoryItemBase foundItem3 285 InventoryItemBase foundItem3
289 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC/" + itemName); 286 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC/" + item1Name);
290 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); 287 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
291 } 288 }
292 289
290 [Test]
291 public void TestIarV0_1WithEscapedChars()
292 {
293 TestHelper.InMethod();
294// log4net.Config.XmlConfigurator.Configure();
295
296 string itemName = "You & you are a mean/man/";
297 string humanEscapedItemName = @"You & you are a mean\/man\/";
298 string userPassword = "meowfood";
299
300 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
301
302 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
303 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
304 CommunicationsManager cm = scene.CommsManager;
305
306 // Create user
307 string userFirstName = "Jock";
308 string userLastName = "Stirrup";
309 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
310
311 lock (this)
312 {
313 UserProfileTestUtils.CreateUserWithInventory(
314 cm, userFirstName, userLastName, userPassword, userId, InventoryReceived);
315 Monitor.Wait(this, 60000);
316 }
317
318 // Create asset
319 SceneObjectGroup object1;
320 SceneObjectPart part1;
321 {
322 string partName = "part name";
323 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
324 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
325 Vector3 groupPosition = new Vector3(10, 20, 30);
326 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
327 Vector3 offsetPosition = new Vector3(5, 10, 15);
328
329 part1
330 = new SceneObjectPart(
331 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
332 part1.Name = partName;
333
334 object1 = new SceneObjectGroup(part1);
335 scene.AddNewSceneObject(object1, false);
336 }
337
338 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
339 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
340 scene.AssetService.Store(asset1);
341
342 // Create item
343 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
344 InventoryItemBase item1 = new InventoryItemBase();
345 item1.Name = itemName;
346 item1.AssetID = asset1.FullID;
347 item1.ID = item1Id;
348 InventoryFolderBase objsFolder
349 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
350 item1.Folder = objsFolder.ID;
351 scene.AddInventoryItem(userId, item1);
352
353 MemoryStream archiveWriteStream = new MemoryStream();
354 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
355
356 mre.Reset();
357 archiverModule.ArchiveInventory(
358 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
359 mre.WaitOne(60000, false);
360
361 // LOAD ITEM
362 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
363
364 archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
365
366 InventoryItemBase foundItem1
367 = InventoryArchiveUtils.FindItemByPath(
368 scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
369
370 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
371// Assert.That(
372// foundItem1.CreatorId, Is.EqualTo(userUuid),
373// "Loaded item non-uuid creator doesn't match that of the loading user");
374 Assert.That(
375 foundItem1.Name, Is.EqualTo(itemName),
376 "Loaded item name doesn't match saved name");
377 }
378
293 /// <summary> 379 /// <summary>
294 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 380 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
295 /// embedded creators do not exist in the system 381 /// embedded creators do not exist in the system
@@ -302,7 +388,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
302 { 388 {
303 TestHelper.InMethod(); 389 TestHelper.InMethod();
304 390
305 log4net.Config.XmlConfigurator.Configure(); 391 //log4net.Config.XmlConfigurator.Configure();
306 392
307 string userFirstName = "Charlie"; 393 string userFirstName = "Charlie";
308 string userLastName = "Chan"; 394 string userLastName = "Chan";
@@ -370,7 +456,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
370 { 456 {
371 TestHelper.InMethod(); 457 TestHelper.InMethod();
372 458
373 log4net.Config.XmlConfigurator.Configure(); 459 //log4net.Config.XmlConfigurator.Configure();
374 460
375 string userFirstName = "Dennis"; 461 string userFirstName = "Dennis";
376 string userLastName = "Menace"; 462 string userLastName = "Menace";
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
index 769af8d..11aca99 100644
--- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
@@ -1,7 +1,10 @@
1using System.Collections.Generic; 1using System.Collections;
2using System.Collections.Generic;
2using System.Reflection; 3using System.Reflection;
3using log4net; 4using log4net;
4using Nini.Config; 5using Nini.Config;
6using OpenMetaverse;
7using OpenSim.Framework;
5using OpenSim.Region.CoreModules.Framework.Monitoring.Alerts; 8using OpenSim.Region.CoreModules.Framework.Monitoring.Alerts;
6using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors; 9using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors;
7using OpenSim.Region.Framework.Interfaces; 10using OpenSim.Region.Framework.Interfaces;
@@ -43,6 +46,56 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
43 "monitor report", 46 "monitor report",
44 "Returns a variety of statistics about the current region and/or simulator", 47 "Returns a variety of statistics about the current region and/or simulator",
45 DebugMonitors); 48 DebugMonitors);
49
50 MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage);
51 }
52
53 public Hashtable StatsPage(Hashtable request)
54 {
55 // If request was for a specific monitor
56 // eg url/?monitor=Monitor.Name
57 if (request.ContainsKey("monitor"))
58 {
59 string monID = (string) request["monitor"];
60
61 foreach (IMonitor monitor in m_monitors)
62 {
63 if (monitor.ToString() == monID)
64 {
65 Hashtable ereply3 = new Hashtable();
66
67 ereply3["int_response_code"] = 404; // 200 OK
68 ereply3["str_response_string"] = monitor.GetValue().ToString();
69 ereply3["content_type"] = "text/plain";
70
71 return ereply3;
72 }
73 }
74
75 // No monitor with that name
76 Hashtable ereply2 = new Hashtable();
77
78 ereply2["int_response_code"] = 404; // 200 OK
79 ereply2["str_response_string"] = "No such monitor";
80 ereply2["content_type"] = "text/plain";
81
82 return ereply2;
83 }
84
85 string xml = "<data>";
86 foreach (IMonitor monitor in m_monitors)
87 {
88 xml += "<" + monitor.ToString() + ">" + monitor.GetValue() + "</" + monitor.ToString() + ">";
89 }
90 xml += "</data>";
91
92 Hashtable ereply = new Hashtable();
93
94 ereply["int_response_code"] = 200; // 200 OK
95 ereply["str_response_string"] = xml;
96 ereply["content_type"] = "text/xml";
97
98 return ereply;
46 } 99 }
47 100
48 public void PostInitialise() 101 public void PostInitialise()
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index 8f82718..9757072 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -13,7 +13,6 @@
13 <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" /> 13 <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" />
14 <RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" /> 14 <RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" />
15 <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" /> 15 <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" />
16 <RegionModule id="RegionCombinerModule" type="OpenSim.Region.CoreModules.World.Land.RegionCombinerModule" />
17 <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" /> 16 <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" />
18 <RegionModule id="HGWorldMapModule" type="OpenSim.Region.CoreModules.Hypergrid.HGWorldMapModule" /> 17 <RegionModule id="HGWorldMapModule" type="OpenSim.Region.CoreModules.Hypergrid.HGWorldMapModule" />
19 <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" /> 18 <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" />
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
index 9a6c49a..43761fc 100644
--- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -311,11 +311,8 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
311 } 311 }
312 312
313 // Create a new asset for user 313 // Create a new asset for user
314 AssetBase asset = new AssetBase(); 314 AssetBase asset = new AssetBase(UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture);
315 asset.FullID = UUID.Random();
316 asset.Data = assetData; 315 asset.Data = assetData;
317 asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
318 asset.Type = 0;
319 asset.Description = String.Format("URL image : {0}", Url); 316 asset.Description = String.Format("URL image : {0}", Url);
320 asset.Local = false; 317 asset.Local = false;
321 asset.Temporary = ((Disp & DISP_TEMP) != 0); 318 asset.Temporary = ((Disp & DISP_TEMP) != 0);
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
index 97899a7..27b64bf 100644
--- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -689,7 +689,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
689 } 689 }
690 if (respParms.Contains("IntValue")) 690 if (respParms.Contains("IntValue"))
691 { 691 {
692 Idata = Convert.ToInt32((string) respParms["IntValue"]); 692 Idata = Convert.ToInt32(respParms["IntValue"]);
693 } 693 }
694 if (respParms.Contains("faultString")) 694 if (respParms.Contains("faultString"))
695 { 695 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
index 92db15b..b12d778 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
118 118
119 m_log.Info("[HypergridService]: Starting..."); 119 m_log.Info("[HypergridService]: Starting...");
120 120
121 Object[] args = new Object[] { m_Config, MainServer.Instance }; 121// Object[] args = new Object[] { m_Config, MainServer.Instance };
122 122
123 m_HypergridHandler = new HypergridServiceInConnector(m_Config, MainServer.Instance, scene.RequestModuleInterface<IHyperlinkService>()); 123 m_HypergridHandler = new HypergridServiceInConnector(m_Config, MainServer.Instance, scene.RequestModuleInterface<IHyperlinkService>());
124 //ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args); 124 //ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
index 40ac647..f2d8579 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
@@ -336,7 +336,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
336 public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) 336 public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
337 { 337 {
338 int snapXmin = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize; 338 int snapXmin = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize;
339 int snapXmax = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize; 339// int snapXmax = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize;
340 int snapYmin = (int)(ymin / Constants.RegionSize) * (int)Constants.RegionSize; 340 int snapYmin = (int)(ymin / Constants.RegionSize) * (int)Constants.RegionSize;
341 int snapYmax = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize; 341 int snapYmax = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize;
342 342
@@ -604,13 +604,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
604 { 604 {
605 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID); 605 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID);
606 606
607 if (uinfo == null)
608 return false;
609
607 if ((IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null)) || 610 if ((IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null)) ||
608 (!IsLocalUser(uinfo) && !IsGoingHome(uinfo, regInfo))) 611 (!IsLocalUser(uinfo) && !IsGoingHome(uinfo, regInfo)))
609 { 612 {
610 m_log.Info("[HGrid]: Local user is going to foreign region or foreign user is going elsewhere"); 613 m_log.Info("[HGrid]: Local user is going to foreign region or foreign user is going elsewhere");
611 614
612 // Set the position of the region on the remote grid 615 // Set the position of the region on the remote grid
613 ulong realHandle = FindRegionHandle(regInfo.RegionHandle); 616// ulong realHandle = FindRegionHandle(regInfo.RegionHandle);
614 uint x = 0, y = 0; 617 uint x = 0, y = 0;
615 Utils.LongToUInts(regInfo.RegionHandle, out x, out y); 618 Utils.LongToUInts(regInfo.RegionHandle, out x, out y);
616 GridRegion clonedRegion = new GridRegion(regInfo); 619 GridRegion clonedRegion = new GridRegion(regInfo);
@@ -737,6 +740,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
737 // Is the user going back to the home region or the home grid? 740 // Is the user going back to the home region or the home grid?
738 protected bool IsGoingHome(CachedUserInfo uinfo, GridRegion rinfo) 741 protected bool IsGoingHome(CachedUserInfo uinfo, GridRegion rinfo)
739 { 742 {
743 if (uinfo == null)
744 return false;
745
740 if (uinfo.UserProfile == null) 746 if (uinfo.UserProfile == null)
741 return false; 747 return false;
742 748
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index c261943..70a225e 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -332,10 +332,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
332 { 332 {
333 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; 333 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
334 334
335 if (assetType == (sbyte)AssetType.Unknown)
336 m_log.WarnFormat("[ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid);
337
335 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); 338 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
336 339
337 AssetBase asset = new AssetBase(new UUID(uuid), String.Empty); 340 AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType);
338 asset.Type = assetType;
339 asset.Data = data; 341 asset.Data = data;
340 342
341 // We're relying on the asset service to do the sensible thing and not store the asset if it already 343 // We're relying on the asset service to do the sensible thing and not store the asset if it already
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs
index 5208e7a..2d2c570 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs
@@ -158,9 +158,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
158 158
159 m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); 159 m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename);
160 160
161 AssetBase asset = new AssetBase(new UUID(filename), metadata.Name); 161 AssetBase asset = new AssetBase(new UUID(filename), metadata.Name, metadata.AssetType);
162 asset.Description = metadata.Description; 162 asset.Description = metadata.Description;
163 asset.Type = metadata.AssetType;
164 asset.Data = data; 163 asset.Data = data;
165 164
166 m_cache.Store(asset); 165 m_cache.Store(asset);
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs b/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs
index ddac515..2ff635b 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs
@@ -52,16 +52,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
52 52
53 public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename) 53 public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename)
54 { 54 {
55 55 m_asset = new AssetBase(UUID.Zero, pClientFilename, type);
56 m_asset = new AssetBase();
57 m_asset.FullID = UUID.Zero;
58 m_asset.Type = type;
59 m_asset.Data = new byte[0]; 56 m_asset.Data = new byte[0];
60 m_asset.Name = pClientFilename;
61 m_asset.Description = "empty"; 57 m_asset.Description = "empty";
62 m_asset.Local = true; 58 m_asset.Local = true;
63 m_asset.Temporary = true; 59 m_asset.Temporary = true;
64
65 } 60 }
66 61
67 public ulong XferID 62 public ulong XferID
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 93a949a..968f46a 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1059,9 +1059,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1059 if (m_scene.Permissions.IsGod(remote_client.AgentId)) 1059 if (m_scene.Permissions.IsGod(remote_client.AgentId))
1060 { 1060 {
1061 land.LandData.OwnerID = ownerID; 1061 land.LandData.OwnerID = ownerID;
1062 land.LandData.GroupID = UUID.Zero;
1063 land.LandData.IsGroupOwned = false;
1062 1064
1063 m_scene.ForEachClient(SendParcelOverlay); 1065 m_scene.ForEachClient(SendParcelOverlay);
1064 land.SendLandUpdateToClient(remote_client); 1066 land.SendLandUpdateToClient(true, remote_client);
1065 } 1067 }
1066 } 1068 }
1067 } 1069 }
@@ -1082,8 +1084,10 @@ namespace OpenSim.Region.CoreModules.World.Land
1082 land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 1084 land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
1083 else 1085 else
1084 land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; 1086 land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
1087 land.LandData.GroupID = UUID.Zero;
1088 land.LandData.IsGroupOwned = false;
1085 m_scene.ForEachClient(SendParcelOverlay); 1089 m_scene.ForEachClient(SendParcelOverlay);
1086 land.SendLandUpdateToClient(remote_client); 1090 land.SendLandUpdateToClient(true, remote_client);
1087 } 1091 }
1088 } 1092 }
1089 } 1093 }
@@ -1105,9 +1109,10 @@ namespace OpenSim.Region.CoreModules.World.Land
1105 else 1109 else
1106 land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; 1110 land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
1107 land.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); 1111 land.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
1112 land.LandData.GroupID = UUID.Zero;
1108 land.LandData.IsGroupOwned = false; 1113 land.LandData.IsGroupOwned = false;
1109 m_scene.ForEachClient(SendParcelOverlay); 1114 m_scene.ForEachClient(SendParcelOverlay);
1110 land.SendLandUpdateToClient(remote_client); 1115 land.SendLandUpdateToClient(true, remote_client);
1111 } 1116 }
1112 } 1117 }
1113 } 1118 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index bfe85f1..0bd225e 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -49,6 +49,8 @@ namespace OpenSim.Region.CoreModules.World.Land
49 #pragma warning restore 0429 49 #pragma warning restore 0429
50 private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax]; 50 private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax];
51 51
52 private int m_lastSeqId = 0;
53
52 protected LandData m_landData = new LandData(); 54 protected LandData m_landData = new LandData();
53 protected Scene m_scene; 55 protected Scene m_scene;
54 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
@@ -81,6 +83,10 @@ namespace OpenSim.Region.CoreModules.World.Land
81 { 83 {
82 m_scene = scene; 84 m_scene = scene;
83 LandData.OwnerID = owner_id; 85 LandData.OwnerID = owner_id;
86 if (is_group_owned)
87 LandData.GroupID = owner_id;
88 else
89 LandData.GroupID = UUID.Zero;
84 LandData.IsGroupOwned = is_group_owned; 90 LandData.IsGroupOwned = is_group_owned;
85 } 91 }
86 92
@@ -172,7 +178,19 @@ namespace OpenSim.Region.CoreModules.World.Land
172// regionFlags |= (uint)RegionFlags.AllowLandmark; 178// regionFlags |= (uint)RegionFlags.AllowLandmark;
173// if (landData.OwnerID == remote_client.AgentId) 179// if (landData.OwnerID == remote_client.AgentId)
174// regionFlags |= (uint)RegionFlags.AllowSetHome; 180// regionFlags |= (uint)RegionFlags.AllowSetHome;
175 remote_client.SendLandProperties(sequence_id, 181
182 int seq_id;
183 if (snap_selection && (sequence_id == 0))
184 {
185 seq_id = m_lastSeqId;
186 }
187 else
188 {
189 seq_id = sequence_id;
190 m_lastSeqId = seq_id;
191 }
192
193 remote_client.SendLandProperties(seq_id,
176 snap_selection, request_result, LandData, 194 snap_selection, request_result, LandData,
177 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, 195 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
178 GetParcelMaxPrimCount(this), 196 GetParcelMaxPrimCount(this),
@@ -184,6 +202,7 @@ namespace OpenSim.Region.CoreModules.World.Land
184 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) 202 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this))
185 { 203 {
186 //Needs later group support 204 //Needs later group support
205 bool snap_selection = false;
187 LandData newData = LandData.Copy(); 206 LandData newData = LandData.Copy();
188 207
189 if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) 208 if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice)
@@ -192,6 +211,7 @@ namespace OpenSim.Region.CoreModules.World.Land
192 { 211 {
193 newData.AuthBuyerID = args.AuthBuyerID; 212 newData.AuthBuyerID = args.AuthBuyerID;
194 newData.SalePrice = args.SalePrice; 213 newData.SalePrice = args.SalePrice;
214 snap_selection = true;
195 } 215 }
196 } 216 }
197 newData.Category = args.Category; 217 newData.Category = args.Category;
@@ -212,7 +232,7 @@ namespace OpenSim.Region.CoreModules.World.Land
212 232
213 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 233 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
214 234
215 SendLandUpdateToAvatarsOverMe(); 235 SendLandUpdateToAvatarsOverMe(snap_selection);
216 } 236 }
217 } 237 }
218 238
@@ -230,7 +250,7 @@ namespace OpenSim.Region.CoreModules.World.Land
230 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects); 250 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects);
231 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 251 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
232 252
233 SendLandUpdateToAvatarsOverMe(); 253 SendLandUpdateToAvatarsOverMe(true);
234 } 254 }
235 255
236 public void DeedToGroup(UUID groupID) 256 public void DeedToGroup(UUID groupID)
@@ -242,7 +262,7 @@ namespace OpenSim.Region.CoreModules.World.Land
242 262
243 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 263 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
244 264
245 SendLandUpdateToAvatarsOverMe(); 265 SendLandUpdateToAvatarsOverMe(true);
246 } 266 }
247 267
248 public bool IsEitherBannedOrRestricted(UUID avatar) 268 public bool IsEitherBannedOrRestricted(UUID avatar)
@@ -297,8 +317,18 @@ namespace OpenSim.Region.CoreModules.World.Land
297 SendLandProperties(0, false, 0, remote_client); 317 SendLandProperties(0, false, 0, remote_client);
298 } 318 }
299 319
320 public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client)
321 {
322 SendLandProperties(0, snap_selection, 0, remote_client);
323 }
324
300 public void SendLandUpdateToAvatarsOverMe() 325 public void SendLandUpdateToAvatarsOverMe()
301 { 326 {
327 SendLandUpdateToAvatarsOverMe(false);
328 }
329
330 public void SendLandUpdateToAvatarsOverMe(bool snap_selection)
331 {
302 List<ScenePresence> avatars = m_scene.GetAvatars(); 332 List<ScenePresence> avatars = m_scene.GetAvatars();
303 ILandObject over = null; 333 ILandObject over = null;
304 for (int i = 0; i < avatars.Count; i++) 334 for (int i = 0; i < avatars.Count; i++)
@@ -325,7 +355,7 @@ namespace OpenSim.Region.CoreModules.World.Land
325 else 355 else
326 avatars[i].Invulnerable = true; 356 avatars[i].Invulnerable = true;
327 357
328 SendLandUpdateToClient(avatars[i].ControllingClient); 358 SendLandUpdateToClient(snap_selection, avatars[i].ControllingClient);
329 } 359 }
330 } 360 }
331 } 361 }
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
deleted file mode 100644
index 70d6de3..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerClientEventForwarder.cs
+++ /dev/null
@@ -1,94 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Region.Framework.Scenes;
32
33namespace OpenSim.Region.CoreModules.World.Land
34{
35public class RegionCombinerClientEventForwarder
36 {
37 private Scene m_rootScene;
38 private Dictionary<UUID, Scene> m_virtScene = new Dictionary<UUID, Scene>();
39 private Dictionary<UUID,RegionCombinerIndividualEventForwarder> m_forwarders = new Dictionary<UUID,
40 RegionCombinerIndividualEventForwarder>();
41
42 public RegionCombinerClientEventForwarder(RegionConnections rootScene)
43 {
44 m_rootScene = rootScene.RegionScene;
45 }
46
47 public void AddSceneToEventForwarding(Scene virtualScene)
48 {
49 lock (m_virtScene)
50 {
51 if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
52 {
53 m_virtScene[virtualScene.RegionInfo.originRegionID] = virtualScene;
54 }
55 else
56 {
57 m_virtScene.Add(virtualScene.RegionInfo.originRegionID, virtualScene);
58 }
59 }
60
61 lock (m_forwarders)
62 {
63 // TODO: Fix this to unregister if this happens
64 if (m_forwarders.ContainsKey(virtualScene.RegionInfo.originRegionID))
65 m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
66
67 RegionCombinerIndividualEventForwarder forwarder =
68 new RegionCombinerIndividualEventForwarder(m_rootScene, virtualScene);
69 m_forwarders.Add(virtualScene.RegionInfo.originRegionID, forwarder);
70
71 virtualScene.EventManager.OnNewClient += forwarder.ClientConnect;
72 virtualScene.EventManager.OnClientClosed += forwarder.ClientClosed;
73 }
74 }
75
76 public void RemoveSceneFromEventForwarding (Scene virtualScene)
77 {
78 lock (m_forwarders)
79 {
80 RegionCombinerIndividualEventForwarder forwarder = m_forwarders[virtualScene.RegionInfo.originRegionID];
81 virtualScene.EventManager.OnNewClient -= forwarder.ClientConnect;
82 virtualScene.EventManager.OnClientClosed -= forwarder.ClientClosed;
83 m_forwarders.Remove(virtualScene.RegionInfo.originRegionID);
84 }
85 lock (m_virtScene)
86 {
87 if (m_virtScene.ContainsKey(virtualScene.RegionInfo.originRegionID))
88 {
89 m_virtScene.Remove(virtualScene.RegionInfo.originRegionID);
90 }
91 }
92 }
93 }
94} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
deleted file mode 100644
index 2cbaf96..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
+++ /dev/null
@@ -1,125 +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 OpenMetaverse;
30using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes;
32
33namespace OpenSim.Region.CoreModules.World.Land
34{
35 public class RegionCombinerIndividualEventForwarder
36 {
37 private Scene m_rootScene;
38 private Scene m_virtScene;
39
40 public RegionCombinerIndividualEventForwarder(Scene rootScene, Scene virtScene)
41 {
42 m_rootScene = rootScene;
43 m_virtScene = virtScene;
44 }
45
46 public void ClientConnect(IClientAPI client)
47 {
48 m_virtScene.UnSubscribeToClientPrimEvents(client);
49 m_virtScene.UnSubscribeToClientPrimRezEvents(client);
50 m_virtScene.UnSubscribeToClientInventoryEvents(client);
51 m_virtScene.UnSubscribeToClientAttachmentEvents(client);
52 //m_virtScene.UnSubscribeToClientTeleportEvents(client);
53 m_virtScene.UnSubscribeToClientScriptEvents(client);
54 m_virtScene.UnSubscribeToClientGodEvents(client);
55 m_virtScene.UnSubscribeToClientNetworkEvents(client);
56
57 m_rootScene.SubscribeToClientPrimEvents(client);
58 client.OnAddPrim += LocalAddNewPrim;
59 client.OnRezObject += LocalRezObject;
60 m_rootScene.SubscribeToClientInventoryEvents(client);
61 m_rootScene.SubscribeToClientAttachmentEvents(client);
62 //m_rootScene.SubscribeToClientTeleportEvents(client);
63 m_rootScene.SubscribeToClientScriptEvents(client);
64 m_rootScene.SubscribeToClientGodEvents(client);
65 m_rootScene.SubscribeToClientNetworkEvents(client);
66 }
67
68 public void ClientClosed(UUID clientid, Scene scene)
69 {
70 }
71
72 /// <summary>
73 /// Fixes position based on the region the Rez event came in on
74 /// </summary>
75 /// <param name="remoteclient"></param>
76 /// <param name="itemid"></param>
77 /// <param name="rayend"></param>
78 /// <param name="raystart"></param>
79 /// <param name="raytargetid"></param>
80 /// <param name="bypassraycast"></param>
81 /// <param name="rayendisintersection"></param>
82 /// <param name="rezselected"></param>
83 /// <param name="removeitem"></param>
84 /// <param name="fromtaskid"></param>
85 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart,
86 UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem,
87 UUID fromtaskid)
88 {
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;
91 rayend.X += differenceX * (int)Constants.RegionSize;
92 rayend.Y += differenceY * (int)Constants.RegionSize;
93 raystart.X += differenceX * (int)Constants.RegionSize;
94 raystart.Y += differenceY * (int)Constants.RegionSize;
95
96 m_rootScene.RezObject(remoteclient, itemid, rayend, raystart, raytargetid, bypassraycast,
97 rayendisintersection, rezselected, removeitem, fromtaskid);
98 }
99 /// <summary>
100 /// Fixes position based on the region the AddPrimShape event came in on
101 /// </summary>
102 /// <param name="ownerid"></param>
103 /// <param name="groupid"></param>
104 /// <param name="rayend"></param>
105 /// <param name="rot"></param>
106 /// <param name="shape"></param>
107 /// <param name="bypassraycast"></param>
108 /// <param name="raystart"></param>
109 /// <param name="raytargetid"></param>
110 /// <param name="rayendisintersection"></param>
111 private void LocalAddNewPrim(UUID ownerid, UUID groupid, Vector3 rayend, Quaternion rot,
112 PrimitiveBaseShape shape, byte bypassraycast, Vector3 raystart, UUID raytargetid,
113 byte rayendisintersection)
114 {
115 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
116 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
117 rayend.X += differenceX * (int)Constants.RegionSize;
118 rayend.Y += differenceY * (int)Constants.RegionSize;
119 raystart.X += differenceX * (int)Constants.RegionSize;
120 raystart.Y += differenceY * (int)Constants.RegionSize;
121 m_rootScene.AddNewPrim(ownerid, groupid, rayend, rot, shape, bypassraycast, raystart, raytargetid,
122 rayendisintersection);
123 }
124 }
125} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
deleted file mode 100644
index 7df836c..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
+++ /dev/null
@@ -1,163 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Interfaces;
33
34namespace OpenSim.Region.CoreModules.World.Land
35{
36public class RegionCombinerLargeLandChannel : ILandChannel
37 {
38 // private static readonly ILog m_log =
39 // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 private RegionData RegData;
41 private ILandChannel RootRegionLandChannel;
42 private readonly List<RegionData> RegionConnections;
43
44 #region ILandChannel Members
45
46 public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,
47 List<RegionData> regionConnections)
48 {
49 RegData = regData;
50 RootRegionLandChannel = rootRegionLandChannel;
51 RegionConnections = regionConnections;
52 }
53
54 public List<ILandObject> ParcelsNearPoint(Vector3 position)
55 {
56 //m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position);
57 return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset);
58 }
59
60 public List<ILandObject> AllParcels()
61 {
62 return RootRegionLandChannel.AllParcels();
63 }
64
65 public ILandObject GetLandObject(int x, int y)
66 {
67 //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
68
69 if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
70 {
71 return RootRegionLandChannel.GetLandObject(x, y);
72 }
73 else
74 {
75 int offsetX = (x / (int)Constants.RegionSize);
76 int offsetY = (y / (int)Constants.RegionSize);
77 offsetX *= (int)Constants.RegionSize;
78 offsetY *= (int)Constants.RegionSize;
79
80 foreach (RegionData regionData in RegionConnections)
81 {
82 if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
83 {
84 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
85 }
86 }
87 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
88 obj.LandData.Name = "NO LAND";
89 return obj;
90 }
91 }
92
93 public ILandObject GetLandObject(int localID)
94 {
95 return RootRegionLandChannel.GetLandObject(localID);
96 }
97
98 public ILandObject GetLandObject(float x, float y)
99 {
100 //m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y);
101
102 if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
103 {
104 return RootRegionLandChannel.GetLandObject(x, y);
105 }
106 else
107 {
108 int offsetX = (int)(x/(int) Constants.RegionSize);
109 int offsetY = (int)(y/(int) Constants.RegionSize);
110 offsetX *= (int) Constants.RegionSize;
111 offsetY *= (int) Constants.RegionSize;
112
113 foreach (RegionData regionData in RegionConnections)
114 {
115 if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
116 {
117 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
118 }
119 }
120 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
121 obj.LandData.Name = "NO LAND";
122 return obj;
123 }
124 }
125
126 public bool IsLandPrimCountTainted()
127 {
128 return RootRegionLandChannel.IsLandPrimCountTainted();
129 }
130
131 public bool IsForcefulBansAllowed()
132 {
133 return RootRegionLandChannel.IsForcefulBansAllowed();
134 }
135
136 public void UpdateLandObject(int localID, LandData data)
137 {
138 RootRegionLandChannel.UpdateLandObject(localID, data);
139 }
140
141 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
142 {
143 RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
144 }
145
146 public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
147 {
148 RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel);
149 }
150
151 public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
152 {
153 RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel);
154 }
155
156 public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
157 {
158 RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
159 }
160
161 #endregion
162 }
163} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
deleted file mode 100644
index d8c5ed9..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ /dev/null
@@ -1,939 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using Nini.Config;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Client;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Framework.Console;
39
40namespace OpenSim.Region.CoreModules.World.Land
41{
42 public class RegionCombinerModule : ISharedRegionModule
43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
46 public string Name
47 {
48 get { return "RegionCombinerModule"; }
49 }
50
51 public Type ReplaceableInterface
52 {
53 get { return null; }
54 }
55
56 private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
57 private bool enabledYN = false;
58 private Dictionary<UUID, Scene> m_startingScenes = new Dictionary<UUID, Scene>();
59
60 public void Initialise(IConfigSource source)
61 {
62 IConfig myConfig = source.Configs["Startup"];
63 enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false);
64 //enabledYN = true;
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 }
69
70 public void Close()
71 {
72 }
73
74 public void AddRegion(Scene scene)
75 {
76 }
77
78 public void RemoveRegion(Scene scene)
79 {
80 }
81
82 public void RegionLoaded(Scene scene)
83 {
84 if (enabledYN)
85 RegionLoadedDoWork(scene);
86 }
87
88 private void RegionLoadedDoWork(Scene scene)
89 {
90/*
91 // For testing on a single instance
92 if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
93 return;
94 //
95*/
96 lock (m_startingScenes)
97 m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
98
99 // Give each region a standard set of non-infinite borders
100 Border northBorder = new Border();
101 northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
102 northBorder.CrossDirection = Cardinals.N;
103 scene.NorthBorders[0] = northBorder;
104
105 Border southBorder = new Border();
106 southBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
107 southBorder.CrossDirection = Cardinals.S;
108 scene.SouthBorders[0] = southBorder;
109
110 Border eastBorder = new Border();
111 eastBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
112 eastBorder.CrossDirection = Cardinals.E;
113 scene.EastBorders[0] = eastBorder;
114
115 Border westBorder = new Border();
116 westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
117 westBorder.CrossDirection = Cardinals.W;
118 scene.WestBorders[0] = westBorder;
119
120
121
122 RegionConnections regionConnections = new RegionConnections();
123 regionConnections.ConnectedRegions = new List<RegionData>();
124 regionConnections.RegionScene = scene;
125 regionConnections.RegionLandChannel = scene.LandChannel;
126 regionConnections.RegionId = scene.RegionInfo.originRegionID;
127 regionConnections.X = scene.RegionInfo.RegionLocX;
128 regionConnections.Y = scene.RegionInfo.RegionLocY;
129 regionConnections.XEnd = (int)Constants.RegionSize;
130 regionConnections.YEnd = (int)Constants.RegionSize;
131
132
133 lock (m_regions)
134 {
135 bool connectedYN = false;
136
137 foreach (RegionConnections conn in m_regions.Values)
138 {
139 #region commented
140 /*
141 // If we're one region over +x +y
142 //xxy
143 //xxx
144 //xxx
145 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
146 == (regionConnections.X * (int)Constants.RegionSize))
147 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
148 == (regionConnections.Y * (int)Constants.RegionSize)))
149 {
150 Vector3 offset = Vector3.Zero;
151 offset.X = (((regionConnections.X * (int) Constants.RegionSize)) -
152 ((conn.X * (int) Constants.RegionSize)));
153 offset.Y = (((regionConnections.Y * (int) Constants.RegionSize)) -
154 ((conn.Y * (int) Constants.RegionSize)));
155
156 Vector3 extents = Vector3.Zero;
157 extents.Y = regionConnections.YEnd + conn.YEnd;
158 extents.X = conn.XEnd + conn.XEnd;
159
160 m_log.DebugFormat("Scene: {0} to the northwest of Scene{1}. Offset: {2}. Extents:{3}",
161 conn.RegionScene.RegionInfo.RegionName,
162 regionConnections.RegionScene.RegionInfo.RegionName,
163 offset, extents);
164
165 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
166
167 connectedYN = true;
168 break;
169 }
170 */
171
172 /*
173 //If we're one region over x +y
174 //xxx
175 //xxx
176 //xyx
177 if ((((int)conn.X * (int)Constants.RegionSize)
178 == (regionConnections.X * (int)Constants.RegionSize))
179 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
180 == (regionConnections.Y * (int)Constants.RegionSize)))
181 {
182 Vector3 offset = Vector3.Zero;
183 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
184 ((conn.X * (int)Constants.RegionSize)));
185 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
186 ((conn.Y * (int)Constants.RegionSize)));
187
188 Vector3 extents = Vector3.Zero;
189 extents.Y = regionConnections.YEnd + conn.YEnd;
190 extents.X = conn.XEnd;
191
192 m_log.DebugFormat("Scene: {0} to the north of Scene{1}. Offset: {2}. Extents:{3}",
193 conn.RegionScene.RegionInfo.RegionName,
194 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
195
196 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
197 connectedYN = true;
198 break;
199 }
200 */
201
202 /*
203 // If we're one region over -x +y
204 //xxx
205 //xxx
206 //yxx
207 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
208 == (regionConnections.X * (int)Constants.RegionSize))
209 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
210 == (regionConnections.Y * (int)Constants.RegionSize)))
211 {
212 Vector3 offset = Vector3.Zero;
213 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
214 ((conn.X * (int)Constants.RegionSize)));
215 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
216 ((conn.Y * (int)Constants.RegionSize)));
217
218 Vector3 extents = Vector3.Zero;
219 extents.Y = regionConnections.YEnd + conn.YEnd;
220 extents.X = conn.XEnd + conn.XEnd;
221
222 m_log.DebugFormat("Scene: {0} to the northeast of Scene. Offset: {2}. Extents:{3}",
223 conn.RegionScene.RegionInfo.RegionName,
224 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
225
226 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
227
228
229 connectedYN = true;
230 break;
231 }
232 */
233
234 /*
235 // If we're one region over -x y
236 //xxx
237 //yxx
238 //xxx
239 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
240 == (regionConnections.X * (int)Constants.RegionSize))
241 && (((int)conn.Y * (int)Constants.RegionSize)
242 == (regionConnections.Y * (int)Constants.RegionSize)))
243 {
244 Vector3 offset = Vector3.Zero;
245 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
246 ((conn.X * (int)Constants.RegionSize)));
247 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
248 ((conn.Y * (int)Constants.RegionSize)));
249
250 Vector3 extents = Vector3.Zero;
251 extents.Y = regionConnections.YEnd;
252 extents.X = conn.XEnd + conn.XEnd;
253
254 m_log.DebugFormat("Scene: {0} to the east of Scene{1} Offset: {2}. Extents:{3}",
255 conn.RegionScene.RegionInfo.RegionName,
256 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
257
258 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
259
260 connectedYN = true;
261 break;
262 }
263 */
264
265 /*
266 // If we're one region over -x -y
267 //yxx
268 //xxx
269 //xxx
270 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
271 == (regionConnections.X * (int)Constants.RegionSize))
272 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
273 == (regionConnections.Y * (int)Constants.RegionSize)))
274 {
275 Vector3 offset = Vector3.Zero;
276 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
277 ((conn.X * (int)Constants.RegionSize)));
278 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
279 ((conn.Y * (int)Constants.RegionSize)));
280
281 Vector3 extents = Vector3.Zero;
282 extents.Y = regionConnections.YEnd + conn.YEnd;
283 extents.X = conn.XEnd + conn.XEnd;
284
285 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
286 conn.RegionScene.RegionInfo.RegionName,
287 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
288
289 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
290
291 connectedYN = true;
292 break;
293 }
294 */
295 #endregion
296
297 // If we're one region over +x y
298 //xxx
299 //xxy
300 //xxx
301
302 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
303 >= (regionConnections.X * (int)Constants.RegionSize))
304 && (((int)conn.Y * (int)Constants.RegionSize)
305 >= (regionConnections.Y * (int)Constants.RegionSize)))
306 {
307 Vector3 offset = Vector3.Zero;
308 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
309 ((conn.X * (int)Constants.RegionSize)));
310 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
311 ((conn.Y * (int)Constants.RegionSize)));
312
313 Vector3 extents = Vector3.Zero;
314 extents.Y = conn.YEnd;
315 extents.X = conn.XEnd + regionConnections.XEnd;
316
317 conn.UpdateExtents(extents);
318
319 m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}",
320 conn.RegionScene.RegionInfo.RegionName,
321 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
322
323 scene.BordersLocked = true;
324 conn.RegionScene.BordersLocked = true;
325
326 RegionData ConnectedRegion = new RegionData();
327 ConnectedRegion.Offset = offset;
328 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
329 ConnectedRegion.RegionScene = scene;
330 conn.ConnectedRegions.Add(ConnectedRegion);
331
332 // Inform root region Physics about the extents of this region
333 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
334
335 // Inform Child region that it needs to forward it's terrain to the root region
336 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
337
338 // Extend the borders as appropriate
339 lock (conn.RegionScene.EastBorders)
340 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
341
342 lock (conn.RegionScene.NorthBorders)
343 conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
344
345 lock (conn.RegionScene.SouthBorders)
346 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
347
348 lock (scene.WestBorders)
349 {
350
351
352 scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
353
354 // Trigger auto teleport to root region
355 scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
356 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
357 }
358
359 // Reset Terrain.. since terrain loads before we get here, we need to load
360 // it again so it loads in the root region
361
362 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
363
364 // Unlock borders
365 conn.RegionScene.BordersLocked = false;
366 scene.BordersLocked = false;
367
368 // Create a client event forwarder and add this region's events to the root region.
369 if (conn.ClientEventForwarder != null)
370 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
371 connectedYN = true;
372 break;
373 }
374
375 // If we're one region over x +y
376 //xyx
377 //xxx
378 //xxx
379 if ((((int)conn.X * (int)Constants.RegionSize)
380 >= (regionConnections.X * (int)Constants.RegionSize))
381 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
382 >= (regionConnections.Y * (int)Constants.RegionSize)))
383 {
384 Vector3 offset = Vector3.Zero;
385 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
386 ((conn.X * (int)Constants.RegionSize)));
387 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
388 ((conn.Y * (int)Constants.RegionSize)));
389
390 Vector3 extents = Vector3.Zero;
391 extents.Y = regionConnections.YEnd + conn.YEnd;
392 extents.X = conn.XEnd;
393 conn.UpdateExtents(extents);
394
395 scene.BordersLocked = true;
396 conn.RegionScene.BordersLocked = true;
397
398 RegionData ConnectedRegion = new RegionData();
399 ConnectedRegion.Offset = offset;
400 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
401 ConnectedRegion.RegionScene = scene;
402 conn.ConnectedRegions.Add(ConnectedRegion);
403
404 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
405 conn.RegionScene.RegionInfo.RegionName,
406 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
407
408 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
409 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
410
411 lock (conn.RegionScene.NorthBorders)
412 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
413 lock (conn.RegionScene.EastBorders)
414 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
415 lock (conn.RegionScene.WestBorders)
416 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
417 lock (scene.SouthBorders)
418 {
419 scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
420 scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
421 scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
422 }
423
424 // Reset Terrain.. since terrain normally loads first.
425 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
426 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
427 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
428
429 scene.BordersLocked = false;
430 conn.RegionScene.BordersLocked = false;
431 if (conn.ClientEventForwarder != null)
432 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
433 connectedYN = true;
434 break;
435 }
436
437 // If we're one region over +x +y
438 //xxy
439 //xxx
440 //xxx
441 if ((((int)conn.X * (int)Constants.RegionSize) + conn.YEnd
442 >= (regionConnections.X * (int)Constants.RegionSize))
443 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
444 >= (regionConnections.Y * (int)Constants.RegionSize)))
445 {
446 Vector3 offset = Vector3.Zero;
447 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
448 ((conn.X * (int)Constants.RegionSize)));
449 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
450 ((conn.Y * (int)Constants.RegionSize)));
451
452 Vector3 extents = Vector3.Zero;
453 extents.Y = regionConnections.YEnd + conn.YEnd;
454 extents.X = regionConnections.XEnd + conn.XEnd;
455 conn.UpdateExtents(extents);
456
457 scene.BordersLocked = true;
458 conn.RegionScene.BordersLocked = true;
459
460 RegionData ConnectedRegion = new RegionData();
461 ConnectedRegion.Offset = offset;
462 ConnectedRegion.RegionId = scene.RegionInfo.originRegionID;
463 ConnectedRegion.RegionScene = scene;
464
465 conn.ConnectedRegions.Add(ConnectedRegion);
466
467 m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}",
468 conn.RegionScene.RegionInfo.RegionName,
469 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
470
471 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
472 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
473 lock (conn.RegionScene.NorthBorders)
474 {
475 if (conn.RegionScene.NorthBorders.Count == 1)// && 2)
476 {
477 //compound border
478 // already locked above
479 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
480
481 lock (conn.RegionScene.EastBorders)
482 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
483 lock (conn.RegionScene.WestBorders)
484 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
485 }
486 }
487
488 lock (scene.SouthBorders)
489 {
490 scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south
491 scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
492 scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
493 }
494
495 lock (conn.RegionScene.EastBorders)
496 {
497 if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
498 {
499
500 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
501 lock (conn.RegionScene.NorthBorders)
502 conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
503 lock (conn.RegionScene.SouthBorders)
504 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
505
506
507 }
508 }
509
510 lock (scene.WestBorders)
511 {
512 scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West
513 scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX;
514 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
515 }
516
517 /*
518 else
519 {
520 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
521 conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
522 conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
523 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
524 }
525 */
526
527
528 // Reset Terrain.. since terrain normally loads first.
529 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
530 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
531 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
532 scene.BordersLocked = false;
533 conn.RegionScene.BordersLocked = false;
534
535 if (conn.ClientEventForwarder != null)
536 conn.ClientEventForwarder.AddSceneToEventForwarding(scene);
537
538 connectedYN = true;
539
540 //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents);
541
542 break;
543 }
544 }
545
546 // If !connectYN means that this region is a root region
547 if (!connectedYN)
548 {
549 RegionData rdata = new RegionData();
550 rdata.Offset = Vector3.Zero;
551 rdata.RegionId = scene.RegionInfo.originRegionID;
552 rdata.RegionScene = scene;
553 // save it's land channel
554 regionConnections.RegionLandChannel = scene.LandChannel;
555
556 // Substitue our landchannel
557 RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel,
558 regionConnections.ConnectedRegions);
559 scene.LandChannel = lnd;
560 // Forward the permissions modules of each of the connected regions to the root region
561 lock (m_regions)
562 {
563 foreach (RegionData r in regionConnections.ConnectedRegions)
564 {
565 ForwardPermissionRequests(regionConnections, r.RegionScene);
566 }
567 }
568 // Create the root region's Client Event Forwarder
569 regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections);
570
571 // Sets up the CoarseLocationUpdate forwarder for this root region
572 scene.EventManager.OnNewPresence += SetCourseLocationDelegate;
573
574 // Adds this root region to a dictionary of regions that are connectable
575 m_regions.Add(scene.RegionInfo.originRegionID, regionConnections);
576 }
577 }
578 // Set up infinite borders around the entire AABB of the combined ConnectedRegions
579 AdjustLargeRegionBounds();
580 }
581
582 private void SetCourseLocationDelegate(ScenePresence presence)
583 {
584 presence.SetSendCourseLocationMethod(SendCourseLocationUpdates);
585 }
586
587 private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence)
588 {
589 RegionConnections connectiondata = null;
590 lock (m_regions)
591 {
592 if (m_regions.ContainsKey(sceneId))
593 connectiondata = m_regions[sceneId];
594 else
595 return;
596 }
597
598 List<ScenePresence> avatars = connectiondata.RegionScene.GetAvatars();
599 List<Vector3> CoarseLocations = new List<Vector3>();
600 List<UUID> AvatarUUIDs = new List<UUID>();
601 for (int i = 0; i < avatars.Count; i++)
602 {
603 if (avatars[i].UUID != presence.UUID)
604 {
605 if (avatars[i].ParentID != 0)
606 {
607 // sitting avatar
608 SceneObjectPart sop = connectiondata.RegionScene.GetSceneObjectPart(avatars[i].ParentID);
609 if (sop != null)
610 {
611 CoarseLocations.Add(sop.AbsolutePosition + avatars[i].AbsolutePosition);
612 AvatarUUIDs.Add(avatars[i].UUID);
613 }
614 else
615 {
616 // we can't find the parent.. ! arg!
617 CoarseLocations.Add(avatars[i].AbsolutePosition);
618 AvatarUUIDs.Add(avatars[i].UUID);
619 }
620 }
621 else
622 {
623 CoarseLocations.Add(avatars[i].AbsolutePosition);
624 AvatarUUIDs.Add(avatars[i].UUID);
625 }
626 }
627 }
628 DistributeCourseLocationUpdates(CoarseLocations, AvatarUUIDs, connectiondata, presence);
629 }
630
631 private void DistributeCourseLocationUpdates(List<Vector3> locations, List<UUID> uuids,
632 RegionConnections connectiondata, ScenePresence rootPresence)
633 {
634 RegionData[] rdata = connectiondata.ConnectedRegions.ToArray();
635 //List<IClientAPI> clients = new List<IClientAPI>();
636 Dictionary<Vector2, RegionCourseLocationStruct> updates = new Dictionary<Vector2, RegionCourseLocationStruct>();
637
638 // Root Region entry
639 RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct();
640 rootupdatedata.Locations = new List<Vector3>();
641 rootupdatedata.Uuids = new List<UUID>();
642 rootupdatedata.Offset = Vector2.Zero;
643
644 rootupdatedata.UserAPI = rootPresence.ControllingClient;
645
646 if (rootupdatedata.UserAPI != null)
647 updates.Add(Vector2.Zero, rootupdatedata);
648
649 //Each Region needs an entry or we will end up with dead minimap dots
650 foreach (RegionData regiondata in rdata)
651 {
652 Vector2 offset = new Vector2(regiondata.Offset.X, regiondata.Offset.Y);
653 RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct();
654 updatedata.Locations = new List<Vector3>();
655 updatedata.Uuids = new List<UUID>();
656 updatedata.Offset = offset;
657
658 if (offset == Vector2.Zero)
659 updatedata.UserAPI = rootPresence.ControllingClient;
660 else
661 updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
662
663 if (updatedata.UserAPI != null)
664 updates.Add(offset, updatedata);
665 }
666
667 // go over the locations and assign them to an IClientAPI
668 for (int i = 0; i < locations.Count; i++)
669 //{locations[i]/(int) Constants.RegionSize;
670 {
671 Vector3 pPosition = new Vector3((int)locations[i].X / (int)Constants.RegionSize,
672 (int)locations[i].Y / (int)Constants.RegionSize, locations[i].Z);
673 Vector2 offset = new Vector2(pPosition.X*(int) Constants.RegionSize,
674 pPosition.Y*(int) Constants.RegionSize);
675
676 if (!updates.ContainsKey(offset))
677 {
678 // This shouldn't happen
679 RegionCourseLocationStruct updatedata = new RegionCourseLocationStruct();
680 updatedata.Locations = new List<Vector3>();
681 updatedata.Uuids = new List<UUID>();
682 updatedata.Offset = offset;
683
684 if (offset == Vector2.Zero)
685 updatedata.UserAPI = rootPresence.ControllingClient;
686 else
687 updatedata.UserAPI = LocateUsersChildAgentIClientAPI(offset, rootPresence.UUID, rdata);
688
689 updates.Add(offset,updatedata);
690 }
691
692 updates[offset].Locations.Add(locations[i]);
693 updates[offset].Uuids.Add(uuids[i]);
694 }
695
696 // Send out the CoarseLocationupdates from their respective client connection based on where the avatar is
697 foreach (Vector2 offset in updates.Keys)
698 {
699 if (updates[offset].UserAPI != null)
700 {
701 updates[offset].UserAPI.SendCoarseLocationUpdate(updates[offset].Uuids,updates[offset].Locations);
702 }
703 }
704 }
705
706 /// <summary>
707 /// Locates a the Client of a particular region in an Array of RegionData based on offset
708 /// </summary>
709 /// <param name="offset"></param>
710 /// <param name="uUID"></param>
711 /// <param name="rdata"></param>
712 /// <returns>IClientAPI or null</returns>
713 private IClientAPI LocateUsersChildAgentIClientAPI(Vector2 offset, UUID uUID, RegionData[] rdata)
714 {
715 IClientAPI returnclient = null;
716 foreach (RegionData r in rdata)
717 {
718 if (r.Offset.X == offset.X && r.Offset.Y == offset.Y)
719 {
720 return r.RegionScene.SceneGraph.GetControllingClient(uUID);
721 }
722 }
723
724 return returnclient;
725 }
726
727 public void PostInitialise()
728 {
729 }
730
731 /// <summary>
732 /// TODO:
733 /// </summary>
734 /// <param name="rdata"></param>
735 public void UnCombineRegion(RegionData rdata)
736 {
737 lock (m_regions)
738 {
739 if (m_regions.ContainsKey(rdata.RegionId))
740 {
741 // uncombine root region and virtual regions
742 }
743 else
744 {
745 foreach (RegionConnections r in m_regions.Values)
746 {
747 foreach (RegionData rd in r.ConnectedRegions)
748 {
749 if (rd.RegionId == rdata.RegionId)
750 {
751 // uncombine virtual region
752 }
753 }
754 }
755 }
756 }
757 }
758
759 // Create a set of infinite borders around the whole aabb of the combined island.
760 private void AdjustLargeRegionBounds()
761 {
762 lock (m_regions)
763 {
764 foreach (RegionConnections rconn in m_regions.Values)
765 {
766 Vector3 offset = Vector3.Zero;
767 rconn.RegionScene.BordersLocked = true;
768 foreach (RegionData rdata in rconn.ConnectedRegions)
769 {
770 if (rdata.Offset.X > offset.X) offset.X = rdata.Offset.X;
771 if (rdata.Offset.Y > offset.Y) offset.Y = rdata.Offset.Y;
772 }
773
774 lock (rconn.RegionScene.NorthBorders)
775 {
776 Border northBorder = null;
777 // If we don't already have an infinite border, create one.
778 if (!TryGetInfiniteBorder(rconn.RegionScene.NorthBorders, out northBorder))
779 {
780 northBorder = new Border();
781 rconn.RegionScene.NorthBorders.Add(northBorder);
782 }
783
784 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue,
785 offset.Y + (int) Constants.RegionSize); //<---
786 northBorder.CrossDirection = Cardinals.N;
787 }
788
789 lock (rconn.RegionScene.SouthBorders)
790 {
791 Border southBorder = null;
792 // If we don't already have an infinite border, create one.
793 if (!TryGetInfiniteBorder(rconn.RegionScene.SouthBorders, out southBorder))
794 {
795 southBorder = new Border();
796 rconn.RegionScene.SouthBorders.Add(southBorder);
797 }
798 southBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
799 southBorder.CrossDirection = Cardinals.S;
800 }
801
802 lock (rconn.RegionScene.EastBorders)
803 {
804 Border eastBorder = null;
805 // If we don't already have an infinite border, create one.
806 if (!TryGetInfiniteBorder(rconn.RegionScene.EastBorders, out eastBorder))
807 {
808 eastBorder = new Border();
809 rconn.RegionScene.EastBorders.Add(eastBorder);
810 }
811 eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, offset.X + (int)Constants.RegionSize);
812 //<---
813 eastBorder.CrossDirection = Cardinals.E;
814 }
815
816 lock (rconn.RegionScene.WestBorders)
817 {
818 Border westBorder = null;
819 // If we don't already have an infinite border, create one.
820 if (!TryGetInfiniteBorder(rconn.RegionScene.WestBorders, out westBorder))
821 {
822 westBorder = new Border();
823 rconn.RegionScene.WestBorders.Add(westBorder);
824
825 }
826 westBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, 0); //--->
827 westBorder.CrossDirection = Cardinals.W;
828 }
829
830 rconn.RegionScene.BordersLocked = false;
831 }
832 }
833 }
834
835 /// <summary>
836 /// Try and get an Infinite border out of a listT of borders
837 /// </summary>
838 /// <param name="borders"></param>
839 /// <param name="oborder"></param>
840 /// <returns></returns>
841 public static bool TryGetInfiniteBorder(List<Border> borders, out Border oborder)
842 {
843 // Warning! Should be locked before getting here!
844 foreach (Border b in borders)
845 {
846 if (b.BorderLine.X == float.MinValue && b.BorderLine.Y == float.MaxValue)
847 {
848 oborder = b;
849 return true;
850 }
851 }
852 oborder = null;
853 return false;
854 }
855
856 public RegionData GetRegionFromPosition(Vector3 pPosition)
857 {
858 pPosition = pPosition/(int) Constants.RegionSize;
859 int OffsetX = (int) pPosition.X;
860 int OffsetY = (int) pPosition.Y;
861 foreach (RegionConnections regConn in m_regions.Values)
862 {
863 foreach (RegionData reg in regConn.ConnectedRegions)
864 {
865 if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY)
866 return reg;
867 }
868 }
869 return new RegionData();
870 }
871
872 public void ForwardPermissionRequests(RegionConnections BigRegion, Scene VirtualRegion)
873 {
874 if (BigRegion.PermissionModule == null)
875 BigRegion.PermissionModule = new RegionCombinerPermissionModule(BigRegion.RegionScene);
876
877 VirtualRegion.Permissions.OnBypassPermissions += BigRegion.PermissionModule.BypassPermissions;
878 VirtualRegion.Permissions.OnSetBypassPermissions += BigRegion.PermissionModule.SetBypassPermissions;
879 VirtualRegion.Permissions.OnPropagatePermissions += BigRegion.PermissionModule.PropagatePermissions;
880 VirtualRegion.Permissions.OnGenerateClientFlags += BigRegion.PermissionModule.GenerateClientFlags;
881 VirtualRegion.Permissions.OnAbandonParcel += BigRegion.PermissionModule.CanAbandonParcel;
882 VirtualRegion.Permissions.OnReclaimParcel += BigRegion.PermissionModule.CanReclaimParcel;
883 VirtualRegion.Permissions.OnDeedParcel += BigRegion.PermissionModule.CanDeedParcel;
884 VirtualRegion.Permissions.OnDeedObject += BigRegion.PermissionModule.CanDeedObject;
885 VirtualRegion.Permissions.OnIsGod += BigRegion.PermissionModule.IsGod;
886 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
887 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
888 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
889 VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED
890 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
891 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
892 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
893 VirtualRegion.Permissions.OnMoveObject += BigRegion.PermissionModule.CanMoveObject; //MAYBE FULLY IMPLEMENTED
894 VirtualRegion.Permissions.OnObjectEntry += BigRegion.PermissionModule.CanObjectEntry;
895 VirtualRegion.Permissions.OnReturnObject += BigRegion.PermissionModule.CanReturnObject; //NOT YET IMPLEMENTED
896 VirtualRegion.Permissions.OnRezObject += BigRegion.PermissionModule.CanRezObject; //MAYBE FULLY IMPLEMENTED
897 VirtualRegion.Permissions.OnRunConsoleCommand += BigRegion.PermissionModule.CanRunConsoleCommand;
898 VirtualRegion.Permissions.OnRunScript += BigRegion.PermissionModule.CanRunScript; //NOT YET IMPLEMENTED
899 VirtualRegion.Permissions.OnCompileScript += BigRegion.PermissionModule.CanCompileScript;
900 VirtualRegion.Permissions.OnSellParcel += BigRegion.PermissionModule.CanSellParcel;
901 VirtualRegion.Permissions.OnTakeObject += BigRegion.PermissionModule.CanTakeObject;
902 VirtualRegion.Permissions.OnTakeCopyObject += BigRegion.PermissionModule.CanTakeCopyObject;
903 VirtualRegion.Permissions.OnTerraformLand += BigRegion.PermissionModule.CanTerraformLand;
904 VirtualRegion.Permissions.OnLinkObject += BigRegion.PermissionModule.CanLinkObject; //NOT YET IMPLEMENTED
905 VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED
906 VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED
907 VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED
908 VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED
909 VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED
910 VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED
911 VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE
912 VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
913 VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED
914 VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED
915 VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript;
916 VirtualRegion.Permissions.OnCreateUserInventory += BigRegion.PermissionModule.CanCreateUserInventory; //NOT YET IMPLEMENTED
917 VirtualRegion.Permissions.OnCopyUserInventory += BigRegion.PermissionModule.CanCopyUserInventory; //NOT YET IMPLEMENTED
918 VirtualRegion.Permissions.OnEditUserInventory += BigRegion.PermissionModule.CanEditUserInventory; //NOT YET IMPLEMENTED
919 VirtualRegion.Permissions.OnDeleteUserInventory += BigRegion.PermissionModule.CanDeleteUserInventory; //NOT YET IMPLEMENTED
920 VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
921 VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED
922 }
923
924 #region console commands
925 public void FixPhantoms(string module, string[] cmdparams)
926 {
927 List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
928 foreach (Scene s in scenes)
929 {
930 s.ForEachSOG(delegate(SceneObjectGroup e)
931 {
932 e.AbsolutePosition = e.AbsolutePosition;
933 }
934 );
935 }
936 }
937 #endregion
938 }
939}
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
deleted file mode 100644
index 76ca5e3..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerPermissionModule.cs
+++ /dev/null
@@ -1,275 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes;
34
35namespace OpenSim.Region.CoreModules.World.Land
36{
37 public class RegionCombinerPermissionModule
38 {
39 private Scene m_rootScene;
40
41 public RegionCombinerPermissionModule(Scene RootScene)
42 {
43 m_rootScene = RootScene;
44 }
45
46 #region Permission Override
47
48 public bool BypassPermissions()
49 {
50 return m_rootScene.Permissions.BypassPermissions();
51 }
52
53 public void SetBypassPermissions(bool value)
54 {
55 m_rootScene.Permissions.SetBypassPermissions(value);
56 }
57
58 public bool PropagatePermissions()
59 {
60 return m_rootScene.Permissions.PropagatePermissions();
61 }
62
63 public uint GenerateClientFlags(UUID userid, UUID objectidid)
64 {
65 return m_rootScene.Permissions.GenerateClientFlags(userid,objectidid);
66 }
67
68 public bool CanAbandonParcel(UUID user, ILandObject parcel, Scene scene)
69 {
70 return m_rootScene.Permissions.CanAbandonParcel(user,parcel);
71 }
72
73 public bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene)
74 {
75 return m_rootScene.Permissions.CanReclaimParcel(user, parcel);
76 }
77
78 public bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene)
79 {
80 return m_rootScene.Permissions.CanDeedParcel(user, parcel);
81 }
82
83 public bool CanDeedObject(UUID user, UUID @group, Scene scene)
84 {
85 return m_rootScene.Permissions.CanDeedObject(user,@group);
86 }
87
88 public bool IsGod(UUID user, Scene requestfromscene)
89 {
90 return m_rootScene.Permissions.IsGod(user);
91 }
92
93 public bool CanDuplicateObject(int objectcount, UUID objectid, UUID owner, Scene scene, Vector3 objectposition)
94 {
95 return m_rootScene.Permissions.CanDuplicateObject(objectcount, objectid, owner, objectposition);
96 }
97
98 public bool CanDeleteObject(UUID objectid, UUID deleter, Scene scene)
99 {
100 return m_rootScene.Permissions.CanDeleteObject(objectid, deleter);
101 }
102
103 public bool CanEditObject(UUID objectid, UUID editorid, Scene scene)
104 {
105 return m_rootScene.Permissions.CanEditObject(objectid, editorid);
106 }
107
108 public bool CanEditParcel(UUID user, ILandObject parcel, Scene scene)
109 {
110 return m_rootScene.Permissions.CanEditParcel(user, parcel);
111 }
112
113 public bool CanInstantMessage(UUID user, UUID target, Scene startscene)
114 {
115 return m_rootScene.Permissions.CanInstantMessage(user, target);
116 }
117
118 public bool CanInventoryTransfer(UUID user, UUID target, Scene startscene)
119 {
120 return m_rootScene.Permissions.CanInventoryTransfer(user, target);
121 }
122
123 public bool CanIssueEstateCommand(UUID user, Scene requestfromscene, bool ownercommand)
124 {
125 return m_rootScene.Permissions.CanIssueEstateCommand(user, ownercommand);
126 }
127
128 public bool CanMoveObject(UUID objectid, UUID moverid, Scene scene)
129 {
130 return m_rootScene.Permissions.CanMoveObject(objectid, moverid);
131 }
132
133 public bool CanObjectEntry(UUID objectid, bool enteringregion, Vector3 newpoint, Scene scene)
134 {
135 return m_rootScene.Permissions.CanObjectEntry(objectid, enteringregion, newpoint);
136 }
137
138 public bool CanReturnObject(UUID objectid, UUID returnerid, Scene scene)
139 {
140 return m_rootScene.Permissions.CanReturnObject(objectid, returnerid);
141 }
142
143 public bool CanRezObject(int objectcount, UUID owner, Vector3 objectposition, Scene scene)
144 {
145 return m_rootScene.Permissions.CanRezObject(objectcount, owner, objectposition);
146 }
147
148 public bool CanRunConsoleCommand(UUID user, Scene requestfromscene)
149 {
150 return m_rootScene.Permissions.CanRunConsoleCommand(user);
151 }
152
153 public bool CanRunScript(UUID script, UUID objectid, UUID user, Scene scene)
154 {
155 return m_rootScene.Permissions.CanRunScript(script, objectid, user);
156 }
157
158 public bool CanCompileScript(UUID owneruuid, int scripttype, Scene scene)
159 {
160 return m_rootScene.Permissions.CanCompileScript(owneruuid, scripttype);
161 }
162
163 public bool CanSellParcel(UUID user, ILandObject parcel, Scene scene)
164 {
165 return m_rootScene.Permissions.CanSellParcel(user, parcel);
166 }
167
168 public bool CanTakeObject(UUID objectid, UUID stealer, Scene scene)
169 {
170 return m_rootScene.Permissions.CanTakeObject(objectid, stealer);
171 }
172
173 public bool CanTakeCopyObject(UUID objectid, UUID userid, Scene inscene)
174 {
175 return m_rootScene.Permissions.CanTakeObject(objectid, userid);
176 }
177
178 public bool CanTerraformLand(UUID user, Vector3 position, Scene requestfromscene)
179 {
180 return m_rootScene.Permissions.CanTerraformLand(user, position);
181 }
182
183 public bool CanLinkObject(UUID user, UUID objectid)
184 {
185 return m_rootScene.Permissions.CanLinkObject(user, objectid);
186 }
187
188 public bool CanDelinkObject(UUID user, UUID objectid)
189 {
190 return m_rootScene.Permissions.CanDelinkObject(user, objectid);
191 }
192
193 public bool CanBuyLand(UUID user, ILandObject parcel, Scene scene)
194 {
195 return m_rootScene.Permissions.CanBuyLand(user, parcel);
196 }
197
198 public bool CanViewNotecard(UUID script, UUID objectid, UUID user, Scene scene)
199 {
200 return m_rootScene.Permissions.CanViewNotecard(script, objectid, user);
201 }
202
203 public bool CanViewScript(UUID script, UUID objectid, UUID user, Scene scene)
204 {
205 return m_rootScene.Permissions.CanViewScript(script, objectid, user);
206 }
207
208 public bool CanEditNotecard(UUID notecard, UUID objectid, UUID user, Scene scene)
209 {
210 return m_rootScene.Permissions.CanEditNotecard(notecard, objectid, user);
211 }
212
213 public bool CanEditScript(UUID script, UUID objectid, UUID user, Scene scene)
214 {
215 return m_rootScene.Permissions.CanEditScript(script, objectid, user);
216 }
217
218 public bool CanCreateObjectInventory(int invtype, UUID objectid, UUID userid)
219 {
220 return m_rootScene.Permissions.CanCreateObjectInventory(invtype, objectid, userid);
221 }
222
223 public bool CanEditObjectInventory(UUID objectid, UUID editorid, Scene scene)
224 {
225 return m_rootScene.Permissions.CanEditObjectInventory(objectid, editorid);
226 }
227
228 public bool CanCopyObjectInventory(UUID itemid, UUID objectid, UUID userid)
229 {
230 return m_rootScene.Permissions.CanCopyObjectInventory(itemid, objectid, userid);
231 }
232
233 public bool CanDeleteObjectInventory(UUID itemid, UUID objectid, UUID userid)
234 {
235 return m_rootScene.Permissions.CanDeleteObjectInventory(itemid, objectid, userid);
236 }
237
238 public bool CanResetScript(UUID prim, UUID script, UUID user, Scene scene)
239 {
240 return m_rootScene.Permissions.CanResetScript(prim, script, user);
241 }
242
243 public bool CanCreateUserInventory(int invtype, UUID userid)
244 {
245 return m_rootScene.Permissions.CanCreateUserInventory(invtype, userid);
246 }
247
248 public bool CanCopyUserInventory(UUID itemid, UUID userid)
249 {
250 return m_rootScene.Permissions.CanCopyUserInventory(itemid, userid);
251 }
252
253 public bool CanEditUserInventory(UUID itemid, UUID userid)
254 {
255 return m_rootScene.Permissions.CanEditUserInventory(itemid, userid);
256 }
257
258 public bool CanDeleteUserInventory(UUID itemid, UUID userid)
259 {
260 return m_rootScene.Permissions.CanDeleteUserInventory(itemid, userid);
261 }
262
263 public bool CanTeleport(UUID userid, Scene scene)
264 {
265 return m_rootScene.Permissions.CanTeleport(userid);
266 }
267
268 public bool CanUseObjectReturn(ILandObject landdata, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene)
269 {
270 return m_rootScene.Permissions.CanUseObjectReturn(landdata, type, client, retlist);
271 }
272
273 #endregion
274 }
275} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs b/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
deleted file mode 100644
index 419ed74..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionConnections.cs
+++ /dev/null
@@ -1,65 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Region.Framework.Interfaces;
32using OpenSim.Region.Framework.Scenes;
33
34namespace OpenSim.Region.CoreModules.World.Land
35{
36 public class RegionConnections
37 {
38 /// <summary>
39 /// Root Region ID
40 /// </summary>
41 public UUID RegionId;
42
43 /// <summary>
44 /// Root Region Scene
45 /// </summary>
46 public Scene RegionScene;
47
48 /// <summary>
49 /// LargeLandChannel for combined region
50 /// </summary>
51 public ILandChannel RegionLandChannel;
52 public uint X;
53 public uint Y;
54 public int XEnd;
55 public int YEnd;
56 public List<RegionData> ConnectedRegions;
57 public RegionCombinerPermissionModule PermissionModule;
58 public RegionCombinerClientEventForwarder ClientEventForwarder;
59 public void UpdateExtents(Vector3 extents)
60 {
61 XEnd = (int)extents.X;
62 YEnd = (int)extents.Y;
63 }
64 }
65} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs b/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
deleted file mode 100644
index 175ca89..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionCourseLocation.cs
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32
33namespace OpenSim.Region.CoreModules.World.Land
34{
35
36 struct RegionCourseLocationStruct
37 {
38 public List<Vector3> Locations;
39 public List<UUID> Uuids;
40 public IClientAPI UserAPI;
41 public Vector2 Offset;
42 }
43} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionData.cs b/OpenSim/Region/CoreModules/World/Land/RegionData.cs
deleted file mode 100644
index 3383527..0000000
--- a/OpenSim/Region/CoreModules/World/Land/RegionData.cs
+++ /dev/null
@@ -1,39 +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 OpenMetaverse;
29using OpenSim.Region.Framework.Scenes;
30
31namespace OpenSim.Region.CoreModules.World.Land
32{
33 public class RegionData
34 {
35 public UUID RegionId;
36 public Scene RegionScene;
37 public Vector3 Offset;
38 }
39} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index fe9de1b..c790624 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -144,6 +144,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
144 private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); 144 private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>();
145 private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); 145 private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>();
146 private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); 146 private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>();
147 private IFriendsModule m_friendsModule = null;
148
147 #endregion 149 #endregion
148 150
149 #region IRegionModule Members 151 #region IRegionModule Members
@@ -363,6 +365,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
363 365
364 public void PostInitialise() 366 public void PostInitialise()
365 { 367 {
368 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
369
370 if (m_friendsModule == null)
371 m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work");
372 else
373 m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled");
366 } 374 }
367 375
368 public void Close() 376 public void Close()
@@ -476,6 +484,24 @@ namespace OpenSim.Region.CoreModules.World.Permissions
476 484
477 return false; 485 return false;
478 } 486 }
487 protected bool IsFriendWithPerms(UUID user,UUID objectOwner)
488 {
489
490 if (user == UUID.Zero)
491 return false;
492
493 if (m_friendsModule == null)
494 return false;
495
496 List<FriendListItem> profile = m_friendsModule.GetUserFriends(user);
497
498 foreach (FriendListItem item in profile)
499 {
500 if(item.Friend == objectOwner && (item.FriendPerms & (uint)FriendRights.CanModifyObjects) != 0)
501 return true;
502 }
503 return false;
504 }
479 505
480 protected bool IsEstateManager(UUID user) 506 protected bool IsEstateManager(UUID user)
481 { 507 {
@@ -565,6 +591,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
565 // Object owners should be able to edit their own content 591 // Object owners should be able to edit their own content
566 if (user == objectOwner) 592 if (user == objectOwner)
567 return objectOwnerMask; 593 return objectOwnerMask;
594
595 if (IsFriendWithPerms(user, objectOwner))
596 return objectOwnerMask;
568 597
569 // Estate users should be able to edit anything in the sim 598 // Estate users should be able to edit anything in the sim
570 if (IsEstateManager(user) && m_RegionOwnerIsGod && !IsAdministrator(objectOwner)) 599 if (IsEstateManager(user) && m_RegionOwnerIsGod && !IsAdministrator(objectOwner))
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index f4b54aa..44a651f 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -1077,14 +1077,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1077 1077
1078 m_scene.RegionInfo.RegionSettings.TerrainImageID = TerrainImageUUID; 1078 m_scene.RegionInfo.RegionSettings.TerrainImageID = TerrainImageUUID;
1079 1079
1080 AssetBase asset = new AssetBase(); 1080 AssetBase asset = new AssetBase(
1081 asset.FullID = m_scene.RegionInfo.RegionSettings.TerrainImageID; 1081 m_scene.RegionInfo.RegionSettings.TerrainImageID,
1082 "terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(),
1083 (sbyte)AssetType.Texture);
1082 asset.Data = data; 1084 asset.Data = data;
1083 asset.Name
1084 = "terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString();
1085 asset.Description = m_scene.RegionInfo.RegionName; 1085 asset.Description = m_scene.RegionInfo.RegionName;
1086
1087 asset.Type = 0;
1088 asset.Temporary = temporary; 1086 asset.Temporary = temporary;
1089 m_scene.AssetService.Store(asset); 1087 m_scene.AssetService.Store(asset);
1090 } 1088 }