aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/InstantMessage
diff options
context:
space:
mode:
authorRevolution2010-01-22 18:09:33 -0600
committerMelanie2010-01-23 15:18:52 +0000
commitec3c31e61e5e540f822891110df9bc978655bbaf (patch)
treeb0b34a239eab48e163a3ca064edcd7567948423c /OpenSim/Region/CoreModules/Avatar/InstantMessage
parentadd a target position to agent updates to ScenePresence to support alternativ... (diff)
downloadopensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.zip
opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.gz
opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.bz2
opensim-SC_OLD-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.xz
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/InstantMessage')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs53
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs54
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs48
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs76
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs61
5 files changed, 193 insertions, 99 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
index 9a68749..e1bde4b 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -24,9 +24,12 @@
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;
27using System.Collections.Generic; 29using System.Collections.Generic;
28using System.Reflection; 30using System.Reflection;
29using log4net; 31using log4net;
32using Mono.Addins;
30using Nini.Config; 33using Nini.Config;
31using OpenMetaverse; 34using OpenMetaverse;
32using OpenSim.Framework; 35using OpenSim.Framework;
@@ -36,7 +39,8 @@ using OpenSim.Region.Framework.Scenes;
36 39
37namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 40namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
38{ 41{
39 public class InstantMessageModule : IRegionModule 42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
43 public class InstantMessageModule : ISharedRegionModule
40 { 44 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 46
@@ -47,11 +51,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
47 51
48 private readonly List<Scene> m_scenes = new List<Scene>(); 52 private readonly List<Scene> m_scenes = new List<Scene>();
49 53
50 #region IRegionModule Members 54 #region ISharedRegionModule Members
51 55
52 private IMessageTransferModule m_TransferModule = null; 56 private IMessageTransferModule m_TransferModule = null;
53 57
54 public void Initialise(Scene scene, IConfigSource config) 58 public void Initialise(IConfigSource config)
55 { 59 {
56 if (config.Configs["Messaging"] != null) 60 if (config.Configs["Messaging"] != null)
57 { 61 {
@@ -62,7 +66,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
62 } 66 }
63 67
64 m_enabled = true; 68 m_enabled = true;
69 }
70
71 public Type ReplaceableInterface
72 {
73 get { return null; }
74 }
65 75
76 public void AddRegion(Scene scene)
77 {
66 lock (m_scenes) 78 lock (m_scenes)
67 { 79 {
68 if (!m_scenes.Contains(scene)) 80 if (!m_scenes.Contains(scene))
@@ -74,6 +86,27 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
74 } 86 }
75 } 87 }
76 88
89 public void RegionLoaded(Scene scene)
90 {
91 if (!m_enabled)
92 return;
93
94 m_TransferModule =
95 m_scenes[0].RequestModuleInterface<IMessageTransferModule>();
96
97 if (m_TransferModule == null)
98 m_log.Error("[INSTANT MESSAGE]: No message transfer module, " +
99 "IM will not work!");
100 }
101
102 public void RemoveRegion(Scene scene)
103 {
104 if (m_scenes.Contains(scene))
105 m_scenes.Remove(scene);
106 scene.EventManager.OnClientConnect -= OnClientConnect;
107 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
108 }
109
77 void OnClientConnect(IClientCore client) 110 void OnClientConnect(IClientCore client)
78 { 111 {
79 IClientIM clientIM; 112 IClientIM clientIM;
@@ -85,15 +118,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
85 118
86 public void PostInitialise() 119 public void PostInitialise()
87 { 120 {
88 if (!m_enabled)
89 return;
90
91 m_TransferModule =
92 m_scenes[0].RequestModuleInterface<IMessageTransferModule>();
93
94 if (m_TransferModule == null)
95 m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+
96 "IM will not work!");
97 } 121 }
98 122
99 public void Close() 123 public void Close()
@@ -105,11 +129,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
105 get { return "InstantMessageModule"; } 129 get { return "InstantMessageModule"; }
106 } 130 }
107 131
108 public bool IsSharedModule
109 {
110 get { return true; }
111 }
112
113 #endregion 132 #endregion
114 133
115 public void OnInstantMessage(IClientAPI client, GridInstantMessage im) 134 public void OnInstantMessage(IClientAPI client, GridInstantMessage im)
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index e5159b3..16bdfdd 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
34using Nwc.XmlRpc; 35using Nwc.XmlRpc;
35using OpenMetaverse; 36using OpenMetaverse;
@@ -40,7 +41,8 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
40 41
41namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 42namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
42{ 43{
43 public class MessageTransferModule : IRegionModule, IMessageTransferModule 44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
45 public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule
44 { 46 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 48
@@ -50,8 +52,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
50 protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>(); 52 protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>();
51 53
52 public event UndeliveredMessage OnUndeliveredMessage; 54 public event UndeliveredMessage OnUndeliveredMessage;
55 private bool m_enabled = true;
53 56
54 public virtual void Initialise(Scene scene, IConfigSource config) 57 public virtual void Initialise(IConfigSource config)
55 { 58 {
56 IConfig cnf = config.Configs["Messaging"]; 59 IConfig cnf = config.Configs["Messaging"];
57 if (cnf != null && cnf.GetString( 60 if (cnf != null && cnf.GetString(
@@ -59,29 +62,51 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
59 "MessageTransferModule") 62 "MessageTransferModule")
60 { 63 {
61 m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration"); 64 m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration");
62 return; 65 m_enabled = false;
63 } 66 }
64 67
65 cnf = config.Configs["Startup"]; 68 cnf = config.Configs["Startup"];
66 if (cnf != null) 69 if (cnf != null)
67 m_Gridmode = cnf.GetBoolean("gridmode", false); 70 m_Gridmode = cnf.GetBoolean("gridmode", false);
71 }
68 72
69 // m_Enabled = true; 73 public Type ReplaceableInterface
74 {
75 get { return null; }
76 }
70 77
71 lock (m_Scenes) 78 public void AddRegion(Scene scene)
79 {
80 if (m_enabled)
72 { 81 {
73 if (m_Scenes.Count == 0) 82 lock (m_Scenes)
74 { 83 {
75 MainServer.Instance.AddXmlRPCHandler( 84 if (m_Scenes.Count == 0)
76 "grid_instant_message", processXMLRPCGridInstantMessage); 85 {
77 } 86 MainServer.Instance.AddXmlRPCHandler(
87 "grid_instant_message", processXMLRPCGridInstantMessage);
88 }
78 89
79 m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active"); 90 m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active");
80 scene.RegisterModuleInterface<IMessageTransferModule>(this); 91 scene.RegisterModuleInterface<IMessageTransferModule>(this);
81 m_Scenes.Add(scene); 92 m_Scenes.Add(scene);
93 }
82 } 94 }
83 } 95 }
84 96
97 public void RegionLoaded(Scene scene)
98 {
99 }
100
101 public void RemoveRegion(Scene scene)
102 {
103 if (m_Scenes.Contains(scene))
104 m_Scenes.Remove(scene);
105 MainServer.Instance.RemoveXmlRPCHandler(
106 "grid_instant_message");
107 scene.UnregisterModuleInterface<IMessageTransferModule>(this);
108 }
109
85 public virtual void PostInitialise() 110 public virtual void PostInitialise()
86 { 111 {
87 } 112 }
@@ -95,11 +120,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
95 get { return "MessageTransferModule"; } 120 get { return "MessageTransferModule"; }
96 } 121 }
97 122
98 public virtual bool IsSharedModule
99 {
100 get { return true; }
101 }
102
103 public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) 123 public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result)
104 { 124 {
105 UUID toAgentID = new UUID(im.toAgentID); 125 UUID toAgentID = new UUID(im.toAgentID);
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs
index 2d4a635..3570495 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs
@@ -28,6 +28,7 @@ using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection; 29using System.Reflection;
30using log4net; 30using log4net;
31using Mono.Addins;
31using Nini.Config; 32using Nini.Config;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -39,7 +40,8 @@ using OpenSim.Region.Framework.Scenes;
39 40
40namespace OpenSim.Region.CoreModules.Avatar.MuteList 41namespace OpenSim.Region.CoreModules.Avatar.MuteList
41{ 42{
42 public class MuteListModule : IRegionModule 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
44 public class MuteListModule : ISharedRegionModule
43 { 45 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 47
@@ -47,7 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList
47 private List<Scene> m_SceneList = new List<Scene>(); 49 private List<Scene> m_SceneList = new List<Scene>();
48 private string m_RestURL = String.Empty; 50 private string m_RestURL = String.Empty;
49 51
50 public void Initialise(Scene scene, IConfigSource config) 52 public void Initialise(IConfigSource config)
51 { 53 {
52 if (!enabled) 54 if (!enabled)
53 return; 55 return;
@@ -66,19 +68,24 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList
66 enabled = false; 68 enabled = false;
67 return; 69 return;
68 } 70 }
71 m_RestURL = cnf.GetString("MuteListURL", "");
72 if (m_RestURL == "")
73 {
74 m_log.Error("[MUTE LIST] Module was enabled, but no URL is given, disabling");
75 enabled = false;
76 return;
77 }
78 }
69 79
80 public Type ReplaceableInterface
81 {
82 get { return null; }
83 }
84
85 public void AddRegion(Scene scene)
86 {
70 lock (m_SceneList) 87 lock (m_SceneList)
71 { 88 {
72 if (m_SceneList.Count == 0)
73 {
74 m_RestURL = cnf.GetString("MuteListURL", "");
75 if (m_RestURL == "")
76 {
77 m_log.Error("[MUTE LIST] Module was enabled, but no URL is given, disabling");
78 enabled = false;
79 return;
80 }
81 }
82 if (!m_SceneList.Contains(scene)) 89 if (!m_SceneList.Contains(scene))
83 m_SceneList.Add(scene); 90 m_SceneList.Add(scene);
84 91
@@ -86,6 +93,18 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList
86 } 93 }
87 } 94 }
88 95
96 public void RegionLoaded(Scene scene)
97 {
98 }
99
100 public void RemoveRegion(Scene scene)
101 {
102 if (m_SceneList.Contains(scene))
103 m_SceneList.Remove(scene);
104
105 scene.EventManager.OnNewClient -= OnNewClient;
106 }
107
89 public void PostInitialise() 108 public void PostInitialise()
90 { 109 {
91 if (!enabled) 110 if (!enabled)
@@ -102,11 +121,6 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList
102 get { return "MuteListModule"; } 121 get { return "MuteListModule"; }
103 } 122 }
104 123
105 public bool IsSharedModule
106 {
107 get { return true; }
108 }
109
110 public void Close() 124 public void Close()
111 { 125 {
112 } 126 }
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index 450897c..6c4d0bf 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -28,6 +28,7 @@ using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection; 29using System.Reflection;
30using log4net; 30using log4net;
31using Mono.Addins;
31using Nini.Config; 32using Nini.Config;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -40,7 +41,8 @@ using OpenSim.Region.Framework.Scenes;
40 41
41namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 42namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
42{ 43{
43 public class OfflineMessageModule : IRegionModule 44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
45 public class OfflineMessageModule : ISharedRegionModule
44 { 46 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 48
@@ -49,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
49 private string m_RestURL = String.Empty; 51 private string m_RestURL = String.Empty;
50 private bool m_ForwardOfflineGroupMessages = true; 52 private bool m_ForwardOfflineGroupMessages = true;
51 53
52 public void Initialise(Scene scene, IConfigSource config) 54 public void Initialise(IConfigSource config)
53 { 55 {
54 if (!enabled) 56 if (!enabled)
55 return; 57 return;
@@ -83,14 +85,23 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
83 return; 85 return;
84 } 86 }
85 } 87 }
86 if (!m_SceneList.Contains(scene))
87 m_SceneList.Add(scene);
88
89 scene.EventManager.OnNewClient += OnNewClient;
90 } 88 }
91 } 89 }
92 90
93 public void PostInitialise() 91 public Type ReplaceableInterface
92 {
93 get { return null; }
94 }
95
96 public void AddRegion(Scene scene)
97 {
98 if (!m_SceneList.Contains(scene))
99 m_SceneList.Add(scene);
100
101 scene.EventManager.OnNewClient += OnNewClient;
102 }
103
104 public void RegionLoaded(Scene scene)
94 { 105 {
95 if (!enabled) 106 if (!enabled)
96 return; 107 return;
@@ -120,16 +131,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
120 m_log.Debug("[OFFLINE MESSAGING] Offline messages enabled"); 131 m_log.Debug("[OFFLINE MESSAGING] Offline messages enabled");
121 } 132 }
122 133
123 public string Name 134 public void RemoveRegion(Scene scene)
124 { 135 {
125 get { return "OfflineMessageModule"; } 136 if (m_SceneList.Contains(scene))
137 m_SceneList.Remove(scene);
138 scene.EventManager.OnNewClient -= OnNewClient;
126 } 139 }
127 140
128 public bool IsSharedModule 141 public void PostInitialise()
142 {
143 }
144
145 public string Name
129 { 146 {
130 get { return true; } 147 get { return "OfflineMessageModule"; }
131 } 148 }
132 149
133 public void Close() 150 public void Close()
134 { 151 {
135 } 152 }
@@ -163,24 +180,27 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
163 180
164 private void RetrieveInstantMessages(IClientAPI client) 181 private void RetrieveInstantMessages(IClientAPI client)
165 { 182 {
166 m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); 183 if (m_RestURL != "")
184 {
185 m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId);
167 186
168 List<GridInstantMessage>msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( 187 List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>(
169 "POST", m_RestURL+"/RetrieveMessages/", client.AgentId); 188 "POST", m_RestURL + "/RetrieveMessages/", client.AgentId);
170 189
171 foreach (GridInstantMessage im in msglist) 190 foreach (GridInstantMessage im in msglist)
172 { 191 {
173 // client.SendInstantMessage(im); 192 // client.SendInstantMessage(im);
174 193
175 // Send through scene event manager so all modules get a chance 194 // Send through scene event manager so all modules get a chance
176 // to look at this message before it gets delivered. 195 // to look at this message before it gets delivered.
177 // 196 //
178 // Needed for proper state management for stored group 197 // Needed for proper state management for stored group
179 // invitations 198 // invitations
180 // 199 //
181 Scene s = FindScene(client.AgentId); 200 Scene s = FindScene(client.AgentId);
182 if (s != null) 201 if (s != null)
183 s.EventManager.TriggerIncomingInstantMessage(im); 202 s.EventManager.TriggerIncomingInstantMessage(im);
203 }
184 } 204 }
185 } 205 }
186 206
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
index f5ab454..f5498f4 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
@@ -24,11 +24,14 @@
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;
27using System.Collections; 29using System.Collections;
28using System.Collections.Generic; 30using System.Collections.Generic;
29using System.Net; 31using System.Net;
30using System.Reflection; 32using System.Reflection;
31using log4net; 33using log4net;
34using Mono.Addins;
32using Nini.Config; 35using Nini.Config;
33using Nwc.XmlRpc; 36using Nwc.XmlRpc;
34using OpenMetaverse; 37using OpenMetaverse;
@@ -39,7 +42,8 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39 42
40namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 43namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
41{ 44{
42 public class PresenceModule : IRegionModule, IPresenceModule 45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
46 public class PresenceModule : ISharedRegionModule, IPresenceModule
43 { 47 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 49
@@ -59,7 +63,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
59 public event PresenceChange OnPresenceChange; 63 public event PresenceChange OnPresenceChange;
60 public event BulkPresenceData OnBulkPresenceData; 64 public event BulkPresenceData OnBulkPresenceData;
61 65
62 public void Initialise(Scene scene, IConfigSource config) 66 public void Initialise(IConfigSource config)
63 { 67 {
64 lock (m_Scenes) 68 lock (m_Scenes)
65 { 69 {
@@ -78,28 +82,38 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
78 m_Gridmode = cnf.GetBoolean("gridmode", false); 82 m_Gridmode = cnf.GetBoolean("gridmode", false);
79 83
80 m_Enabled = true; 84 m_Enabled = true;
81
82 m_initialScene = scene;
83 } 85 }
86 }
87 }
88
89 public Type ReplaceableInterface
90 {
91 get { return null; }
92 }
84 93
94 public void AddRegion(Scene scene)
95 {
96 if (m_Enabled)
97 {
98 m_initialScene = scene;
85 if (m_Gridmode) 99 if (m_Gridmode)
86 NotifyMessageServerOfStartup(scene); 100 NotifyMessageServerOfStartup(scene);
87 101
88 m_Scenes.Add(scene); 102 m_Scenes.Add(scene);
89 }
90 103
91 scene.RegisterModuleInterface<IPresenceModule>(this); 104 scene.RegisterModuleInterface<IPresenceModule>(this);
92 105
93 scene.EventManager.OnNewClient += OnNewClient; 106 scene.EventManager.OnNewClient += OnNewClient;
94 scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; 107 scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene;
95 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; 108 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
109 }
96 } 110 }
97 111
98 public void PostInitialise() 112 public void RegionLoaded(Scene scene)
99 { 113 {
100 } 114 }
101 115
102 public void Close() 116 public void RemoveRegion(Scene scene)
103 { 117 {
104 if (!m_Gridmode || !m_Enabled) 118 if (!m_Gridmode || !m_Enabled)
105 return; 119 return;
@@ -116,21 +130,28 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
116 } 130 }
117 } 131 }
118 132
119 lock (m_Scenes) 133 NotifyMessageServerOfShutdown(scene);
120 { 134 if(m_Scenes.Contains(scene))
121 foreach (Scene scene in m_Scenes) 135 m_Scenes.Remove(scene);
122 NotifyMessageServerOfShutdown(scene); 136
123 } 137 scene.UnregisterModuleInterface<IPresenceModule>(this);
138
139 scene.EventManager.OnNewClient -= OnNewClient;
140 scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene;
141 scene.EventManager.OnMakeChildAgent -= OnMakeChildAgent;
124 } 142 }
125 143
126 public string Name 144 public void PostInitialise()
127 { 145 {
128 get { return "PresenceModule"; }
129 } 146 }
130 147
131 public bool IsSharedModule 148 public void Close()
132 { 149 {
133 get { return true; } 150 }
151
152 public string Name
153 {
154 get { return "PresenceModule"; }
134 } 155 }
135 156
136 public void RequestBulkPresenceData(UUID[] users) 157 public void RequestBulkPresenceData(UUID[] users)