aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs29
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs32
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs32
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs54
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs35
-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
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs63
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs61
-rw-r--r--OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs55
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs32
17 files changed, 560 insertions, 218 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 35c59aa..6bbbd56 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
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;
@@ -38,7 +39,8 @@ using OpenSim.Services.Interfaces;
38 39
39namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory 40namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
40{ 41{
41 public class AvatarFactoryModule : IAvatarFactory, IRegionModule 42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
43 public class AvatarFactoryModule : IAvatarFactory, ISharedRegionModule
42 { 44 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 private Scene m_scene = null; 46 private Scene m_scene = null;
@@ -75,7 +77,16 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
75 return appearance; 77 return appearance;
76 } 78 }
77 79
78 public void Initialise(Scene scene, IConfigSource source) 80 public void Initialise(IConfigSource source)
81 {
82 }
83
84 public Type ReplaceableInterface
85 {
86 get { return null; }
87 }
88
89 public void AddRegion(Scene scene)
79 { 90 {
80 scene.RegisterModuleInterface<IAvatarFactory>(this); 91 scene.RegisterModuleInterface<IAvatarFactory>(this);
81 scene.EventManager.OnNewClient += NewClient; 92 scene.EventManager.OnNewClient += NewClient;
@@ -84,9 +95,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
84 { 95 {
85 m_scene = scene; 96 m_scene = scene;
86 } 97 }
98 }
87 99
100 public void RegionLoaded(Scene scene)
101 {
88 } 102 }
89 103
104 public void RemoveRegion(Scene scene)
105 {
106 scene.UnregisterModuleInterface<IAvatarFactory>(this);
107 scene.EventManager.OnNewClient -= NewClient;
108 }
109
90 public void PostInitialise() 110 public void PostInitialise()
91 { 111 {
92 } 112 }
@@ -100,11 +120,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
100 get { return "Default Avatar Factory"; } 120 get { return "Default Avatar Factory"; }
101 } 121 }
102 122
103 public bool IsSharedModule
104 {
105 get { return false; }
106 }
107
108 public void NewClient(IClientAPI client) 123 public void NewClient(IClientAPI client)
109 { 124 {
110 client.OnAvatarNowWearing += AvatarIsWearing; 125 client.OnAvatarNowWearing += AvatarIsWearing;
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index 61b6d65..b7d12aa 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Mono.Addins;
30using Nini.Config; 31using Nini.Config;
31using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
32using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
@@ -34,7 +35,8 @@ using OpenMetaverse;
34 35
35namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule 36namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
36{ 37{
37 public class CombatModule : IRegionModule 38 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
39 public class CombatModule : ISharedRegionModule
38 { 40 {
39 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 42
@@ -53,7 +55,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
53 /// </summary> 55 /// </summary>
54 /// <param name="scene"></param> 56 /// <param name="scene"></param>
55 /// <param name="config"></param> 57 /// <param name="config"></param>
56 public void Initialise(Scene scene, IConfigSource config) 58 public void Initialise(IConfigSource config)
59 {
60
61 }
62
63 public Type ReplaceableInterface
64 {
65 get { return null; }
66 }
67
68 public void AddRegion(Scene scene)
57 { 69 {
58 lock (m_scenel) 70 lock (m_scenel)
59 { 71 {
@@ -71,6 +83,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
71 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 83 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
72 } 84 }
73 85
86 public void RegionLoaded(Scene scene)
87 {
88 }
89
90 public void RemoveRegion(Scene scene)
91 {
92 scene.EventManager.OnAvatarKilled -= KillAvatar;
93 scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
94 m_scenel.Remove(scene.RegionInfo.RegionHandle);
95 }
96
74 public void PostInitialise() 97 public void PostInitialise()
75 { 98 {
76 } 99 }
@@ -84,11 +107,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
84 get { return "CombatModule"; } 107 get { return "CombatModule"; }
85 } 108 }
86 109
87 public bool IsSharedModule
88 {
89 get { return true; }
90 }
91
92 private void KillAvatar(uint killerObjectLocalID, ScenePresence DeadAvatar) 110 private void KillAvatar(uint killerObjectLocalID, ScenePresence DeadAvatar)
93 { 111 {
94 if (killerObjectLocalID == 0) 112 if (killerObjectLocalID == 0)
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index 72ec869..ecffc7a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -25,9 +25,11 @@
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 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using log4net; 31using log4net;
32using Mono.Addins;
31using Nini.Config; 33using Nini.Config;
32using OpenMetaverse; 34using OpenMetaverse;
33using OpenSim.Framework; 35using OpenSim.Framework;
@@ -37,28 +39,46 @@ using OpenSim.Region.Framework.Scenes;
37 39
38namespace OpenSim.Region.CoreModules.Avatar.Dialog 40namespace OpenSim.Region.CoreModules.Avatar.Dialog
39{ 41{
40 public class DialogModule : IRegionModule, IDialogModule 42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
43 public class DialogModule : ISharedRegionModule, IDialogModule
41 { 44 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 46
44 protected Scene m_scene; 47 protected Scene m_scene;
45 48
46 public void Initialise(Scene scene, IConfigSource source) 49 public void Initialise(IConfigSource source)
50 {
51 }
52
53 public Type ReplaceableInterface
54 {
55 get { return null; }
56 }
57
58 public void AddRegion(Scene scene)
47 { 59 {
48 m_scene = scene; 60 m_scene = scene;
49 m_scene.RegisterModuleInterface<IDialogModule>(this); 61 m_scene.RegisterModuleInterface<IDialogModule>(this);
50 62
51 m_scene.AddCommand( 63 m_scene.AddCommand(
52 this, "alert", "alert <first> <last> <message>", "Send an alert to a user", HandleAlertConsoleCommand); 64 this, "alert", "alert <first> <last> <message>", "Send an alert to a user", HandleAlertConsoleCommand);
53 65
54 m_scene.AddCommand( 66 m_scene.AddCommand(
55 this, "alert general", "alert general <message>", "Send an alert to everyone", HandleAlertConsoleCommand); 67 this, "alert general", "alert general <message>", "Send an alert to everyone", HandleAlertConsoleCommand);
56 } 68 }
57 69
58 public void PostInitialise() {} 70 public void RegionLoaded(Scene scene)
71 {
72 }
73
74 public void RemoveRegion(Scene scene)
75 {
76 scene.UnregisterModuleInterface<IDialogModule>(this);
77 }
78
79 public void PostInitialise() { }
59 public void Close() {} 80 public void Close() {}
60 public string Name { get { return "Dialog Module"; } } 81 public string Name { get { return "Dialog Module"; } }
61 public bool IsSharedModule { get { return false; } }
62 82
63 public void SendAlertToUser(IClientAPI client, string message) 83 public void SendAlertToUser(IClientAPI client, string message)
64 { 84 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 086d4fe..7254180 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using log4net; 33using log4net;
34using Mono.Addins;
34using Nini.Config; 35using Nini.Config;
35using Nwc.XmlRpc; 36using Nwc.XmlRpc;
36using OpenMetaverse; 37using OpenMetaverse;
@@ -81,7 +82,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
81 - Terminate Friendship messages (single) 82 - Terminate Friendship messages (single)
82 */ 83 */
83 84
84 public class FriendsModule : IRegionModule, IFriendsModule 85 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
86 public class FriendsModule : ISharedRegionModule, IFriendsModule
85 { 87 {
86 private class Transaction 88 private class Transaction
87 { 89 {
@@ -111,9 +113,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
111 113
112 private IGridService m_gridServices = null; 114 private IGridService m_gridServices = null;
113 115
114 #region IRegionModule Members 116 #region ISharedRegionModule Members
115 117
116 public void Initialise(Scene scene, IConfigSource config) 118 public void Initialise(IConfigSource config)
119 {
120
121 }
122
123 public void PostInitialise()
124 {
125 }
126
127 public Type ReplaceableInterface
128 {
129 get { return null; }
130 }
131
132 public void AddRegion(Scene scene)
117 { 133 {
118 lock (m_scenes) 134 lock (m_scenes)
119 { 135 {
@@ -128,9 +144,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
128 if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle)) 144 if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle))
129 m_scenes[scene.RegionInfo.RegionHandle] = scene; 145 m_scenes[scene.RegionInfo.RegionHandle] = scene;
130 } 146 }
131 147
132 scene.RegisterModuleInterface<IFriendsModule>(this); 148 scene.RegisterModuleInterface<IFriendsModule>(this);
133 149
134 scene.EventManager.OnNewClient += OnNewClient; 150 scene.EventManager.OnNewClient += OnNewClient;
135 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 151 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
136 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 152 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
@@ -138,29 +154,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
138 scene.EventManager.OnClientClosed += ClientClosed; 154 scene.EventManager.OnClientClosed += ClientClosed;
139 } 155 }
140 156
141 public void PostInitialise() 157 public void RegionLoaded(Scene scene)
142 { 158 {
143 if (m_scenes.Count > 0) 159 if (m_scenes.Count > 0)
144 { 160 {
145 m_TransferModule = m_initialScene.RequestModuleInterface<IMessageTransferModule>(); 161 m_TransferModule = scene.RequestModuleInterface<IMessageTransferModule>();
146 m_gridServices = m_initialScene.GridService; 162 m_gridServices = scene.GridService;
147 } 163 }
148 if (m_TransferModule == null) 164 if (m_TransferModule == null)
149 m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work"); 165 m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work");
150 } 166 }
151 167
152 public void Close() 168 public void RemoveRegion(Scene scene)
153 { 169 {
170 MainServer.Instance.RemoveXmlRPCHandler("presence_update_bulk");
171 MainServer.Instance.RemoveXmlRPCHandler("terminate_friend");
172
173 if (m_scenes.ContainsKey(scene.RegionInfo.RegionHandle))
174 m_scenes.Remove(scene.RegionInfo.RegionHandle);
175
176 scene.UnregisterModuleInterface<IFriendsModule>(this);
177
178 scene.EventManager.OnNewClient -= OnNewClient;
179 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
180 scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
181 scene.EventManager.OnMakeChildAgent -= MakeChildAgent;
182 scene.EventManager.OnClientClosed -= ClientClosed;
154 } 183 }
155 184
156 public string Name 185 public void Close()
157 { 186 {
158 get { return "FriendsModule"; }
159 } 187 }
160 188
161 public bool IsSharedModule 189 public string Name
162 { 190 {
163 get { return true; } 191 get { return "FriendsModule"; }
164 } 192 }
165 193
166 #endregion 194 #endregion
diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
index 8ce5092..c306f94 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
@@ -25,8 +25,10 @@
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 27
28using System;
28using System.Reflection; 29using System.Reflection;
29using log4net; 30using log4net;
31using Mono.Addins;
30using Nini.Config; 32using Nini.Config;
31using OpenMetaverse; 33using OpenMetaverse;
32using OpenSim.Framework; 34using OpenSim.Framework;
@@ -37,23 +39,41 @@ using OpenSim.Services.Interfaces;
37 39
38namespace OpenSim.Region.CoreModules.Avatar.Gestures 40namespace OpenSim.Region.CoreModules.Avatar.Gestures
39{ 41{
40 public class GesturesModule : IRegionModule 42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
43 public class GesturesModule : INonSharedRegionModule
41 { 44 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 46
44 protected Scene m_scene; 47 protected Scene m_scene;
45 48
46 public void Initialise(Scene scene, IConfigSource source) 49 public void Initialise(IConfigSource source)
50 {
51 }
52
53 public Type ReplaceableInterface
54 {
55 get { return null; }
56 }
57
58 public void AddRegion(Scene scene)
47 { 59 {
48 m_scene = scene; 60 m_scene = scene;
49
50 m_scene.EventManager.OnNewClient += OnNewClient; 61 m_scene.EventManager.OnNewClient += OnNewClient;
51 } 62 }
63
64 public void RegionLoaded(Scene scene)
65 {
66 }
67
68 public void RemoveRegion(Scene scene)
69 {
70 if(m_scene == scene)
71 m_scene = null;
72 scene.EventManager.OnNewClient -= OnNewClient;
73 }
52 74
53 public void PostInitialise() {}
54 public void Close() {} 75 public void Close() {}
55 public string Name { get { return "Gestures Module"; } } 76 public string Name { get { return "Gestures Module"; } }
56 public bool IsSharedModule { get { return false; } }
57 77
58 private void OnNewClient(IClientAPI client) 78 private void OnNewClient(IClientAPI client)
59 { 79 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index 50171a3..3914f2e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -25,7 +25,9 @@
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 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
30using Mono.Addins;
29using Nini.Config; 31using Nini.Config;
30using OpenMetaverse; 32using OpenMetaverse;
31using OpenSim.Framework; 33using OpenSim.Framework;
@@ -34,7 +36,8 @@ using OpenSim.Region.Framework.Interfaces;
34 36
35namespace OpenSim.Region.CoreModules.Avatar.Gods 37namespace OpenSim.Region.CoreModules.Avatar.Gods
36{ 38{
37 public class GodsModule : IRegionModule, IGodsModule 39 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
40 public class GodsModule : INonSharedRegionModule, IGodsModule
38 { 41 {
39 /// <summary>Special UUID for actions that apply to all agents</summary> 42 /// <summary>Special UUID for actions that apply to all agents</summary>
40 private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); 43 private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb");
@@ -42,17 +45,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
42 protected Scene m_scene; 45 protected Scene m_scene;
43 protected IDialogModule m_dialogModule; 46 protected IDialogModule m_dialogModule;
44 47
45 public void Initialise(Scene scene, IConfigSource source) 48 public void Initialise(IConfigSource source)
49 {
50
51 }
52
53 public Type ReplaceableInterface
54 {
55 get { return null; }
56 }
57
58 public void AddRegion(Scene scene)
46 { 59 {
47 m_scene = scene; 60 m_scene = scene;
48 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); 61 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
49 m_scene.RegisterModuleInterface<IGodsModule>(this); 62 m_scene.RegisterModuleInterface<IGodsModule>(this);
50 } 63 }
64
65 public void RegionLoaded(Scene scene)
66 {
67 }
68
69 public void RemoveRegion(Scene scene)
70 {
71 scene.UnregisterModuleInterface<IGodsModule>(this);
72 }
51 73
52 public void PostInitialise() {}
53 public void Close() {} 74 public void Close() {}
54 public string Name { get { return "Gods Module"; } } 75 public string Name { get { return "Gods Module"; } }
55 public bool IsSharedModule { get { return false; } }
56 76
57 public void RequestGodlikePowers( 77 public void RequestGodlikePowers(
58 UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) 78 UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient)
diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
index 31363e5..7ff8d30 100644
--- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
@@ -25,9 +25,11 @@
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 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using log4net; 31using log4net;
32using Mono.Addins;
31using Nini.Config; 33using Nini.Config;
32using OpenMetaverse; 34using OpenMetaverse;
33using OpenSim.Framework; 35using OpenSim.Framework;
@@ -36,7 +38,8 @@ using OpenSim.Region.Framework.Scenes;
36 38
37namespace OpenSim.Region.CoreModules.Avatar.Groups 39namespace OpenSim.Region.CoreModules.Avatar.Groups
38{ 40{
39 public class GroupsModule : IRegionModule 41 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
42 public class GroupsModule : ISharedRegionModule
40 { 43 {
41 private static readonly ILog m_log = 44 private static readonly ILog m_log =
42 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -55,9 +58,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
55 private static GroupMembershipData osGroup = 58 private static GroupMembershipData osGroup =
56 new GroupMembershipData(); 59 new GroupMembershipData();
57 60
58 #region IRegionModule Members 61 #region ISharedRegionModule Members
59 62
60 public void Initialise(Scene scene, IConfigSource config) 63 public void Initialise(IConfigSource config)
61 { 64 {
62 IConfig groupsConfig = config.Configs["Groups"]; 65 IConfig groupsConfig = config.Configs["Groups"];
63 66
@@ -76,7 +79,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
76 if (groupsConfig.GetString("Module", "Default") != "Default") 79 if (groupsConfig.GetString("Module", "Default") != "Default")
77 return; 80 return;
78 } 81 }
82 }
83
84 public Type ReplaceableInterface
85 {
86 get { return null; }
87 }
79 88
89 public void AddRegion(Scene scene)
90 {
80 lock (m_SceneList) 91 lock (m_SceneList)
81 { 92 {
82 if (!m_SceneList.Contains(scene)) 93 if (!m_SceneList.Contains(scene))
@@ -99,6 +110,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
99 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 110 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
100 } 111 }
101 112
113 public void RegionLoaded(Scene scene)
114 {
115 }
116
117 public void RemoveRegion(Scene scene)
118 {
119 if (m_SceneList.Contains(scene))
120 m_SceneList.Remove(scene);
121 scene.EventManager.OnNewClient -= OnNewClient;
122 scene.EventManager.OnClientClosed -= OnClientClosed;
123 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
124 }
125
102 public void PostInitialise() 126 public void PostInitialise()
103 { 127 {
104 } 128 }
@@ -123,11 +147,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
123 get { return "GroupsModule"; } 147 get { return "GroupsModule"; }
124 } 148 }
125 149
126 public bool IsSharedModule
127 {
128 get { return true; }
129 }
130
131 #endregion 150 #endregion
132 151
133 private void OnNewClient(IClientAPI client) 152 private void OnNewClient(IClientAPI client)
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)
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index ecd60bd..a04ab22 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenSim.Framework; 36using OpenSim.Framework;
@@ -41,10 +42,11 @@ using OpenSim.Services.Interfaces;
41 42
42namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver 43namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
43{ 44{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
44 /// <summary> 46 /// <summary>
45 /// This module loads and saves OpenSimulator inventory archives 47 /// This module loads and saves OpenSimulator inventory archives
46 /// </summary> 48 /// </summary>
47 public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule 49 public class InventoryArchiverModule : ISharedRegionModule, IInventoryArchiverModule
48 { 50 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 52
@@ -82,18 +84,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
82 DisablePresenceChecks = disablePresenceChecks; 84 DisablePresenceChecks = disablePresenceChecks;
83 } 85 }
84 86
85 public void Initialise(Scene scene, IConfigSource source) 87 public void Initialise(IConfigSource source)
88 {
89
90 }
91
92 public Type ReplaceableInterface
93 {
94 get { return null; }
95 }
96
97 public void AddRegion(Scene scene)
86 { 98 {
87 if (m_scenes.Count == 0) 99 if (m_scenes.Count == 0)
88 { 100 {
89 scene.RegisterModuleInterface<IInventoryArchiverModule>(this); 101 scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
90 OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; 102 OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
91 103
92 scene.AddCommand( 104 scene.AddCommand(
93 this, "load iar", 105 this, "load iar",
94 "load iar <first> <last> <inventory path> <password> [<archive path>]", 106 "load iar <first> <last> <inventory path> <password> [<archive path>]",
95 "Load user inventory archive.", HandleLoadInvConsoleCommand); 107 "Load user inventory archive.", HandleLoadInvConsoleCommand);
96 108
97 scene.AddCommand( 109 scene.AddCommand(
98 this, "save iar", 110 this, "save iar",
99 "save iar <first> <last> <inventory path> <password> [<archive path>]", 111 "save iar <first> <last> <inventory path> <password> [<archive path>]",
@@ -101,10 +113,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
101 113
102 m_aScene = scene; 114 m_aScene = scene;
103 } 115 }
104 116
105 m_scenes[scene.RegionInfo.RegionID] = scene; 117 m_scenes[scene.RegionInfo.RegionID] = scene;
106 } 118 }
107 119
120 public void RegionLoaded(Scene scene)
121 {
122 }
123
124 public void RemoveRegion(Scene scene)
125 {
126 scene.UnregisterModuleInterface<IInventoryArchiverModule>(this);
127 if(m_scenes.ContainsKey(scene.RegionInfo.RegionID))
128 m_scenes.Remove(scene.RegionInfo.RegionID);
129 }
130
108 public void PostInitialise() {} 131 public void PostInitialise() {}
109 132
110 public void Close() {} 133 public void Close() {}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index d9a021f..44906b4 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Mono.Addins;
32using Nini.Config; 33using Nini.Config;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenSim.Framework; 35using OpenSim.Framework;
@@ -39,7 +40,8 @@ using OpenSim.Services.Interfaces;
39 40
40namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer 41namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
41{ 42{
42 public class InventoryTransferModule : IInventoryTransferModule, IRegionModule 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
44 public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule
43 { 45 {
44 private static readonly ILog m_log 46 private static readonly ILog m_log
45 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -50,10 +52,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
50 new Dictionary<UUID, Scene>(); 52 new Dictionary<UUID, Scene>();
51 53
52 private IMessageTransferModule m_TransferModule = null; 54 private IMessageTransferModule m_TransferModule = null;
55 private bool m_enabled = true;
53 56
54 #region IRegionModule Members 57 #region ISharedRegionModule Members
55 58
56 public void Initialise(Scene scene, IConfigSource config) 59 public void Initialise(IConfigSource config)
57 { 60 {
58 if (config.Configs["Messaging"] != null) 61 if (config.Configs["Messaging"] != null)
59 { 62 {
@@ -62,31 +65,61 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
62 if (config.Configs["Messaging"].GetString( 65 if (config.Configs["Messaging"].GetString(
63 "InventoryTransferModule", "InventoryTransferModule") != 66 "InventoryTransferModule", "InventoryTransferModule") !=
64 "InventoryTransferModule") 67 "InventoryTransferModule")
65 return; 68 m_enabled = false;
66 } 69 }
70 }
71
72 public Type ReplaceableInterface
73 {
74 get { return null; }
75 }
67 76
68 if (!m_Scenelist.Contains(scene)) 77 public void AddRegion(Scene scene)
78 {
79 if (m_enabled)
69 { 80 {
70 m_Scenelist.Add(scene); 81 if (!m_Scenelist.Contains(scene))
82 {
83 m_Scenelist.Add(scene);
71 84
72 scene.RegisterModuleInterface<IInventoryTransferModule>(this); 85 scene.RegisterModuleInterface<IInventoryTransferModule>(this);
73 86
74 scene.EventManager.OnNewClient += OnNewClient; 87 scene.EventManager.OnNewClient += OnNewClient;
75 scene.EventManager.OnClientClosed += ClientLoggedOut; 88 scene.EventManager.OnClientClosed += ClientLoggedOut;
76 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 89 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
90 }
77 } 91 }
78 } 92 }
79 93
80 public void PostInitialise() 94 public void RegionLoaded(Scene scene)
81 { 95 {
82 if (m_Scenelist.Count > 0) 96 if (m_enabled)
83 { 97 {
84 m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>(); 98 if (m_Scenelist.Count > 0)
85 if (m_TransferModule == null) 99 {
86 m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only"); 100 m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>();
101 if (m_TransferModule == null)
102 m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only");
103 }
87 } 104 }
88 } 105 }
89 106
107 public void RemoveRegion(Scene scene)
108 {
109 if (m_Scenelist.Contains(scene))
110 m_Scenelist.Remove(scene);
111
112 scene.UnregisterModuleInterface<IInventoryTransferModule>(this);
113
114 scene.EventManager.OnNewClient -= OnNewClient;
115 scene.EventManager.OnClientClosed -= ClientLoggedOut;
116 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
117 }
118
119 public void PostInitialise()
120 {
121 }
122
90 public void Close() 123 public void Close()
91 { 124 {
92 } 125 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
index 261bd6c..973d27f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Mono.Addins;
32using Nini.Config; 33using Nini.Config;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenSim.Framework; 35using OpenSim.Framework;
@@ -37,36 +38,72 @@ using OpenSim.Region.Framework.Scenes;
37 38
38namespace OpenSim.Region.CoreModules.Avatar.Lure 39namespace OpenSim.Region.CoreModules.Avatar.Lure
39{ 40{
40 public class LureModule : IRegionModule 41 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
42 public class LureModule : ISharedRegionModule
41 { 43 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 45
44 private readonly List<Scene> m_scenes = new List<Scene>(); 46 private readonly List<Scene> m_scenes = new List<Scene>();
45 47
48 private bool m_enabled = true;
49
46 private IMessageTransferModule m_TransferModule = null; 50 private IMessageTransferModule m_TransferModule = null;
47 51
48 public void Initialise(Scene scene, IConfigSource config) 52 public void Initialise(IConfigSource config)
49 { 53 {
50 if (config.Configs["Messaging"] != null) 54 if (config.Configs["Messaging"] != null)
51 { 55 {
52 if (config.Configs["Messaging"].GetString( 56 if (config.Configs["Messaging"].GetString(
53 "LureModule", "LureModule") != 57 "LureModule", "LureModule") !=
54 "LureModule") 58 "LureModule")
55 return; 59 m_enabled = false;
56 } 60 }
61 }
62
63 public Type ReplaceableInterface
64 {
65 get { return null; }
66 }
57 67
58 lock (m_scenes) 68 public void AddRegion(Scene scene)
69 {
70 if (m_enabled)
59 { 71 {
60 if (!m_scenes.Contains(scene)) 72 lock (m_scenes)
61 { 73 {
62 m_scenes.Add(scene); 74 if (!m_scenes.Contains(scene))
63 scene.EventManager.OnNewClient += OnNewClient; 75 {
64 scene.EventManager.OnIncomingInstantMessage += 76 m_scenes.Add(scene);
65 OnGridInstantMessage; 77 scene.EventManager.OnNewClient += OnNewClient;
78 scene.EventManager.OnIncomingInstantMessage +=
79 OnGridInstantMessage;
80 }
66 } 81 }
67 } 82 }
68 } 83 }
69 84
85 public void RegionLoaded(Scene scene)
86 {
87 if (m_enabled)
88 {
89 m_TransferModule =
90 m_scenes[0].RequestModuleInterface<IMessageTransferModule>();
91
92 if (m_TransferModule == null)
93 m_log.Error("[INSTANT MESSAGE]: No message transfer module, " +
94 "lures will not work!");
95 }
96 }
97
98 public void RemoveRegion(Scene scene)
99 {
100 if (m_scenes.Contains(scene))
101 m_scenes.Remove(scene);
102 scene.EventManager.OnNewClient -= OnNewClient;
103 scene.EventManager.OnIncomingInstantMessage -=
104 OnGridInstantMessage;
105 }
106
70 void OnNewClient(IClientAPI client) 107 void OnNewClient(IClientAPI client)
71 { 108 {
72 client.OnInstantMessage += OnInstantMessage; 109 client.OnInstantMessage += OnInstantMessage;
@@ -76,12 +113,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
76 113
77 public void PostInitialise() 114 public void PostInitialise()
78 { 115 {
79 m_TransferModule =
80 m_scenes[0].RequestModuleInterface<IMessageTransferModule>();
81
82 if (m_TransferModule == null)
83 m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+
84 "lures will not work!");
85 } 116 }
86 117
87 public void Close() 118 public void Close()
diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
index 63a93aa..748b42c 100644
--- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
+++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Mono.Addins;
32using Nini.Config; 33using Nini.Config;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenMetaverse.StructuredData; 35using OpenMetaverse.StructuredData;
@@ -41,24 +42,54 @@ using Caps=OpenSim.Framework.Capabilities.Caps;
41 42
42namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps 43namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
43{ 44{
44 public class ObjectAdd : IRegionModule 45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
46 public class ObjectAdd : ISharedRegionModule
45 { 47 {
46 private static readonly ILog m_log = 48 private static readonly ILog m_log =
47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 private Scene m_scene; 50 private Scene m_scene;
49 #region IRegionModule Members 51 #region ISharedRegionModule Members
50 52
51 public void Initialise(Scene pScene, IConfigSource pSource) 53 public void Initialise(IConfigSource pSource)
52 { 54 {
53 m_scene = pScene; 55
56 }
57
58 public Type ReplaceableInterface
59 {
60 get { return null; }
61 }
62
63 public void AddRegion(Scene scene)
64 {
65 m_scene = scene;
54 m_scene.EventManager.OnRegisterCaps += RegisterCaps; 66 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
55 } 67 }
56 68
69 public void RegionLoaded(Scene scene)
70 {
71 }
72
73 public void RemoveRegion(Scene scene)
74 {
75 scene.EventManager.OnRegisterCaps -= RegisterCaps;
76 }
77
57 public void PostInitialise() 78 public void PostInitialise()
58 { 79 {
59 80
60 } 81 }
61 82
83 public void Close()
84 {
85
86 }
87
88 public string Name
89 {
90 get { return "ObjectAddModule"; }
91 }
92
62 public void RegisterCaps(UUID agentID, Caps caps) 93 public void RegisterCaps(UUID agentID, Caps caps)
63 { 94 {
64 UUID capuuid = UUID.Random(); 95 UUID capuuid = UUID.Random();
@@ -348,22 +379,6 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
348 Array.Reverse(resultbytes); 379 Array.Reverse(resultbytes);
349 return String.Format("<binary encoding=\"base64\">{0}</binary>",Convert.ToBase64String(resultbytes)); 380 return String.Format("<binary encoding=\"base64\">{0}</binary>",Convert.ToBase64String(resultbytes));
350 } 381 }
351
352 public void Close()
353 {
354
355 }
356
357 public string Name
358 {
359 get { return "ObjectAddModule"; }
360 }
361
362 public bool IsSharedModule
363 {
364 get { return false; }
365 }
366
367 #endregion 382 #endregion
368 } 383 }
369} 384}
diff --git a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs
index 8cf58c6..7fcb0e1 100644
--- a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.Globalization; 30using System.Globalization;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenSim.Framework; 36using OpenSim.Framework;
@@ -38,20 +39,17 @@ using OpenSim.Region.Framework.Scenes;
38 39
39namespace OpenSim.Region.CoreModules.Avatar.Profiles 40namespace OpenSim.Region.CoreModules.Avatar.Profiles
40{ 41{
41 public class AvatarProfilesModule : IRegionModule 42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
43 public class AvatarProfilesModule : INonSharedRegionModule
42 { 44 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 private Scene m_scene; 46 private Scene m_scene;
45 private IProfileModule m_profileModule = null; 47 private IProfileModule m_profileModule = null;
46 private bool m_enabled = true; 48 private bool m_enabled = true;
47 49
48 public AvatarProfilesModule() 50 #region INonSharedRegionModule Members
49 {
50 }
51 51
52 #region IRegionModule Members 52 public void Initialise(IConfigSource config)
53
54 public void Initialise(Scene scene, IConfigSource config)
55 { 53 {
56 IConfig profileConfig = config.Configs["Profile"]; 54 IConfig profileConfig = config.Configs["Profile"];
57 if (profileConfig != null) 55 if (profileConfig != null)
@@ -62,30 +60,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles
62 return; 60 return;
63 } 61 }
64 } 62 }
63 }
64
65 public Type ReplaceableInterface
66 {
67 get { return null; }
68 }
65 69
70 public void AddRegion(Scene scene)
71 {
66 m_scene = scene; 72 m_scene = scene;
67 m_scene.EventManager.OnNewClient += NewClient; 73 m_scene.EventManager.OnNewClient += NewClient;
68 } 74 }
69 75
70 public void PostInitialise() 76 public void RegionLoaded(Scene scene)
71 { 77 {
72 if (!m_enabled) 78 if (!m_enabled)
73 return; 79 return;
74 m_profileModule = m_scene.RequestModuleInterface<IProfileModule>(); 80 m_profileModule = m_scene.RequestModuleInterface<IProfileModule>();
75 } 81 }
76 82
77 public void Close() 83 public void RemoveRegion(Scene scene)
78 { 84 {
85 scene.EventManager.OnNewClient -= NewClient;
79 } 86 }
80 87
81 public string Name 88 public void Close()
82 { 89 {
83 get { return "AvatarProfilesModule"; }
84 } 90 }
85 91
86 public bool IsSharedModule 92 public string Name
87 { 93 {
88 get { return false; } 94 get { return "AvatarProfilesModule"; }
89 } 95 }
90 96
91 #endregion 97 #endregion