* 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.
0.6.0-stable
Teravus Ovares 2008-04-30 16:08:24 +00:00
parent dd96158afe
commit a9cc76e0ef
16 changed files with 313 additions and 50 deletions

View File

@ -332,6 +332,15 @@ namespace OpenSim.Data.MySQL
item.Creator = new LLUUID((string) reader["creatorID"]); item.Creator = new LLUUID((string) reader["creatorID"]);
item.BasePermissions = (uint) reader["inventoryBasePermissions"]; item.BasePermissions = (uint) reader["inventoryBasePermissions"];
item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
// new fields
item.SalePrice = (int) reader["salePrice"];
item.SaleType = Convert.ToByte(reader["saleType"]);
item.CreationDate = (int) reader["creationDate"];
item.GroupID = new LLUUID(reader["groupID"].ToString());
item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
item.Flags = (uint) reader["flags"];
return item; return item;
} }
catch (MySqlException e) catch (MySqlException e)
@ -353,8 +362,6 @@ namespace OpenSim.Data.MySQL
{ {
lock (database) lock (database)
{ {
Dictionary<string, string> param = new Dictionary<string, string>();
MySqlCommand result = MySqlCommand result =
new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection); new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection);
result.Parameters.AddWithValue("?uuid", itemID.ToString()); result.Parameters.AddWithValue("?uuid", itemID.ToString());
@ -444,9 +451,9 @@ namespace OpenSim.Data.MySQL
public void addInventoryItem(InventoryItemBase item) public void addInventoryItem(InventoryItemBase item)
{ {
string sql = string sql =
"REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions) VALUES "; "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags) VALUES ";
sql += sql +=
"(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions)"; "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions, ?salePrice, ?saleType, ?creationDate, ?groupID, ?groupOwned, ?flags)";
try try
{ {
@ -465,6 +472,12 @@ namespace OpenSim.Data.MySQL
result.Parameters.AddWithValue("?creatorID", item.Creator.ToString()); result.Parameters.AddWithValue("?creatorID", item.Creator.ToString());
result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions); result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
result.Parameters.AddWithValue("?salePrice", item.SalePrice);
result.Parameters.AddWithValue("?saleType", item.SaleType);
result.Parameters.AddWithValue("?creationDate", item.CreationDate);
result.Parameters.AddWithValue("?groupID", item.GroupID);
result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
result.Parameters.AddWithValue("?flags", item.Flags);
lock (database) lock (database)
{ {

View File

@ -12,7 +12,13 @@ CREATE TABLE `inventoryitems` (
`creatorID` varchar(36) default NULL, `creatorID` varchar(36) default NULL,
`inventoryBasePermissions` int(10) unsigned NOT NULL default 0, `inventoryBasePermissions` int(10) unsigned NOT NULL default 0,
`inventoryEveryOnePermissions` int(10) unsigned NOT NULL default 0, `inventoryEveryOnePermissions` int(10) unsigned NOT NULL default 0,
`salePrice` int(11) default NULL,
`saleType` tinyint(4) default NULL,
`creationDate` int(11) default NULL,
`groupID` varchar(63) default NULL,
`groupOwned` tinyint(4) default NULL,
`flags` int(11) unsigned default NULL,
PRIMARY KEY (`inventoryID`), PRIMARY KEY (`inventoryID`),
KEY `owner` (`avatarID`), KEY `owner` (`avatarID`),
KEY `folder` (`parentFolderID`) KEY `folder` (`parentFolderID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 2'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 3';

View File

@ -0,0 +1,8 @@
ALTER TABLE `inventoryitems`
ADD COLUMN `salePrice` int(11) NOT NULL,
ADD COLUMN `saleType` tinyint(4) NOT NULL,
ADD COLUMN `creationDate` int(11) NOT NULL,
ADD COLUMN `groupID` varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
ADD COLUMN `groupOwned` tinyint(4) NOT NULL,
ADD COLUMN `flags` int(11) unsigned NOT NULL,
COMMENT='Rev. 3';

View File

@ -101,6 +101,14 @@ namespace OpenSim.Data.SQLite
item.CurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]); item.CurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]);
item.BasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]); item.BasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]);
item.EveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]); item.EveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]);
// new fields
item.SalePrice = Convert.ToInt32(row["salePrice"]);
item.SaleType = Convert.ToByte(row["saleType"]);
item.CreationDate = Convert.ToInt32(row["creationDate"]);
item.GroupID = new LLUUID((string)row["groupID"]);
item.GroupOwned = Convert.ToBoolean(row["groupOwned"]);
item.Flags = Convert.ToUInt32(row["Flags"]);
return item; return item;
} }
@ -120,6 +128,14 @@ namespace OpenSim.Data.SQLite
row["inventoryCurrentPermissions"] = item.CurrentPermissions; row["inventoryCurrentPermissions"] = item.CurrentPermissions;
row["inventoryBasePermissions"] = item.BasePermissions; row["inventoryBasePermissions"] = item.BasePermissions;
row["inventoryEveryOnePermissions"] = item.EveryOnePermissions; row["inventoryEveryOnePermissions"] = item.EveryOnePermissions;
// new fields
row["salePrice"] = item.SalePrice;
row["saleType"] = item.SaleType;
row["creationDate"] = item.CreationDate;
row["groupID"] = item.GroupID;
row["groupOwned"] = item.GroupOwned;
row["flags"] = item.Flags;
} }
private void addFolder(InventoryFolderBase folder, bool add) private void addFolder(InventoryFolderBase folder, bool add)
@ -530,7 +546,21 @@ namespace OpenSim.Data.SQLite
createCol(inv, "inventoryBasePermissions", typeof (Int32)); createCol(inv, "inventoryBasePermissions", typeof (Int32));
createCol(inv, "inventoryEveryOnePermissions", typeof (Int32)); createCol(inv, "inventoryEveryOnePermissions", typeof (Int32));
inv.PrimaryKey = new DataColumn[] {inv.Columns["UUID"]}; // sale info
createCol(inv, "salePrice", typeof(Int32));
createCol(inv, "saleType", typeof(Byte));
// creation date
createCol(inv, "creationDate", typeof(Int32));
// group info
createCol(inv, "groupID", typeof(String));
createCol(inv, "groupOwned", typeof(Boolean));
// Flags
createCol(inv, "flags", typeof(UInt32));
inv.PrimaryKey = new DataColumn[] { inv.Columns["UUID"] };
return inv; return inv;
} }

View File

@ -721,7 +721,7 @@ namespace OpenSim.Data.SQLite
createCol(items, "everyonePermissions", typeof (UInt32)); createCol(items, "everyonePermissions", typeof (UInt32));
createCol(items, "groupPermissions", typeof (UInt32)); createCol(items, "groupPermissions", typeof (UInt32));
items.PrimaryKey = new DataColumn[] {items.Columns["itemID"]}; items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] };
return items; return items;
} }

View File

@ -325,7 +325,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
if ((userID == UserProfile.ID) && HasInventory) if ((userID == UserProfile.ID) && HasInventory)
{ {
m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); m_commsManager.InventoryService.UpdateInventoryItem(userID, itemInfo);
} }
} }

View File

@ -77,6 +77,13 @@ namespace OpenSim.Framework.Communications
/// <param name="item"></param> /// <param name="item"></param>
void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
/// <summary>
/// Update an item in the given user's inventory
/// </summary>
/// <param name="userID"></param>
/// <param name="item"></param>
void UpdateInventoryItem(LLUUID userID, InventoryItemBase item);
/// <summary> /// <summary>
/// Delete an item from the given user's inventory /// Delete an item from the given user's inventory
/// </summary> /// </summary>

View File

@ -172,6 +172,9 @@ namespace OpenSim.Framework.Communications
// See IInventoryServices // See IInventoryServices
public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
// See IInventoryServices
public abstract void UpdateInventoryItem(LLUUID userID, InventoryItemBase item);
// See IInventoryServices // See IInventoryServices
public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
@ -230,6 +233,14 @@ namespace OpenSim.Framework.Communications
} }
} }
protected void UpdateItem(InventoryItemBase item)
{
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{
plugin.Value.updateInventoryItem(item);
}
}
protected void DeleteItem(InventoryItemBase item) protected void DeleteItem(InventoryItemBase item)
{ {
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)

View File

@ -393,9 +393,12 @@ namespace OpenSim.Framework
public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID);
public delegate void UpdateInventoryItem( /* public delegate void UpdateInventoryItem(
IClientAPI remoteClient, LLUUID transactionID, LLUUID itemID, string name, string description, IClientAPI remoteClient, LLUUID transactionID, LLUUID itemID, string name, string description,
uint nextOwnerMask); uint nextOwnerMask);*/
public delegate void UpdateInventoryItem(
IClientAPI remoteClient, LLUUID transactionID, LLUUID itemID, InventoryItemBase itemUpd);
public delegate void CopyInventoryItem( public delegate void CopyInventoryItem(
IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID,
@ -756,4 +759,4 @@ namespace OpenSim.Framework
public byte[] usecircuit; public byte[] usecircuit;
public EndPoint userEP; public EndPoint userEP;
} }
} }

View File

@ -54,6 +54,10 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
private LLUUID _creator; private LLUUID _creator;
private LLUUID _owner;
private uint _nextPermissions;
/// <summary> /// <summary>
/// A mask containing permissions for the current owner (cannot be enforced) /// A mask containing permissions for the current owner (cannot be enforced)
/// </summary> /// </summary>
@ -89,20 +93,44 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
private string _name; private string _name;
/// <summary> /// <summary>
/// A mask containing the permissions for the next owner (cannot be enforced) ///
/// </summary> /// </summary>
private uint _nextPermissions; private LLUUID _groupID;
/// <summary> /// <summary>
/// The owner of this inventory item ///
/// </summary> /// </summary>
private LLUUID _owner; private bool _groupOwned;
public LLUUID ID /// <summary>
{ ///
get { return _id; } /// </summary>
set { _id = value; } private int _salePrice;
/// <summary>
///
/// </summary>
private byte _saleType;
/// <summary>
///
/// </summary>
private uint _flags;
/// <summary>
///
/// </summary>
public int _creationDate;
public LLUUID ID {
get {
return _id;
}
set {
_id = value;
}
} }
public int InvType public int InvType
@ -176,5 +204,77 @@ namespace OpenSim.Framework
get { return _assetID; } get { return _assetID; }
set { _assetID = value; } set { _assetID = value; }
} }
public LLUUID GroupID
{
get
{
return _groupID;
}
set
{
_groupID = value;
}
}
public bool GroupOwned
{
get
{
return _groupOwned;
}
set
{
_groupOwned = value;
}
}
public int SalePrice
{
get
{
return _salePrice;
}
set
{
_salePrice = value;
}
}
public byte SaleType
{
get
{
return _saleType;
}
set
{
_saleType = value;
}
}
public uint Flags
{
get
{
return _flags;
}
set
{
_flags = value;
}
}
public int CreationDate
{
get
{
return _creationDate;
}
set
{
_creationDate = value;
}
}
} }
} }

View File

@ -209,6 +209,11 @@ namespace OpenSim.Grid.InventoryServer
AddItem(item); AddItem(item);
} }
public override void UpdateInventoryItem(LLUUID userID, InventoryItemBase item)
{
UpdateItem(item);
}
public bool AddInventoryFolder(InventoryFolderBase folder) public bool AddInventoryFolder(InventoryFolderBase folder)
{ {
// Right now, this actions act more like an update/insert combination than a simple create. // Right now, this actions act more like an update/insert combination than a simple create.

View File

@ -1284,21 +1284,25 @@ namespace OpenSim.Region.ClientStack
descend.ItemData[i].AssetID = item.AssetID; descend.ItemData[i].AssetID = item.AssetID;
descend.ItemData[i].CreatorID = item.Creator; descend.ItemData[i].CreatorID = item.Creator;
descend.ItemData[i].BaseMask = item.BasePermissions; descend.ItemData[i].BaseMask = item.BasePermissions;
descend.ItemData[i].CreationDate = 1000;
descend.ItemData[i].Description = Helpers.StringToField(item.Description); descend.ItemData[i].Description = Helpers.StringToField(item.Description);
descend.ItemData[i].EveryoneMask = item.EveryOnePermissions; descend.ItemData[i].EveryoneMask = item.EveryOnePermissions;
descend.ItemData[i].Flags = 1; descend.ItemData[i].OwnerMask = item.CurrentPermissions;
descend.ItemData[i].FolderID = item.Folder; descend.ItemData[i].FolderID = item.Folder;
descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); descend.ItemData[i].InvType = (sbyte)item.InvType;
descend.ItemData[i].GroupMask = 0;
descend.ItemData[i].InvType = (sbyte) item.InvType;
descend.ItemData[i].Name = Helpers.StringToField(item.Name); descend.ItemData[i].Name = Helpers.StringToField(item.Name);
descend.ItemData[i].NextOwnerMask = item.NextPermissions; descend.ItemData[i].NextOwnerMask = item.NextPermissions;
descend.ItemData[i].OwnerID = item.Owner; descend.ItemData[i].OwnerID = item.Owner;
descend.ItemData[i].OwnerMask = item.CurrentPermissions; descend.ItemData[i].Type = (sbyte)item.AssetType;
descend.ItemData[i].SalePrice = 0;
descend.ItemData[i].SaleType = 0; //descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
descend.ItemData[i].Type = (sbyte) item.AssetType; descend.ItemData[i].GroupID = item.GroupID;
descend.ItemData[i].GroupOwned = item.GroupOwned;
descend.ItemData[i].GroupMask = 0;
descend.ItemData[i].CreationDate = item.CreationDate;
descend.ItemData[i].SalePrice = item.SalePrice;
descend.ItemData[i].SaleType = item.SaleType;
descend.ItemData[i].Flags = item.Flags;
descend.ItemData[i].CRC = descend.ItemData[i].CRC =
Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType,
descend.ItemData[i].InvType, descend.ItemData[i].Type, descend.ItemData[i].InvType, descend.ItemData[i].Type,
@ -1433,18 +1437,22 @@ namespace OpenSim.Region.ClientStack
(int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
inventoryReply.InventoryData[0].Description = Helpers.StringToField(item.Description); inventoryReply.InventoryData[0].Description = Helpers.StringToField(item.Description);
inventoryReply.InventoryData[0].EveryoneMask = item.EveryOnePermissions; inventoryReply.InventoryData[0].EveryoneMask = item.EveryOnePermissions;
inventoryReply.InventoryData[0].Flags = 0;
inventoryReply.InventoryData[0].FolderID = item.Folder; inventoryReply.InventoryData[0].FolderID = item.Folder;
inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
inventoryReply.InventoryData[0].GroupMask = 0;
inventoryReply.InventoryData[0].InvType = (sbyte)item.InvType; inventoryReply.InventoryData[0].InvType = (sbyte)item.InvType;
inventoryReply.InventoryData[0].Name = Helpers.StringToField(item.Name); inventoryReply.InventoryData[0].Name = Helpers.StringToField(item.Name);
inventoryReply.InventoryData[0].NextOwnerMask = item.NextPermissions; inventoryReply.InventoryData[0].NextOwnerMask = item.NextPermissions;
inventoryReply.InventoryData[0].OwnerID = item.Owner; inventoryReply.InventoryData[0].OwnerID = item.Owner;
inventoryReply.InventoryData[0].OwnerMask = item.CurrentPermissions; inventoryReply.InventoryData[0].OwnerMask = item.CurrentPermissions;
inventoryReply.InventoryData[0].SalePrice = 0;
inventoryReply.InventoryData[0].SaleType = 0;
inventoryReply.InventoryData[0].Type = (sbyte)item.AssetType; inventoryReply.InventoryData[0].Type = (sbyte)item.AssetType;
//inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
inventoryReply.InventoryData[0].GroupID = item.GroupID;
inventoryReply.InventoryData[0].GroupOwned = item.GroupOwned;
inventoryReply.InventoryData[0].GroupMask = 0;
inventoryReply.InventoryData[0].Flags = item.Flags;
inventoryReply.InventoryData[0].SalePrice = item.SalePrice;
inventoryReply.InventoryData[0].SaleType = item.SaleType;
inventoryReply.InventoryData[0].CRC = inventoryReply.InventoryData[0].CRC =
Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType, Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType,
inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID, inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID,
@ -1484,18 +1492,22 @@ namespace OpenSim.Region.ClientStack
bulkUpdate.ItemData[0].CreationDate = 1000; bulkUpdate.ItemData[0].CreationDate = 1000;
bulkUpdate.ItemData[0].Description = Helpers.StringToField(item.Description); bulkUpdate.ItemData[0].Description = Helpers.StringToField(item.Description);
bulkUpdate.ItemData[0].EveryoneMask = item.EveryOnePermissions; bulkUpdate.ItemData[0].EveryoneMask = item.EveryOnePermissions;
bulkUpdate.ItemData[0].Flags = 0;
bulkUpdate.ItemData[0].FolderID = item.Folder; bulkUpdate.ItemData[0].FolderID = item.Folder;
bulkUpdate.ItemData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
bulkUpdate.ItemData[0].GroupMask = 0;
bulkUpdate.ItemData[0].InvType = (sbyte)item.InvType; bulkUpdate.ItemData[0].InvType = (sbyte)item.InvType;
bulkUpdate.ItemData[0].Name = Helpers.StringToField(item.Name); bulkUpdate.ItemData[0].Name = Helpers.StringToField(item.Name);
bulkUpdate.ItemData[0].NextOwnerMask = item.NextPermissions; bulkUpdate.ItemData[0].NextOwnerMask = item.NextPermissions;
bulkUpdate.ItemData[0].OwnerID = item.Owner; bulkUpdate.ItemData[0].OwnerID = item.Owner;
bulkUpdate.ItemData[0].OwnerMask = item.CurrentPermissions; bulkUpdate.ItemData[0].OwnerMask = item.CurrentPermissions;
bulkUpdate.ItemData[0].SalePrice = 100;
bulkUpdate.ItemData[0].SaleType = 0;
bulkUpdate.ItemData[0].Type = (sbyte)item.AssetType; bulkUpdate.ItemData[0].Type = (sbyte)item.AssetType;
//bulkUpdate.ItemData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
bulkUpdate.ItemData[0].GroupID = item.GroupID;
bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned;
bulkUpdate.ItemData[0].GroupMask = 0;
bulkUpdate.ItemData[0].Flags = item.Flags;
bulkUpdate.ItemData[0].SalePrice = item.SalePrice;
bulkUpdate.ItemData[0].SaleType = item.SaleType;
bulkUpdate.ItemData[0].CRC = bulkUpdate.ItemData[0].CRC =
Helpers.InventoryCRC(1000, 0, bulkUpdate.ItemData[0].InvType, Helpers.InventoryCRC(1000, 0, bulkUpdate.ItemData[0].InvType,
bulkUpdate.ItemData[0].Type, bulkUpdate.ItemData[0].AssetID, bulkUpdate.ItemData[0].Type, bulkUpdate.ItemData[0].AssetID,
@ -1526,21 +1538,24 @@ namespace OpenSim.Region.ClientStack
InventoryReply.InventoryData[0].AssetID = Item.AssetID; InventoryReply.InventoryData[0].AssetID = Item.AssetID;
InventoryReply.InventoryData[0].CreatorID = Item.Creator; InventoryReply.InventoryData[0].CreatorID = Item.Creator;
InventoryReply.InventoryData[0].BaseMask = Item.BasePermissions; InventoryReply.InventoryData[0].BaseMask = Item.BasePermissions;
InventoryReply.InventoryData[0].CreationDate = 1000;
InventoryReply.InventoryData[0].Description = Helpers.StringToField(Item.Description); InventoryReply.InventoryData[0].Description = Helpers.StringToField(Item.Description);
InventoryReply.InventoryData[0].EveryoneMask = Item.EveryOnePermissions; InventoryReply.InventoryData[0].EveryoneMask = Item.EveryOnePermissions;
InventoryReply.InventoryData[0].Flags = 0;
InventoryReply.InventoryData[0].FolderID = Item.Folder; InventoryReply.InventoryData[0].FolderID = Item.Folder;
InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
InventoryReply.InventoryData[0].GroupMask = 0;
InventoryReply.InventoryData[0].InvType = (sbyte)Item.InvType; InventoryReply.InventoryData[0].InvType = (sbyte)Item.InvType;
InventoryReply.InventoryData[0].Name = Helpers.StringToField(Item.Name); InventoryReply.InventoryData[0].Name = Helpers.StringToField(Item.Name);
InventoryReply.InventoryData[0].NextOwnerMask = Item.NextPermissions; InventoryReply.InventoryData[0].NextOwnerMask = Item.NextPermissions;
InventoryReply.InventoryData[0].OwnerID = Item.Owner; InventoryReply.InventoryData[0].OwnerID = Item.Owner;
InventoryReply.InventoryData[0].OwnerMask = Item.CurrentPermissions; InventoryReply.InventoryData[0].OwnerMask = Item.CurrentPermissions;
InventoryReply.InventoryData[0].SalePrice = 100;
InventoryReply.InventoryData[0].SaleType = 0;
InventoryReply.InventoryData[0].Type = (sbyte)Item.AssetType; InventoryReply.InventoryData[0].Type = (sbyte)Item.AssetType;
//InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
InventoryReply.InventoryData[0].GroupID = Item.GroupID;
InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned;
InventoryReply.InventoryData[0].GroupMask = 0;
InventoryReply.InventoryData[0].Flags = Item.Flags;
InventoryReply.InventoryData[0].SalePrice = Item.SalePrice;
InventoryReply.InventoryData[0].SaleType = Item.SaleType;
InventoryReply.InventoryData[0].CRC = InventoryReply.InventoryData[0].CRC =
Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType,
InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID,
@ -4162,11 +4177,30 @@ namespace OpenSim.Region.ClientStack
if (handlerUpdateInventoryItem != null) if (handlerUpdateInventoryItem != null)
{ {
InventoryItemBase itemUpd = new InventoryItemBase();
itemUpd.ID = update.InventoryData[i].ItemID;
itemUpd.Name = Util.FieldToString(update.InventoryData[i].Name);
itemUpd.Description = Util.FieldToString(update.InventoryData[i].Description);
itemUpd.GroupID = update.InventoryData[i].GroupID;
itemUpd.GroupOwned = update.InventoryData[i].GroupOwned;
itemUpd.NextPermissions = update.InventoryData[i].NextOwnerMask;
itemUpd.EveryOnePermissions = update.InventoryData[i].EveryoneMask;
itemUpd.CreationDate = update.InventoryData[i].CreationDate;
itemUpd.Folder = update.InventoryData[i].FolderID;
itemUpd.InvType = update.InventoryData[i].InvType;
itemUpd.SalePrice = update.InventoryData[i].SalePrice;
itemUpd.SaleType = update.InventoryData[i].SaleType;
itemUpd.Flags = update.InventoryData[i].Flags;
/*
OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID,
update.InventoryData[i].ItemID, update.InventoryData[i].ItemID,
Util.FieldToString(update.InventoryData[i].Name), Util.FieldToString(update.InventoryData[i].Name),
Util.FieldToString(update.InventoryData[i].Description), Util.FieldToString(update.InventoryData[i].Description),
update.InventoryData[i].NextOwnerMask); update.InventoryData[i].NextOwnerMask);
*/
OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID,
update.InventoryData[i].ItemID,
itemUpd);
} }
} }
} }

View File

@ -95,6 +95,11 @@ namespace OpenSim.Region.Communications.Local
AddItem(item); AddItem(item);
} }
public override void UpdateInventoryItem(LLUUID userID, InventoryItemBase item)
{
UpdateItem(item);
}
public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
DeleteItem(item); DeleteItem(item);

View File

@ -229,6 +229,21 @@ namespace OpenSim.Region.Communications.OGS1
} }
} }
// TODO: this is a temporary workaround, the UpdateInventoryItem method need to be implemented
public void UpdateInventoryItem(LLUUID userID, InventoryItemBase item)
{
try
{
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
"POST", _inventoryServerUrl + "/NewItem/", item);
}
catch (System.Net.WebException e)
{
m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}",
e.Source, e.Message);
}
}
/// <summary> /// <summary>
/// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
/// </summary> /// </summary>

View File

@ -150,6 +150,7 @@ namespace OpenSim.Region.Environment.Modules
private string m_description = String.Empty; private string m_description = String.Empty;
private sbyte type = 0; private sbyte type = 0;
private sbyte invType = 0; private sbyte invType = 0;
private byte wearableType = 0;
private uint nextPerm = 0; private uint nextPerm = 0;
private bool m_finished = false; private bool m_finished = false;
private bool m_createItem = false; private bool m_createItem = false;
@ -314,6 +315,7 @@ namespace OpenSim.Region.Environment.Modules
m_description = description; m_description = description;
this.type = type; this.type = type;
this.invType = invType; this.invType = invType;
this.wearableType = wearableType;
nextPerm = nextOwnerMask; nextPerm = nextOwnerMask;
Asset.Name = name; Asset.Name = name;
Asset.Description = description; Asset.Description = description;
@ -386,6 +388,7 @@ namespace OpenSim.Region.Environment.Modules
item.BasePermissions = 2147483647; item.BasePermissions = 2147483647;
item.CurrentPermissions = 2147483647; item.CurrentPermissions = 2147483647;
item.NextPermissions = nextPerm; item.NextPermissions = nextPerm;
item.Flags = (uint)wearableType;
userInfo.AddItem(ourClient.AgentId, item); userInfo.AddItem(ourClient.AgentId, item);
ourClient.SendInventoryItemCreateUpdate(item); ourClient.SendInventoryItemCreateUpdate(item);

View File

@ -260,9 +260,11 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="name">The name of the updated item</param> /// <param name="name">The name of the updated item</param>
/// <param name="description">The description of the updated item</param> /// <param name="description">The description of the updated item</param>
/// <param name="nextOwnerMask">The permissions of the updated item</param> /// <param name="nextOwnerMask">The permissions of the updated item</param>
public void UpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, /* public void UpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID,
LLUUID itemID, string name, string description, LLUUID itemID, string name, string description,
uint nextOwnerMask) uint nextOwnerMask)*/
public void UpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID,
LLUUID itemID, InventoryItemBase itemUpd)
{ {
CachedUserInfo userInfo CachedUserInfo userInfo
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
@ -275,9 +277,22 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (LLUUID.Zero == transactionID) if (LLUUID.Zero == transactionID)
{ {
item.Name = name; item.Name = itemUpd.Name;
item.Description = description; item.Description = itemUpd.Description;
item.NextPermissions = nextOwnerMask; item.NextPermissions = itemUpd.NextPermissions;
item.EveryOnePermissions = itemUpd.EveryOnePermissions;
// TODO: Requires sanity checks
//item.GroupID = itemUpd.GroupID;
//item.GroupOwned = itemUpd.GroupOwned;
//item.CreationDate = itemUpd.CreationDate;
// TODO: Check if folder changed and move item
//item.NextPermissions = itemUpd.Folder;
item.InvType = itemUpd.InvType;
item.SalePrice = itemUpd.SalePrice;
item.SaleType = itemUpd.SaleType;
item.Flags = itemUpd.Flags;
userInfo.UpdateItem(remoteClient.AgentId, item); userInfo.UpdateItem(remoteClient.AgentId, item);
} }
@ -351,6 +366,12 @@ namespace OpenSim.Region.Environment.Scenes
itemCopy.BasePermissions = item.BasePermissions; itemCopy.BasePermissions = item.BasePermissions;
itemCopy.CurrentPermissions = item.CurrentPermissions; itemCopy.CurrentPermissions = item.CurrentPermissions;
itemCopy.GroupID = item.GroupID;
itemCopy.GroupOwned = item.GroupOwned;
itemCopy.Flags = item.Flags;
itemCopy.SalePrice = item.SalePrice;
itemCopy.SaleType = item.SaleType;
recipientUserInfo.AddItem(recipientClient.AgentId, itemCopy); recipientUserInfo.AddItem(recipientClient.AgentId, itemCopy);
// Let the recipient client know about this new item // Let the recipient client know about this new item
@ -988,6 +1009,8 @@ namespace OpenSim.Region.Environment.Scenes
item.NextPermissions = objectGroup.RootPart.NextOwnerMask; item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
} }
// TODO: add the new fields (Flags, Sale info, etc)
userInfo.AddItem(remoteClient.AgentId, item); userInfo.AddItem(remoteClient.AgentId, item);
remoteClient.SendInventoryItemCreateUpdate(item); remoteClient.SendInventoryItemCreateUpdate(item);
} }