diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
17 files changed, 328 insertions, 317 deletions
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs index e414713..54d5ad8 100644 --- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs | |||
@@ -26,11 +26,10 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using OpenSim.Framework.Interfaces; | 29 | using Nini.Config; |
30 | using OpenSim.Framework; | ||
30 | using OpenSim.Region.Environment.Interfaces; | 31 | using OpenSim.Region.Environment.Interfaces; |
31 | using OpenSim.Region.Environment.Scenes; | 32 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Framework; | ||
33 | using Nini.Config; | ||
34 | 33 | ||
35 | namespace OpenSim.Region.Environment.Modules | 34 | namespace OpenSim.Region.Environment.Modules |
36 | { | 35 | { |
@@ -70,4 +69,4 @@ namespace OpenSim.Region.Environment.Modules | |||
70 | { | 69 | { |
71 | } | 70 | } |
72 | } | 71 | } |
73 | } | 72 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs index 456d838..4bb0638 100644 --- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs | |||
@@ -1,6 +1,3 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | 1 | using libsecondlife; |
5 | using Nini.Config; | 2 | using Nini.Config; |
6 | using OpenSim.Framework; | 3 | using OpenSim.Framework; |
@@ -11,7 +8,8 @@ namespace OpenSim.Region.Environment.Modules | |||
11 | { | 8 | { |
12 | public class AvatarFactoryModule : IAvatarFactory | 9 | public class AvatarFactoryModule : IAvatarFactory |
13 | { | 10 | { |
14 | public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams) | 11 | public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, |
12 | out byte[] visualParams) | ||
15 | { | 13 | { |
16 | GetDefaultAvatarAppearance(out wearables, out visualParams); | 14 | GetDefaultAvatarAppearance(out wearables, out visualParams); |
17 | return true; | 15 | return true; |
@@ -51,7 +49,4 @@ namespace OpenSim.Region.Environment.Modules | |||
51 | wearables = AvatarWearable.DefaultWearables; | 49 | wearables = AvatarWearable.DefaultWearables; |
52 | } | 50 | } |
53 | } | 51 | } |
54 | 52 | } \ No newline at end of file | |
55 | |||
56 | |||
57 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs index 802655f..1b7e2a4 100644 --- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs | |||
@@ -27,11 +27,10 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using OpenSim.Framework.Interfaces; | 30 | using Nini.Config; |
31 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Environment.Interfaces; | 32 | using OpenSim.Region.Environment.Interfaces; |
32 | using OpenSim.Region.Environment.Scenes; | 33 | using OpenSim.Region.Environment.Scenes; |
33 | using OpenSim.Framework; | ||
34 | using Nini.Config; | ||
35 | 34 | ||
36 | namespace OpenSim.Region.Environment.Modules | 35 | namespace OpenSim.Region.Environment.Modules |
37 | { | 36 | { |
@@ -92,4 +91,4 @@ namespace OpenSim.Region.Environment.Modules | |||
92 | partner); | 91 | partner); |
93 | } | 92 | } |
94 | } | 93 | } |
95 | } | 94 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index bdb8ee5..9d4187a 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -27,13 +27,13 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
30 | using System.IO; | 31 | using System.IO; |
31 | using System.Net.Sockets; | 32 | using System.Net.Sockets; |
32 | using System.Threading; | ||
33 | using System.Collections.Generic; | ||
34 | using System.Text.RegularExpressions; | 33 | using System.Text.RegularExpressions; |
34 | using System.Threading; | ||
35 | using libsecondlife; | 35 | using libsecondlife; |
36 | using OpenSim.Framework.Interfaces; | 36 | using Nini.Config; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Console; | 38 | using OpenSim.Framework.Console; |
39 | using OpenSim.Region.Environment.Interfaces; | 39 | using OpenSim.Region.Environment.Interfaces; |
@@ -54,18 +54,22 @@ namespace OpenSim.Region.Environment.Modules | |||
54 | 54 | ||
55 | public ChatModule() | 55 | public ChatModule() |
56 | { | 56 | { |
57 | m_log = OpenSim.Framework.Console.MainLog.Instance; | 57 | m_log = MainLog.Instance; |
58 | } | 58 | } |
59 | 59 | ||
60 | public void Initialise(Scene scene, Nini.Config.IConfigSource config) | 60 | public void Initialise(Scene scene, IConfigSource config) |
61 | { | 61 | { |
62 | // wrap this in a try block so that defaults will work if | 62 | // wrap this in a try block so that defaults will work if |
63 | // the config file doesn't specify otherwise. | 63 | // the config file doesn't specify otherwise. |
64 | try { | 64 | try |
65 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 65 | { |
66 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | ||
66 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 67 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); |
67 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 68 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); |
68 | } catch (Exception e) {} | 69 | } |
70 | catch (Exception e) | ||
71 | { | ||
72 | } | ||
69 | 73 | ||
70 | if (!m_scenes.Contains(scene)) | 74 | if (!m_scenes.Contains(scene)) |
71 | { | 75 | { |
@@ -73,20 +77,20 @@ namespace OpenSim.Region.Environment.Modules | |||
73 | scene.EventManager.OnNewClient += NewClient; | 77 | scene.EventManager.OnNewClient += NewClient; |
74 | scene.RegisterModuleInterface<ISimChat>(this); | 78 | scene.RegisterModuleInterface<ISimChat>(this); |
75 | } | 79 | } |
76 | 80 | ||
77 | // setup IRC Relay | 81 | // setup IRC Relay |
78 | m_irc = new IRCChatModule(config); | 82 | m_irc = new IRCChatModule(config); |
79 | } | 83 | } |
80 | 84 | ||
81 | public void PostInitialise() | 85 | public void PostInitialise() |
82 | { | 86 | { |
83 | 87 | if (m_irc.Enabled) | |
84 | if (m_irc.Enabled) { | 88 | { |
85 | m_irc.Connect(m_scenes); | 89 | m_irc.Connect(m_scenes); |
86 | } | 90 | } |
87 | } | 91 | } |
88 | 92 | ||
89 | public void Close() | 93 | public void Close() |
90 | { | 94 | { |
91 | m_irc.Close(); | 95 | m_irc.Close(); |
92 | } | 96 | } |
@@ -111,7 +115,7 @@ namespace OpenSim.Region.Environment.Modules | |||
111 | ScenePresence avatar = null; | 115 | ScenePresence avatar = null; |
112 | 116 | ||
113 | //TODO: Move ForEachScenePresence and others into IScene. | 117 | //TODO: Move ForEachScenePresence and others into IScene. |
114 | Scene scene = (Scene)e.Scene; | 118 | Scene scene = (Scene) e.Scene; |
115 | 119 | ||
116 | //TODO: Remove the need for this check | 120 | //TODO: Remove the need for this check |
117 | if (scene == null) | 121 | if (scene == null) |
@@ -119,10 +123,12 @@ namespace OpenSim.Region.Environment.Modules | |||
119 | 123 | ||
120 | // Filled in since it's easier than rewriting right now. | 124 | // Filled in since it's easier than rewriting right now. |
121 | LLVector3 fromPos = e.Position; | 125 | LLVector3 fromPos = e.Position; |
122 | LLVector3 fromRegionPos = e.Position + new LLVector3(e.Scene.RegionInfo.RegionLocX * 256, e.Scene.RegionInfo.RegionLocY * 256, 0); | 126 | LLVector3 fromRegionPos = e.Position + |
127 | new LLVector3(e.Scene.RegionInfo.RegionLocX*256, e.Scene.RegionInfo.RegionLocY*256, | ||
128 | 0); | ||
123 | string fromName = e.From; | 129 | string fromName = e.From; |
124 | string message = e.Message; | 130 | string message = e.Message; |
125 | byte type = (byte)e.Type; | 131 | byte type = (byte) e.Type; |
126 | LLUUID fromAgentID = LLUUID.Zero; | 132 | LLUUID fromAgentID = LLUUID.Zero; |
127 | 133 | ||
128 | if (e.Sender != null) | 134 | if (e.Sender != null) |
@@ -133,7 +139,8 @@ namespace OpenSim.Region.Environment.Modules | |||
133 | if (avatar != null) | 139 | if (avatar != null) |
134 | { | 140 | { |
135 | fromPos = avatar.AbsolutePosition; | 141 | fromPos = avatar.AbsolutePosition; |
136 | fromRegionPos = fromPos + new LLVector3(e.Scene.RegionInfo.RegionLocX * 256, e.Scene.RegionInfo.RegionLocY * 256, 0); | 142 | fromRegionPos = fromPos + |
143 | new LLVector3(e.Scene.RegionInfo.RegionLocX*256, e.Scene.RegionInfo.RegionLocY*256, 0); | ||
137 | fromName = avatar.Firstname + " " + avatar.Lastname; | 144 | fromName = avatar.Firstname + " " + avatar.Lastname; |
138 | fromAgentID = e.Sender.AgentId; | 145 | fromAgentID = e.Sender.AgentId; |
139 | avatar = null; | 146 | avatar = null; |
@@ -159,75 +166,84 @@ namespace OpenSim.Region.Environment.Modules | |||
159 | break; | 166 | break; |
160 | } | 167 | } |
161 | 168 | ||
162 | m_log.Verbose("CHAT", fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " + e.Message); | 169 | m_log.Verbose("CHAT", |
163 | 170 | fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " + | |
164 | if (m_irc.Connected) | 171 | e.Message); |
165 | { | 172 | |
166 | m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); | 173 | if (m_irc.Connected) |
167 | } | 174 | { |
168 | 175 | m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); | |
169 | if (e.Channel == 0) | 176 | } |
170 | { | 177 | |
171 | foreach (Scene m_scene in m_scenes) | 178 | if (e.Channel == 0) |
172 | { | 179 | { |
173 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) | 180 | foreach (Scene m_scene in m_scenes) |
174 | { | 181 | { |
175 | int dis = -100000; | 182 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) |
176 | 183 | { | |
177 | LLVector3 avatarRegionPos = presence.AbsolutePosition + new LLVector3(scene.RegionInfo.RegionLocX * 256, scene.RegionInfo.RegionLocY * 256, 0); | 184 | int dis = -100000; |
178 | dis = Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos)); | 185 | |
179 | 186 | LLVector3 avatarRegionPos = presence.AbsolutePosition + | |
180 | switch (e.Type) | 187 | new LLVector3( |
181 | { | 188 | scene.RegionInfo.RegionLocX*256, |
182 | case ChatTypeEnum.Whisper: | 189 | scene.RegionInfo.RegionLocY*256, |
183 | if (dis < m_whisperdistance) | 190 | 0); |
184 | { | 191 | dis = |
185 | //should change so the message is sent through the avatar rather than direct to the ClientView | 192 | Math.Abs((int) avatarRegionPos.GetDistanceTo(fromRegionPos)); |
186 | presence.ControllingClient.SendChatMessage(message, | 193 | |
187 | type, | 194 | switch (e.Type) |
188 | fromPos, | 195 | { |
189 | fromName, | 196 | case ChatTypeEnum.Whisper: |
190 | fromAgentID); | 197 | if (dis < m_whisperdistance) |
191 | } | 198 | { |
192 | break; | 199 | //should change so the message is sent through the avatar rather than direct to the ClientView |
193 | case ChatTypeEnum.Say: | 200 | presence.ControllingClient.SendChatMessage(message, |
194 | if (dis < m_saydistance) | 201 | type, |
195 | { | 202 | fromPos, |
196 | //Console.WriteLine("sending chat"); | 203 | fromName, |
197 | presence.ControllingClient.SendChatMessage(message, | 204 | fromAgentID); |
198 | type, | 205 | } |
199 | fromPos, | 206 | break; |
200 | fromName, | 207 | case ChatTypeEnum.Say: |
201 | fromAgentID); | 208 | if (dis < m_saydistance) |
202 | } | 209 | { |
203 | break; | 210 | //Console.WriteLine("sending chat"); |
204 | case ChatTypeEnum.Shout: | 211 | presence.ControllingClient.SendChatMessage(message, |
205 | if (dis < m_shoutdistance) | 212 | type, |
206 | { | 213 | fromPos, |
207 | presence.ControllingClient.SendChatMessage(message, | 214 | fromName, |
208 | type, | 215 | fromAgentID); |
209 | fromPos, | 216 | } |
210 | fromName, | 217 | break; |
211 | fromAgentID); | 218 | case ChatTypeEnum.Shout: |
212 | } | 219 | if (dis < m_shoutdistance) |
213 | break; | 220 | { |
214 | 221 | presence.ControllingClient.SendChatMessage(message, | |
215 | case ChatTypeEnum.Broadcast: | 222 | type, |
216 | presence.ControllingClient.SendChatMessage(message, type, | 223 | fromPos, |
217 | fromPos, | 224 | fromName, |
218 | fromName, | 225 | fromAgentID); |
219 | fromAgentID); | 226 | } |
220 | break; | 227 | break; |
221 | default: | 228 | |
222 | break; | 229 | case ChatTypeEnum.Broadcast: |
223 | } | 230 | presence.ControllingClient.SendChatMessage(message, |
224 | }); | 231 | type, |
232 | fromPos, | ||
233 | fromName, | ||
234 | fromAgentID); | ||
235 | break; | ||
236 | default: | ||
237 | break; | ||
238 | } | ||
239 | }); | ||
225 | } | 240 | } |
226 | } | 241 | } |
227 | } | 242 | } |
228 | } | 243 | } |
229 | 244 | ||
230 | class IRCChatModule { | 245 | internal class IRCChatModule |
246 | { | ||
231 | private string m_server = null; | 247 | private string m_server = null; |
232 | private int m_port = 6668; | 248 | private int m_port = 6668; |
233 | private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; | 249 | private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; |
@@ -238,7 +254,7 @@ namespace OpenSim.Region.Environment.Modules | |||
238 | private TcpClient m_tcp; | 254 | private TcpClient m_tcp; |
239 | private StreamWriter m_writer; | 255 | private StreamWriter m_writer; |
240 | private StreamReader m_reader; | 256 | private StreamReader m_reader; |
241 | 257 | ||
242 | private Thread pingSender; | 258 | private Thread pingSender; |
243 | private Thread listener; | 259 | private Thread listener; |
244 | 260 | ||
@@ -248,29 +264,36 @@ namespace OpenSim.Region.Environment.Modules | |||
248 | private List<Scene> m_scenes = null; | 264 | private List<Scene> m_scenes = null; |
249 | private LogBase m_log; | 265 | private LogBase m_log; |
250 | 266 | ||
251 | public IRCChatModule(Nini.Config.IConfigSource config) { | 267 | public IRCChatModule(IConfigSource config) |
268 | { | ||
252 | m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); | 269 | m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); |
253 | m_tcp = null; | 270 | m_tcp = null; |
254 | m_writer = null; | 271 | m_writer = null; |
255 | m_reader = null; | 272 | m_reader = null; |
256 | 273 | ||
257 | try { | 274 | try |
275 | { | ||
258 | m_server = config.Configs["IRC"].GetString("server"); | 276 | m_server = config.Configs["IRC"].GetString("server"); |
259 | m_nick = config.Configs["IRC"].GetString("nick"); | 277 | m_nick = config.Configs["IRC"].GetString("nick"); |
260 | m_channel = config.Configs["IRC"].GetString("channel"); | 278 | m_channel = config.Configs["IRC"].GetString("channel"); |
261 | m_port = config.Configs["IRC"].GetInt("port", m_port); | 279 | m_port = config.Configs["IRC"].GetInt("port", m_port); |
262 | m_user = config.Configs["IRC"].GetString("username", m_user); | 280 | m_user = config.Configs["IRC"].GetString("username", m_user); |
263 | if (m_server != null && m_nick != null && m_channel != null) { | 281 | if (m_server != null && m_nick != null && m_channel != null) |
282 | { | ||
264 | m_enabled = true; | 283 | m_enabled = true; |
265 | } | 284 | } |
266 | } catch (Exception e) { | 285 | } |
286 | catch (Exception e) | ||
287 | { | ||
267 | Console.WriteLine("No IRC config information, skipping IRC bridge configuration"); | 288 | Console.WriteLine("No IRC config information, skipping IRC bridge configuration"); |
268 | } | 289 | } |
269 | m_log = OpenSim.Framework.Console.MainLog.Instance; | 290 | m_log = MainLog.Instance; |
270 | } | 291 | } |
271 | 292 | ||
272 | public bool Connect(List<Scene> scenes) { | 293 | public bool Connect(List<Scene> scenes) |
273 | try { | 294 | { |
295 | try | ||
296 | { | ||
274 | m_scenes = scenes; | 297 | m_scenes = scenes; |
275 | 298 | ||
276 | m_tcp = new TcpClient(m_server, m_port); | 299 | m_tcp = new TcpClient(m_server, m_port); |
@@ -279,13 +302,13 @@ namespace OpenSim.Region.Environment.Modules | |||
279 | m_log.Verbose("IRC", "Connected to " + m_server); | 302 | m_log.Verbose("IRC", "Connected to " + m_server); |
280 | m_reader = new StreamReader(m_stream); | 303 | m_reader = new StreamReader(m_stream); |
281 | m_writer = new StreamWriter(m_stream); | 304 | m_writer = new StreamWriter(m_stream); |
282 | 305 | ||
283 | pingSender = new Thread(new ThreadStart(this.PingRun)); | 306 | pingSender = new Thread(new ThreadStart(PingRun)); |
284 | pingSender.Start(); | 307 | pingSender.Start(); |
285 | 308 | ||
286 | listener = new Thread(new ThreadStart(this.ListenerRun)); | 309 | listener = new Thread(new ThreadStart(ListenerRun)); |
287 | listener.Start(); | 310 | listener.Start(); |
288 | 311 | ||
289 | m_writer.WriteLine(m_user); | 312 | m_writer.WriteLine(m_user); |
290 | m_writer.Flush(); | 313 | m_writer.Flush(); |
291 | m_writer.WriteLine("NICK " + m_nick); | 314 | m_writer.WriteLine("NICK " + m_nick); |
@@ -294,50 +317,61 @@ namespace OpenSim.Region.Environment.Modules | |||
294 | m_writer.Flush(); | 317 | m_writer.Flush(); |
295 | m_log.Verbose("IRC", "Connection fully established"); | 318 | m_log.Verbose("IRC", "Connection fully established"); |
296 | m_connected = true; | 319 | m_connected = true; |
297 | } catch (Exception e) { | 320 | } |
321 | catch (Exception e) | ||
322 | { | ||
298 | Console.WriteLine(e.ToString()); | 323 | Console.WriteLine(e.ToString()); |
299 | } | 324 | } |
300 | return m_connected; | 325 | return m_connected; |
301 | } | 326 | } |
302 | 327 | ||
303 | public bool Enabled | 328 | public bool Enabled |
304 | { | 329 | { |
305 | get { return m_enabled; } | 330 | get { return m_enabled; } |
306 | } | 331 | } |
307 | 332 | ||
308 | public bool Connected | 333 | public bool Connected |
309 | { | 334 | { |
310 | get { return m_connected; } | 335 | get { return m_connected; } |
311 | } | 336 | } |
312 | 337 | ||
313 | public void PrivMsg(string from, string region, string msg) { | 338 | public void PrivMsg(string from, string region, string msg) |
314 | try { | 339 | { |
340 | try | ||
341 | { | ||
315 | m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg); | 342 | m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg); |
316 | m_writer.Flush(); | 343 | m_writer.Flush(); |
317 | } catch (IOException) { | 344 | } |
318 | m_log.Error("IRC","Disconnected from IRC server."); | 345 | catch (IOException) |
346 | { | ||
347 | m_log.Error("IRC", "Disconnected from IRC server."); | ||
319 | listener.Abort(); | 348 | listener.Abort(); |
320 | pingSender.Abort(); | 349 | pingSender.Abort(); |
321 | m_connected = false; | 350 | m_connected = false; |
322 | } | 351 | } |
323 | } | 352 | } |
324 | 353 | ||
325 | private Dictionary<string, string> ExtractMsg(string input) { | 354 | private Dictionary<string, string> ExtractMsg(string input) |
355 | { | ||
326 | Dictionary<string, string> result = null; | 356 | Dictionary<string, string> result = null; |
327 | string regex = @":(?<nick>\w*)!~(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)"; | 357 | string regex = @":(?<nick>\w*)!~(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)"; |
328 | Regex RE = new Regex(regex, RegexOptions.Multiline); | 358 | Regex RE = new Regex(regex, RegexOptions.Multiline); |
329 | MatchCollection matches = RE.Matches(input); | 359 | MatchCollection matches = RE.Matches(input); |
330 | // Get some direct matches $1 $4 is a | 360 | // Get some direct matches $1 $4 is a |
331 | if ((matches.Count == 1) && (matches[0].Groups.Count == 5)) { | 361 | if ((matches.Count == 1) && (matches[0].Groups.Count == 5)) |
362 | { | ||
332 | result = new Dictionary<string, string>(); | 363 | result = new Dictionary<string, string>(); |
333 | result.Add("nick", matches[0].Groups[1].Value); | 364 | result.Add("nick", matches[0].Groups[1].Value); |
334 | result.Add("user", matches[0].Groups[2].Value); | 365 | result.Add("user", matches[0].Groups[2].Value); |
335 | result.Add("channel", matches[0].Groups[3].Value); | 366 | result.Add("channel", matches[0].Groups[3].Value); |
336 | result.Add("msg", matches[0].Groups[4].Value); | 367 | result.Add("msg", matches[0].Groups[4].Value); |
337 | } else { | 368 | } |
369 | else | ||
370 | { | ||
338 | m_log.Verbose("IRC", "Number of matches: " + matches.Count); | 371 | m_log.Verbose("IRC", "Number of matches: " + matches.Count); |
339 | if (matches.Count > 0) { | 372 | if (matches.Count > 0) |
340 | m_log.Verbose("IRC", "Number of groups: " + matches[0].Groups.Count); | 373 | { |
374 | m_log.Verbose("IRC", "Number of groups: " + matches[0].Groups.Count); | ||
341 | } | 375 | } |
342 | } | 376 | } |
343 | return result; | 377 | return result; |
@@ -365,19 +399,20 @@ namespace OpenSim.Region.Environment.Modules | |||
365 | if (inputLine.Contains(m_channel)) | 399 | if (inputLine.Contains(m_channel)) |
366 | { | 400 | { |
367 | Dictionary<string, string> data = ExtractMsg(inputLine); | 401 | Dictionary<string, string> data = ExtractMsg(inputLine); |
368 | if (data != null ) | 402 | if (data != null) |
369 | { | 403 | { |
370 | foreach (Scene m_scene in m_scenes) | 404 | foreach (Scene m_scene in m_scenes) |
371 | { | 405 | { |
372 | m_scene.ForEachScenePresence(delegate(ScenePresence avatar) | 406 | m_scene.ForEachScenePresence(delegate(ScenePresence avatar) |
373 | { | ||
374 | if (!avatar.IsChildAgent) | ||
375 | { | 407 | { |
376 | avatar.ControllingClient.SendChatMessage( | 408 | if (!avatar.IsChildAgent) |
377 | Helpers.StringToField(data["msg"]), 255, pos, data["nick"], | 409 | { |
378 | LLUUID.Zero); | 410 | avatar.ControllingClient.SendChatMessage( |
379 | } | 411 | Helpers.StringToField(data["msg"]), 255, |
380 | }); | 412 | pos, data["nick"], |
413 | LLUUID.Zero); | ||
414 | } | ||
415 | }); | ||
381 | } | 416 | } |
382 | } | 417 | } |
383 | } | 418 | } |
@@ -387,7 +422,8 @@ namespace OpenSim.Region.Environment.Modules | |||
387 | } | 422 | } |
388 | 423 | ||
389 | 424 | ||
390 | public void Close() { | 425 | public void Close() |
426 | { | ||
391 | listener.Abort(); | 427 | listener.Abort(); |
392 | pingSender.Abort(); | 428 | pingSender.Abort(); |
393 | m_writer.Close(); | 429 | m_writer.Close(); |
@@ -395,4 +431,4 @@ namespace OpenSim.Region.Environment.Modules | |||
395 | m_tcp.Close(); | 431 | m_tcp.Close(); |
396 | } | 432 | } |
397 | } | 433 | } |
398 | } | 434 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs index 7c852dc..2bc3db8 100644 --- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs | |||
@@ -29,10 +29,10 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using Nini.Config; | ||
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
33 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
34 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
35 | using Nini.Config; | ||
36 | 36 | ||
37 | namespace OpenSim.Region.Environment.Modules | 37 | namespace OpenSim.Region.Environment.Modules |
38 | { | 38 | { |
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Environment.Modules | |||
99 | if (RenderPlugins.ContainsKey(contentType)) | 99 | if (RenderPlugins.ContainsKey(contentType)) |
100 | { | 100 | { |
101 | //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); | 101 | //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); |
102 | 102 | ||
103 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 103 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); |
104 | updater.SimUUID = simID; | 104 | updater.SimUUID = simID; |
105 | updater.PrimID = primID; | 105 | updater.PrimID = primID; |
@@ -187,4 +187,4 @@ namespace OpenSim.Region.Environment.Modules | |||
187 | } | 187 | } |
188 | } | 188 | } |
189 | } | 189 | } |
190 | } | 190 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/EmailModule.cs b/OpenSim/Region/Environment/Modules/EmailModule.cs index 00ea07a..046a46c 100644 --- a/OpenSim/Region/Environment/Modules/EmailModule.cs +++ b/OpenSim/Region/Environment/Modules/EmailModule.cs | |||
@@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Modules | |||
31 | internal class EmailModule | 31 | internal class EmailModule |
32 | { | 32 | { |
33 | } | 33 | } |
34 | } | 34 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index 9144bee..d9f09f7 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs | |||
@@ -26,9 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using Nini.Config; | ||
29 | using OpenSim.Region.Environment.Interfaces; | 30 | using OpenSim.Region.Environment.Interfaces; |
30 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
31 | using Nini.Config; | ||
32 | 32 | ||
33 | namespace OpenSim.Region.Environment.Modules | 33 | namespace OpenSim.Region.Environment.Modules |
34 | { | 34 | { |
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules | |||
59 | get { return false; } | 59 | get { return false; } |
60 | } | 60 | } |
61 | } | 61 | } |
62 | } | 62 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs index 150f294..50e9a39 100644 --- a/OpenSim/Region/Environment/Modules/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs | |||
@@ -26,9 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using Nini.Config; | ||
29 | using OpenSim.Region.Environment.Interfaces; | 30 | using OpenSim.Region.Environment.Interfaces; |
30 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
31 | using Nini.Config; | ||
32 | 32 | ||
33 | namespace OpenSim.Region.Environment.Modules | 33 | namespace OpenSim.Region.Environment.Modules |
34 | { | 34 | { |
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules | |||
59 | get { return false; } | 59 | get { return false; } |
60 | } | 60 | } |
61 | } | 61 | } |
62 | } | 62 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index 9ac1d76..2ad027a 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs | |||
@@ -27,11 +27,12 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using libsecondlife; | ||
31 | using Nini.Config; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Console; | ||
30 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
31 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Framework.Console; | ||
33 | using OpenSim.Framework; | ||
34 | using Nini.Config; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.Environment.Modules | 37 | namespace OpenSim.Region.Environment.Modules |
37 | { | 38 | { |
@@ -42,7 +43,7 @@ namespace OpenSim.Region.Environment.Modules | |||
42 | 43 | ||
43 | public InstantMessageModule() | 44 | public InstantMessageModule() |
44 | { | 45 | { |
45 | m_log = OpenSim.Framework.Console.MainLog.Instance; | 46 | m_log = MainLog.Instance; |
46 | } | 47 | } |
47 | 48 | ||
48 | public void Initialise(Scene scene, IConfigSource config) | 49 | public void Initialise(Scene scene, IConfigSource config) |
@@ -50,33 +51,34 @@ namespace OpenSim.Region.Environment.Modules | |||
50 | if (!m_scenes.Contains(scene)) | 51 | if (!m_scenes.Contains(scene)) |
51 | { | 52 | { |
52 | m_scenes.Add(scene); | 53 | m_scenes.Add(scene); |
53 | scene.EventManager.OnNewClient += OnNewClient; | 54 | scene.EventManager.OnNewClient += OnNewClient; |
54 | } | 55 | } |
55 | } | 56 | } |
56 | 57 | ||
57 | void OnNewClient(OpenSim.Framework.IClientAPI client) | 58 | private void OnNewClient(IClientAPI client) |
58 | { | 59 | { |
59 | client.OnInstantMessage += OnInstantMessage; | 60 | client.OnInstantMessage += OnInstantMessage; |
60 | } | 61 | } |
61 | 62 | ||
62 | void OnInstantMessage(libsecondlife.LLUUID fromAgentID, | 63 | private void OnInstantMessage(LLUUID fromAgentID, |
63 | libsecondlife.LLUUID fromAgentSession, libsecondlife.LLUUID toAgentID, | 64 | LLUUID fromAgentSession, LLUUID toAgentID, |
64 | libsecondlife.LLUUID imSessionID, uint timestamp, string fromAgentName, | 65 | LLUUID imSessionID, uint timestamp, string fromAgentName, |
65 | string message, byte dialog) | 66 | string message, byte dialog) |
66 | { | 67 | { |
67 | // TODO: Remove after debugging. Privacy implications. | 68 | // TODO: Remove after debugging. Privacy implications. |
68 | m_log.Verbose("IM",fromAgentName + ": " + message); | 69 | m_log.Verbose("IM", fromAgentName + ": " + message); |
69 | 70 | ||
70 | foreach (Scene m_scene in m_scenes) | 71 | foreach (Scene m_scene in m_scenes) |
71 | { | 72 | { |
72 | if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) | 73 | if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) |
73 | { | 74 | { |
74 | // Local Message | 75 | // Local Message |
75 | ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID]; | 76 | ScenePresence user = (ScenePresence) m_scene.Entities[toAgentID]; |
76 | if (!user.IsChildAgent) | 77 | if (!user.IsChildAgent) |
77 | { | 78 | { |
78 | user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, | 79 | user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, |
79 | toAgentID, imSessionID, fromAgentName, dialog, timestamp); | 80 | toAgentID, imSessionID, fromAgentName, dialog, |
81 | timestamp); | ||
80 | } | 82 | } |
81 | // Message sent | 83 | // Message sent |
82 | return; | 84 | return; |
@@ -104,4 +106,4 @@ namespace OpenSim.Region.Environment.Modules | |||
104 | get { return true; } | 106 | get { return true; } |
105 | } | 107 | } |
106 | } | 108 | } |
107 | } | 109 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs index 3f8cd6e..e2ad0d5 100644 --- a/OpenSim/Region/Environment/Modules/InventoryModule.cs +++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs | |||
@@ -26,9 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using Nini.Config; | ||
29 | using OpenSim.Region.Environment.Interfaces; | 30 | using OpenSim.Region.Environment.Interfaces; |
30 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
31 | using Nini.Config; | ||
32 | 32 | ||
33 | namespace OpenSim.Region.Environment.Modules | 33 | namespace OpenSim.Region.Environment.Modules |
34 | { | 34 | { |
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules | |||
59 | get { return false; } | 59 | get { return false; } |
60 | } | 60 | } |
61 | } | 61 | } |
62 | } | 62 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs index 8b8b386..9d10fc3 100644 --- a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs +++ b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs | |||
@@ -1,18 +1,16 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.Net; | ||
5 | using System.IO; | ||
6 | using System.Drawing; | 2 | using System.Drawing; |
3 | using System.IO; | ||
4 | using System.Net; | ||
7 | using libsecondlife; | 5 | using libsecondlife; |
6 | using Nini.Config; | ||
8 | using OpenJPEGNet; | 7 | using OpenJPEGNet; |
9 | using OpenSim.Region.Environment.Scenes; | ||
10 | using OpenSim.Region.Environment.Interfaces; | 8 | using OpenSim.Region.Environment.Interfaces; |
11 | using Nini.Config; | 9 | using OpenSim.Region.Environment.Scenes; |
12 | 10 | ||
13 | namespace OpenSim.Region.Environment.Modules | 11 | namespace OpenSim.Region.Environment.Modules |
14 | { | 12 | { |
15 | public class LoadImageURLModule : IRegionModule , IDynamicTextureRender | 13 | public class LoadImageURLModule : IRegionModule, IDynamicTextureRender |
16 | { | 14 | { |
17 | private string m_name = "LoadImageURL"; | 15 | private string m_name = "LoadImageURL"; |
18 | private IDynamicTextureManager m_textureManager; | 16 | private IDynamicTextureManager m_textureManager; |
@@ -85,25 +83,25 @@ namespace OpenSim.Region.Environment.Modules | |||
85 | private void MakeHttpRequest(string url, LLUUID requestID) | 83 | private void MakeHttpRequest(string url, LLUUID requestID) |
86 | { | 84 | { |
87 | WebRequest request = HttpWebRequest.Create(url); | 85 | WebRequest request = HttpWebRequest.Create(url); |
88 | RequestState state = new RequestState((HttpWebRequest)request, requestID); | 86 | RequestState state = new RequestState((HttpWebRequest) request, requestID); |
89 | IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); | 87 | IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); |
90 | 88 | ||
91 | TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); | 89 | TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); |
92 | state.TimeOfRequest = (int)t.TotalSeconds; | 90 | state.TimeOfRequest = (int) t.TotalSeconds; |
93 | } | 91 | } |
94 | 92 | ||
95 | private void HttpRequestReturn(IAsyncResult result) | 93 | private void HttpRequestReturn(IAsyncResult result) |
96 | { | 94 | { |
97 | RequestState state = (RequestState)result.AsyncState; | 95 | RequestState state = (RequestState) result.AsyncState; |
98 | WebRequest request = (WebRequest)state.Request; | 96 | WebRequest request = (WebRequest) state.Request; |
99 | HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); | 97 | HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result); |
100 | if (response.StatusCode == HttpStatusCode.OK) | 98 | if (response.StatusCode == HttpStatusCode.OK) |
101 | { | 99 | { |
102 | Bitmap image = new Bitmap(response.GetResponseStream()); | 100 | Bitmap image = new Bitmap(response.GetResponseStream()); |
103 | Bitmap resize = new Bitmap(image, new Size(512, 512)); | 101 | Bitmap resize = new Bitmap(image, new Size(512, 512)); |
104 | byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); | 102 | byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); |
105 | 103 | ||
106 | m_textureManager.ReturnData(state.RequestID, imageJ2000); | 104 | m_textureManager.ReturnData(state.RequestID, imageJ2000); |
107 | } | 105 | } |
108 | } | 106 | } |
109 | 107 | ||
@@ -119,6 +117,5 @@ namespace OpenSim.Region.Environment.Modules | |||
119 | RequestID = requestID; | 117 | RequestID = requestID; |
120 | } | 118 | } |
121 | } | 119 | } |
122 | |||
123 | } | 120 | } |
124 | } | 121 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs index 9412089..5ac0b39 100644 --- a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs +++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs | |||
@@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Modules | |||
31 | internal class ScriptsHttpRequests | 31 | internal class ScriptsHttpRequests |
32 | { | 32 | { |
33 | } | 33 | } |
34 | } | 34 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/TeleportModule.cs b/OpenSim/Region/Environment/Modules/TeleportModule.cs index d22a722..77f8db2 100644 --- a/OpenSim/Region/Environment/Modules/TeleportModule.cs +++ b/OpenSim/Region/Environment/Modules/TeleportModule.cs | |||
@@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Modules | |||
31 | internal class TeleportModule | 31 | internal class TeleportModule |
32 | { | 32 | { |
33 | } | 33 | } |
34 | } | 34 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs index 5eeeca6..66c499b 100644 --- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs | |||
@@ -27,14 +27,12 @@ | |||
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Threading; | ||
31 | using libsecondlife; | 30 | using libsecondlife; |
32 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
33 | using OpenSim.Framework.Interfaces; | 32 | using Nini.Config; |
34 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
35 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
36 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
37 | using Nini.Config; | ||
38 | 36 | ||
39 | namespace OpenSim.Region.Environment.Modules | 37 | namespace OpenSim.Region.Environment.Modules |
40 | { | 38 | { |
@@ -42,17 +40,19 @@ namespace OpenSim.Region.Environment.Modules | |||
42 | { | 40 | { |
43 | private Scene m_scene; | 41 | private Scene m_scene; |
44 | private List<Scene> m_scenes = new List<Scene>(); | 42 | private List<Scene> m_scenes = new List<Scene>(); |
45 | private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> ClientRequests = new Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>>(); | 43 | |
44 | private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> ClientRequests = | ||
45 | new Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>>(); | ||
46 | 46 | ||
47 | private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>(); | 47 | private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>(); |
48 | private Dictionary<LLUUID, List<LLUUID>> InProcess = new Dictionary<LLUUID, List<LLUUID>>(); | 48 | private Dictionary<LLUUID, List<LLUUID>> InProcess = new Dictionary<LLUUID, List<LLUUID>>(); |
49 | // private Thread m_thread; | 49 | // private Thread m_thread; |
50 | 50 | ||
51 | public TextureDownloadModule() | 51 | public TextureDownloadModule() |
52 | { | 52 | { |
53 | // m_thread = new Thread(new ThreadStart(ProcessTextureSenders)); | 53 | // m_thread = new Thread(new ThreadStart(ProcessTextureSenders)); |
54 | // m_thread.IsBackground = true; | 54 | // m_thread.IsBackground = true; |
55 | // m_thread.Start(); | 55 | // m_thread.Start(); |
56 | } | 56 | } |
57 | 57 | ||
58 | public void Initialise(Scene scene, IConfigSource config) | 58 | public void Initialise(Scene scene, IConfigSource config) |
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules | |||
85 | 85 | ||
86 | public void NewClient(IClientAPI client) | 86 | public void NewClient(IClientAPI client) |
87 | { | 87 | { |
88 | /* lock (ClientRequests) | 88 | /* lock (ClientRequests) |
89 | { | 89 | { |
90 | if (!ClientRequests.ContainsKey(client.AgentId)) | 90 | if (!ClientRequests.ContainsKey(client.AgentId)) |
91 | { | 91 | { |
@@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Modules | |||
120 | 120 | ||
121 | public void TextureRequest(Object sender, TextureRequestArgs e) | 121 | public void TextureRequest(Object sender, TextureRequestArgs e) |
122 | { | 122 | { |
123 | IClientAPI client = (IClientAPI)sender; | 123 | IClientAPI client = (IClientAPI) sender; |
124 | if (!ClientRequests[client.AgentId].ContainsKey(e.RequestedAssetID)) | 124 | if (!ClientRequests[client.AgentId].ContainsKey(e.RequestedAssetID)) |
125 | { | 125 | { |
126 | lock (ClientRequests) | 126 | lock (ClientRequests) |
@@ -136,15 +136,15 @@ namespace OpenSim.Region.Environment.Modules | |||
136 | { | 136 | { |
137 | while (true) | 137 | while (true) |
138 | { | 138 | { |
139 | TextureSender sender = this.QueueSenders.Dequeue(); | 139 | TextureSender sender = QueueSenders.Dequeue(); |
140 | bool finished = sender.SendTexture(); | 140 | bool finished = sender.SendTexture(); |
141 | if (finished) | 141 | if (finished) |
142 | { | 142 | { |
143 | this.TextureSent(sender); | 143 | TextureSent(sender); |
144 | } | 144 | } |
145 | else | 145 | else |
146 | { | 146 | { |
147 | this.QueueSenders.Enqueue(sender); | 147 | QueueSenders.Enqueue(sender); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | } | 150 | } |
@@ -173,13 +173,13 @@ namespace OpenSim.Region.Environment.Modules | |||
173 | 173 | ||
174 | if (asset.Data.LongLength > 600) | 174 | if (asset.Data.LongLength > 600) |
175 | { | 175 | { |
176 | NumPackets = 2 + (int)(asset.Data.Length - 601) / 1000; | 176 | NumPackets = 2 + (int) (asset.Data.Length - 601)/1000; |
177 | } | 177 | } |
178 | else | 178 | else |
179 | { | 179 | { |
180 | NumPackets = 1; | 180 | NumPackets = 1; |
181 | } | 181 | } |
182 | 182 | ||
183 | PacketCounter = (int) req.PacketNumber; | 183 | PacketCounter = (int) req.PacketNumber; |
184 | } | 184 | } |
185 | 185 | ||
@@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Modules | |||
205 | im.Header.Reliable = false; | 205 | im.Header.Reliable = false; |
206 | im.ImageID.Packets = 1; | 206 | im.ImageID.Packets = 1; |
207 | im.ImageID.ID = m_asset.FullID; | 207 | im.ImageID.ID = m_asset.FullID; |
208 | im.ImageID.Size = (uint)m_asset.Data.Length; | 208 | im.ImageID.Size = (uint) m_asset.Data.Length; |
209 | im.ImageData.Data = m_asset.Data; | 209 | im.ImageData.Data = m_asset.Data; |
210 | im.ImageID.Codec = 2; | 210 | im.ImageID.Codec = 2; |
211 | req.RequestUser.OutPacket(im); | 211 | req.RequestUser.OutPacket(im); |
@@ -215,9 +215,9 @@ namespace OpenSim.Region.Environment.Modules | |||
215 | { | 215 | { |
216 | ImageDataPacket im = new ImageDataPacket(); | 216 | ImageDataPacket im = new ImageDataPacket(); |
217 | im.Header.Reliable = false; | 217 | im.Header.Reliable = false; |
218 | im.ImageID.Packets = (ushort)(NumPackets); | 218 | im.ImageID.Packets = (ushort) (NumPackets); |
219 | im.ImageID.ID = m_asset.FullID; | 219 | im.ImageID.ID = m_asset.FullID; |
220 | im.ImageID.Size = (uint)m_asset.Data.Length; | 220 | im.ImageID.Size = (uint) m_asset.Data.Length; |
221 | im.ImageData.Data = new byte[600]; | 221 | im.ImageData.Data = new byte[600]; |
222 | Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600); | 222 | Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600); |
223 | im.ImageID.Codec = 2; | 223 | im.ImageID.Codec = 2; |
@@ -229,18 +229,16 @@ namespace OpenSim.Region.Environment.Modules | |||
229 | { | 229 | { |
230 | ImagePacketPacket im = new ImagePacketPacket(); | 230 | ImagePacketPacket im = new ImagePacketPacket(); |
231 | im.Header.Reliable = false; | 231 | im.Header.Reliable = false; |
232 | im.ImageID.Packet = (ushort)(PacketCounter); | 232 | im.ImageID.Packet = (ushort) (PacketCounter); |
233 | im.ImageID.ID = m_asset.FullID; | 233 | im.ImageID.ID = m_asset.FullID; |
234 | int size = m_asset.Data.Length - 600 - (1000 * (PacketCounter - 1)); | 234 | int size = m_asset.Data.Length - 600 - (1000*(PacketCounter - 1)); |
235 | if (size > 1000) size = 1000; | 235 | if (size > 1000) size = 1000; |
236 | im.ImageData.Data = new byte[size]; | 236 | im.ImageData.Data = new byte[size]; |
237 | Array.Copy(m_asset.Data, 600 + (1000 * (PacketCounter - 1)), im.ImageData.Data, 0, size); | 237 | Array.Copy(m_asset.Data, 600 + (1000*(PacketCounter - 1)), im.ImageData.Data, 0, size); |
238 | req.RequestUser.OutPacket(im); | 238 | req.RequestUser.OutPacket(im); |
239 | PacketCounter++; | 239 | PacketCounter++; |
240 | } | 240 | } |
241 | |||
242 | } | 241 | } |
243 | |||
244 | } | 242 | } |
245 | 243 | ||
246 | public class AssetRequest | 244 | public class AssetRequest |
@@ -258,6 +256,5 @@ namespace OpenSim.Region.Environment.Modules | |||
258 | PacketNumber = packetNumber; | 256 | PacketNumber = packetNumber; |
259 | } | 257 | } |
260 | } | 258 | } |
261 | |||
262 | } | 259 | } |
263 | } | 260 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs index a697162..7a631d7 100644 --- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs +++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs | |||
@@ -27,20 +27,12 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.IO; | 30 | using System.Collections.Generic; |
31 | using System.Net.Sockets; | ||
32 | using System.Text; | ||
33 | using System.Threading; | ||
34 | using libsecondlife; | 31 | using libsecondlife; |
35 | using OpenSim.Framework.Interfaces; | 32 | using Nini.Config; |
36 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
37 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
38 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
39 | using OpenSim.Framework.Servers; | ||
40 | using Nwc.XmlRpc; | ||
41 | using System.Collections; | ||
42 | using System.Collections.Generic; | ||
43 | using Nini.Config; | ||
44 | 36 | ||
45 | /***************************************************** | 37 | /***************************************************** |
46 | * | 38 | * |
@@ -71,6 +63,7 @@ using Nini.Config; | |||
71 | * thats the way it works. | 63 | * thats the way it works. |
72 | * | 64 | * |
73 | * **************************************************/ | 65 | * **************************************************/ |
66 | |||
74 | namespace OpenSim.Region.Environment.Modules | 67 | namespace OpenSim.Region.Environment.Modules |
75 | { | 68 | { |
76 | public class WorldCommModule : IRegionModule, IWorldComm | 69 | public class WorldCommModule : IRegionModule, IWorldComm |
@@ -120,9 +113,9 @@ namespace OpenSim.Region.Environment.Modules | |||
120 | private void DeliverClientMessage(Object sender, ChatFromViewerArgs e) | 113 | private void DeliverClientMessage(Object sender, ChatFromViewerArgs e) |
121 | { | 114 | { |
122 | DeliverMessage(e.Sender.AgentId.ToString(), | 115 | DeliverMessage(e.Sender.AgentId.ToString(), |
123 | (int)e.Type, e.Channel, | 116 | (int) e.Type, e.Channel, |
124 | e.Sender.FirstName + " " + e.Sender.LastName, | 117 | e.Sender.FirstName + " " + e.Sender.LastName, |
125 | e.Message); | 118 | e.Message); |
126 | } | 119 | } |
127 | 120 | ||
128 | public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) | 121 | public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) |
@@ -132,11 +125,10 @@ namespace OpenSim.Region.Environment.Modules | |||
132 | 125 | ||
133 | public void ListenControl(int handle, int active) | 126 | public void ListenControl(int handle, int active) |
134 | { | 127 | { |
135 | if ( active == 1 ) | 128 | if (active == 1) |
136 | m_listenerManager.Activate(handle); | 129 | m_listenerManager.Activate(handle); |
137 | else if ( active == 0 ) | 130 | else if (active == 0) |
138 | m_listenerManager.Dectivate(handle); | 131 | m_listenerManager.Dectivate(handle); |
139 | |||
140 | } | 132 | } |
141 | 133 | ||
142 | public void ListenRemove(int handle) | 134 | public void ListenRemove(int handle) |
@@ -151,7 +143,6 @@ namespace OpenSim.Region.Environment.Modules | |||
151 | // nearby avatards, the SimChat function is used. | 143 | // nearby avatards, the SimChat function is used. |
152 | public void DeliverMessage(string sourceItemID, int type, int channel, string name, string msg) | 144 | public void DeliverMessage(string sourceItemID, int type, int channel, string name, string msg) |
153 | { | 145 | { |
154 | |||
155 | SceneObjectPart source = null; | 146 | SceneObjectPart source = null; |
156 | ScenePresence avatar = null; | 147 | ScenePresence avatar = null; |
157 | 148 | ||
@@ -160,7 +151,7 @@ namespace OpenSim.Region.Environment.Modules | |||
160 | { | 151 | { |
161 | avatar = m_scene.GetScenePresence(new LLUUID(sourceItemID)); | 152 | avatar = m_scene.GetScenePresence(new LLUUID(sourceItemID)); |
162 | } | 153 | } |
163 | if( (avatar != null) || (source != null) ) | 154 | if ((avatar != null) || (source != null)) |
164 | { | 155 | { |
165 | // Loop through the objects in the scene | 156 | // Loop through the objects in the scene |
166 | // If they are in proximity, then if they are | 157 | // If they are in proximity, then if they are |
@@ -169,12 +160,12 @@ namespace OpenSim.Region.Environment.Modules | |||
169 | foreach (LLUUID eb in m_scene.Entities.Keys) | 160 | foreach (LLUUID eb in m_scene.Entities.Keys) |
170 | { | 161 | { |
171 | EntityBase sPart; | 162 | EntityBase sPart; |
172 | 163 | ||
173 | m_scene.Entities.TryGetValue(eb, out sPart); | 164 | m_scene.Entities.TryGetValue(eb, out sPart); |
174 | 165 | ||
175 | // Dont process if this message is from itself! | 166 | // Dont process if this message is from itself! |
176 | if (eb.ToString().Equals(sourceItemID) || | 167 | if (eb.ToString().Equals(sourceItemID) || |
177 | sPart.UUID.ToString().Equals(sourceItemID) ) | 168 | sPart.UUID.ToString().Equals(sourceItemID)) |
178 | continue; | 169 | continue; |
179 | 170 | ||
180 | double dis = 0; | 171 | double dis = 0; |
@@ -192,12 +183,11 @@ namespace OpenSim.Region.Environment.Modules | |||
192 | { | 183 | { |
193 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( | 184 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( |
194 | sourceItemID, sPart.UUID, channel, name, msg | 185 | sourceItemID, sPart.UUID, channel, name, msg |
195 | ); | 186 | ); |
196 | if (isListener != null) | 187 | if (isListener != null) |
197 | { | 188 | { |
198 | m_pending.Enqueue(isListener); | 189 | m_pending.Enqueue(isListener); |
199 | } | 190 | } |
200 | |||
201 | } | 191 | } |
202 | break; | 192 | break; |
203 | 193 | ||
@@ -207,12 +197,11 @@ namespace OpenSim.Region.Environment.Modules | |||
207 | { | 197 | { |
208 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( | 198 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( |
209 | sourceItemID, sPart.UUID, channel, name, msg | 199 | sourceItemID, sPart.UUID, channel, name, msg |
210 | ); | 200 | ); |
211 | if (isListener != null) | 201 | if (isListener != null) |
212 | { | 202 | { |
213 | m_pending.Enqueue(isListener); | 203 | m_pending.Enqueue(isListener); |
214 | } | 204 | } |
215 | |||
216 | } | 205 | } |
217 | break; | 206 | break; |
218 | 207 | ||
@@ -221,22 +210,22 @@ namespace OpenSim.Region.Environment.Modules | |||
221 | { | 210 | { |
222 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( | 211 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( |
223 | sourceItemID, sPart.UUID, channel, name, msg | 212 | sourceItemID, sPart.UUID, channel, name, msg |
224 | ); | 213 | ); |
225 | if (isListener != null) | 214 | if (isListener != null) |
226 | { | 215 | { |
227 | m_pending.Enqueue(isListener); | 216 | m_pending.Enqueue(isListener); |
228 | } | 217 | } |
229 | |||
230 | } | 218 | } |
231 | break; | 219 | break; |
232 | 220 | ||
233 | case 0xff: // Broadcast | 221 | case 0xff: // Broadcast |
234 | ListenerInfo isListen = m_listenerManager.IsListenerMatch(sourceItemID, eb, channel, name, msg); | 222 | ListenerInfo isListen = |
223 | m_listenerManager.IsListenerMatch(sourceItemID, eb, channel, name, msg); | ||
235 | if (isListen != null) | 224 | if (isListen != null) |
236 | { | 225 | { |
237 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( | 226 | ListenerInfo isListener = m_listenerManager.IsListenerMatch( |
238 | sourceItemID, sPart.UUID, channel, name, msg | 227 | sourceItemID, sPart.UUID, channel, name, msg |
239 | ); | 228 | ); |
240 | if (isListener != null) | 229 | if (isListener != null) |
241 | { | 230 | { |
242 | m_pending.Enqueue(isListener); | 231 | m_pending.Enqueue(isListener); |
@@ -244,10 +233,9 @@ namespace OpenSim.Region.Environment.Modules | |||
244 | } | 233 | } |
245 | break; | 234 | break; |
246 | } | 235 | } |
247 | }; | 236 | } |
248 | 237 | ; | |
249 | } | 238 | } |
250 | |||
251 | } | 239 | } |
252 | 240 | ||
253 | public bool HasMessages() | 241 | public bool HasMessages() |
@@ -257,18 +245,15 @@ namespace OpenSim.Region.Environment.Modules | |||
257 | 245 | ||
258 | public ListenerInfo GetNextMessage() | 246 | public ListenerInfo GetNextMessage() |
259 | { | 247 | { |
260 | |||
261 | ListenerInfo li = null; | 248 | ListenerInfo li = null; |
262 | 249 | ||
263 | lock (CommListLock) | 250 | lock (CommListLock) |
264 | { | 251 | { |
265 | li = m_pending.Dequeue(); | 252 | li = m_pending.Dequeue(); |
266 | } | 253 | } |
267 | 254 | ||
268 | return li; | 255 | return li; |
269 | |||
270 | } | 256 | } |
271 | |||
272 | } | 257 | } |
273 | 258 | ||
274 | // hostID: the ID of the ScenePart | 259 | // hostID: the ID of the ScenePart |
@@ -285,20 +270,19 @@ namespace OpenSim.Region.Environment.Modules | |||
285 | m_listeners = new Dictionary<int, ListenerInfo>(); | 270 | m_listeners = new Dictionary<int, ListenerInfo>(); |
286 | } | 271 | } |
287 | 272 | ||
288 | public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) | 273 | public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, |
274 | string msg) | ||
289 | { | 275 | { |
290 | 276 | if (m_listeners.Count < m_MaxListeners) | |
291 | if ( m_listeners.Count < m_MaxListeners ) | ||
292 | { | 277 | { |
293 | ListenerInfo isListener = IsListenerMatch(LLUUID.Zero.ToString(), itemID, channel, name, msg); | 278 | ListenerInfo isListener = IsListenerMatch(LLUUID.Zero.ToString(), itemID, channel, name, msg); |
294 | 279 | ||
295 | if(isListener == null) | 280 | if (isListener == null) |
296 | { | 281 | { |
297 | int newHandle = GetNewHandle(); | 282 | int newHandle = GetNewHandle(); |
298 | 283 | ||
299 | if (newHandle > -1) | 284 | if (newHandle > -1) |
300 | { | 285 | { |
301 | |||
302 | ListenerInfo li = new ListenerInfo(localID, newHandle, itemID, hostID, channel, name, id, msg); | 286 | ListenerInfo li = new ListenerInfo(localID, newHandle, itemID, hostID, channel, name, id, msg); |
303 | 287 | ||
304 | lock (ListenersLock) | 288 | lock (ListenersLock) |
@@ -308,13 +292,10 @@ namespace OpenSim.Region.Environment.Modules | |||
308 | 292 | ||
309 | return newHandle; | 293 | return newHandle; |
310 | } | 294 | } |
311 | |||
312 | } | 295 | } |
313 | |||
314 | } | 296 | } |
315 | 297 | ||
316 | return -1; | 298 | return -1; |
317 | |||
318 | } | 299 | } |
319 | 300 | ||
320 | public void Remove(int handle) | 301 | public void Remove(int handle) |
@@ -324,7 +305,6 @@ namespace OpenSim.Region.Environment.Modules | |||
324 | 305 | ||
325 | private int GetNewHandle() | 306 | private int GetNewHandle() |
326 | { | 307 | { |
327 | |||
328 | for (int i = 0; i < int.MaxValue - 1; i++) | 308 | for (int i = 0; i < int.MaxValue - 1; i++) |
329 | { | 309 | { |
330 | if (!m_listeners.ContainsKey(i)) | 310 | if (!m_listeners.ContainsKey(i)) |
@@ -332,12 +312,10 @@ namespace OpenSim.Region.Environment.Modules | |||
332 | } | 312 | } |
333 | 313 | ||
334 | return -1; | 314 | return -1; |
335 | |||
336 | } | 315 | } |
337 | 316 | ||
338 | public bool IsListener(LLUUID hostID) | 317 | public bool IsListener(LLUUID hostID) |
339 | { | 318 | { |
340 | |||
341 | foreach (ListenerInfo li in m_listeners.Values) | 319 | foreach (ListenerInfo li in m_listeners.Values) |
342 | { | 320 | { |
343 | if (li.GetHostID().Equals(hostID)) | 321 | if (li.GetHostID().Equals(hostID)) |
@@ -345,15 +323,13 @@ namespace OpenSim.Region.Environment.Modules | |||
345 | } | 323 | } |
346 | 324 | ||
347 | return false; | 325 | return false; |
348 | |||
349 | } | 326 | } |
350 | 327 | ||
351 | public void Activate(int handle) | 328 | public void Activate(int handle) |
352 | { | 329 | { |
353 | |||
354 | ListenerInfo li; | 330 | ListenerInfo li; |
355 | 331 | ||
356 | if( m_listeners.TryGetValue(handle, out li) ) | 332 | if (m_listeners.TryGetValue(handle, out li)) |
357 | { | 333 | { |
358 | li.Activate(); | 334 | li.Activate(); |
359 | } | 335 | } |
@@ -361,10 +337,9 @@ namespace OpenSim.Region.Environment.Modules | |||
361 | 337 | ||
362 | public void Dectivate(int handle) | 338 | public void Dectivate(int handle) |
363 | { | 339 | { |
364 | |||
365 | ListenerInfo li; | 340 | ListenerInfo li; |
366 | 341 | ||
367 | if( m_listeners.TryGetValue(handle, out li) ) | 342 | if (m_listeners.TryGetValue(handle, out li)) |
368 | { | 343 | { |
369 | li.Deactivate(); | 344 | li.Deactivate(); |
370 | } | 345 | } |
@@ -372,40 +347,40 @@ namespace OpenSim.Region.Environment.Modules | |||
372 | 347 | ||
373 | // Theres probably a more clever and efficient way to | 348 | // Theres probably a more clever and efficient way to |
374 | // do this, maybe with regex. | 349 | // do this, maybe with regex. |
375 | public ListenerInfo IsListenerMatch(string sourceItemID, LLUUID listenerKey, int channel, string name, string msg) | 350 | public ListenerInfo IsListenerMatch(string sourceItemID, LLUUID listenerKey, int channel, string name, |
351 | string msg) | ||
376 | { | 352 | { |
377 | |||
378 | bool isMatch = true; | 353 | bool isMatch = true; |
379 | 354 | ||
380 | foreach (ListenerInfo li in m_listeners.Values) | 355 | foreach (ListenerInfo li in m_listeners.Values) |
381 | { | 356 | { |
382 | if (li.GetHostID().Equals(listenerKey)) | 357 | if (li.GetHostID().Equals(listenerKey)) |
383 | { | 358 | { |
384 | if ( li.IsActive() ) | 359 | if (li.IsActive()) |
385 | { | 360 | { |
386 | if ( channel == li.GetChannel() ) | 361 | if (channel == li.GetChannel()) |
387 | { | 362 | { |
388 | if ( (li.GetID().ToString().Length > 0) && | 363 | if ((li.GetID().ToString().Length > 0) && |
389 | (!li.GetID().Equals(LLUUID.Zero)) ) | 364 | (!li.GetID().Equals(LLUUID.Zero))) |
390 | { | 365 | { |
391 | if (!li.GetID().ToString().Equals(sourceItemID)) | 366 | if (!li.GetID().ToString().Equals(sourceItemID)) |
392 | { | 367 | { |
393 | isMatch = false; | 368 | isMatch = false; |
394 | } | 369 | } |
395 | } | 370 | } |
396 | if ( isMatch && (li.GetName().Length > 0) ) | 371 | if (isMatch && (li.GetName().Length > 0)) |
397 | { | 372 | { |
398 | if ( li.GetName().Equals(name) ) | 373 | if (li.GetName().Equals(name)) |
399 | { | 374 | { |
400 | isMatch = false; | 375 | isMatch = false; |
401 | } | 376 | } |
402 | } | 377 | } |
403 | if ( isMatch ) | 378 | if (isMatch) |
404 | { | 379 | { |
405 | return new ListenerInfo( | 380 | return new ListenerInfo( |
406 | li.GetLocalID(), li.GetHandle(), li.GetItemID(), li.GetHostID(), | 381 | li.GetLocalID(), li.GetHandle(), li.GetItemID(), li.GetHostID(), |
407 | li.GetChannel(), name, li.GetID(), msg, new LLUUID(sourceItemID) | 382 | li.GetChannel(), name, li.GetID(), msg, new LLUUID(sourceItemID) |
408 | ); | 383 | ); |
409 | } | 384 | } |
410 | } | 385 | } |
411 | } | 386 | } |
@@ -413,35 +388,36 @@ namespace OpenSim.Region.Environment.Modules | |||
413 | } | 388 | } |
414 | return null; | 389 | return null; |
415 | } | 390 | } |
416 | |||
417 | } | 391 | } |
418 | 392 | ||
419 | public class ListenerInfo | 393 | public class ListenerInfo |
420 | { | 394 | { |
421 | 395 | private LLUUID m_itemID; // ID of the host script engine | |
422 | private LLUUID m_itemID; // ID of the host script engine | 396 | private LLUUID m_hostID; // ID of the host/scene part |
423 | private LLUUID m_hostID; // ID of the host/scene part | 397 | private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message |
424 | private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message | 398 | private int m_channel; // Channel |
425 | private int m_channel; // Channel | 399 | private int m_handle; // Assigned handle of this listener |
426 | private int m_handle; // Assigned handle of this listener | 400 | private uint m_localID; // Local ID from script engine |
427 | private uint m_localID; // Local ID from script engine | 401 | private string m_name; // Object name to filter messages from |
428 | private string m_name; // Object name to filter messages from | 402 | private LLUUID m_id; // ID to filter messages from |
429 | private LLUUID m_id; // ID to filter messages from | 403 | private string m_message; // The message |
430 | private string m_message; // The message | 404 | private bool m_active; // Listener is active or not |
431 | private bool m_active; // Listener is active or not | 405 | |
432 | 406 | public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, | |
433 | public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) | 407 | string message) |
434 | { | 408 | { |
435 | Initialise(localID, handle, ItemID, hostID, channel, name, id, message); | 409 | Initialise(localID, handle, ItemID, hostID, channel, name, id, message); |
436 | } | 410 | } |
437 | 411 | ||
438 | public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message, LLUUID sourceItemID) | 412 | public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, |
413 | string message, LLUUID sourceItemID) | ||
439 | { | 414 | { |
440 | Initialise(localID, handle, ItemID, hostID, channel, name, id, message); | 415 | Initialise(localID, handle, ItemID, hostID, channel, name, id, message); |
441 | m_sourceItemID = sourceItemID; | 416 | m_sourceItemID = sourceItemID; |
442 | } | 417 | } |
443 | 418 | ||
444 | private void Initialise(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) | 419 | private void Initialise(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, |
420 | LLUUID id, string message) | ||
445 | { | 421 | { |
446 | m_handle = handle; | 422 | m_handle = handle; |
447 | m_channel = channel; | 423 | m_channel = channel; |
@@ -453,55 +429,65 @@ namespace OpenSim.Region.Environment.Modules | |||
453 | m_active = true; | 429 | m_active = true; |
454 | m_localID = localID; | 430 | m_localID = localID; |
455 | } | 431 | } |
432 | |||
456 | public LLUUID GetItemID() | 433 | public LLUUID GetItemID() |
457 | { | 434 | { |
458 | return m_itemID; | 435 | return m_itemID; |
459 | } | 436 | } |
437 | |||
460 | public LLUUID GetHostID() | 438 | public LLUUID GetHostID() |
461 | { | 439 | { |
462 | return m_hostID; | 440 | return m_hostID; |
463 | } | 441 | } |
442 | |||
464 | public LLUUID GetSourceItemID() | 443 | public LLUUID GetSourceItemID() |
465 | { | 444 | { |
466 | return m_sourceItemID; | 445 | return m_sourceItemID; |
467 | } | 446 | } |
447 | |||
468 | public int GetChannel() | 448 | public int GetChannel() |
469 | { | 449 | { |
470 | return m_channel; | 450 | return m_channel; |
471 | } | 451 | } |
452 | |||
472 | public uint GetLocalID() | 453 | public uint GetLocalID() |
473 | { | 454 | { |
474 | return m_localID; | 455 | return m_localID; |
475 | } | 456 | } |
457 | |||
476 | public int GetHandle() | 458 | public int GetHandle() |
477 | { | 459 | { |
478 | return m_handle; | 460 | return m_handle; |
479 | } | 461 | } |
462 | |||
480 | public string GetMessage() | 463 | public string GetMessage() |
481 | { | 464 | { |
482 | return m_message; | 465 | return m_message; |
483 | } | 466 | } |
467 | |||
484 | public string GetName() | 468 | public string GetName() |
485 | { | 469 | { |
486 | return m_name; | 470 | return m_name; |
487 | } | 471 | } |
472 | |||
488 | public bool IsActive() | 473 | public bool IsActive() |
489 | { | 474 | { |
490 | return m_active; | 475 | return m_active; |
491 | } | 476 | } |
477 | |||
492 | public void Deactivate() | 478 | public void Deactivate() |
493 | { | 479 | { |
494 | m_active = false; | 480 | m_active = false; |
495 | } | 481 | } |
482 | |||
496 | public void Activate() | 483 | public void Activate() |
497 | { | 484 | { |
498 | m_active = true; | 485 | m_active = true; |
499 | } | 486 | } |
487 | |||
500 | public LLUUID GetID() | 488 | public LLUUID GetID() |
501 | { | 489 | { |
502 | return m_id; | 490 | return m_id; |
503 | } | 491 | } |
504 | |||
505 | } | 492 | } |
506 | 493 | } \ No newline at end of file | |
507 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs index dd84778..434c92f 100644 --- a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs +++ b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs | |||
@@ -26,20 +26,15 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System.Collections; |
30 | using System.IO; | 30 | using System.Collections.Generic; |
31 | using System.Net.Sockets; | ||
32 | using System.Threading; | 31 | using System.Threading; |
33 | using libsecondlife; | 32 | using libsecondlife; |
34 | using OpenSim.Framework.Interfaces; | 33 | using Nini.Config; |
35 | using OpenSim.Framework; | 34 | using Nwc.XmlRpc; |
35 | using OpenSim.Framework.Servers; | ||
36 | using OpenSim.Region.Environment.Interfaces; | 36 | using OpenSim.Region.Environment.Interfaces; |
37 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
38 | using OpenSim.Framework.Servers; | ||
39 | using Nwc.XmlRpc; | ||
40 | using System.Collections; | ||
41 | using System.Collections.Generic; | ||
42 | using Nini.Config; | ||
43 | 38 | ||
44 | /***************************************************** | 39 | /***************************************************** |
45 | * | 40 | * |
@@ -73,6 +68,7 @@ using Nini.Config; | |||
73 | * llCloseRemoteDataChannel | 68 | * llCloseRemoteDataChannel |
74 | * | 69 | * |
75 | * **************************************************/ | 70 | * **************************************************/ |
71 | |||
76 | namespace OpenSim.Region.Environment.Modules | 72 | namespace OpenSim.Region.Environment.Modules |
77 | { | 73 | { |
78 | public class XMLRPCModule : IRegionModule, IXMLRPC | 74 | public class XMLRPCModule : IRegionModule, IXMLRPC |
@@ -83,7 +79,7 @@ namespace OpenSim.Region.Environment.Modules | |||
83 | private string m_name = "XMLRPCModule"; | 79 | private string m_name = "XMLRPCModule"; |
84 | private int RemoteReplyScriptWait = 100; | 80 | private int RemoteReplyScriptWait = 100; |
85 | private int RemoteReplyScriptTimeout = 300; | 81 | private int RemoteReplyScriptTimeout = 300; |
86 | 82 | ||
87 | // <channel id, RPCChannelInfo> | 83 | // <channel id, RPCChannelInfo> |
88 | private Dictionary<LLUUID, RPCChannelInfo> m_openChannels; | 84 | private Dictionary<LLUUID, RPCChannelInfo> m_openChannels; |
89 | 85 | ||
@@ -106,7 +102,7 @@ namespace OpenSim.Region.Environment.Modules | |||
106 | // Start http server | 102 | // Start http server |
107 | // Attach xmlrpc handlers | 103 | // Attach xmlrpc handlers |
108 | BaseHttpServer httpServer = new BaseHttpServer(20800); | 104 | BaseHttpServer httpServer = new BaseHttpServer(20800); |
109 | httpServer.AddXmlRPCHandler("llRemoteData", this.XmlRpcRemoteData); | 105 | httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); |
110 | httpServer.Start(); | 106 | httpServer.Start(); |
111 | } | 107 | } |
112 | 108 | ||
@@ -141,6 +137,7 @@ namespace OpenSim.Region.Environment.Modules | |||
141 | * current channel and assign a new one. | 137 | * current channel and assign a new one. |
142 | * | 138 | * |
143 | * ********************************************/ | 139 | * ********************************************/ |
140 | |||
144 | public LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID) | 141 | public LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID) |
145 | { | 142 | { |
146 | LLUUID channel = null; | 143 | LLUUID channel = null; |
@@ -156,7 +153,7 @@ namespace OpenSim.Region.Environment.Modules | |||
156 | } | 153 | } |
157 | } | 154 | } |
158 | 155 | ||
159 | if ( (channel == null) || (channel.Equals(LLUUID.Zero)) ) | 156 | if ((channel == null) || (channel.Equals(LLUUID.Zero))) |
160 | { | 157 | { |
161 | channel = LLUUID.Random(); | 158 | channel = LLUUID.Random(); |
162 | RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, channel); | 159 | RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, channel); |
@@ -164,7 +161,6 @@ namespace OpenSim.Region.Environment.Modules | |||
164 | { | 161 | { |
165 | m_openChannels.Add(channel, rpcChanInfo); | 162 | m_openChannels.Add(channel, rpcChanInfo); |
166 | } | 163 | } |
167 | |||
168 | } | 164 | } |
169 | 165 | ||
170 | return channel; | 166 | return channel; |
@@ -176,6 +172,7 @@ namespace OpenSim.Region.Environment.Modules | |||
176 | * Response to RPC message | 172 | * Response to RPC message |
177 | * | 173 | * |
178 | *********************************************/ | 174 | *********************************************/ |
175 | |||
179 | public void RemoteDataReply(string channel, string message_id, string sdata, int idata) | 176 | public void RemoteDataReply(string channel, string message_id, string sdata, int idata) |
180 | { | 177 | { |
181 | RPCRequestInfo rpcInfo; | 178 | RPCRequestInfo rpcInfo; |
@@ -191,7 +188,6 @@ namespace OpenSim.Region.Environment.Modules | |||
191 | m_pendingResponse.Remove(message_key); | 188 | m_pendingResponse.Remove(message_key); |
192 | } | 189 | } |
193 | } | 190 | } |
194 | |||
195 | } | 191 | } |
196 | 192 | ||
197 | /********************************************** | 193 | /********************************************** |
@@ -200,41 +196,44 @@ namespace OpenSim.Region.Environment.Modules | |||
200 | * Remove channel from dictionary | 196 | * Remove channel from dictionary |
201 | * | 197 | * |
202 | *********************************************/ | 198 | *********************************************/ |
199 | |||
203 | public void CloseXMLRPCChannel(LLUUID channelKey) | 200 | public void CloseXMLRPCChannel(LLUUID channelKey) |
204 | { | 201 | { |
205 | if(m_openChannels.ContainsKey(channelKey)) | 202 | if (m_openChannels.ContainsKey(channelKey)) |
206 | m_openChannels.Remove(channelKey); | 203 | m_openChannels.Remove(channelKey); |
207 | } | 204 | } |
208 | 205 | ||
209 | 206 | ||
210 | public XmlRpcResponse XmlRpcRemoteData(XmlRpcRequest request) | 207 | public XmlRpcResponse XmlRpcRemoteData(XmlRpcRequest request) |
211 | { | 208 | { |
212 | |||
213 | XmlRpcResponse response = new XmlRpcResponse(); | 209 | XmlRpcResponse response = new XmlRpcResponse(); |
214 | 210 | ||
215 | Hashtable requestData = (Hashtable)request.Params[0]; | 211 | Hashtable requestData = (Hashtable) request.Params[0]; |
216 | bool GoodXML = (requestData.Contains("Channel") && requestData.Contains("IntValue") && requestData.Contains("StringValue")); | 212 | bool GoodXML = (requestData.Contains("Channel") && requestData.Contains("IntValue") && |
213 | requestData.Contains("StringValue")); | ||
217 | 214 | ||
218 | if (GoodXML) | 215 | if (GoodXML) |
219 | { | 216 | { |
220 | LLUUID channel = new LLUUID((string)requestData["Channel"]); | 217 | LLUUID channel = new LLUUID((string) requestData["Channel"]); |
221 | RPCChannelInfo rpcChanInfo; | 218 | RPCChannelInfo rpcChanInfo; |
222 | if (m_openChannels.TryGetValue(channel, out rpcChanInfo)) | 219 | if (m_openChannels.TryGetValue(channel, out rpcChanInfo)) |
223 | { | 220 | { |
224 | string intVal = (string)requestData["IntValue"]; | 221 | string intVal = (string) requestData["IntValue"]; |
225 | string strVal = (string)requestData["StringValue"]; | 222 | string strVal = (string) requestData["StringValue"]; |
226 | 223 | ||
227 | RPCRequestInfo rpcInfo; | 224 | RPCRequestInfo rpcInfo; |
228 | 225 | ||
229 | lock (XMLRPCListLock) | 226 | lock (XMLRPCListLock) |
230 | { | 227 | { |
231 | rpcInfo = new RPCRequestInfo(rpcChanInfo.GetLocalID(), rpcChanInfo.GetItemID(), channel, strVal, intVal); | 228 | rpcInfo = |
229 | new RPCRequestInfo(rpcChanInfo.GetLocalID(), rpcChanInfo.GetItemID(), channel, strVal, | ||
230 | intVal); | ||
232 | rpcQueue.Enqueue(rpcInfo); | 231 | rpcQueue.Enqueue(rpcInfo); |
233 | } | 232 | } |
234 | 233 | ||
235 | int timeoutCtr = 0; | 234 | int timeoutCtr = 0; |
236 | 235 | ||
237 | while(!rpcInfo.IsProcessed() && (timeoutCtr < RemoteReplyScriptTimeout)) | 236 | while (!rpcInfo.IsProcessed() && (timeoutCtr < RemoteReplyScriptTimeout)) |
238 | { | 237 | { |
239 | Thread.Sleep(RemoteReplyScriptWait); | 238 | Thread.Sleep(RemoteReplyScriptWait); |
240 | timeoutCtr += RemoteReplyScriptWait; | 239 | timeoutCtr += RemoteReplyScriptWait; |
@@ -252,13 +251,11 @@ namespace OpenSim.Region.Environment.Modules | |||
252 | m_pendingResponse.Remove(rpcInfo.GetMessageID()); | 251 | m_pendingResponse.Remove(rpcInfo.GetMessageID()); |
253 | } | 252 | } |
254 | } | 253 | } |
255 | |||
256 | } | 254 | } |
257 | else | 255 | else |
258 | { | 256 | { |
259 | response.SetFault(-1, "Invalid channel"); | 257 | response.SetFault(-1, "Invalid channel"); |
260 | } | 258 | } |
261 | |||
262 | } | 259 | } |
263 | 260 | ||
264 | return response; | 261 | return response; |
@@ -278,7 +275,6 @@ namespace OpenSim.Region.Environment.Modules | |||
278 | return rpcInfo; | 275 | return rpcInfo; |
279 | } | 276 | } |
280 | } | 277 | } |
281 | |||
282 | } | 278 | } |
283 | 279 | ||
284 | /************************************************************** | 280 | /************************************************************** |
@@ -288,6 +284,7 @@ namespace OpenSim.Region.Environment.Modules | |||
288 | * Holds details about incoming requests until they are picked | 284 | * Holds details about incoming requests until they are picked |
289 | * from the queue by LSLLongCmdHandler | 285 | * from the queue by LSLLongCmdHandler |
290 | * ***********************************************************/ | 286 | * ***********************************************************/ |
287 | |||
291 | public class RPCRequestInfo | 288 | public class RPCRequestInfo |
292 | { | 289 | { |
293 | private string m_StrVal; | 290 | private string m_StrVal; |
@@ -315,6 +312,7 @@ namespace OpenSim.Region.Environment.Modules | |||
315 | { | 312 | { |
316 | return m_processed; | 313 | return m_processed; |
317 | } | 314 | } |
315 | |||
318 | public LLUUID GetChannelKey() | 316 | public LLUUID GetChannelKey() |
319 | { | 317 | { |
320 | return m_ChannelKey; | 318 | return m_ChannelKey; |
@@ -324,36 +322,41 @@ namespace OpenSim.Region.Environment.Modules | |||
324 | { | 322 | { |
325 | m_processed = processed; | 323 | m_processed = processed; |
326 | } | 324 | } |
325 | |||
327 | public void SetRetval(string resp) | 326 | public void SetRetval(string resp) |
328 | { | 327 | { |
329 | m_resp = resp; | 328 | m_resp = resp; |
330 | } | 329 | } |
330 | |||
331 | public string GetRetval() | 331 | public string GetRetval() |
332 | { | 332 | { |
333 | return m_resp; | 333 | return m_resp; |
334 | } | 334 | } |
335 | |||
335 | public uint GetLocalID() | 336 | public uint GetLocalID() |
336 | { | 337 | { |
337 | return m_localID; | 338 | return m_localID; |
338 | } | 339 | } |
340 | |||
339 | public LLUUID GetItemID() | 341 | public LLUUID GetItemID() |
340 | { | 342 | { |
341 | return m_ItemID; | 343 | return m_ItemID; |
342 | } | 344 | } |
345 | |||
343 | public string GetStrVal() | 346 | public string GetStrVal() |
344 | { | 347 | { |
345 | return m_StrVal; | 348 | return m_StrVal; |
346 | } | 349 | } |
350 | |||
347 | public int GetIntValue() | 351 | public int GetIntValue() |
348 | { | 352 | { |
349 | return int.Parse(m_IntVal); | 353 | return int.Parse(m_IntVal); |
350 | } | 354 | } |
355 | |||
351 | public LLUUID GetMessageID() | 356 | public LLUUID GetMessageID() |
352 | { | 357 | { |
353 | return m_MessageID; | 358 | return m_MessageID; |
354 | } | 359 | } |
355 | |||
356 | |||
357 | } | 360 | } |
358 | 361 | ||
359 | public class RPCChannelInfo | 362 | public class RPCChannelInfo |
@@ -383,7 +386,5 @@ namespace OpenSim.Region.Environment.Modules | |||
383 | { | 386 | { |
384 | return m_localID; | 387 | return m_localID; |
385 | } | 388 | } |
386 | |||
387 | } | 389 | } |
388 | 390 | } \ No newline at end of file | |
389 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs index e555475..807b46c 100644 --- a/OpenSim/Region/Environment/Modules/XferModule.cs +++ b/OpenSim/Region/Environment/Modules/XferModule.cs | |||
@@ -29,11 +29,10 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using OpenSim.Framework.Interfaces; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Environment.Interfaces; |
34 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
35 | using OpenSim.Framework; | ||
36 | using Nini.Config; | ||
37 | 36 | ||
38 | namespace OpenSim.Region.Environment.Modules | 37 | namespace OpenSim.Region.Environment.Modules |
39 | { | 38 | { |
@@ -200,4 +199,4 @@ namespace OpenSim.Region.Environment.Modules | |||
200 | } | 199 | } |
201 | } | 200 | } |
202 | } | 201 | } |
203 | } | 202 | } \ No newline at end of file |