aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-07-07 23:49:19 +0100
committerJustin Clark-Casey (justincc)2011-07-07 23:49:19 +0100
commit3bda7711b3998d21d0ce78d99273f83d6ee73991 (patch)
tree199c8981e1ad29217f70cbf244298171671959a5 /OpenSim
parentMake MeshUploadFlagModule non-shared rather than shared (since each scene nee... (diff)
downloadopensim-SC_OLD-3bda7711b3998d21d0ce78d99273f83d6ee73991.zip
opensim-SC_OLD-3bda7711b3998d21d0ce78d99273f83d6ee73991.tar.gz
opensim-SC_OLD-3bda7711b3998d21d0ce78d99273f83d6ee73991.tar.bz2
opensim-SC_OLD-3bda7711b3998d21d0ce78d99273f83d6ee73991.tar.xz
Switch the MeshUploadFlag CAP module on and off with the existing config AllowMeshUpload flag in [Mesh] (in OpenSimDefaults.ini)
Default is on.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs49
1 files changed, 35 insertions, 14 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs
index 2d15ca5..c9d7ae1 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs
@@ -45,33 +45,54 @@ namespace OpenSim.Region.ClientStack.Linden
45 /// <summary> 45 /// <summary>
46 /// MeshUploadFlag capability. This is required for uploading Mesh. 46 /// MeshUploadFlag capability. This is required for uploading Mesh.
47 /// </summary> 47 /// </summary>
48 ///
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
50 public class MeshUploadFlagModule : INonSharedRegionModule 49 public class MeshUploadFlagModule : INonSharedRegionModule
51 { 50 {
52 private static readonly ILog m_log = 51 private static readonly ILog m_log =
53 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53
54 /// <summary>
55 /// Is this module enabled?
56 /// </summary>
57 public bool Enabled { get; private set; }
58
54 private Scene m_scene; 59 private Scene m_scene;
55 private UUID m_agentID; 60 private UUID m_agentID;
56 61
57
58 #region ISharedRegionModule Members 62 #region ISharedRegionModule Members
59 63
64 public MeshUploadFlagModule()
65 {
66 Enabled = true;
67 }
68
60 public void Initialise(IConfigSource source) 69 public void Initialise(IConfigSource source)
61 { 70 {
62 IConfig config = source.Configs["MeshUploadFlag"]; 71 IConfig config = source.Configs["Mesh"];
63 if (config == null) 72 if (config == null)
73 {
64 return; 74 return;
75 }
76 else
77 {
78 Enabled = config.GetBoolean("AllowMeshUpload", Enabled);
79 }
65 } 80 }
66 81
67 public void AddRegion(Scene s) 82 public void AddRegion(Scene s)
68 { 83 {
84 if (!Enabled)
85 return;
86
69 m_scene = s; 87 m_scene = s;
70 m_scene.EventManager.OnRegisterCaps += RegisterCaps; 88 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
71 } 89 }
72 90
73 public void RemoveRegion(Scene s) 91 public void RemoveRegion(Scene s)
74 { 92 {
93 if (!Enabled)
94 return;
95
75 m_scene.EventManager.OnRegisterCaps -= RegisterCaps; 96 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
76 } 97 }
77 98
@@ -98,22 +119,23 @@ namespace OpenSim.Region.ClientStack.Linden
98 { 119 {
99 IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag); 120 IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag);
100 caps.RegisterHandler("MeshUploadFlag", reqHandler); 121 caps.RegisterHandler("MeshUploadFlag", reqHandler);
101 m_agentID = agentID; 122 m_agentID = agentID;
102 } 123 }
103 124
104 private Hashtable MeshUploadFlag(Hashtable mDhttpMethod) 125 private Hashtable MeshUploadFlag(Hashtable mDhttpMethod)
105 { 126 {
106 m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: MeshUploadFlag request"); 127 m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: MeshUploadFlag request");
128
107 OSDMap data = new OSDMap(); 129 OSDMap data = new OSDMap();
108 ScenePresence sp = m_scene.GetScenePresence(m_agentID); 130 ScenePresence sp = m_scene.GetScenePresence(m_agentID);
109 data["username"] = sp.Firstname + "." + sp.Lastname; 131 data["username"] = sp.Firstname + "." + sp.Lastname;
110 data["display_name_next_update"] = new OSDDate(DateTime.Now); 132 data["display_name_next_update"] = new OSDDate(DateTime.Now);
111 data["legacy_first_name"] = sp.Firstname; 133 data["legacy_first_name"] = sp.Firstname;
112 data["mesh_upload_status"] = "valid"; 134 data["mesh_upload_status"] = "valid";
113 data["display_name"] = sp.Firstname + " " + sp.Lastname; 135 data["display_name"] = sp.Firstname + " " + sp.Lastname;
114 data["legacy_last_name"] = sp.Lastname; 136 data["legacy_last_name"] = sp.Lastname;
115 data["id"] = m_agentID; 137 data["id"] = m_agentID;
116 data["is_display_name_default"] = true; 138 data["is_display_name_default"] = true;
117 139
118 //Send back data 140 //Send back data
119 Hashtable responsedata = new Hashtable(); 141 Hashtable responsedata = new Hashtable();
@@ -123,6 +145,5 @@ namespace OpenSim.Region.ClientStack.Linden
123 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data); 145 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
124 return responsedata; 146 return responsedata;
125 } 147 }
126
127 } 148 }
128} \ No newline at end of file 149} \ No newline at end of file