aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2007-08-14 17:29:15 +0000
committerMW2007-08-14 17:29:15 +0000
commit181a90967ee9084676f84e74b2393855218c5723 (patch)
tree7eee2ef5dba2b95827e2849a8981075786cb5cc3 /OpenSim
parentCorrect caps of Default.lsl for Linux. Thanks again krinkec. :) (diff)
downloadopensim-SC_OLD-181a90967ee9084676f84e74b2393855218c5723.zip
opensim-SC_OLD-181a90967ee9084676f84e74b2393855218c5723.tar.gz
opensim-SC_OLD-181a90967ee9084676f84e74b2393855218c5723.tar.bz2
opensim-SC_OLD-181a90967ee9084676f84e74b2393855218c5723.tar.xz
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).
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetTransactions.cs4
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs21
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCache.cs2
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs43
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs1
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs75
-rw-r--r--OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs8
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs11
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs72
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
128 } 128 }
129 if (this.OnUpLoad != null) 129 if (this.OnUpLoad != null)
130 { 130 {
131 this.OnUpLoad(this.m_assetName, this.newAssetID, inventoryItemID, data); 131 this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data);
132 } 132 }
133 return text; 133 return text;
134 } 134 }
@@ -266,7 +266,7 @@ namespace OpenSim.Framework.Communications.Caches
266 } 266 }
267 if (this.OnUpLoad != null) 267 if (this.OnUpLoad != null)
268 { 268 {
269 this.OnUpLoad(this.m_assetName, this.newAssetID, inventoryItemID, data); 269 this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data);
270 } 270 }
271 return text; 271 return text;
272 } 272 }
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
40{ 40{
41 public class CachedUserInfo 41 public class CachedUserInfo
42 { 42 {
43 private CommunicationsManager m_parentCommsManager;
43 // Fields 44 // Fields
44 public InventoryFolder RootFolder = null; 45 public InventoryFolder RootFolder = null;
45 public UserProfileData UserProfile = null; 46 public UserProfileData UserProfile = null;
46 47
48 public CachedUserInfo(CommunicationsManager commsManager)
49 {
50 m_parentCommsManager = commsManager;
51 }
52
47 // Methods 53 // Methods
48 public void FolderReceive(LLUUID userID, InventoryFolder folderInfo) 54 public void FolderReceive(LLUUID userID, InventoryFolder folderInfo)
49 { 55 {
@@ -73,6 +79,7 @@ namespace OpenSim.Framework.Communications.Caches
73 79
74 public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) 80 public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo)
75 { 81 {
82 Console.WriteLine("received new inventory item " + itemInfo.inventoryID + " with asset id of " + itemInfo.assetID);
76 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) 83 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null))
77 { 84 {
78 if (itemInfo.parentFolderID == this.RootFolder.folderID) 85 if (itemInfo.parentFolderID == this.RootFolder.folderID)
@@ -84,11 +91,23 @@ namespace OpenSim.Framework.Communications.Caches
84 InventoryFolder folder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID); 91 InventoryFolder folder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID);
85 if (folder != null) 92 if (folder != null)
86 { 93 {
87 folder.Items.Add(itemInfo.inventoryID, itemInfo); 94 folder.Items.Add(itemInfo.inventoryID, itemInfo);
88 } 95 }
89 } 96 }
90 } 97 }
91 } 98 }
99
100 public void AddItem(LLUUID userID, InventoryItemBase itemInfo)
101 {
102 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null))
103 {
104 this.ItemReceive(userID, itemInfo);
105 Console.WriteLine("now adding inventory item to database");
106 this.m_parentCommsManager.InventoryServer.AddNewInventoryItem(userID, itemInfo);
107 }
108 }
92 } 109 }
110
111
93} 112}
94 113
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
61 { 61 {
62 if (!this.UserProfiles.ContainsKey(userID)) 62 if (!this.UserProfiles.ContainsKey(userID))
63 { 63 {
64 CachedUserInfo userInfo = new CachedUserInfo(); 64 CachedUserInfo userInfo = new CachedUserInfo(this.m_parent);
65 userInfo.UserProfile = this.RequestUserProfileForUser(userID); 65 userInfo.UserProfile = this.RequestUserProfileForUser(userID);
66 if (userInfo.UserProfile != null) 66 if (userInfo.UserProfile != null)
67 { 67 {
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;
35using OpenSim.Framework.Types; 35using OpenSim.Framework.Types;
36using OpenSim.Framework.Utilities; 36using OpenSim.Framework.Utilities;
37using OpenSim.Framework.Communications.Caches; 37using OpenSim.Framework.Communications.Caches;
38using OpenSim.Framework.Data;
38 39
39namespace OpenSim.Region.Capabilities 40namespace OpenSim.Region.Capabilities
40{ 41{
41 public delegate void UpLoadedTexture(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data); 42 public delegate void UpLoadedTexture(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data);
43 public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item);
42 44
43 public class Caps 45 public class Caps
44 { 46 {
@@ -56,6 +58,7 @@ namespace OpenSim.Region.Capabilities
56 private AssetCache assetCache; 58 private AssetCache assetCache;
57 private int eventQueueCount = 1; 59 private int eventQueueCount = 1;
58 private Queue<string> CapsEventQueue = new Queue<string>(); 60 private Queue<string> CapsEventQueue = new Queue<string>();
61 public NewInventoryItem AddNewInventoryItem = null;
59 62
60 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent) 63 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent)
61 { 64 {
@@ -122,7 +125,7 @@ namespace OpenSim.Region.Capabilities
122 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; 125 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath;
123 caps.MapLayer = capsBaseUrl + m_mapLayerPath; 126 caps.MapLayer = capsBaseUrl + m_mapLayerPath;
124 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; 127 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory;
125 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; 128 // caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath;
126 return caps; 129 return caps;
127 } 130 }
128 131
@@ -242,7 +245,7 @@ namespace OpenSim.Region.Capabilities
242 LLUUID newInvItem = LLUUID.Random(); 245 LLUUID newInvItem = LLUUID.Random();
243 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 246 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
244 247
245 AssetUploader uploader = new AssetUploader(assetName, newAsset, newInvItem, capsBase + uploaderPath, this.httpListener); 248 AssetUploader uploader = new AssetUploader(assetName, "description", newAsset, newInvItem, LLUUID.Zero, "", "", capsBase + uploaderPath, this.httpListener);
246 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 249 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
247 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; 250 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath;
248 251
@@ -261,13 +264,16 @@ namespace OpenSim.Region.Capabilities
261 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) 264 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
262 { 265 {
263 // Console.WriteLine("asset upload request via CAPS"); 266 // Console.WriteLine("asset upload request via CAPS");
267
264 string assetName = llsdRequest.name; 268 string assetName = llsdRequest.name;
269 string assetDes = llsdRequest.description;
265 string capsBase = "/CAPS/" + m_capsObjectPath; 270 string capsBase = "/CAPS/" + m_capsObjectPath;
266 LLUUID newAsset = LLUUID.Random(); 271 LLUUID newAsset = LLUUID.Random();
267 LLUUID newInvItem = LLUUID.Random(); 272 LLUUID newInvItem = LLUUID.Random();
273 LLUUID parentFolder = llsdRequest.folder_id;
268 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 274 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
269 275
270 AssetUploader uploader = new AssetUploader(assetName, newAsset, newInvItem, capsBase + uploaderPath, this.httpListener); 276 AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, "" , "", capsBase + uploaderPath, this.httpListener);
271 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 277 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
272 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; 278 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath;
273 279
@@ -284,7 +290,7 @@ namespace OpenSim.Region.Capabilities
284 /// <param name="assetID"></param> 290 /// <param name="assetID"></param>
285 /// <param name="inventoryItem"></param> 291 /// <param name="inventoryItem"></param>
286 /// <param name="data"></param> 292 /// <param name="data"></param>
287 public void UploadCompleteHandler(string assetName, LLUUID assetID, LLUUID inventoryItem, byte[] data) 293 public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data)
288 { 294 {
289 AssetBase asset; 295 AssetBase asset;
290 asset = new AssetBase(); 296 asset = new AssetBase();
@@ -294,6 +300,25 @@ namespace OpenSim.Region.Capabilities
294 asset.Name = assetName; 300 asset.Name = assetName;
295 asset.Data = data; 301 asset.Data = data;
296 this.assetCache.AddAsset(asset); 302 this.assetCache.AddAsset(asset);
303
304 InventoryItemBase item = new InventoryItemBase();
305 item.avatarID = agentID;
306 item.creatorsID = agentID;
307 item.inventoryID = inventoryItem;
308 item.assetID = asset.FullID;
309 item.inventoryDescription = assetDescription;
310 item.inventoryName = assetName;
311 item.assetType = 0;
312 item.invType = 0;
313 item.parentFolderID = parentFolder;
314 item.inventoryCurrentPermissions = 2147483647;
315 item.inventoryNextPermissions = 2147483647;
316
317 if (AddNewInventoryItem != null)
318 {
319 AddNewInventoryItem(agentID, item);
320 }
321
297 } 322 }
298 323
299 public class AssetUploader 324 public class AssetUploader
@@ -303,9 +328,11 @@ namespace OpenSim.Region.Capabilities
303 private string uploaderPath = ""; 328 private string uploaderPath = "";
304 private LLUUID newAssetID; 329 private LLUUID newAssetID;
305 private LLUUID inventoryItemID; 330 private LLUUID inventoryItemID;
331 private LLUUID parentFolder;
306 private BaseHttpServer httpListener; 332 private BaseHttpServer httpListener;
307 private bool SaveAssets = false; 333 private bool SaveAssets = false;
308 private string m_assetName = ""; 334 private string m_assetName = "";
335 private string m_assetDes = "";
309 336
310 /// <summary> 337 /// <summary>
311 /// 338 ///
@@ -314,13 +341,15 @@ namespace OpenSim.Region.Capabilities
314 /// <param name="inventoryItem"></param> 341 /// <param name="inventoryItem"></param>
315 /// <param name="path"></param> 342 /// <param name="path"></param>
316 /// <param name="httpServer"></param> 343 /// <param name="httpServer"></param>
317 public AssetUploader(string assetName, LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) 344 public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolderID, string invType, string assetType, string path, BaseHttpServer httpServer)
318 { 345 {
319 m_assetName = assetName; 346 m_assetName = assetName;
347 m_assetDes = description;
320 newAssetID = assetID; 348 newAssetID = assetID;
321 inventoryItemID = inventoryItem; 349 inventoryItemID = inventoryItem;
322 uploaderPath = path; 350 uploaderPath = path;
323 httpListener = httpServer; 351 httpListener = httpServer;
352 parentFolder = parentFolderID;
324 } 353 }
325 354
326 /// <summary> 355 /// <summary>
@@ -348,7 +377,7 @@ namespace OpenSim.Region.Capabilities
348 377
349 if (OnUpLoad != null) 378 if (OnUpLoad != null)
350 { 379 {
351 OnUpLoad(m_assetName, newAssetID, inv, data); 380 OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data);
352 } 381 }
353 382
354 return res; 383 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
15 { 15 {
16 void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); 16 void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
17 void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder); 17 void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
18 void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
18 } 19 }
19} 20}
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
91 data.Add("inventoryCurrentPermissions", DbType.Int32); 91 data.Add("inventoryCurrentPermissions", DbType.Int32);
92 data.Add("inventoryBasePermissions", DbType.Int32); 92 data.Add("inventoryBasePermissions", DbType.Int32);
93 data.Add("inventoryEveryOnePermissions", DbType.Int32); 93 data.Add("inventoryEveryOnePermissions", DbType.Int32);
94 94
95 return data; 95 return data;
96 } 96 }
97 97
@@ -219,6 +219,44 @@ namespace OpenSim.Framework.Data.SQLite
219 row["version"] = folder.version; 219 row["version"] = folder.version;
220 } 220 }
221 221
222 public InventoryItemBase BuildItem(DataRow row)
223 {
224 InventoryItemBase item = new InventoryItemBase();
225 item.inventoryID = new LLUUID((string)row["UUID"]);
226 item.assetID = new LLUUID((string)row["assetID"]);
227 item.assetType = Convert.ToInt32(row["assetType"]);
228 item.invType = Convert.ToInt32(row["invType"]);
229 item.parentFolderID = new LLUUID((string)row["parentFolderID"]);
230 item.avatarID = new LLUUID((string)row["avatarID"]);
231 item.creatorsID = new LLUUID((string)row["creatorsID"]);
232 item.inventoryName =(string) row["inventoryName"];
233 item.inventoryDescription = (string) row["inventoryDescription"];
234
235 item.inventoryNextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]);
236 item.inventoryCurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]);
237 item.inventoryBasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]);
238 item.inventoryEveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]);
239 return item;
240 }
241
242 private void fillItemRow(DataRow row, InventoryItemBase item)
243 {
244 row["UUID"] = item.inventoryID;
245 row["assetID"] = item.assetID;
246 row["assetType"] = item.assetType;
247 row["invType"] = item.invType;
248 row["parentFolderID"] = item.parentFolderID;
249 row["avatarID"] = item.avatarID;
250 row["creatorsID"] = item.creatorsID;
251 row["inventoryName"] = item.inventoryName;
252 row["inventoryDescription"] = item.inventoryDescription;
253
254 row["inventoryNextPermissions"] = item.inventoryNextPermissions;
255 row["inventoryCurrentPermissions"] = item.inventoryCurrentPermissions;
256 row["inventoryBasePermissions"] = item.inventoryBasePermissions;
257 row["inventoryEveryOnePermissions"] = item.inventoryEveryOnePermissions;
258 }
259
222 private void addFolder(InventoryFolderBase folder) 260 private void addFolder(InventoryFolderBase folder)
223 { 261 {
224 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 262 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
@@ -238,6 +276,24 @@ namespace OpenSim.Framework.Data.SQLite
238 this.invFoldersDa.Update(ds, "inventoryfolders"); 276 this.invFoldersDa.Update(ds, "inventoryfolders");
239 } 277 }
240 278
279 private void addItem(InventoryItemBase item)
280 {
281 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
282
283 DataRow inventoryRow = inventoryItemTable.Rows.Find(item.inventoryID);
284 if (inventoryRow == null)
285 {
286 inventoryRow = inventoryItemTable.NewRow();
287 fillItemRow(inventoryRow, item);
288 inventoryItemTable.Rows.Add(inventoryRow);
289 }
290 else
291 {
292 fillItemRow(inventoryRow, item);
293 }
294 this.invItemsDa.Update(ds, "inventoryitems");
295 }
296
241 public void Shutdown() 297 public void Shutdown()
242 { 298 {
243 // TODO: DataSet commit 299 // TODO: DataSet commit
@@ -275,7 +331,16 @@ namespace OpenSim.Framework.Data.SQLite
275 /// <returns>A List of InventoryItemBase items</returns> 331 /// <returns>A List of InventoryItemBase items</returns>
276 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) 332 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
277 { 333 {
278 return null; 334 List<InventoryItemBase> retval = new List<InventoryItemBase>();
335 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
336 string selectExp = "parentFolderID = '" + folderID.ToString() + "'";
337 DataRow[] rows = inventoryItemTable.Select(selectExp);
338 foreach (DataRow row in rows)
339 {
340 retval.Add(BuildItem(row));
341 }
342
343 return retval;
279 } 344 }
280 345
281 /// <summary> 346 /// <summary>
@@ -297,7 +362,7 @@ namespace OpenSim.Framework.Data.SQLite
297 { 362 {
298 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 363 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
299 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 364 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
300 string selectExp = "agentID = '"+ user.ToString()+"' AND parentID = '"+ LLUUID.Zero.ToString()+"'"; 365 string selectExp = "agentID = '" + user.ToString() + "' AND parentID = '" + LLUUID.Zero.ToString() + "'";
301 DataRow[] rows = inventoryFolderTable.Select(selectExp); 366 DataRow[] rows = inventoryFolderTable.Select(selectExp);
302 foreach (DataRow row in rows) 367 foreach (DataRow row in rows)
303 { 368 {
@@ -339,7 +404,7 @@ namespace OpenSim.Framework.Data.SQLite
339 { 404 {
340 folders.Add(this.buildFolder(row)); 405 folders.Add(this.buildFolder(row));
341 } 406 }
342 // System.Console.WriteLine("found " + folders.Count + " inventory folders"); 407 // System.Console.WriteLine("found " + folders.Count + " inventory folders");
343 return folders; 408 return folders;
344 } 409 }
345 410
@@ -369,6 +434,7 @@ namespace OpenSim.Framework.Data.SQLite
369 /// <param name="item">The item to be created</param> 434 /// <param name="item">The item to be created</param>
370 public void addInventoryItem(InventoryItemBase item) 435 public void addInventoryItem(InventoryItemBase item)
371 { 436 {
437 this.addItem(item);
372 } 438 }
373 439
374 /// <summary> 440 /// <summary>
@@ -377,6 +443,7 @@ namespace OpenSim.Framework.Data.SQLite
377 /// <param name="item">The updated item</param> 443 /// <param name="item">The updated item</param>
378 public void updateInventoryItem(InventoryItemBase item) 444 public void updateInventoryItem(InventoryItemBase item)
379 { 445 {
446 this.addItem(item);
380 } 447 }
381 448
382 /// <summary> 449 /// <summary>
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
116 } 116 }
117 } 117 }
118 118
119 public void AddItem(InventoryItemBase item)
120 {
121 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
122 {
123 plugin.Value.addInventoryItem(item);
124 }
125 }
126
119 /// <summary> 127 /// <summary>
120 /// 128 ///
121 /// </summary> 129 /// </summary>
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
43 { 43 {
44 InventoryFolder newfolder = new InventoryFolder(folder); 44 InventoryFolder newfolder = new InventoryFolder(folder);
45 folderCallBack(userID, newfolder); 45 folderCallBack(userID, newfolder);
46
47 List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID);
48 foreach (InventoryItemBase item in items)
49 {
50 itemCallBack(userID, item);
51 }
46 } 52 }
47 } 53 }
48 } 54 }
@@ -52,5 +58,10 @@ namespace OpenSim.Region.Communications.Local
52 { 58 {
53 this.AddFolder(folder); 59 this.AddFolder(folder);
54 } 60 }
61
62 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
63 {
64 this.AddItem(item);
65 }
55 } 66 }
56} 67}
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
24 { 24 {
25 25
26 } 26 }
27
28 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
29 {
30
31 }
27 } 32 }
28} 33}
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
727 item.inventoryCurrentPermissions = 2147483647; 727 item.inventoryCurrentPermissions = 2147483647;
728 item.inventoryNextPermissions = nextOwnerMask; 728 item.inventoryNextPermissions = nextOwnerMask;
729 729
730 userInfo.ItemReceive(remoteClient.AgentId, item); 730 userInfo.AddItem(remoteClient.AgentId, item);
731 remoteClient.SendInventoryItemUpdate(item); 731 remoteClient.SendInventoryItemUpdate(item);
732 } 732 }
733 } 733 }
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;
41using OpenSim.Region.Environment.LandManagement; 41using OpenSim.Region.Environment.LandManagement;
42using OpenSim.Region.Scripting; 42using OpenSim.Region.Scripting;
43using OpenSim.Region.Terrain; 43using OpenSim.Region.Terrain;
44using Caps=OpenSim.Region.Capabilities.Caps; 44using OpenSim.Framework.Data;
45using Timer=System.Timers.Timer; 45using Caps = OpenSim.Region.Capabilities.Caps;
46using Timer = System.Timers.Timer;
46 47
47namespace OpenSim.Region.Environment.Scenes 48namespace OpenSim.Region.Environment.Scenes
48{ 49{
@@ -205,7 +206,7 @@ namespace OpenSim.Region.Environment.Scenes
205 phyScene.GetResults(); 206 phyScene.GetResults();
206 } 207 }
207 208
208 List<EntityBase> moveEntities = new List<EntityBase>( Entities.Values ); 209 List<EntityBase> moveEntities = new List<EntityBase>(Entities.Values);
209 210
210 foreach (EntityBase entity in moveEntities) 211 foreach (EntityBase entity in moveEntities)
211 { 212 {
@@ -503,9 +504,9 @@ namespace OpenSim.Region.Environment.Scenes
503 { 504 {
504 if (obj is SceneObjectGroup) 505 if (obj is SceneObjectGroup)
505 { 506 {
506 if (((SceneObjectGroup) obj).LocalId == localID) 507 if (((SceneObjectGroup)obj).LocalId == localID)
507 { 508 {
508 RemoveEntity((SceneObjectGroup) obj); 509 RemoveEntity((SceneObjectGroup)obj);
509 return; 510 return;
510 } 511 }
511 } 512 }
@@ -607,8 +608,8 @@ namespace OpenSim.Region.Environment.Scenes
607 new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); 608 new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
608 609
609 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); 610 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
610 611
611 //client.OnCreateNewInventoryItem += CreateNewInventoryItem; 612 //client.OnCreateNewInventoryItem += CreateNewInventoryItem;
612 client.OnCreateNewInventoryFolder += commsManager.UserProfiles.HandleCreateInventoryFolder; 613 client.OnCreateNewInventoryFolder += commsManager.UserProfiles.HandleCreateInventoryFolder;
613 client.OnFetchInventoryDescendents += commsManager.UserProfiles.HandleFecthInventoryDescendents; 614 client.OnFetchInventoryDescendents += commsManager.UserProfiles.HandleFecthInventoryDescendents;
614 client.OnRequestTaskInventory += RequestTaskInventory; 615 client.OnRequestTaskInventory += RequestTaskInventory;
@@ -670,9 +671,9 @@ namespace OpenSim.Region.Environment.Scenes
670 671
671 ForEachScenePresence( 672 ForEachScenePresence(
672 delegate(ScenePresence presence) 673 delegate(ScenePresence presence)
673 { 674 {
674 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId); 675 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
675 }); 676 });
676 677
677 lock (Avatars) 678 lock (Avatars)
678 { 679 {
@@ -689,7 +690,7 @@ namespace OpenSim.Region.Environment.Scenes
689 } 690 }
690 } 691 }
691 // TODO: Add the removal from physics ? 692 // TODO: Add the removal from physics ?
692 693
693 // Remove client agent from profile, so new logins will work 694 // Remove client agent from profile, so new logins will work
694 commsManager.UserServer.clearUserAgent(agentID); 695 commsManager.UserServer.clearUserAgent(agentID);
695 696
@@ -787,7 +788,7 @@ namespace OpenSim.Region.Environment.Scenes
787 { 788 {
788 if (ent is SceneObjectGroup) 789 if (ent is SceneObjectGroup)
789 { 790 {
790 ((SceneObjectGroup) ent).SendFullUpdateToClient(client); 791 ((SceneObjectGroup)ent).SendFullUpdateToClient(client);
791 } 792 }
792 } 793 }
793 } 794 }
@@ -825,6 +826,7 @@ namespace OpenSim.Region.Environment.Scenes
825 new Caps(assetCache, httpListener, m_regInfo.ExternalHostName, m_regInfo.ExternalEndPoint.Port, 826 new Caps(assetCache, httpListener, m_regInfo.ExternalHostName, m_regInfo.ExternalEndPoint.Port,
826 agent.CapsPath, agent.AgentID); 827 agent.CapsPath, agent.AgentID);
827 cap.RegisterHandlers(); 828 cap.RegisterHandlers();
829 cap.AddNewInventoryItem = this.AddInventoryItem;
828 if (capsHandlers.ContainsKey(agent.AgentID)) 830 if (capsHandlers.ContainsKey(agent.AgentID))
829 { 831 {
830 MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + 832 MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " +
@@ -1009,7 +1011,7 @@ namespace OpenSim.Region.Environment.Scenes
1009 string result = ""; 1011 string result = "";
1010 for (int i = pos; i < commandParams.Length; i++) 1012 for (int i = pos; i < commandParams.Length; i++)
1011 { 1013 {
1012 result += commandParams[i]+ " "; 1014 result += commandParams[i] + " ";
1013 } 1015 }
1014 return result; 1016 return result;
1015 } 1017 }
@@ -1020,25 +1022,45 @@ namespace OpenSim.Region.Environment.Scenes
1020 public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine, LogBase m_logger) 1022 public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine, LogBase m_logger)
1021 { 1023 {
1022 ScriptEngines.Add(ScriptEngine); 1024 ScriptEngines.Add(ScriptEngine);
1025
1023 ScriptEngine.InitializeEngine(this, m_logger); 1026 ScriptEngine.InitializeEngine(this, m_logger);
1024 } 1027 }
1025 #endregion 1028 #endregion
1026 1029
1027 public LLUUID ConvertLocalIDToFullID(uint localID) 1030 public LLUUID ConvertLocalIDToFullID(uint localID)
1028 { 1031 {
1029 bool hasPrim = false; 1032 bool hasPrim = false;
1030 foreach (EntityBase ent in Entities.Values) 1033 foreach (EntityBase ent in Entities.Values)
1031 { 1034 {
1032 if (ent is SceneObjectGroup) 1035 if (ent is SceneObjectGroup)
1033 { 1036 {
1034 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 1037 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
1035 if (hasPrim != false) 1038 if (hasPrim != false)
1036 { 1039 {
1037 return ((SceneObjectGroup)ent).GetPartsFullID(localID); 1040 return ((SceneObjectGroup)ent).GetPartsFullID(localID);
1038 } 1041 }
1039 } 1042 }
1040 } 1043 }
1041 return LLUUID.Zero; 1044 return LLUUID.Zero;
1045 }
1046
1047 public void AddInventoryItem(LLUUID userID, InventoryItemBase item)
1048 {
1049 if(this.Avatars.ContainsKey(userID))
1050 {
1051 this.AddInventoryItem(this.Avatars[userID].ControllingClient, item);
1052 }
1042 } 1053 }
1054
1055 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
1056 {
1057 CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
1058 if (userInfo != null)
1059 {
1060 userInfo.AddItem(remoteClient.AgentId, item);
1061 remoteClient.SendInventoryItemUpdate(item);
1062 }
1063 }
1064
1043 } 1065 }
1044} 1066}