aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins
diff options
context:
space:
mode:
authorUbitUmarov2015-09-01 14:54:35 +0100
committerUbitUmarov2015-09-01 14:54:35 +0100
commit371c9dd2af01a2e7422ec901ee1f80757284a78c (patch)
tree058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/ApplicationPlugins
parentremove lixo (diff)
parentdont change camera on crossings (diff)
downloadopensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip
opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz
opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2
opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz
bad merge?
Diffstat (limited to 'OpenSim/ApplicationPlugins')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs288
1 files changed, 236 insertions, 52 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 0228c3c..0c582e1 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -75,6 +75,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
75 75
76 private string m_name = "RemoteAdminPlugin"; 76 private string m_name = "RemoteAdminPlugin";
77 private string m_version = "0.0"; 77 private string m_version = "0.0";
78 private string m_openSimVersion;
78 79
79 public string Version 80 public string Version
80 { 81 {
@@ -94,6 +95,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
94 95
95 public void Initialise(OpenSimBase openSim) 96 public void Initialise(OpenSimBase openSim)
96 { 97 {
98 m_openSimVersion = openSim.GetVersionText();
99
97 m_configSource = openSim.ConfigSource.Source; 100 m_configSource = openSim.ConfigSource.Source;
98 try 101 try
99 { 102 {
@@ -136,6 +139,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
136 availableMethods["admin_region_query"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRegionQueryMethod); 139 availableMethods["admin_region_query"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRegionQueryMethod);
137 availableMethods["admin_shutdown"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcShutdownMethod); 140 availableMethods["admin_shutdown"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcShutdownMethod);
138 availableMethods["admin_broadcast"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAlertMethod); 141 availableMethods["admin_broadcast"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAlertMethod);
142 availableMethods["admin_dialog"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcDialogMethod);
139 availableMethods["admin_restart"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRestartMethod); 143 availableMethods["admin_restart"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRestartMethod);
140 availableMethods["admin_load_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadHeightmapMethod); 144 availableMethods["admin_load_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadHeightmapMethod);
141 availableMethods["admin_save_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveHeightmapMethod); 145 availableMethods["admin_save_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveHeightmapMethod);
@@ -164,8 +168,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
164 availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList); 168 availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList);
165 availableMethods["admin_estate_reload"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcEstateReload); 169 availableMethods["admin_estate_reload"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcEstateReload);
166 170
167 // Land management 171 // Misc
168 availableMethods["admin_reset_land"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcResetLand); 172 availableMethods["admin_refresh_search"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshSearch);
173 availableMethods["admin_refresh_map"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshMap);
174 availableMethods["admin_get_opensim_version"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetOpenSimVersion);
175 availableMethods["admin_get_agent_count"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetAgentCount);
169 176
170 // Either enable full remote functionality or just selected features 177 // Either enable full remote functionality or just selected features
171 string enabledMethods = m_config.GetString("enabled_methods", "all"); 178 string enabledMethods = m_config.GetString("enabled_methods", "all");
@@ -266,25 +273,105 @@ namespace OpenSim.ApplicationPlugins.RemoteController
266 273
267 try 274 try
268 { 275 {
269 m_log.Info("[RADMIN]: Request to restart Region."); 276 Scene rebootedScene = null;
277 bool restartAll = false;
270 278
271 CheckRegionParams(requestData, responseData); 279 IConfig startupConfig = m_configSource.Configs["Startup"];
280 if (startupConfig != null)
281 {
282 if (startupConfig.GetBoolean("InworldRestartShutsDown", false))
283 {
284 rebootedScene = m_application.SceneManager.CurrentOrFirstScene;
285 restartAll = true;
286 }
287 }
272 288
273 Scene rebootedScene = null; 289 if (rebootedScene == null)
274 GetSceneFromRegionParams(requestData, responseData, out rebootedScene); 290 {
291 CheckRegionParams(requestData, responseData);
292
293 GetSceneFromRegionParams(requestData, responseData, out rebootedScene);
294 }
295
296 IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
275 297
276 responseData["success"] = false; 298 responseData["success"] = false;
277 responseData["accepted"] = true; 299 responseData["accepted"] = true;
278 responseData["rebooting"] = true; 300 responseData["rebooting"] = true;
279 301
280 IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>(); 302 string message;
281 if (restartModule != null) 303 List<int> times = new List<int>();
304
305 if (requestData.ContainsKey("alerts"))
282 { 306 {
283 List<int> times = new List<int> { 30, 15 }; 307 string[] alertTimes = requestData["alerts"].ToString().Split( new char[] {','});
308 if (alertTimes.Length == 1 && Convert.ToInt32(alertTimes[0]) == -1)
309 {
310 m_log.Info("[RADMIN]: Request to cancel restart.");
284 311
285 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); 312 if (restartModule != null)
286 responseData["success"] = true; 313 {
314 message = "Restart has been cancelled";
315
316 if (requestData.ContainsKey("message"))
317 message = requestData["message"].ToString();
318
319 restartModule.AbortRestart(message);
320
321 responseData["success"] = true;
322 responseData["rebooting"] = false;
323
324 return;
325 }
326 }
327 foreach (string a in alertTimes)
328 times.Add(Convert.ToInt32(a));
329 }
330 else
331 {
332 int timeout = 30;
333 if (requestData.ContainsKey("milliseconds"))
334 timeout = Int32.Parse(requestData["milliseconds"].ToString()) / 1000;
335 while (timeout > 0)
336 {
337 times.Add(timeout);
338 if (timeout > 300)
339 timeout -= 120;
340 else if (timeout > 30)
341 timeout -= 30;
342 else
343 timeout -= 15;
344 }
287 } 345 }
346
347 m_log.Info("[RADMIN]: Request to restart Region.");
348
349 message = "Region is restarting in {0}. Please save what you are doing and log out.";
350
351 if (requestData.ContainsKey("message"))
352 message = requestData["message"].ToString();
353
354 bool notice = true;
355 if (requestData.ContainsKey("noticetype")
356 && ((string)requestData["noticetype"] == "dialog"))
357 {
358 notice = false;
359 }
360
361 List<Scene> restartList;
362
363 if (restartAll)
364 restartList = m_application.SceneManager.Scenes;
365 else
366 restartList = new List<Scene>() { rebootedScene };
367
368 foreach (Scene s in m_application.SceneManager.Scenes)
369 {
370 restartModule = s.RequestModuleInterface<IRestartModule>();
371 if (restartModule != null)
372 restartModule.ScheduleRestart(UUID.Zero, message, times.ToArray(), notice);
373 }
374 responseData["success"] = true;
288 } 375 }
289 catch (Exception e) 376 catch (Exception e)
290 { 377 {
@@ -321,6 +408,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController
321 m_log.Info("[RADMIN]: Alert request complete"); 408 m_log.Info("[RADMIN]: Alert request complete");
322 } 409 }
323 410
411 public void XmlRpcDialogMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
412 {
413 Hashtable responseData = (Hashtable)response.Value;
414
415 m_log.Info("[RADMIN]: Dialog request started");
416
417 Hashtable requestData = (Hashtable)request.Params[0];
418
419 string message = (string)requestData["message"];
420 string fromuuid = (string)requestData["from"];
421 m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
422
423 responseData["accepted"] = true;
424 responseData["success"] = true;
425
426 m_application.SceneManager.ForEachScene(
427 delegate(Scene scene)
428 {
429 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
430 if (dialogModule != null)
431 dialogModule.SendNotificationToUsersInRegion(UUID.Zero, fromuuid, message);
432 });
433
434 m_log.Info("[RADMIN]: Dialog request complete");
435 }
436
324 private void XmlRpcLoadHeightmapMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) 437 private void XmlRpcLoadHeightmapMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
325 { 438 {
326 m_log.Info("[RADMIN]: Load height maps request started"); 439 m_log.Info("[RADMIN]: Load height maps request started");
@@ -424,13 +537,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController
424 message = "Region is going down now."; 537 message = "Region is going down now.";
425 } 538 }
426 539
427 m_application.SceneManager.ForEachScene( 540 if (requestData.ContainsKey("noticetype")
541 && ((string) requestData["noticetype"] == "dialog"))
542 {
543 m_application.SceneManager.ForEachScene(
544
428 delegate(Scene scene) 545 delegate(Scene scene)
546 {
547 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
548 if (dialogModule != null)
549 dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message);
550 });
551 }
552 else
553 {
554 if (!requestData.ContainsKey("noticetype")
555 || ((string)requestData["noticetype"] != "none"))
556 {
557 m_application.SceneManager.ForEachScene(
558 delegate(Scene scene)
429 { 559 {
430 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); 560 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
431 if (dialogModule != null) 561 if (dialogModule != null)
432 dialogModule.SendGeneralAlert(message); 562 dialogModule.SendGeneralAlert(message);
433 }); 563 });
564 }
565 }
434 566
435 // Perform shutdown 567 // Perform shutdown
436 System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing 568 System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing
@@ -1489,7 +1621,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1489 } 1621 }
1490 1622
1491 IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>(); 1623 IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
1492 Dictionary<string, object> archiveOptions = new Dictionary<string,object>(); 1624 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
1493 if (mergeOar) archiveOptions.Add("merge", null); 1625 if (mergeOar) archiveOptions.Add("merge", null);
1494 if (skipAssets) archiveOptions.Add("skipAssets", null); 1626 if (skipAssets) archiveOptions.Add("skipAssets", null);
1495 if (archiver != null) 1627 if (archiver != null)
@@ -1749,21 +1881,31 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1749 1881
1750 private void XmlRpcRegionQueryMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) 1882 private void XmlRpcRegionQueryMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
1751 { 1883 {
1752 m_log.Info("[RADMIN]: Received Query XML Administrator Request");
1753
1754 Hashtable responseData = (Hashtable)response.Value; 1884 Hashtable responseData = (Hashtable)response.Value;
1755 Hashtable requestData = (Hashtable)request.Params[0]; 1885 Hashtable requestData = (Hashtable)request.Params[0];
1756 1886
1887 int flags = 0;
1888 string text = String.Empty;
1889 int health = 0;
1890 responseData["success"] = true;
1891
1757 CheckRegionParams(requestData, responseData); 1892 CheckRegionParams(requestData, responseData);
1758 1893
1759 Scene scene = null; 1894 Scene scene = null;
1760 GetSceneFromRegionParams(requestData, responseData, out scene); 1895 try
1761 1896 {
1762 int health = scene.GetHealth(); 1897 GetSceneFromRegionParams(requestData, responseData, out scene);
1763 responseData["health"] = health; 1898 health = scene.GetHealth(out flags, out text);
1899 }
1900 catch (Exception e)
1901 {
1902 responseData["error"] = null;
1903 }
1764 1904
1765 responseData["success"] = true; 1905 responseData["success"] = true;
1766 m_log.Info("[RADMIN]: Query XML Administrator Request complete"); 1906 responseData["health"] = health;
1907 responseData["flags"] = flags;
1908 responseData["message"] = text;
1767 } 1909 }
1768 1910
1769 private void XmlRpcConsoleCommandMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) 1911 private void XmlRpcConsoleCommandMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
@@ -2068,55 +2210,97 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2068 responseData["success"] = true; 2210 responseData["success"] = true;
2069 } 2211 }
2070 2212
2071 private void XmlRpcResetLand(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) 2213 private void XmlRpcRefreshSearch(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
2072 { 2214 {
2073 Hashtable requestData = (Hashtable)request.Params[0]; 2215 m_log.Info("[RADMIN]: Received Refresh Search Request");
2216
2074 Hashtable responseData = (Hashtable)response.Value; 2217 Hashtable responseData = (Hashtable)response.Value;
2218 Hashtable requestData = (Hashtable)request.Params[0];
2219
2220 CheckRegionParams(requestData, responseData);
2075 2221
2076 string musicURL = string.Empty; 2222 Scene scene = null;
2077 UUID groupID = UUID.Zero; 2223 GetSceneFromRegionParams(requestData, responseData, out scene);
2078 uint flags = 0;
2079 bool set_group = false, set_music = false, set_flags = false;
2080 2224
2081 if (requestData.Contains("group") && requestData["group"] != null) 2225 ISearchModule searchModule = scene.RequestModuleInterface<ISearchModule>();
2082 set_group = UUID.TryParse(requestData["group"].ToString(), out groupID); 2226 if (searchModule != null)
2083 if (requestData.Contains("music") && requestData["music"] != null)
2084 { 2227 {
2085 musicURL = requestData["music"].ToString(); 2228 searchModule.Refresh();
2086 set_music = true; 2229 responseData["success"] = true;
2087 } 2230 }
2088 if (requestData.Contains("flags") && requestData["flags"] != null) 2231 else
2089 set_flags = UInt32.TryParse(requestData["flags"].ToString(), out flags); 2232 {
2233 responseData["success"] = false;
2234 }
2235
2236 m_log.Info("[RADMIN]: Refresh Search Request complete");
2237 }
2238
2239 private void XmlRpcRefreshMap(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
2240 {
2241 m_log.Info("[RADMIN]: Received Refresh Map Request");
2242
2243 Hashtable responseData = (Hashtable)response.Value;
2244 Hashtable requestData = (Hashtable)request.Params[0];
2090 2245
2091 m_log.InfoFormat("[RADMIN]: Received Reset Land Request group={0} musicURL={1} flags={2}", 2246 CheckRegionParams(requestData, responseData);
2092 (set_group ? groupID.ToString() : "unchanged"),
2093 (set_music ? musicURL : "unchanged"),
2094 (set_flags ? flags.ToString() : "unchanged"));
2095 2247
2096 m_application.SceneManager.ForEachScene(delegate(Scene s) 2248 Scene scene = null;
2249 GetSceneFromRegionParams(requestData, responseData, out scene);
2250
2251 IMapImageUploadModule mapTileModule = scene.RequestModuleInterface<IMapImageUploadModule>();
2252 if (mapTileModule != null)
2097 { 2253 {
2098 List<ILandObject> parcels = s.LandChannel.AllParcels(); 2254 Util.FireAndForget((x) =>
2099 foreach (ILandObject p in parcels)
2100 { 2255 {
2101 if (set_music) 2256 mapTileModule.UploadMapTile(scene);
2102 p.LandData.MusicURL = musicURL; 2257 });
2258 responseData["success"] = true;
2259 }
2260 else
2261 {
2262 responseData["success"] = false;
2263 }
2103 2264
2104 if (set_group) 2265 m_log.Info("[RADMIN]: Refresh Map Request complete");
2105 p.LandData.GroupID = groupID; 2266 }
2106 2267
2107 if (set_flags) 2268 private void XmlRpcGetOpenSimVersion(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
2108 p.LandData.Flags = flags; 2269 {
2270 m_log.Info("[RADMIN]: Received Get OpenSim Version Request");
2109 2271
2110 s.LandChannel.UpdateLandObject(p.LandData.LocalID, p.LandData); 2272 Hashtable responseData = (Hashtable)response.Value;
2111 }
2112 }
2113 );
2114 2273
2274 responseData["version"] = m_openSimVersion;
2115 responseData["success"] = true; 2275 responseData["success"] = true;
2116 2276
2117 m_log.Info("[RADMIN]: Reset Land Request complete"); 2277 m_log.Info("[RADMIN]: Get OpenSim Version Request complete");
2118 } 2278 }
2119 2279
2280 private void XmlRpcGetAgentCount(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
2281 {
2282 m_log.Info("[RADMIN]: Received Get Agent Count Request");
2283
2284 Hashtable responseData = (Hashtable)response.Value;
2285 Hashtable requestData = (Hashtable)request.Params[0];
2286
2287 CheckRegionParams(requestData, responseData);
2288
2289 Scene scene = null;
2290 GetSceneFromRegionParams(requestData, responseData, out scene);
2291
2292 if (scene == null)
2293 {
2294 responseData["success"] = false;
2295 }
2296 else
2297 {
2298 responseData["count"] = scene.GetRootAgentCount();
2299 responseData["success"] = true;
2300 }
2301
2302 m_log.Info("[RADMIN]: Get Agent Count Request complete");
2303 }
2120 2304
2121 /// <summary> 2305 /// <summary>
2122 /// Parse a float with the given parameter name from a request data hash table. 2306 /// Parse a float with the given parameter name from a request data hash table.
@@ -2823,7 +3007,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2823 /// </summary> 3007 /// </summary>
2824 private void ApplyNextOwnerPermissions(InventoryItemBase item) 3008 private void ApplyNextOwnerPermissions(InventoryItemBase item)
2825 { 3009 {
2826 if (item.InvType == (int)InventoryType.Object) 3010 if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
2827 { 3011 {
2828 uint perms = item.CurrentPermissions; 3012 uint perms = item.CurrentPermissions;
2829 PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms); 3013 PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms);