diff options
author | Melanie | 2012-11-11 16:31:01 +0000 |
---|---|---|
committer | Melanie | 2012-11-11 16:31:01 +0000 |
commit | 389077345f9fc78fddcaa39e29daa532a32815d6 (patch) | |
tree | a455d88d93ac5fe984ebf5342276ca1ddc831442 /OpenSim/Region/CoreModules/Scripting | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Deleted 2 obsolete modules: OGSRadmin and OpenGridProtocol. They were still I... (diff) | |
download | opensim-SC-389077345f9fc78fddcaa39e29daa532a32815d6.zip opensim-SC-389077345f9fc78fddcaa39e29daa532a32815d6.tar.gz opensim-SC-389077345f9fc78fddcaa39e29daa532a32815d6.tar.bz2 opensim-SC-389077345f9fc78fddcaa39e29daa532a32815d6.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | 262 |
1 files changed, 187 insertions, 75 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index e167e31..5f9aa42 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -29,8 +29,12 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text.RegularExpressions; | 31 | using System.Text.RegularExpressions; |
32 | |||
32 | using Nini.Config; | 33 | using Nini.Config; |
34 | using Mono.Addins; | ||
35 | |||
33 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | |||
34 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
35 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
@@ -86,7 +90,8 @@ using OpenSim.Region.Framework.Scenes; | |||
86 | 90 | ||
87 | namespace OpenSim.Region.CoreModules.Scripting.WorldComm | 91 | namespace OpenSim.Region.CoreModules.Scripting.WorldComm |
88 | { | 92 | { |
89 | public class WorldCommModule : IRegionModule, IWorldComm | 93 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
94 | public class WorldCommModule : IWorldComm, INonSharedRegionModule | ||
90 | { | 95 | { |
91 | // private static readonly ILog m_log = | 96 | // private static readonly ILog m_log = |
92 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 97 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -101,9 +106,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
101 | private int m_saydistance = 20; | 106 | private int m_saydistance = 20; |
102 | private int m_shoutdistance = 100; | 107 | private int m_shoutdistance = 100; |
103 | 108 | ||
104 | #region IRegionModule Members | 109 | #region INonSharedRegionModule Members |
105 | 110 | ||
106 | public void Initialise(Scene scene, IConfigSource config) | 111 | public void Initialise(IConfigSource config) |
107 | { | 112 | { |
108 | // wrap this in a try block so that defaults will work if | 113 | // wrap this in a try block so that defaults will work if |
109 | // the config file doesn't specify otherwise. | 114 | // the config file doesn't specify otherwise. |
@@ -111,29 +116,49 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
111 | int maxhandles = 64; | 116 | int maxhandles = 64; |
112 | try | 117 | try |
113 | { | 118 | { |
114 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 119 | m_whisperdistance = config.Configs["Chat"].GetInt( |
115 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 120 | "whisper_distance", m_whisperdistance); |
116 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 121 | m_saydistance = config.Configs["Chat"].GetInt( |
117 | maxlisteners = config.Configs["LL-Functions"].GetInt("max_listens_per_region", maxlisteners); | 122 | "say_distance", m_saydistance); |
118 | maxhandles = config.Configs["LL-Functions"].GetInt("max_listens_per_script", maxhandles); | 123 | m_shoutdistance = config.Configs["Chat"].GetInt( |
124 | "shout_distance", m_shoutdistance); | ||
125 | maxlisteners = config.Configs["LL-Functions"].GetInt( | ||
126 | "max_listens_per_region", maxlisteners); | ||
127 | maxhandles = config.Configs["LL-Functions"].GetInt( | ||
128 | "max_listens_per_script", maxhandles); | ||
119 | } | 129 | } |
120 | catch (Exception) | 130 | catch (Exception) |
121 | { | 131 | { |
122 | } | 132 | } |
123 | if (maxlisteners < 1) maxlisteners = int.MaxValue; | 133 | if (maxlisteners < 1) maxlisteners = int.MaxValue; |
124 | if (maxhandles < 1) maxhandles = int.MaxValue; | 134 | if (maxhandles < 1) maxhandles = int.MaxValue; |
135 | m_listenerManager = new ListenerManager(maxlisteners, maxhandles); | ||
136 | m_pendingQ = new Queue(); | ||
137 | m_pending = Queue.Synchronized(m_pendingQ); | ||
138 | } | ||
139 | |||
140 | public void PostInitialise() | ||
141 | { | ||
142 | } | ||
125 | 143 | ||
144 | public void AddRegion(Scene scene) | ||
145 | { | ||
126 | m_scene = scene; | 146 | m_scene = scene; |
127 | m_scene.RegisterModuleInterface<IWorldComm>(this); | 147 | m_scene.RegisterModuleInterface<IWorldComm>(this); |
128 | m_listenerManager = new ListenerManager(maxlisteners, maxhandles); | ||
129 | m_scene.EventManager.OnChatFromClient += DeliverClientMessage; | 148 | m_scene.EventManager.OnChatFromClient += DeliverClientMessage; |
130 | m_scene.EventManager.OnChatBroadcast += DeliverClientMessage; | 149 | m_scene.EventManager.OnChatBroadcast += DeliverClientMessage; |
131 | m_pendingQ = new Queue(); | ||
132 | m_pending = Queue.Synchronized(m_pendingQ); | ||
133 | } | 150 | } |
134 | 151 | ||
135 | public void PostInitialise() | 152 | public void RegionLoaded(Scene scene) { } |
153 | |||
154 | public void RemoveRegion(Scene scene) | ||
136 | { | 155 | { |
156 | if (scene != m_scene) | ||
157 | return; | ||
158 | |||
159 | m_scene.UnregisterModuleInterface<IWorldComm>(this); | ||
160 | m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage; | ||
161 | m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage; | ||
137 | } | 162 | } |
138 | 163 | ||
139 | public void Close() | 164 | public void Close() |
@@ -145,10 +170,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
145 | get { return "WorldCommModule"; } | 170 | get { return "WorldCommModule"; } |
146 | } | 171 | } |
147 | 172 | ||
148 | public bool IsSharedModule | 173 | public Type ReplaceableInterface { get { return null; } } |
149 | { | ||
150 | get { return false; } | ||
151 | } | ||
152 | 174 | ||
153 | #endregion | 175 | #endregion |
154 | 176 | ||
@@ -257,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
257 | 279 | ||
258 | if ((source = m_scene.GetSceneObjectPart(id)) != null) | 280 | if ((source = m_scene.GetSceneObjectPart(id)) != null) |
259 | position = source.AbsolutePosition; | 281 | position = source.AbsolutePosition; |
260 | else if ((avatar = m_scene.GetScenePresence(id)) != null) | 282 | else if ((avatar = m_scene.GetScenePresence(id)) != null) |
261 | position = avatar.AbsolutePosition; | 283 | position = avatar.AbsolutePosition; |
262 | else if (ChatTypeEnum.Region == type) | 284 | else if (ChatTypeEnum.Region == type) |
263 | position = CenterOfRegion; | 285 | position = CenterOfRegion; |
@@ -280,7 +302,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
280 | /// <param name="name">name of sender (object or avatar)</param> | 302 | /// <param name="name">name of sender (object or avatar)</param> |
281 | /// <param name="id">key of sender (object or avatar)</param> | 303 | /// <param name="id">key of sender (object or avatar)</param> |
282 | /// <param name="msg">msg to sent</param> | 304 | /// <param name="msg">msg to sent</param> |
283 | public void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg, Vector3 position) | 305 | public void DeliverMessage(ChatTypeEnum type, int channel, |
306 | string name, UUID id, string msg, Vector3 position) | ||
284 | { | 307 | { |
285 | // m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}", | 308 | // m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}", |
286 | // type, channel, name, id, msg); | 309 | // type, channel, name, id, msg); |
@@ -288,17 +311,21 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
288 | // Determine which listen event filters match the given set of arguments, this results | 311 | // Determine which listen event filters match the given set of arguments, this results |
289 | // in a limited set of listeners, each belonging a host. If the host is in range, add them | 312 | // in a limited set of listeners, each belonging a host. If the host is in range, add them |
290 | // to the pending queue. | 313 | // to the pending queue. |
291 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | 314 | foreach (ListenerInfo li |
315 | in m_listenerManager.GetListeners(UUID.Zero, channel, | ||
316 | name, id, msg)) | ||
292 | { | 317 | { |
293 | // Dont process if this message is from yourself! | 318 | // Dont process if this message is from yourself! |
294 | if (li.GetHostID().Equals(id)) | 319 | if (li.GetHostID().Equals(id)) |
295 | continue; | 320 | continue; |
296 | 321 | ||
297 | SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID()); | 322 | SceneObjectPart sPart = m_scene.GetSceneObjectPart( |
323 | li.GetHostID()); | ||
298 | if (sPart == null) | 324 | if (sPart == null) |
299 | continue; | 325 | continue; |
300 | 326 | ||
301 | double dis = Util.GetDistanceTo(sPart.AbsolutePosition, position); | 327 | double dis = Util.GetDistanceTo(sPart.AbsolutePosition, |
328 | position); | ||
302 | switch (type) | 329 | switch (type) |
303 | { | 330 | { |
304 | case ChatTypeEnum.Whisper: | 331 | case ChatTypeEnum.Whisper: |
@@ -400,11 +427,12 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
400 | if (li.GetHostID().Equals(id)) | 427 | if (li.GetHostID().Equals(id)) |
401 | continue; | 428 | continue; |
402 | 429 | ||
403 | SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID()); | 430 | SceneObjectPart sPart = m_scene.GetSceneObjectPart( |
431 | li.GetHostID()); | ||
404 | if (sPart == null) | 432 | if (sPart == null) |
405 | continue; | 433 | continue; |
406 | 434 | ||
407 | if ( li.GetHostID().Equals(target)) | 435 | if (li.GetHostID().Equals(target)) |
408 | { | 436 | { |
409 | QueueMessage(new ListenerInfo(li, name, id, msg)); | 437 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
410 | break; | 438 | break; |
@@ -458,9 +486,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
458 | private void DeliverClientMessage(Object sender, OSChatMessage e) | 486 | private void DeliverClientMessage(Object sender, OSChatMessage e) |
459 | { | 487 | { |
460 | if (null != e.Sender) | 488 | if (null != e.Sender) |
461 | DeliverMessage(e.Type, e.Channel, e.Sender.Name, e.Sender.AgentId, e.Message, e.Position); | 489 | { |
490 | DeliverMessage(e.Type, e.Channel, e.Sender.Name, | ||
491 | e.Sender.AgentId, e.Message, e.Position); | ||
492 | } | ||
462 | else | 493 | else |
463 | DeliverMessage(e.Type, e.Channel, e.From, UUID.Zero, e.Message, e.Position); | 494 | { |
495 | DeliverMessage(e.Type, e.Channel, e.From, UUID.Zero, | ||
496 | e.Message, e.Position); | ||
497 | } | ||
464 | } | 498 | } |
465 | 499 | ||
466 | public Object[] GetSerializationData(UUID itemID) | 500 | public Object[] GetSerializationData(UUID itemID) |
@@ -477,7 +511,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
477 | 511 | ||
478 | public class ListenerManager | 512 | public class ListenerManager |
479 | { | 513 | { |
480 | private Dictionary<int, List<ListenerInfo>> m_listeners = new Dictionary<int, List<ListenerInfo>>(); | 514 | private Dictionary<int, List<ListenerInfo>> m_listeners = |
515 | new Dictionary<int, List<ListenerInfo>>(); | ||
481 | private int m_maxlisteners; | 516 | private int m_maxlisteners; |
482 | private int m_maxhandles; | 517 | private int m_maxhandles; |
483 | private int m_curlisteners; | 518 | private int m_curlisteners; |
@@ -535,14 +570,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
535 | itemID, hostID, channel, name, id, msg, | 570 | itemID, hostID, channel, name, id, msg, |
536 | regexBitfield); | 571 | regexBitfield); |
537 | 572 | ||
538 | List<ListenerInfo> listeners; | 573 | List<ListenerInfo> listeners; |
539 | if (!m_listeners.TryGetValue(channel,out listeners)) | 574 | if (!m_listeners.TryGetValue( |
540 | { | 575 | channel, out listeners)) |
541 | listeners = new List<ListenerInfo>(); | 576 | { |
542 | m_listeners.Add(channel, listeners); | 577 | listeners = new List<ListenerInfo>(); |
543 | } | 578 | m_listeners.Add(channel, listeners); |
544 | listeners.Add(li); | 579 | } |
545 | m_curlisteners++; | 580 | listeners.Add(li); |
581 | m_curlisteners++; | ||
546 | 582 | ||
547 | return newHandle; | 583 | return newHandle; |
548 | } | 584 | } |
@@ -555,11 +591,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
555 | { | 591 | { |
556 | lock (m_listeners) | 592 | lock (m_listeners) |
557 | { | 593 | { |
558 | foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) | 594 | foreach (KeyValuePair<int, List<ListenerInfo>> lis |
595 | in m_listeners) | ||
559 | { | 596 | { |
560 | foreach (ListenerInfo li in lis.Value) | 597 | foreach (ListenerInfo li in lis.Value) |
561 | { | 598 | { |
562 | if (li.GetItemID().Equals(itemID) && li.GetHandle().Equals(handle)) | 599 | if (li.GetItemID().Equals(itemID) && |
600 | li.GetHandle().Equals(handle)) | ||
563 | { | 601 | { |
564 | lis.Value.Remove(li); | 602 | lis.Value.Remove(li); |
565 | if (lis.Value.Count == 0) | 603 | if (lis.Value.Count == 0) |
@@ -582,13 +620,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
582 | 620 | ||
583 | lock (m_listeners) | 621 | lock (m_listeners) |
584 | { | 622 | { |
585 | foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) | 623 | foreach (KeyValuePair<int, List<ListenerInfo>> lis |
624 | in m_listeners) | ||
586 | { | 625 | { |
587 | foreach (ListenerInfo li in lis.Value) | 626 | foreach (ListenerInfo li in lis.Value) |
588 | { | 627 | { |
589 | if (li.GetItemID().Equals(itemID)) | 628 | if (li.GetItemID().Equals(itemID)) |
590 | { | 629 | { |
591 | // store them first, else the enumerated bails on us | 630 | // store them first, else the enumerated bails on |
631 | // us | ||
592 | removedListeners.Add(li); | 632 | removedListeners.Add(li); |
593 | } | 633 | } |
594 | } | 634 | } |
@@ -615,11 +655,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
615 | { | 655 | { |
616 | lock (m_listeners) | 656 | lock (m_listeners) |
617 | { | 657 | { |
618 | foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) | 658 | foreach (KeyValuePair<int, List<ListenerInfo>> lis |
659 | in m_listeners) | ||
619 | { | 660 | { |
620 | foreach (ListenerInfo li in lis.Value) | 661 | foreach (ListenerInfo li in lis.Value) |
621 | { | 662 | { |
622 | if (li.GetItemID().Equals(itemID) && li.GetHandle() == handle) | 663 | if (li.GetItemID().Equals(itemID) && |
664 | li.GetHandle() == handle) | ||
623 | { | 665 | { |
624 | li.Activate(); | 666 | li.Activate(); |
625 | // only one, bail out | 667 | // only one, bail out |
@@ -634,11 +676,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
634 | { | 676 | { |
635 | lock (m_listeners) | 677 | lock (m_listeners) |
636 | { | 678 | { |
637 | foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) | 679 | foreach (KeyValuePair<int, List<ListenerInfo>> lis |
680 | in m_listeners) | ||
638 | { | 681 | { |
639 | foreach (ListenerInfo li in lis.Value) | 682 | foreach (ListenerInfo li in lis.Value) |
640 | { | 683 | { |
641 | if (li.GetItemID().Equals(itemID) && li.GetHandle() == handle) | 684 | if (li.GetItemID().Equals(itemID) && |
685 | li.GetHandle() == handle) | ||
642 | { | 686 | { |
643 | li.Deactivate(); | 687 | li.Deactivate(); |
644 | // only one, bail out | 688 | // only one, bail out |
@@ -649,19 +693,24 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
649 | } | 693 | } |
650 | } | 694 | } |
651 | 695 | ||
652 | // non-locked access, since its always called in the context of the lock | 696 | /// <summary> |
697 | /// non-locked access, since its always called in the context of the | ||
698 | /// lock | ||
699 | /// </summary> | ||
700 | /// <param name="itemID"></param> | ||
701 | /// <returns></returns> | ||
653 | private int GetNewHandle(UUID itemID) | 702 | private int GetNewHandle(UUID itemID) |
654 | { | 703 | { |
655 | List<int> handles = new List<int>(); | 704 | List<int> handles = new List<int>(); |
656 | 705 | ||
657 | // build a list of used keys for this specific itemID... | 706 | // build a list of used keys for this specific itemID... |
658 | foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) | 707 | foreach (KeyValuePair<int, List<ListenerInfo>> lis in m_listeners) |
659 | { | 708 | { |
660 | foreach (ListenerInfo li in lis.Value) | 709 | foreach (ListenerInfo li in lis.Value) |
661 | { | 710 | { |
662 | if (li.GetItemID().Equals(itemID)) | 711 | if (li.GetItemID().Equals(itemID)) |
663 | handles.Add(li.GetHandle()); | 712 | handles.Add(li.GetHandle()); |
664 | } | 713 | } |
665 | } | 714 | } |
666 | 715 | ||
667 | // Note: 0 is NOT a valid handle for llListen() to return | 716 | // Note: 0 is NOT a valid handle for llListen() to return |
@@ -690,17 +739,30 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
690 | 739 | ||
691 | #endregion | 740 | #endregion |
692 | 741 | ||
693 | // Theres probably a more clever and efficient way to | 742 | /// <summary> |
694 | // do this, maybe with regex. | 743 | /// Get listeners matching the input parameters. |
695 | // PM2008: Ha, one could even be smart and define a specialized Enumerator. | 744 | /// </summary> |
696 | public List<ListenerInfo> GetListeners(UUID itemID, int channel, string name, UUID id, string msg) | 745 | /// <remarks> |
746 | /// Theres probably a more clever and efficient way to do this, maybe | ||
747 | /// with regex. | ||
748 | /// PM2008: Ha, one could even be smart and define a specialized | ||
749 | /// Enumerator. | ||
750 | /// </remarks> | ||
751 | /// <param name="itemID"></param> | ||
752 | /// <param name="channel"></param> | ||
753 | /// <param name="name"></param> | ||
754 | /// <param name="id"></param> | ||
755 | /// <param name="msg"></param> | ||
756 | /// <returns></returns> | ||
757 | public List<ListenerInfo> GetListeners(UUID itemID, int channel, | ||
758 | string name, UUID id, string msg) | ||
697 | { | 759 | { |
698 | List<ListenerInfo> collection = new List<ListenerInfo>(); | 760 | List<ListenerInfo> collection = new List<ListenerInfo>(); |
699 | 761 | ||
700 | lock (m_listeners) | 762 | lock (m_listeners) |
701 | { | 763 | { |
702 | List<ListenerInfo> listeners; | 764 | List<ListenerInfo> listeners; |
703 | if (!m_listeners.TryGetValue(channel,out listeners)) | 765 | if (!m_listeners.TryGetValue(channel, out listeners)) |
704 | { | 766 | { |
705 | return collection; | 767 | return collection; |
706 | } | 768 | } |
@@ -711,7 +773,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
711 | { | 773 | { |
712 | continue; | 774 | continue; |
713 | } | 775 | } |
714 | if (!itemID.Equals(UUID.Zero) && !li.GetItemID().Equals(itemID)) | 776 | if (!itemID.Equals(UUID.Zero) && |
777 | !li.GetItemID().Equals(itemID)) | ||
715 | { | 778 | { |
716 | continue; | 779 | continue; |
717 | } | 780 | } |
@@ -776,28 +839,68 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
776 | lock (m_listeners) | 839 | lock (m_listeners) |
777 | { | 840 | { |
778 | if (!m_listeners.ContainsKey((int)item[2])) | 841 | if (!m_listeners.ContainsKey((int)item[2])) |
779 | m_listeners.Add((int)item[2], new List<ListenerInfo>()); | 842 | { |
843 | m_listeners.Add((int)item[2], | ||
844 | new List<ListenerInfo>()); | ||
845 | } | ||
780 | m_listeners[(int)item[2]].Add(info); | 846 | m_listeners[(int)item[2]].Add(info); |
781 | } | 847 | } |
782 | 848 | ||
783 | idx+=dataItemLength; | 849 | idx += dataItemLength; |
784 | } | 850 | } |
785 | } | 851 | } |
786 | } | 852 | } |
787 | 853 | ||
788 | public class ListenerInfo : IWorldCommListenerInfo | 854 | public class ListenerInfo : IWorldCommListenerInfo |
789 | { | 855 | { |
790 | private bool m_active; // Listener is active or not | 856 | /// <summary> |
791 | private int m_handle; // Assigned handle of this listener | 857 | /// Listener is active or not |
792 | private uint m_localID; // Local ID from script engine | 858 | /// </summary> |
793 | private UUID m_itemID; // ID of the host script engine | 859 | private bool m_active; |
794 | private UUID m_hostID; // ID of the host/scene part | 860 | |
795 | private int m_channel; // Channel | 861 | /// <summary> |
796 | private UUID m_id; // ID to filter messages from | 862 | /// Assigned handle of this listener |
797 | private string m_name; // Object name to filter messages from | 863 | /// </summary> |
798 | private string m_message; // The message | 864 | private int m_handle; |
799 | 865 | ||
800 | public ListenerInfo(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message) | 866 | /// <summary> |
867 | /// Local ID from script engine | ||
868 | /// </summary> | ||
869 | private uint m_localID; | ||
870 | |||
871 | /// <summary> | ||
872 | /// ID of the host script engine | ||
873 | /// </summary> | ||
874 | private UUID m_itemID; | ||
875 | |||
876 | /// <summary> | ||
877 | /// ID of the host/scene part | ||
878 | /// </summary> | ||
879 | private UUID m_hostID; | ||
880 | |||
881 | /// <summary> | ||
882 | /// Channel | ||
883 | /// </summary> | ||
884 | private int m_channel; | ||
885 | |||
886 | /// <summary> | ||
887 | /// ID to filter messages from | ||
888 | /// </summary> | ||
889 | private UUID m_id; | ||
890 | |||
891 | /// <summary> | ||
892 | /// Object name to filter messages from | ||
893 | /// </summary> | ||
894 | private string m_name; | ||
895 | |||
896 | /// <summary> | ||
897 | /// The message | ||
898 | /// </summary> | ||
899 | private string m_message; | ||
900 | |||
901 | public ListenerInfo(int handle, uint localID, UUID ItemID, | ||
902 | UUID hostID, int channel, string name, UUID id, | ||
903 | string message) | ||
801 | { | 904 | { |
802 | Initialise(handle, localID, ItemID, hostID, channel, name, id, | 905 | Initialise(handle, localID, ItemID, hostID, channel, name, id, |
803 | message, 0); | 906 | message, 0); |
@@ -811,17 +914,23 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
811 | message, regexBitfield); | 914 | message, regexBitfield); |
812 | } | 915 | } |
813 | 916 | ||
814 | public ListenerInfo(ListenerInfo li, string name, UUID id, string message) | 917 | public ListenerInfo(ListenerInfo li, string name, UUID id, |
918 | string message) | ||
815 | { | 919 | { |
816 | Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message, 0); | 920 | Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, |
921 | li.m_channel, name, id, message, 0); | ||
817 | } | 922 | } |
818 | 923 | ||
819 | public ListenerInfo(ListenerInfo li, string name, UUID id, string message, int regexBitfield) | 924 | public ListenerInfo(ListenerInfo li, string name, UUID id, |
925 | string message, int regexBitfield) | ||
820 | { | 926 | { |
821 | Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message, regexBitfield); | 927 | Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, |
928 | li.m_channel, name, id, message, regexBitfield); | ||
822 | } | 929 | } |
823 | 930 | ||
824 | private void Initialise(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message, int regexBitfield) | 931 | private void Initialise(int handle, uint localID, UUID ItemID, |
932 | UUID hostID, int channel, string name, UUID id, | ||
933 | string message, int regexBitfield) | ||
825 | { | 934 | { |
826 | m_active = true; | 935 | m_active = true; |
827 | m_handle = handle; | 936 | m_handle = handle; |
@@ -850,9 +959,12 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
850 | return data; | 959 | return data; |
851 | } | 960 | } |
852 | 961 | ||
853 | public static ListenerInfo FromData(uint localID, UUID ItemID, UUID hostID, Object[] data) | 962 | public static ListenerInfo FromData(uint localID, UUID ItemID, |
963 | UUID hostID, Object[] data) | ||
854 | { | 964 | { |
855 | ListenerInfo linfo = new ListenerInfo((int)data[1], localID, ItemID, hostID, (int)data[2], (string)data[3], (UUID)data[4], (string)data[5]); | 965 | ListenerInfo linfo = new ListenerInfo((int)data[1], localID, |
966 | ItemID, hostID, (int)data[2], (string)data[3], | ||
967 | (UUID)data[4], (string)data[5]); | ||
856 | linfo.m_active = (bool)data[0]; | 968 | linfo.m_active = (bool)data[0]; |
857 | if (data.Length >= 7) | 969 | if (data.Length >= 7) |
858 | { | 970 | { |