aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Capabilities
diff options
context:
space:
mode:
authorMW2007-08-14 17:29:15 +0000
committerMW2007-08-14 17:29:15 +0000
commit181a90967ee9084676f84e74b2393855218c5723 (patch)
tree7eee2ef5dba2b95827e2849a8981075786cb5cc3 /OpenSim/Framework/Communications/Capabilities
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/Framework/Communications/Capabilities')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs43
1 files changed, 36 insertions, 7 deletions
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;