aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs246
1 files changed, 123 insertions, 123 deletions
diff --git a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs
index a9a6a74..6f68025 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs
@@ -1,123 +1,123 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Net; 4using System.Net;
5using System.Reflection; 5using System.Reflection;
6using System.Text; 6using System.Text;
7using log4net; 7using log4net;
8using Nini.Config; 8using Nini.Config;
9using Nwc.XmlRpc; 9using Nwc.XmlRpc;
10using OpenMetaverse; 10using OpenMetaverse;
11using OpenSim.Framework; 11using OpenSim.Framework;
12using OpenSim.Framework.Communications; 12using OpenSim.Framework.Communications;
13using OpenSim.Region.Framework.Interfaces; 13using OpenSim.Region.Framework.Interfaces;
14using OpenSim.Region.Framework.Scenes; 14using OpenSim.Region.Framework.Scenes;
15 15
16namespace OpenSim.Region.CoreModules.InterGrid 16namespace OpenSim.Region.CoreModules.InterGrid
17{ 17{
18 public class OGSRadmin : IRegionModule 18 public class OGSRadmin : IRegionModule
19 { 19 {
20 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 20 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
21 private readonly List<Scene> m_scenes = new List<Scene>(); 21 private readonly List<Scene> m_scenes = new List<Scene>();
22 private CommunicationsManager m_com; 22 private CommunicationsManager m_com;
23 private IConfigSource m_settings; 23 private IConfigSource m_settings;
24 24
25 #region Implementation of IRegionModuleBase 25 #region Implementation of IRegionModuleBase
26 26
27 public string Name 27 public string Name
28 { 28 {
29 get { return "OGS Supporting RAdmin"; } 29 get { return "OGS Supporting RAdmin"; }
30 } 30 }
31 31
32 32
33 public void Initialise(IConfigSource source) 33 public void Initialise(IConfigSource source)
34 { 34 {
35 m_settings = source; 35 m_settings = source;
36 } 36 }
37 37
38 public void Close() 38 public void Close()
39 { 39 {
40 40
41 } 41 }
42 42
43 public void AddRegion(Scene scene) 43 public void AddRegion(Scene scene)
44 { 44 {
45 lock(m_scenes) 45 lock(m_scenes)
46 m_scenes.Add(scene); 46 m_scenes.Add(scene);
47 } 47 }
48 48
49 public void RemoveRegion(Scene scene) 49 public void RemoveRegion(Scene scene)
50 { 50 {
51 lock (m_scenes) 51 lock (m_scenes)
52 m_scenes.Remove(scene); 52 m_scenes.Remove(scene);
53 } 53 }
54 54
55 public void RegionLoaded(Scene scene) 55 public void RegionLoaded(Scene scene)
56 { 56 {
57 57
58 } 58 }
59 59
60 public void PostInitialise() 60 public void PostInitialise()
61 { 61 {
62 if (m_settings.Configs["Startup"].GetBoolean("gridmode", false)) 62 if (m_settings.Configs["Startup"].GetBoolean("gridmode", false))
63 { 63 {
64 m_com = m_scenes[0].CommsManager; 64 m_com = m_scenes[0].CommsManager;
65 m_com.HttpServer.AddXmlRPCHandler("grid_message", GridWideMessage); 65 m_com.HttpServer.AddXmlRPCHandler("grid_message", GridWideMessage);
66 } 66 }
67 } 67 }
68 68
69 #endregion 69 #endregion
70 70
71 #region IRegionModule 71 #region IRegionModule
72 72
73 public void Initialise(Scene scene, IConfigSource source) 73 public void Initialise(Scene scene, IConfigSource source)
74 { 74 {
75 m_settings = source; 75 m_settings = source;
76 76
77 lock (m_scenes) 77 lock (m_scenes)
78 m_scenes.Add(scene); 78 m_scenes.Add(scene);
79 } 79 }
80 80
81 public bool IsSharedModule 81 public bool IsSharedModule
82 { 82 {
83 get { return true; } 83 get { return true; }
84 } 84 }
85 85
86 #endregion 86 #endregion
87 87
88 public XmlRpcResponse GridWideMessage(XmlRpcRequest req, IPEndPoint remoteClient) 88 public XmlRpcResponse GridWideMessage(XmlRpcRequest req, IPEndPoint remoteClient)
89 { 89 {
90 XmlRpcResponse response = new XmlRpcResponse(); 90 XmlRpcResponse response = new XmlRpcResponse();
91 Hashtable responseData = new Hashtable(); 91 Hashtable responseData = new Hashtable();
92 92
93 Hashtable requestData = (Hashtable)req.Params[0]; 93 Hashtable requestData = (Hashtable)req.Params[0];
94 94
95 if ((!requestData.Contains("password") || (string)requestData["password"] != m_com.NetworkServersInfo.GridRecvKey)) 95 if ((!requestData.Contains("password") || (string)requestData["password"] != m_com.NetworkServersInfo.GridRecvKey))
96 { 96 {
97 responseData["accepted"] = false; 97 responseData["accepted"] = false;
98 responseData["success"] = false; 98 responseData["success"] = false;
99 responseData["error"] = "Invalid Key"; 99 responseData["error"] = "Invalid Key";
100 response.Value = responseData; 100 response.Value = responseData;
101 return response; 101 return response;
102 } 102 }
103 103
104 string message = (string)requestData["message"]; 104 string message = (string)requestData["message"];
105 string user = (string)requestData["user"]; 105 string user = (string)requestData["user"];
106 m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); 106 m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
107 107
108 lock(m_scenes) 108 lock(m_scenes)
109 foreach (Scene scene in m_scenes) 109 foreach (Scene scene in m_scenes)
110 { 110 {
111 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); 111 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
112 if (dialogModule != null) 112 if (dialogModule != null)
113 dialogModule.SendNotificationToUsersInRegion(UUID.Random(), user, message); 113 dialogModule.SendNotificationToUsersInRegion(UUID.Random(), user, message);
114 } 114 }
115 115
116 responseData["accepted"] = true; 116 responseData["accepted"] = true;
117 responseData["success"] = true; 117 responseData["success"] = true;
118 response.Value = responseData; 118 response.Value = responseData;
119 119
120 return response; 120 return response;
121 } 121 }
122 } 122 }
123} 123}