diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs | 150 |
1 files changed, 0 insertions, 150 deletions
diff --git a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs deleted file mode 100644 index 2cc0a07..0000000 --- a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs +++ /dev/null | |||
@@ -1,150 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Text; | ||
34 | using log4net; | ||
35 | using Nini.Config; | ||
36 | using Nwc.XmlRpc; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Communications; | ||
40 | using OpenSim.Framework.Servers; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | |||
44 | namespace OpenSim.Region.CoreModules.InterGrid | ||
45 | { | ||
46 | public class OGSRadmin : IRegionModule | ||
47 | { | ||
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | private readonly List<Scene> m_scenes = new List<Scene>(); | ||
50 | private IConfigSource m_settings; | ||
51 | |||
52 | #region Implementation of IRegionModuleBase | ||
53 | |||
54 | public string Name | ||
55 | { | ||
56 | get { return "OGS Supporting RAdmin"; } | ||
57 | } | ||
58 | |||
59 | |||
60 | public void Initialise(IConfigSource source) | ||
61 | { | ||
62 | m_settings = source; | ||
63 | } | ||
64 | |||
65 | public void Close() | ||
66 | { | ||
67 | |||
68 | } | ||
69 | |||
70 | public void AddRegion(Scene scene) | ||
71 | { | ||
72 | lock (m_scenes) | ||
73 | m_scenes.Add(scene); | ||
74 | } | ||
75 | |||
76 | public void RemoveRegion(Scene scene) | ||
77 | { | ||
78 | lock (m_scenes) | ||
79 | m_scenes.Remove(scene); | ||
80 | } | ||
81 | |||
82 | public void RegionLoaded(Scene scene) | ||
83 | { | ||
84 | |||
85 | } | ||
86 | |||
87 | public void PostInitialise() | ||
88 | { | ||
89 | if (m_settings.Configs["Startup"].GetBoolean("gridmode", false)) | ||
90 | { | ||
91 | MainServer.Instance.AddXmlRPCHandler("grid_message", GridWideMessage); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | #endregion | ||
96 | |||
97 | #region IRegionModule | ||
98 | |||
99 | public void Initialise(Scene scene, IConfigSource source) | ||
100 | { | ||
101 | m_settings = source; | ||
102 | |||
103 | lock (m_scenes) | ||
104 | m_scenes.Add(scene); | ||
105 | } | ||
106 | |||
107 | public bool IsSharedModule | ||
108 | { | ||
109 | get { return true; } | ||
110 | } | ||
111 | |||
112 | #endregion | ||
113 | |||
114 | public XmlRpcResponse GridWideMessage(XmlRpcRequest req, IPEndPoint remoteClient) | ||
115 | { | ||
116 | XmlRpcResponse response = new XmlRpcResponse(); | ||
117 | Hashtable responseData = new Hashtable(); | ||
118 | |||
119 | Hashtable requestData = (Hashtable)req.Params[0]; | ||
120 | |||
121 | // REFACTORING PROBLEM. This authorization needs to be replaced with some other | ||
122 | //if ((!requestData.Contains("password") || (string)requestData["password"] != m_com.NetworkServersInfo.GridRecvKey)) | ||
123 | //{ | ||
124 | // responseData["accepted"] = false; | ||
125 | // responseData["success"] = false; | ||
126 | // responseData["error"] = "Invalid Key"; | ||
127 | // response.Value = responseData; | ||
128 | // return response; | ||
129 | //} | ||
130 | |||
131 | string message = (string)requestData["message"]; | ||
132 | string user = (string)requestData["user"]; | ||
133 | m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); | ||
134 | |||
135 | lock (m_scenes) | ||
136 | foreach (Scene scene in m_scenes) | ||
137 | { | ||
138 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
139 | if (dialogModule != null) | ||
140 | dialogModule.SendNotificationToUsersInRegion(UUID.Random(), user, message); | ||
141 | } | ||
142 | |||
143 | responseData["accepted"] = true; | ||
144 | responseData["success"] = true; | ||
145 | response.Value = responseData; | ||
146 | |||
147 | return response; | ||
148 | } | ||
149 | } | ||
150 | } | ||