aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
authorUbitUmarov2018-11-29 18:57:20 +0000
committerUbitUmarov2018-11-29 18:57:32 +0000
commit2eee87fea3a5353e24ce2a6279400e4b5da292e6 (patch)
treea9bd17234b90f663fcc82683c4ec75b2d970fa13 /OpenSim/Region/ClientStack/Linden
parentOSSL remove functions with illegal lsl types, also redundante (diff)
downloadopensim-SC-2eee87fea3a5353e24ce2a6279400e4b5da292e6.zip
opensim-SC-2eee87fea3a5353e24ce2a6279400e4b5da292e6.tar.gz
opensim-SC-2eee87fea3a5353e24ce2a6279400e4b5da292e6.tar.bz2
opensim-SC-2eee87fea3a5353e24ce2a6279400e4b5da292e6.tar.xz
mantis 8414: add cap CreateInventoryCategory handler
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs71
1 files changed, 70 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index dd410a7..0289513 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -312,9 +312,13 @@ namespace OpenSim.Region.ClientStack.Linden
312 m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler); 312 m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler);
313 313
314 IRequestHandler CopyInventoryFromNotecardHandler = new RestStreamHandler( 314 IRequestHandler CopyInventoryFromNotecardHandler = new RestStreamHandler(
315 "POST", GetNewCapPath(), CopyInventoryFromNotecard, "CopyInventoryFromNotecard", null); 315 "POST", GetNewCapPath(), CopyInventoryFromNotecard, "CopyInventoryFromNotecard", null);
316 m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", CopyInventoryFromNotecardHandler); 316 m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", CopyInventoryFromNotecardHandler);
317 317
318 IRequestHandler CreateInventoryCategoryHandler = new RestStreamHandler(
319 "POST", GetNewCapPath(), CreateInventoryCategory, "CreateInventoryCategory", null);
320 m_HostCapsObj.RegisterHandler("CreateInventoryCategory", CreateInventoryCategoryHandler);
321
318 } 322 }
319 catch (Exception e) 323 catch (Exception e)
320 { 324 {
@@ -1260,6 +1264,71 @@ namespace OpenSim.Region.ClientStack.Linden
1260 return String.Empty; 1264 return String.Empty;
1261 } 1265 }
1262 1266
1267 public string CreateInventoryCategory(string request, string path, string param,
1268 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
1269 {
1270 if (m_Scene.InventoryService == null)
1271 {
1272 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.ServiceUnavailable;
1273 httpResponse.StatusDescription = "Service not avaiable";
1274 return "";
1275 }
1276
1277 ScenePresence sp = m_Scene.GetScenePresence(m_AgentID);
1278 if (sp == null || sp.IsDeleted)
1279 {
1280 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.ServiceUnavailable;
1281 httpResponse.StatusDescription = "Retry later";
1282 httpResponse.AddHeader("Retry-After", "30");
1283 return "";
1284 }
1285
1286 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
1287
1288 while (true) // kinda goto
1289 {
1290 if (!hash.Contains("folder_id") || !(hash["folder_id"] is UUID))
1291 break;
1292 UUID folderID = (UUID)hash["folder_id"];
1293
1294 if (!hash.Contains("parent_id") || !(hash["parent_id"] is UUID))
1295 break;
1296 UUID parentID = (UUID)hash["parent_id"];
1297
1298 if (!hash.Contains("name") || !(hash["name"] is string))
1299 break;
1300 string folderName = (string)hash["name"];
1301
1302 if (!hash.Contains("type") || !(hash["type"] is int))
1303 break;
1304 int folderType = (int)hash["type"];
1305
1306 InventoryFolderBase folder = new InventoryFolderBase(folderID, folderName, m_AgentID, (short)folderType, parentID, 1);
1307 if (!m_Scene.InventoryService.AddFolder(folder))
1308 break;
1309
1310 // costly double check plus possible service changes
1311 folder = m_Scene.InventoryService.GetFolder(m_AgentID, folderID);
1312 if(folder == null)
1313 break;
1314
1315 StringBuilder sb = LLSDxmlEncode.Start(256);
1316 LLSDxmlEncode.AddMap(sb);
1317 LLSDxmlEncode.AddElem("folder_id", folder.ID, sb);
1318 LLSDxmlEncode.AddElem("name", folder.Name, sb);
1319 LLSDxmlEncode.AddElem("parent_id", folder.ParentID, sb);
1320 LLSDxmlEncode.AddElem("type", folder.Type, sb);
1321 LLSDxmlEncode.AddEndMap(sb);
1322 string resp = LLSDxmlEncode.End(sb);
1323
1324 return resp;
1325 }
1326
1327 httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest;
1328 httpResponse.StatusDescription = "Error";
1329 httpResponse.KeepAlive = false;
1330 return "";
1331 }
1263 1332
1264 /// <summary> 1333 /// <summary>
1265 /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset. 1334 /// Called by the notecard update handler. Provides a URL to which the client can upload a new asset.