diff options
author | Adam Frisby | 2008-04-30 21:43:47 +0000 |
---|---|---|
committer | Adam Frisby | 2008-04-30 21:43:47 +0000 |
commit | be20f41637b6c06ce3ab16bc25851b6e43468e12 (patch) | |
tree | c41081329891f4c24de704fc760fb9012954ac9d /OpenSim/Region/Environment/Modules/Scripting/WorldComm | |
parent | * Sometimes you know, you do something really stupid. (diff) | |
download | opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.zip opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.gz opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.bz2 opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.xz |
* Cruft removal step #1. Cleaning Modules directory.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs | 79 |
1 files changed, 43 insertions, 36 deletions
diff --git a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs index a949fb6..ff3b31e 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -67,18 +67,20 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
67 | { | 67 | { |
68 | public class WorldCommModule : IRegionModule, IWorldComm | 68 | public class WorldCommModule : IRegionModule, IWorldComm |
69 | { | 69 | { |
70 | private Scene m_scene; | ||
71 | private object CommListLock = new object(); | 70 | private object CommListLock = new object(); |
72 | private object ListLock = new object(); | 71 | private object ListLock = new object(); |
73 | private string m_name = "WorldCommModule"; | ||
74 | private ListenerManager m_listenerManager; | 72 | private ListenerManager m_listenerManager; |
75 | private Queue m_pendingQ; | 73 | private string m_name = "WorldCommModule"; |
76 | private Queue m_pending; | 74 | private Queue m_pending; |
75 | private Queue m_pendingQ; | ||
76 | private Scene m_scene; | ||
77 | 77 | ||
78 | public WorldCommModule() | 78 | public WorldCommModule() |
79 | { | 79 | { |
80 | } | 80 | } |
81 | 81 | ||
82 | #region IRegionModule Members | ||
83 | |||
82 | public void Initialise(Scene scene, IConfigSource config) | 84 | public void Initialise(Scene scene, IConfigSource config) |
83 | { | 85 | { |
84 | m_scene = scene; | 86 | m_scene = scene; |
@@ -107,23 +109,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
107 | get { return false; } | 109 | get { return false; } |
108 | } | 110 | } |
109 | 111 | ||
110 | public void NewClient(IClientAPI client) | 112 | #endregion |
111 | { | ||
112 | client.OnChatFromViewer += DeliverClientMessage; | ||
113 | } | ||
114 | 113 | ||
115 | /******************************************************************** | 114 | #region IWorldComm Members |
116 | * | ||
117 | * Listener Stuff | ||
118 | * | ||
119 | * *****************************************************************/ | ||
120 | private void DeliverClientMessage(Object sender, ChatFromViewerArgs e) | ||
121 | { | ||
122 | DeliverMessage(e.Sender.AgentId.ToString(), | ||
123 | e.Type, e.Channel, | ||
124 | e.Sender.FirstName + " " + e.Sender.LastName, | ||
125 | e.Message); | ||
126 | } | ||
127 | 115 | ||
128 | public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) | 116 | public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) |
129 | { | 117 | { |
@@ -295,7 +283,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
295 | 283 | ||
296 | lock (m_pending.SyncRoot) | 284 | lock (m_pending.SyncRoot) |
297 | { | 285 | { |
298 | li = (ListenerInfo)m_pending.Dequeue(); | 286 | li = (ListenerInfo) m_pending.Dequeue(); |
299 | } | 287 | } |
300 | 288 | ||
301 | return li; | 289 | return li; |
@@ -303,20 +291,41 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
303 | 291 | ||
304 | public uint PeekNextMessageLocalID() | 292 | public uint PeekNextMessageLocalID() |
305 | { | 293 | { |
306 | return ((ListenerInfo)m_pending.Peek()).GetLocalID(); | 294 | return ((ListenerInfo) m_pending.Peek()).GetLocalID(); |
307 | } | 295 | } |
308 | 296 | ||
309 | public LLUUID PeekNextMessageItemID() | 297 | public LLUUID PeekNextMessageItemID() |
310 | { | 298 | { |
311 | return ((ListenerInfo)m_pending.Peek()).GetItemID(); | 299 | return ((ListenerInfo) m_pending.Peek()).GetItemID(); |
300 | } | ||
301 | |||
302 | #endregion | ||
303 | |||
304 | public void NewClient(IClientAPI client) | ||
305 | { | ||
306 | client.OnChatFromViewer += DeliverClientMessage; | ||
307 | } | ||
308 | |||
309 | /******************************************************************** | ||
310 | * | ||
311 | * Listener Stuff | ||
312 | * | ||
313 | * *****************************************************************/ | ||
314 | |||
315 | private void DeliverClientMessage(Object sender, ChatFromViewerArgs e) | ||
316 | { | ||
317 | DeliverMessage(e.Sender.AgentId.ToString(), | ||
318 | e.Type, e.Channel, | ||
319 | e.Sender.FirstName + " " + e.Sender.LastName, | ||
320 | e.Message); | ||
312 | } | 321 | } |
313 | } | 322 | } |
314 | 323 | ||
315 | public class ListenerManager | 324 | public class ListenerManager |
316 | { | 325 | { |
317 | //private Dictionary<int, ListenerInfo> m_listeners; | 326 | //private Dictionary<int, ListenerInfo> m_listeners; |
318 | private Hashtable m_listeners = Hashtable.Synchronized(new Hashtable()); | ||
319 | private object ListenersLock = new object(); | 327 | private object ListenersLock = new object(); |
328 | private Hashtable m_listeners = Hashtable.Synchronized(new Hashtable()); | ||
320 | private int m_MaxListeners = 100; | 329 | private int m_MaxListeners = 100; |
321 | 330 | ||
322 | public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) | 331 | public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) |
@@ -363,7 +372,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
363 | IDictionaryEnumerator en = m_listeners.GetEnumerator(); | 372 | IDictionaryEnumerator en = m_listeners.GetEnumerator(); |
364 | while (en.MoveNext()) | 373 | while (en.MoveNext()) |
365 | { | 374 | { |
366 | ListenerInfo li = (ListenerInfo)en.Value; | 375 | ListenerInfo li = (ListenerInfo) en.Value; |
367 | if (li.GetItemID().Equals(itemID)) | 376 | if (li.GetItemID().Equals(itemID)) |
368 | { | 377 | { |
369 | removedListeners.Add(li.GetHandle()); | 378 | removedListeners.Add(li.GetHandle()); |
@@ -400,12 +409,11 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
400 | 409 | ||
401 | public void Activate(int handle) | 410 | public void Activate(int handle) |
402 | { | 411 | { |
403 | |||
404 | if (m_listeners.ContainsKey(handle)) | 412 | if (m_listeners.ContainsKey(handle)) |
405 | { | 413 | { |
406 | lock (m_listeners.SyncRoot) | 414 | lock (m_listeners.SyncRoot) |
407 | { | 415 | { |
408 | ListenerInfo li = (ListenerInfo)m_listeners[handle]; | 416 | ListenerInfo li = (ListenerInfo) m_listeners[handle]; |
409 | li.Activate(); | 417 | li.Activate(); |
410 | } | 418 | } |
411 | } | 419 | } |
@@ -413,10 +421,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
413 | 421 | ||
414 | public void Dectivate(int handle) | 422 | public void Dectivate(int handle) |
415 | { | 423 | { |
416 | |||
417 | if (m_listeners.ContainsKey(handle)) | 424 | if (m_listeners.ContainsKey(handle)) |
418 | { | 425 | { |
419 | ListenerInfo li = (ListenerInfo)m_listeners[handle]; | 426 | ListenerInfo li = (ListenerInfo) m_listeners[handle]; |
420 | li.Deactivate(); | 427 | li.Deactivate(); |
421 | } | 428 | } |
422 | } | 429 | } |
@@ -432,9 +439,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
432 | IDictionaryEnumerator en = m_listeners.GetEnumerator(); | 439 | IDictionaryEnumerator en = m_listeners.GetEnumerator(); |
433 | while (en.MoveNext()) | 440 | while (en.MoveNext()) |
434 | { | 441 | { |
435 | ListenerInfo li = (ListenerInfo)en.Value; | 442 | ListenerInfo li = (ListenerInfo) en.Value; |
436 | 443 | ||
437 | if (li.IsActive()) | 444 | if (li.IsActive()) |
438 | { | 445 | { |
439 | if (li.GetHostID().Equals(listenerKey)) | 446 | if (li.GetHostID().Equals(listenerKey)) |
440 | { | 447 | { |
@@ -478,16 +485,16 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
478 | 485 | ||
479 | public class ListenerInfo | 486 | public class ListenerInfo |
480 | { | 487 | { |
481 | private LLUUID m_itemID; // ID of the host script engine | 488 | private bool m_active; // Listener is active or not |
482 | private LLUUID m_hostID; // ID of the host/scene part | ||
483 | private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message | ||
484 | private int m_channel; // Channel | 489 | private int m_channel; // Channel |
485 | private int m_handle; // Assigned handle of this listener | 490 | private int m_handle; // Assigned handle of this listener |
486 | private uint m_localID; // Local ID from script engine | 491 | private LLUUID m_hostID; // ID of the host/scene part |
487 | private string m_name; // Object name to filter messages from | ||
488 | private LLUUID m_id; // ID to filter messages from | 492 | private LLUUID m_id; // ID to filter messages from |
493 | private LLUUID m_itemID; // ID of the host script engine | ||
494 | private uint m_localID; // Local ID from script engine | ||
489 | private string m_message; // The message | 495 | private string m_message; // The message |
490 | private bool m_active; // Listener is active or not | 496 | private string m_name; // Object name to filter messages from |
497 | private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message | ||
491 | 498 | ||
492 | public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) | 499 | public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) |
493 | { | 500 | { |