From 531f64a53bbd084dd8d0b33ae6c49821c74d718a Mon Sep 17 00:00:00 2001
From: MW
Date: Thu, 16 Aug 2007 16:31:32 +0000
Subject: Taking Prims (SceneObjectGroups) in and out of inventory should now
work and if left in inventory will still be there after restarts. (as with
the rest of inventory it will only fully work in standalone mode with account
authentication turned on).
---
.../Framework/Communications/Cache/AssetCache.cs | 69 ++++++++++++++--------
.../Communications/Cache/CachedUserInfo.cs | 16 ++++-
.../Communications/Cache/InventoryFolder.cs | 20 +++++++
.../Framework/Communications/IInventoryServices.cs | 1 +
OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | 9 +++
.../Framework/Data.SQLite/SQLiteInventoryStore.cs | 17 ++++++
OpenSim/Framework/Data/InventoryData.cs | 6 ++
OpenSim/Framework/General/Interfaces/IClientAPI.cs | 3 +-
OpenSim/Framework/General/NullClientAPI.cs | 1 +
.../InventoryServiceBase/InventoryServiceBase.cs | 8 +++
10 files changed, 122 insertions(+), 28 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 3866e21..c08bef2 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -137,6 +137,16 @@ namespace OpenSim.Framework.Communications.Caches
return asset;
}
+ public AssetBase GetAsset(LLUUID assetID, bool isTexture)
+ {
+ AssetBase asset = GetAsset(assetID);
+ if (asset == null)
+ {
+ this._assetServer.RequestAsset(assetID, isTexture);
+ }
+ return asset;
+ }
+
public void AddAsset(AssetBase asset)
{
// Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated());
@@ -241,44 +251,51 @@ namespace OpenSim.Framework.Communications.Caches
if (IsTexture)
{
// Console.WriteLine("asset recieved from asset server");
+
TextureImage image = new TextureImage(asset);
- this.Textures.Add(image.FullID, image);
- if (this.RequestedTextures.ContainsKey(image.FullID))
+ if (!this.Textures.ContainsKey(image.FullID))
{
- AssetRequest req = this.RequestedTextures[image.FullID];
- req.ImageInfo = image;
- if (image.Data.LongLength > 600)
- {
- //over 600 bytes so split up file
- req.NumPackets = 1 + (int)(image.Data.Length - 600 ) / 1000;
- }
- else
+ this.Textures.Add(image.FullID, image);
+ if (this.RequestedTextures.ContainsKey(image.FullID))
{
- req.NumPackets = 1;
+ AssetRequest req = this.RequestedTextures[image.FullID];
+ req.ImageInfo = image;
+ if (image.Data.LongLength > 600)
+ {
+ //over 600 bytes so split up file
+ req.NumPackets = 1 + (int)(image.Data.Length - 600) / 1000;
+ }
+ else
+ {
+ req.NumPackets = 1;
+ }
+ this.RequestedTextures.Remove(image.FullID);
+ this.TextureRequests.Add(req);
}
- this.RequestedTextures.Remove(image.FullID);
- this.TextureRequests.Add(req);
}
}
else
{
AssetInfo assetInf = new AssetInfo(asset);
- this.Assets.Add(assetInf.FullID, assetInf);
- if (this.RequestedAssets.ContainsKey(assetInf.FullID))
+ if (!this.Assets.ContainsKey(assetInf.FullID))
{
- AssetRequest req = this.RequestedAssets[assetInf.FullID];
- req.AssetInf = assetInf;
- if (assetInf.Data.LongLength > 600)
- {
- //over 600 bytes so split up file
- req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
- }
- else
+ this.Assets.Add(assetInf.FullID, assetInf);
+ if (this.RequestedAssets.ContainsKey(assetInf.FullID))
{
- req.NumPackets = 1;
+ AssetRequest req = this.RequestedAssets[assetInf.FullID];
+ req.AssetInf = assetInf;
+ if (assetInf.Data.LongLength > 600)
+ {
+ //over 600 bytes so split up file
+ req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
+ }
+ else
+ {
+ req.NumPackets = 1;
+ }
+ this.RequestedAssets.Remove(assetInf.FullID);
+ this.AssetRequests.Add(req);
}
- this.RequestedAssets.Remove(assetInf.FullID);
- this.AssetRequests.Add(req);
}
}
}
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 9970d80..ddb5658 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -105,13 +105,27 @@ namespace OpenSim.Framework.Communications.Caches
}
}
- public void updateItem(LLUUID userID, InventoryItemBase itemInfo)
+ public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo)
{
if ((userID == this.UserProfile.UUID) && (this.RootFolder != null))
{
this.m_parentCommsManager.InventoryServer.AddNewInventoryItem(userID, itemInfo);
}
}
+
+ public bool DeleteItem(LLUUID userID, InventoryItemBase item)
+ {
+ bool result = false;
+ if ((userID == this.UserProfile.UUID) && (this.RootFolder != null))
+ {
+ result = RootFolder.DeleteItem(item.inventoryID);
+ if (result)
+ {
+ this.m_parentCommsManager.InventoryServer.DeleteInventoryItem(userID, item);
+ }
+ }
+ return result;
+ }
}
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
index 6b0e2b4..34f83db 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
@@ -90,6 +90,26 @@ namespace OpenSim.Framework.Communications.Caches
return base2;
}
+ public bool DeleteItem(LLUUID itemID)
+ {
+ bool found = false;
+ if (this.Items.ContainsKey(itemID))
+ {
+ Items.Remove(itemID);
+ return true;
+ }
+ foreach (InventoryFolder folder in this.SubFolders.Values)
+ {
+ found = folder.DeleteItem(itemID);
+ if (found == true)
+ {
+ break;
+ }
+ }
+ return found;
+ }
+
+
public InventoryFolder HasSubFolder(LLUUID folderID)
{
InventoryFolder returnFolder = null;
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index 6f01cf2..bd58756 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -16,5 +16,6 @@ namespace OpenSim.Framework.Communications
void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
+ void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
}
}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
index d8bfc4d..b02aa93 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
@@ -320,6 +320,15 @@ namespace OpenSim.Framework.Data.MySQL
}
///
+ ///
+ ///
+ ///
+ public void deleteInventoryItem(InventoryItemBase item)
+ {
+
+ }
+
+ ///
/// Creates a new inventory folder
///
/// Folder to create
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index 045fbee..fe494fb 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -447,6 +447,23 @@ namespace OpenSim.Framework.Data.SQLite
}
///
+ ///
+ ///
+ ///
+ public void deleteInventoryItem(InventoryItemBase item)
+ {
+ DataTable inventoryItemTable = ds.Tables["inventoryitems"];
+
+ DataRow inventoryRow = inventoryItemTable.Rows.Find(item.inventoryID);
+ if (inventoryRow != null)
+ {
+ inventoryRow.Delete();
+ }
+
+ this.invItemsDa.Update(ds, "inventoryitems");
+ }
+
+ ///
/// Adds a new folder specified by folder
///
/// The inventory folder
diff --git a/OpenSim/Framework/Data/InventoryData.cs b/OpenSim/Framework/Data/InventoryData.cs
index a12b87b..38c251c 100644
--- a/OpenSim/Framework/Data/InventoryData.cs
+++ b/OpenSim/Framework/Data/InventoryData.cs
@@ -202,6 +202,12 @@ namespace OpenSim.Framework.Data
void updateInventoryItem(InventoryItemBase item);
///
+ ///
+ ///
+ ///
+ void deleteInventoryItem(InventoryItemBase item);
+
+ ///
/// Adds a new folder specified by folder
///
/// The inventory folder
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index f39d0c7..8db1e15 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Framework.Interfaces
{
public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message); // Cut down from full list
- public delegate void RezObject(AssetBase primAsset, LLVector3 pos);
+ public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos);
public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient);
public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
public delegate void StartAnim(LLUUID animID, int seq);
@@ -210,6 +210,7 @@ namespace OpenSim.Framework.Interfaces
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items);
void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
void SendInventoryItemUpdate(InventoryItemBase Item);
+ void SendRemoveInventoryItem(LLUUID itemID);
void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName);
void SendNameReply(LLUUID profileId, string firstname, string lastname);
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs
index e85b88f..6be2563 100644
--- a/OpenSim/Framework/General/NullClientAPI.cs
+++ b/OpenSim/Framework/General/NullClientAPI.cs
@@ -138,6 +138,7 @@ namespace OpenSim.Framework
public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items){}
public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item){}
public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { }
+ public virtual void SendRemoveInventoryItem(LLUUID itemID) { }
public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { }
public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){}
diff --git a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
index bc55d05..20d3a77 100644
--- a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
+++ b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
@@ -124,6 +124,14 @@ namespace OpenSim.Framework.InventoryServiceBase
}
}
+ public void deleteItem(InventoryItemBase item)
+ {
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ plugin.Value.deleteInventoryItem(item);
+ }
+ }
+
///
///
///
--
cgit v1.1