diff options
author | Adam Frisby | 2009-05-28 18:27:08 +0000 |
---|---|---|
committer | Adam Frisby | 2009-05-28 18:27:08 +0000 |
commit | 940b5567a0103847ebe4a48d9bc766a4f40ed415 (patch) | |
tree | e52f96d58c34f288cc5be8c2f0d16bab4e9ac067 | |
parent | * May make the terrain flatten brush behave like Second Life(tm)'s client exp... (diff) | |
download | opensim-SC_OLD-940b5567a0103847ebe4a48d9bc766a4f40ed415.zip opensim-SC_OLD-940b5567a0103847ebe4a48d9bc766a4f40ed415.tar.gz opensim-SC_OLD-940b5567a0103847ebe4a48d9bc766a4f40ed415.tar.bz2 opensim-SC_OLD-940b5567a0103847ebe4a48d9bc766a4f40ed415.tar.xz |
* Adds OGS RAdmin class. Adds primitive remote admin functions for gridservers to perform on region servers. Used for grid-wide announcements, etc.
-rw-r--r-- | OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs new file mode 100644 index 0000000..98710c6 --- /dev/null +++ b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs | |||
@@ -0,0 +1,102 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Net; | ||
5 | using System.Reflection; | ||
6 | using System.Text; | ||
7 | using log4net; | ||
8 | using Nini.Config; | ||
9 | using Nwc.XmlRpc; | ||
10 | using OpenSim.Framework.Communications; | ||
11 | using OpenSim.Region.Framework.Interfaces; | ||
12 | using OpenSim.Region.Framework.Scenes; | ||
13 | |||
14 | namespace OpenSim.Region.CoreModules.InterGrid | ||
15 | { | ||
16 | public class OGSRadmin : ISharedRegionModule | ||
17 | { | ||
18 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
19 | private readonly List<Scene> m_scenes = new List<Scene>(); | ||
20 | private CommunicationsManager m_com; | ||
21 | private IConfigSource m_settings; | ||
22 | |||
23 | #region Implementation of IRegionModuleBase | ||
24 | |||
25 | public string Name | ||
26 | { | ||
27 | get { return "OGS Supporting RAdmin"; } | ||
28 | } | ||
29 | |||
30 | public void Initialise(IConfigSource source) | ||
31 | { | ||
32 | m_settings = source; | ||
33 | } | ||
34 | |||
35 | public void Close() | ||
36 | { | ||
37 | |||
38 | } | ||
39 | |||
40 | public void AddRegion(Scene scene) | ||
41 | { | ||
42 | lock(m_scenes) | ||
43 | m_scenes.Add(scene); | ||
44 | } | ||
45 | |||
46 | public void RemoveRegion(Scene scene) | ||
47 | { | ||
48 | lock (m_scenes) | ||
49 | m_scenes.Remove(scene); | ||
50 | } | ||
51 | |||
52 | public void RegionLoaded(Scene scene) | ||
53 | { | ||
54 | |||
55 | } | ||
56 | |||
57 | public void PostInitialise() | ||
58 | { | ||
59 | if (m_settings.Configs["Startup"].GetBoolean("gridmode", false)) | ||
60 | { | ||
61 | m_com = m_scenes[0].CommsManager; | ||
62 | m_com.HttpServer.AddXmlRPCHandler("grid_message", GridWideMessage); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | #endregion | ||
67 | |||
68 | public XmlRpcResponse GridWideMessage(XmlRpcRequest req, IPEndPoint remoteClient) | ||
69 | { | ||
70 | XmlRpcResponse response = new XmlRpcResponse(); | ||
71 | Hashtable responseData = new Hashtable(); | ||
72 | |||
73 | Hashtable requestData = (Hashtable)req.Params[0]; | ||
74 | |||
75 | if ((!requestData.Contains("password") || (string)requestData["password"] != m_com.NetworkServersInfo.GridRecvKey)) | ||
76 | { | ||
77 | responseData["accepted"] = false; | ||
78 | responseData["success"] = false; | ||
79 | responseData["error"] = "Invalid Key"; | ||
80 | response.Value = responseData; | ||
81 | return response; | ||
82 | } | ||
83 | |||
84 | string message = (string)requestData["message"]; | ||
85 | m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); | ||
86 | |||
87 | lock(m_scenes) | ||
88 | foreach (Scene scene in m_scenes) | ||
89 | { | ||
90 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
91 | if (dialogModule != null) | ||
92 | dialogModule.SendGeneralAlert(message); | ||
93 | } | ||
94 | |||
95 | responseData["accepted"] = true; | ||
96 | responseData["success"] = true; | ||
97 | response.Value = responseData; | ||
98 | |||
99 | return response; | ||
100 | } | ||
101 | } | ||
102 | } | ||