diff options
author | Brian McBee | 2007-12-15 04:57:14 +0000 |
---|---|---|
committer | Brian McBee | 2007-12-15 04:57:14 +0000 |
commit | 8a8c89a0f32b528bd588715bdbfc875c852e7187 (patch) | |
tree | b46cb20d03dfdb21a5cbdfa514a8e745070a3713 /OpenSim/Grid/InventoryServer | |
parent | Set svn:eol-style. Cleaned up set-eol-style.sh a bit. (diff) | |
download | opensim-SC_OLD-8a8c89a0f32b528bd588715bdbfc875c852e7187.zip opensim-SC_OLD-8a8c89a0f32b528bd588715bdbfc875c852e7187.tar.gz opensim-SC_OLD-8a8c89a0f32b528bd588715bdbfc875c852e7187.tar.bz2 opensim-SC_OLD-8a8c89a0f32b528bd588715bdbfc875c852e7187.tar.xz |
Grid Inventory feature upgrade: renaming folders should now be correct, subfolders work, moving folders works.
Tested only in MYSQL, but may work in MSSQL and sqlite.
Probably not working in standalone mode.
Diffstat (limited to 'OpenSim/Grid/InventoryServer')
-rw-r--r-- | OpenSim/Grid/InventoryServer/GridInventoryService.cs | 59 | ||||
-rw-r--r-- | OpenSim/Grid/InventoryServer/Main.cs | 4 |
2 files changed, 54 insertions, 9 deletions
diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index 8756ecb..6ae1d82 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs | |||
@@ -45,22 +45,33 @@ namespace OpenSim.Grid.InventoryServer | |||
45 | 45 | ||
46 | private bool TryGetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList, out List<InventoryItemBase> itemsList) | 46 | private bool TryGetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList, out List<InventoryItemBase> itemsList) |
47 | { | 47 | { |
48 | List<InventoryFolderBase> folders = RequestFirstLevelFolders(userID); | 48 | List<InventoryFolderBase> rootFolders = RequestFirstLevelFolders(userID); |
49 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); | 49 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); |
50 | List<InventoryFolderBase> allFolders = new List<InventoryFolderBase>(); | ||
50 | 51 | ||
51 | if (folders != null) | 52 | if (rootFolders != null) |
52 | { | 53 | { |
53 | foreach (InventoryFolderBase folder in folders) | 54 | allFolders.InsertRange(0, rootFolders); |
55 | foreach (InventoryFolderBase subfolder in rootFolders) | ||
54 | { | 56 | { |
55 | List<InventoryItemBase> items = RequestFolderItems(folder.folderID); | 57 | List<InventoryFolderBase> subFolders = GetAllFolders(subfolder.folderID); |
56 | if (items != null) | 58 | if (subFolders != null) |
57 | { | 59 | { |
58 | allItems.InsertRange(0, items); | 60 | allFolders.InsertRange(0, subFolders); |
59 | } | 61 | } |
60 | } | 62 | } |
61 | } | 63 | } |
62 | 64 | ||
63 | folderList = folders; | 65 | foreach (InventoryFolderBase folder in allFolders) |
66 | { | ||
67 | List<InventoryItemBase> items = RequestFolderItems(folder.folderID); | ||
68 | if (items != null) | ||
69 | { | ||
70 | allItems.InsertRange(0, items); | ||
71 | } | ||
72 | } | ||
73 | |||
74 | folderList = allFolders; | ||
64 | itemsList = allItems; | 75 | itemsList = allItems; |
65 | if (folderList != null) | 76 | if (folderList != null) |
66 | { | 77 | { |
@@ -72,6 +83,26 @@ namespace OpenSim.Grid.InventoryServer | |||
72 | } | 83 | } |
73 | } | 84 | } |
74 | 85 | ||
86 | private List<InventoryFolderBase> GetAllFolders(LLUUID folder) | ||
87 | { | ||
88 | List<InventoryFolderBase> allFolders = new List<InventoryFolderBase>(); | ||
89 | List<InventoryFolderBase> folders = RequestSubFolders(folder); | ||
90 | if (folders != null) | ||
91 | { | ||
92 | allFolders.InsertRange(0, folders); | ||
93 | foreach (InventoryFolderBase subfolder in folders) | ||
94 | { | ||
95 | List<InventoryFolderBase> subFolders = GetAllFolders(subfolder.folderID); | ||
96 | if (subFolders != null) | ||
97 | { | ||
98 | allFolders.InsertRange(0, subFolders); | ||
99 | } | ||
100 | } | ||
101 | } | ||
102 | return allFolders; | ||
103 | } | ||
104 | |||
105 | |||
75 | public InventoryCollection GetUserInventory(Guid rawUserID) | 106 | public InventoryCollection GetUserInventory(Guid rawUserID) |
76 | { | 107 | { |
77 | Console.WriteLine("Request for Inventory for " + rawUserID.ToString()); | 108 | Console.WriteLine("Request for Inventory for " + rawUserID.ToString()); |
@@ -104,6 +135,11 @@ namespace OpenSim.Grid.InventoryServer | |||
104 | AddFolder(folder); | 135 | AddFolder(folder); |
105 | } | 136 | } |
106 | 137 | ||
138 | public override void MoveExistingInventoryFolder(InventoryFolderBase folder) | ||
139 | { | ||
140 | MoveFolder(folder); | ||
141 | } | ||
142 | |||
107 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) | 143 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) |
108 | { | 144 | { |
109 | AddItem(item); | 145 | AddItem(item); |
@@ -111,11 +147,16 @@ namespace OpenSim.Grid.InventoryServer | |||
111 | 147 | ||
112 | public bool AddInventoryFolder( InventoryFolderBase folder) | 148 | public bool AddInventoryFolder( InventoryFolderBase folder) |
113 | { | 149 | { |
114 | Console.WriteLine("creating new folder for " + folder.agentID.ToString()); | ||
115 | AddNewInventoryFolder(folder.agentID, folder); | 150 | AddNewInventoryFolder(folder.agentID, folder); |
116 | return true; | 151 | return true; |
117 | } | 152 | } |
118 | 153 | ||
154 | public bool MoveInventoryFolder(InventoryFolderBase folder) | ||
155 | { | ||
156 | MoveExistingInventoryFolder(folder); | ||
157 | return true; | ||
158 | } | ||
159 | |||
119 | public bool AddInventoryItem( InventoryItemBase item) | 160 | public bool AddInventoryItem( InventoryItemBase item) |
120 | { | 161 | { |
121 | Console.WriteLine("creating new item for " + item.avatarID.ToString()); | 162 | Console.WriteLine("creating new item for " + item.avatarID.ToString()); |
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index 58b63f4..df854f9 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs | |||
@@ -88,6 +88,10 @@ namespace OpenSim.Grid.InventoryServer | |||
88 | m_inventoryService.AddInventoryFolder)); | 88 | m_inventoryService.AddInventoryFolder)); |
89 | 89 | ||
90 | httpServer.AddStreamHandler( | 90 | httpServer.AddStreamHandler( |
91 | new RestDeserialisehandler<InventoryFolderBase, bool>("POST", "/MoveFolder/", | ||
92 | m_inventoryService.MoveInventoryFolder)); | ||
93 | |||
94 | httpServer.AddStreamHandler( | ||
91 | new RestDeserialisehandler<InventoryItemBase, bool>("POST", "/NewItem/", | 95 | new RestDeserialisehandler<InventoryItemBase, bool>("POST", "/NewItem/", |
92 | m_inventoryService.AddInventoryItem)); | 96 | m_inventoryService.AddInventoryItem)); |
93 | httpServer.AddStreamHandler( | 97 | httpServer.AddStreamHandler( |