diff options
author | BlueWall | 2013-01-23 08:16:18 -0500 |
---|---|---|
committer | BlueWall | 2013-01-23 08:16:18 -0500 |
commit | 2841ed05cf003fef8dc820d0327c1fcce0d76e93 (patch) | |
tree | 2d3647e4ffad8220e5b30fbdfbf7b3a36be0597c /OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs | |
parent | Add additional return status (diff) | |
parent | BulletSim: Tweeks to vehicle motion. (diff) | |
download | opensim-SC-2841ed05cf003fef8dc820d0327c1fcce0d76e93.zip opensim-SC-2841ed05cf003fef8dc820d0327c1fcce0d76e93.tar.gz opensim-SC-2841ed05cf003fef8dc820d0327c1fcce0d76e93.tar.bz2 opensim-SC-2841ed05cf003fef8dc820d0327c1fcce0d76e93.tar.xz |
Merge branch 'master' of /home/opensim/var/repo/opensim
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs index 2e1d03d..351dbfe 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCBridgeModule.cs | |||
@@ -46,18 +46,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | internal static bool m_pluginEnabled = false; | 49 | internal static bool Enabled = false; |
50 | internal static IConfig m_config = null; | 50 | internal static IConfig m_config = null; |
51 | 51 | ||
52 | internal static List<ChannelState> m_channels = new List<ChannelState>(); | 52 | internal static List<ChannelState> m_channels = new List<ChannelState>(); |
53 | internal static List<RegionState> m_regions = new List<RegionState>(); | 53 | internal static List<RegionState> m_regions = new List<RegionState>(); |
54 | 54 | ||
55 | internal static string m_password = String.Empty; | 55 | internal static string m_password = String.Empty; |
56 | internal RegionState m_region = null; | 56 | internal RegionState m_region = null; |
57 | 57 | ||
58 | #region INonSharedRegionModule Members | 58 | #region INonSharedRegionModule Members |
59 | 59 | ||
60 | public Type ReplaceableInterface | 60 | public Type ReplaceableInterface |
61 | { | 61 | { |
62 | get { return null; } | 62 | get { return null; } |
63 | } | 63 | } |
@@ -72,13 +72,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
72 | m_config = config.Configs["IRC"]; | 72 | m_config = config.Configs["IRC"]; |
73 | if (m_config == null) | 73 | if (m_config == null) |
74 | { | 74 | { |
75 | // m_log.InfoFormat("[IRC-Bridge] module not configured"); | 75 | // m_log.InfoFormat("[IRC-Bridge] module not configured"); |
76 | return; | 76 | return; |
77 | } | 77 | } |
78 | 78 | ||
79 | if (!m_config.GetBoolean("enabled", false)) | 79 | if (!m_config.GetBoolean("enabled", false)) |
80 | { | 80 | { |
81 | // m_log.InfoFormat("[IRC-Bridge] module disabled in configuration"); | 81 | // m_log.InfoFormat("[IRC-Bridge] module disabled in configuration"); |
82 | return; | 82 | return; |
83 | } | 83 | } |
84 | 84 | ||
@@ -87,19 +87,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
87 | m_password = config.Configs["RemoteAdmin"].GetString("access_password", m_password); | 87 | m_password = config.Configs["RemoteAdmin"].GetString("access_password", m_password); |
88 | } | 88 | } |
89 | 89 | ||
90 | m_pluginEnabled = true; | 90 | Enabled = true; |
91 | m_log.InfoFormat("[IRC-Bridge]: Module enabled"); | 91 | |
92 | m_log.InfoFormat("[IRC-Bridge]: Module is enabled"); | ||
92 | } | 93 | } |
93 | 94 | ||
94 | public void AddRegion(Scene scene) | 95 | public void AddRegion(Scene scene) |
95 | { | 96 | { |
96 | if (m_pluginEnabled) | 97 | if (Enabled) |
97 | { | 98 | { |
98 | try | 99 | try |
99 | { | 100 | { |
100 | m_log.InfoFormat("[IRC-Bridge] Connecting region {0}", scene.RegionInfo.RegionName); | 101 | m_log.InfoFormat("[IRC-Bridge] Connecting region {0}", scene.RegionInfo.RegionName); |
102 | |||
101 | if (!String.IsNullOrEmpty(m_password)) | 103 | if (!String.IsNullOrEmpty(m_password)) |
102 | MainServer.Instance.AddXmlRPCHandler("irc_admin", XmlRpcAdminMethod, false); | 104 | MainServer.Instance.AddXmlRPCHandler("irc_admin", XmlRpcAdminMethod, false); |
105 | |||
103 | m_region = new RegionState(scene, m_config); | 106 | m_region = new RegionState(scene, m_config); |
104 | lock (m_regions) m_regions.Add(m_region); | 107 | lock (m_regions) m_regions.Add(m_region); |
105 | m_region.Open(); | 108 | m_region.Open(); |
@@ -123,7 +126,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
123 | 126 | ||
124 | public void RemoveRegion(Scene scene) | 127 | public void RemoveRegion(Scene scene) |
125 | { | 128 | { |
126 | if (!m_pluginEnabled) | 129 | if (!Enabled) |
127 | return; | 130 | return; |
128 | 131 | ||
129 | if (m_region == null) | 132 | if (m_region == null) |
@@ -150,12 +153,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
150 | m_log.Debug("[IRC-Bridge]: XML RPC Admin Entry"); | 153 | m_log.Debug("[IRC-Bridge]: XML RPC Admin Entry"); |
151 | 154 | ||
152 | XmlRpcResponse response = new XmlRpcResponse(); | 155 | XmlRpcResponse response = new XmlRpcResponse(); |
153 | Hashtable responseData = new Hashtable(); | 156 | Hashtable responseData = new Hashtable(); |
154 | 157 | ||
155 | try | 158 | try |
156 | { | 159 | { |
157 | Hashtable requestData = (Hashtable)request.Params[0]; | 160 | Hashtable requestData = (Hashtable)request.Params[0]; |
158 | bool found = false; | 161 | bool found = false; |
159 | string region = String.Empty; | 162 | string region = String.Empty; |
160 | 163 | ||
161 | if (m_password != String.Empty) | 164 | if (m_password != String.Empty) |
@@ -169,18 +172,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
169 | if (!requestData.ContainsKey("region")) | 172 | if (!requestData.ContainsKey("region")) |
170 | throw new Exception("No region name specified"); | 173 | throw new Exception("No region name specified"); |
171 | region = (string)requestData["region"]; | 174 | region = (string)requestData["region"]; |
172 | 175 | ||
173 | foreach (RegionState rs in m_regions) | 176 | foreach (RegionState rs in m_regions) |
174 | { | 177 | { |
175 | if (rs.Region == region) | 178 | if (rs.Region == region) |
176 | { | 179 | { |
177 | responseData["server"] = rs.cs.Server; | 180 | responseData["server"] = rs.cs.Server; |
178 | responseData["port"] = (int)rs.cs.Port; | 181 | responseData["port"] = (int)rs.cs.Port; |
179 | responseData["user"] = rs.cs.User; | 182 | responseData["user"] = rs.cs.User; |
180 | responseData["channel"] = rs.cs.IrcChannel; | 183 | responseData["channel"] = rs.cs.IrcChannel; |
181 | responseData["enabled"] = rs.cs.irc.Enabled; | 184 | responseData["enabled"] = rs.cs.irc.Enabled; |
182 | responseData["connected"] = rs.cs.irc.Connected; | 185 | responseData["connected"] = rs.cs.irc.Connected; |
183 | responseData["nickname"] = rs.cs.irc.Nick; | 186 | responseData["nickname"] = rs.cs.irc.Nick; |
184 | found = true; | 187 | found = true; |
185 | break; | 188 | break; |
186 | } | 189 | } |
@@ -195,7 +198,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
195 | m_log.ErrorFormat("[IRC-Bridge] XML RPC Admin request failed : {0}", e.Message); | 198 | m_log.ErrorFormat("[IRC-Bridge] XML RPC Admin request failed : {0}", e.Message); |
196 | 199 | ||
197 | responseData["success"] = "false"; | 200 | responseData["success"] = "false"; |
198 | responseData["error"] = e.Message; | 201 | responseData["error"] = e.Message; |
199 | } | 202 | } |
200 | finally | 203 | finally |
201 | { | 204 | { |