DispatchRegionInfo.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections;
  3. using System.IO;
  4. using System.Net;
  5. using System.Text;
  6. using System.Threading;
  7. using OpenMetaverse;
  8. using OpenMetaverse.StructuredData;
  9. using OpenSim.Framework;
  10. using OpenSim.Framework.Capabilities;
  11. using OpenSim.Region.Framework.Scenes;
  12. using OpenSim.Region.Framework.Interfaces;
  13. using OpenSim.Framework.Servers.HttpServer;
  14. using OSDMap = OpenMetaverse.StructuredData.OSDMap;
  15. namespace OpenSim.Region.ClientStack.Linden
  16. {
  17. public partial class BunchOfCaps
  18. {
  19. public void DispatchRegionInfo(IOSHttpRequest request, IOSHttpResponse response, OSDMap map)
  20. {
  21. //m_log.Debug("[CAPS]: DispatchRegionInfo Request in region: " + m_regionName + "\n");
  22. if (request.HttpMethod != "POST")
  23. {
  24. response.StatusCode = (int)HttpStatusCode.NotFound;
  25. return;
  26. }
  27. if(map == map.Count < 3)
  28. {
  29. response.StatusCode = (int)HttpStatusCode.BadRequest;
  30. return;
  31. }
  32. if (!m_Scene.TryGetScenePresence(m_AgentID, out ScenePresence _) || !m_Scene.Permissions.CanIssueEstateCommand(m_AgentID, false))
  33. {
  34. response.StatusCode = (int)HttpStatusCode.Unauthorized;
  35. return;
  36. }
  37. IEstateModule estateModule = m_Scene.RequestModuleInterface<IEstateModule>();
  38. if (estateModule == null)
  39. {
  40. response.StatusCode = (int)HttpStatusCode.NotImplemented;
  41. return;
  42. }
  43. response.StatusCode = estateModule.SetRegionInfobyCap(map) ? (int)HttpStatusCode.OK : (int)HttpStatusCode.NotImplemented;
  44. }
  45. }
  46. }