aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs1610
1 files changed, 1276 insertions, 334 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 774202e..6f5775a 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -26,11 +26,14 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Timers;
29using System.Collections; 30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Collections.Specialized;
31using System.IO; 33using System.IO;
32using System.Reflection; 34using System.Reflection;
33using System.Text; 35using System.Text;
36using System.Web;
34 37
35using OpenMetaverse; 38using OpenMetaverse;
36using OpenMetaverse.StructuredData; 39using OpenMetaverse.StructuredData;
@@ -40,11 +43,11 @@ using log4net;
40using OpenSim.Framework; 43using OpenSim.Framework;
41using OpenSim.Framework.Capabilities; 44using OpenSim.Framework.Capabilities;
42using OpenSim.Region.Framework; 45using OpenSim.Region.Framework;
46using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 47using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Framework.Scenes.Serialization; 48using OpenSim.Region.Framework.Scenes.Serialization;
45using OpenSim.Framework.Servers; 49using OpenSim.Framework.Servers;
46using OpenSim.Framework.Servers.HttpServer; 50using OpenSim.Framework.Servers.HttpServer;
47using OpenSim.Framework.Client;
48using OpenSim.Services.Interfaces; 51using OpenSim.Services.Interfaces;
49 52
50using Caps = OpenSim.Framework.Capabilities.Caps; 53using Caps = OpenSim.Framework.Capabilities.Caps;
@@ -55,14 +58,16 @@ using PermissionMask = OpenSim.Framework.PermissionMask;
55namespace OpenSim.Region.ClientStack.Linden 58namespace OpenSim.Region.ClientStack.Linden
56{ 59{
57 public delegate void UpLoadedAsset( 60 public delegate void UpLoadedAsset(
58 string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, 61 string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
59 byte[] data, string inventoryType, string assetType); 62 byte[] data, string inventoryType, string assetType,
63 int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
64 bool IsAtestUpload, ref string error, ref int nextOwnerMask, ref int groupMask, ref int everyoneMask);
60 65
61 public delegate UUID UpdateItem(UUID itemID, byte[] data); 66 public delegate UUID UpdateItem(UUID itemID, byte[] data);
62 67
63 public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors); 68 public delegate void UpdateTaskScript(UUID itemID, UUID primID, bool isScriptRunning, byte[] data, ref ArrayList errors);
64 69
65 public delegate void NewInventoryItem(UUID userID, InventoryItemBase item); 70 public delegate void NewInventoryItem(UUID userID, InventoryItemBase item, uint cost);
66 71
67 public delegate void NewAsset(AssetBase asset); 72 public delegate void NewAsset(AssetBase asset);
68 73
@@ -87,21 +92,12 @@ namespace OpenSim.Region.ClientStack.Linden
87 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 92 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
88 93
89 private Scene m_Scene; 94 private Scene m_Scene;
95 private UUID m_AgentID;
90 private Caps m_HostCapsObj; 96 private Caps m_HostCapsObj;
97 private ModelCost m_ModelCost;
91 98
92 private static readonly string m_requestPath = "0000/";
93 // private static readonly string m_mapLayerPath = "0001/";
94 private static readonly string m_newInventory = "0002/";
95 //private static readonly string m_requestTexture = "0003/";
96 private static readonly string m_notecardUpdatePath = "0004/";
97 private static readonly string m_notecardTaskUpdatePath = "0005/";
98 // private static readonly string m_fetchInventoryPath = "0006/";
99 private static readonly string m_copyFromNotecardPath = "0007/";
100 // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. 99 // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
101 private static readonly string m_getObjectPhysicsDataPath = "0101/"; 100
102 /* 0102 - 0103 RESERVED */
103 private static readonly string m_UpdateAgentInformationPath = "0500/";
104
105 // These are callbacks which will be setup by the scene so that we can update scene data when we 101 // These are callbacks which will be setup by the scene so that we can update scene data when we
106 // receive capability calls 102 // receive capability calls
107 public NewInventoryItem AddNewInventoryItem = null; 103 public NewInventoryItem AddNewInventoryItem = null;
@@ -115,12 +111,45 @@ namespace OpenSim.Region.ClientStack.Linden
115 private IAssetService m_assetService; 111 private IAssetService m_assetService;
116 private bool m_dumpAssetsToFile = false; 112 private bool m_dumpAssetsToFile = false;
117 private string m_regionName; 113 private string m_regionName;
114
118 private int m_levelUpload = 0; 115 private int m_levelUpload = 0;
119 116
120 public BunchOfCaps(Scene scene, Caps caps) 117 private bool m_enableFreeTestUpload = false; // allows "TEST-" prefix hack
118 private bool m_ForceFreeTestUpload = false; // forces all uploads to be test
119
120 private bool m_enableModelUploadTextureToInventory = false; // place uploaded textures also in inventory
121 // may not be visible till relog
122
123 private bool m_RestrictFreeTestUploadPerms = false; // reduces also the permitions. Needs a creator defined!!
124 private UUID m_testAssetsCreatorID = UUID.Zero;
125
126 private float m_PrimScaleMin = 0.001f;
127
128 private bool m_AllowCapHomeLocation = true;
129 private bool m_AllowCapGroupMemberData = true;
130 private IUserManagement m_UserManager;
131
132
133 private enum FileAgentInventoryState : int
134 {
135 idle = 0,
136 processRequest = 1,
137 waitUpload = 2,
138 processUpload = 3
139 }
140 private FileAgentInventoryState m_FileAgentInventoryState = FileAgentInventoryState.idle;
141
142 public BunchOfCaps(Scene scene, UUID agentID, Caps caps)
121 { 143 {
122 m_Scene = scene; 144 m_Scene = scene;
145 m_AgentID = agentID;
123 m_HostCapsObj = caps; 146 m_HostCapsObj = caps;
147
148 // create a model upload cost provider
149 m_ModelCost = new ModelCost(scene);
150
151 m_PrimScaleMin = m_ModelCost.PrimScaleMin;
152
124 IConfigSource config = m_Scene.Config; 153 IConfigSource config = m_Scene.Config;
125 if (config != null) 154 if (config != null)
126 { 155 {
@@ -135,10 +164,45 @@ namespace OpenSim.Region.ClientStack.Linden
135 { 164 {
136 m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); 165 m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
137 } 166 }
167 // economy for model upload
168 IConfig EconomyConfig = config.Configs["Economy"];
169 if (EconomyConfig != null)
170 {
171 m_ModelCost.Econfig(EconomyConfig);
172
173 m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", m_enableModelUploadTextureToInventory);
174
175 m_RestrictFreeTestUploadPerms = EconomyConfig.GetBoolean("m_RestrictFreeTestUploadPerms", m_RestrictFreeTestUploadPerms);
176 m_enableFreeTestUpload = EconomyConfig.GetBoolean("AllowFreeTestUpload", m_enableFreeTestUpload);
177 m_ForceFreeTestUpload = EconomyConfig.GetBoolean("ForceFreeTestUpload", m_ForceFreeTestUpload);
178 string testcreator = EconomyConfig.GetString("TestAssetsCreatorID", "");
179 if (testcreator != "")
180 {
181 UUID id;
182 UUID.TryParse(testcreator, out id);
183 if (id != null)
184 m_testAssetsCreatorID = id;
185 }
186 }
187
188 IConfig CapsConfig = config.Configs["ClientStack.LindenCaps"];
189 if (CapsConfig != null)
190 {
191 string homeLocationUrl = CapsConfig.GetString("Cap_HomeLocation", "localhost");
192 if(homeLocationUrl == String.Empty)
193 m_AllowCapHomeLocation = false;
194
195 string GroupMemberDataUrl = CapsConfig.GetString("Cap_GroupMemberData", "localhost");
196 if(GroupMemberDataUrl == String.Empty)
197 m_AllowCapGroupMemberData = false;
198 }
138 } 199 }
139 200
140 m_assetService = m_Scene.AssetService; 201 m_assetService = m_Scene.AssetService;
141 m_regionName = m_Scene.RegionInfo.RegionName; 202 m_regionName = m_Scene.RegionInfo.RegionName;
203 m_UserManager = m_Scene.RequestModuleInterface<IUserManagement>();
204 if (m_UserManager == null)
205 m_log.Error("[CAPS]: GetDisplayNames disabled because user management component not found");
142 206
143 RegisterHandlers(); 207 RegisterHandlers();
144 208
@@ -146,6 +210,13 @@ namespace OpenSim.Region.ClientStack.Linden
146 ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset; 210 ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset;
147 TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset; 211 TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset;
148 GetClient = m_Scene.SceneGraph.GetControllingClient; 212 GetClient = m_Scene.SceneGraph.GetControllingClient;
213
214 m_FileAgentInventoryState = FileAgentInventoryState.idle;
215 }
216
217 public string GetNewCapPath()
218 {
219 return "/CAPS/" + UUID.Random();
149 } 220 }
150 221
151 /// <summary> 222 /// <summary>
@@ -153,33 +224,67 @@ namespace OpenSim.Region.ClientStack.Linden
153 /// </summary> 224 /// </summary>
154 public void RegisterHandlers() 225 public void RegisterHandlers()
155 { 226 {
156 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; 227 // this path is also defined elsewhere so keeping it
228 string seedcapsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath +"0000/";
157 229
158 RegisterRegionServiceHandlers(capsBase); 230 // the root of all evil path needs to be capsBase + m_requestPath
159 RegisterInventoryServiceHandlers(capsBase); 231 m_HostCapsObj.RegisterHandler(
232 "SEED", new RestStreamHandler("POST", seedcapsBase, SeedCapRequest, "SEED", null));
233
234// m_log.DebugFormat(
235// "[CAPS]: Registered seed capability {0} for {1}", seedcapsBase, m_HostCapsObj.AgentID);
236
237 RegisterRegionServiceHandlers();
238 RegisterInventoryServiceHandlers();
239 RegisterOtherHandlers();
160 } 240 }
161 241
162 public void RegisterRegionServiceHandlers(string capsBase) 242 public void RegisterRegionServiceHandlers()
163 { 243 {
164 try 244 try
165 { 245 {
166 // the root of all evil
167 m_HostCapsObj.RegisterHandler(
168 "SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest, "SEED", null));
169
170// m_log.DebugFormat(
171// "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID);
172
173 //m_capsHandlers["MapLayer"] = 246 //m_capsHandlers["MapLayer"] =
174 // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", 247 // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
175 // capsBase + m_mapLayerPath, 248 // GetNewCapPath(),
176 // GetMapLayer); 249 // GetMapLayer);
177 IRequestHandler req 250
178 = new RestStreamHandler( 251 IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler(
179 "POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null); 252 "POST", GetNewCapPath(), GetObjectPhysicsData, "GetObjectPhysicsData", null);
253 m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
254
255 IRequestHandler getObjectCostHandler = new RestStreamHandler(
256 "POST", GetNewCapPath(), GetObjectCost, "GetObjectCost", null );
257 m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler);
180 258
259 IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler(
260 "POST", GetNewCapPath(), ResourceCostSelected, "ResourceCostSelected", null);
261 m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler);
262
263 IRequestHandler req = new RestStreamHandler(
264 "POST", GetNewCapPath(), ScriptTaskInventory, "UpdateScript", null);
181 m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); 265 m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req);
182 m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); 266 m_HostCapsObj.RegisterHandler("UpdateScriptTask", req);
267
268 if(m_AllowCapHomeLocation)
269 {
270 IRequestHandler HomeLocationHandler = new RestStreamHandler(
271 "POST", GetNewCapPath(), HomeLocation, "HomeLocation", null);
272 m_HostCapsObj.RegisterHandler("HomeLocation", HomeLocationHandler);
273 }
274
275 if(m_AllowCapGroupMemberData)
276 {
277 IRequestHandler GroupMemberDataHandler = new RestStreamHandler(
278 "POST", GetNewCapPath(), GroupMemberData, "GroupMemberData", null);
279 m_HostCapsObj.RegisterHandler("GroupMemberData", GroupMemberDataHandler);
280 }
281
282
283// IRequestHandler animSetRequestHandler
284// = new RestStreamHandler(
285// "POST", capsBase + m_animSetTaskUpdatePath, AnimSetTaskInventory, "UpdateScript", null);
286
287// m_HostCapsObj.RegisterHandler("UpdateAnimSetTaskInventory", animSetRequestHandler);
183 } 288 }
184 catch (Exception e) 289 catch (Exception e)
185 { 290 {
@@ -187,68 +292,29 @@ namespace OpenSim.Region.ClientStack.Linden
187 } 292 }
188 } 293 }
189 294
190 public void RegisterInventoryServiceHandlers(string capsBase) 295 public void RegisterInventoryServiceHandlers()
191 { 296 {
192 try 297 try
193 { 298 {
194 // I don't think this one works... 299 m_HostCapsObj.RegisterHandler("NewFileAgentInventory",
195 m_HostCapsObj.RegisterHandler(
196 "NewFileAgentInventory",
197 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>( 300 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>(
198 "POST", 301 "POST", GetNewCapPath(), NewAgentInventoryRequest, "NewFileAgentInventory", null));
199 capsBase + m_newInventory,
200 NewAgentInventoryRequest,
201 "NewFileAgentInventory",
202 null));
203
204 IRequestHandler req
205 = new RestStreamHandler(
206 "POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory, "Update*", null);
207 302
303 IRequestHandler req = new RestStreamHandler(
304 "POST", GetNewCapPath(), NoteCardAgentInventory, "Update*", null);
208 m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); 305 m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req);
306 m_HostCapsObj.RegisterHandler("UpdateAnimSetAgentInventory", req);
209 m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); 307 m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
210 m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); 308 m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
211 309
212 IRequestHandler getObjectPhysicsDataHandler 310 IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler(
213 = new RestStreamHandler( 311 "POST", GetNewCapPath(), UpdateAgentInformation, "UpdateAgentInformation", null);
214 "POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null);
215 m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
216
217 IRequestHandler UpdateAgentInformationHandler
218 = new RestStreamHandler(
219 "POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation, "UpdateAgentInformation", null);
220 m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler); 312 m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler);
221 313
222 m_HostCapsObj.RegisterHandler( 314 IRequestHandler CopyInventoryFromNotecardHandler = new RestStreamHandler(
223 "CopyInventoryFromNotecard", 315 "POST", GetNewCapPath(), CopyInventoryFromNotecard, "CopyInventoryFromNotecard", null);
224 new RestStreamHandler( 316 m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", CopyInventoryFromNotecardHandler);
225 "POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard, "CopyInventoryFromNotecard", null)); 317
226
227 // As of RC 1.22.9 of the Linden client this is
228 // supported
229
230 //m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest);
231
232 // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and
233 // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires
234 // enhancements (probably filling out the folder part of the LLSD reply) to our CAPS service,
235 // but when I went on the Linden grid, the
236 // simulators I visited (version 1.21) were, surprisingly, no longer supplying this capability. Instead,
237 // the 1.19.1.4 client appeared to be happily flowing inventory data over UDP
238 //
239 // This is very probably just a temporary measure - once the CAPS service appears again on the Linden grid
240 // we will be
241 // able to get the data we need to implement the necessary part of the protocol to fix the issue above.
242 // m_capsHandlers["FetchInventoryDescendents"] =
243 // new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryRequest);
244
245 // m_capsHandlers["FetchInventoryDescendents"] =
246 // new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST",
247 // capsBase + m_fetchInventory,
248 // FetchInventory));
249 // m_capsHandlers["RequestTextureDownload"] = new RestStreamHandler("POST",
250 // capsBase + m_requestTexture,
251 // RequestTexture);
252 } 318 }
253 catch (Exception e) 319 catch (Exception e)
254 { 320 {
@@ -256,6 +322,22 @@ namespace OpenSim.Region.ClientStack.Linden
256 } 322 }
257 } 323 }
258 324
325 public void RegisterOtherHandlers()
326 {
327 try
328 {
329 if (m_UserManager != null)
330 {
331 IRequestHandler GetDisplayNamesHandler = new RestStreamHandler(
332 "GET", GetNewCapPath(), GetDisplayNames, "GetDisplayNames", null);
333 m_HostCapsObj.RegisterHandler("GetDisplayNames", GetDisplayNamesHandler);
334 }
335 }
336 catch (Exception e)
337 {
338 m_log.Error("[CAPS]: " + e.ToString());
339 }
340 }
259 /// <summary> 341 /// <summary>
260 /// Construct a client response detailing all the capabilities this server can provide. 342 /// Construct a client response detailing all the capabilities this server can provide.
261 /// </summary> 343 /// </summary>
@@ -268,8 +350,11 @@ namespace OpenSim.Region.ClientStack.Linden
268 public string SeedCapRequest(string request, string path, string param, 350 public string SeedCapRequest(string request, string path, string param,
269 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 351 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
270 { 352 {
271// m_log.DebugFormat( 353 m_log.DebugFormat(
272// "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID); 354 "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID);
355
356 if (!m_HostCapsObj.WaitForActivation())
357 return string.Empty;
273 358
274 if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) 359 if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
275 { 360 {
@@ -314,30 +399,28 @@ namespace OpenSim.Region.ClientStack.Linden
314 LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); 399 LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate();
315 LLSDHelpers.DeserialiseOSDMap(hash, llsdUpdateRequest); 400 LLSDHelpers.DeserialiseOSDMap(hash, llsdUpdateRequest);
316 401
317 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; 402 string uploaderPath = GetNewCapPath();
318 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
319 403
320 TaskInventoryScriptUpdater uploader = 404 TaskInventoryScriptUpdater uploader =
321 new TaskInventoryScriptUpdater( 405 new TaskInventoryScriptUpdater(
322 llsdUpdateRequest.item_id, 406 llsdUpdateRequest.item_id,
323 llsdUpdateRequest.task_id, 407 llsdUpdateRequest.task_id,
324 llsdUpdateRequest.is_script_running, 408 llsdUpdateRequest.is_script_running,
325 capsBase + uploaderPath, 409 uploaderPath,
326 m_HostCapsObj.HttpListener, 410 m_HostCapsObj.HttpListener,
327 m_dumpAssetsToFile); 411 m_dumpAssetsToFile);
328 uploader.OnUpLoad += TaskScriptUpdated; 412 uploader.OnUpLoad += TaskScriptUpdated;
329 413
330 m_HostCapsObj.HttpListener.AddStreamHandler( 414 m_HostCapsObj.HttpListener.AddStreamHandler(
331 new BinaryStreamHandler( 415 new BinaryStreamHandler(
332 "POST", capsBase + uploaderPath, uploader.uploaderCaps, "TaskInventoryScriptUpdater", null)); 416 "POST", uploaderPath, uploader.uploaderCaps, "TaskInventoryScriptUpdater", null));
333 417
334 string protocol = "http://"; 418 string protocol = "http://";
335 419
336 if (m_HostCapsObj.SSLCaps) 420 if (m_HostCapsObj.SSLCaps)
337 protocol = "https://"; 421 protocol = "https://";
338 422
339 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + 423 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + uploaderPath;
340 uploaderPath;
341 424
342 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 425 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
343 uploadResponse.uploader = uploaderURL; 426 uploadResponse.uploader = uploaderURL;
@@ -400,83 +483,208 @@ namespace OpenSim.Region.ClientStack.Linden
400 //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString()); 483 //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString());
401 //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type); 484 //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type);
402 485
486 // start by getting the client
487 IClientAPI client = null;
488 m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
489
490 // check current state so we only have one service at a time
491 lock (m_ModelCost)
492 {
493 switch (m_FileAgentInventoryState)
494 {
495 case FileAgentInventoryState.processRequest:
496 case FileAgentInventoryState.processUpload:
497 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
498 resperror.message = "Uploader busy processing previus request";
499 resperror.identifier = UUID.Zero;
500
501 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
502 errorResponse.uploader = "";
503 errorResponse.state = "error";
504 errorResponse.error = resperror;
505 return errorResponse;
506 break;
507 case FileAgentInventoryState.waitUpload:
508 // todo stop current uploader server
509 break;
510 case FileAgentInventoryState.idle:
511 default:
512 break;
513 }
514
515 m_FileAgentInventoryState = FileAgentInventoryState.processRequest;
516 }
517
518 int cost = 0;
519 int nreqtextures = 0;
520 int nreqmeshs= 0;
521 int nreqinstances = 0;
522 bool IsAtestUpload = false;
523
524 string assetName = llsdRequest.name;
525
526 LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData();
527
403 if (llsdRequest.asset_type == "texture" || 528 if (llsdRequest.asset_type == "texture" ||
404 llsdRequest.asset_type == "animation" || 529 llsdRequest.asset_type == "animation" ||
530 llsdRequest.asset_type == "animatn" || // this is the asset name actually used by viewers
531 llsdRequest.asset_type == "mesh" ||
405 llsdRequest.asset_type == "sound") 532 llsdRequest.asset_type == "sound")
406 { 533 {
407 ScenePresence avatar = null; 534 ScenePresence avatar = null;
408 IClientAPI client = null;
409 m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); 535 m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar);
410 536
411 // check user level 537 // check user level
412 if (avatar != null) 538 if (avatar != null)
413 { 539 {
414 client = avatar.ControllingClient; 540 if (avatar.GodController.UserLevel < m_levelUpload)
415
416 if (avatar.UserLevel < m_levelUpload)
417 { 541 {
418 if (client != null) 542 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
419 client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); 543 resperror.message = "Insufficient permissions to upload";
544 resperror.identifier = UUID.Zero;
420 545
421 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); 546 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
422 errorResponse.uploader = ""; 547 errorResponse.uploader = "";
423 errorResponse.state = "error"; 548 errorResponse.state = "error";
549 errorResponse.error = resperror;
550 lock (m_ModelCost)
551 m_FileAgentInventoryState = FileAgentInventoryState.idle;
424 return errorResponse; 552 return errorResponse;
425 } 553 }
426 } 554 }
427 555
428 // check funds 556 // check test upload and funds
429 if (client != null) 557 if (client != null)
430 { 558 {
431 IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>(); 559 IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>();
432 560
561 int baseCost = 0;
433 if (mm != null) 562 if (mm != null)
563 baseCost = mm.UploadCharge;
564
565 string warning = String.Empty;
566
567 if (llsdRequest.asset_type == "mesh")
434 { 568 {
435 if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) 569 string error;
570 int modelcost;
571
572
573 if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost,
574 meshcostdata, out error, ref warning))
436 { 575 {
437 client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); 576 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
577 resperror.message = error;
578 resperror.identifier = UUID.Zero;
438 579
439 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); 580 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
440 errorResponse.uploader = ""; 581 errorResponse.uploader = "";
441 errorResponse.state = "error"; 582 errorResponse.state = "error";
583 errorResponse.error = resperror;
584
585 lock (m_ModelCost)
586 m_FileAgentInventoryState = FileAgentInventoryState.idle;
442 return errorResponse; 587 return errorResponse;
443 } 588 }
589 cost = modelcost;
590 }
591 else
592 {
593 cost = baseCost;
444 } 594 }
595
596 if (cost > 0 && mm != null)
597 {
598 // check for test upload
599
600 if (m_ForceFreeTestUpload) // all are test
601 {
602 if (!(assetName.Length > 5 && assetName.StartsWith("TEST-"))) // has normal name lets change it
603 assetName = "TEST-" + assetName;
604
605 IsAtestUpload = true;
606 }
607
608 else if (m_enableFreeTestUpload) // only if prefixed with "TEST-"
609 {
610
611 IsAtestUpload = (assetName.Length > 5 && assetName.StartsWith("TEST-"));
612 }
613
614
615 if(IsAtestUpload) // let user know, still showing cost estimation
616 warning += "Upload will have no cost, for testing purposes only. Other uses are prohibited. Items will not work after 48 hours or on other regions";
617
618 // check funds
619 else
620 {
621 if (!mm.UploadCovered(client.AgentId, (int)cost))
622 {
623 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
624 resperror.message = "Insuficient funds";
625 resperror.identifier = UUID.Zero;
626
627 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
628 errorResponse.uploader = "";
629 errorResponse.state = "error";
630 errorResponse.error = resperror;
631 lock (m_ModelCost)
632 m_FileAgentInventoryState = FileAgentInventoryState.idle;
633 return errorResponse;
634 }
635 }
636 }
637
638 if (client != null && warning != String.Empty)
639 client.SendAgentAlertMessage(warning, true);
445 } 640 }
446 } 641 }
447 642
448 string assetName = llsdRequest.name;
449 string assetDes = llsdRequest.description; 643 string assetDes = llsdRequest.description;
450 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
451 UUID newAsset = UUID.Random(); 644 UUID newAsset = UUID.Random();
452 UUID newInvItem = UUID.Random(); 645 UUID newInvItem = UUID.Random();
453 UUID parentFolder = llsdRequest.folder_id; 646 UUID parentFolder = llsdRequest.folder_id;
454 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 647 string uploaderPath = GetNewCapPath();
648 UUID texturesFolder = UUID.Zero;
649
650 if(!IsAtestUpload && m_enableModelUploadTextureToInventory)
651 texturesFolder = llsdRequest.texture_folder_id;
455 652
456 AssetUploader uploader = 653 AssetUploader uploader =
457 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, 654 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
458 llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile); 655 llsdRequest.asset_type, uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost,
656 texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload,
657 llsdRequest.next_owner_mask, llsdRequest.group_mask, llsdRequest.everyone_mask);
459 658
460 m_HostCapsObj.HttpListener.AddStreamHandler( 659 m_HostCapsObj.HttpListener.AddStreamHandler(
461 new BinaryStreamHandler( 660 new BinaryStreamHandler(
462 "POST", 661 "POST",
463 capsBase + uploaderPath, 662 uploaderPath,
464 uploader.uploaderCaps, 663 uploader.uploaderCaps,
465 "NewAgentInventoryRequest", 664 "NewAgentInventoryRequest",
466 m_HostCapsObj.AgentID.ToString())); 665 m_HostCapsObj.AgentID.ToString()));
467 666
468 string protocol = "http://"; 667 string protocol = "http://";
469
470 if (m_HostCapsObj.SSLCaps) 668 if (m_HostCapsObj.SSLCaps)
471 protocol = "https://"; 669 protocol = "https://";
472 670
473 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + 671 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + uploaderPath;
474 uploaderPath;
475 672
476 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 673 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
477 uploadResponse.uploader = uploaderURL; 674 uploadResponse.uploader = uploaderURL;
478 uploadResponse.state = "upload"; 675 uploadResponse.state = "upload";
676 uploadResponse.upload_price = (int)cost;
677
678 if (llsdRequest.asset_type == "mesh")
679 {
680 uploadResponse.data = meshcostdata;
681 }
682
479 uploader.OnUpLoad += UploadCompleteHandler; 683 uploader.OnUpLoad += UploadCompleteHandler;
684
685 lock (m_ModelCost)
686 m_FileAgentInventoryState = FileAgentInventoryState.waitUpload;
687
480 return uploadResponse; 688 return uploadResponse;
481 } 689 }
482 690
@@ -488,8 +696,14 @@ namespace OpenSim.Region.ClientStack.Linden
488 /// <param name="data"></param> 696 /// <param name="data"></param>
489 public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, 697 public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID,
490 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, 698 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
491 string assetType) 699 string assetType, int cost,
700 UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
701 bool IsAtestUpload, ref string error,
702 ref int nextOwnerMask, ref int groupMask, ref int everyoneMask)
492 { 703 {
704 lock (m_ModelCost)
705 m_FileAgentInventoryState = FileAgentInventoryState.processUpload;
706
493 m_log.DebugFormat( 707 m_log.DebugFormat(
494 "[BUNCH OF CAPS]: Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}", 708 "[BUNCH OF CAPS]: Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}",
495 assetID, inventoryItem, inventoryType, assetType); 709 assetID, inventoryItem, inventoryType, assetType);
@@ -497,6 +711,34 @@ namespace OpenSim.Region.ClientStack.Linden
497 sbyte assType = 0; 711 sbyte assType = 0;
498 sbyte inType = 0; 712 sbyte inType = 0;
499 713
714 IClientAPI client = null;
715
716 UUID owner_id = m_HostCapsObj.AgentID;
717 UUID creatorID;
718
719 bool istest = IsAtestUpload && m_enableFreeTestUpload && (cost > 0);
720
721 bool restrictPerms = m_RestrictFreeTestUploadPerms && istest;
722
723 if (istest && m_testAssetsCreatorID != UUID.Zero)
724 creatorID = m_testAssetsCreatorID;
725 else
726 creatorID = owner_id;
727
728 string creatorIDstr = creatorID.ToString();
729
730 IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>();
731 if (mm != null)
732 {
733 // make sure client still has enougth credit
734 if (!mm.UploadCovered(m_HostCapsObj.AgentID, (int)cost))
735 {
736 error = "Insufficient funds.";
737 return;
738 }
739 }
740
741 // strings to types
500 if (inventoryType == "sound") 742 if (inventoryType == "sound")
501 { 743 {
502 inType = (sbyte)InventoryType.Sound; 744 inType = (sbyte)InventoryType.Sound;
@@ -511,6 +753,12 @@ namespace OpenSim.Region.ClientStack.Linden
511 inType = (sbyte)InventoryType.Animation; 753 inType = (sbyte)InventoryType.Animation;
512 assType = (sbyte)AssetType.Animation; 754 assType = (sbyte)AssetType.Animation;
513 } 755 }
756 else if (inventoryType == "animset")
757 {
758 inType = (sbyte)CustomInventoryType.AnimationSet;
759 assType = (sbyte)CustomAssetType.AnimationSet;
760 m_log.Debug("got animset upload request");
761 }
514 else if (inventoryType == "wearable") 762 else if (inventoryType == "wearable")
515 { 763 {
516 inType = (sbyte)InventoryType.Wearable; 764 inType = (sbyte)InventoryType.Wearable;
@@ -526,191 +774,290 @@ namespace OpenSim.Region.ClientStack.Linden
526 } 774 }
527 else if (inventoryType == "object") 775 else if (inventoryType == "object")
528 { 776 {
529 inType = (sbyte)InventoryType.Object; 777 if (assetType == "mesh") // this code for now is for mesh models uploads only
530 assType = (sbyte)AssetType.Object; 778 {
531 779 inType = (sbyte)InventoryType.Object;
532 List<Vector3> positions = new List<Vector3>(); 780 assType = (sbyte)AssetType.Object;
533 List<Quaternion> rotations = new List<Quaternion>();
534 OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data);
535 OSDArray instance_list = (OSDArray)request["instance_list"];
536 OSDArray mesh_list = (OSDArray)request["mesh_list"];
537 OSDArray texture_list = (OSDArray)request["texture_list"];
538 SceneObjectGroup grp = null;
539 781
540 InventoryFolderBase textureUploadFolder = null; 782 List<Vector3> positions = new List<Vector3>();
783 List<Quaternion> rotations = new List<Quaternion>();
784 OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data);
541 785
542 List<InventoryFolderBase> foldersToUpdate = new List<InventoryFolderBase>(); 786 // compare and get updated information
543 List<InventoryItemBase> itemsToUpdate = new List<InventoryItemBase>(); 787/* does nothing still we do need something to avoid special viewer to upload something diferent from the cost estimation
544 IClientInventory clientInv = null; 788 bool mismatchError = true;
545
546 if (texture_list.Count > 0)
547 {
548 ScenePresence avatar = null;
549 m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar);
550 789
551 if (avatar != null) 790 while (mismatchError)
552 { 791 {
553 IClientCore core = (IClientCore)avatar.ControllingClient; 792 mismatchError = false;
793 }
794
795 if (mismatchError)
796 {
797 error = "Upload and fee estimation information don't match";
798 lock (m_ModelCost)
799 m_FileAgentInventoryState = FileAgentInventoryState.idle;
800
801 return;
802 }
803*/
804 OSDArray instance_list = (OSDArray)request["instance_list"];
805 OSDArray mesh_list = (OSDArray)request["mesh_list"];
806 OSDArray texture_list = (OSDArray)request["texture_list"];
807 SceneObjectGroup grp = null;
808
809 // create and store texture assets
810 bool doTextInv = (!istest && m_enableModelUploadTextureToInventory &&
811 texturesFolder != UUID.Zero);
812
813
814 List<UUID> textures = new List<UUID>();
815
816
817// if (doTextInv)
818 m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
819
820 if(client == null) // don't put textures in inventory if there is no client
821 doTextInv = false;
554 822
555 if (core.TryGet<IClientInventory>(out clientInv)) 823 for (int i = 0; i < texture_list.Count; i++)
824 {
825 AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, creatorIDstr);
826 textureAsset.Data = texture_list[i].AsBinary();
827 if (istest)
828 textureAsset.Local = true;
829 m_assetService.Store(textureAsset);
830 textures.Add(textureAsset.FullID);
831
832 if (doTextInv)
556 { 833 {
557 var systemTextureFolder = m_Scene.InventoryService.GetFolderForType(m_HostCapsObj.AgentID, FolderType.Texture); 834 string name = assetName;
558 textureUploadFolder = new InventoryFolderBase(UUID.Random(), assetName, m_HostCapsObj.AgentID, (short)FolderType.None, systemTextureFolder.ID, 1); 835 if (name.Length > 25)
559 if (m_Scene.InventoryService.AddFolder(textureUploadFolder)) 836 name = name.Substring(0, 24);
560 { 837 name += "_Texture#" + i.ToString();
561 foldersToUpdate.Add(textureUploadFolder); 838 InventoryItemBase texitem = new InventoryItemBase();
839 texitem.Owner = m_HostCapsObj.AgentID;
840 texitem.CreatorId = creatorIDstr;
841 texitem.CreatorData = String.Empty;
842 texitem.ID = UUID.Random();
843 texitem.AssetID = textureAsset.FullID;
844 texitem.Description = "mesh model texture";
845 texitem.Name = name;
846 texitem.AssetType = (int)AssetType.Texture;
847 texitem.InvType = (int)InventoryType.Texture;
848 texitem.Folder = texturesFolder;
849
850 texitem.CurrentPermissions
851 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
852
853 texitem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
854 texitem.EveryOnePermissions = 0;
855 texitem.NextPermissions = (uint)PermissionMask.All;
856 texitem.CreationDate = Util.UnixTimeSinceEpoch();
857
858 m_Scene.AddInventoryItem(client, texitem);
859 texitem = null;
860 }
861 }
562 862
563 m_log.DebugFormat( 863 // create and store meshs assets
564 "[BUNCH OF CAPS]: Created new folder '{0}' ({1}) for textures uploaded with mesh object {2}", 864 List<UUID> meshAssets = new List<UUID>();
565 textureUploadFolder.Name, textureUploadFolder.ID, assetName); 865 List<bool> meshAvatarSkeletons = new List<bool>();
566 } 866 List<bool> meshAvatarColliders = new List<bool>();
567 else 867
868 bool curAvSkeleton;
869 bool curAvCollider;
870 for (int i = 0; i < mesh_list.Count; i++)
871 {
872 curAvSkeleton = false;
873 curAvCollider = false;
874
875 // we do need to parse the mesh now
876 OSD osd = OSDParser.DeserializeLLSDBinary(mesh_list[i]);
877 if (osd is OSDMap)
878 {
879 OSDMap mosd = (OSDMap)osd;
880 if (mosd.ContainsKey("skeleton"))
568 { 881 {
569 textureUploadFolder = null; 882 OSDMap skeleton = (OSDMap)mosd["skeleton"];
883 int sksize = skeleton["size"].AsInteger();
884 if (sksize > 0)
885 curAvSkeleton = true;
570 } 886 }
571 } 887 }
572 }
573 }
574 888
575 List<UUID> textures = new List<UUID>(); 889 AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr);
576 for (int i = 0; i < texture_list.Count; i++) 890 meshAsset.Data = mesh_list[i].AsBinary();
577 { 891 if (istest)
578 AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, ""); 892 meshAsset.Local = true;
579 textureAsset.Data = texture_list[i].AsBinary(); 893 m_assetService.Store(meshAsset);
580 m_assetService.Store(textureAsset); 894 meshAssets.Add(meshAsset.FullID);
581 textures.Add(textureAsset.FullID); 895 meshAvatarSkeletons.Add(curAvSkeleton);
896 meshAvatarColliders.Add(curAvCollider);
897
898 // test code
899 if (curAvSkeleton && client != null)
900 {
901 string name = assetName;
902 if (name.Length > 25)
903 name = name.Substring(0, 24);
904 name += "_Mesh#" + i.ToString();
905 InventoryItemBase meshitem = new InventoryItemBase();
906 meshitem.Owner = m_HostCapsObj.AgentID;
907 meshitem.CreatorId = creatorIDstr;
908 meshitem.CreatorData = String.Empty;
909 meshitem.ID = UUID.Random();
910 meshitem.AssetID = meshAsset.FullID;
911 meshitem.Description = "mesh ";
912 meshitem.Name = name;
913 meshitem.AssetType = (int)AssetType.Mesh;
914 meshitem.InvType = (int)InventoryType.Mesh;
915 // meshitem.Folder = UUID.Zero; // send to default
916
917 meshitem.Folder = parentFolder; // dont let it go to folder Meshes that viewers dont show
918
919 // If we set PermissionMask.All then when we rez the item the next permissions will replace the current
920 // (owner) permissions. This becomes a problem if next permissions are changed.
921 meshitem.CurrentPermissions
922 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
923
924 meshitem.BasePermissions = (uint)PermissionMask.All;
925 meshitem.EveryOnePermissions = 0;
926 meshitem.NextPermissions = (uint)PermissionMask.All;
927 meshitem.CreationDate = Util.UnixTimeSinceEpoch();
928
929 m_Scene.AddInventoryItem(client, meshitem);
930 meshitem = null;
931 }
932 }
582 933
583 if (textureUploadFolder != null) 934 int skipedMeshs = 0;
935 // build prims from instances
936 for (int i = 0; i < instance_list.Count; i++)
584 { 937 {
585 InventoryItemBase textureItem = new InventoryItemBase(); 938 OSDMap inner_instance_list = (OSDMap)instance_list[i];
586 textureItem.Owner = m_HostCapsObj.AgentID;
587 textureItem.CreatorId = m_HostCapsObj.AgentID.ToString();
588 textureItem.CreatorData = String.Empty;
589 textureItem.ID = UUID.Random();
590 textureItem.AssetID = textureAsset.FullID;
591 textureItem.Description = assetDescription;
592 textureItem.Name = assetName + " - Texture " + (i + 1).ToString();
593 textureItem.AssetType = (int)AssetType.Texture;
594 textureItem.InvType = (int)InventoryType.Texture;
595 textureItem.Folder = textureUploadFolder.ID;
596 textureItem.CurrentPermissions
597 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
598 textureItem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
599 textureItem.EveryOnePermissions = 0;
600 textureItem.NextPermissions = (uint)PermissionMask.All;
601 textureItem.CreationDate = Util.UnixTimeSinceEpoch();
602 m_Scene.InventoryService.AddItem(textureItem);
603 itemsToUpdate.Add(textureItem);
604
605 m_log.DebugFormat(
606 "[BUNCH OF CAPS]: Created new inventory item '{0}' ({1}) for texture uploaded with mesh object {2}",
607 textureItem.Name, textureItem.ID, assetName);
608 }
609 }
610 939
611 if (clientInv != null && (foldersToUpdate.Count > 0 || itemsToUpdate.Count > 0)) 940 // skip prims that are 2 small
612 { 941 Vector3 scale = inner_instance_list["scale"].AsVector3();
613 clientInv.SendBulkUpdateInventory(foldersToUpdate.ToArray(), itemsToUpdate.ToArray());
614 }
615 942
616 for (int i = 0; i < mesh_list.Count; i++) 943 if (scale.X < m_PrimScaleMin || scale.Y < m_PrimScaleMin || scale.Z < m_PrimScaleMin)
617 { 944 {
618 PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); 945 skipedMeshs++;
946 continue;
947 }
619 948
620 Primitive.TextureEntry textureEntry 949 OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
621 = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE);
622 OSDMap inner_instance_list = (OSDMap)instance_list[i];
623 950
624 OSDArray face_list = (OSDArray)inner_instance_list["face_list"]; 951 PrimitiveBaseShape pbs = null;
625 for (uint face = 0; face < face_list.Count; face++) 952 if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ...
626 { 953 {
627 OSDMap faceMap = (OSDMap)face_list[(int)face]; 954 int meshindx = inner_instance_list["mesh"].AsInteger();
628 Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face); 955 if (meshAssets.Count > meshindx)
629 if(faceMap.ContainsKey("fullbright")) 956 pbs = PrimitiveBaseShape.CreateMesh(face_list.Count, meshAssets[meshindx]);
630 f.Fullbright = faceMap["fullbright"].AsBoolean(); 957 }
631 if (faceMap.ContainsKey ("diffuse_color")) 958 if(pbs == null) // fallback
632 f.RGBA = faceMap["diffuse_color"].AsColor4(); 959 pbs = PrimitiveBaseShape.CreateBox();
960
961 Primitive.TextureEntry textureEntry
962 = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE);
633 963
634 int textureNum = faceMap["image"].AsInteger(); 964 for (uint face = 0; face < face_list.Count; face++)
635 float imagerot = faceMap["imagerot"].AsInteger(); 965 {
636 float offsets = (float)faceMap["offsets"].AsReal(); 966 OSDMap faceMap = (OSDMap)face_list[(int)face];
637 float offsett = (float)faceMap["offsett"].AsReal();
638 float scales = (float)faceMap["scales"].AsReal();
639 float scalet = (float)faceMap["scalet"].AsReal();
640 967
641 if(imagerot != 0) 968 Primitive.TextureEntryFace f = textureEntry.CreateFace(face); //clone the default
642 f.Rotation = imagerot; 969 if (faceMap.ContainsKey("fullbright"))
970 f.Fullbright = faceMap["fullbright"].AsBoolean();
971 if (faceMap.ContainsKey("diffuse_color"))
972 f.RGBA = faceMap["diffuse_color"].AsColor4();
643 973
644 if(offsets != 0) 974 int textureNum = faceMap["image"].AsInteger();
645 f.OffsetU = offsets; 975 float imagerot = faceMap["imagerot"].AsInteger();
976 float offsets = (float)faceMap["offsets"].AsReal();
977 float offsett = (float)faceMap["offsett"].AsReal();
978 float scales = (float)faceMap["scales"].AsReal();
979 float scalet = (float)faceMap["scalet"].AsReal();
646 980
647 if (offsett != 0) 981 if (imagerot != 0)
648 f.OffsetV = offsett; 982 f.Rotation = imagerot;
649 983
650 if (scales != 0) 984 if (offsets != 0)
651 f.RepeatU = scales; 985 f.OffsetU = offsets;
652 986
653 if (scalet != 0) 987 if (offsett != 0)
654 f.RepeatV = scalet; 988 f.OffsetV = offsett;
655 989
656 if (textures.Count > textureNum) 990 if (scales != 0)
657 f.TextureID = textures[textureNum]; 991 f.RepeatU = scales;
992
993 if (scalet != 0)
994 f.RepeatV = scalet;
995
996 if (textures.Count > textureNum)
997 f.TextureID = textures[textureNum];
998
999 textureEntry.FaceTextures[face] = f;
1000 }
1001 pbs.TextureEntry = textureEntry.GetBytes();
1002
1003 Vector3 position = inner_instance_list["position"].AsVector3();
1004 Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();
1005
1006 // for now viwers do send fixed defaults
1007 // but this may change
1008// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger();
1009 byte physicsShapeType = (byte)PhysShapeType.convex; // default is simple convex
1010// int material = inner_instance_list["material"].AsInteger();
1011 byte material = (byte)Material.Wood;
1012
1013 SceneObjectPart prim
1014 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero);
1015
1016 prim.Scale = scale;
1017 rotations.Add(rotation);
1018 positions.Add(position);
1019 prim.UUID = UUID.Random();
1020 prim.CreatorID = creatorID;
1021 prim.OwnerID = owner_id;
1022 prim.GroupID = UUID.Zero;
1023 prim.LastOwnerID = creatorID;
1024 prim.RezzerID = creatorID;
1025 prim.CreationDate = Util.UnixTimeSinceEpoch();
1026
1027 if (grp == null)
1028 prim.Name = assetName;
658 else 1029 else
659 f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE; 1030 prim.Name = assetName + "#" + i.ToString();
660 1031
661 textureEntry.FaceTextures[face] = f; 1032 prim.EveryoneMask = 0;
662 } 1033 prim.GroupMask = 0;
663 1034
664 pbs.TextureEntry = textureEntry.GetBytes(); 1035 if (restrictPerms)
665 1036 {
666 AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); 1037 prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify);
667 meshAsset.Data = mesh_list[i].AsBinary(); 1038 prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify);
668 m_assetService.Store(meshAsset); 1039 prim.NextOwnerMask = 0;
669 1040 }
670 pbs.SculptEntry = true; 1041 else
671 pbs.SculptTexture = meshAsset.FullID; 1042 {
672 pbs.SculptType = (byte)SculptType.Mesh; 1043 prim.BaseMask = (uint)PermissionMask.All | (uint)PermissionMask.Export;
673 pbs.SculptData = meshAsset.Data; 1044 prim.OwnerMask = (uint)PermissionMask.All | (uint)PermissionMask.Export;
674 1045 prim.GroupMask = prim.BaseMask & (uint)groupMask;
675 Vector3 position = inner_instance_list["position"].AsVector3(); 1046 prim.EveryoneMask = prim.BaseMask & (uint)everyoneMask;
676 Vector3 scale = inner_instance_list["scale"].AsVector3(); 1047 prim.NextOwnerMask = prim.BaseMask & (uint)nextOwnerMask;
677 Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); 1048 // If the viewer gives us bogus permissions, revert to the SL
678 1049 // default of transfer only.
679// no longer used - begin ------------------------ 1050 if ((prim.NextOwnerMask & (uint)PermissionMask.All) == 0)
680// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger(); 1051 prim.NextOwnerMask = (uint)PermissionMask.Transfer;
681// int material = inner_instance_list["material"].AsInteger(); 1052 }
682// int mesh = inner_instance_list["mesh"].AsInteger(); 1053
683 1054 if(istest)
684// OSDMap permissions = (OSDMap)inner_instance_list["permissions"]; 1055 prim.Description = "For testing only. Other uses are prohibited";
685// int base_mask = permissions["base_mask"].AsInteger(); 1056 else
686// int everyone_mask = permissions["everyone_mask"].AsInteger(); 1057 prim.Description = "";
687// UUID creator_id = permissions["creator_id"].AsUUID(); 1058
688// UUID group_id = permissions["group_id"].AsUUID(); 1059 prim.Material = material;
689// int group_mask = permissions["group_mask"].AsInteger(); 1060 prim.PhysicsShapeType = physicsShapeType;
690// bool is_owner_group = permissions["is_owner_group"].AsBoolean();
691// UUID last_owner_id = permissions["last_owner_id"].AsUUID();
692// int next_owner_mask = permissions["next_owner_mask"].AsInteger();
693// UUID owner_id = permissions["owner_id"].AsUUID();
694// int owner_mask = permissions["owner_mask"].AsInteger();
695// no longer used - end ------------------------
696
697 UUID owner_id = m_HostCapsObj.AgentID;
698
699 SceneObjectPart prim
700 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero);
701
702 prim.Scale = scale;
703 //prim.OffsetPosition = position;
704 rotations.Add(rotation);
705 positions.Add(position);
706 prim.UUID = UUID.Random();
707 prim.CreatorID = owner_id;
708 prim.OwnerID = owner_id;
709 prim.GroupID = UUID.Zero;
710 prim.LastOwnerID = prim.OwnerID;
711 prim.CreationDate = Util.UnixTimeSinceEpoch();
712 prim.Name = assetName;
713 prim.Description = "";
714 1061
715// prim.BaseMask = (uint)base_mask; 1062// prim.BaseMask = (uint)base_mask;
716// prim.EveryoneMask = (uint)everyone_mask; 1063// prim.EveryoneMask = (uint)everyone_mask;
@@ -718,52 +1065,65 @@ namespace OpenSim.Region.ClientStack.Linden
718// prim.NextOwnerMask = (uint)next_owner_mask; 1065// prim.NextOwnerMask = (uint)next_owner_mask;
719// prim.OwnerMask = (uint)owner_mask; 1066// prim.OwnerMask = (uint)owner_mask;
720 1067
721 if (grp == null) 1068 if (grp == null)
722 grp = new SceneObjectGroup(prim); 1069 {
723 else 1070 grp = new SceneObjectGroup(prim);
724 grp.AddPart(prim); 1071 grp.LastOwnerID = creatorID;
725 } 1072 grp.RezzerID = creatorID;
1073 }
1074 else
1075 grp.AddPart(prim);
1076 }
726 1077
727 Vector3 rootPos = positions[0]; 1078 Vector3 rootPos = positions[0];
728 1079
729 if (grp.Parts.Length > 1) 1080 if (grp.Parts.Length > 1)
730 { 1081 {
731 // Fix first link number 1082 // Fix first link number
732 grp.RootPart.LinkNum++; 1083 grp.RootPart.LinkNum++;
733 1084
734 Quaternion rootRotConj = Quaternion.Conjugate(rotations[0]); 1085 Quaternion rootRotConj = Quaternion.Conjugate(rotations[0]);
735 Quaternion tmprot; 1086 Quaternion tmprot;
736 Vector3 offset; 1087 Vector3 offset;
737 1088
738 // fix children rotations and positions 1089 // fix children rotations and positions
739 for (int i = 1; i < rotations.Count; i++) 1090 for (int i = 1; i < rotations.Count; i++)
740 { 1091 {
741 tmprot = rotations[i]; 1092 tmprot = rotations[i];
742 tmprot = rootRotConj * tmprot; 1093 tmprot = rootRotConj * tmprot;
743 1094
744 grp.Parts[i].RotationOffset = tmprot; 1095 grp.Parts[i].RotationOffset = tmprot;
745 1096
746 offset = positions[i] - rootPos; 1097 offset = positions[i] - rootPos;
1098
1099 offset *= rootRotConj;
1100 grp.Parts[i].OffsetPosition = offset;
1101 }
747 1102
748 offset *= rootRotConj; 1103 grp.AbsolutePosition = rootPos;
749 grp.Parts[i].OffsetPosition = offset; 1104 grp.UpdateGroupRotationR(rotations[0]);
1105 }
1106 else
1107 {
1108 grp.AbsolutePosition = rootPos;
1109 grp.UpdateGroupRotationR(rotations[0]);
750 } 1110 }
751 1111
752 grp.AbsolutePosition = rootPos; 1112 data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp));
753 grp.UpdateGroupRotationR(rotations[0]);
754 } 1113 }
755 else 1114
1115 else // not a mesh model
756 { 1116 {
757 grp.AbsolutePosition = rootPos; 1117 m_log.ErrorFormat("[CAPS Asset Upload] got unsuported assetType for object upload");
758 grp.UpdateGroupRotationR(rotations[0]); 1118 return;
759 } 1119 }
760
761 data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp));
762 } 1120 }
763 1121
764 AssetBase asset; 1122 AssetBase asset;
765 asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString()); 1123 asset = new AssetBase(assetID, assetName, assType, creatorIDstr);
766 asset.Data = data; 1124 asset.Data = data;
1125 if (istest)
1126 asset.Local = true;
767 if (AddNewAsset != null) 1127 if (AddNewAsset != null)
768 AddNewAsset(asset); 1128 AddNewAsset(asset);
769 else if (m_assetService != null) 1129 else if (m_assetService != null)
@@ -771,11 +1131,17 @@ namespace OpenSim.Region.ClientStack.Linden
771 1131
772 InventoryItemBase item = new InventoryItemBase(); 1132 InventoryItemBase item = new InventoryItemBase();
773 item.Owner = m_HostCapsObj.AgentID; 1133 item.Owner = m_HostCapsObj.AgentID;
774 item.CreatorId = m_HostCapsObj.AgentID.ToString(); 1134 item.CreatorId = creatorIDstr;
775 item.CreatorData = String.Empty; 1135 item.CreatorData = String.Empty;
776 item.ID = inventoryItem; 1136 item.ID = inventoryItem;
777 item.AssetID = asset.FullID; 1137 item.AssetID = asset.FullID;
778 item.Description = assetDescription; 1138 if (istest)
1139 {
1140 item.Description = "For testing only. Other uses are prohibited";
1141 item.Flags = (uint) (InventoryItemFlags.SharedSingleReference);
1142 }
1143 else
1144 item.Description = assetDescription;
779 item.Name = assetName; 1145 item.Name = assetName;
780 item.AssetType = assType; 1146 item.AssetType = assType;
781 item.InvType = inType; 1147 item.InvType = inType;
@@ -783,18 +1149,69 @@ namespace OpenSim.Region.ClientStack.Linden
783 1149
784 // If we set PermissionMask.All then when we rez the item the next permissions will replace the current 1150 // If we set PermissionMask.All then when we rez the item the next permissions will replace the current
785 // (owner) permissions. This becomes a problem if next permissions are changed. 1151 // (owner) permissions. This becomes a problem if next permissions are changed.
786 item.CurrentPermissions
787 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
788 1152
789 item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; 1153 if (inType == (sbyte)CustomInventoryType.AnimationSet)
790 item.EveryOnePermissions = 0; 1154 {
791 item.NextPermissions = (uint)PermissionMask.All; 1155 AnimationSet.setCreateItemPermitions(item);
1156 }
1157
1158 else if (restrictPerms)
1159 {
1160 item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify);
1161 item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify);
1162 item.GroupPermissions = 0;
1163 item.EveryOnePermissions = 0;
1164 item.NextPermissions = 0;
1165 }
1166 else
1167 {
1168 item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
1169 item.CurrentPermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
1170 item.GroupPermissions = item.BasePermissions & (uint)groupMask;
1171 item.EveryOnePermissions = item.BasePermissions & (uint)everyoneMask;
1172 item.NextPermissions = item.BasePermissions & (uint)nextOwnerMask;
1173 if ((item.NextPermissions & (uint)PermissionMask.All) == 0)
1174 item.NextPermissions = (uint)PermissionMask.Transfer;
1175 }
1176
792 item.CreationDate = Util.UnixTimeSinceEpoch(); 1177 item.CreationDate = Util.UnixTimeSinceEpoch();
793 1178
1179 everyoneMask = (int)item.EveryOnePermissions;
1180 groupMask = (int)item.GroupPermissions;
1181 nextOwnerMask = (int)item.NextPermissions;
1182
1183 m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
1184
794 if (AddNewInventoryItem != null) 1185 if (AddNewInventoryItem != null)
795 { 1186 {
796 AddNewInventoryItem(m_HostCapsObj.AgentID, item); 1187 if (istest)
1188 {
1189 m_Scene.AddInventoryItem(client, item);
1190/*
1191 AddNewInventoryItem(m_HostCapsObj.AgentID, item, 0);
1192 if (client != null)
1193 client.SendAgentAlertMessage("Upload will have no cost, for personal test purposes only. Other uses are forbiden. Items may not work on a another region" , true);
1194 */
1195 }
1196 else
1197 {
1198 AddNewInventoryItem(m_HostCapsObj.AgentID, item, (uint)cost);
1199// if (client != null)
1200// {
1201// // let users see anything.. i don't so far
1202// string str;
1203// if (cost > 0)
1204// // dont remember where is money unit name to put here
1205// str = "Upload complete. charged " + cost.ToString() + "$";
1206// else
1207// str = "Upload complete";
1208// client.SendAgentAlertMessage(str, true);
1209// }
1210 }
797 } 1211 }
1212
1213 lock (m_ModelCost)
1214 m_FileAgentInventoryState = FileAgentInventoryState.idle;
798 } 1215 }
799 1216
800 /// <summary> 1217 /// <summary>
@@ -857,24 +1274,22 @@ namespace OpenSim.Region.ClientStack.Linden
857 LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); 1274 LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
858 LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest); 1275 LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest);
859 1276
860 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; 1277 string uploaderPath = GetNewCapPath();
861 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
862 1278
863 ItemUpdater uploader = 1279 ItemUpdater uploader =
864 new ItemUpdater(llsdRequest.item_id, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile); 1280 new ItemUpdater(llsdRequest.item_id, uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile);
865 uploader.OnUpLoad += ItemUpdated; 1281 uploader.OnUpLoad += ItemUpdated;
866 1282
867 m_HostCapsObj.HttpListener.AddStreamHandler( 1283 m_HostCapsObj.HttpListener.AddStreamHandler(
868 new BinaryStreamHandler( 1284 new BinaryStreamHandler(
869 "POST", capsBase + uploaderPath, uploader.uploaderCaps, "NoteCardAgentInventory", null)); 1285 "POST", uploaderPath, uploader.uploaderCaps, "NoteCardAgentInventory", null));
870 1286
871 string protocol = "http://"; 1287 string protocol = "http://";
872 1288
873 if (m_HostCapsObj.SSLCaps) 1289 if (m_HostCapsObj.SSLCaps)
874 protocol = "https://"; 1290 protocol = "https://";
875 1291
876 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + 1292 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + uploaderPath;
877 uploaderPath;
878 1293
879 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 1294 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
880 uploadResponse.uploader = uploaderURL; 1295 uploadResponse.uploader = uploaderURL;
@@ -930,29 +1345,22 @@ namespace OpenSim.Region.ClientStack.Linden
930 IClientAPI client = null; 1345 IClientAPI client = null;
931 1346
932 m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); 1347 m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
933 item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID)); 1348 item = m_Scene.InventoryService.GetItem(m_HostCapsObj.AgentID, itemID);
934 if (item != null) 1349 if (item != null)
935 { 1350 {
936 string message; 1351 string message;
937 copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID, out message); 1352 copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID, out message);
938 if (client != null) 1353 if (copyItem != null && client != null)
939 { 1354 {
940 if (copyItem != null) 1355 m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder);
941 { 1356 client.SendBulkUpdateInventory(copyItem);
942 m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder);
943 client.SendBulkUpdateInventory(copyItem);
944 }
945 else
946 {
947 client.SendAgentAlertMessage(message, false);
948 }
949 } 1357 }
950 } 1358 }
951 else 1359 else
952 { 1360 {
953 m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID); 1361 m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID);
954 if (client != null) 1362 if (client != null)
955 client.SendAgentAlertMessage("Failed to retrieve item", false); 1363 client.SendAlertMessage("Failed to retrieve item");
956 } 1364 }
957 } 1365 }
958 catch (Exception e) 1366 catch (Exception e)
@@ -995,26 +1403,483 @@ namespace OpenSim.Region.ClientStack.Linden
995 return response; 1403 return response;
996 } 1404 }
997 1405
998 public string UpdateAgentInformation(string request, string path, 1406 public string GetObjectCost(string request, string path,
999 string param, IOSHttpRequest httpRequest, 1407 string param, IOSHttpRequest httpRequest,
1000 IOSHttpResponse httpResponse) 1408 IOSHttpResponse httpResponse)
1001 { 1409 {
1002 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); 1410 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
1003 OSDMap accessPrefs = (OSDMap)req["access_prefs"]; 1411 OSDMap resp = new OSDMap();
1004 string desiredMaturity = accessPrefs["max"]; 1412
1413 OSDArray object_ids = (OSDArray)req["object_ids"];
1414
1415 for (int i = 0; i < object_ids.Count; i++)
1416 {
1417 UUID uuid = object_ids[i].AsUUID();
1418
1419 SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid);
1420 SceneObjectGroup grp = null;
1421 if (part != null)
1422 grp = part.ParentGroup;
1423 if (grp != null)
1424 {
1425 float linksetCost;
1426 float linksetPhysCost;
1427 float partCost;
1428 float partPhysCost;
1429
1430 grp.GetResourcesCosts(part,out linksetCost,out linksetPhysCost,out partCost,out partPhysCost);
1431
1432 OSDMap object_data = new OSDMap();
1433 object_data["linked_set_resource_cost"] = linksetCost;
1434 object_data["resource_cost"] = partCost;
1435 object_data["physics_cost"] = partPhysCost;
1436 object_data["linked_set_physics_cost"] = linksetPhysCost;
1437 object_data["resource_limiting_type"] = "legacy";
1438 resp[uuid.ToString()] = object_data;
1439 }
1440 }
1441 if(resp.Count == 0)
1442 {
1443 OSDMap object_data = new OSDMap();
1444 object_data["linked_set_resource_cost"] = 0;
1445 object_data["resource_cost"] = 0;
1446 object_data["physics_cost"] = 0;
1447 object_data["linked_set_physics_cost"] = 0;
1448 resp[UUID.Zero.ToString()] = object_data;
1449 }
1450 string response = OSDParser.SerializeLLSDXmlString(resp);
1451 return response;
1452 }
1453
1454 public string ResourceCostSelected(string request, string path,
1455 string param, IOSHttpRequest httpRequest,
1456 IOSHttpResponse httpResponse)
1457 {
1458 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
1459 OSDMap resp = new OSDMap();
1460
1461
1462 float phys=0;
1463 float stream=0;
1464 float simul=0;
1465
1466 if (req.ContainsKey("selected_roots"))
1467 {
1468 OSDArray object_ids = (OSDArray)req["selected_roots"];
1469
1470 // should go by SOG suming costs for all parts
1471 // ll v3 works ok with several objects select we get the list and adds ok
1472 // FS calls per object so results are wrong guess fs bug
1473 for (int i = 0; i < object_ids.Count; i++)
1474 {
1475 UUID uuid = object_ids[i].AsUUID();
1476 float Physc;
1477 float simulc;
1478 float streamc;
1479
1480 SceneObjectGroup grp = m_Scene.GetGroupByPrim(uuid);
1481 if (grp != null)
1482 {
1483 grp.GetSelectedCosts(out Physc, out streamc, out simulc);
1484 phys += Physc;
1485 stream += streamc;
1486 simul += simulc;
1487 }
1488 }
1489 }
1490 else if (req.ContainsKey("selected_prims"))
1491 {
1492 OSDArray object_ids = (OSDArray)req["selected_prims"];
1493
1494 // don't see in use in any of the 2 viewers
1495 // guess it should be for edit linked but... nothing
1496 // should go to SOP per part
1497 for (int i = 0; i < object_ids.Count; i++)
1498 {
1499 UUID uuid = object_ids[i].AsUUID();
1500
1501 SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid);
1502 if (part != null)
1503 {
1504 phys += part.PhysicsCost;
1505 stream += part.StreamingCost;
1506 simul += part.SimulationCost;
1507 }
1508 }
1509 }
1510
1511 OSDMap object_data = new OSDMap();
1512
1513 object_data["physics"] = phys;
1514 object_data["streaming"] = stream;
1515 object_data["simulation"] = simul;
1516
1517 resp["selected"] = object_data;
1518// resp["transaction_id"] = "undef";
1519 string response = OSDParser.SerializeLLSDXmlString(resp);
1520 return response;
1521 }
1005 1522
1523 public string UpdateAgentInformation(string request, string path,
1524 string param, IOSHttpRequest httpRequest,
1525 IOSHttpResponse httpResponse)
1526 {
1527// OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
1006 OSDMap resp = new OSDMap(); 1528 OSDMap resp = new OSDMap();
1007 OSDMap respAccessPrefs = new OSDMap(); 1529
1008 respAccessPrefs["max"] = desiredMaturity; // echoing the maturity back means success 1530 OSDMap accessPrefs = new OSDMap();
1009 resp["access_prefs"] = respAccessPrefs; 1531 accessPrefs["max"] = "A";
1532
1533 resp["access_prefs"] = accessPrefs;
1010 1534
1011 string response = OSDParser.SerializeLLSDXmlString(resp); 1535 string response = OSDParser.SerializeLLSDXmlString(resp);
1012 return response; 1536 return response;
1537 }
1538
1539 public bool OSDMapTOVector3(OSDMap map, out Vector3 v)
1540 {
1541 v = Vector3.Zero;
1542 if(!map.ContainsKey("X"))
1543 return false;
1544 if(!map.ContainsKey("Y"))
1545 return false;
1546 if(!map.ContainsKey("Z"))
1547 return false;
1548 v.X = (float)map["X"].AsReal();
1549 v.Y = (float)map["Y"].AsReal();
1550 v.Z = (float)map["Z"].AsReal();
1551 return true;
1552 }
1553
1554 public string HomeLocation(string request, string path, string param, IOSHttpRequest httpRequest,
1555 IOSHttpResponse httpResponse)
1556 {
1557 OSDMap resp = new OSDMap();
1558
1559 resp["success"] = "false";
1560
1561
1562 bool fail = true;
1563 string message = "Set Home request failed";
1564 int locationID = 1;
1565 Vector3 pos = Vector3.Zero;
1566 Vector3 lookAt = Vector3.Zero;
1567
1568 IClientAPI client = null;
1569 ScenePresence sp;
1570
1571 while(true)
1572 {
1573 if(m_Scene.GridUserService == null)
1574 break;
1575
1576 if(m_Scene.UserManagementModule == null)
1577 break;
1578
1579 m_Scene.TryGetScenePresence(m_AgentID, out sp);
1580 if(sp == null || sp.IsChildAgent || sp.IsDeleted)
1581 break;
1582
1583 if(sp.IsInTransit && !sp.IsInLocalTransit)
1584 break;
1585
1586 client = sp.ControllingClient;
1587
1588 if(!m_Scene.UserManagementModule.IsLocalGridUser(m_AgentID))
1589 break;
1590
1591 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
1592 if(!req.ContainsKey("HomeLocation"))
1593 break;
1594
1595 OSDMap HLocation = (OSDMap)req["HomeLocation"];
1596 if(!HLocation.ContainsKey("LocationPos"))
1597 break;
1598 if(!HLocation.ContainsKey("LocationLookAt"))
1599 break;
1600
1601 locationID = HLocation["LocationId"].AsInteger();
1602
1603 if(!OSDMapTOVector3((OSDMap)HLocation["LocationPos"], out pos))
1604 break;
1605
1606 if(!OSDMapTOVector3((OSDMap)HLocation["LocationLookAt"], out lookAt))
1607 break;
1608
1609 ILandObject land = m_Scene.LandChannel.GetLandObject(pos);
1610 if(land == null)
1611 break;
1612
1613 ulong gpowers = client.GetGroupPowers(land.LandData.GroupID);
1614 SceneObjectGroup telehub = null;
1615 if (m_Scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero)
1616 // Does the telehub exist in the scene?
1617 telehub = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject);
1618
1619 if (!m_Scene.Permissions.IsAdministrator(m_AgentID) && // (a) gods and land managers can set home
1620 !m_Scene.Permissions.IsGod(m_AgentID) &&
1621 m_AgentID != land.LandData.OwnerID && // (b) land owners can set home
1622 // (c) members of the land-associated group in roles that can set home
1623 ((gpowers & (ulong)GroupPowers.AllowSetHome) != (ulong)GroupPowers.AllowSetHome) &&
1624 // (d) parcels with telehubs can be the home of anyone
1625 (telehub == null || !land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y)))
1626 {
1627 message = "You are not allowed to set your home location in this parcel.";
1628 break;
1629 }
1630
1631 string userId;
1632 UUID test;
1633 if (!m_Scene.UserManagementModule.GetUserUUI(m_AgentID, out userId))
1634 {
1635 message = "Set Home request failed. (User Lookup)";
1636 break;
1637 }
1638
1639 if (!UUID.TryParse(userId, out test))
1640 {
1641 message = "Set Home request failed. (HG visitor)";
1642 break;
1643 }
1644
1645 if (m_Scene.GridUserService.SetHome(userId, land.RegionUUID, pos, lookAt))
1646 fail = false;
1647
1648 break;
1649 }
1650
1651 string response;
1652
1653 if(fail)
1654 {
1655 if(client != null)
1656 client.SendAlertMessage(message);
1657 response = OSDParser.SerializeLLSDXmlString(resp);
1658 return response;
1659 }
1660
1661 // so its http but still needs a udp reply to inform user? crap :p
1662 if(client != null)
1663 client.SendAlertMessage("Home position set.","HomePositionSet");
1664
1665 resp["success"] = "true";
1666 OSDMap homeloc = new OSDMap();
1667 OSDMap homelocpos = new OSDMap();
1668 // for some odd reason viewers send pos as reals but read as integer
1669 homelocpos["X"] = new OSDReal(pos.X);
1670 homelocpos["Y"] = new OSDReal(pos.Y);
1671 homelocpos["Z"] = new OSDReal(pos.Z);
1672 homeloc["LocationPos"] = homelocpos;
1673
1674 resp["HomeLocation"] = homeloc;
1675
1676 response = OSDParser.SerializeLLSDXmlString(resp);
1677 return response;
1678 }
1679
1680 private static int CompareRolesByMembersDesc(GroupRolesData x, GroupRolesData y)
1681 {
1682 return -(x.Members.CompareTo(y.Members));
1683 }
1684
1685 public string GroupMemberData(string request, string path, string param, IOSHttpRequest httpRequest,
1686 IOSHttpResponse httpResponse)
1687 {
1688 OSDMap resp = new OSDMap();
1689
1690 string response;
1691
1692 bool fail = true;
1693 IClientAPI client = null;
1694 ScenePresence sp;
1695 IGroupsModule m_GroupsModule;
1696 UUID groupID = UUID.Zero;
1697
1698 while(true)
1699 {
1700 m_GroupsModule = m_Scene.RequestModuleInterface<IGroupsModule>();
1701 if(m_GroupsModule == null)
1702 break;
1703
1704 m_Scene.TryGetScenePresence(m_AgentID, out sp);
1705 if(sp == null || sp.IsChildAgent || sp.IsDeleted)
1706 break;
1707
1708 if(sp.IsInTransit && !sp.IsInLocalTransit)
1709 break;
1710
1711 client = sp.ControllingClient;
1712
1713 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
1714 if(!req.ContainsKey("group_id"))
1715 break;
1716
1717 groupID = req["group_id"].AsUUID();
1718 if(groupID == UUID.Zero)
1719 break;
1720
1721 List<GroupRolesData> roles = m_GroupsModule.GroupRoleDataRequest(client, groupID);
1722 if(roles == null || roles.Count == 0)
1723 break;
1724
1725 List<GroupMembersData> members = m_GroupsModule.GroupMembersRequest(client, groupID);
1726 if(members == null || members.Count == 0)
1727 break;
1728
1729 int memberCount = members.Count;
1730
1731 Dictionary<string,int> titles = new Dictionary<string,int>();
1732 int i = 0;
1733
1734 ulong defaultPowers = 0;
1735
1736
1737 // build titles array and index
1738 roles.Sort(CompareRolesByMembersDesc);
1739
1740 OSDArray osdtitles = new OSDArray();
1741 foreach(GroupRolesData grd in roles)
1742 {
1743 if(grd.Title == null)
1744 continue;
1745 string title = grd.Title;
1746 if(i==0)
1747 defaultPowers = grd.Powers;
1748
1749 if(!titles.ContainsKey(title))
1750 {
1751 titles[title] = i++;
1752 osdtitles.Add(new OSDString(title));
1753 }
1754 }
1755
1756 if(titles.Count == 0)
1757 break;
1758
1759 OSDMap osdmembers = new OSDMap();
1760 foreach(GroupMembersData gmd in members)
1761 {
1762 OSDMap m = new OSDMap();
1763 if(gmd.OnlineStatus != null && gmd.OnlineStatus != "")
1764 m["last_login"] = new OSDString(gmd.OnlineStatus);
1765 if(gmd.AgentPowers != defaultPowers)
1766 m["powers"] = new OSDString((gmd.AgentPowers).ToString("X"));
1767 if(gmd.Title != null && titles.ContainsKey(gmd.Title) && titles[gmd.Title] != 0)
1768 m["title"] = new OSDInteger(titles[gmd.Title]);
1769 if(gmd.IsOwner)
1770 m["owner"] = new OSDString("true");
1771 if(gmd.Contribution != 0)
1772 m["donated_square_meters"] = new OSDInteger(gmd.Contribution);
1773
1774 osdmembers[(gmd.AgentID).ToString()] = m;
1775 }
1776
1777 OSDMap osddefaults = new OSDMap();
1778 osddefaults["default_powers"] = new OSDString(defaultPowers.ToString("X"));
1779
1780 resp["group_id"] = new OSDUUID(groupID);
1781 resp["agent_id"] = new OSDUUID(m_AgentID);
1782 resp["member_count"] = new OSDInteger(memberCount);
1783 resp["defaults"] = osddefaults;
1784 resp["titles"] = osdtitles;
1785 resp["members"] = osdmembers;
1786
1787 fail = false;
1788 break;
1789 }
1790
1791 if(fail)
1792 {
1793 resp["group_id"] = new OSDUUID(groupID);
1794 resp["agent_id"] = new OSDUUID(m_AgentID);
1795 resp["member_count"] = new OSDInteger(0);
1796 resp["defaults"] = new OSDMap();
1797 resp["titles"] = new OSDArray();
1798 resp["members"] = new OSDMap();
1799 }
1800
1801 response = OSDParser.SerializeLLSDXmlString(resp);
1802 return response;
1803 }
1804
1805 public string GetDisplayNames(string request, string path,
1806 string param, IOSHttpRequest httpRequest,
1807 IOSHttpResponse httpResponse)
1808 {
1809 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.Gone;
1810 httpResponse.ContentType = "text/plain";
1811
1812 ScenePresence sp = m_Scene.GetScenePresence(m_AgentID);
1813 if(sp == null || sp.IsDeleted)
1814 return "";
1815
1816 if(sp.IsInTransit && !sp.IsInLocalTransit)
1817 {
1818 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.ServiceUnavailable;
1819 httpResponse.AddHeader("Retry-After","30");
1820 return "";
1821 }
1822
1823 NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
1824 string[] ids = query.GetValues("ids");
1825
1826 Dictionary<UUID,string> names = m_UserManager.GetUsersNames(ids);
1827
1828 OSDMap osdReply = new OSDMap();
1829 OSDArray agents = new OSDArray();
1830
1831 osdReply["agents"] = agents;
1832 foreach (KeyValuePair<UUID,string> kvp in names)
1833 {
1834 if (string.IsNullOrEmpty(kvp.Value))
1835 continue;
1836 if(kvp.Key == UUID.Zero)
1837 continue;
1838
1839 string[] parts = kvp.Value.Split(new char[] {' '});
1840 OSDMap osdname = new OSDMap();
1841
1842 // dont tell about unknown users, we can't send them back on Bad either
1843 if(parts[0] == "Unknown")
1844 continue;
1845/*
1846 if(parts[0] == "Unknown")
1847 {
1848 osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1));
1849 osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2));
1850 }
1851 else
1852*/
1853 {
1854 osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8));
1855 osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1));
1856 }
1857 osdname["display_name"] = OSD.FromString(kvp.Value);
1858 osdname["legacy_first_name"] = parts[0];
1859 osdname["legacy_last_name"] = parts[1];
1860 osdname["username"] = OSD.FromString(kvp.Value);
1861 osdname["id"] = OSD.FromUUID(kvp.Key);
1862 osdname["is_display_name_default"] = OSD.FromBoolean(true);
1863
1864 agents.Add(osdname);
1865 }
1866
1867 // Full content request
1868 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
1869 //httpResponse.ContentLength = ??;
1870 httpResponse.ContentType = "application/llsd+xml";
1871
1872 string reply = OSDParser.SerializeLLSDXmlString(osdReply);
1873 return reply;
1013 } 1874 }
1014 } 1875 }
1015 1876
1016 public class AssetUploader 1877 public class AssetUploader
1017 { 1878 {
1879 private static readonly ILog m_log =
1880 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
1881
1882
1018 public event UpLoadedAsset OnUpLoad; 1883 public event UpLoadedAsset OnUpLoad;
1019 private UpLoadedAsset handlerUpLoad = null; 1884 private UpLoadedAsset handlerUpLoad = null;
1020 1885
@@ -1029,10 +1894,26 @@ namespace OpenSim.Region.ClientStack.Linden
1029 1894
1030 private string m_invType = String.Empty; 1895 private string m_invType = String.Empty;
1031 private string m_assetType = String.Empty; 1896 private string m_assetType = String.Empty;
1897 private int m_cost;
1898 private string m_error = String.Empty;
1899
1900 private Timer m_timeoutTimer = new Timer();
1901 private UUID m_texturesFolder;
1902 private int m_nreqtextures;
1903 private int m_nreqmeshs;
1904 private int m_nreqinstances;
1905 private bool m_IsAtestUpload;
1906
1907 private int m_nextOwnerMask;
1908 private int m_groupMask;
1909 private int m_everyoneMask;
1910
1032 1911
1033 public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, 1912 public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem,
1034 UUID parentFolderID, string invType, string assetType, string path, 1913 UUID parentFolderID, string invType, string assetType, string path,
1035 IHttpServer httpServer, bool dumpAssetsToFile) 1914 IHttpServer httpServer, bool dumpAssetsToFile,
1915 int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
1916 bool IsAtestUpload, int nextOwnerMask, int groupMask, int everyoneMask)
1036 { 1917 {
1037 m_assetName = assetName; 1918 m_assetName = assetName;
1038 m_assetDes = description; 1919 m_assetDes = description;
@@ -1044,6 +1925,22 @@ namespace OpenSim.Region.ClientStack.Linden
1044 m_assetType = assetType; 1925 m_assetType = assetType;
1045 m_invType = invType; 1926 m_invType = invType;
1046 m_dumpAssetsToFile = dumpAssetsToFile; 1927 m_dumpAssetsToFile = dumpAssetsToFile;
1928 m_cost = totalCost;
1929
1930 m_texturesFolder = texturesFolder;
1931 m_nreqtextures = nreqtextures;
1932 m_nreqmeshs = nreqmeshs;
1933 m_nreqinstances = nreqinstances;
1934 m_IsAtestUpload = IsAtestUpload;
1935
1936 m_timeoutTimer.Elapsed += TimedOut;
1937 m_timeoutTimer.Interval = 120000;
1938 m_timeoutTimer.AutoReset = false;
1939 m_timeoutTimer.Start();
1940
1941 m_nextOwnerMask = nextOwnerMask;
1942 m_groupMask = groupMask;
1943 m_everyoneMask = everyoneMask;
1047 } 1944 }
1048 1945
1049 /// <summary> 1946 /// <summary>
@@ -1058,12 +1955,14 @@ namespace OpenSim.Region.ClientStack.Linden
1058 UUID inv = inventoryItemID; 1955 UUID inv = inventoryItemID;
1059 string res = String.Empty; 1956 string res = String.Empty;
1060 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); 1957 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
1958/*
1061 uploadComplete.new_asset = newAssetID.ToString(); 1959 uploadComplete.new_asset = newAssetID.ToString();
1062 uploadComplete.new_inventory_item = inv; 1960 uploadComplete.new_inventory_item = inv;
1063 uploadComplete.state = "complete"; 1961 uploadComplete.state = "complete";
1064 1962
1065 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); 1963 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
1066 1964*/
1965 m_timeoutTimer.Stop();
1067 httpListener.RemoveStreamHandler("POST", uploaderPath); 1966 httpListener.RemoveStreamHandler("POST", uploaderPath);
1068 1967
1069 // TODO: probably make this a better set of extensions here 1968 // TODO: probably make this a better set of extensions here
@@ -1080,12 +1979,55 @@ namespace OpenSim.Region.ClientStack.Linden
1080 handlerUpLoad = OnUpLoad; 1979 handlerUpLoad = OnUpLoad;
1081 if (handlerUpLoad != null) 1980 if (handlerUpLoad != null)
1082 { 1981 {
1083 handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); 1982 handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,
1983 m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload,
1984 ref m_error, ref m_nextOwnerMask, ref m_groupMask, ref m_everyoneMask);
1084 } 1985 }
1085 1986
1987 uploadComplete.new_next_owner_mask = m_nextOwnerMask;
1988 uploadComplete.new_group_mask = m_groupMask;
1989 uploadComplete.new_everyone_mask = m_everyoneMask;
1990
1991 if (m_IsAtestUpload)
1992 {
1993 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
1994 resperror.message = "Upload SUCESSEFULL for testing purposes only. Other uses are prohibited. Item will not work after 48 hours or on other regions";
1995 resperror.identifier = inv;
1996
1997 uploadComplete.error = resperror;
1998 uploadComplete.state = "Upload4Testing";
1999 }
2000 else
2001 {
2002 if (m_error == String.Empty)
2003 {
2004 uploadComplete.new_asset = newAssetID.ToString();
2005 uploadComplete.new_inventory_item = inv;
2006 // if (m_texturesFolder != UUID.Zero)
2007 // uploadComplete.new_texture_folder_id = m_texturesFolder;
2008 uploadComplete.state = "complete";
2009 }
2010 else
2011 {
2012 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
2013 resperror.message = m_error;
2014 resperror.identifier = inv;
2015
2016 uploadComplete.error = resperror;
2017 uploadComplete.state = "failed";
2018 }
2019 }
2020
2021 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
1086 return res; 2022 return res;
1087 } 2023 }
1088 2024
2025 private void TimedOut(object sender, ElapsedEventArgs args)
2026 {
2027 m_log.InfoFormat("[CAPS]: Removing URL and handler for timed out mesh upload");
2028 httpListener.RemoveStreamHandler("POST", uploaderPath);
2029 }
2030
1089 ///Left this in and commented in case there are unforseen issues 2031 ///Left this in and commented in case there are unforseen issues
1090 //private void SaveAssetToFile(string filename, byte[] data) 2032 //private void SaveAssetToFile(string filename, byte[] data)
1091 //{ 2033 //{