From 181a90967ee9084676f84e74b2393855218c5723 Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 14 Aug 2007 17:29:15 +0000 Subject: Start of inventory items, when you upload a texture the data will now be stored in the inventory database and you will still have that texture in inventory on later logins (Again only in standalone mode with authentication.) Also there might be some problems if you upload textures in other regions to the start one (due to us not updating the CAPS url properly). --- .../Communications/Cache/AssetTransactions.cs | 4 +- .../Communications/Cache/CachedUserInfo.cs | 21 +++++- .../Communications/Cache/UserProfileCache.cs | 2 +- .../Framework/Communications/Capabilities/Caps.cs | 43 +++++++++++-- .../Framework/Communications/IInventoryServices.cs | 1 + .../Framework/Data.SQLite/SQLiteInventoryStore.cs | 75 ++++++++++++++++++++-- .../InventoryServiceBase/InventoryServiceBase.cs | 8 +++ .../Communications/Local/LocalInventoryService.cs | 11 ++++ .../Communications/OGS1/OGS1InventoryService.cs | 5 ++ .../Environment/Scenes/Scene.PacketHandlers.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 72 +++++++++++++-------- 11 files changed, 203 insertions(+), 41 deletions(-) diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs index c906b76..e12d234 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs +++ b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs @@ -128,7 +128,7 @@ namespace OpenSim.Framework.Communications.Caches } if (this.OnUpLoad != null) { - this.OnUpLoad(this.m_assetName, this.newAssetID, inventoryItemID, data); + this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data); } return text; } @@ -266,7 +266,7 @@ namespace OpenSim.Framework.Communications.Caches } if (this.OnUpLoad != null) { - this.OnUpLoad(this.m_assetName, this.newAssetID, inventoryItemID, data); + this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data); } return text; } diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index fc2f948..123e692 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -40,10 +40,16 @@ namespace OpenSim.Framework.Communications.Caches { public class CachedUserInfo { + private CommunicationsManager m_parentCommsManager; // Fields public InventoryFolder RootFolder = null; public UserProfileData UserProfile = null; + public CachedUserInfo(CommunicationsManager commsManager) + { + m_parentCommsManager = commsManager; + } + // Methods public void FolderReceive(LLUUID userID, InventoryFolder folderInfo) { @@ -73,6 +79,7 @@ namespace OpenSim.Framework.Communications.Caches public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) { + Console.WriteLine("received new inventory item " + itemInfo.inventoryID + " with asset id of " + itemInfo.assetID); if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) { if (itemInfo.parentFolderID == this.RootFolder.folderID) @@ -84,11 +91,23 @@ namespace OpenSim.Framework.Communications.Caches InventoryFolder folder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID); if (folder != null) { - folder.Items.Add(itemInfo.inventoryID, itemInfo); + folder.Items.Add(itemInfo.inventoryID, itemInfo); } } } } + + public void AddItem(LLUUID userID, InventoryItemBase itemInfo) + { + if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) + { + this.ItemReceive(userID, itemInfo); + Console.WriteLine("now adding inventory item to database"); + this.m_parentCommsManager.InventoryServer.AddNewInventoryItem(userID, itemInfo); + } + } } + + } diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs index e65b6b2..02c5f65 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs @@ -61,7 +61,7 @@ namespace OpenSim.Framework.Communications.Caches { if (!this.UserProfiles.ContainsKey(userID)) { - CachedUserInfo userInfo = new CachedUserInfo(); + CachedUserInfo userInfo = new CachedUserInfo(this.m_parent); userInfo.UserProfile = this.RequestUserProfileForUser(userID); if (userInfo.UserProfile != null) { diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 82ef08d..eb88aa7 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -35,10 +35,12 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; using OpenSim.Framework.Communications.Caches; +using OpenSim.Framework.Data; namespace OpenSim.Region.Capabilities { - public delegate void UpLoadedTexture(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data); + public delegate void UpLoadedTexture(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data); + public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); public class Caps { @@ -56,6 +58,7 @@ namespace OpenSim.Region.Capabilities private AssetCache assetCache; private int eventQueueCount = 1; private Queue CapsEventQueue = new Queue(); + public NewInventoryItem AddNewInventoryItem = null; public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent) { @@ -122,7 +125,7 @@ namespace OpenSim.Region.Capabilities string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; caps.MapLayer = capsBaseUrl + m_mapLayerPath; caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; - caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; + // caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; return caps; } @@ -242,7 +245,7 @@ namespace OpenSim.Region.Capabilities LLUUID newInvItem = LLUUID.Random(); string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); - AssetUploader uploader = new AssetUploader(assetName, newAsset, newInvItem, capsBase + uploaderPath, this.httpListener); + AssetUploader uploader = new AssetUploader(assetName, "description", newAsset, newInvItem, LLUUID.Zero, "", "", capsBase + uploaderPath, this.httpListener); httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; @@ -261,13 +264,16 @@ namespace OpenSim.Region.Capabilities public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) { // Console.WriteLine("asset upload request via CAPS"); + string assetName = llsdRequest.name; + string assetDes = llsdRequest.description; string capsBase = "/CAPS/" + m_capsObjectPath; LLUUID newAsset = LLUUID.Random(); LLUUID newInvItem = LLUUID.Random(); + LLUUID parentFolder = llsdRequest.folder_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); - AssetUploader uploader = new AssetUploader(assetName, newAsset, newInvItem, capsBase + uploaderPath, this.httpListener); + AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, "" , "", capsBase + uploaderPath, this.httpListener); httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; @@ -284,7 +290,7 @@ namespace OpenSim.Region.Capabilities /// /// /// - public void UploadCompleteHandler(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data) + public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data) { AssetBase asset; asset = new AssetBase(); @@ -294,6 +300,25 @@ namespace OpenSim.Region.Capabilities asset.Name = assetName; asset.Data = data; this.assetCache.AddAsset(asset); + + InventoryItemBase item = new InventoryItemBase(); + item.avatarID = agentID; + item.creatorsID = agentID; + item.inventoryID = inventoryItem; + item.assetID = asset.FullID; + item.inventoryDescription = assetDescription; + item.inventoryName = assetName; + item.assetType = 0; + item.invType = 0; + item.parentFolderID = parentFolder; + item.inventoryCurrentPermissions = 2147483647; + item.inventoryNextPermissions = 2147483647; + + if (AddNewInventoryItem != null) + { + AddNewInventoryItem(agentID, item); + } + } public class AssetUploader @@ -303,9 +328,11 @@ namespace OpenSim.Region.Capabilities private string uploaderPath = ""; private LLUUID newAssetID; private LLUUID inventoryItemID; + private LLUUID parentFolder; private BaseHttpServer httpListener; private bool SaveAssets = false; private string m_assetName = ""; + private string m_assetDes = ""; /// /// @@ -314,13 +341,15 @@ namespace OpenSim.Region.Capabilities /// /// /// - public AssetUploader(string assetName, LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) + public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolderID, string invType, string assetType, string path, BaseHttpServer httpServer) { m_assetName = assetName; + m_assetDes = description; newAssetID = assetID; inventoryItemID = inventoryItem; uploaderPath = path; httpListener = httpServer; + parentFolder = parentFolderID; } /// @@ -348,7 +377,7 @@ namespace OpenSim.Region.Capabilities if (OnUpLoad != null) { - OnUpLoad(m_assetName, newAssetID, inv, data); + OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data); } return res; diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index 777dbe2..6f01cf2 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs @@ -15,5 +15,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); } } diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs index 811a355..045fbee 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs @@ -91,7 +91,7 @@ namespace OpenSim.Framework.Data.SQLite data.Add("inventoryCurrentPermissions", DbType.Int32); data.Add("inventoryBasePermissions", DbType.Int32); data.Add("inventoryEveryOnePermissions", DbType.Int32); - + return data; } @@ -219,6 +219,44 @@ namespace OpenSim.Framework.Data.SQLite row["version"] = folder.version; } + public InventoryItemBase BuildItem(DataRow row) + { + InventoryItemBase item = new InventoryItemBase(); + item.inventoryID = new LLUUID((string)row["UUID"]); + item.assetID = new LLUUID((string)row["assetID"]); + item.assetType = Convert.ToInt32(row["assetType"]); + item.invType = Convert.ToInt32(row["invType"]); + item.parentFolderID = new LLUUID((string)row["parentFolderID"]); + item.avatarID = new LLUUID((string)row["avatarID"]); + item.creatorsID = new LLUUID((string)row["creatorsID"]); + item.inventoryName =(string) row["inventoryName"]; + item.inventoryDescription = (string) row["inventoryDescription"]; + + item.inventoryNextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]); + item.inventoryCurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]); + item.inventoryBasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]); + item.inventoryEveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]); + return item; + } + + private void fillItemRow(DataRow row, InventoryItemBase item) + { + row["UUID"] = item.inventoryID; + row["assetID"] = item.assetID; + row["assetType"] = item.assetType; + row["invType"] = item.invType; + row["parentFolderID"] = item.parentFolderID; + row["avatarID"] = item.avatarID; + row["creatorsID"] = item.creatorsID; + row["inventoryName"] = item.inventoryName; + row["inventoryDescription"] = item.inventoryDescription; + + row["inventoryNextPermissions"] = item.inventoryNextPermissions; + row["inventoryCurrentPermissions"] = item.inventoryCurrentPermissions; + row["inventoryBasePermissions"] = item.inventoryBasePermissions; + row["inventoryEveryOnePermissions"] = item.inventoryEveryOnePermissions; + } + private void addFolder(InventoryFolderBase folder) { DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; @@ -238,6 +276,24 @@ namespace OpenSim.Framework.Data.SQLite this.invFoldersDa.Update(ds, "inventoryfolders"); } + private void addItem(InventoryItemBase item) + { + DataTable inventoryItemTable = ds.Tables["inventoryitems"]; + + DataRow inventoryRow = inventoryItemTable.Rows.Find(item.inventoryID); + if (inventoryRow == null) + { + inventoryRow = inventoryItemTable.NewRow(); + fillItemRow(inventoryRow, item); + inventoryItemTable.Rows.Add(inventoryRow); + } + else + { + fillItemRow(inventoryRow, item); + } + this.invItemsDa.Update(ds, "inventoryitems"); + } + public void Shutdown() { // TODO: DataSet commit @@ -275,7 +331,16 @@ namespace OpenSim.Framework.Data.SQLite /// A List of InventoryItemBase items public List getInventoryInFolder(LLUUID folderID) { - return null; + List retval = new List(); + DataTable inventoryItemTable = ds.Tables["inventoryitems"]; + string selectExp = "parentFolderID = '" + folderID.ToString() + "'"; + DataRow[] rows = inventoryItemTable.Select(selectExp); + foreach (DataRow row in rows) + { + retval.Add(BuildItem(row)); + } + + return retval; } /// @@ -297,7 +362,7 @@ namespace OpenSim.Framework.Data.SQLite { List folders = new List(); DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; - string selectExp = "agentID = '"+ user.ToString()+"' AND parentID = '"+ LLUUID.Zero.ToString()+"'"; + string selectExp = "agentID = '" + user.ToString() + "' AND parentID = '" + LLUUID.Zero.ToString() + "'"; DataRow[] rows = inventoryFolderTable.Select(selectExp); foreach (DataRow row in rows) { @@ -339,7 +404,7 @@ namespace OpenSim.Framework.Data.SQLite { folders.Add(this.buildFolder(row)); } - // System.Console.WriteLine("found " + folders.Count + " inventory folders"); + // System.Console.WriteLine("found " + folders.Count + " inventory folders"); return folders; } @@ -369,6 +434,7 @@ namespace OpenSim.Framework.Data.SQLite /// The item to be created public void addInventoryItem(InventoryItemBase item) { + this.addItem(item); } /// @@ -377,6 +443,7 @@ namespace OpenSim.Framework.Data.SQLite /// The updated item public void updateInventoryItem(InventoryItemBase item) { + this.addItem(item); } /// diff --git a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs index 10da633..bc55d05 100644 --- a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs +++ b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs @@ -116,6 +116,14 @@ namespace OpenSim.Framework.InventoryServiceBase } } + public void AddItem(InventoryItemBase item) + { + foreach (KeyValuePair plugin in m_plugins) + { + plugin.Value.addInventoryItem(item); + } + } + /// /// /// diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index 6ba024a..8295cfa 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs @@ -43,6 +43,12 @@ namespace OpenSim.Region.Communications.Local { InventoryFolder newfolder = new InventoryFolder(folder); folderCallBack(userID, newfolder); + + List items = this.RequestFolderItems(newfolder.folderID); + foreach (InventoryItemBase item in items) + { + itemCallBack(userID, item); + } } } } @@ -52,5 +58,10 @@ namespace OpenSim.Region.Communications.Local { this.AddFolder(folder); } + + public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) + { + this.AddItem(item); + } } } diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index e8355c6..a98684e 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -24,5 +24,10 @@ namespace OpenSim.Region.Communications.OGS1 { } + + public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) + { + + } } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 72dc9c0..e61a5bd 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -727,7 +727,7 @@ namespace OpenSim.Region.Environment.Scenes item.inventoryCurrentPermissions = 2147483647; item.inventoryNextPermissions = nextOwnerMask; - userInfo.ItemReceive(remoteClient.AgentId, item); + userInfo.AddItem(remoteClient.AgentId, item); remoteClient.SendInventoryItemUpdate(item); } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 4254f74..f83e43c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -41,8 +41,9 @@ using OpenSim.Framework.Communications.Caches; using OpenSim.Region.Environment.LandManagement; using OpenSim.Region.Scripting; using OpenSim.Region.Terrain; -using Caps=OpenSim.Region.Capabilities.Caps; -using Timer=System.Timers.Timer; +using OpenSim.Framework.Data; +using Caps = OpenSim.Region.Capabilities.Caps; +using Timer = System.Timers.Timer; namespace OpenSim.Region.Environment.Scenes { @@ -205,7 +206,7 @@ namespace OpenSim.Region.Environment.Scenes phyScene.GetResults(); } - List moveEntities = new List( Entities.Values ); + List moveEntities = new List(Entities.Values); foreach (EntityBase entity in moveEntities) { @@ -503,9 +504,9 @@ namespace OpenSim.Region.Environment.Scenes { if (obj is SceneObjectGroup) { - if (((SceneObjectGroup) obj).LocalId == localID) + if (((SceneObjectGroup)obj).LocalId == localID) { - RemoveEntity((SceneObjectGroup) obj); + RemoveEntity((SceneObjectGroup)obj); return; } } @@ -607,8 +608,8 @@ namespace OpenSim.Region.Environment.Scenes new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); - - //client.OnCreateNewInventoryItem += CreateNewInventoryItem; + + //client.OnCreateNewInventoryItem += CreateNewInventoryItem; client.OnCreateNewInventoryFolder += commsManager.UserProfiles.HandleCreateInventoryFolder; client.OnFetchInventoryDescendents += commsManager.UserProfiles.HandleFecthInventoryDescendents; client.OnRequestTaskInventory += RequestTaskInventory; @@ -670,9 +671,9 @@ namespace OpenSim.Region.Environment.Scenes ForEachScenePresence( delegate(ScenePresence presence) - { - presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId); - }); + { + presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId); + }); lock (Avatars) { @@ -689,7 +690,7 @@ namespace OpenSim.Region.Environment.Scenes } } // TODO: Add the removal from physics ? - + // Remove client agent from profile, so new logins will work commsManager.UserServer.clearUserAgent(agentID); @@ -787,7 +788,7 @@ namespace OpenSim.Region.Environment.Scenes { if (ent is SceneObjectGroup) { - ((SceneObjectGroup) ent).SendFullUpdateToClient(client); + ((SceneObjectGroup)ent).SendFullUpdateToClient(client); } } } @@ -825,6 +826,7 @@ namespace OpenSim.Region.Environment.Scenes new Caps(assetCache, httpListener, m_regInfo.ExternalHostName, m_regInfo.ExternalEndPoint.Port, agent.CapsPath, agent.AgentID); cap.RegisterHandlers(); + cap.AddNewInventoryItem = this.AddInventoryItem; if (capsHandlers.ContainsKey(agent.AgentID)) { MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + @@ -1009,7 +1011,7 @@ namespace OpenSim.Region.Environment.Scenes string result = ""; for (int i = pos; i < commandParams.Length; i++) { - result += commandParams[i]+ " "; + result += commandParams[i] + " "; } return result; } @@ -1020,25 +1022,45 @@ namespace OpenSim.Region.Environment.Scenes public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine, LogBase m_logger) { ScriptEngines.Add(ScriptEngine); + ScriptEngine.InitializeEngine(this, m_logger); } #endregion public LLUUID ConvertLocalIDToFullID(uint localID) { - bool hasPrim = false; - foreach (EntityBase ent in Entities.Values) - { - if (ent is SceneObjectGroup) - { - hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); - if (hasPrim != false) - { + bool hasPrim = false; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObjectGroup) + { + hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); + if (hasPrim != false) + { return ((SceneObjectGroup)ent).GetPartsFullID(localID); - } - } - } - return LLUUID.Zero; + } + } + } + return LLUUID.Zero; + } + + public void AddInventoryItem(LLUUID userID, InventoryItemBase item) + { + if(this.Avatars.ContainsKey(userID)) + { + this.AddInventoryItem(this.Avatars[userID].ControllingClient, item); + } } + + public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) + { + CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); + if (userInfo != null) + { + userInfo.AddItem(remoteClient.AgentId, item); + remoteClient.SendInventoryItemUpdate(item); + } + } + } } -- cgit v1.1