diff options
30 files changed, 859 insertions, 315 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 287073b..1370449 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt | |||
@@ -144,6 +144,7 @@ what it is today. | |||
144 | * SignpostMarv | 144 | * SignpostMarv |
145 | * SpotOn3D | 145 | * SpotOn3D |
146 | * Strawberry Fride | 146 | * Strawberry Fride |
147 | * Talun | ||
147 | * tglion | 148 | * tglion |
148 | * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) | 149 | * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) |
149 | * tyre | 150 | * tyre |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index f64c161..fc6325d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -162,7 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | protected void InitModule(IConfigSource config) | 165 | protected virtual void InitModule(IConfigSource config) |
166 | { | 166 | { |
167 | IConfig friendsConfig = config.Configs["Friends"]; | 167 | IConfig friendsConfig = config.Configs["Friends"]; |
168 | if (friendsConfig != null) | 168 | if (friendsConfig != null) |
@@ -546,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
546 | } | 546 | } |
547 | } | 547 | } |
548 | 548 | ||
549 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) | 549 | protected virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im) |
550 | { | 550 | { |
551 | if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) | 551 | if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) |
552 | { | 552 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 9a6d277..3728b85 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
50 | { | 50 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | private int m_levelHGFriends = 0; | ||
54 | |||
53 | IUserManagement m_uMan; | 55 | IUserManagement m_uMan; |
54 | public IUserManagement UserManagementModule | 56 | public IUserManagement UserManagementModule |
55 | { | 57 | { |
@@ -87,6 +89,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
87 | m_StatusNotifier = new HGStatusNotifier(this); | 89 | m_StatusNotifier = new HGStatusNotifier(this); |
88 | } | 90 | } |
89 | 91 | ||
92 | protected override void InitModule(IConfigSource config) | ||
93 | { | ||
94 | base.InitModule(config); | ||
95 | |||
96 | // Additionally to the base method | ||
97 | IConfig friendsConfig = config.Configs["HGFriendsModule"]; | ||
98 | if (friendsConfig != null) | ||
99 | { | ||
100 | m_levelHGFriends = friendsConfig.GetInt("LevelHGFriends", 0); | ||
101 | |||
102 | // TODO: read in all config variables pertaining to | ||
103 | // HG friendship permissions | ||
104 | } | ||
105 | } | ||
106 | |||
90 | #endregion | 107 | #endregion |
91 | 108 | ||
92 | #region IFriendsSimConnector | 109 | #region IFriendsSimConnector |
@@ -105,6 +122,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
105 | 122 | ||
106 | #endregion | 123 | #endregion |
107 | 124 | ||
125 | protected override void OnInstantMessage(IClientAPI client, GridInstantMessage im) | ||
126 | { | ||
127 | if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) | ||
128 | { | ||
129 | // we got a friendship offer | ||
130 | UUID principalID = new UUID(im.fromAgentID); | ||
131 | UUID friendID = new UUID(im.toAgentID); | ||
132 | |||
133 | // Check if friendID is foreigner and if principalID has the permission | ||
134 | // to request friendships with foreigners. If not, return immediately. | ||
135 | if (!UserManagementModule.IsLocalGridUser(friendID)) | ||
136 | { | ||
137 | ScenePresence avatar = null; | ||
138 | ((Scene)client.Scene).TryGetScenePresence(principalID, out avatar); | ||
139 | |||
140 | if (avatar == null) | ||
141 | return; | ||
142 | |||
143 | if (avatar.UserLevel < m_levelHGFriends) | ||
144 | { | ||
145 | client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false); | ||
146 | return; | ||
147 | } | ||
148 | } | ||
149 | } | ||
150 | |||
151 | base.OnInstantMessage(client, im); | ||
152 | } | ||
153 | |||
108 | protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders) | 154 | protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders) |
109 | { | 155 | { |
110 | // Update the local cache. Yes, we need to do it right here | 156 | // Update the local cache. Yes, we need to do it right here |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 8560c73..0ee7606 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -91,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
91 | /// Constructor | 91 | /// Constructor |
92 | /// </summary> | 92 | /// </summary> |
93 | public InventoryArchiveWriteRequest( | 93 | public InventoryArchiveWriteRequest( |
94 | Guid id, InventoryArchiverModule module, Scene scene, | 94 | Guid id, InventoryArchiverModule module, Scene scene, |
95 | UserAccount userInfo, string invPath, string savePath) | 95 | UserAccount userInfo, string invPath, string savePath) |
96 | : this( | 96 | : this( |
97 | id, | 97 | id, |
@@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
107 | /// Constructor | 107 | /// Constructor |
108 | /// </summary> | 108 | /// </summary> |
109 | public InventoryArchiveWriteRequest( | 109 | public InventoryArchiveWriteRequest( |
110 | Guid id, InventoryArchiverModule module, Scene scene, | 110 | Guid id, InventoryArchiverModule module, Scene scene, |
111 | UserAccount userInfo, string invPath, Stream saveStream) | 111 | UserAccount userInfo, string invPath, Stream saveStream) |
112 | { | 112 | { |
113 | m_id = id; | 113 | m_id = id; |
@@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
125 | { | 125 | { |
126 | Exception reportedException = null; | 126 | Exception reportedException = null; |
127 | bool succeeded = true; | 127 | bool succeeded = true; |
128 | 128 | ||
129 | try | 129 | try |
130 | { | 130 | { |
131 | m_archiveWriter.Close(); | 131 | m_archiveWriter.Close(); |
@@ -146,6 +146,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
146 | 146 | ||
147 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) | 147 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) |
148 | { | 148 | { |
149 | if (options.ContainsKey("exclude")) | ||
150 | { | ||
151 | if (((List<String>)options["exclude"]).Contains(inventoryItem.Name) || | ||
152 | ((List<String>)options["exclude"]).Contains(inventoryItem.ID.ToString())) | ||
153 | { | ||
154 | if (options.ContainsKey("verbose")) | ||
155 | { | ||
156 | m_log.InfoFormat( | ||
157 | "[INVENTORY ARCHIVER]: Skipping inventory item {0} {1} at {2}", | ||
158 | inventoryItem.Name, inventoryItem.ID, path); | ||
159 | } | ||
160 | return; | ||
161 | } | ||
162 | } | ||
163 | |||
149 | if (options.ContainsKey("verbose")) | 164 | if (options.ContainsKey("verbose")) |
150 | m_log.InfoFormat( | 165 | m_log.InfoFormat( |
151 | "[INVENTORY ARCHIVER]: Saving item {0} {1} with asset {2}", | 166 | "[INVENTORY ARCHIVER]: Saving item {0} {1} with asset {2}", |
@@ -175,9 +190,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
175 | /// <param name="options"></param> | 190 | /// <param name="options"></param> |
176 | /// <param name="userAccountService"></param> | 191 | /// <param name="userAccountService"></param> |
177 | protected void SaveInvFolder( | 192 | protected void SaveInvFolder( |
178 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, | 193 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, |
179 | Dictionary<string, object> options, IUserAccountService userAccountService) | 194 | Dictionary<string, object> options, IUserAccountService userAccountService) |
180 | { | 195 | { |
196 | if (options.ContainsKey("excludefolders")) | ||
197 | { | ||
198 | if (((List<String>)options["excludefolders"]).Contains(inventoryFolder.Name) || | ||
199 | ((List<String>)options["excludefolders"]).Contains(inventoryFolder.ID.ToString())) | ||
200 | { | ||
201 | if (options.ContainsKey("verbose")) | ||
202 | { | ||
203 | m_log.InfoFormat( | ||
204 | "[INVENTORY ARCHIVER]: Skipping folder {0} at {1}", | ||
205 | inventoryFolder.Name, path); | ||
206 | } | ||
207 | return; | ||
208 | } | ||
209 | } | ||
210 | |||
211 | if (options.ContainsKey("verbose")) | ||
212 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving folder {0}", inventoryFolder.Name); | ||
213 | |||
181 | if (saveThisFolderItself) | 214 | if (saveThisFolderItself) |
182 | { | 215 | { |
183 | path += CreateArchiveFolderName(inventoryFolder); | 216 | path += CreateArchiveFolderName(inventoryFolder); |
@@ -186,7 +219,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
186 | m_archiveWriter.WriteDir(path); | 219 | m_archiveWriter.WriteDir(path); |
187 | } | 220 | } |
188 | 221 | ||
189 | InventoryCollection contents | 222 | InventoryCollection contents |
190 | = m_scene.InventoryService.GetFolderContent(inventoryFolder.Owner, inventoryFolder.ID); | 223 | = m_scene.InventoryService.GetFolderContent(inventoryFolder.Owner, inventoryFolder.ID); |
191 | 224 | ||
192 | foreach (InventoryFolderBase childFolder in contents.Folders) | 225 | foreach (InventoryFolderBase childFolder in contents.Folders) |
@@ -213,16 +246,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
213 | InventoryFolderBase inventoryFolder = null; | 246 | InventoryFolderBase inventoryFolder = null; |
214 | InventoryItemBase inventoryItem = null; | 247 | InventoryItemBase inventoryItem = null; |
215 | InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); | 248 | InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); |
216 | 249 | ||
217 | bool saveFolderContentsOnly = false; | 250 | bool saveFolderContentsOnly = false; |
218 | 251 | ||
219 | // Eliminate double slashes and any leading / on the path. | 252 | // Eliminate double slashes and any leading / on the path. |
220 | string[] components | 253 | string[] components |
221 | = m_invPath.Split( | 254 | = m_invPath.Split( |
222 | new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries); | 255 | new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries); |
223 | 256 | ||
224 | int maxComponentIndex = components.Length - 1; | 257 | int maxComponentIndex = components.Length - 1; |
225 | 258 | ||
226 | // If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the | 259 | // If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the |
227 | // folder itself. This may get more sophisicated later on | 260 | // folder itself. This may get more sophisicated later on |
228 | if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) | 261 | if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) |
@@ -230,13 +263,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
230 | saveFolderContentsOnly = true; | 263 | saveFolderContentsOnly = true; |
231 | maxComponentIndex--; | 264 | maxComponentIndex--; |
232 | } | 265 | } |
233 | 266 | ||
234 | m_invPath = String.Empty; | 267 | m_invPath = String.Empty; |
235 | for (int i = 0; i <= maxComponentIndex; i++) | 268 | for (int i = 0; i <= maxComponentIndex; i++) |
236 | { | 269 | { |
237 | m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER; | 270 | m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER; |
238 | } | 271 | } |
239 | 272 | ||
240 | // Annoyingly Split actually returns the original string if the input string consists only of delimiters | 273 | // Annoyingly Split actually returns the original string if the input string consists only of delimiters |
241 | // Therefore if we still start with a / after the split, then we need the root folder | 274 | // Therefore if we still start with a / after the split, then we need the root folder |
242 | if (m_invPath.Length == 0) | 275 | if (m_invPath.Length == 0) |
@@ -246,25 +279,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
246 | else | 279 | else |
247 | { | 280 | { |
248 | m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER)); | 281 | m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER)); |
249 | List<InventoryFolderBase> candidateFolders | 282 | List<InventoryFolderBase> candidateFolders |
250 | = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath); | 283 | = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath); |
251 | if (candidateFolders.Count > 0) | 284 | if (candidateFolders.Count > 0) |
252 | inventoryFolder = candidateFolders[0]; | 285 | inventoryFolder = candidateFolders[0]; |
253 | } | 286 | } |
254 | 287 | ||
255 | // The path may point to an item instead | 288 | // The path may point to an item instead |
256 | if (inventoryFolder == null) | 289 | if (inventoryFolder == null) |
257 | inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath); | 290 | inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath); |
258 | 291 | ||
259 | if (null == inventoryFolder && null == inventoryItem) | 292 | if (null == inventoryFolder && null == inventoryItem) |
260 | { | 293 | { |
261 | // We couldn't find the path indicated | 294 | // We couldn't find the path indicated |
262 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); | 295 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); |
263 | Exception e = new InventoryArchiverException(errorMessage); | 296 | Exception e = new InventoryArchiverException(errorMessage); |
264 | m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); | 297 | m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); |
265 | throw e; | 298 | throw e; |
266 | } | 299 | } |
267 | 300 | ||
268 | m_archiveWriter = new TarArchiveWriter(m_saveStream); | 301 | m_archiveWriter = new TarArchiveWriter(m_saveStream); |
269 | 302 | ||
270 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Adding control file to archive."); | 303 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Adding control file to archive."); |
@@ -278,10 +311,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
278 | { | 311 | { |
279 | m_log.DebugFormat( | 312 | m_log.DebugFormat( |
280 | "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", | 313 | "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", |
281 | inventoryFolder.Name, | 314 | inventoryFolder.Name, |
282 | inventoryFolder.ID, | 315 | inventoryFolder.ID, |
283 | m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath); | 316 | m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath); |
284 | 317 | ||
285 | //recurse through all dirs getting dirs and files | 318 | //recurse through all dirs getting dirs and files |
286 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly, options, userAccountService); | 319 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly, options, userAccountService); |
287 | } | 320 | } |
@@ -290,10 +323,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
290 | m_log.DebugFormat( | 323 | m_log.DebugFormat( |
291 | "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", | 324 | "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", |
292 | inventoryItem.Name, inventoryItem.ID, m_invPath); | 325 | inventoryItem.Name, inventoryItem.ID, m_invPath); |
293 | 326 | ||
294 | SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH, options, userAccountService); | 327 | SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH, options, userAccountService); |
295 | } | 328 | } |
296 | 329 | ||
297 | // Don't put all this profile information into the archive right now. | 330 | // Don't put all this profile information into the archive right now. |
298 | //SaveUsers(); | 331 | //SaveUsers(); |
299 | 332 | ||
@@ -352,7 +385,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
352 | /// | 385 | /// |
353 | /// These names are prepended with an inventory folder's UUID so that more than one folder can have the | 386 | /// These names are prepended with an inventory folder's UUID so that more than one folder can have the |
354 | /// same name | 387 | /// same name |
355 | /// | 388 | /// |
356 | /// <param name="folder"></param> | 389 | /// <param name="folder"></param> |
357 | /// <returns></returns> | 390 | /// <returns></returns> |
358 | public static string CreateArchiveFolderName(InventoryFolderBase folder) | 391 | public static string CreateArchiveFolderName(InventoryFolderBase folder) |
@@ -366,7 +399,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
366 | /// | 399 | /// |
367 | /// These names are prepended with an inventory item's UUID so that more than one item can have the | 400 | /// These names are prepended with an inventory item's UUID so that more than one item can have the |
368 | /// same name | 401 | /// same name |
369 | /// | 402 | /// |
370 | /// <param name="item"></param> | 403 | /// <param name="item"></param> |
371 | /// <returns></returns> | 404 | /// <returns></returns> |
372 | public static string CreateArchiveItemName(InventoryItemBase item) | 405 | public static string CreateArchiveItemName(InventoryItemBase item) |
@@ -412,7 +445,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
412 | public string CreateControlFile(Dictionary<string, object> options) | 445 | public string CreateControlFile(Dictionary<string, object> options) |
413 | { | 446 | { |
414 | int majorVersion, minorVersion; | 447 | int majorVersion, minorVersion; |
415 | 448 | ||
416 | if (options.ContainsKey("home")) | 449 | if (options.ContainsKey("home")) |
417 | { | 450 | { |
418 | majorVersion = 1; | 451 | majorVersion = 1; |
@@ -422,10 +455,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
422 | { | 455 | { |
423 | majorVersion = 0; | 456 | majorVersion = 0; |
424 | minorVersion = 3; | 457 | minorVersion = 3; |
425 | } | 458 | } |
426 | 459 | ||
427 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); | 460 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); |
428 | 461 | ||
429 | StringWriter sw = new StringWriter(); | 462 | StringWriter sw = new StringWriter(); |
430 | XmlTextWriter xtw = new XmlTextWriter(sw); | 463 | XmlTextWriter xtw = new XmlTextWriter(sw); |
431 | xtw.Formatting = Formatting.Indented; | 464 | xtw.Formatting = Formatting.Indented; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index ac22c3f..cf87010 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -47,18 +47,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
47 | public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule | 47 | public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | public string Name { get { return "Inventory Archiver Module"; } } | 51 | public string Name { get { return "Inventory Archiver Module"; } } |
52 | 52 | ||
53 | public bool IsSharedModule { get { return true; } } | 53 | public bool IsSharedModule { get { return true; } } |
54 | 54 | ||
55 | /// <value> | 55 | /// <value> |
56 | /// Enable or disable checking whether the iar user is actually logged in | 56 | /// Enable or disable checking whether the iar user is actually logged in |
57 | /// </value> | 57 | /// </value> |
58 | // public bool DisablePresenceChecks { get; set; } | 58 | // public bool DisablePresenceChecks { get; set; } |
59 | 59 | ||
60 | public event InventoryArchiveSaved OnInventoryArchiveSaved; | 60 | public event InventoryArchiveSaved OnInventoryArchiveSaved; |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// The file to load and save inventory if no filename has been specified | 63 | /// The file to load and save inventory if no filename has been specified |
64 | /// </summary> | 64 | /// </summary> |
@@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
68 | /// Pending save completions initiated from the console | 68 | /// Pending save completions initiated from the console |
69 | /// </value> | 69 | /// </value> |
70 | protected List<Guid> m_pendingConsoleSaves = new List<Guid>(); | 70 | protected List<Guid> m_pendingConsoleSaves = new List<Guid>(); |
71 | 71 | ||
72 | /// <value> | 72 | /// <value> |
73 | /// All scenes that this module knows about | 73 | /// All scenes that this module knows about |
74 | /// </value> | 74 | /// </value> |
@@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
106 | { | 106 | { |
107 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); | 107 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); |
108 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; | 108 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; |
109 | 109 | ||
110 | scene.AddCommand( | 110 | scene.AddCommand( |
111 | "Archiving", this, "load iar", | 111 | "Archiving", this, "load iar", |
112 | "load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]", | 112 | "load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]", |
@@ -119,11 +119,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
119 | + "<IAR path> is the filesystem path or URI from which to load the IAR." | 119 | + "<IAR path> is the filesystem path or URI from which to load the IAR." |
120 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), | 120 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), |
121 | HandleLoadInvConsoleCommand); | 121 | HandleLoadInvConsoleCommand); |
122 | 122 | ||
123 | scene.AddCommand( | 123 | scene.AddCommand( |
124 | "Archiving", this, "save iar", | 124 | "Archiving", this, "save iar", |
125 | "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]", | 125 | "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]", |
126 | "Save user inventory archive (IAR).", | 126 | "Save user inventory archive (IAR).", |
127 | "<first> is the user's first name.\n" | 127 | "<first> is the user's first name.\n" |
128 | + "<last> is the user's last name.\n" | 128 | + "<last> is the user's last name.\n" |
129 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved.\n" | 129 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved.\n" |
@@ -131,32 +131,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
131 | + string.Format(" If this is not given then the filename {0} in the current directory is used.\n", DEFAULT_INV_BACKUP_FILENAME) | 131 | + string.Format(" If this is not given then the filename {0} in the current directory is used.\n", DEFAULT_INV_BACKUP_FILENAME) |
132 | + "-h|--home=<url> adds the url of the profile service to the saved user information.\n" | 132 | + "-h|--home=<url> adds the url of the profile service to the saved user information.\n" |
133 | + "-c|--creators preserves information about foreign creators.\n" | 133 | + "-c|--creators preserves information about foreign creators.\n" |
134 | + "-e|--exclude=<name/uuid> don't save the inventory item in archive" + Environment.NewLine | ||
135 | + "-f|--excludefolder=<folder/uuid> don't save contents of the folder in archive" + Environment.NewLine | ||
134 | + "-v|--verbose extra debug messages.\n" | 136 | + "-v|--verbose extra debug messages.\n" |
135 | + "--noassets stops assets being saved to the IAR.", | 137 | + "--noassets stops assets being saved to the IAR.", |
136 | HandleSaveInvConsoleCommand); | 138 | HandleSaveInvConsoleCommand); |
137 | 139 | ||
138 | m_aScene = scene; | 140 | m_aScene = scene; |
139 | } | 141 | } |
140 | 142 | ||
141 | m_scenes[scene.RegionInfo.RegionID] = scene; | 143 | m_scenes[scene.RegionInfo.RegionID] = scene; |
142 | } | 144 | } |
143 | 145 | ||
144 | public void PostInitialise() {} | 146 | public void PostInitialise() {} |
145 | 147 | ||
146 | public void Close() {} | 148 | public void Close() {} |
147 | 149 | ||
148 | /// <summary> | 150 | /// <summary> |
149 | /// Trigger the inventory archive saved event. | 151 | /// Trigger the inventory archive saved event. |
150 | /// </summary> | 152 | /// </summary> |
151 | protected internal void TriggerInventoryArchiveSaved( | 153 | protected internal void TriggerInventoryArchiveSaved( |
152 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 154 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
153 | Exception reportedException) | 155 | Exception reportedException) |
154 | { | 156 | { |
155 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; | 157 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; |
156 | if (handlerInventoryArchiveSaved != null) | 158 | if (handlerInventoryArchiveSaved != null) |
157 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); | 159 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); |
158 | } | 160 | } |
159 | 161 | ||
160 | public bool ArchiveInventory( | 162 | public bool ArchiveInventory( |
161 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) | 163 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) |
162 | { | 164 | { |
@@ -164,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
164 | } | 166 | } |
165 | 167 | ||
166 | public bool ArchiveInventory( | 168 | public bool ArchiveInventory( |
167 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, | 169 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, |
168 | Dictionary<string, object> options) | 170 | Dictionary<string, object> options) |
169 | { | 171 | { |
170 | if (m_scenes.Count > 0) | 172 | if (m_scenes.Count > 0) |
@@ -188,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
188 | 190 | ||
189 | return false; | 191 | return false; |
190 | } | 192 | } |
191 | 193 | ||
192 | return true; | 194 | return true; |
193 | // } | 195 | // } |
194 | // else | 196 | // else |
@@ -202,15 +204,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
202 | 204 | ||
203 | return false; | 205 | return false; |
204 | } | 206 | } |
205 | 207 | ||
206 | public bool ArchiveInventory( | 208 | public bool ArchiveInventory( |
207 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, | 209 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, |
208 | Dictionary<string, object> options) | 210 | Dictionary<string, object> options) |
209 | { | 211 | { |
210 | if (m_scenes.Count > 0) | 212 | if (m_scenes.Count > 0) |
211 | { | 213 | { |
212 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); | 214 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
213 | 215 | ||
214 | if (userInfo != null) | 216 | if (userInfo != null) |
215 | { | 217 | { |
216 | // if (CheckPresence(userInfo.PrincipalID)) | 218 | // if (CheckPresence(userInfo.PrincipalID)) |
@@ -228,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
228 | 230 | ||
229 | return false; | 231 | return false; |
230 | } | 232 | } |
231 | 233 | ||
232 | return true; | 234 | return true; |
233 | // } | 235 | // } |
234 | // else | 236 | // else |
@@ -239,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
239 | // } | 241 | // } |
240 | } | 242 | } |
241 | } | 243 | } |
242 | 244 | ||
243 | return false; | 245 | return false; |
244 | } | 246 | } |
245 | 247 | ||
@@ -247,9 +249,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
247 | { | 249 | { |
248 | return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); | 250 | return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); |
249 | } | 251 | } |
250 | 252 | ||
251 | public bool DearchiveInventory( | 253 | public bool DearchiveInventory( |
252 | string firstName, string lastName, string invPath, string pass, Stream loadStream, | 254 | string firstName, string lastName, string invPath, string pass, Stream loadStream, |
253 | Dictionary<string, object> options) | 255 | Dictionary<string, object> options) |
254 | { | 256 | { |
255 | if (m_scenes.Count > 0) | 257 | if (m_scenes.Count > 0) |
@@ -295,22 +297,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
295 | 297 | ||
296 | return false; | 298 | return false; |
297 | } | 299 | } |
298 | 300 | ||
299 | public bool DearchiveInventory( | 301 | public bool DearchiveInventory( |
300 | string firstName, string lastName, string invPath, string pass, string loadPath, | 302 | string firstName, string lastName, string invPath, string pass, string loadPath, |
301 | Dictionary<string, object> options) | 303 | Dictionary<string, object> options) |
302 | { | 304 | { |
303 | if (m_scenes.Count > 0) | 305 | if (m_scenes.Count > 0) |
304 | { | 306 | { |
305 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); | 307 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
306 | 308 | ||
307 | if (userInfo != null) | 309 | if (userInfo != null) |
308 | { | 310 | { |
309 | // if (CheckPresence(userInfo.PrincipalID)) | 311 | // if (CheckPresence(userInfo.PrincipalID)) |
310 | // { | 312 | // { |
311 | InventoryArchiveReadRequest request; | 313 | InventoryArchiveReadRequest request; |
312 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); | 314 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); |
313 | 315 | ||
314 | try | 316 | try |
315 | { | 317 | { |
316 | request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); | 318 | request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); |
@@ -324,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
324 | 326 | ||
325 | return false; | 327 | return false; |
326 | } | 328 | } |
327 | 329 | ||
328 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); | 330 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); |
329 | 331 | ||
330 | return true; | 332 | return true; |
@@ -340,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
340 | 342 | ||
341 | return false; | 343 | return false; |
342 | } | 344 | } |
343 | 345 | ||
344 | /// <summary> | 346 | /// <summary> |
345 | /// Load inventory from an inventory file archive | 347 | /// Load inventory from an inventory file archive |
346 | /// </summary> | 348 | /// </summary> |
@@ -351,26 +353,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
351 | { | 353 | { |
352 | Dictionary<string, object> options = new Dictionary<string, object>(); | 354 | Dictionary<string, object> options = new Dictionary<string, object>(); |
353 | OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); | 355 | OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); |
354 | 356 | ||
355 | List<string> mainParams = optionSet.Parse(cmdparams); | 357 | List<string> mainParams = optionSet.Parse(cmdparams); |
356 | 358 | ||
357 | if (mainParams.Count < 6) | 359 | if (mainParams.Count < 6) |
358 | { | 360 | { |
359 | m_log.Error( | 361 | m_log.Error( |
360 | "[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> <user password> [<load file path>]"); | 362 | "[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> <user password> [<load file path>]"); |
361 | return; | 363 | return; |
362 | } | 364 | } |
363 | 365 | ||
364 | string firstName = mainParams[2]; | 366 | string firstName = mainParams[2]; |
365 | string lastName = mainParams[3]; | 367 | string lastName = mainParams[3]; |
366 | string invPath = mainParams[4]; | 368 | string invPath = mainParams[4]; |
367 | string pass = mainParams[5]; | 369 | string pass = mainParams[5]; |
368 | string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); | 370 | string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); |
369 | 371 | ||
370 | m_log.InfoFormat( | 372 | m_log.InfoFormat( |
371 | "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", | 373 | "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", |
372 | loadPath, invPath, firstName, lastName); | 374 | loadPath, invPath, firstName, lastName); |
373 | 375 | ||
374 | if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) | 376 | if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) |
375 | m_log.InfoFormat( | 377 | m_log.InfoFormat( |
376 | "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", | 378 | "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", |
@@ -381,7 +383,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
381 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message); | 383 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message); |
382 | } | 384 | } |
383 | } | 385 | } |
384 | 386 | ||
385 | /// <summary> | 387 | /// <summary> |
386 | /// Save inventory to a file archive | 388 | /// Save inventory to a file archive |
387 | /// </summary> | 389 | /// </summary> |
@@ -398,6 +400,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
398 | ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; }); | 400 | ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; }); |
399 | ops.Add("c|creators", delegate(string v) { options["creators"] = v; }); | 401 | ops.Add("c|creators", delegate(string v) { options["creators"] = v; }); |
400 | ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; }); | 402 | ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; }); |
403 | ops.Add("e|exclude=", delegate(string v) | ||
404 | { | ||
405 | if (!options.ContainsKey("exclude")) | ||
406 | options["exclude"] = new List<String>(); | ||
407 | ((List<String>)options["exclude"]).Add(v); | ||
408 | }); | ||
409 | ops.Add("f|excludefolder=", delegate(string v) | ||
410 | { | ||
411 | if (!options.ContainsKey("excludefolders")) | ||
412 | options["excludefolders"] = new List<String>(); | ||
413 | ((List<String>)options["excludefolders"]).Add(v); | ||
414 | }); | ||
401 | 415 | ||
402 | List<string> mainParams = ops.Parse(cmdparams); | 416 | List<string> mainParams = ops.Parse(cmdparams); |
403 | 417 | ||
@@ -406,10 +420,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
406 | if (mainParams.Count < 6) | 420 | if (mainParams.Count < 6) |
407 | { | 421 | { |
408 | m_log.Error( | 422 | m_log.Error( |
409 | "[INVENTORY ARCHIVER]: usage is save iar [-h|--home=<url>] [--noassets] <first name> <last name> <inventory path> <user password> [<save file path>] [-c|--creators] [-v|--verbose]"); | 423 | "[INVENTORY ARCHIVER]: save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]"); |
410 | return; | 424 | return; |
411 | } | 425 | } |
412 | 426 | ||
413 | if (options.ContainsKey("home")) | 427 | if (options.ContainsKey("home")) |
414 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR"); | 428 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR"); |
415 | 429 | ||
@@ -418,7 +432,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
418 | string invPath = mainParams[4]; | 432 | string invPath = mainParams[4]; |
419 | string pass = mainParams[5]; | 433 | string pass = mainParams[5]; |
420 | string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); | 434 | string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); |
421 | 435 | ||
422 | m_log.InfoFormat( | 436 | m_log.InfoFormat( |
423 | "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", | 437 | "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", |
424 | savePath, invPath, firstName, lastName); | 438 | savePath, invPath, firstName, lastName); |
@@ -433,9 +447,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
433 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message); | 447 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message); |
434 | } | 448 | } |
435 | } | 449 | } |
436 | 450 | ||
437 | private void SaveInvConsoleCommandCompleted( | 451 | private void SaveInvConsoleCommandCompleted( |
438 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 452 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
439 | Exception reportedException) | 453 | Exception reportedException) |
440 | { | 454 | { |
441 | lock (m_pendingConsoleSaves) | 455 | lock (m_pendingConsoleSaves) |
@@ -445,7 +459,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
445 | else | 459 | else |
446 | return; | 460 | return; |
447 | } | 461 | } |
448 | 462 | ||
449 | if (succeeded) | 463 | if (succeeded) |
450 | { | 464 | { |
451 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0} {1}", userInfo.FirstName, userInfo.LastName); | 465 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0} {1}", userInfo.FirstName, userInfo.LastName); |
@@ -453,11 +467,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
453 | else | 467 | else |
454 | { | 468 | { |
455 | m_log.ErrorFormat( | 469 | m_log.ErrorFormat( |
456 | "[INVENTORY ARCHIVER]: Archive save for {0} {1} failed - {2}", | 470 | "[INVENTORY ARCHIVER]: Archive save for {0} {1} failed - {2}", |
457 | userInfo.FirstName, userInfo.LastName, reportedException.Message); | 471 | userInfo.FirstName, userInfo.LastName, reportedException.Message); |
458 | } | 472 | } |
459 | } | 473 | } |
460 | 474 | ||
461 | /// <summary> | 475 | /// <summary> |
462 | /// Get user information for the given name. | 476 | /// Get user information for the given name. |
463 | /// </summary> | 477 | /// </summary> |
@@ -467,13 +481,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
467 | /// <returns></returns> | 481 | /// <returns></returns> |
468 | protected UserAccount GetUserInfo(string firstName, string lastName, string pass) | 482 | protected UserAccount GetUserInfo(string firstName, string lastName, string pass) |
469 | { | 483 | { |
470 | UserAccount account | 484 | UserAccount account |
471 | = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName); | 485 | = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName); |
472 | 486 | ||
473 | if (null == account) | 487 | if (null == account) |
474 | { | 488 | { |
475 | m_log.ErrorFormat( | 489 | m_log.ErrorFormat( |
476 | "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1}", | 490 | "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1}", |
477 | firstName, lastName); | 491 | firstName, lastName); |
478 | return null; | 492 | return null; |
479 | } | 493 | } |
@@ -488,7 +502,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
488 | else | 502 | else |
489 | { | 503 | { |
490 | m_log.ErrorFormat( | 504 | m_log.ErrorFormat( |
491 | "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", | 505 | "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", |
492 | firstName, lastName); | 506 | firstName, lastName); |
493 | return null; | 507 | return null; |
494 | } | 508 | } |
@@ -499,7 +513,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
499 | return null; | 513 | return null; |
500 | } | 514 | } |
501 | } | 515 | } |
502 | 516 | ||
503 | /// <summary> | 517 | /// <summary> |
504 | /// Notify the client of loaded nodes if they are logged in | 518 | /// Notify the client of loaded nodes if they are logged in |
505 | /// </summary> | 519 | /// </summary> |
@@ -508,22 +522,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
508 | { | 522 | { |
509 | if (loadedNodes.Count == 0) | 523 | if (loadedNodes.Count == 0) |
510 | return; | 524 | return; |
511 | 525 | ||
512 | foreach (Scene scene in m_scenes.Values) | 526 | foreach (Scene scene in m_scenes.Values) |
513 | { | 527 | { |
514 | ScenePresence user = scene.GetScenePresence(userInfo.PrincipalID); | 528 | ScenePresence user = scene.GetScenePresence(userInfo.PrincipalID); |
515 | 529 | ||
516 | if (user != null && !user.IsChildAgent) | 530 | if (user != null && !user.IsChildAgent) |
517 | { | 531 | { |
518 | foreach (InventoryNodeBase node in loadedNodes) | 532 | foreach (InventoryNodeBase node in loadedNodes) |
519 | { | 533 | { |
520 | // m_log.DebugFormat( | 534 | // m_log.DebugFormat( |
521 | // "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}", | 535 | // "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}", |
522 | // user.Name, node.Name); | 536 | // user.Name, node.Name); |
523 | 537 | ||
524 | user.ControllingClient.SendBulkUpdateInventory(node); | 538 | user.ControllingClient.SendBulkUpdateInventory(node); |
525 | } | 539 | } |
526 | 540 | ||
527 | break; | 541 | break; |
528 | } | 542 | } |
529 | } | 543 | } |
@@ -538,7 +552,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
538 | // { | 552 | // { |
539 | // if (DisablePresenceChecks) | 553 | // if (DisablePresenceChecks) |
540 | // return true; | 554 | // return true; |
541 | // | 555 | // |
542 | // foreach (Scene scene in m_scenes.Values) | 556 | // foreach (Scene scene in m_scenes.Values) |
543 | // { | 557 | // { |
544 | // ScenePresence p; | 558 | // ScenePresence p; |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 1e743c3..366e02d 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -168,12 +168,18 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
168 | sendRegionInfoPacketToAll(); | 168 | sendRegionInfoPacketToAll(); |
169 | } | 169 | } |
170 | 170 | ||
171 | public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, UUID texture) | 171 | public void setEstateTerrainBaseTexture(int level, UUID texture) |
172 | { | ||
173 | setEstateTerrainBaseTexture(null, level, texture); | ||
174 | sendRegionHandshakeToAll(); | ||
175 | } | ||
176 | |||
177 | public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture) | ||
172 | { | 178 | { |
173 | if (texture == UUID.Zero) | 179 | if (texture == UUID.Zero) |
174 | return; | 180 | return; |
175 | 181 | ||
176 | switch (corner) | 182 | switch (level) |
177 | { | 183 | { |
178 | case 0: | 184 | case 0: |
179 | Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; | 185 | Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; |
@@ -193,6 +199,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
193 | sendRegionInfoPacketToAll(); | 199 | sendRegionInfoPacketToAll(); |
194 | } | 200 | } |
195 | 201 | ||
202 | public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue) | ||
203 | { | ||
204 | setEstateTerrainTextureHeights(null, corner, lowValue, highValue); | ||
205 | } | ||
206 | |||
196 | public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) | 207 | public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) |
197 | { | 208 | { |
198 | switch (corner) | 209 | switch (corner) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 509c4d7..9b2ddfd 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -447,7 +447,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
447 | { | 447 | { |
448 | bool isMember; | 448 | bool isMember; |
449 | if (m_groupMemberCache.TryGetValue(avatar, out isMember)) | 449 | if (m_groupMemberCache.TryGetValue(avatar, out isMember)) |
450 | { | ||
451 | m_groupMemberCache.Update(avatar, isMember, m_groupMemberCacheTimeout); | ||
450 | return isMember; | 452 | return isMember; |
453 | } | ||
451 | 454 | ||
452 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | 455 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); |
453 | if (groupsModule == null) | 456 | if (groupsModule == null) |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 32f4eea..8732ec0 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -174,7 +174,17 @@ namespace OpenSim.Region.Framework.Interfaces | |||
174 | /// If no inventory item has that name then an empty list is returned. | 174 | /// If no inventory item has that name then an empty list is returned. |
175 | /// </returns> | 175 | /// </returns> |
176 | List<TaskInventoryItem> GetInventoryItems(string name); | 176 | List<TaskInventoryItem> GetInventoryItems(string name); |
177 | 177 | ||
178 | /// <summary> | ||
179 | /// Get inventory items by type. | ||
180 | /// </summary> | ||
181 | /// <param type="name"></param> | ||
182 | /// <returns> | ||
183 | /// A list of inventory items of that type. | ||
184 | /// If no inventory items of that type then an empty list is returned. | ||
185 | /// </returns> | ||
186 | List<TaskInventoryItem> GetInventoryItems(InventoryType type); | ||
187 | |||
178 | /// <summary> | 188 | /// <summary> |
179 | /// Get the scene object referenced by an inventory item. | 189 | /// Get the scene object referenced by an inventory item. |
180 | /// </summary> | 190 | /// </summary> |
@@ -228,6 +238,16 @@ namespace OpenSim.Region.Framework.Interfaces | |||
228 | bool ContainsScripts(); | 238 | bool ContainsScripts(); |
229 | 239 | ||
230 | /// <summary> | 240 | /// <summary> |
241 | /// Returns the count of scripts contained | ||
242 | /// </summary></returns> | ||
243 | int ScriptCount(); | ||
244 | |||
245 | /// <summary> | ||
246 | /// Returns the count of running scripts contained | ||
247 | /// </summary></returns> | ||
248 | int RunningScriptCount(); | ||
249 | |||
250 | /// <summary> | ||
231 | /// Get the uuids of all items in this inventory | 251 | /// Get the uuids of all items in this inventory |
232 | /// </summary> | 252 | /// </summary> |
233 | /// <returns></returns> | 253 | /// <returns></returns> |
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 72e79ed..ca2ad94 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs | |||
@@ -47,5 +47,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
47 | void sendRegionHandshakeToAll(); | 47 | void sendRegionHandshakeToAll(); |
48 | void TriggerEstateInfoChange(); | 48 | void TriggerEstateInfoChange(); |
49 | void TriggerRegionInfoChange(); | 49 | void TriggerRegionInfoChange(); |
50 | |||
51 | void setEstateTerrainBaseTexture(int level, UUID texture); | ||
52 | void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue); | ||
50 | } | 53 | } |
51 | } | 54 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index ce66100..143af48 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -71,6 +71,12 @@ namespace OpenSim.Region.Framework.Interfaces | |||
71 | 71 | ||
72 | bool HasScript(UUID itemID, out bool running); | 72 | bool HasScript(UUID itemID, out bool running); |
73 | 73 | ||
74 | /// <summary> | ||
75 | /// Returns true if a script is running. | ||
76 | /// </summary> | ||
77 | /// <param name="itemID">The item ID of the script.</param> | ||
78 | bool GetScriptState(UUID itemID); | ||
79 | |||
74 | void SaveAllState(); | 80 | void SaveAllState(); |
75 | 81 | ||
76 | /// <summary> | 82 | /// <summary> |
@@ -79,6 +85,14 @@ namespace OpenSim.Region.Framework.Interfaces | |||
79 | void StartProcessing(); | 85 | void StartProcessing(); |
80 | 86 | ||
81 | /// <summary> | 87 | /// <summary> |
88 | /// Get the execution times of all scripts in the given array if they are currently running. | ||
89 | /// </summary> | ||
90 | /// <returns> | ||
91 | /// A float the value is a representative execution time in milliseconds of all scripts in that Array. | ||
92 | /// </returns> | ||
93 | float GetScriptExecutionTime(List<UUID> itemIDs); | ||
94 | |||
95 | /// <summary> | ||
82 | /// Get the execution times of all scripts in each object. | 96 | /// Get the execution times of all scripts in each object. |
83 | /// </summary> | 97 | /// </summary> |
84 | /// <returns> | 98 | /// <returns> |
@@ -87,4 +101,4 @@ namespace OpenSim.Region.Framework.Interfaces | |||
87 | /// </returns> | 101 | /// </returns> |
88 | Dictionary<uint, float> GetObjectScriptsExecutionTimes(); | 102 | Dictionary<uint, float> GetObjectScriptsExecutionTimes(); |
89 | } | 103 | } |
90 | } \ No newline at end of file | 104 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index b806d91..77e808e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -156,7 +156,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
156 | // that the region position is cached or performance will degrade | 156 | // that the region position is cached or performance will degrade |
157 | Utils.LongToUInts(regionHandle, out x, out y); | 157 | Utils.LongToUInts(regionHandle, out x, out y); |
158 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | 158 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); |
159 | // bool v = true; | 159 | if (dest == null) |
160 | continue; | ||
161 | |||
160 | if (!simulatorList.Contains(dest.ServerURI)) | 162 | if (!simulatorList.Contains(dest.ServerURI)) |
161 | { | 163 | { |
162 | // we havent seen this simulator before, add it to the list | 164 | // we havent seen this simulator before, add it to the list |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3fd1f5e..6f3a084 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -4045,7 +4045,72 @@ namespace OpenSim.Region.Framework.Scenes | |||
4045 | for (int i = 0; i < parts.Length; i++) | 4045 | for (int i = 0; i < parts.Length; i++) |
4046 | parts[i].TriggerScriptChangedEvent(val); | 4046 | parts[i].TriggerScriptChangedEvent(val); |
4047 | } | 4047 | } |
4048 | 4048 | ||
4049 | /// <summary> | ||
4050 | /// Returns a count of the number of scripts in this groups parts. | ||
4051 | /// </summary> | ||
4052 | public int ScriptCount() | ||
4053 | { | ||
4054 | int count = 0; | ||
4055 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4056 | for (int i = 0; i < parts.Length; i++) | ||
4057 | count += parts[i].Inventory.ScriptCount(); | ||
4058 | |||
4059 | return count; | ||
4060 | } | ||
4061 | |||
4062 | /// <summary> | ||
4063 | /// A float the value is a representative execution time in milliseconds of all scripts in the link set. | ||
4064 | /// </summary> | ||
4065 | public float ScriptExecutionTime() | ||
4066 | { | ||
4067 | IScriptModule[] engines = Scene.RequestModuleInterfaces<IScriptModule>(); | ||
4068 | |||
4069 | if (engines.Length == 0) // No engine at all | ||
4070 | return 0.0f; | ||
4071 | |||
4072 | float time = 0.0f; | ||
4073 | |||
4074 | // get all the scripts in all parts | ||
4075 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4076 | List<TaskInventoryItem> scripts = new List<TaskInventoryItem>(); | ||
4077 | for (int i = 0; i < parts.Length; i++) | ||
4078 | { | ||
4079 | scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL)); | ||
4080 | } | ||
4081 | // extract the UUIDs | ||
4082 | List<UUID> ids = new List<UUID>(scripts.Count); | ||
4083 | foreach (TaskInventoryItem script in scripts) | ||
4084 | { | ||
4085 | if (!ids.Contains(script.ItemID)) | ||
4086 | { | ||
4087 | ids.Add(script.ItemID); | ||
4088 | } | ||
4089 | } | ||
4090 | // Offer the list of script UUIDs to each engine found and accumulate the time | ||
4091 | foreach (IScriptModule e in engines) | ||
4092 | { | ||
4093 | if (e != null) | ||
4094 | { | ||
4095 | time += e.GetScriptExecutionTime(ids); | ||
4096 | } | ||
4097 | } | ||
4098 | return time; | ||
4099 | } | ||
4100 | |||
4101 | /// <summary> | ||
4102 | /// Returns a count of the number of running scripts in this groups parts. | ||
4103 | /// </summary> | ||
4104 | public int RunningScriptCount() | ||
4105 | { | ||
4106 | int count = 0; | ||
4107 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4108 | for (int i = 0; i < parts.Length; i++) | ||
4109 | count += parts[i].Inventory.RunningScriptCount(); | ||
4110 | |||
4111 | return count; | ||
4112 | } | ||
4113 | |||
4049 | public override string ToString() | 4114 | public override string ToString() |
4050 | { | 4115 | { |
4051 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); | 4116 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index a2649ee..36cb09a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -267,14 +267,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
267 | /// </summary> | 267 | /// </summary> |
268 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) | 268 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) |
269 | { | 269 | { |
270 | Items.LockItemsForRead(true); | 270 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); |
271 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 271 | foreach (TaskInventoryItem item in scripts) |
272 | Items.LockItemsForRead(false); | 272 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); |
273 | foreach (TaskInventoryItem item in items) | ||
274 | { | ||
275 | if ((int)InventoryType.LSL == item.InvType) | ||
276 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); | ||
277 | } | ||
278 | } | 273 | } |
279 | 274 | ||
280 | public ArrayList GetScriptErrors(UUID itemID) | 275 | public ArrayList GetScriptErrors(UUID itemID) |
@@ -305,17 +300,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
305 | /// </param> | 300 | /// </param> |
306 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) | 301 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) |
307 | { | 302 | { |
308 | Items.LockItemsForRead(true); | 303 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); |
309 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 304 | foreach (TaskInventoryItem item in scripts) |
310 | Items.LockItemsForRead(false); | ||
311 | |||
312 | foreach (TaskInventoryItem item in items) | ||
313 | { | 305 | { |
314 | if ((int)InventoryType.LSL == item.InvType) | 306 | RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); |
315 | { | 307 | m_part.RemoveScriptEvents(item.ItemID); |
316 | RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); | ||
317 | m_part.RemoveScriptEvents(item.ItemID); | ||
318 | } | ||
319 | } | 308 | } |
320 | } | 309 | } |
321 | 310 | ||
@@ -1280,9 +1269,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
1280 | return true; | 1269 | return true; |
1281 | } | 1270 | } |
1282 | } | 1271 | } |
1272 | |||
1283 | return false; | 1273 | return false; |
1284 | } | 1274 | } |
1285 | 1275 | ||
1276 | /// <summary> | ||
1277 | /// Returns the count of scripts in this parts inventory. | ||
1278 | /// </summary> | ||
1279 | /// <returns></returns> | ||
1280 | public int ScriptCount() | ||
1281 | { | ||
1282 | int count = 0; | ||
1283 | Items.LockItemsForRead(true); | ||
1284 | foreach (TaskInventoryItem item in m_items.Values) | ||
1285 | { | ||
1286 | if (item.InvType == (int)InventoryType.LSL) | ||
1287 | { | ||
1288 | count++; | ||
1289 | } | ||
1290 | } | ||
1291 | Items.LockItemsForRead(false); | ||
1292 | return count; | ||
1293 | } | ||
1294 | /// <summary> | ||
1295 | /// Returns the count of running scripts in this parts inventory. | ||
1296 | /// </summary> | ||
1297 | /// <returns></returns> | ||
1298 | public int RunningScriptCount() | ||
1299 | { | ||
1300 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
1301 | if (engines.Length == 0) | ||
1302 | return 0; | ||
1303 | |||
1304 | int count = 0; | ||
1305 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); | ||
1306 | |||
1307 | foreach (TaskInventoryItem item in scripts) | ||
1308 | { | ||
1309 | foreach (IScriptModule engine in engines) | ||
1310 | { | ||
1311 | if (engine != null) | ||
1312 | { | ||
1313 | if (engine.GetScriptState(item.ItemID)) | ||
1314 | { | ||
1315 | count++; | ||
1316 | } | ||
1317 | } | ||
1318 | } | ||
1319 | } | ||
1320 | return count; | ||
1321 | } | ||
1322 | |||
1286 | public List<UUID> GetInventoryList() | 1323 | public List<UUID> GetInventoryList() |
1287 | { | 1324 | { |
1288 | List<UUID> ret = new List<UUID>(); | 1325 | List<UUID> ret = new List<UUID>(); |
@@ -1297,22 +1334,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1297 | { | 1334 | { |
1298 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); | 1335 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); |
1299 | 1336 | ||
1300 | lock (m_items) | 1337 | Items.LockItemsForRead(true); |
1301 | ret = new List<TaskInventoryItem>(m_items.Values); | 1338 | ret = new List<TaskInventoryItem>(m_items.Values); |
1339 | Items.LockItemsForRead(false); | ||
1302 | 1340 | ||
1303 | return ret; | 1341 | return ret; |
1304 | } | 1342 | } |
1305 | 1343 | ||
1306 | public List<TaskInventoryItem> GetInventoryScripts() | 1344 | public List<TaskInventoryItem> GetInventoryItems(InventoryType type) |
1307 | { | 1345 | { |
1308 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); | 1346 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); |
1309 | 1347 | ||
1310 | lock (m_items) | 1348 | Items.LockItemsForRead(true); |
1311 | { | 1349 | |
1312 | foreach (TaskInventoryItem item in m_items.Values) | 1350 | foreach (TaskInventoryItem item in m_items.Values) |
1313 | if (item.InvType == (int)InventoryType.LSL) | 1351 | if (item.InvType == (int)type) |
1314 | ret.Add(item); | 1352 | ret.Add(item); |
1315 | } | 1353 | |
1354 | Items.LockItemsForRead(false); | ||
1316 | 1355 | ||
1317 | return ret; | 1356 | return ret; |
1318 | } | 1357 | } |
@@ -1334,35 +1373,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1334 | if (engines.Length == 0) // No engine at all | 1373 | if (engines.Length == 0) // No engine at all |
1335 | return ret; | 1374 | return ret; |
1336 | 1375 | ||
1337 | Items.LockItemsForRead(true); | 1376 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); |
1338 | foreach (TaskInventoryItem item in m_items.Values) | 1377 | |
1378 | foreach (TaskInventoryItem item in scripts) | ||
1339 | { | 1379 | { |
1340 | if (item.InvType == (int)InventoryType.LSL) | 1380 | foreach (IScriptModule e in engines) |
1341 | { | 1381 | { |
1342 | foreach (IScriptModule e in engines) | 1382 | if (e != null) |
1343 | { | 1383 | { |
1344 | if (e != null) | 1384 | string n = e.GetXMLState(item.ItemID); |
1385 | if (n != String.Empty) | ||
1345 | { | 1386 | { |
1346 | string n = e.GetXMLState(item.ItemID); | 1387 | if (oldIDs) |
1347 | if (n != String.Empty) | 1388 | { |
1389 | if (!ret.ContainsKey(item.OldItemID)) | ||
1390 | ret[item.OldItemID] = n; | ||
1391 | } | ||
1392 | else | ||
1348 | { | 1393 | { |
1349 | if (oldIDs) | 1394 | if (!ret.ContainsKey(item.ItemID)) |
1350 | { | 1395 | ret[item.ItemID] = n; |
1351 | if (!ret.ContainsKey(item.OldItemID)) | ||
1352 | ret[item.OldItemID] = n; | ||
1353 | } | ||
1354 | else | ||
1355 | { | ||
1356 | if (!ret.ContainsKey(item.ItemID)) | ||
1357 | ret[item.ItemID] = n; | ||
1358 | } | ||
1359 | break; | ||
1360 | } | 1396 | } |
1397 | break; | ||
1361 | } | 1398 | } |
1362 | } | 1399 | } |
1363 | } | 1400 | } |
1364 | } | 1401 | } |
1365 | Items.LockItemsForRead(false); | ||
1366 | return ret; | 1402 | return ret; |
1367 | } | 1403 | } |
1368 | 1404 | ||
@@ -1372,27 +1408,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1372 | if (engines.Length == 0) | 1408 | if (engines.Length == 0) |
1373 | return; | 1409 | return; |
1374 | 1410 | ||
1411 | List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL); | ||
1375 | 1412 | ||
1376 | Items.LockItemsForRead(true); | 1413 | foreach (TaskInventoryItem item in scripts) |
1377 | |||
1378 | foreach (TaskInventoryItem item in m_items.Values) | ||
1379 | { | 1414 | { |
1380 | if (item.InvType == (int)InventoryType.LSL) | 1415 | foreach (IScriptModule engine in engines) |
1381 | { | 1416 | { |
1382 | foreach (IScriptModule engine in engines) | 1417 | if (engine != null) |
1383 | { | 1418 | { |
1384 | if (engine != null) | 1419 | if (item.OwnerChanged) |
1385 | { | 1420 | engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER }); |
1386 | if (item.OwnerChanged) | 1421 | item.OwnerChanged = false; |
1387 | engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER }); | 1422 | engine.ResumeScript(item.ItemID); |
1388 | item.OwnerChanged = false; | ||
1389 | engine.ResumeScript(item.ItemID); | ||
1390 | } | ||
1391 | } | 1423 | } |
1392 | } | 1424 | } |
1393 | } | 1425 | } |
1394 | |||
1395 | Items.LockItemsForRead(false); | ||
1396 | } | 1426 | } |
1397 | } | 1427 | } |
1398 | } | 1428 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8ac09e9..7a634c4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3532,6 +3532,63 @@ namespace OpenSim.Region.Framework.Scenes | |||
3532 | return m_attachments.Count > 0; | 3532 | return m_attachments.Count > 0; |
3533 | } | 3533 | } |
3534 | 3534 | ||
3535 | /// <summary> | ||
3536 | /// Returns the total count of scripts in all parts inventories. | ||
3537 | /// </summary> | ||
3538 | public int ScriptCount() | ||
3539 | { | ||
3540 | int count = 0; | ||
3541 | lock (m_attachments) | ||
3542 | { | ||
3543 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3544 | { | ||
3545 | if (gobj != null) | ||
3546 | { | ||
3547 | count += gobj.ScriptCount(); | ||
3548 | } | ||
3549 | } | ||
3550 | } | ||
3551 | return count; | ||
3552 | } | ||
3553 | |||
3554 | /// <summary> | ||
3555 | /// A float the value is a representative execution time in milliseconds of all scripts in all attachments. | ||
3556 | /// </summary> | ||
3557 | public float ScriptExecutionTime() | ||
3558 | { | ||
3559 | float time = 0.0f; | ||
3560 | lock (m_attachments) | ||
3561 | { | ||
3562 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3563 | { | ||
3564 | if (gobj != null) | ||
3565 | { | ||
3566 | time += gobj.ScriptExecutionTime(); | ||
3567 | } | ||
3568 | } | ||
3569 | } | ||
3570 | return time; | ||
3571 | } | ||
3572 | |||
3573 | /// <summary> | ||
3574 | /// Returns the total count of running scripts in all parts. | ||
3575 | /// </summary> | ||
3576 | public int RunningScriptCount() | ||
3577 | { | ||
3578 | int count = 0; | ||
3579 | lock (m_attachments) | ||
3580 | { | ||
3581 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3582 | { | ||
3583 | if (gobj != null) | ||
3584 | { | ||
3585 | count += gobj.RunningScriptCount(); | ||
3586 | } | ||
3587 | } | ||
3588 | } | ||
3589 | return count; | ||
3590 | } | ||
3591 | |||
3535 | public bool HasScriptedAttachments() | 3592 | public bool HasScriptedAttachments() |
3536 | { | 3593 | { |
3537 | lock (m_attachments) | 3594 | lock (m_attachments) |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs new file mode 100644 index 0000000..7a3b362 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using System.Threading; | ||
31 | using NUnit.Framework; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Tests.Common; | ||
37 | using OpenSim.Tests.Common.Mock; | ||
38 | |||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.) | ||
43 | /// </summary> | ||
44 | [TestFixture] | ||
45 | public class SceneObjectSpatialTests | ||
46 | { | ||
47 | TestScene m_scene; | ||
48 | UUID m_ownerId = TestHelpers.ParseTail(0x1); | ||
49 | |||
50 | [SetUp] | ||
51 | public void SetUp() | ||
52 | { | ||
53 | m_scene = SceneHelpers.SetupScene(); | ||
54 | } | ||
55 | |||
56 | [Test] | ||
57 | public void TestGetSceneObjectGroupPosition() | ||
58 | { | ||
59 | TestHelpers.InMethod(); | ||
60 | |||
61 | Vector3 position = new Vector3(10, 20, 30); | ||
62 | |||
63 | SceneObjectGroup so | ||
64 | = SceneHelpers.CreateSceneObject(1, m_ownerId, "obj1", 0x10); | ||
65 | so.AbsolutePosition = position; | ||
66 | m_scene.AddNewSceneObject(so, false); | ||
67 | |||
68 | Assert.That(so.AbsolutePosition, Is.EqualTo(position)); | ||
69 | } | ||
70 | |||
71 | [Test] | ||
72 | public void TestGetRootPartPosition() | ||
73 | { | ||
74 | TestHelpers.InMethod(); | ||
75 | |||
76 | Vector3 partPosition = new Vector3(10, 20, 30); | ||
77 | |||
78 | SceneObjectGroup so | ||
79 | = SceneHelpers.CreateSceneObject(1, m_ownerId, "obj1", 0x10); | ||
80 | so.AbsolutePosition = partPosition; | ||
81 | m_scene.AddNewSceneObject(so, false); | ||
82 | |||
83 | Assert.That(so.RootPart.AbsolutePosition, Is.EqualTo(partPosition)); | ||
84 | Assert.That(so.RootPart.GroupPosition, Is.EqualTo(partPosition)); | ||
85 | Assert.That(so.RootPart.GetWorldPosition(), Is.EqualTo(partPosition)); | ||
86 | Assert.That(so.RootPart.RelativePosition, Is.EqualTo(partPosition)); | ||
87 | Assert.That(so.RootPart.OffsetPosition, Is.EqualTo(Vector3.Zero)); | ||
88 | } | ||
89 | } | ||
90 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8e73eb1..3a7eb32 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -11182,19 +11182,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11182 | break; | 11182 | break; |
11183 | // For the following 8 see the Object version below | 11183 | // For the following 8 see the Object version below |
11184 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | 11184 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: |
11185 | ret.Add(new LSL_Integer(0)); | 11185 | ret.Add(new LSL_Integer(av.RunningScriptCount())); |
11186 | break; | 11186 | break; |
11187 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | 11187 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: |
11188 | ret.Add(new LSL_Integer(0)); | 11188 | ret.Add(new LSL_Integer(av.ScriptCount())); |
11189 | break; | 11189 | break; |
11190 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | 11190 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: |
11191 | ret.Add(new LSL_Integer(0)); | 11191 | ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384)); |
11192 | break; | 11192 | break; |
11193 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | 11193 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: |
11194 | ret.Add(new LSL_Float(0)); | 11194 | ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f)); |
11195 | break; | 11195 | break; |
11196 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | 11196 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: |
11197 | ret.Add(new LSL_Integer(0)); | 11197 | ret.Add(new LSL_Integer(1)); |
11198 | break; | 11198 | break; |
11199 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11199 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11200 | ret.Add(new LSL_Float(0)); | 11200 | ret.Add(new LSL_Float(0)); |
@@ -11246,43 +11246,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11246 | case ScriptBaseClass.OBJECT_CREATOR: | 11246 | case ScriptBaseClass.OBJECT_CREATOR: |
11247 | ret.Add(new LSL_String(obj.CreatorID.ToString())); | 11247 | ret.Add(new LSL_String(obj.CreatorID.ToString())); |
11248 | break; | 11248 | break; |
11249 | // The following 8 I have intentionaly coded to return zero. They are part of | ||
11250 | // "Land Impact" calculations. These calculations are probably not applicable | ||
11251 | // to OpenSim, required figures (cpu/memory usage) are not currently tracked | ||
11252 | // I have intentionally left these all at zero rather than return possibly | ||
11253 | // missleading numbers | ||
11254 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | 11249 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: |
11255 | // in SL this currently includes crashed scripts | 11250 | ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount())); |
11256 | ret.Add(new LSL_Integer(0)); | ||
11257 | break; | 11251 | break; |
11258 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | 11252 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: |
11259 | ret.Add(new LSL_Integer(0)); | 11253 | ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount())); |
11260 | break; | 11254 | break; |
11261 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | 11255 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: |
11262 | // The value returned in SL for mono scripts is 65536 * number of active scripts | 11256 | // The value returned in SL for mono scripts is 65536 * number of active scripts |
11263 | ret.Add(new LSL_Integer(0)); | 11257 | // and 16384 * number of active scripts for LSO. since llGetFreememory |
11258 | // is coded to give the LSO value use it here | ||
11259 | ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); | ||
11264 | break; | 11260 | break; |
11265 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | 11261 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: |
11266 | // Average cpu time per simulator frame expended on all scripts in the objetc | 11262 | // Average cpu time in seconds per simulator frame expended on all scripts in the object |
11267 | ret.Add(new LSL_Float(0)); | 11263 | ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f)); |
11268 | break; | 11264 | break; |
11269 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | 11265 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: |
11270 | // according to the SL wiki A prim or linkset will have prim | 11266 | // according to the SL wiki A prim or linkset will have prim |
11271 | // equivalent of the number of prims in a linkset if it does not | 11267 | // equivalent of the number of prims in a linkset if it does not |
11272 | // contain a mesh anywhere in the link set or is not a normal prim | 11268 | // contain a mesh anywhere in the link set or is not a normal prim |
11273 | // The value returned in SL for normal prims is prim count | 11269 | // The value returned in SL for normal prims is prim count |
11274 | ret.Add(new LSL_Integer(0)); | 11270 | ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); |
11275 | break; | 11271 | break; |
11272 | // The following 3 costs I have intentionaly coded to return zero. They are part of | ||
11273 | // "Land Impact" calculations. These calculations are probably not applicable | ||
11274 | // to OpenSim and are not yet complete in SL | ||
11276 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11275 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11277 | // The value returned in SL for normal prims is prim count | 11276 | // The linden calculation is here |
11277 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight | ||
11278 | // The value returned in SL for normal prims looks like the prim count | ||
11278 | ret.Add(new LSL_Float(0)); | 11279 | ret.Add(new LSL_Float(0)); |
11279 | break; | 11280 | break; |
11280 | case ScriptBaseClass.OBJECT_STREAMING_COST: | 11281 | case ScriptBaseClass.OBJECT_STREAMING_COST: |
11281 | // The value returned in SL for normal prims is prim count * 0.06 | 11282 | // The linden calculation is here |
11283 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost | ||
11284 | // The value returned in SL for normal prims looks like the prim count * 0.06 | ||
11282 | ret.Add(new LSL_Float(0)); | 11285 | ret.Add(new LSL_Float(0)); |
11283 | break; | 11286 | break; |
11284 | case ScriptBaseClass.OBJECT_PHYSICS_COST: | 11287 | case ScriptBaseClass.OBJECT_PHYSICS_COST: |
11285 | // The value returned in SL for normal prims is prim count | 11288 | // The linden calculation is here |
11289 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_physics | ||
11290 | // The value returned in SL for normal prims looks like the prim count | ||
11286 | ret.Add(new LSL_Float(0)); | 11291 | ret.Add(new LSL_Float(0)); |
11287 | break; | 11292 | break; |
11288 | default: | 11293 | default: |
@@ -12099,35 +12104,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12099 | return 1; | 12104 | return 1; |
12100 | } | 12105 | } |
12101 | 12106 | ||
12102 | #region Not Implemented | 12107 | public LSL_Integer llGetMemoryLimit() |
12103 | // | 12108 | { |
12104 | // Listing the unimplemented lsl functions here, please move | 12109 | m_host.AddScriptLPS(1); |
12105 | // them from this region as they are completed | 12110 | // The value returned for LSO scripts in SL |
12106 | // | 12111 | return 16384; |
12112 | } | ||
12107 | 12113 | ||
12108 | public void llGetEnv(LSL_String name) | 12114 | public LSL_Integer llSetMemoryLimit(LSL_Integer limit) |
12109 | { | 12115 | { |
12110 | m_host.AddScriptLPS(1); | 12116 | m_host.AddScriptLPS(1); |
12111 | NotImplemented("llGetEnv"); | 12117 | // Treat as an LSO script |
12118 | return ScriptBaseClass.FALSE; | ||
12112 | } | 12119 | } |
12113 | 12120 | ||
12114 | public void llGetSPMaxMemory() | 12121 | public LSL_Integer llGetSPMaxMemory() |
12115 | { | 12122 | { |
12116 | m_host.AddScriptLPS(1); | 12123 | m_host.AddScriptLPS(1); |
12117 | NotImplemented("llGetSPMaxMemory"); | 12124 | // The value returned for LSO scripts in SL |
12125 | return 16384; | ||
12118 | } | 12126 | } |
12119 | 12127 | ||
12120 | public virtual LSL_Integer llGetUsedMemory() | 12128 | public virtual LSL_Integer llGetUsedMemory() |
12121 | { | 12129 | { |
12122 | m_host.AddScriptLPS(1); | 12130 | m_host.AddScriptLPS(1); |
12123 | NotImplemented("llGetUsedMemory"); | 12131 | // The value returned for LSO scripts in SL |
12124 | return 0; | 12132 | return 16384; |
12125 | } | 12133 | } |
12126 | 12134 | ||
12127 | public void llScriptProfiler(LSL_Integer flags) | 12135 | public void llScriptProfiler(LSL_Integer flags) |
12128 | { | 12136 | { |
12129 | m_host.AddScriptLPS(1); | 12137 | m_host.AddScriptLPS(1); |
12130 | //NotImplemented("llScriptProfiler"); | 12138 | // This does nothing for LSO scripts in SL |
12139 | } | ||
12140 | |||
12141 | #region Not Implemented | ||
12142 | // | ||
12143 | // Listing the unimplemented lsl functions here, please move | ||
12144 | // them from this region as they are completed | ||
12145 | // | ||
12146 | |||
12147 | public void llGetEnv(LSL_String name) | ||
12148 | { | ||
12149 | m_host.AddScriptLPS(1); | ||
12150 | NotImplemented("llGetEnv"); | ||
12131 | } | 12151 | } |
12132 | 12152 | ||
12133 | public void llSetSoundQueueing(int queue) | 12153 | public void llSetSoundQueueing(int queue) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0dc2aa2..df49fd7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1186,12 +1186,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1186 | CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); | 1186 | CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); |
1187 | 1187 | ||
1188 | m_host.AddScriptLPS(1); | 1188 | m_host.AddScriptLPS(1); |
1189 | //Check to make sure that the script's owner is the estate manager/master | 1189 | |
1190 | //World.Permissions.GenericEstatePermission( | 1190 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); |
1191 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1192 | { | ||
1193 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); | ||
1194 | } | ||
1195 | } | 1191 | } |
1196 | 1192 | ||
1197 | /// <summary> | 1193 | /// <summary> |
@@ -1202,27 +1198,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1202 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> | 1198 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> |
1203 | public void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour) | 1199 | public void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour) |
1204 | { | 1200 | { |
1205 | CheckThreatLevel(ThreatLevel.Nuisance, "osSetRegionSunSettings"); | 1201 | CheckThreatLevel(ThreatLevel.High, "osSetRegionSunSettings"); |
1206 | 1202 | ||
1207 | m_host.AddScriptLPS(1); | 1203 | m_host.AddScriptLPS(1); |
1208 | //Check to make sure that the script's owner is the estate manager/master | ||
1209 | //World.Permissions.GenericEstatePermission( | ||
1210 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1211 | { | ||
1212 | while (sunHour > 24.0) | ||
1213 | sunHour -= 24.0; | ||
1214 | 1204 | ||
1215 | while (sunHour < 0) | 1205 | while (sunHour > 24.0) |
1216 | sunHour += 24.0; | 1206 | sunHour -= 24.0; |
1217 | 1207 | ||
1208 | while (sunHour < 0) | ||
1209 | sunHour += 24.0; | ||
1218 | 1210 | ||
1219 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; | 1211 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; |
1220 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 | 1212 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 |
1221 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; | 1213 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; |
1222 | World.RegionInfo.RegionSettings.Save(); | 1214 | World.RegionInfo.RegionSettings.Save(); |
1223 | 1215 | ||
1224 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); | 1216 | World.EventManager.TriggerEstateToolsSunUpdate( |
1225 | } | 1217 | World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); |
1226 | } | 1218 | } |
1227 | 1219 | ||
1228 | /// <summary> | 1220 | /// <summary> |
@@ -1232,26 +1224,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1232 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> | 1224 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> |
1233 | public void osSetEstateSunSettings(bool sunFixed, double sunHour) | 1225 | public void osSetEstateSunSettings(bool sunFixed, double sunHour) |
1234 | { | 1226 | { |
1235 | CheckThreatLevel(ThreatLevel.Nuisance, "osSetEstateSunSettings"); | 1227 | CheckThreatLevel(ThreatLevel.High, "osSetEstateSunSettings"); |
1236 | 1228 | ||
1237 | m_host.AddScriptLPS(1); | 1229 | m_host.AddScriptLPS(1); |
1238 | //Check to make sure that the script's owner is the estate manager/master | ||
1239 | //World.Permissions.GenericEstatePermission( | ||
1240 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1241 | { | ||
1242 | while (sunHour > 24.0) | ||
1243 | sunHour -= 24.0; | ||
1244 | 1230 | ||
1245 | while (sunHour < 0) | 1231 | while (sunHour > 24.0) |
1246 | sunHour += 24.0; | 1232 | sunHour -= 24.0; |
1247 | 1233 | ||
1248 | World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; | 1234 | while (sunHour < 0) |
1249 | World.RegionInfo.EstateSettings.SunPosition = sunHour; | 1235 | sunHour += 24.0; |
1250 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; | ||
1251 | World.RegionInfo.EstateSettings.Save(); | ||
1252 | 1236 | ||
1253 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); | 1237 | World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; |
1254 | } | 1238 | World.RegionInfo.EstateSettings.SunPosition = sunHour; |
1239 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; | ||
1240 | World.RegionInfo.EstateSettings.Save(); | ||
1241 | |||
1242 | World.EventManager.TriggerEstateToolsSunUpdate( | ||
1243 | World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); | ||
1255 | } | 1244 | } |
1256 | 1245 | ||
1257 | /// <summary> | 1246 | /// <summary> |
@@ -2555,7 +2544,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2555 | 2544 | ||
2556 | public void osNpcStopMoveToTarget(LSL_Key npc) | 2545 | public void osNpcStopMoveToTarget(LSL_Key npc) |
2557 | { | 2546 | { |
2558 | CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); | 2547 | CheckThreatLevel(ThreatLevel.High, "osNpcStopMoveToTarget"); |
2559 | m_host.AddScriptLPS(1); | 2548 | m_host.AddScriptLPS(1); |
2560 | 2549 | ||
2561 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2550 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
@@ -3095,5 +3084,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3095 | 3084 | ||
3096 | return ScriptBaseClass.TRUE; | 3085 | return ScriptBaseClass.TRUE; |
3097 | } | 3086 | } |
3087 | |||
3088 | /// <summary> | ||
3089 | /// Sets terrain estate texture | ||
3090 | /// </summary> | ||
3091 | /// <param name="level"></param> | ||
3092 | /// <param name="texture"></param> | ||
3093 | /// <returns></returns> | ||
3094 | public void osSetTerrainTexture(int level, LSL_Key texture) | ||
3095 | { | ||
3096 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture"); | ||
3097 | |||
3098 | m_host.AddScriptLPS(1); | ||
3099 | //Check to make sure that the script's owner is the estate manager/master | ||
3100 | //World.Permissions.GenericEstatePermission( | ||
3101 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
3102 | { | ||
3103 | if (level < 0 || level > 3) | ||
3104 | return; | ||
3105 | |||
3106 | UUID textureID = new UUID(); | ||
3107 | if (!UUID.TryParse(texture, out textureID)) | ||
3108 | return; | ||
3109 | |||
3110 | // estate module is required | ||
3111 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | ||
3112 | if (estate != null) | ||
3113 | estate.setEstateTerrainBaseTexture(level, textureID); | ||
3114 | } | ||
3115 | } | ||
3116 | |||
3117 | /// <summary> | ||
3118 | /// Sets terrain heights of estate | ||
3119 | /// </summary> | ||
3120 | /// <param name="corner"></param> | ||
3121 | /// <param name="low"></param> | ||
3122 | /// <param name="high"></param> | ||
3123 | /// <returns></returns> | ||
3124 | public void osSetTerrainTextureHeight(int corner, double low, double high) | ||
3125 | { | ||
3126 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight"); | ||
3127 | |||
3128 | m_host.AddScriptLPS(1); | ||
3129 | //Check to make sure that the script's owner is the estate manager/master | ||
3130 | //World.Permissions.GenericEstatePermission( | ||
3131 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
3132 | { | ||
3133 | if (corner < 0 || corner > 3) | ||
3134 | return; | ||
3135 | |||
3136 | // estate module is required | ||
3137 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | ||
3138 | if (estate != null) | ||
3139 | estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high); | ||
3140 | } | ||
3141 | } | ||
3098 | } | 3142 | } |
3099 | } | 3143 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 5c528977..eab6851 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -149,7 +149,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
149 | LSL_Rotation llGetLocalRot(); | 149 | LSL_Rotation llGetLocalRot(); |
150 | LSL_Float llGetMass(); | 150 | LSL_Float llGetMass(); |
151 | LSL_Float llGetMassMKS(); | 151 | LSL_Float llGetMassMKS(); |
152 | void llGetNextEmail(string address, string subject); | 152 | LSL_Integer llGetMemoryLimit(); |
153 | void llGetNextEmail(string address, string subject); | ||
153 | LSL_String llGetNotecardLine(string name, int line); | 154 | LSL_String llGetNotecardLine(string name, int line); |
154 | LSL_Key llGetNumberOfNotecardLines(string name); | 155 | LSL_Key llGetNumberOfNotecardLines(string name); |
155 | LSL_Integer llGetNumberOfPrims(); | 156 | LSL_Integer llGetNumberOfPrims(); |
@@ -187,6 +188,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
187 | LSL_String llGetScriptName(); | 188 | LSL_String llGetScriptName(); |
188 | LSL_Integer llGetScriptState(string name); | 189 | LSL_Integer llGetScriptState(string name); |
189 | LSL_String llGetSimulatorHostname(); | 190 | LSL_String llGetSimulatorHostname(); |
191 | LSL_Integer llGetSPMaxMemory(); | ||
190 | LSL_Integer llGetStartParameter(); | 192 | LSL_Integer llGetStartParameter(); |
191 | LSL_Integer llGetStatus(int status); | 193 | LSL_Integer llGetStatus(int status); |
192 | LSL_String llGetSubString(string src, int start, int end); | 194 | LSL_String llGetSubString(string src, int start, int end); |
@@ -322,6 +324,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
322 | void llSay(int channelID, string text); | 324 | void llSay(int channelID, string text); |
323 | void llScaleTexture(double u, double v, int face); | 325 | void llScaleTexture(double u, double v, int face); |
324 | LSL_Integer llScriptDanger(LSL_Vector pos); | 326 | LSL_Integer llScriptDanger(LSL_Vector pos); |
327 | void llScriptProfiler(LSL_Integer flag); | ||
325 | LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata); | 328 | LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata); |
326 | void llSensor(string name, string id, int type, double range, double arc); | 329 | void llSensor(string name, string id, int type, double range, double arc); |
327 | void llSensorRemove(); | 330 | void llSensorRemove(); |
@@ -345,6 +348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
345 | void llSetLinkTexture(int linknumber, string texture, int face); | 348 | void llSetLinkTexture(int linknumber, string texture, int face); |
346 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); | 349 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); |
347 | void llSetLocalRot(LSL_Rotation rot); | 350 | void llSetLocalRot(LSL_Rotation rot); |
351 | LSL_Integer llSetMemoryLimit(LSL_Integer limit); | ||
348 | void llSetObjectDesc(string desc); | 352 | void llSetObjectDesc(string desc); |
349 | void llSetObjectName(string name); | 353 | void llSetObjectName(string name); |
350 | void llSetObjectPermMask(int mask, int value); | 354 | void llSetObjectPermMask(int mask, int value); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 444a681..2fcc443 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -234,5 +234,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
234 | 234 | ||
235 | LSL_Integer osInviteToGroup(LSL_Key agentId); | 235 | LSL_Integer osInviteToGroup(LSL_Key agentId); |
236 | LSL_Integer osEjectFromGroup(LSL_Key agentId); | 236 | LSL_Integer osEjectFromGroup(LSL_Key agentId); |
237 | |||
238 | void osSetTerrainTexture(int level, LSL_Key texture); | ||
239 | void osSetTerrainTextureHeight(int corner, double low, double high); | ||
237 | } | 240 | } |
238 | } | 241 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 6246b57..23b4336 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -383,6 +383,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
383 | public const int PRIM_SCULPT_FLAG_INVERT = 64; | 383 | public const int PRIM_SCULPT_FLAG_INVERT = 64; |
384 | public const int PRIM_SCULPT_FLAG_MIRROR = 128; | 384 | public const int PRIM_SCULPT_FLAG_MIRROR = 128; |
385 | 385 | ||
386 | public const int PROFILE_NONE = 0; | ||
387 | public const int PROFILE_SCRIPT_MEMORY = 1; | ||
388 | |||
386 | public const int MASK_BASE = 0; | 389 | public const int MASK_BASE = 0; |
387 | public const int MASK_OWNER = 1; | 390 | public const int MASK_OWNER = 1; |
388 | public const int MASK_GROUP = 2; | 391 | public const int MASK_GROUP = 2; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 70c5fcd..9446099 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -586,6 +586,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
586 | return m_LSL_Functions.llGetMassMKS(); | 586 | return m_LSL_Functions.llGetMassMKS(); |
587 | } | 587 | } |
588 | 588 | ||
589 | public LSL_Integer llGetMemoryLimit() | ||
590 | { | ||
591 | return m_LSL_Functions.llGetMemoryLimit(); | ||
592 | } | ||
593 | |||
589 | public void llGetNextEmail(string address, string subject) | 594 | public void llGetNextEmail(string address, string subject) |
590 | { | 595 | { |
591 | m_LSL_Functions.llGetNextEmail(address, subject); | 596 | m_LSL_Functions.llGetNextEmail(address, subject); |
@@ -776,6 +781,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
776 | return m_LSL_Functions.llGetSimulatorHostname(); | 781 | return m_LSL_Functions.llGetSimulatorHostname(); |
777 | } | 782 | } |
778 | 783 | ||
784 | public LSL_Integer llGetSPMaxMemory() | ||
785 | { | ||
786 | return m_LSL_Functions.llGetSPMaxMemory(); | ||
787 | } | ||
788 | |||
779 | public LSL_Integer llGetStartParameter() | 789 | public LSL_Integer llGetStartParameter() |
780 | { | 790 | { |
781 | return m_LSL_Functions.llGetStartParameter(); | 791 | return m_LSL_Functions.llGetStartParameter(); |
@@ -1445,6 +1455,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1445 | return m_LSL_Functions.llScriptDanger(pos); | 1455 | return m_LSL_Functions.llScriptDanger(pos); |
1446 | } | 1456 | } |
1447 | 1457 | ||
1458 | public void llScriptProfiler(LSL_Integer flags) | ||
1459 | { | ||
1460 | m_LSL_Functions.llScriptProfiler(flags); | ||
1461 | } | ||
1462 | |||
1448 | public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata) | 1463 | public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata) |
1449 | { | 1464 | { |
1450 | return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); | 1465 | return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); |
@@ -1555,6 +1570,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1555 | m_LSL_Functions.llSetLocalRot(rot); | 1570 | m_LSL_Functions.llSetLocalRot(rot); |
1556 | } | 1571 | } |
1557 | 1572 | ||
1573 | public LSL_Integer llSetMemoryLimit(LSL_Integer limit) | ||
1574 | { | ||
1575 | return m_LSL_Functions.llSetMemoryLimit(limit); | ||
1576 | } | ||
1577 | |||
1558 | public void llSetObjectDesc(string desc) | 1578 | public void llSetObjectDesc(string desc) |
1559 | { | 1579 | { |
1560 | m_LSL_Functions.llSetObjectDesc(desc); | 1580 | m_LSL_Functions.llSetObjectDesc(desc); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 680cefb4..b94b9bf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -878,5 +878,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
878 | { | 878 | { |
879 | return m_OSSL_Functions.osEjectFromGroup(agentId); | 879 | return m_OSSL_Functions.osEjectFromGroup(agentId); |
880 | } | 880 | } |
881 | |||
882 | public void osSetTerrainTexture(int level, LSL_Key texture) | ||
883 | { | ||
884 | m_OSSL_Functions.osSetTerrainTexture(level, texture); | ||
885 | } | ||
886 | |||
887 | public void osSetTerrainTextureHeight(int corner, double low, double high) | ||
888 | { | ||
889 | m_OSSL_Functions.osSetTerrainTextureHeight(corner, low, high); | ||
890 | } | ||
881 | } | 891 | } |
882 | } | 892 | } |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 1e0f01f..bfe7418 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1997,45 +1997,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1997 | if (!topScripts.ContainsKey(si.LocalID)) | 1997 | if (!topScripts.ContainsKey(si.LocalID)) |
1998 | topScripts[si.RootLocalID] = 0; | 1998 | topScripts[si.RootLocalID] = 0; |
1999 | 1999 | ||
2000 | // long ticksElapsed = tickNow - si.MeasurementPeriodTickStart; | 2000 | topScripts[si.RootLocalID] += CalculateAdjustedExectionTime(si, tickNow); |
2001 | // float framesElapsed = ticksElapsed / (18.1818 * TimeSpan.TicksPerMillisecond); | 2001 | } |
2002 | 2002 | } | |
2003 | // Execution time of the script adjusted by it's measurement period to make scripts started at | ||
2004 | // different times comparable. | ||
2005 | // float adjustedExecutionTime | ||
2006 | // = (float)si.MeasurementPeriodExecutionTime | ||
2007 | // / ((float)(tickNow - si.MeasurementPeriodTickStart) / ScriptInstance.MaxMeasurementPeriod) | ||
2008 | // / TimeSpan.TicksPerMillisecond; | ||
2009 | |||
2010 | long ticksElapsed = tickNow - si.MeasurementPeriodTickStart; | ||
2011 | |||
2012 | // Avoid divide by zerp | ||
2013 | if (ticksElapsed == 0) | ||
2014 | ticksElapsed = 1; | ||
2015 | 2003 | ||
2016 | // Scale execution time to the ideal 55 fps frame time for these reasons. | 2004 | return topScripts; |
2017 | // | 2005 | } |
2018 | // 1) XEngine does not execute scripts per frame, unlike other script engines. Hence, there is no | ||
2019 | // 'script execution time per frame', which is the original purpose of this value. | ||
2020 | // | ||
2021 | // 2) Giving the raw execution times is misleading since scripts start at different times, making | ||
2022 | // it impossible to compare scripts. | ||
2023 | // | ||
2024 | // 3) Scaling the raw execution time to the time that the script has been running is better but | ||
2025 | // is still misleading since a script that has just been rezzed may appear to have been running | ||
2026 | // for much longer. | ||
2027 | // | ||
2028 | // 4) Hence, we scale execution time to an idealised frame time (55 fps). This is also not perfect | ||
2029 | // since the figure does not represent actual execution time and very hard running scripts will | ||
2030 | // never exceed 18ms (though this is a very high number for script execution so is a warning sign). | ||
2031 | float adjustedExecutionTime | ||
2032 | = ((float)si.MeasurementPeriodExecutionTime / ticksElapsed) * 18.1818f; | ||
2033 | 2006 | ||
2034 | topScripts[si.RootLocalID] += adjustedExecutionTime; | 2007 | public float GetScriptExecutionTime(List<UUID> itemIDs) |
2008 | { | ||
2009 | if (itemIDs == null|| itemIDs.Count == 0) | ||
2010 | { | ||
2011 | return 0.0f; | ||
2012 | } | ||
2013 | float time = 0.0f; | ||
2014 | long tickNow = Util.EnvironmentTickCount(); | ||
2015 | IScriptInstance si; | ||
2016 | // Calculate the time for all scripts that this engine is executing | ||
2017 | // Ignore any others | ||
2018 | foreach (UUID id in itemIDs) | ||
2019 | { | ||
2020 | si = GetInstance(id); | ||
2021 | if (si != null && si.Running) | ||
2022 | { | ||
2023 | time += CalculateAdjustedExectionTime(si, tickNow); | ||
2035 | } | 2024 | } |
2036 | } | 2025 | } |
2026 | return time; | ||
2027 | } | ||
2037 | 2028 | ||
2038 | return topScripts; | 2029 | private float CalculateAdjustedExectionTime(IScriptInstance si, long tickNow) |
2030 | { | ||
2031 | long ticksElapsed = tickNow - si.MeasurementPeriodTickStart; | ||
2032 | |||
2033 | // Avoid divide by zero | ||
2034 | if (ticksElapsed == 0) | ||
2035 | ticksElapsed = 1; | ||
2036 | |||
2037 | // Scale execution time to the ideal 55 fps frame time for these reasons. | ||
2038 | // | ||
2039 | // 1) XEngine does not execute scripts per frame, unlike other script engines. Hence, there is no | ||
2040 | // 'script execution time per frame', which is the original purpose of this value. | ||
2041 | // | ||
2042 | // 2) Giving the raw execution times is misleading since scripts start at different times, making | ||
2043 | // it impossible to compare scripts. | ||
2044 | // | ||
2045 | // 3) Scaling the raw execution time to the time that the script has been running is better but | ||
2046 | // is still misleading since a script that has just been rezzed may appear to have been running | ||
2047 | // for much longer. | ||
2048 | // | ||
2049 | // 4) Hence, we scale execution time to an idealised frame time (55 fps). This is also not perfect | ||
2050 | // since the figure does not represent actual execution time and very hard running scripts will | ||
2051 | // never exceed 18ms (though this is a very high number for script execution so is a warning sign). | ||
2052 | return ((float)si.MeasurementPeriodExecutionTime / ticksElapsed) * 18.1818f; | ||
2039 | } | 2053 | } |
2040 | 2054 | ||
2041 | public void SuspendScript(UUID itemID) | 2055 | public void SuspendScript(UUID itemID) |
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 7deaf95..f982cc1 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | |||
@@ -116,29 +116,36 @@ namespace OpenSim.Services.Connectors | |||
116 | } | 116 | } |
117 | else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure")) | 117 | else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure")) |
118 | { | 118 | { |
119 | m_log.DebugFormat("[GRID CONNECTOR]: Registration failed: {0}", replyData["Message"].ToString()); | 119 | m_log.ErrorFormat( |
120 | "[GRID CONNECTOR]: Registration failed: {0} when contacting {1}", replyData["Message"], uri); | ||
121 | |||
120 | return replyData["Message"].ToString(); | 122 | return replyData["Message"].ToString(); |
121 | } | 123 | } |
122 | else if (!replyData.ContainsKey("Result")) | 124 | else if (!replyData.ContainsKey("Result")) |
123 | { | 125 | { |
124 | m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field"); | 126 | m_log.ErrorFormat( |
127 | "[GRID CONNECTOR]: reply data does not contain result field when contacting {0}", uri); | ||
125 | } | 128 | } |
126 | else | 129 | else |
127 | { | 130 | { |
128 | m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString()); | 131 | m_log.ErrorFormat( |
129 | return "Unexpected result "+replyData["Result"].ToString(); | 132 | "[GRID CONNECTOR]: unexpected result {0} when contacting {1}", replyData["Result"], uri); |
133 | |||
134 | return "Unexpected result " + replyData["Result"].ToString(); | ||
130 | } | 135 | } |
131 | |||
132 | } | 136 | } |
133 | else | 137 | else |
134 | m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply"); | 138 | { |
139 | m_log.ErrorFormat( | ||
140 | "[GRID CONNECTOR]: RegisterRegion received null reply when contacting grid server at {0}", uri); | ||
141 | } | ||
135 | } | 142 | } |
136 | catch (Exception e) | 143 | catch (Exception e) |
137 | { | 144 | { |
138 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); | 145 | m_log.ErrorFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); |
139 | } | 146 | } |
140 | 147 | ||
141 | return "Error communicating with grid service"; | 148 | return string.Format("Error communicating with the grid service at {0}", uri); |
142 | } | 149 | } |
143 | 150 | ||
144 | public bool DeregisterRegion(UUID regionID) | 151 | public bool DeregisterRegion(UUID regionID) |
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index b6ec558..53fbea6 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | |||
@@ -107,9 +107,8 @@ namespace OpenSim.Services.HypergridService | |||
107 | public override List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) | 107 | public override List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) |
108 | { | 108 | { |
109 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | 109 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); |
110 | XInventoryFolder root = GetRootXFolder(principalID); | ||
111 | 110 | ||
112 | List<XInventoryFolder> tree = GetFolderTree(suitcase.folderID); | 111 | List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); |
113 | if (tree == null || (tree != null && tree.Count == 0)) | 112 | if (tree == null || (tree != null && tree.Count == 0)) |
114 | return null; | 113 | return null; |
115 | 114 | ||
@@ -119,7 +118,7 @@ namespace OpenSim.Services.HypergridService | |||
119 | folders.Add(ConvertToOpenSim(x)); | 118 | folders.Add(ConvertToOpenSim(x)); |
120 | } | 119 | } |
121 | 120 | ||
122 | SetAsRootFolder(suitcase, root); | 121 | SetAsNormalFolder(suitcase); |
123 | folders.Add(ConvertToOpenSim(suitcase)); | 122 | folders.Add(ConvertToOpenSim(suitcase)); |
124 | 123 | ||
125 | return folders; | 124 | return folders; |
@@ -134,12 +133,11 @@ namespace OpenSim.Services.HypergridService | |||
134 | userInventory.Items = new List<InventoryItemBase>(); | 133 | userInventory.Items = new List<InventoryItemBase>(); |
135 | 134 | ||
136 | XInventoryFolder suitcase = GetSuitcaseXFolder(userID); | 135 | XInventoryFolder suitcase = GetSuitcaseXFolder(userID); |
137 | XInventoryFolder root = GetRootXFolder(userID); | ||
138 | 136 | ||
139 | List<XInventoryFolder> tree = GetFolderTree(suitcase.folderID); | 137 | List<XInventoryFolder> tree = GetFolderTree(userID, suitcase.folderID); |
140 | if (tree == null || (tree != null && tree.Count == 0)) | 138 | if (tree == null || (tree != null && tree.Count == 0)) |
141 | { | 139 | { |
142 | SetAsRootFolder(suitcase, root); | 140 | SetAsNormalFolder(suitcase); |
143 | userInventory.Folders.Add(ConvertToOpenSim(suitcase)); | 141 | userInventory.Folders.Add(ConvertToOpenSim(suitcase)); |
144 | return userInventory; | 142 | return userInventory; |
145 | } | 143 | } |
@@ -164,7 +162,7 @@ namespace OpenSim.Services.HypergridService | |||
164 | userInventory.Items.AddRange(items); | 162 | userInventory.Items.AddRange(items); |
165 | } | 163 | } |
166 | 164 | ||
167 | SetAsRootFolder(suitcase, root); | 165 | SetAsNormalFolder(suitcase); |
168 | userInventory.Folders.Add(ConvertToOpenSim(suitcase)); | 166 | userInventory.Folders.Add(ConvertToOpenSim(suitcase)); |
169 | 167 | ||
170 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetUserInventory for user {0} returning {1} folders and {2} items", | 168 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetUserInventory for user {0} returning {1} folders and {2} items", |
@@ -175,14 +173,13 @@ namespace OpenSim.Services.HypergridService | |||
175 | public override InventoryFolderBase GetRootFolder(UUID principalID) | 173 | public override InventoryFolderBase GetRootFolder(UUID principalID) |
176 | { | 174 | { |
177 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID); | 175 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID); |
178 | if (m_Database == null) | ||
179 | m_log.ErrorFormat("[XXX]: m_Database is NULL!"); | ||
180 | 176 | ||
181 | // Let's find out the local root folder | 177 | // Let's find out the local root folder |
182 | XInventoryFolder root = GetRootXFolder(principalID); ; | 178 | XInventoryFolder root = GetRootXFolder(principalID); ; |
183 | if (root == null) | 179 | if (root == null) |
184 | { | 180 | { |
185 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve local root folder for user {0}", principalID); | 181 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve local root folder for user {0}", principalID); |
182 | return null; | ||
186 | } | 183 | } |
187 | 184 | ||
188 | // Warp! Root folder for travelers is the suitcase folder | 185 | // Warp! Root folder for travelers is the suitcase folder |
@@ -202,7 +199,7 @@ namespace OpenSim.Services.HypergridService | |||
202 | CreateSystemFolders(principalID, suitcase.folderID); | 199 | CreateSystemFolders(principalID, suitcase.folderID); |
203 | } | 200 | } |
204 | 201 | ||
205 | SetAsRootFolder(suitcase, root); | 202 | SetAsNormalFolder(suitcase); |
206 | 203 | ||
207 | return ConvertToOpenSim(suitcase); | 204 | return ConvertToOpenSim(suitcase); |
208 | } | 205 | } |
@@ -271,9 +268,8 @@ namespace OpenSim.Services.HypergridService | |||
271 | public override InventoryCollection GetFolderContent(UUID principalID, UUID folderID) | 268 | public override InventoryCollection GetFolderContent(UUID principalID, UUID folderID) |
272 | { | 269 | { |
273 | InventoryCollection coll = null; | 270 | InventoryCollection coll = null; |
274 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | ||
275 | 271 | ||
276 | if (!IsWithinSuitcaseTree(folderID, suitcase)) | 272 | if (!IsWithinSuitcaseTree(principalID, folderID)) |
277 | return new InventoryCollection(); | 273 | return new InventoryCollection(); |
278 | 274 | ||
279 | coll = base.GetFolderContent(principalID, folderID); | 275 | coll = base.GetFolderContent(principalID, folderID); |
@@ -290,9 +286,7 @@ namespace OpenSim.Services.HypergridService | |||
290 | { | 286 | { |
291 | // Let's do a bit of sanity checking, more than the base service does | 287 | // Let's do a bit of sanity checking, more than the base service does |
292 | // make sure the given folder exists under the suitcase tree of this user | 288 | // make sure the given folder exists under the suitcase tree of this user |
293 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | 289 | if (!IsWithinSuitcaseTree(principalID, folderID)) |
294 | |||
295 | if (!IsWithinSuitcaseTree(folderID, suitcase)) | ||
296 | return new List<InventoryItemBase>(); | 290 | return new List<InventoryItemBase>(); |
297 | 291 | ||
298 | return base.GetFolderItems(principalID, folderID); | 292 | return base.GetFolderItems(principalID, folderID); |
@@ -303,21 +297,27 @@ namespace OpenSim.Services.HypergridService | |||
303 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID); | 297 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID); |
304 | // Let's do a bit of sanity checking, more than the base service does | 298 | // Let's do a bit of sanity checking, more than the base service does |
305 | // make sure the given folder's parent folder exists under the suitcase tree of this user | 299 | // make sure the given folder's parent folder exists under the suitcase tree of this user |
306 | XInventoryFolder suitcase = GetSuitcaseXFolder(folder.Owner); | ||
307 | 300 | ||
308 | if (!IsWithinSuitcaseTree(folder.ParentID, suitcase)) | 301 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) |
309 | return false; | 302 | return false; |
310 | 303 | ||
311 | // OK, it's legit | 304 | // OK, it's legit |
312 | return base.AddFolder(folder); | 305 | if (base.AddFolder(folder)) |
306 | { | ||
307 | List<XInventoryFolder> tree; | ||
308 | if (m_SuitcaseTrees.TryGetValue(folder.Owner, out tree)) | ||
309 | tree.Add(ConvertFromOpenSim(folder)); | ||
310 | |||
311 | return true; | ||
312 | } | ||
313 | |||
314 | return false; | ||
313 | } | 315 | } |
314 | 316 | ||
315 | public override bool UpdateFolder(InventoryFolderBase folder) | 317 | public override bool UpdateFolder(InventoryFolderBase folder) |
316 | { | 318 | { |
317 | XInventoryFolder suitcase = GetSuitcaseXFolder(folder.Owner); | ||
318 | |||
319 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); | 319 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); |
320 | if (!IsWithinSuitcaseTree(folder.ID, suitcase)) | 320 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) |
321 | { | 321 | { |
322 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); | 322 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); |
323 | return false; | 323 | return false; |
@@ -329,9 +329,8 @@ namespace OpenSim.Services.HypergridService | |||
329 | 329 | ||
330 | public override bool MoveFolder(InventoryFolderBase folder) | 330 | public override bool MoveFolder(InventoryFolderBase folder) |
331 | { | 331 | { |
332 | XInventoryFolder suitcase = GetSuitcaseXFolder(folder.Owner); | 332 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID) || |
333 | 333 | !IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) | |
334 | if (!IsWithinSuitcaseTree(folder.ID, suitcase) || !IsWithinSuitcaseTree(folder.ParentID, suitcase)) | ||
335 | return false; | 334 | return false; |
336 | 335 | ||
337 | return base.MoveFolder(folder); | 336 | return base.MoveFolder(folder); |
@@ -353,9 +352,7 @@ namespace OpenSim.Services.HypergridService | |||
353 | { | 352 | { |
354 | // Let's do a bit of sanity checking, more than the base service does | 353 | // Let's do a bit of sanity checking, more than the base service does |
355 | // make sure the given folder's parent folder exists under the suitcase tree of this user | 354 | // make sure the given folder's parent folder exists under the suitcase tree of this user |
356 | XInventoryFolder suitcase = GetSuitcaseXFolder(item.Owner); | 355 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) |
357 | |||
358 | if (!IsWithinSuitcaseTree(item.Folder, suitcase)) | ||
359 | return false; | 356 | return false; |
360 | 357 | ||
361 | // OK, it's legit | 358 | // OK, it's legit |
@@ -365,9 +362,7 @@ namespace OpenSim.Services.HypergridService | |||
365 | 362 | ||
366 | public override bool UpdateItem(InventoryItemBase item) | 363 | public override bool UpdateItem(InventoryItemBase item) |
367 | { | 364 | { |
368 | XInventoryFolder suitcase = GetSuitcaseXFolder(item.Owner); | 365 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) |
369 | |||
370 | if (!IsWithinSuitcaseTree(item.Folder, suitcase)) | ||
371 | return false; | 366 | return false; |
372 | 367 | ||
373 | return base.UpdateItem(item); | 368 | return base.UpdateItem(item); |
@@ -377,9 +372,7 @@ namespace OpenSim.Services.HypergridService | |||
377 | { | 372 | { |
378 | // Principal is b0rked. *sigh* | 373 | // Principal is b0rked. *sigh* |
379 | 374 | ||
380 | XInventoryFolder suitcase = GetSuitcaseXFolder(items[0].Owner); | 375 | if (!IsWithinSuitcaseTree(items[0].Owner, items[0].Folder)) |
381 | |||
382 | if (!IsWithinSuitcaseTree(items[0].Folder, suitcase)) | ||
383 | return false; | 376 | return false; |
384 | 377 | ||
385 | return base.MoveItems(principalID, items); | 378 | return base.MoveItems(principalID, items); |
@@ -400,15 +393,8 @@ namespace OpenSim.Services.HypergridService | |||
400 | item.Name, item.ID, item.Folder); | 393 | item.Name, item.ID, item.Folder); |
401 | return null; | 394 | return null; |
402 | } | 395 | } |
403 | XInventoryFolder suitcase = GetSuitcaseXFolder(it.Owner); | ||
404 | if (suitcase == null) | ||
405 | { | ||
406 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Root or Suitcase are null for user {0}", | ||
407 | it.Owner); | ||
408 | return null; | ||
409 | } | ||
410 | 396 | ||
411 | if (!IsWithinSuitcaseTree(it.Folder, suitcase)) | 397 | if (!IsWithinSuitcaseTree(it.Owner, it.Folder)) |
412 | { | 398 | { |
413 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", | 399 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", |
414 | it.Name, it.Folder); | 400 | it.Name, it.Folder); |
@@ -431,9 +417,7 @@ namespace OpenSim.Services.HypergridService | |||
431 | 417 | ||
432 | if (f != null) | 418 | if (f != null) |
433 | { | 419 | { |
434 | XInventoryFolder suitcase = GetSuitcaseXFolder(f.Owner); | 420 | if (!IsWithinSuitcaseTree(f.Owner, f.ID)) |
435 | |||
436 | if (!IsWithinSuitcaseTree(f.ID, suitcase)) | ||
437 | return null; | 421 | return null; |
438 | } | 422 | } |
439 | 423 | ||
@@ -481,22 +465,37 @@ namespace OpenSim.Services.HypergridService | |||
481 | 465 | ||
482 | if (folders != null && folders.Length > 0) | 466 | if (folders != null && folders.Length > 0) |
483 | return folders[0]; | 467 | return folders[0]; |
468 | |||
469 | // check to see if we have the old Suitcase folder | ||
470 | folders = m_Database.GetFolders( | ||
471 | new string[] { "agentID", "folderName", "parentFolderID" }, | ||
472 | new string[] { principalID.ToString(), "My Suitcase", UUID.Zero.ToString() }); | ||
473 | if (folders != null && folders.Length > 0) | ||
474 | { | ||
475 | // Move it to under the root folder | ||
476 | XInventoryFolder root = GetRootXFolder(principalID); | ||
477 | folders[0].parentFolderID = root.folderID; | ||
478 | folders[0].type = 100; | ||
479 | m_Database.StoreFolder(folders[0]); | ||
480 | return folders[0]; | ||
481 | } | ||
482 | |||
484 | return null; | 483 | return null; |
485 | } | 484 | } |
486 | 485 | ||
487 | private void SetAsRootFolder(XInventoryFolder suitcase, XInventoryFolder root) | 486 | private void SetAsNormalFolder(XInventoryFolder suitcase) |
488 | { | 487 | { |
489 | suitcase.type = (short)AssetType.Folder; | 488 | suitcase.type = (short)AssetType.Folder; |
490 | } | 489 | } |
491 | 490 | ||
492 | private List<XInventoryFolder> GetFolderTree(UUID folder) | 491 | private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder) |
493 | { | 492 | { |
494 | List<XInventoryFolder> t = null; | 493 | List<XInventoryFolder> t = null; |
495 | if (m_SuitcaseTrees.TryGetValue(folder, out t)) | 494 | if (m_SuitcaseTrees.TryGetValue(principalID, out t)) |
496 | return t; | 495 | return t; |
497 | 496 | ||
498 | t = GetFolderTreeRecursive(folder); | 497 | t = GetFolderTreeRecursive(folder); |
499 | m_SuitcaseTrees.AddOrUpdate(folder, t, 120); | 498 | m_SuitcaseTrees.AddOrUpdate(principalID, t, 5*60); // 5minutes |
500 | return t; | 499 | return t; |
501 | } | 500 | } |
502 | 501 | ||
@@ -528,11 +527,18 @@ namespace OpenSim.Services.HypergridService | |||
528 | /// <param name="root"></param> | 527 | /// <param name="root"></param> |
529 | /// <param name="suitcase"></param> | 528 | /// <param name="suitcase"></param> |
530 | /// <returns></returns> | 529 | /// <returns></returns> |
531 | private bool IsWithinSuitcaseTree(UUID folderID, XInventoryFolder suitcase) | 530 | private bool IsWithinSuitcaseTree(UUID principalID, UUID folderID) |
532 | { | 531 | { |
532 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | ||
533 | if (suitcase == null) | ||
534 | { | ||
535 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder", principalID); | ||
536 | return false; | ||
537 | } | ||
538 | |||
533 | List<XInventoryFolder> tree = new List<XInventoryFolder>(); | 539 | List<XInventoryFolder> tree = new List<XInventoryFolder>(); |
534 | tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder | 540 | tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder |
535 | tree.AddRange(GetFolderTree(suitcase.folderID)); | 541 | tree.AddRange(GetFolderTree(principalID, suitcase.folderID)); |
536 | XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl) | 542 | XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl) |
537 | { | 543 | { |
538 | if (fl.folderID == folderID) return true; | 544 | if (fl.folderID == folderID) return true; |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 6fb9787..babd0ec 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -1129,7 +1129,7 @@ | |||
1129 | 1129 | ||
1130 | ; Maximum number of llListen events we allow over the entire region. | 1130 | ; Maximum number of llListen events we allow over the entire region. |
1131 | ; Set this to 0 to have no limit imposed | 1131 | ; Set this to 0 to have no limit imposed |
1132 | max_listeners_per_region = 1000 | 1132 | max_listens_per_region = 1000 |
1133 | 1133 | ||
1134 | ; Maximum number of llListen events we allow per script | 1134 | ; Maximum number of llListen events we allow per script |
1135 | ; Set this to 0 to have no limit imposed. | 1135 | ; Set this to 0 to have no limit imposed. |
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 2fd9f11..4ea5ffd 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example | |||
@@ -318,6 +318,14 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 | |||
318 | 318 | ||
319 | ; password help: optional: page providing password assistance for users of your grid | 319 | ; password help: optional: page providing password assistance for users of your grid |
320 | ;password = http://127.0.0.1/password | 320 | ;password = http://127.0.0.1/password |
321 | |||
322 | ; HG address of the gatekeeper, if you have one | ||
323 | ; this is the entry point for all the regions of the world | ||
324 | ; gatekeeper = http://127.0.0.1:8002/ | ||
325 | |||
326 | ; HG user domain, if you have one | ||
327 | ; this is the entry point for all user-related HG services | ||
328 | ; uas = http://127.0.0.1:8002/ | ||
321 | 329 | ||
322 | [GatekeeperService] | 330 | [GatekeeperService] |
323 | LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService" | 331 | LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService" |
diff --git a/bin/config-include/FlotsamCache.ini.example b/bin/config-include/FlotsamCache.ini.example index cd39f8c..b9c6d84 100644 --- a/bin/config-include/FlotsamCache.ini.example +++ b/bin/config-include/FlotsamCache.ini.example | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | ; How often {in hours} should the disk be checked for expired filed | 37 | ; How often {in hours} should the disk be checked for expired filed |
38 | ; Specify 0 to disable expiration checking | 38 | ; Specify 0 to disable expiration checking |
39 | FileCleanupTimer = .166 ;roughly every 10 minutes | 39 | FileCleanupTimer = 1.0 ;every hour |
40 | 40 | ||
41 | ; If WAIT_ON_INPROGRESS_REQUESTS has been defined then this specifies how | 41 | ; If WAIT_ON_INPROGRESS_REQUESTS has been defined then this specifies how |
42 | ; long (in miliseconds) to block a request thread while trying to complete | 42 | ; long (in miliseconds) to block a request thread while trying to complete |
@@ -60,4 +60,4 @@ | |||
60 | ; cache, and request all assets that are found that are not already cached (this | 60 | ; cache, and request all assets that are found that are not already cached (this |
61 | ; will cause those assets to be cached) | 61 | ; will cause those assets to be cached) |
62 | ; | 62 | ; |
63 | ; DeepScanBeforePurge = false | 63 | DeepScanBeforePurge = true |
diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index fa6f525..8d7f6fc 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example | |||
@@ -137,6 +137,10 @@ | |||
137 | ;; uncomment the next line. You may want to do this on sims that have licensed content. | 137 | ;; uncomment the next line. You may want to do this on sims that have licensed content. |
138 | ; OutboundPermission = False | 138 | ; OutboundPermission = False |
139 | 139 | ||
140 | [HGFriendsModule] | ||
141 | ; User level required to be able to send friendship invitations to foreign users | ||
142 | ;LevelHGFriends = 0; | ||
143 | |||
140 | [UserAgentService] | 144 | [UserAgentService] |
141 | ; | 145 | ; |
142 | ; === HG ONLY === | 146 | ; === HG ONLY === |
diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 8d9842c..e4bc548 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example | |||
@@ -61,6 +61,10 @@ | |||
61 | ;; uncomment the next line. You may want to do this on sims that have licensed content. | 61 | ;; uncomment the next line. You may want to do this on sims that have licensed content. |
62 | ; OutboundPermission = False | 62 | ; OutboundPermission = False |
63 | 63 | ||
64 | [HGFriendsModule] | ||
65 | ; User level required to be able to send friendship invitations to foreign users | ||
66 | ;LevelHGFriends = 0; | ||
67 | |||
64 | [GridService] | 68 | [GridService] |
65 | ;; For in-memory region storage (default) | 69 | ;; For in-memory region storage (default) |
66 | StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" | 70 | StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" |
@@ -231,6 +235,14 @@ | |||
231 | ; currently unused | 235 | ; currently unused |
232 | ;password = http://127.0.0.1/password | 236 | ;password = http://127.0.0.1/password |
233 | 237 | ||
238 | ; HG address of the gatekeeper, if you have one | ||
239 | ; this is the entry point for all the regions of the world | ||
240 | ; gatekeeper = http://127.0.0.1:9000/ | ||
241 | |||
242 | ; HG user domain, if you have one | ||
243 | ; this is the entry point for all user-related HG services | ||
244 | ; uas = http://127.0.0.1:9000/ | ||
245 | |||
234 | [MapImageService] | 246 | [MapImageService] |
235 | ; Set this if you want to change the default | 247 | ; Set this if you want to change the default |
236 | ; TilesStoragePath = "maptiles" | 248 | ; TilesStoragePath = "maptiles" |