aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs61
1 files changed, 20 insertions, 41 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
index f5498f4..f5ab454 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
@@ -24,14 +24,11 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27
28using System;
29using System.Collections; 27using System.Collections;
30using System.Collections.Generic; 28using System.Collections.Generic;
31using System.Net; 29using System.Net;
32using System.Reflection; 30using System.Reflection;
33using log4net; 31using log4net;
34using Mono.Addins;
35using Nini.Config; 32using Nini.Config;
36using Nwc.XmlRpc; 33using Nwc.XmlRpc;
37using OpenMetaverse; 34using OpenMetaverse;
@@ -42,8 +39,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
42 39
43namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 40namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
44{ 41{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 42 public class PresenceModule : IRegionModule, IPresenceModule
46 public class PresenceModule : ISharedRegionModule, IPresenceModule
47 { 43 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 45
@@ -63,7 +59,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
63 public event PresenceChange OnPresenceChange; 59 public event PresenceChange OnPresenceChange;
64 public event BulkPresenceData OnBulkPresenceData; 60 public event BulkPresenceData OnBulkPresenceData;
65 61
66 public void Initialise(IConfigSource config) 62 public void Initialise(Scene scene, IConfigSource config)
67 { 63 {
68 lock (m_Scenes) 64 lock (m_Scenes)
69 { 65 {
@@ -82,38 +78,28 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
82 m_Gridmode = cnf.GetBoolean("gridmode", false); 78 m_Gridmode = cnf.GetBoolean("gridmode", false);
83 79
84 m_Enabled = true; 80 m_Enabled = true;
85 }
86 }
87 }
88 81
89 public Type ReplaceableInterface 82 m_initialScene = scene;
90 { 83 }
91 get { return null; }
92 }
93 84
94 public void AddRegion(Scene scene)
95 {
96 if (m_Enabled)
97 {
98 m_initialScene = scene;
99 if (m_Gridmode) 85 if (m_Gridmode)
100 NotifyMessageServerOfStartup(scene); 86 NotifyMessageServerOfStartup(scene);
101 87
102 m_Scenes.Add(scene); 88 m_Scenes.Add(scene);
89 }
103 90
104 scene.RegisterModuleInterface<IPresenceModule>(this); 91 scene.RegisterModuleInterface<IPresenceModule>(this);
105 92
106 scene.EventManager.OnNewClient += OnNewClient; 93 scene.EventManager.OnNewClient += OnNewClient;
107 scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; 94 scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene;
108 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; 95 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
109 }
110 } 96 }
111 97
112 public void RegionLoaded(Scene scene) 98 public void PostInitialise()
113 { 99 {
114 } 100 }
115 101
116 public void RemoveRegion(Scene scene) 102 public void Close()
117 { 103 {
118 if (!m_Gridmode || !m_Enabled) 104 if (!m_Gridmode || !m_Enabled)
119 return; 105 return;
@@ -130,28 +116,21 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
130 } 116 }
131 } 117 }
132 118
133 NotifyMessageServerOfShutdown(scene); 119 lock (m_Scenes)
134 if(m_Scenes.Contains(scene)) 120 {
135 m_Scenes.Remove(scene); 121 foreach (Scene scene in m_Scenes)
136 122 NotifyMessageServerOfShutdown(scene);
137 scene.UnregisterModuleInterface<IPresenceModule>(this); 123 }
138
139 scene.EventManager.OnNewClient -= OnNewClient;
140 scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene;
141 scene.EventManager.OnMakeChildAgent -= OnMakeChildAgent;
142 }
143
144 public void PostInitialise()
145 {
146 } 124 }
147 125
148 public void Close() 126 public string Name
149 { 127 {
128 get { return "PresenceModule"; }
150 } 129 }
151 130
152 public string Name 131 public bool IsSharedModule
153 { 132 {
154 get { return "PresenceModule"; } 133 get { return true; }
155 } 134 }
156 135
157 public void RequestBulkPresenceData(UUID[] users) 136 public void RequestBulkPresenceData(UUID[] users)