public InventoryFolderBase GetFolderAttributes(UUID folderId) { IInventoryProviderSelector inventorySelect = ProviderRegistry.Instance.Get <IInventoryProviderSelector>(); InventoryFolderBase folderInfo = inventorySelect.GetProvider(m_userProfile.ID).GetFolderAttributes(folderId); return(folderInfo); }
/// <summary> /// Handle a client request to update the inventory folder /// </summary> /// /// If the inventory service has not yet delievered the inventory /// for this user then the request will be queued. /// /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing, /// and needs to be changed. /// /// <param name="folderID"></param> /// <param name="type"></param> /// <param name="name"></param> /// <param name="parentID"></param> public bool UpdateFolder(InventoryFolderBase baseFolder) { IInventoryProviderSelector inventorySelect = ProviderRegistry.Instance.Get <IInventoryProviderSelector>(); inventorySelect.GetProvider(m_userProfile.ID).SaveFolder(baseFolder); return(true); }
/// <summary> /// Delete an item from the user's inventory /// /// If the inventory service has not yet delievered the inventory /// for this user then the request will be queued. /// </summary> /// <param name="item"></param> /// <returns> /// true on a successful delete or a if the request is queued. /// Returns false on an immediate failure /// </returns> public bool DeleteItem(InventoryItemBase item) { IInventoryProviderSelector selector = ProviderRegistry.Instance.Get <IInventoryProviderSelector>(); IInventoryStorage provider = selector.GetProvider(item.Owner); provider.PurgeItem(item); return(true); }
/// <summary> /// Find an appropriate folder for the given asset type /// </summary> /// <param name="type"></param> /// <returns>null if no appropriate folder exists</returns> public InventoryFolderBase FindFolderForType(int type) { InventoryFolderBase bestFolderForType; lock (_folderTypeCache) { _folderTypeCache.TryGetValue(type, out bestFolderForType); if (bestFolderForType != null) { return(bestFolderForType); } } IInventoryProviderSelector inventorySelect = ProviderRegistry.Instance.Get <IInventoryProviderSelector>(); IInventoryStorage provider = inventorySelect.GetProvider(m_userProfile.ID); try { bestFolderForType = provider.FindFolderForType(m_userProfile.ID, (AssetType)type); } catch { } if (bestFolderForType == null) { //next best folder will be the user root folder, it has to exist try { bestFolderForType = provider.FindFolderForType(m_userProfile.ID, (AssetType)FolderType.Root); } catch { } if (bestFolderForType == null) { throw new InventoryStorageException( String.Format("Can not retrieve a destination folder for types, user {0} has no root folder", m_userProfile.ID)); } } lock (_folderTypeCache) { if (_folderTypeCache.ContainsKey(type)) { _folderTypeCache[type] = bestFolderForType; } else { _folderTypeCache.Add(type, bestFolderForType); } } return(bestFolderForType); }
/// <summary> /// This method will delete the given folder and all the items and folders in it. /// </summary> /// If the inventory service has not yet delievered the inventory /// for this user then the request will be queued. /// /// <param name="folderID"></param> public bool PurgeFolder(InventoryFolderBase folder) { try { IInventoryProviderSelector inventorySelect = ProviderRegistry.Instance.Get <IInventoryProviderSelector>(); inventorySelect.GetProvider(m_userProfile.ID).PurgeFolder(folder); return(true); } catch (InventoryStorageException) { } return(false); }
// Searches the parentage tree for an ancestor folder with a matching type (e.g. Trash) public InventoryFolderBase FindTopLevelFolderFor(UUID folderID) { IInventoryProviderSelector inventorySelect = ProviderRegistry.Instance.Get <IInventoryProviderSelector>(); IInventoryStorage provider = inventorySelect.GetProvider(m_userProfile.ID); InventoryFolderBase folder; try { folder = provider.FindTopLevelFolderFor(m_userProfile.ID, folderID); } catch { folder = null; } return(folder); }
private void CollectCreatedAssetIdsFromUserInventory(UUID creatorId, C5.HashSet <UUID> retAssets) { IInventoryProviderSelector selector = ProviderRegistry.Instance.Get <IInventoryProviderSelector>(); IInventoryStorage provider = selector.GetProvider(creatorId); List <InventoryFolderBase> skel = provider.GetInventorySkeleton(creatorId); foreach (InventoryFolderBase folder in skel) { InventoryFolderBase fullFolder = provider.GetFolder(folder.ID); foreach (InventoryItemBase item in fullFolder.Items) { if (m_allowedCreatorIds.Contains(item.CreatorIdAsUuid)) { retAssets.Add(item.AssetID); } } } }
public bool CheckAttachmentCount(UUID botID, AvatarAppearance appearance, ILandObject parcel, UUID originalOwner, out string reason) { int landImpact = 0; foreach (AvatarAttachment attachment in appearance.GetAttachments()) { // get original itemID UUID origItemID = attachment.ItemID ^ botID; if (origItemID == UUID.Zero) { continue; } IInventoryProviderSelector inventorySelect = ProviderRegistry.Instance.Get <IInventoryProviderSelector>(); var provider = inventorySelect.GetProvider(originalOwner); InventoryItemBase item = provider.GetItem(origItemID, UUID.Zero); SceneObjectGroup grp = m_scene.GetObjectFromItem(item); if (grp != null) { if ((grp.GetEffectivePermissions(true) & (uint)PermissionMask.Copy) != (uint)PermissionMask.Copy) { continue;//No copy objects cannot be attached } landImpact += grp.LandImpact; } } if (!m_scene.CheckLandImpact(parcel, landImpact, out reason)) { //Cannot create bot on a parcel that does not allow for rezzing an object reason = "Attachments exceed the land impact limit for this " + reason + "."; return(false); } reason = null; return(true); }
public void InitialAttachmentRez(ScenePresence sp, List <AvatarAttachment> attachments, UUID originalOwner, bool isSavedOutfit) { ScenePresence ownerSP = null; //retrieve all attachments sp.Appearance.ClearAttachments(); foreach (AvatarAttachment attachment in attachments) { if (attachment.ItemID == UUID.Zero) { continue; } // Are we already attached? if (sp.Appearance.GetAttachmentForItem(attachment.ItemID) == null) { IInventoryProviderSelector inventorySelect = ProviderRegistry.Instance.Get <IInventoryProviderSelector>(); var provider = inventorySelect.GetProvider(originalOwner); InventoryItemBase item = provider.GetItem(attachment.ItemID, UUID.Zero); if ((item.CurrentPermissions & (uint)PermissionMask.Copy) != (uint)PermissionMask.Copy) { if (ownerSP == null) { ownerSP = m_scene.GetScenePresence(originalOwner); } if (ownerSP != null) { ownerSP.ControllingClient.SendAgentAlertMessage("Bot cannot wear no-copy attachment: '" + item.Name + "'.", true); } continue;//No copy objects cannot be attached } SceneObjectGroup grp = m_scene.RezObject(sp.ControllingClient, sp.ControllingClient.ActiveGroupId, attachment.ItemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, false, false, sp.UUID, true, (uint)attachment.AttachPoint, 0, null, item, false); if (grp != null) { grp.OwnerID = sp.UUID; //Force UUID to botID, this should probably update the parts too, but right now they are separate grp.SetOwnerId(grp.OwnerID); // let's do this for safety and consistency. In case childpart.OwnerID is referenced, or rootpart.OwnerID bool tainted = false; if (attachment.AttachPoint != 0 && attachment.AttachPoint != grp.GetBestAttachmentPoint()) { tainted = true; } m_scene.SceneGraph.AttachObject(sp.ControllingClient, grp.LocalId, (uint)attachment.AttachPoint, true, false, AttachFlags.None); if (tainted) { grp.HasGroupChanged = true; } // Fire after attach, so we don't get messy perms dialogs // grp.CreateScriptInstances(0, ScriptStartFlags.PostOnRez, m_scene.DefaultScriptEngine, (int)ScriptStateSource.PrimData, null); attachment.AttachPoint = grp.RootPart.AttachmentPoint; UUID assetId = grp.UUID; sp.Appearance.SetAttachment((int)attachment.AttachPoint, true, attachment.ItemID, assetId); grp.DisableUpdates = false; grp.ScheduleGroupForFullUpdate(); } } } }
public void MoveItemToTrash(InventoryItemBase item, InventoryFolderBase trashFolder) { IInventoryProviderSelector inventorySelect = ProviderRegistry.Instance.Get <IInventoryProviderSelector>(); inventorySelect.GetProvider(item.Owner).SendItemToTrash(item, trashFolder.ID); }
/// <summary> /// Update an item in the user's inventory /// </summary> /// <param name="userID"></param> /// <param name="itemInfo"></param> public void UpdateItem(InventoryItemBase item) { IInventoryProviderSelector selector = ProviderRegistry.Instance.Get <IInventoryProviderSelector>(); selector.GetProvider(item.Owner).SaveItem(item); }