Implementing updateinventoryfolder: Should now be able to rename folders in inventory

afrisby
Brian McBee 2007-12-11 03:51:32 +00:00
parent b7178ec241
commit 16903ec488
5 changed files with 40 additions and 0 deletions

View File

@ -127,6 +127,26 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
public void HandleUpdateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID)
{
CachedUserInfo userProfile;
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
{
if (userProfile.RootFolder != null)
{
InventoryFolderBase baseFolder = new InventoryFolderBase();
baseFolder.agentID = remoteClient.AgentId;
baseFolder.folderID = folderID;
baseFolder.name = name;
baseFolder.parentID = parentID;
baseFolder.type = (short)type;
baseFolder.version = userProfile.RootFolder.version;
m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder);
}
}
}
/// <summary> /// <summary>
/// Tell the client about the various child items and folders contained in the requested folder. /// Tell the client about the various child items and folders contained in the requested folder.
/// </summary> /// </summary>

View File

@ -327,6 +327,9 @@ namespace OpenSim.Framework
public delegate void CreateInventoryFolder( public delegate void CreateInventoryFolder(
IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID);
public delegate void UpdateInventoryFolder(
IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID);
public delegate void CreateNewInventoryItem( public delegate void CreateNewInventoryItem(
IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name,
sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask); sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask);
@ -428,6 +431,7 @@ namespace OpenSim.Framework
event CreateNewInventoryItem OnCreateNewInventoryItem; event CreateNewInventoryItem OnCreateNewInventoryItem;
event CreateInventoryFolder OnCreateNewInventoryFolder; event CreateInventoryFolder OnCreateNewInventoryFolder;
event UpdateInventoryFolder OnUpdateInventoryFolder;
event FetchInventoryDescendents OnFetchInventoryDescendents; event FetchInventoryDescendents OnFetchInventoryDescendents;
event PurgeInventoryDescendents OnPurgeInventoryDescendents; event PurgeInventoryDescendents OnPurgeInventoryDescendents;
event FetchInventory OnFetchInventory; event FetchInventory OnFetchInventory;

View File

@ -430,6 +430,7 @@ namespace OpenSim.Region.ClientStack
public event CreateNewInventoryItem OnCreateNewInventoryItem; public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder; public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event UpdateInventoryFolder OnUpdateInventoryFolder;
public event FetchInventoryDescendents OnFetchInventoryDescendents; public event FetchInventoryDescendents OnFetchInventoryDescendents;
public event PurgeInventoryDescendents OnPurgeInventoryDescendents; public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
public event FetchInventory OnFetchInventory; public event FetchInventory OnFetchInventory;
@ -2809,6 +2810,19 @@ namespace OpenSim.Region.ClientStack
invFolder.FolderData.ParentID); invFolder.FolderData.ParentID);
} }
break; break;
case PacketType.UpdateInventoryFolder:
if (OnUpdateInventoryFolder != null)
{
UpdateInventoryFolderPacket invFolder = (UpdateInventoryFolderPacket)Pack;
for (int i = 0; i < invFolder.FolderData.Length; i++)
{
OnUpdateInventoryFolder(this, invFolder.FolderData[i].FolderID,
(ushort)invFolder.FolderData[i].Type,
Util.FieldToString(invFolder.FolderData[i].Name),
invFolder.FolderData[i].ParentID);
}
}
break;
case PacketType.CreateInventoryItem: case PacketType.CreateInventoryItem:
CreateInventoryItemPacket createItem = (CreateInventoryItemPacket) Pack; CreateInventoryItemPacket createItem = (CreateInventoryItemPacket) Pack;
if (OnCreateNewInventoryItem != null) if (OnCreateNewInventoryItem != null)

View File

@ -1036,6 +1036,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnCreateNewInventoryItem += CreateNewInventoryItem; client.OnCreateNewInventoryItem += CreateNewInventoryItem;
client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder; client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder;
client.OnUpdateInventoryFolder += CommsManager.UserProfileCacheService.HandleUpdateInventoryFolder;
client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFetchInventoryDescendents; client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFetchInventoryDescendents;
client.OnPurgeInventoryDescendents += CommsManager.UserProfileCacheService.HandlePurgeInventoryDescendents; client.OnPurgeInventoryDescendents += CommsManager.UserProfileCacheService.HandlePurgeInventoryDescendents;
client.OnRequestTaskInventory += RequestTaskInventory; client.OnRequestTaskInventory += RequestTaskInventory;

View File

@ -107,6 +107,7 @@ namespace SimpleApp
public event CreateNewInventoryItem OnCreateNewInventoryItem; public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder; public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event UpdateInventoryFolder OnUpdateInventoryFolder;
public event FetchInventoryDescendents OnFetchInventoryDescendents; public event FetchInventoryDescendents OnFetchInventoryDescendents;
public event PurgeInventoryDescendents OnPurgeInventoryDescendents; public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
public event FetchInventory OnFetchInventory; public event FetchInventory OnFetchInventory;