aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorBrian McBee2007-12-15 04:57:14 +0000
committerBrian McBee2007-12-15 04:57:14 +0000
commit8a8c89a0f32b528bd588715bdbfc875c852e7187 (patch)
treeb46cb20d03dfdb21a5cbdfa514a8e745070a3713 /OpenSim/Framework
parentSet svn:eol-style. Cleaned up set-eol-style.sh a bit. (diff)
downloadopensim-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/Framework')
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs10
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs32
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs1
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs20
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs28
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs22
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs32
-rw-r--r--OpenSim/Framework/IClientAPI.cs6
-rw-r--r--OpenSim/Framework/InventoryItemBase.cs6
9 files changed, 149 insertions, 8 deletions
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
index c07a15b..1d2c920 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
@@ -142,5 +142,15 @@ namespace OpenSim.Framework.Communications.Cache
142 } 142 }
143 return itemList; 143 return itemList;
144 } 144 }
145
146 public List<InventoryFolderBase> RequestListOfFolders()
147 {
148 List<InventoryFolderBase> folderList = new List<InventoryFolderBase>();
149 foreach (InventoryFolderBase folder in SubFolders.Values)
150 {
151 folderList.Add(folder);
152 }
153 return folderList;
154 }
145 } 155 }
146} 156}
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 32d941c..bf7f5c1 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -147,6 +147,23 @@ namespace OpenSim.Framework.Communications.Cache
147 } 147 }
148 } 148 }
149 149
150 public void HandleMoveInventoryFolder(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID)
151 {
152 CachedUserInfo userProfile;
153
154 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
155 {
156 if (userProfile.RootFolder != null)
157 {
158 InventoryFolderBase baseFolder = new InventoryFolderBase();
159 baseFolder.agentID = remoteClient.AgentId;
160 baseFolder.folderID = folderID;
161 baseFolder.parentID = parentID;
162 m_parent.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder);
163 }
164 }
165 }
166
150 /// <summary> 167 /// <summary>
151 /// Tell the client about the various child items and folders contained in the requested folder. 168 /// Tell the client about the various child items and folders contained in the requested folder.
152 /// </summary> 169 /// </summary>
@@ -163,14 +180,15 @@ namespace OpenSim.Framework.Communications.Cache
163 if (folderID == libraryRoot.folderID) 180 if (folderID == libraryRoot.folderID)
164 { 181 {
165 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, 182 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID,
166 libraryRoot.RequestListOfItems(), libraryRoot.SubFoldersCount); 183 libraryRoot.RequestListOfItems(), libraryRoot.RequestListOfFolders(), libraryRoot.SubFoldersCount);
167 184
168 return; 185 return;
169 } 186 }
170 187
171 if ((fold = libraryRoot.HasSubFolder(folderID)) != null) 188 if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
172 { 189 {
173 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems(), fold.SubFoldersCount); 190 System.Console.WriteLine("fetching librarysubfolder");
191 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems(), fold.RequestListOfFolders(), fold.SubFoldersCount);
174 192
175 return; 193 return;
176 } 194 }
@@ -182,19 +200,19 @@ namespace OpenSim.Framework.Communications.Cache
182 { 200 {
183 if (userProfile.RootFolder.folderID == folderID) 201 if (userProfile.RootFolder.folderID == folderID)
184 { 202 {
203 System.Console.Write("fetching root folder");
185 if (fetchItems) 204 if (fetchItems)
186 { 205 {
187 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, 206 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID,
188 userProfile.RootFolder.RequestListOfItems(), userProfile.RootFolder.SubFoldersCount); 207 userProfile.RootFolder.RequestListOfItems(), userProfile.RootFolder.RequestListOfFolders(), userProfile.RootFolder.SubFoldersCount);
189 } 208 }
190 } 209 }
191 else 210 else
192 { 211 {
193 InventoryFolderImpl folder = userProfile.RootFolder.HasSubFolder(folderID); 212 if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null)
194
195 if (fetchItems && folder != null)
196 { 213 {
197 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, folder.RequestListOfItems(), folder.SubFoldersCount); 214 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, fold.RequestListOfItems(), fold.RequestListOfFolders(), fold.SubFoldersCount);
215 return;
198 } 216 }
199 } 217 }
200 } 218 }
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index 191cdf2..9c493d4 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -40,6 +40,7 @@ namespace OpenSim.Framework.Communications
40 { 40 {
41 void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); 41 void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
42 void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); 42 void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
43 void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder);
43 void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); 44 void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
44 void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); 45 void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
45 void CreateNewUserInventory(LLUUID user); 46 void CreateNewUserInventory(LLUUID user);
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 28b81d4..1e13031 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -130,6 +130,17 @@ namespace OpenSim.Framework.Communications
130 /// <summary> 130 /// <summary>
131 /// 131 ///
132 /// </summary> 132 /// </summary>
133 public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder)
134 {
135 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
136 {
137 plugin.Value.moveInventoryFolder(folder);
138 }
139 }
140
141 /// <summary>
142 ///
143 /// </summary>
133 /// <param name="parentFolderID"></param> 144 /// <param name="parentFolderID"></param>
134 /// <returns></returns> 145 /// <returns></returns>
135 public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID) 146 public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID)
@@ -161,6 +172,14 @@ namespace OpenSim.Framework.Communications
161 } 172 }
162 } 173 }
163 174
175 public void MoveFolder(InventoryFolderBase folder)
176 {
177 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
178 {
179 plugin.Value.moveInventoryFolder(folder);
180 }
181 }
182
164 public void AddItem(InventoryItemBase item) 183 public void AddItem(InventoryItemBase item)
165 { 184 {
166 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 185 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
@@ -251,6 +270,7 @@ namespace OpenSim.Framework.Communications
251 InventoryItemInfo itemCallBack); 270 InventoryItemInfo itemCallBack);
252 271
253 public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); 272 public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
273 public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder);
254 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); 274 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
255 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); 275 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
256 } 276 }
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
index ef2a0f3..69b53a3 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
@@ -604,6 +604,34 @@ namespace OpenSim.Framework.Data.MSSQL
604 604
605 } 605 }
606 606
607 /// <summary>
608 /// Updates an inventory folder
609 /// </summary>
610 /// <param name="folder">Folder to update</param>
611
612 public void moveInventoryFolder(InventoryFolderBase folder)
613 {
614 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " +
615 "parentFolderID = @parentFolderID," +
616 "folderID = @keyFolderID;", database.getConnection());
617 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToStringHyphenated());
618 SqlParameter param2 = new SqlParameter("@parentFolderID", folder.parentID.ToStringHyphenated());
619 SqlParameter param3 = new SqlParameter("@keyFolderID", folder.folderID.ToStringHyphenated());
620 command.Parameters.Add(param1);
621 command.Parameters.Add(param2);
622 command.Parameters.Add(param3);
623
624 try
625 {
626 command.ExecuteNonQuery();
627 }
628 catch (Exception e)
629 {
630 MainLog.Instance.Error(e.ToString());
631 }
632
633
634 }
607 635
608 /// <summary> 636 /// <summary>
609 /// Append a list of all the child folders of a parent folder 637 /// Append a list of all the child folders of a parent folder
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
index edf7c43..6828f66 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
@@ -529,6 +529,28 @@ namespace OpenSim.Framework.Data.MySQL
529 addInventoryFolder(folder); 529 addInventoryFolder(folder);
530 } 530 }
531 531
532 /// Creates a new inventory folder
533 /// </summary>
534 /// <param name="folder">Folder to create</param>
535 public void moveInventoryFolder(InventoryFolderBase folder)
536 {
537 string sql =
538 "UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID";
539
540 MySqlCommand cmd = new MySqlCommand(sql, database.Connection);
541 cmd.Parameters.AddWithValue("?folderID", folder.folderID.ToStringHyphenated());
542 cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToStringHyphenated());
543
544
545 try
546 {
547 cmd.ExecuteNonQuery();
548 }
549 catch (Exception e)
550 {
551 MainLog.Instance.Error(e.ToString());
552 }
553 }
532 554
533 /// <summary> 555 /// <summary>
534 /// Append a list of all the child folders of a parent folder 556 /// Append a list of all the child folders of a parent folder
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index b9a1daa..fe27e32 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -141,6 +141,24 @@ namespace OpenSim.Framework.Data.SQLite
141 invFoldersDa.Update(ds, "inventoryfolders"); 141 invFoldersDa.Update(ds, "inventoryfolders");
142 } 142 }
143 143
144 private void moveFolder(InventoryFolderBase folder)
145 {
146 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
147
148 DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.folderID);
149 if (inventoryRow == null)
150 {
151 inventoryRow = inventoryFolderTable.NewRow();
152 fillFolderRow(inventoryRow, folder);
153 inventoryFolderTable.Rows.Add(inventoryRow);
154 }
155 else
156 {
157 moveFolderRow(inventoryRow, folder);
158 }
159
160 invFoldersDa.Update(ds, "inventoryfolders");
161 }
144 private void addItem(InventoryItemBase item) 162 private void addItem(InventoryItemBase item)
145 { 163 {
146 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 164 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
@@ -404,6 +422,15 @@ namespace OpenSim.Framework.Data.SQLite
404 } 422 }
405 423
406 /// <summary> 424 /// <summary>
425 /// Moves a folder based on its ID with folder
426 /// </summary>
427 /// <param name="folder">The inventory folder</param>
428 public void moveInventoryFolder(InventoryFolderBase folder)
429 {
430 moveFolder(folder);
431 }
432
433 /// <summary>
407 /// Delete a folder 434 /// Delete a folder
408 /// </summary> 435 /// </summary>
409 /// <remarks> 436 /// <remarks>
@@ -534,6 +561,11 @@ namespace OpenSim.Framework.Data.SQLite
534 row["version"] = folder.version; 561 row["version"] = folder.version;
535 } 562 }
536 563
564 private void moveFolderRow(DataRow row, InventoryFolderBase folder)
565 {
566 row["UUID"] = folder.folderID;
567 row["parentID"] = folder.parentID;
568 }
537 569
538 /*********************************************************************** 570 /***********************************************************************
539 * 571 *
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 8075d0d..738df13 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -330,6 +330,9 @@ namespace OpenSim.Framework
330 public delegate void UpdateInventoryFolder( 330 public delegate void UpdateInventoryFolder(
331 IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID); 331 IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID);
332 332
333 public delegate void MoveInventoryFolder(
334 IClientAPI remoteClient, LLUUID folderID, LLUUID parentID);
335
333 public delegate void CreateNewInventoryItem( 336 public delegate void CreateNewInventoryItem(
334 IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, 337 IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name,
335 sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask); 338 sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask);
@@ -432,6 +435,7 @@ namespace OpenSim.Framework
432 event CreateNewInventoryItem OnCreateNewInventoryItem; 435 event CreateNewInventoryItem OnCreateNewInventoryItem;
433 event CreateInventoryFolder OnCreateNewInventoryFolder; 436 event CreateInventoryFolder OnCreateNewInventoryFolder;
434 event UpdateInventoryFolder OnUpdateInventoryFolder; 437 event UpdateInventoryFolder OnUpdateInventoryFolder;
438 event MoveInventoryFolder OnMoveInventoryFolder;
435 event FetchInventoryDescendents OnFetchInventoryDescendents; 439 event FetchInventoryDescendents OnFetchInventoryDescendents;
436 event PurgeInventoryDescendents OnPurgeInventoryDescendents; 440 event PurgeInventoryDescendents OnPurgeInventoryDescendents;
437 event FetchInventory OnFetchInventory; 441 event FetchInventory OnFetchInventory;
@@ -522,7 +526,7 @@ namespace OpenSim.Framework
522 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, 526 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
523 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity); 527 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity);
524 528
525 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, int subFoldersCount); 529 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int subFoldersCount);
526 void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); 530 void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
527 531
528 /// <summary> 532 /// <summary>
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs
index adcc289..8cb3e73 100644
--- a/OpenSim/Framework/InventoryItemBase.cs
+++ b/OpenSim/Framework/InventoryItemBase.cs
@@ -239,6 +239,12 @@ namespace OpenSim.Framework
239 void updateInventoryFolder(InventoryFolderBase folder); 239 void updateInventoryFolder(InventoryFolderBase folder);
240 240
241 /// <summary> 241 /// <summary>
242 /// Updates a folder based on its ID with folder
243 /// </summary>
244 /// <param name="folder">The inventory folder</param>
245 void moveInventoryFolder(InventoryFolderBase folder);
246
247 /// <summary>
242 /// Deletes a folder based on its ID with folder 248 /// Deletes a folder based on its ID with folder
243 /// </summary> 249 /// </summary>
244 /// <param name="folder">The id of the folder</param> 250 /// <param name="folder">The id of the folder</param>