aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2008-04-30 16:08:24 +0000
committerTeravus Ovares2008-04-30 16:08:24 +0000
commita9cc76e0efba7496909d613c75b81de6a9c5d979 (patch)
treee83763d4dfb3b78ead9b5926dce1d2468b496845
parentmove IUserService into the OpenSim.Framework.Communications assembly (diff)
downloadopensim-SC_OLD-a9cc76e0efba7496909d613c75b81de6a9c5d979.zip
opensim-SC_OLD-a9cc76e0efba7496909d613c75b81de6a9c5d979.tar.gz
opensim-SC_OLD-a9cc76e0efba7496909d613c75b81de6a9c5d979.tar.bz2
opensim-SC_OLD-a9cc76e0efba7496909d613c75b81de6a9c5d979.tar.xz
* Long awaited patch from A_Biondi Mantis 923. Kept alive by Melanie. Thanks A_Biondi and Melanie!
* This builds but might not work. JustinCC will examine.. it may work out of the box.
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs21
-rw-r--r--OpenSim/Data/MySQL/Resources/CreateItemsTable.sql8
-rw-r--r--OpenSim/Data/MySQL/Resources/UpgradeItemsTableToVersion3.sql8
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs32
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs2
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs2
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs7
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs11
-rw-r--r--OpenSim/Framework/IClientAPI.cs9
-rw-r--r--OpenSim/Framework/InventoryItemBase.cs118
-rw-r--r--OpenSim/Grid/InventoryServer/GridInventoryService.cs5
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs84
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs5
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs15
-rw-r--r--OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs33
16 files changed, 313 insertions, 50 deletions
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 6261d37..2c781e0 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -332,6 +332,15 @@ namespace OpenSim.Data.MySQL
332 item.Creator = new LLUUID((string) reader["creatorID"]); 332 item.Creator = new LLUUID((string) reader["creatorID"]);
333 item.BasePermissions = (uint) reader["inventoryBasePermissions"]; 333 item.BasePermissions = (uint) reader["inventoryBasePermissions"];
334 item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; 334 item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
335
336 // new fields
337 item.SalePrice = (int) reader["salePrice"];
338 item.SaleType = Convert.ToByte(reader["saleType"]);
339 item.CreationDate = (int) reader["creationDate"];
340 item.GroupID = new LLUUID(reader["groupID"].ToString());
341 item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
342 item.Flags = (uint) reader["flags"];
343
335 return item; 344 return item;
336 } 345 }
337 catch (MySqlException e) 346 catch (MySqlException e)
@@ -353,8 +362,6 @@ namespace OpenSim.Data.MySQL
353 { 362 {
354 lock (database) 363 lock (database)
355 { 364 {
356 Dictionary<string, string> param = new Dictionary<string, string>();
357
358 MySqlCommand result = 365 MySqlCommand result =
359 new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection); 366 new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection);
360 result.Parameters.AddWithValue("?uuid", itemID.ToString()); 367 result.Parameters.AddWithValue("?uuid", itemID.ToString());
@@ -444,9 +451,9 @@ namespace OpenSim.Data.MySQL
444 public void addInventoryItem(InventoryItemBase item) 451 public void addInventoryItem(InventoryItemBase item)
445 { 452 {
446 string sql = 453 string sql =
447 "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions) VALUES "; 454 "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags) VALUES ";
448 sql += 455 sql +=
449 "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions)"; 456 "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions, ?salePrice, ?saleType, ?creationDate, ?groupID, ?groupOwned, ?flags)";
450 457
451 try 458 try
452 { 459 {
@@ -465,6 +472,12 @@ namespace OpenSim.Data.MySQL
465 result.Parameters.AddWithValue("?creatorID", item.Creator.ToString()); 472 result.Parameters.AddWithValue("?creatorID", item.Creator.ToString());
466 result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions); 473 result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
467 result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); 474 result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
475 result.Parameters.AddWithValue("?salePrice", item.SalePrice);
476 result.Parameters.AddWithValue("?saleType", item.SaleType);
477 result.Parameters.AddWithValue("?creationDate", item.CreationDate);
478 result.Parameters.AddWithValue("?groupID", item.GroupID);
479 result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
480 result.Parameters.AddWithValue("?flags", item.Flags);
468 481
469 lock (database) 482 lock (database)
470 { 483 {
diff --git a/OpenSim/Data/MySQL/Resources/CreateItemsTable.sql b/OpenSim/Data/MySQL/Resources/CreateItemsTable.sql
index 1723ee3..c8b7481 100644
--- a/OpenSim/Data/MySQL/Resources/CreateItemsTable.sql
+++ b/OpenSim/Data/MySQL/Resources/CreateItemsTable.sql
@@ -12,7 +12,13 @@ CREATE TABLE `inventoryitems` (
12 `creatorID` varchar(36) default NULL, 12 `creatorID` varchar(36) default NULL,
13 `inventoryBasePermissions` int(10) unsigned NOT NULL default 0, 13 `inventoryBasePermissions` int(10) unsigned NOT NULL default 0,
14 `inventoryEveryOnePermissions` int(10) unsigned NOT NULL default 0, 14 `inventoryEveryOnePermissions` int(10) unsigned NOT NULL default 0,
15 `salePrice` int(11) default NULL,
16 `saleType` tinyint(4) default NULL,
17 `creationDate` int(11) default NULL,
18 `groupID` varchar(63) default NULL,
19 `groupOwned` tinyint(4) default NULL,
20 `flags` int(11) unsigned default NULL,
15 PRIMARY KEY (`inventoryID`), 21 PRIMARY KEY (`inventoryID`),
16 KEY `owner` (`avatarID`), 22 KEY `owner` (`avatarID`),
17 KEY `folder` (`parentFolderID`) 23 KEY `folder` (`parentFolderID`)
18) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 2'; 24) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 3';
diff --git a/OpenSim/Data/MySQL/Resources/UpgradeItemsTableToVersion3.sql b/OpenSim/Data/MySQL/Resources/UpgradeItemsTableToVersion3.sql
new file mode 100644
index 0000000..2b3b1f7
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/UpgradeItemsTableToVersion3.sql
@@ -0,0 +1,8 @@
1ALTER TABLE `inventoryitems`
2 ADD COLUMN `salePrice` int(11) NOT NULL,
3 ADD COLUMN `saleType` tinyint(4) NOT NULL,
4 ADD COLUMN `creationDate` int(11) NOT NULL,
5 ADD COLUMN `groupID` varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
6 ADD COLUMN `groupOwned` tinyint(4) NOT NULL,
7 ADD COLUMN `flags` int(11) unsigned NOT NULL,
8COMMENT='Rev. 3';
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index 5c53f32..b638528 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -101,6 +101,14 @@ namespace OpenSim.Data.SQLite
101 item.CurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]); 101 item.CurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]);
102 item.BasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]); 102 item.BasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]);
103 item.EveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]); 103 item.EveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]);
104
105 // new fields
106 item.SalePrice = Convert.ToInt32(row["salePrice"]);
107 item.SaleType = Convert.ToByte(row["saleType"]);
108 item.CreationDate = Convert.ToInt32(row["creationDate"]);
109 item.GroupID = new LLUUID((string)row["groupID"]);
110 item.GroupOwned = Convert.ToBoolean(row["groupOwned"]);
111 item.Flags = Convert.ToUInt32(row["Flags"]);
104 return item; 112 return item;
105 } 113 }
106 114
@@ -120,6 +128,14 @@ namespace OpenSim.Data.SQLite
120 row["inventoryCurrentPermissions"] = item.CurrentPermissions; 128 row["inventoryCurrentPermissions"] = item.CurrentPermissions;
121 row["inventoryBasePermissions"] = item.BasePermissions; 129 row["inventoryBasePermissions"] = item.BasePermissions;
122 row["inventoryEveryOnePermissions"] = item.EveryOnePermissions; 130 row["inventoryEveryOnePermissions"] = item.EveryOnePermissions;
131
132 // new fields
133 row["salePrice"] = item.SalePrice;
134 row["saleType"] = item.SaleType;
135 row["creationDate"] = item.CreationDate;
136 row["groupID"] = item.GroupID;
137 row["groupOwned"] = item.GroupOwned;
138 row["flags"] = item.Flags;
123 } 139 }
124 140
125 private void addFolder(InventoryFolderBase folder, bool add) 141 private void addFolder(InventoryFolderBase folder, bool add)
@@ -530,7 +546,21 @@ namespace OpenSim.Data.SQLite
530 createCol(inv, "inventoryBasePermissions", typeof (Int32)); 546 createCol(inv, "inventoryBasePermissions", typeof (Int32));
531 createCol(inv, "inventoryEveryOnePermissions", typeof (Int32)); 547 createCol(inv, "inventoryEveryOnePermissions", typeof (Int32));
532 548
533 inv.PrimaryKey = new DataColumn[] {inv.Columns["UUID"]}; 549 // sale info
550 createCol(inv, "salePrice", typeof(Int32));
551 createCol(inv, "saleType", typeof(Byte));
552
553 // creation date
554 createCol(inv, "creationDate", typeof(Int32));
555
556 // group info
557 createCol(inv, "groupID", typeof(String));
558 createCol(inv, "groupOwned", typeof(Boolean));
559
560 // Flags
561 createCol(inv, "flags", typeof(UInt32));
562
563 inv.PrimaryKey = new DataColumn[] { inv.Columns["UUID"] };
534 return inv; 564 return inv;
535 } 565 }
536 566
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 4355033..d385376 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -721,7 +721,7 @@ namespace OpenSim.Data.SQLite
721 createCol(items, "everyonePermissions", typeof (UInt32)); 721 createCol(items, "everyonePermissions", typeof (UInt32));
722 createCol(items, "groupPermissions", typeof (UInt32)); 722 createCol(items, "groupPermissions", typeof (UInt32));
723 723
724 items.PrimaryKey = new DataColumn[] {items.Columns["itemID"]}; 724 items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] };
725 725
726 return items; 726 return items;
727 } 727 }
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 9749366..847909a 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -325,7 +325,7 @@ namespace OpenSim.Framework.Communications.Cache
325 { 325 {
326 if ((userID == UserProfile.ID) && HasInventory) 326 if ((userID == UserProfile.ID) && HasInventory)
327 { 327 {
328 m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); 328 m_commsManager.InventoryService.UpdateInventoryItem(userID, itemInfo);
329 } 329 }
330 } 330 }
331 331
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index 5690f89..c82c946 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -78,6 +78,13 @@ namespace OpenSim.Framework.Communications
78 void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); 78 void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
79 79
80 /// <summary> 80 /// <summary>
81 /// Update an item in the given user's inventory
82 /// </summary>
83 /// <param name="userID"></param>
84 /// <param name="item"></param>
85 void UpdateInventoryItem(LLUUID userID, InventoryItemBase item);
86
87 /// <summary>
81 /// Delete an item from the given user's inventory 88 /// Delete an item from the given user's inventory
82 /// </summary> 89 /// </summary>
83 /// <param name="userID"></param> 90 /// <param name="userID"></param>
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 0528b91..dab6a16 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -172,6 +172,9 @@ namespace OpenSim.Framework.Communications
172 172
173 // See IInventoryServices 173 // See IInventoryServices
174 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); 174 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
175
176 // See IInventoryServices
177 public abstract void UpdateInventoryItem(LLUUID userID, InventoryItemBase item);
175 178
176 // See IInventoryServices 179 // See IInventoryServices
177 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); 180 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
@@ -230,6 +233,14 @@ namespace OpenSim.Framework.Communications
230 } 233 }
231 } 234 }
232 235
236 protected void UpdateItem(InventoryItemBase item)
237 {
238 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
239 {
240 plugin.Value.updateInventoryItem(item);
241 }
242 }
243
233 protected void DeleteItem(InventoryItemBase item) 244 protected void DeleteItem(InventoryItemBase item)
234 { 245 {
235 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 246 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 20d4e62..9bcd65f 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -393,9 +393,12 @@ namespace OpenSim.Framework
393 393
394 public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); 394 public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID);
395 395
396 public delegate void UpdateInventoryItem( 396/* public delegate void UpdateInventoryItem(
397 IClientAPI remoteClient, LLUUID transactionID, LLUUID itemID, string name, string description, 397 IClientAPI remoteClient, LLUUID transactionID, LLUUID itemID, string name, string description,
398 uint nextOwnerMask); 398 uint nextOwnerMask);*/
399
400 public delegate void UpdateInventoryItem(
401 IClientAPI remoteClient, LLUUID transactionID, LLUUID itemID, InventoryItemBase itemUpd);
399 402
400 public delegate void CopyInventoryItem( 403 public delegate void CopyInventoryItem(
401 IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, 404 IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID,
@@ -756,4 +759,4 @@ namespace OpenSim.Framework
756 public byte[] usecircuit; 759 public byte[] usecircuit;
757 public EndPoint userEP; 760 public EndPoint userEP;
758 } 761 }
759} \ No newline at end of file 762}
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs
index 3d75a8a..dbf2085 100644
--- a/OpenSim/Framework/InventoryItemBase.cs
+++ b/OpenSim/Framework/InventoryItemBase.cs
@@ -54,6 +54,10 @@ namespace OpenSim.Framework
54 /// </summary> 54 /// </summary>
55 private LLUUID _creator; 55 private LLUUID _creator;
56 56
57 private LLUUID _owner;
58
59 private uint _nextPermissions;
60
57 /// <summary> 61 /// <summary>
58 /// A mask containing permissions for the current owner (cannot be enforced) 62 /// A mask containing permissions for the current owner (cannot be enforced)
59 /// </summary> 63 /// </summary>
@@ -89,20 +93,44 @@ namespace OpenSim.Framework
89 /// </summary> 93 /// </summary>
90 private string _name; 94 private string _name;
91 95
96
92 /// <summary> 97 /// <summary>
93 /// A mask containing the permissions for the next owner (cannot be enforced) 98 ///
94 /// </summary> 99 /// </summary>
95 private uint _nextPermissions; 100 private LLUUID _groupID;
96 101
97 /// <summary> 102 /// <summary>
98 /// The owner of this inventory item 103 ///
99 /// </summary> 104 /// </summary>
100 private LLUUID _owner; 105 private bool _groupOwned;
101 106
102 public LLUUID ID 107 /// <summary>
103 { 108 ///
104 get { return _id; } 109 /// </summary>
105 set { _id = value; } 110 private int _salePrice;
111
112 /// <summary>
113 ///
114 /// </summary>
115 private byte _saleType;
116
117 /// <summary>
118 ///
119 /// </summary>
120 private uint _flags;
121
122 /// <summary>
123 ///
124 /// </summary>
125 public int _creationDate;
126
127 public LLUUID ID {
128 get {
129 return _id;
130 }
131 set {
132 _id = value;
133 }
106 } 134 }
107 135
108 public int InvType 136 public int InvType
@@ -176,5 +204,77 @@ namespace OpenSim.Framework
176 get { return _assetID; } 204 get { return _assetID; }
177 set { _assetID = value; } 205 set { _assetID = value; }
178 } 206 }
207
208 public LLUUID GroupID
209 {
210 get
211 {
212 return _groupID;
213 }
214 set
215 {
216 _groupID = value;
217 }
218 }
219
220 public bool GroupOwned
221 {
222 get
223 {
224 return _groupOwned;
225 }
226 set
227 {
228 _groupOwned = value;
229 }
230 }
231
232 public int SalePrice
233 {
234 get
235 {
236 return _salePrice;
237 }
238 set
239 {
240 _salePrice = value;
241 }
242 }
243
244 public byte SaleType
245 {
246 get
247 {
248 return _saleType;
249 }
250 set
251 {
252 _saleType = value;
253 }
254 }
255
256 public uint Flags
257 {
258 get
259 {
260 return _flags;
261 }
262 set
263 {
264 _flags = value;
265 }
266 }
267
268 public int CreationDate
269 {
270 get
271 {
272 return _creationDate;
273 }
274 set
275 {
276 _creationDate = value;
277 }
278 }
179 } 279 }
180} \ No newline at end of file 280}
diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
index efa6a6e..f8467b6 100644
--- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs
+++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
@@ -209,6 +209,11 @@ namespace OpenSim.Grid.InventoryServer
209 AddItem(item); 209 AddItem(item);
210 } 210 }
211 211
212 public override void UpdateInventoryItem(LLUUID userID, InventoryItemBase item)
213 {
214 UpdateItem(item);
215 }
216
212 public bool AddInventoryFolder(InventoryFolderBase folder) 217 public bool AddInventoryFolder(InventoryFolderBase folder)
213 { 218 {
214 // Right now, this actions act more like an update/insert combination than a simple create. 219 // Right now, this actions act more like an update/insert combination than a simple create.
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index aac96d1..010a37f 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -1284,21 +1284,25 @@ namespace OpenSim.Region.ClientStack
1284 descend.ItemData[i].AssetID = item.AssetID; 1284 descend.ItemData[i].AssetID = item.AssetID;
1285 descend.ItemData[i].CreatorID = item.Creator; 1285 descend.ItemData[i].CreatorID = item.Creator;
1286 descend.ItemData[i].BaseMask = item.BasePermissions; 1286 descend.ItemData[i].BaseMask = item.BasePermissions;
1287 descend.ItemData[i].CreationDate = 1000;
1288 descend.ItemData[i].Description = Helpers.StringToField(item.Description); 1287 descend.ItemData[i].Description = Helpers.StringToField(item.Description);
1289 descend.ItemData[i].EveryoneMask = item.EveryOnePermissions; 1288 descend.ItemData[i].EveryoneMask = item.EveryOnePermissions;
1290 descend.ItemData[i].Flags = 1; 1289 descend.ItemData[i].OwnerMask = item.CurrentPermissions;
1291 descend.ItemData[i].FolderID = item.Folder; 1290 descend.ItemData[i].FolderID = item.Folder;
1292 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 1291 descend.ItemData[i].InvType = (sbyte)item.InvType;
1293 descend.ItemData[i].GroupMask = 0;
1294 descend.ItemData[i].InvType = (sbyte) item.InvType;
1295 descend.ItemData[i].Name = Helpers.StringToField(item.Name); 1292 descend.ItemData[i].Name = Helpers.StringToField(item.Name);
1296 descend.ItemData[i].NextOwnerMask = item.NextPermissions; 1293 descend.ItemData[i].NextOwnerMask = item.NextPermissions;
1297 descend.ItemData[i].OwnerID = item.Owner; 1294 descend.ItemData[i].OwnerID = item.Owner;
1298 descend.ItemData[i].OwnerMask = item.CurrentPermissions; 1295 descend.ItemData[i].Type = (sbyte)item.AssetType;
1299 descend.ItemData[i].SalePrice = 0; 1296
1300 descend.ItemData[i].SaleType = 0; 1297 //descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1301 descend.ItemData[i].Type = (sbyte) item.AssetType; 1298 descend.ItemData[i].GroupID = item.GroupID;
1299 descend.ItemData[i].GroupOwned = item.GroupOwned;
1300 descend.ItemData[i].GroupMask = 0;
1301 descend.ItemData[i].CreationDate = item.CreationDate;
1302 descend.ItemData[i].SalePrice = item.SalePrice;
1303 descend.ItemData[i].SaleType = item.SaleType;
1304 descend.ItemData[i].Flags = item.Flags;
1305
1302 descend.ItemData[i].CRC = 1306 descend.ItemData[i].CRC =
1303 Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, 1307 Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType,
1304 descend.ItemData[i].InvType, descend.ItemData[i].Type, 1308 descend.ItemData[i].InvType, descend.ItemData[i].Type,
@@ -1433,18 +1437,22 @@ namespace OpenSim.Region.ClientStack
1433 (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 1437 (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
1434 inventoryReply.InventoryData[0].Description = Helpers.StringToField(item.Description); 1438 inventoryReply.InventoryData[0].Description = Helpers.StringToField(item.Description);
1435 inventoryReply.InventoryData[0].EveryoneMask = item.EveryOnePermissions; 1439 inventoryReply.InventoryData[0].EveryoneMask = item.EveryOnePermissions;
1436 inventoryReply.InventoryData[0].Flags = 0;
1437 inventoryReply.InventoryData[0].FolderID = item.Folder; 1440 inventoryReply.InventoryData[0].FolderID = item.Folder;
1438 inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1439 inventoryReply.InventoryData[0].GroupMask = 0;
1440 inventoryReply.InventoryData[0].InvType = (sbyte)item.InvType; 1441 inventoryReply.InventoryData[0].InvType = (sbyte)item.InvType;
1441 inventoryReply.InventoryData[0].Name = Helpers.StringToField(item.Name); 1442 inventoryReply.InventoryData[0].Name = Helpers.StringToField(item.Name);
1442 inventoryReply.InventoryData[0].NextOwnerMask = item.NextPermissions; 1443 inventoryReply.InventoryData[0].NextOwnerMask = item.NextPermissions;
1443 inventoryReply.InventoryData[0].OwnerID = item.Owner; 1444 inventoryReply.InventoryData[0].OwnerID = item.Owner;
1444 inventoryReply.InventoryData[0].OwnerMask = item.CurrentPermissions; 1445 inventoryReply.InventoryData[0].OwnerMask = item.CurrentPermissions;
1445 inventoryReply.InventoryData[0].SalePrice = 0;
1446 inventoryReply.InventoryData[0].SaleType = 0;
1447 inventoryReply.InventoryData[0].Type = (sbyte)item.AssetType; 1446 inventoryReply.InventoryData[0].Type = (sbyte)item.AssetType;
1447
1448 //inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1449 inventoryReply.InventoryData[0].GroupID = item.GroupID;
1450 inventoryReply.InventoryData[0].GroupOwned = item.GroupOwned;
1451 inventoryReply.InventoryData[0].GroupMask = 0;
1452 inventoryReply.InventoryData[0].Flags = item.Flags;
1453 inventoryReply.InventoryData[0].SalePrice = item.SalePrice;
1454 inventoryReply.InventoryData[0].SaleType = item.SaleType;
1455
1448 inventoryReply.InventoryData[0].CRC = 1456 inventoryReply.InventoryData[0].CRC =
1449 Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType, 1457 Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType,
1450 inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID, 1458 inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID,
@@ -1484,18 +1492,22 @@ namespace OpenSim.Region.ClientStack
1484 bulkUpdate.ItemData[0].CreationDate = 1000; 1492 bulkUpdate.ItemData[0].CreationDate = 1000;
1485 bulkUpdate.ItemData[0].Description = Helpers.StringToField(item.Description); 1493 bulkUpdate.ItemData[0].Description = Helpers.StringToField(item.Description);
1486 bulkUpdate.ItemData[0].EveryoneMask = item.EveryOnePermissions; 1494 bulkUpdate.ItemData[0].EveryoneMask = item.EveryOnePermissions;
1487 bulkUpdate.ItemData[0].Flags = 0;
1488 bulkUpdate.ItemData[0].FolderID = item.Folder; 1495 bulkUpdate.ItemData[0].FolderID = item.Folder;
1489 bulkUpdate.ItemData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1490 bulkUpdate.ItemData[0].GroupMask = 0;
1491 bulkUpdate.ItemData[0].InvType = (sbyte)item.InvType; 1496 bulkUpdate.ItemData[0].InvType = (sbyte)item.InvType;
1492 bulkUpdate.ItemData[0].Name = Helpers.StringToField(item.Name); 1497 bulkUpdate.ItemData[0].Name = Helpers.StringToField(item.Name);
1493 bulkUpdate.ItemData[0].NextOwnerMask = item.NextPermissions; 1498 bulkUpdate.ItemData[0].NextOwnerMask = item.NextPermissions;
1494 bulkUpdate.ItemData[0].OwnerID = item.Owner; 1499 bulkUpdate.ItemData[0].OwnerID = item.Owner;
1495 bulkUpdate.ItemData[0].OwnerMask = item.CurrentPermissions; 1500 bulkUpdate.ItemData[0].OwnerMask = item.CurrentPermissions;
1496 bulkUpdate.ItemData[0].SalePrice = 100;
1497 bulkUpdate.ItemData[0].SaleType = 0;
1498 bulkUpdate.ItemData[0].Type = (sbyte)item.AssetType; 1501 bulkUpdate.ItemData[0].Type = (sbyte)item.AssetType;
1502
1503 //bulkUpdate.ItemData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1504 bulkUpdate.ItemData[0].GroupID = item.GroupID;
1505 bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned;
1506 bulkUpdate.ItemData[0].GroupMask = 0;
1507 bulkUpdate.ItemData[0].Flags = item.Flags;
1508 bulkUpdate.ItemData[0].SalePrice = item.SalePrice;
1509 bulkUpdate.ItemData[0].SaleType = item.SaleType;
1510
1499 bulkUpdate.ItemData[0].CRC = 1511 bulkUpdate.ItemData[0].CRC =
1500 Helpers.InventoryCRC(1000, 0, bulkUpdate.ItemData[0].InvType, 1512 Helpers.InventoryCRC(1000, 0, bulkUpdate.ItemData[0].InvType,
1501 bulkUpdate.ItemData[0].Type, bulkUpdate.ItemData[0].AssetID, 1513 bulkUpdate.ItemData[0].Type, bulkUpdate.ItemData[0].AssetID,
@@ -1526,21 +1538,24 @@ namespace OpenSim.Region.ClientStack
1526 InventoryReply.InventoryData[0].AssetID = Item.AssetID; 1538 InventoryReply.InventoryData[0].AssetID = Item.AssetID;
1527 InventoryReply.InventoryData[0].CreatorID = Item.Creator; 1539 InventoryReply.InventoryData[0].CreatorID = Item.Creator;
1528 InventoryReply.InventoryData[0].BaseMask = Item.BasePermissions; 1540 InventoryReply.InventoryData[0].BaseMask = Item.BasePermissions;
1529 InventoryReply.InventoryData[0].CreationDate = 1000;
1530 InventoryReply.InventoryData[0].Description = Helpers.StringToField(Item.Description); 1541 InventoryReply.InventoryData[0].Description = Helpers.StringToField(Item.Description);
1531 InventoryReply.InventoryData[0].EveryoneMask = Item.EveryOnePermissions; 1542 InventoryReply.InventoryData[0].EveryoneMask = Item.EveryOnePermissions;
1532 InventoryReply.InventoryData[0].Flags = 0;
1533 InventoryReply.InventoryData[0].FolderID = Item.Folder; 1543 InventoryReply.InventoryData[0].FolderID = Item.Folder;
1534 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1535 InventoryReply.InventoryData[0].GroupMask = 0;
1536 InventoryReply.InventoryData[0].InvType = (sbyte)Item.InvType; 1544 InventoryReply.InventoryData[0].InvType = (sbyte)Item.InvType;
1537 InventoryReply.InventoryData[0].Name = Helpers.StringToField(Item.Name); 1545 InventoryReply.InventoryData[0].Name = Helpers.StringToField(Item.Name);
1538 InventoryReply.InventoryData[0].NextOwnerMask = Item.NextPermissions; 1546 InventoryReply.InventoryData[0].NextOwnerMask = Item.NextPermissions;
1539 InventoryReply.InventoryData[0].OwnerID = Item.Owner; 1547 InventoryReply.InventoryData[0].OwnerID = Item.Owner;
1540 InventoryReply.InventoryData[0].OwnerMask = Item.CurrentPermissions; 1548 InventoryReply.InventoryData[0].OwnerMask = Item.CurrentPermissions;
1541 InventoryReply.InventoryData[0].SalePrice = 100;
1542 InventoryReply.InventoryData[0].SaleType = 0;
1543 InventoryReply.InventoryData[0].Type = (sbyte)Item.AssetType; 1549 InventoryReply.InventoryData[0].Type = (sbyte)Item.AssetType;
1550
1551 //InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1552 InventoryReply.InventoryData[0].GroupID = Item.GroupID;
1553 InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned;
1554 InventoryReply.InventoryData[0].GroupMask = 0;
1555 InventoryReply.InventoryData[0].Flags = Item.Flags;
1556 InventoryReply.InventoryData[0].SalePrice = Item.SalePrice;
1557 InventoryReply.InventoryData[0].SaleType = Item.SaleType;
1558
1544 InventoryReply.InventoryData[0].CRC = 1559 InventoryReply.InventoryData[0].CRC =
1545 Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, 1560 Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType,
1546 InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, 1561 InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID,
@@ -4162,11 +4177,30 @@ namespace OpenSim.Region.ClientStack
4162 4177
4163 if (handlerUpdateInventoryItem != null) 4178 if (handlerUpdateInventoryItem != null)
4164 { 4179 {
4180 InventoryItemBase itemUpd = new InventoryItemBase();
4181 itemUpd.ID = update.InventoryData[i].ItemID;
4182 itemUpd.Name = Util.FieldToString(update.InventoryData[i].Name);
4183 itemUpd.Description = Util.FieldToString(update.InventoryData[i].Description);
4184 itemUpd.GroupID = update.InventoryData[i].GroupID;
4185 itemUpd.GroupOwned = update.InventoryData[i].GroupOwned;
4186 itemUpd.NextPermissions = update.InventoryData[i].NextOwnerMask;
4187 itemUpd.EveryOnePermissions = update.InventoryData[i].EveryoneMask;
4188 itemUpd.CreationDate = update.InventoryData[i].CreationDate;
4189 itemUpd.Folder = update.InventoryData[i].FolderID;
4190 itemUpd.InvType = update.InventoryData[i].InvType;
4191 itemUpd.SalePrice = update.InventoryData[i].SalePrice;
4192 itemUpd.SaleType = update.InventoryData[i].SaleType;
4193 itemUpd.Flags = update.InventoryData[i].Flags;
4194 /*
4165 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, 4195 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID,
4166 update.InventoryData[i].ItemID, 4196 update.InventoryData[i].ItemID,
4167 Util.FieldToString(update.InventoryData[i].Name), 4197 Util.FieldToString(update.InventoryData[i].Name),
4168 Util.FieldToString(update.InventoryData[i].Description), 4198 Util.FieldToString(update.InventoryData[i].Description),
4169 update.InventoryData[i].NextOwnerMask); 4199 update.InventoryData[i].NextOwnerMask);
4200 */
4201 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID,
4202 update.InventoryData[i].ItemID,
4203 itemUpd);
4170 } 4204 }
4171 } 4205 }
4172 } 4206 }
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
index 175829b..0de00a1 100644
--- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs
+++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
@@ -95,6 +95,11 @@ namespace OpenSim.Region.Communications.Local
95 AddItem(item); 95 AddItem(item);
96 } 96 }
97 97
98 public override void UpdateInventoryItem(LLUUID userID, InventoryItemBase item)
99 {
100 UpdateItem(item);
101 }
102
98 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) 103 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
99 { 104 {
100 DeleteItem(item); 105 DeleteItem(item);
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 65f3ee3..5b72f0d 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -229,6 +229,21 @@ namespace OpenSim.Region.Communications.OGS1
229 } 229 }
230 } 230 }
231 231
232 // TODO: this is a temporary workaround, the UpdateInventoryItem method need to be implemented
233 public void UpdateInventoryItem(LLUUID userID, InventoryItemBase item)
234 {
235 try
236 {
237 SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
238 "POST", _inventoryServerUrl + "/NewItem/", item);
239 }
240 catch (System.Net.WebException e)
241 {
242 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}",
243 e.Source, e.Message);
244 }
245 }
246
232 /// <summary> 247 /// <summary>
233 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> 248 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
234 /// </summary> 249 /// </summary>
diff --git a/OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs
index 4d2ec5b..9fa173d 100644
--- a/OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs
@@ -150,6 +150,7 @@ namespace OpenSim.Region.Environment.Modules
150 private string m_description = String.Empty; 150 private string m_description = String.Empty;
151 private sbyte type = 0; 151 private sbyte type = 0;
152 private sbyte invType = 0; 152 private sbyte invType = 0;
153 private byte wearableType = 0;
153 private uint nextPerm = 0; 154 private uint nextPerm = 0;
154 private bool m_finished = false; 155 private bool m_finished = false;
155 private bool m_createItem = false; 156 private bool m_createItem = false;
@@ -314,6 +315,7 @@ namespace OpenSim.Region.Environment.Modules
314 m_description = description; 315 m_description = description;
315 this.type = type; 316 this.type = type;
316 this.invType = invType; 317 this.invType = invType;
318 this.wearableType = wearableType;
317 nextPerm = nextOwnerMask; 319 nextPerm = nextOwnerMask;
318 Asset.Name = name; 320 Asset.Name = name;
319 Asset.Description = description; 321 Asset.Description = description;
@@ -386,6 +388,7 @@ namespace OpenSim.Region.Environment.Modules
386 item.BasePermissions = 2147483647; 388 item.BasePermissions = 2147483647;
387 item.CurrentPermissions = 2147483647; 389 item.CurrentPermissions = 2147483647;
388 item.NextPermissions = nextPerm; 390 item.NextPermissions = nextPerm;
391 item.Flags = (uint)wearableType;
389 392
390 userInfo.AddItem(ourClient.AgentId, item); 393 userInfo.AddItem(ourClient.AgentId, item);
391 ourClient.SendInventoryItemCreateUpdate(item); 394 ourClient.SendInventoryItemCreateUpdate(item);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index d41ede1..7e1b89f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -260,9 +260,11 @@ namespace OpenSim.Region.Environment.Scenes
260 /// <param name="name">The name of the updated item</param> 260 /// <param name="name">The name of the updated item</param>
261 /// <param name="description">The description of the updated item</param> 261 /// <param name="description">The description of the updated item</param>
262 /// <param name="nextOwnerMask">The permissions of the updated item</param> 262 /// <param name="nextOwnerMask">The permissions of the updated item</param>
263 public void UpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, 263/* public void UpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID,
264 LLUUID itemID, string name, string description, 264 LLUUID itemID, string name, string description,
265 uint nextOwnerMask) 265 uint nextOwnerMask)*/
266 public void UpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID,
267 LLUUID itemID, InventoryItemBase itemUpd)
266 { 268 {
267 CachedUserInfo userInfo 269 CachedUserInfo userInfo
268 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 270 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
@@ -275,9 +277,22 @@ namespace OpenSim.Region.Environment.Scenes
275 { 277 {
276 if (LLUUID.Zero == transactionID) 278 if (LLUUID.Zero == transactionID)
277 { 279 {
278 item.Name = name; 280 item.Name = itemUpd.Name;
279 item.Description = description; 281 item.Description = itemUpd.Description;
280 item.NextPermissions = nextOwnerMask; 282 item.NextPermissions = itemUpd.NextPermissions;
283 item.EveryOnePermissions = itemUpd.EveryOnePermissions;
284
285 // TODO: Requires sanity checks
286 //item.GroupID = itemUpd.GroupID;
287 //item.GroupOwned = itemUpd.GroupOwned;
288 //item.CreationDate = itemUpd.CreationDate;
289
290 // TODO: Check if folder changed and move item
291 //item.NextPermissions = itemUpd.Folder;
292 item.InvType = itemUpd.InvType;
293 item.SalePrice = itemUpd.SalePrice;
294 item.SaleType = itemUpd.SaleType;
295 item.Flags = itemUpd.Flags;
281 296
282 userInfo.UpdateItem(remoteClient.AgentId, item); 297 userInfo.UpdateItem(remoteClient.AgentId, item);
283 } 298 }
@@ -351,6 +366,12 @@ namespace OpenSim.Region.Environment.Scenes
351 itemCopy.BasePermissions = item.BasePermissions; 366 itemCopy.BasePermissions = item.BasePermissions;
352 itemCopy.CurrentPermissions = item.CurrentPermissions; 367 itemCopy.CurrentPermissions = item.CurrentPermissions;
353 368
369 itemCopy.GroupID = item.GroupID;
370 itemCopy.GroupOwned = item.GroupOwned;
371 itemCopy.Flags = item.Flags;
372 itemCopy.SalePrice = item.SalePrice;
373 itemCopy.SaleType = item.SaleType;
374
354 recipientUserInfo.AddItem(recipientClient.AgentId, itemCopy); 375 recipientUserInfo.AddItem(recipientClient.AgentId, itemCopy);
355 376
356 // Let the recipient client know about this new item 377 // Let the recipient client know about this new item
@@ -988,6 +1009,8 @@ namespace OpenSim.Region.Environment.Scenes
988 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 1009 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
989 } 1010 }
990 1011
1012 // TODO: add the new fields (Flags, Sale info, etc)
1013
991 userInfo.AddItem(remoteClient.AgentId, item); 1014 userInfo.AddItem(remoteClient.AgentId, item);
992 remoteClient.SendInventoryItemCreateUpdate(item); 1015 remoteClient.SendInventoryItemCreateUpdate(item);
993 } 1016 }