diff options
author | Jeff Ames | 2008-05-16 01:22:11 +0000 |
---|---|---|
committer | Jeff Ames | 2008-05-16 01:22:11 +0000 |
commit | 65c5efe43b68700bad94076d4cd421160203c5de (patch) | |
tree | 589b56649ed02f4942671fd6e51c6dc43f682e0d /OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |
parent | Thank you very much, mjm for : (diff) | |
download | opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.zip opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.tar.gz opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.tar.bz2 opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.tar.xz |
Formatting cleanup.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 444 |
1 files changed, 222 insertions, 222 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 6aef45e..5e2ccec 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
40 | { | 40 | { |
41 | public partial class Scene | 41 | public partial class Scene |
42 | { | 42 | { |
43 | private static readonly ILog m_log | 43 | private static readonly ILog m_log |
44 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | /// <summary> | 46 | /// <summary> |
@@ -49,14 +49,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
49 | public void StartScripts() | 49 | public void StartScripts() |
50 | { | 50 | { |
51 | m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); | 51 | m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); |
52 | 52 | ||
53 | foreach (EntityBase group in Entities.Values) | 53 | foreach (EntityBase group in Entities.Values) |
54 | { | 54 | { |
55 | if (group is SceneObjectGroup) | 55 | if (group is SceneObjectGroup) |
56 | { | 56 | { |
57 | ((SceneObjectGroup) group).StartScripts(); | 57 | ((SceneObjectGroup) group).StartScripts(); |
58 | } | 58 | } |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
@@ -67,9 +67,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
67 | /// in which the item is to be placed.</param> | 67 | /// in which the item is to be placed.</param> |
68 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) | 68 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) |
69 | { | 69 | { |
70 | CachedUserInfo userInfo | 70 | CachedUserInfo userInfo |
71 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 71 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
72 | 72 | ||
73 | if (userInfo != null) | 73 | if (userInfo != null) |
74 | { | 74 | { |
75 | userInfo.AddItem(item); | 75 | userInfo.AddItem(item); |
@@ -91,17 +91,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
91 | m_log.ErrorFormat( | 91 | m_log.ErrorFormat( |
92 | "[AGENT INVENTORY]: Agent {0} {1} was not found for add of item {2} {3}", | 92 | "[AGENT INVENTORY]: Agent {0} {1} was not found for add of item {2} {3}", |
93 | remoteClient.Name, remoteClient.AgentId, item.Name, item.ID); | 93 | remoteClient.Name, remoteClient.AgentId, item.Name, item.ID); |
94 | 94 | ||
95 | return; | 95 | return; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | /// <summary> | 99 | /// <summary> |
100 | /// <see>AddInventoryItem(LLUUID, InventoryItemBase)</see> | 100 | /// <see>AddInventoryItem(LLUUID, InventoryItemBase)</see> |
101 | /// </summary> | 101 | /// </summary> |
102 | /// <param name="avatarId">The ID of the avatar</param> | 102 | /// <param name="avatarId">The ID of the avatar</param> |
103 | /// <param name="item">The item. This structure contains all the item metadata, including the folder | 103 | /// <param name="item">The item. This structure contains all the item metadata, including the folder |
104 | /// in which the item is to be placed.</param> | 104 | /// in which the item is to be placed.</param> |
105 | public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) | 105 | public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) |
106 | { | 106 | { |
107 | ScenePresence avatar; | 107 | ScenePresence avatar; |
@@ -131,7 +131,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
131 | if (userInfo.RootFolder != null) | 131 | if (userInfo.RootFolder != null) |
132 | { | 132 | { |
133 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 133 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); |
134 | 134 | ||
135 | if (item != null) | 135 | if (item != null) |
136 | { | 136 | { |
137 | AssetBase asset = | 137 | AssetBase asset = |
@@ -188,13 +188,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
188 | /// <param name="itemID"></param> | 188 | /// <param name="itemID"></param> |
189 | /// <param name="primID">The prim which contains the item to update</param> | 189 | /// <param name="primID">The prim which contains the item to update</param> |
190 | /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param> | 190 | /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param> |
191 | /// <param name="data"></param> | 191 | /// <param name="data"></param> |
192 | public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, LLUUID itemId, | 192 | public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, LLUUID itemId, |
193 | LLUUID primId, bool isScriptRunning, byte[] data) | 193 | LLUUID primId, bool isScriptRunning, byte[] data) |
194 | { | 194 | { |
195 | // Retrieve group | 195 | // Retrieve group |
196 | SceneObjectPart part = GetSceneObjectPart(primId); | 196 | SceneObjectPart part = GetSceneObjectPart(primId); |
197 | SceneObjectGroup group = part.ParentGroup; | 197 | SceneObjectGroup group = part.ParentGroup; |
198 | if (null == group) | 198 | if (null == group) |
199 | { | 199 | { |
200 | m_log.ErrorFormat( | 200 | m_log.ErrorFormat( |
@@ -204,36 +204,36 @@ namespace OpenSim.Region.Environment.Scenes | |||
204 | 204 | ||
205 | return; | 205 | return; |
206 | } | 206 | } |
207 | 207 | ||
208 | // Retrieve item | 208 | // Retrieve item |
209 | TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemId); | 209 | TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemId); |
210 | if (null == item) | 210 | if (null == item) |
211 | { | 211 | { |
212 | return; | 212 | return; |
213 | } | 213 | } |
214 | 214 | ||
215 | // Create new asset | 215 | // Create new asset |
216 | // XXX Hardcoding the numbers is a temporary measure - need an enumeration for this | 216 | // XXX Hardcoding the numbers is a temporary measure - need an enumeration for this |
217 | // There may well be one in libsecondlife | 217 | // There may well be one in libsecondlife |
218 | AssetBase asset = CreateAsset(item.Name, item.Description, 10, 10, data); | 218 | AssetBase asset = CreateAsset(item.Name, item.Description, 10, 10, data); |
219 | AssetCache.AddAsset(asset); | 219 | AssetCache.AddAsset(asset); |
220 | 220 | ||
221 | // Update item with new asset | 221 | // Update item with new asset |
222 | item.AssetID = asset.FullID; | 222 | item.AssetID = asset.FullID; |
223 | group.UpdateInventoryItem(item); | 223 | group.UpdateInventoryItem(item); |
224 | group.GetProperties(remoteClient); | 224 | group.GetProperties(remoteClient); |
225 | 225 | ||
226 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) | 226 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) |
227 | if (isScriptRunning) | 227 | if (isScriptRunning) |
228 | { | 228 | { |
229 | group.StopScript(part.LocalId, item.ItemID); | 229 | group.StopScript(part.LocalId, item.ItemID); |
230 | group.StartScript(part.LocalId, item.ItemID); | 230 | group.StartScript(part.LocalId, item.ItemID); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | 233 | ||
234 | /// <summary> | 234 | /// <summary> |
235 | /// <see>CapsUpdateTaskInventoryScriptAsset(IClientAPI, LLUUID, LLUUID, bool, byte[])</see> | 235 | /// <see>CapsUpdateTaskInventoryScriptAsset(IClientAPI, LLUUID, LLUUID, bool, byte[])</see> |
236 | /// </summary> | 236 | /// </summary> |
237 | private void CapsUpdateTaskInventoryScriptAsset(LLUUID avatarId, LLUUID itemId, | 237 | private void CapsUpdateTaskInventoryScriptAsset(LLUUID avatarId, LLUUID itemId, |
238 | LLUUID primId, bool isScriptRunning, byte[] data) | 238 | LLUUID primId, bool isScriptRunning, byte[] data) |
239 | { | 239 | { |
@@ -276,7 +276,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
276 | if (userInfo != null && userInfo.RootFolder != null) | 276 | if (userInfo != null && userInfo.RootFolder != null) |
277 | { | 277 | { |
278 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 278 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); |
279 | 279 | ||
280 | if (item != null) | 280 | if (item != null) |
281 | { | 281 | { |
282 | if (LLUUID.Zero == transactionID) | 282 | if (LLUUID.Zero == transactionID) |
@@ -284,7 +284,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
284 | item.Name = itemUpd.Name; | 284 | item.Name = itemUpd.Name; |
285 | item.Description = itemUpd.Description; | 285 | item.Description = itemUpd.Description; |
286 | item.NextPermissions = itemUpd.NextPermissions; | 286 | item.NextPermissions = itemUpd.NextPermissions; |
287 | item.CurrentPermissions |= 8; // Slam! | 287 | item.CurrentPermissions |= 8; // Slam! |
288 | item.EveryOnePermissions = itemUpd.EveryOnePermissions; | 288 | item.EveryOnePermissions = itemUpd.EveryOnePermissions; |
289 | 289 | ||
290 | // TODO: Requires sanity checks | 290 | // TODO: Requires sanity checks |
@@ -323,7 +323,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
323 | "[AGENT INVENTORY]: Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); | 323 | "[AGENT INVENTORY]: Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); |
324 | } | 324 | } |
325 | } | 325 | } |
326 | 326 | ||
327 | /// <summary> | 327 | /// <summary> |
328 | /// Give an inventory item from one avatar to another | 328 | /// Give an inventory item from one avatar to another |
329 | /// </summary> | 329 | /// </summary> |
@@ -333,35 +333,35 @@ namespace OpenSim.Region.Environment.Scenes | |||
333 | public void GiveInventoryItem(IClientAPI recipientClient, LLUUID senderId, LLUUID itemId) | 333 | public void GiveInventoryItem(IClientAPI recipientClient, LLUUID senderId, LLUUID itemId) |
334 | { | 334 | { |
335 | // Retrieve the item from the sender | 335 | // Retrieve the item from the sender |
336 | CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId); | 336 | CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId); |
337 | 337 | ||
338 | if (senderUserInfo == null) | 338 | if (senderUserInfo == null) |
339 | { | 339 | { |
340 | m_log.ErrorFormat( | 340 | m_log.ErrorFormat( |
341 | "[AGENT INVENTORY]: Failed to find sending user {0} for item {1}", senderId, itemId); | 341 | "[AGENT INVENTORY]: Failed to find sending user {0} for item {1}", senderId, itemId); |
342 | 342 | ||
343 | return; | 343 | return; |
344 | } | 344 | } |
345 | 345 | ||
346 | if (senderUserInfo.RootFolder != null) | 346 | if (senderUserInfo.RootFolder != null) |
347 | { | 347 | { |
348 | InventoryItemBase item = senderUserInfo.RootFolder.FindItem(itemId); | 348 | InventoryItemBase item = senderUserInfo.RootFolder.FindItem(itemId); |
349 | 349 | ||
350 | if (item != null) | 350 | if (item != null) |
351 | { | 351 | { |
352 | if (!ExternalChecks.ExternalChecksBypassPermissions()) | 352 | if (!ExternalChecks.ExternalChecksBypassPermissions()) |
353 | { | 353 | { |
354 | if((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 354 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) |
355 | return; | 355 | return; |
356 | } | 356 | } |
357 | 357 | ||
358 | // TODO get recipient's root folder | 358 | // TODO get recipient's root folder |
359 | CachedUserInfo recipientUserInfo | 359 | CachedUserInfo recipientUserInfo |
360 | = CommsManager.UserProfileCacheService.GetUserDetails(recipientClient.AgentId); | 360 | = CommsManager.UserProfileCacheService.GetUserDetails(recipientClient.AgentId); |
361 | 361 | ||
362 | if (recipientUserInfo != null) | 362 | if (recipientUserInfo != null) |
363 | { | 363 | { |
364 | // Insert a copy of the item into the recipient | 364 | // Insert a copy of the item into the recipient |
365 | InventoryItemBase itemCopy = new InventoryItemBase(); | 365 | InventoryItemBase itemCopy = new InventoryItemBase(); |
366 | itemCopy.Owner = recipientClient.AgentId; | 366 | itemCopy.Owner = recipientClient.AgentId; |
367 | itemCopy.Creator = senderId; | 367 | itemCopy.Creator = senderId; |
@@ -372,37 +372,37 @@ namespace OpenSim.Region.Environment.Scenes | |||
372 | itemCopy.AssetType = item.AssetType; | 372 | itemCopy.AssetType = item.AssetType; |
373 | itemCopy.InvType = item.InvType; | 373 | itemCopy.InvType = item.InvType; |
374 | itemCopy.Folder = recipientUserInfo.RootFolder.ID; | 374 | itemCopy.Folder = recipientUserInfo.RootFolder.ID; |
375 | if (ExternalChecks.ExternalChecksPropagatePermissions()) | 375 | if (ExternalChecks.ExternalChecksPropagatePermissions()) |
376 | { | 376 | { |
377 | if(item.InvType == 6) | 377 | if (item.InvType == 6) |
378 | { | 378 | { |
379 | itemCopy.BasePermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); | 379 | itemCopy.BasePermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); |
380 | itemCopy.BasePermissions |= (item.CurrentPermissions & 7) << 13; | 380 | itemCopy.BasePermissions |= (item.CurrentPermissions & 7) << 13; |
381 | } | 381 | } |
382 | else | 382 | else |
383 | { | 383 | { |
384 | Console.WriteLine("Non-Prim item ==>"); | 384 | Console.WriteLine("Non-Prim item ==>"); |
385 | itemCopy.BasePermissions = item.BasePermissions & item.NextPermissions; | 385 | itemCopy.BasePermissions = item.BasePermissions & item.NextPermissions; |
386 | } | 386 | } |
387 | 387 | ||
388 | itemCopy.CurrentPermissions = itemCopy.BasePermissions; | 388 | itemCopy.CurrentPermissions = itemCopy.BasePermissions; |
389 | if((item.CurrentPermissions & 8) != 0) // Propagate slam bit | 389 | if ((item.CurrentPermissions & 8) != 0) // Propagate slam bit |
390 | { | 390 | { |
391 | itemCopy.CurrentPermissions = item.NextPermissions; | 391 | itemCopy.CurrentPermissions = item.NextPermissions; |
392 | itemCopy.BasePermissions=itemCopy.CurrentPermissions; | 392 | itemCopy.BasePermissions=itemCopy.CurrentPermissions; |
393 | itemCopy.CurrentPermissions |= 8; | 393 | itemCopy.CurrentPermissions |= 8; |
394 | } | 394 | } |
395 | 395 | ||
396 | itemCopy.NextPermissions = item.NextPermissions; | 396 | itemCopy.NextPermissions = item.NextPermissions; |
397 | itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions; | 397 | itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions; |
398 | } | 398 | } |
399 | else | 399 | else |
400 | { | 400 | { |
401 | itemCopy.CurrentPermissions = item.CurrentPermissions; | 401 | itemCopy.CurrentPermissions = item.CurrentPermissions; |
402 | itemCopy.NextPermissions = item.NextPermissions; | 402 | itemCopy.NextPermissions = item.NextPermissions; |
403 | itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions; | 403 | itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions; |
404 | itemCopy.BasePermissions = item.BasePermissions; | 404 | itemCopy.BasePermissions = item.BasePermissions; |
405 | } | 405 | } |
406 | itemCopy.GroupID = item.GroupID; | 406 | itemCopy.GroupID = item.GroupID; |
407 | itemCopy.GroupOwned = item.GroupOwned; | 407 | itemCopy.GroupOwned = item.GroupOwned; |
408 | itemCopy.Flags = item.Flags; | 408 | itemCopy.Flags = item.Flags; |
@@ -410,21 +410,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
410 | itemCopy.SaleType = item.SaleType; | 410 | itemCopy.SaleType = item.SaleType; |
411 | 411 | ||
412 | recipientUserInfo.AddItem(itemCopy); | 412 | recipientUserInfo.AddItem(itemCopy); |
413 | 413 | ||
414 | if (!ExternalChecks.ExternalChecksBypassPermissions()) | 414 | if (!ExternalChecks.ExternalChecksBypassPermissions()) |
415 | { | 415 | { |
416 | if((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 416 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
417 | senderUserInfo.DeleteItem(itemId); | 417 | senderUserInfo.DeleteItem(itemId); |
418 | } | 418 | } |
419 | 419 | ||
420 | // Let the recipient client know about this new item | 420 | // Let the recipient client know about this new item |
421 | recipientClient.SendBulkUpdateInventory(itemCopy); | 421 | recipientClient.SendBulkUpdateInventory(itemCopy); |
422 | } | 422 | } |
423 | else | 423 | else |
424 | { | 424 | { |
425 | m_log.ErrorFormat( | 425 | m_log.ErrorFormat( |
426 | "[AGENT INVENTORY]: Could not find userinfo for recipient user {0}, {1} of item {2}, {3} from {4}", | 426 | "[AGENT INVENTORY]: Could not find userinfo for recipient user {0}, {1} of item {2}, {3} from {4}", |
427 | recipientClient.Name, recipientClient.AgentId, item.Name, | 427 | recipientClient.Name, recipientClient.AgentId, item.Name, |
428 | item.ID, senderId); | 428 | item.ID, senderId); |
429 | } | 429 | } |
430 | } | 430 | } |
@@ -432,7 +432,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
432 | { | 432 | { |
433 | m_log.ErrorFormat( | 433 | m_log.ErrorFormat( |
434 | "[AGENT INVENTORY]: Failed to find item {0} to give to {1}", itemId, senderId); | 434 | "[AGENT INVENTORY]: Failed to find item {0} to give to {1}", itemId, senderId); |
435 | 435 | ||
436 | return; | 436 | return; |
437 | } | 437 | } |
438 | } | 438 | } |
@@ -440,7 +440,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
440 | { | 440 | { |
441 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder"); | 441 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder"); |
442 | return; | 442 | return; |
443 | } | 443 | } |
444 | } | 444 | } |
445 | 445 | ||
446 | public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, | 446 | public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, |
@@ -449,9 +449,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
449 | m_log.DebugFormat( | 449 | m_log.DebugFormat( |
450 | "[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}", | 450 | "[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}", |
451 | remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName); | 451 | remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName); |
452 | 452 | ||
453 | InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.FindItem(oldItemID); | 453 | InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.FindItem(oldItemID); |
454 | 454 | ||
455 | if (item == null) | 455 | if (item == null) |
456 | { | 456 | { |
457 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID); | 457 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID); |
@@ -464,7 +464,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
464 | if (userInfo.RootFolder != null) | 464 | if (userInfo.RootFolder != null) |
465 | { | 465 | { |
466 | item = userInfo.RootFolder.FindItem(oldItemID); | 466 | item = userInfo.RootFolder.FindItem(oldItemID); |
467 | 467 | ||
468 | if (item == null) | 468 | if (item == null) |
469 | { | 469 | { |
470 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString()); | 470 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString()); |
@@ -477,29 +477,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
477 | return; | 477 | return; |
478 | } | 478 | } |
479 | } | 479 | } |
480 | 480 | ||
481 | AssetBase asset | 481 | AssetBase asset |
482 | = AssetCache.GetAsset( | 482 | = AssetCache.GetAsset( |
483 | item.AssetID, (item.AssetType == (int)AssetType.Texture ? true : false)); | 483 | item.AssetID, (item.AssetType == (int)AssetType.Texture ? true : false)); |
484 | 484 | ||
485 | if (asset != null) | 485 | if (asset != null) |
486 | { | 486 | { |
487 | if(remoteClient.AgentId == oldAgentID) | 487 | if (remoteClient.AgentId == oldAgentID) |
488 | { | 488 | { |
489 | CreateNewInventoryItem( | 489 | CreateNewInventoryItem( |
490 | remoteClient, newFolderID, callbackID, asset, item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions); | 490 | remoteClient, newFolderID, callbackID, asset, item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions); |
491 | } | 491 | } |
492 | else | 492 | else |
493 | { | 493 | { |
494 | CreateNewInventoryItem( | 494 | CreateNewInventoryItem( |
495 | remoteClient, newFolderID, callbackID, asset, item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions); | 495 | remoteClient, newFolderID, callbackID, asset, item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions); |
496 | } | 496 | } |
497 | } | 497 | } |
498 | else | 498 | else |
499 | { | 499 | { |
500 | m_log.ErrorFormat( | 500 | m_log.ErrorFormat( |
501 | "[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found", | 501 | "[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found", |
502 | item.Name, item.AssetID); | 502 | item.Name, item.AssetID); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
@@ -530,18 +530,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
530 | "[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId); | 530 | "[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId); |
531 | 531 | ||
532 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 532 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
533 | 533 | ||
534 | if (userInfo == null) | 534 | if (userInfo == null) |
535 | { | 535 | { |
536 | m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); | 536 | m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); |
537 | 537 | ||
538 | return; | 538 | return; |
539 | } | 539 | } |
540 | 540 | ||
541 | if (userInfo.RootFolder != null) | 541 | if (userInfo.RootFolder != null) |
542 | { | 542 | { |
543 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 543 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); |
544 | 544 | ||
545 | if (item != null) | 545 | if (item != null) |
546 | { | 546 | { |
547 | if (newName != String.Empty) | 547 | if (newName != String.Empty) |
@@ -549,7 +549,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
549 | item.Name = newName; | 549 | item.Name = newName; |
550 | } | 550 | } |
551 | item.Folder = folderID; | 551 | item.Folder = folderID; |
552 | 552 | ||
553 | userInfo.DeleteItem(item.ID); | 553 | userInfo.DeleteItem(item.ID); |
554 | 554 | ||
555 | AddInventoryItem(remoteClient, item); | 555 | AddInventoryItem(remoteClient, item); |
@@ -557,23 +557,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
557 | else | 557 | else |
558 | { | 558 | { |
559 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString()); | 559 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString()); |
560 | 560 | ||
561 | return; | 561 | return; |
562 | } | 562 | } |
563 | } | 563 | } |
564 | else | 564 | else |
565 | { | 565 | { |
566 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString() + ", no root folder"); | 566 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString() + ", no root folder"); |
567 | 567 | ||
568 | return; | 568 | return; |
569 | } | 569 | } |
570 | } | 570 | } |
571 | 571 | ||
572 | private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, | 572 | private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, |
573 | AssetBase asset, uint nextOwnerMask) | 573 | AssetBase asset, uint nextOwnerMask) |
574 | { | 574 | { |
575 | CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask, nextOwnerMask, 0, nextOwnerMask); | 575 | CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask, nextOwnerMask, 0, nextOwnerMask); |
576 | } | 576 | } |
577 | 577 | ||
578 | /// <summary> | 578 | /// <summary> |
579 | /// Create a new inventory item. | 579 | /// Create a new inventory item. |
@@ -586,9 +586,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
586 | private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, | 586 | private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, |
587 | AssetBase asset, uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask) | 587 | AssetBase asset, uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask) |
588 | { | 588 | { |
589 | CachedUserInfo userInfo | 589 | CachedUserInfo userInfo |
590 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 590 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
591 | 591 | ||
592 | if (userInfo != null) | 592 | if (userInfo != null) |
593 | { | 593 | { |
594 | InventoryItemBase item = new InventoryItemBase(); | 594 | InventoryItemBase item = new InventoryItemBase(); |
@@ -603,8 +603,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
603 | item.Folder = folderID; | 603 | item.Folder = folderID; |
604 | item.CurrentPermissions = currentMask; | 604 | item.CurrentPermissions = currentMask; |
605 | item.NextPermissions = nextOwnerMask; | 605 | item.NextPermissions = nextOwnerMask; |
606 | item.EveryOnePermissions = everyoneMask; | 606 | item.EveryOnePermissions = everyoneMask; |
607 | item.BasePermissions = baseMask; | 607 | item.BasePermissions = baseMask; |
608 | 608 | ||
609 | userInfo.AddItem(item); | 609 | userInfo.AddItem(item); |
610 | remoteClient.SendInventoryItemCreateUpdate(item); | 610 | remoteClient.SendInventoryItemCreateUpdate(item); |
@@ -612,7 +612,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
612 | else | 612 | else |
613 | { | 613 | { |
614 | m_log.WarnFormat( | 614 | m_log.WarnFormat( |
615 | "No user details associated with client {0} uuid {1} in CreateNewInventoryItem!", | 615 | "No user details associated with client {0} uuid {1} in CreateNewInventoryItem!", |
616 | remoteClient.Name, remoteClient.AgentId); | 616 | remoteClient.Name, remoteClient.AgentId); |
617 | } | 617 | } |
618 | } | 618 | } |
@@ -637,12 +637,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
637 | byte wearableType, uint nextOwnerMask) | 637 | byte wearableType, uint nextOwnerMask) |
638 | { | 638 | { |
639 | // m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item {0} in folder {1}", name, folderID); | 639 | // m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item {0} in folder {1}", name, folderID); |
640 | 640 | ||
641 | if (transactionID == LLUUID.Zero) | 641 | if (transactionID == LLUUID.Zero) |
642 | { | 642 | { |
643 | CachedUserInfo userInfo | 643 | CachedUserInfo userInfo |
644 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 644 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
645 | 645 | ||
646 | if (userInfo != null) | 646 | if (userInfo != null) |
647 | { | 647 | { |
648 | ScenePresence presence; | 648 | ScenePresence presence; |
@@ -666,7 +666,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
666 | else | 666 | else |
667 | { | 667 | { |
668 | m_log.ErrorFormat( | 668 | m_log.ErrorFormat( |
669 | "userInfo for agent uuid {0} unexpectedly null in CreateNewInventoryItem", | 669 | "userInfo for agent uuid {0} unexpectedly null in CreateNewInventoryItem", |
670 | remoteClient.AgentId); | 670 | remoteClient.AgentId); |
671 | } | 671 | } |
672 | } | 672 | } |
@@ -677,10 +677,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
677 | { | 677 | { |
678 | agentTransactions.HandleItemCreationFromTransaction( | 678 | agentTransactions.HandleItemCreationFromTransaction( |
679 | remoteClient, transactionID, folderID, callbackID, description, | 679 | remoteClient, transactionID, folderID, callbackID, description, |
680 | name, invType, assetType, wearableType, nextOwnerMask); | 680 | name, invType, assetType, wearableType, nextOwnerMask); |
681 | } | 681 | } |
682 | 682 | ||
683 | 683 | ||
684 | } | 684 | } |
685 | } | 685 | } |
686 | 686 | ||
@@ -693,13 +693,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
693 | { | 693 | { |
694 | CachedUserInfo userInfo | 694 | CachedUserInfo userInfo |
695 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 695 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
696 | 696 | ||
697 | if (userInfo == null) | 697 | if (userInfo == null) |
698 | { | 698 | { |
699 | m_log.WarnFormat( | 699 | m_log.WarnFormat( |
700 | "[AGENT INVENTORY]: Failed to find user {0} {1} to delete inventory item {2}", | 700 | "[AGENT INVENTORY]: Failed to find user {0} {1} to delete inventory item {2}", |
701 | remoteClient.Name, remoteClient.AgentId, itemID); | 701 | remoteClient.Name, remoteClient.AgentId, itemID); |
702 | 702 | ||
703 | return; | 703 | return; |
704 | } | 704 | } |
705 | 705 | ||
@@ -716,7 +716,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
716 | { | 716 | { |
717 | CachedUserInfo userInfo | 717 | CachedUserInfo userInfo |
718 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 718 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
719 | 719 | ||
720 | if (userInfo == null) | 720 | if (userInfo == null) |
721 | { | 721 | { |
722 | m_log.Warn("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); | 722 | m_log.Warn("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); |
@@ -726,13 +726,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
726 | if (userInfo.RootFolder != null) | 726 | if (userInfo.RootFolder != null) |
727 | { | 727 | { |
728 | InventoryItemBase folder = userInfo.RootFolder.FindItem(folderID); | 728 | InventoryItemBase folder = userInfo.RootFolder.FindItem(folderID); |
729 | 729 | ||
730 | if (folder != null) | 730 | if (folder != null) |
731 | { | 731 | { |
732 | m_log.WarnFormat( | 732 | m_log.WarnFormat( |
733 | "[AGENT INVENTORY]: Remove folder not implemented in request by {0} {1} for {2}", | 733 | "[AGENT INVENTORY]: Remove folder not implemented in request by {0} {1} for {2}", |
734 | remoteClient.Name, remoteClient.AgentId, folderID); | 734 | remoteClient.Name, remoteClient.AgentId, folderID); |
735 | 735 | ||
736 | // doesn't work just yet, commented out. will fix in next patch. | 736 | // doesn't work just yet, commented out. will fix in next patch. |
737 | // userInfo.DeleteItem(folder); | 737 | // userInfo.DeleteItem(folder); |
738 | } | 738 | } |
@@ -760,7 +760,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
760 | /// <param name="remoteClient"></param> | 760 | /// <param name="remoteClient"></param> |
761 | /// <param name="primLocalID"></param> | 761 | /// <param name="primLocalID"></param> |
762 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | 762 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) |
763 | { | 763 | { |
764 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 764 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
765 | if (group != null) | 765 | if (group != null) |
766 | { | 766 | { |
@@ -808,7 +808,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
808 | localID); | 808 | localID); |
809 | } | 809 | } |
810 | } | 810 | } |
811 | 811 | ||
812 | /// <summary> | 812 | /// <summary> |
813 | /// Move the given item in the given prim to a folder in the client's inventory | 813 | /// Move the given item in the given prim to a folder in the client's inventory |
814 | /// </summary> | 814 | /// </summary> |
@@ -819,33 +819,33 @@ namespace OpenSim.Region.Environment.Scenes | |||
819 | public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId) | 819 | public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId) |
820 | { | 820 | { |
821 | SceneObjectPart part = GetSceneObjectPart(primLocalId); | 821 | SceneObjectPart part = GetSceneObjectPart(primLocalId); |
822 | 822 | ||
823 | if (null == part) | 823 | if (null == part) |
824 | { | 824 | { |
825 | m_log.WarnFormat( | 825 | m_log.WarnFormat( |
826 | "[PRIM INVENTORY]: " + | 826 | "[PRIM INVENTORY]: " + |
827 | "Move of inventory item {0} from prim with local id {1} failed because the prim could not be found", | 827 | "Move of inventory item {0} from prim with local id {1} failed because the prim could not be found", |
828 | itemId, primLocalId); | 828 | itemId, primLocalId); |
829 | 829 | ||
830 | return; | 830 | return; |
831 | } | 831 | } |
832 | 832 | ||
833 | TaskInventoryItem taskItem = part.GetInventoryItem(itemId); | 833 | TaskInventoryItem taskItem = part.GetInventoryItem(itemId); |
834 | 834 | ||
835 | if (null == taskItem) | 835 | if (null == taskItem) |
836 | { | 836 | { |
837 | // Console already notified of error in GetInventoryItem | 837 | // Console already notified of error in GetInventoryItem |
838 | return; | 838 | return; |
839 | } | 839 | } |
840 | 840 | ||
841 | // Only owner can copy | 841 | // Only owner can copy |
842 | if (remoteClient.AgentId != taskItem.OwnerID) | 842 | if (remoteClient.AgentId != taskItem.OwnerID) |
843 | { | 843 | { |
844 | return; | 844 | return; |
845 | } | 845 | } |
846 | 846 | ||
847 | InventoryItemBase agentItem = new InventoryItemBase(); | 847 | InventoryItemBase agentItem = new InventoryItemBase(); |
848 | 848 | ||
849 | agentItem.ID = LLUUID.Random(); | 849 | agentItem.ID = LLUUID.Random(); |
850 | agentItem.Creator = taskItem.CreatorID; | 850 | agentItem.Creator = taskItem.CreatorID; |
851 | agentItem.Owner = remoteClient.AgentId; | 851 | agentItem.Owner = remoteClient.AgentId; |
@@ -855,33 +855,33 @@ namespace OpenSim.Region.Environment.Scenes | |||
855 | agentItem.AssetType = taskItem.Type; | 855 | agentItem.AssetType = taskItem.Type; |
856 | agentItem.InvType = taskItem.InvType; | 856 | agentItem.InvType = taskItem.InvType; |
857 | agentItem.Folder = folderId; | 857 | agentItem.Folder = folderId; |
858 | 858 | ||
859 | if ((remoteClient.AgentId != taskItem.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) | 859 | if ((remoteClient.AgentId != taskItem.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) |
860 | { | 860 | { |
861 | agentItem.BasePermissions = taskItem.NextOwnerMask; | 861 | agentItem.BasePermissions = taskItem.NextOwnerMask; |
862 | agentItem.CurrentPermissions = taskItem.NextOwnerMask; | 862 | agentItem.CurrentPermissions = taskItem.NextOwnerMask; |
863 | agentItem.NextPermissions = taskItem.NextOwnerMask; | 863 | agentItem.NextPermissions = taskItem.NextOwnerMask; |
864 | agentItem.EveryOnePermissions = taskItem.EveryoneMask & taskItem.NextOwnerMask; | 864 | agentItem.EveryOnePermissions = taskItem.EveryoneMask & taskItem.NextOwnerMask; |
865 | } | 865 | } |
866 | else | 866 | else |
867 | { | 867 | { |
868 | agentItem.BasePermissions = taskItem.BaseMask; | 868 | agentItem.BasePermissions = taskItem.BaseMask; |
869 | agentItem.CurrentPermissions = taskItem.OwnerMask; | 869 | agentItem.CurrentPermissions = taskItem.OwnerMask; |
870 | agentItem.NextPermissions = taskItem.NextOwnerMask; | 870 | agentItem.NextPermissions = taskItem.NextOwnerMask; |
871 | agentItem.EveryOnePermissions = taskItem.EveryoneMask; | 871 | agentItem.EveryOnePermissions = taskItem.EveryoneMask; |
872 | } | 872 | } |
873 | 873 | ||
874 | AddInventoryItem(remoteClient, agentItem); | 874 | AddInventoryItem(remoteClient, agentItem); |
875 | if (!ExternalChecks.ExternalChecksBypassPermissions()) | 875 | if (!ExternalChecks.ExternalChecksBypassPermissions()) |
876 | { | 876 | { |
877 | if((taskItem.OwnerMask & (uint)PermissionMask.Copy) == 0) | 877 | if ((taskItem.OwnerMask & (uint)PermissionMask.Copy) == 0) |
878 | part.RemoveInventoryItem(itemId); | 878 | part.RemoveInventoryItem(itemId); |
879 | } | 879 | } |
880 | 880 | ||
881 | } | 881 | } |
882 | 882 | ||
883 | /// <summary> | 883 | /// <summary> |
884 | /// Update an item in a prim (task) inventory. | 884 | /// Update an item in a prim (task) inventory. |
885 | /// This method does not handle scripts, <see>RezScript(IClientAPI, LLUUID, unit)</see> | 885 | /// This method does not handle scripts, <see>RezScript(IClientAPI, LLUUID, unit)</see> |
886 | /// </summary> | 886 | /// </summary> |
887 | /// <param name="remoteClient"></param> | 887 | /// <param name="remoteClient"></param> |
@@ -915,14 +915,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
915 | { | 915 | { |
916 | part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); | 916 | part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); |
917 | m_log.InfoFormat( | 917 | m_log.InfoFormat( |
918 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", | 918 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", |
919 | item.Name, primLocalID, remoteClient.Name); | 919 | item.Name, primLocalID, remoteClient.Name); |
920 | part.ParentGroup.GetProperties(remoteClient); | 920 | part.ParentGroup.GetProperties(remoteClient); |
921 | if (!ExternalChecks.ExternalChecksBypassPermissions()) | 921 | if (!ExternalChecks.ExternalChecksBypassPermissions()) |
922 | { | 922 | { |
923 | if((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 923 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
924 | RemoveInventoryItem(remoteClient, itemID); | 924 | RemoveInventoryItem(remoteClient, itemID); |
925 | } | 925 | } |
926 | } | 926 | } |
927 | else | 927 | else |
928 | { | 928 | { |
@@ -951,22 +951,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
951 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) | 951 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) |
952 | { | 952 | { |
953 | LLUUID copyID = LLUUID.Random(); | 953 | LLUUID copyID = LLUUID.Random(); |
954 | 954 | ||
955 | if (itemID != LLUUID.Zero) | 955 | if (itemID != LLUUID.Zero) |
956 | { | 956 | { |
957 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 957 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
958 | 958 | ||
959 | if (userInfo != null && userInfo.RootFolder != null) | 959 | if (userInfo != null && userInfo.RootFolder != null) |
960 | { | 960 | { |
961 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 961 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); |
962 | 962 | ||
963 | // Try library | 963 | // Try library |
964 | // XXX clumsy, possibly should be one call | 964 | // XXX clumsy, possibly should be one call |
965 | if (null == item) | 965 | if (null == item) |
966 | { | 966 | { |
967 | item = CommsManager.UserProfileCacheService.libraryRoot.FindItem(itemID); | 967 | item = CommsManager.UserProfileCacheService.libraryRoot.FindItem(itemID); |
968 | } | 968 | } |
969 | 969 | ||
970 | if (item != null) | 970 | if (item != null) |
971 | { | 971 | { |
972 | SceneObjectPart part = GetSceneObjectPart(localID); | 972 | SceneObjectPart part = GetSceneObjectPart(localID); |
@@ -975,7 +975,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
975 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); | 975 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); |
976 | part.ParentGroup.StartScript(localID, copyID); | 976 | part.ParentGroup.StartScript(localID, copyID); |
977 | part.ParentGroup.GetProperties(remoteClient); | 977 | part.ParentGroup.GetProperties(remoteClient); |
978 | 978 | ||
979 | // m_log.InfoFormat("[PRIMINVENTORY]: " + | 979 | // m_log.InfoFormat("[PRIMINVENTORY]: " + |
980 | // "Rezzed script {0} into prim local ID {1} for user {2}", | 980 | // "Rezzed script {0} into prim local ID {1} for user {2}", |
981 | // item.inventoryName, localID, remoteClient.Name); | 981 | // item.inventoryName, localID, remoteClient.Name); |
@@ -1000,10 +1000,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1000 | else // If the itemID is zero then the script has been rezzed directly in an object's inventory | 1000 | else // If the itemID is zero then the script has been rezzed directly in an object's inventory |
1001 | { | 1001 | { |
1002 | // not yet implemented | 1002 | // not yet implemented |
1003 | // TODO Need to get more details from original RezScript packet | 1003 | // TODO Need to get more details from original RezScript packet |
1004 | // XXX jc tmp | 1004 | // XXX jc tmp |
1005 | // AssetBase asset = CreateAsset("chimney sweep", "sailor.lsl", 10, 10, null); | 1005 | // AssetBase asset = CreateAsset("chimney sweep", "sailor.lsl", 10, 10, null); |
1006 | // AssetCache.AddAsset(asset); | 1006 | // AssetCache.AddAsset(asset); |
1007 | } | 1007 | } |
1008 | } | 1008 | } |
1009 | 1009 | ||
@@ -1023,11 +1023,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1023 | else | 1023 | else |
1024 | { | 1024 | { |
1025 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) | 1025 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) |
1026 | { | 1026 | { |
1027 | // m_log.DebugFormat( | 1027 | // m_log.DebugFormat( |
1028 | // "[AGENT INVENTORY]: Received request to derez {0} into folder {1}", | 1028 | // "[AGENT INVENTORY]: Received request to derez {0} into folder {1}", |
1029 | // Data.ObjectLocalID, DeRezPacket.AgentBlock.DestinationID); | 1029 | // Data.ObjectLocalID, DeRezPacket.AgentBlock.DestinationID); |
1030 | 1030 | ||
1031 | EntityBase selectedEnt = null; | 1031 | EntityBase selectedEnt = null; |
1032 | //m_log.Info("[CLIENT]: LocalID:" + Data.ObjectLocalID.ToString()); | 1032 | //m_log.Info("[CLIENT]: LocalID:" + Data.ObjectLocalID.ToString()); |
1033 | 1033 | ||
@@ -1046,9 +1046,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1046 | bool permissionToTake = false; | 1046 | bool permissionToTake = false; |
1047 | bool permissionToDelete = false; | 1047 | bool permissionToDelete = false; |
1048 | if (DeRezPacket.AgentBlock.Destination == 1)// Take Copy | 1048 | if (DeRezPacket.AgentBlock.Destination == 1)// Take Copy |
1049 | { | 1049 | { |
1050 | permissionToTake = ExternalChecks.ExternalChecksCanTakeCopyObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); | 1050 | permissionToTake = ExternalChecks.ExternalChecksCanTakeCopyObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); |
1051 | permissionToDelete = false; //Just taking copy! | 1051 | permissionToDelete = false; //Just taking copy! |
1052 | 1052 | ||
1053 | } | 1053 | } |
1054 | else if (DeRezPacket.AgentBlock.Destination == 4) //Take | 1054 | else if (DeRezPacket.AgentBlock.Destination == 4) //Take |
@@ -1094,27 +1094,27 @@ namespace OpenSim.Region.Environment.Scenes | |||
1094 | item.Folder = DeRezPacket.AgentBlock.DestinationID; | 1094 | item.Folder = DeRezPacket.AgentBlock.DestinationID; |
1095 | if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) | 1095 | if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) |
1096 | { | 1096 | { |
1097 | uint perms=objectGroup.GetEffectivePermissions(); | 1097 | uint perms=objectGroup.GetEffectivePermissions(); |
1098 | uint nextPerms=(perms & 7) << 13; | 1098 | uint nextPerms=(perms & 7) << 13; |
1099 | if((nextPerms & (uint)PermissionMask.Copy) == 0) | 1099 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) |
1100 | perms &= ~(uint)PermissionMask.Copy; | 1100 | perms &= ~(uint)PermissionMask.Copy; |
1101 | if((nextPerms & (uint)PermissionMask.Transfer) == 0) | 1101 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) |
1102 | perms &= ~(uint)PermissionMask.Transfer; | 1102 | perms &= ~(uint)PermissionMask.Transfer; |
1103 | if((nextPerms & (uint)PermissionMask.Modify) == 0) | 1103 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) |
1104 | perms &= ~(uint)PermissionMask.Modify; | 1104 | perms &= ~(uint)PermissionMask.Modify; |
1105 | 1105 | ||
1106 | item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; | 1106 | item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; |
1107 | item.CurrentPermissions = item.BasePermissions; | 1107 | item.CurrentPermissions = item.BasePermissions; |
1108 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | 1108 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; |
1109 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; | 1109 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; |
1110 | item.CurrentPermissions |= 8; // Slam! | 1110 | item.CurrentPermissions |= 8; // Slam! |
1111 | } | 1111 | } |
1112 | else | 1112 | else |
1113 | { | 1113 | { |
1114 | item.BasePermissions = objectGroup.GetEffectivePermissions(); | 1114 | item.BasePermissions = objectGroup.GetEffectivePermissions(); |
1115 | item.CurrentPermissions = objectGroup.GetEffectivePermissions(); | 1115 | item.CurrentPermissions = objectGroup.GetEffectivePermissions(); |
1116 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | 1116 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; |
1117 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; | 1117 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; |
1118 | } | 1118 | } |
1119 | 1119 | ||
1120 | // TODO: add the new fields (Flags, Sale info, etc) | 1120 | // TODO: add the new fields (Flags, Sale info, etc) |
@@ -1201,15 +1201,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1201 | item.BasePermissions = objectGroup.RootPart.NextOwnerMask; | 1201 | item.BasePermissions = objectGroup.RootPart.NextOwnerMask; |
1202 | item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; | 1202 | item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; |
1203 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | 1203 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; |
1204 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; | 1204 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; |
1205 | } | 1205 | } |
1206 | else | 1206 | else |
1207 | { | 1207 | { |
1208 | item.BasePermissions = objectGroup.GetEffectivePermissions(); | 1208 | item.BasePermissions = objectGroup.GetEffectivePermissions(); |
1209 | item.CurrentPermissions = objectGroup.GetEffectivePermissions(); | 1209 | item.CurrentPermissions = objectGroup.GetEffectivePermissions(); |
1210 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | 1210 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; |
1211 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; | 1211 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; |
1212 | } | 1212 | } |
1213 | 1213 | ||
1214 | userInfo.AddItem(item); | 1214 | userInfo.AddItem(item); |
1215 | 1215 | ||
@@ -1218,7 +1218,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1218 | { | 1218 | { |
1219 | remoteClient.SendInventoryItemCreateUpdate(item); | 1219 | remoteClient.SendInventoryItemCreateUpdate(item); |
1220 | } | 1220 | } |
1221 | 1221 | ||
1222 | } | 1222 | } |
1223 | } | 1223 | } |
1224 | } | 1224 | } |
@@ -1250,7 +1250,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1250 | item.Name = asset.Name; | 1250 | item.Name = asset.Name; |
1251 | item.AssetType = asset.Type; | 1251 | item.AssetType = asset.Type; |
1252 | item.InvType = asset.InvType; | 1252 | item.InvType = asset.InvType; |
1253 | 1253 | ||
1254 | // Sticking it in root folder for now.. objects folder later? | 1254 | // Sticking it in root folder for now.. objects folder later? |
1255 | 1255 | ||
1256 | item.Folder = userInfo.RootFolder.ID;// DeRezPacket.AgentBlock.DestinationID; | 1256 | item.Folder = userInfo.RootFolder.ID;// DeRezPacket.AgentBlock.DestinationID; |
@@ -1259,14 +1259,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1259 | item.BasePermissions = objectGroup.RootPart.NextOwnerMask; | 1259 | item.BasePermissions = objectGroup.RootPart.NextOwnerMask; |
1260 | item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; | 1260 | item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; |
1261 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | 1261 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; |
1262 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; | 1262 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; |
1263 | } | 1263 | } |
1264 | else | 1264 | else |
1265 | { | 1265 | { |
1266 | item.BasePermissions = objectGroup.RootPart.BaseMask; | 1266 | item.BasePermissions = objectGroup.RootPart.BaseMask; |
1267 | item.CurrentPermissions = objectGroup.RootPart.OwnerMask; | 1267 | item.CurrentPermissions = objectGroup.RootPart.OwnerMask; |
1268 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | 1268 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; |
1269 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; | 1269 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; |
1270 | } | 1270 | } |
1271 | 1271 | ||
1272 | userInfo.AddItem(item); | 1272 | userInfo.AddItem(item); |
@@ -1345,12 +1345,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1345 | 1345 | ||
1346 | LLVector3 scale = new LLVector3(0.5f, 0.5f, 0.5f); | 1346 | LLVector3 scale = new LLVector3(0.5f, 0.5f, 0.5f); |
1347 | 1347 | ||
1348 | 1348 | ||
1349 | LLVector3 pos = GetNewRezLocation( | 1349 | LLVector3 pos = GetNewRezLocation( |
1350 | RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), | 1350 | RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), |
1351 | BypassRayCast, bRayEndIsIntersection,true,scale, false); | 1351 | BypassRayCast, bRayEndIsIntersection,true,scale, false); |
1352 | 1352 | ||
1353 | 1353 | ||
1354 | 1354 | ||
1355 | // Rez object | 1355 | // Rez object |
1356 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 1356 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
@@ -1359,14 +1359,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1359 | if (userInfo.RootFolder != null) | 1359 | if (userInfo.RootFolder != null) |
1360 | { | 1360 | { |
1361 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 1361 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); |
1362 | 1362 | ||
1363 | if (item != null) | 1363 | if (item != null) |
1364 | { | 1364 | { |
1365 | AssetBase rezAsset = AssetCache.GetAsset(item.AssetID, false); | 1365 | AssetBase rezAsset = AssetCache.GetAsset(item.AssetID, false); |
1366 | 1366 | ||
1367 | if (rezAsset != null) | 1367 | if (rezAsset != null) |
1368 | { | 1368 | { |
1369 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); | 1369 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); |
1370 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | 1370 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); |
1371 | if (!ExternalChecks.ExternalChecksCanRezObject(group.Children.Count,remoteClient.AgentId, pos) && !attachment) | 1371 | if (!ExternalChecks.ExternalChecksCanRezObject(group.Children.Count,remoteClient.AgentId, pos) && !attachment) |
1372 | { | 1372 | { |
@@ -1401,10 +1401,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1401 | 1401 | ||
1402 | if (attachment) | 1402 | if (attachment) |
1403 | isAttachment = " Object was an attachment"; | 1403 | isAttachment = " Object was an attachment"; |
1404 | 1404 | ||
1405 | m_log.Error("[OJECTREZ]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); | 1405 | m_log.Error("[OJECTREZ]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); |
1406 | } | 1406 | } |
1407 | 1407 | ||
1408 | // Since renaming the item in the inventory does not affect the name stored | 1408 | // Since renaming the item in the inventory does not affect the name stored |
1409 | // in the serialization, transfer the correct name from the inventory to the | 1409 | // in the serialization, transfer the correct name from the inventory to the |
1410 | // object itself before we rez. | 1410 | // object itself before we rez. |
@@ -1413,18 +1413,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
1413 | 1413 | ||
1414 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | 1414 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); |
1415 | 1415 | ||
1416 | if(rootPart.OwnerID != item.Owner) | 1416 | if (rootPart.OwnerID != item.Owner) |
1417 | { | 1417 | { |
1418 | if((item.CurrentPermissions & 8) != 0) | 1418 | if ((item.CurrentPermissions & 8) != 0) |
1419 | { | 1419 | { |
1420 | foreach (SceneObjectPart part in partList) | 1420 | foreach (SceneObjectPart part in partList) |
1421 | { | 1421 | { |
1422 | part.EveryoneMask = item.EveryOnePermissions; | 1422 | part.EveryoneMask = item.EveryOnePermissions; |
1423 | part.NextOwnerMask = item.NextPermissions; | 1423 | part.NextOwnerMask = item.NextPermissions; |
1424 | } | 1424 | } |
1425 | } | 1425 | } |
1426 | group.ApplyNextOwnerPermissions(); | 1426 | group.ApplyNextOwnerPermissions(); |
1427 | } | 1427 | } |
1428 | 1428 | ||
1429 | foreach (SceneObjectPart part in partList) | 1429 | foreach (SceneObjectPart part in partList) |
1430 | { | 1430 | { |
@@ -1434,13 +1434,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1434 | part.OwnerID = item.Owner; | 1434 | part.OwnerID = item.Owner; |
1435 | part.ChangeInventoryOwner(item.Owner); | 1435 | part.ChangeInventoryOwner(item.Owner); |
1436 | } | 1436 | } |
1437 | else if(((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam! | 1437 | else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam! |
1438 | { | 1438 | { |
1439 | part.EveryoneMask = item.EveryOnePermissions; | 1439 | part.EveryoneMask = item.EveryOnePermissions; |
1440 | part.NextOwnerMask = item.NextPermissions; | 1440 | part.NextOwnerMask = item.NextPermissions; |
1441 | } | 1441 | } |
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | rootPart.TrimPermissions(); | 1444 | rootPart.TrimPermissions(); |
1445 | 1445 | ||
1446 | if (!attachment) | 1446 | if (!attachment) |
@@ -1451,11 +1451,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1451 | } | 1451 | } |
1452 | group.ApplyPhysics(m_physicalPrim); | 1452 | group.ApplyPhysics(m_physicalPrim); |
1453 | } | 1453 | } |
1454 | 1454 | ||
1455 | 1455 | ||
1456 | group.StartScripts(); | 1456 | group.StartScripts(); |
1457 | 1457 | ||
1458 | 1458 | ||
1459 | if (!attachment) | 1459 | if (!attachment) |
1460 | rootPart.ScheduleFullUpdate(); | 1460 | rootPart.ScheduleFullUpdate(); |
1461 | 1461 | ||
@@ -1505,18 +1505,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
1505 | 1505 | ||
1506 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | 1506 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); |
1507 | 1507 | ||
1508 | if(rootPart.OwnerID != item.OwnerID) | 1508 | if (rootPart.OwnerID != item.OwnerID) |
1509 | { | 1509 | { |
1510 | if((item.OwnerMask & 8) != 0) | 1510 | if ((item.OwnerMask & 8) != 0) |
1511 | { | 1511 | { |
1512 | foreach (SceneObjectPart part in partList) | 1512 | foreach (SceneObjectPart part in partList) |
1513 | { | 1513 | { |
1514 | part.EveryoneMask = item.EveryoneMask; | 1514 | part.EveryoneMask = item.EveryoneMask; |
1515 | part.NextOwnerMask = item.NextOwnerMask; | 1515 | part.NextOwnerMask = item.NextOwnerMask; |
1516 | } | 1516 | } |
1517 | } | 1517 | } |
1518 | group.ApplyNextOwnerPermissions(); | 1518 | group.ApplyNextOwnerPermissions(); |
1519 | } | 1519 | } |
1520 | 1520 | ||
1521 | foreach (SceneObjectPart part in partList) | 1521 | foreach (SceneObjectPart part in partList) |
1522 | { | 1522 | { |
@@ -1526,11 +1526,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1526 | part.OwnerID = item.OwnerID; | 1526 | part.OwnerID = item.OwnerID; |
1527 | part.ChangeInventoryOwner(item.OwnerID); | 1527 | part.ChangeInventoryOwner(item.OwnerID); |
1528 | } | 1528 | } |
1529 | else if((item.OwnerMask & 8) != 0) // Slam! | 1529 | else if ((item.OwnerMask & 8) != 0) // Slam! |
1530 | { | 1530 | { |
1531 | part.EveryoneMask = item.EveryoneMask; | 1531 | part.EveryoneMask = item.EveryoneMask; |
1532 | part.NextOwnerMask = item.NextOwnerMask; | 1532 | part.NextOwnerMask = item.NextOwnerMask; |
1533 | } | 1533 | } |
1534 | } | 1534 | } |
1535 | rootPart.TrimPermissions(); | 1535 | rootPart.TrimPermissions(); |
1536 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | 1536 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) |
@@ -1548,6 +1548,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1548 | } | 1548 | } |
1549 | return null; | 1549 | return null; |
1550 | } | 1550 | } |
1551 | 1551 | ||
1552 | } | 1552 | } |
1553 | } | 1553 | } |