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.cs37
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs29
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs144
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs50
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs50
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs39
7 files changed, 292 insertions, 90 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index e3bf997..5b04a39 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -39,9 +39,12 @@ using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41 41
42using Mono.Addins;
43
42namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory 44namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
43{ 45{
44 public class AvatarFactoryModule : IAvatarFactoryModule, IRegionModule 46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
47 public class AvatarFactoryModule : IAvatarFactoryModule, INonSharedRegionModule
45 { 48 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 50
@@ -61,10 +64,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
61 64
62 #region IRegionModule 65 #region IRegionModule
63 66
64 public void Initialise(Scene scene, IConfigSource config) 67 public void Initialise(IConfigSource config)
65 { 68 {
66 scene.RegisterModuleInterface<IAvatarFactoryModule>(this);
67 scene.EventManager.OnNewClient += SubscribeToClientEvents;
68 69
69 IConfig appearanceConfig = config.Configs["Appearance"]; 70 IConfig appearanceConfig = config.Configs["Appearance"];
70 if (appearanceConfig != null) 71 if (appearanceConfig != null)
@@ -74,11 +75,29 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
74 // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); 75 // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime);
75 } 76 }
76 77
78 }
79
80 public void AddRegion(Scene scene)
81 {
77 if (m_scene == null) 82 if (m_scene == null)
78 m_scene = scene; 83 m_scene = scene;
84
85 scene.RegisterModuleInterface<IAvatarFactoryModule>(this);
86 scene.EventManager.OnNewClient += SubscribeToClientEvents;
79 } 87 }
80 88
81 public void PostInitialise() 89 public void RemoveRegion(Scene scene)
90 {
91 if (scene == m_scene)
92 {
93 scene.UnregisterModuleInterface<IAvatarFactoryModule>(this);
94 scene.EventManager.OnNewClient -= SubscribeToClientEvents;
95 }
96
97 m_scene = null;
98 }
99
100 public void RegionLoaded(Scene scene)
82 { 101 {
83 m_updateTimer.Enabled = false; 102 m_updateTimer.Enabled = false;
84 m_updateTimer.AutoReset = true; 103 m_updateTimer.AutoReset = true;
@@ -100,6 +119,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
100 get { return false; } 119 get { return false; }
101 } 120 }
102 121
122 public Type ReplaceableInterface
123 {
124 get { return null; }
125 }
126
127
103 private void SubscribeToClientEvents(IClientAPI client) 128 private void SubscribeToClientEvents(IClientAPI client)
104 { 129 {
105 client.OnRequestWearables += Client_OnRequestWearables; 130 client.OnRequestWearables += Client_OnRequestWearables;
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index 3a91465..c1a22bf 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -33,9 +33,12 @@ using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34using OpenMetaverse; 34using OpenMetaverse;
35 35
36using Mono.Addins;
37
36namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule 38namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
37{ 39{
38 public class CombatModule : IRegionModule 40 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
41 public class CombatModule : ISharedRegionModule
39 { 42 {
40 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 44
@@ -54,7 +57,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
54 /// </summary> 57 /// </summary>
55 /// <param name="scene"></param> 58 /// <param name="scene"></param>
56 /// <param name="config"></param> 59 /// <param name="config"></param>
57 public void Initialise(Scene scene, IConfigSource config) 60 public void Initialise(IConfigSource config)
61 {
62 }
63
64 public void AddRegion(Scene scene)
58 { 65 {
59 lock (m_scenel) 66 lock (m_scenel)
60 { 67 {
@@ -72,6 +79,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
72 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 79 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
73 } 80 }
74 81
82 public void RemoveRegion(Scene scene)
83 {
84 if (m_scenel.ContainsKey(scene.RegionInfo.RegionHandle))
85 m_scenel.Remove(scene.RegionInfo.RegionHandle);
86
87 scene.EventManager.OnAvatarKilled -= KillAvatar;
88 scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
89 }
90
91 public void RegionLoaded(Scene scene)
92 {
93 }
94
75 public void PostInitialise() 95 public void PostInitialise()
76 { 96 {
77 } 97 }
@@ -85,11 +105,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
85 get { return "CombatModule"; } 105 get { return "CombatModule"; }
86 } 106 }
87 107
88 public bool IsSharedModule 108 public Type ReplaceableInterface
89 { 109 {
90 get { return true; } 110 get { return null; }
91 } 111 }
92 112
113
93 private void KillAvatar(uint killerObjectLocalID, ScenePresence deadAvatar) 114 private void KillAvatar(uint killerObjectLocalID, ScenePresence deadAvatar)
94 { 115 {
95 string deadAvatarMessage; 116 string deadAvatarMessage;
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index 3c294bb..db5a788 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -32,6 +32,7 @@ using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using Mono.Addins;
35 36
36using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
@@ -39,16 +40,27 @@ using OpenSim.Services.Interfaces;
39 40
40namespace OpenSim.Region.CoreModules.Avatar.Dialog 41namespace OpenSim.Region.CoreModules.Avatar.Dialog
41{ 42{
42 public class DialogModule : IRegionModule, IDialogModule 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
43 { 44 public class DialogModule : IDialogModule, INonSharedRegionModule
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
46 protected Scene m_scene; 48 protected Scene m_scene;
47 49
48 public void Initialise(Scene scene, IConfigSource source) 50 public void Initialise(IConfigSource source) { }
51
52 public Type ReplaceableInterface { get { return null; } }
53
54 public void AddRegion(Scene scene)
49 { 55 {
50 m_scene = scene; 56 m_scene = scene;
51 m_scene.RegisterModuleInterface<IDialogModule>(this); 57 m_scene.RegisterModuleInterface<IDialogModule>(this);
58 }
59
60 public void RegionLoaded(Scene scene)
61 {
62 if (scene != m_scene)
63 return;
52 64
53 m_scene.AddCommand( 65 m_scene.AddCommand(
54 "Users", this, "alert", "alert <message>", 66 "Users", this, "alert", "alert <message>",
@@ -56,46 +68,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
56 HandleAlertConsoleCommand); 68 HandleAlertConsoleCommand);
57 69
58 m_scene.AddCommand( 70 m_scene.AddCommand(
59 "Users", this, "alert-user", "alert-user <first> <last> <message>", 71 "Users", this, "alert-user",
72 "alert-user <first> <last> <message>",
60 "Send an alert to a user", 73 "Send an alert to a user",
61 HandleAlertConsoleCommand); 74 HandleAlertConsoleCommand);
62 } 75 }
63 76
64 public void PostInitialise() {} 77 public void RemoveRegion(Scene scene)
65 public void Close() {} 78 {
79 if (scene != m_scene)
80 return;
81
82 m_scene.UnregisterModuleInterface<IDialogModule>(this);
83 }
84
85 public void Close() { }
66 public string Name { get { return "Dialog Module"; } } 86 public string Name { get { return "Dialog Module"; } }
67 public bool IsSharedModule { get { return false; } } 87
68
69 public void SendAlertToUser(IClientAPI client, string message) 88 public void SendAlertToUser(IClientAPI client, string message)
70 { 89 {
71 SendAlertToUser(client, message, false); 90 SendAlertToUser(client, message, false);
72 } 91 }
73 92
74 public void SendAlertToUser(IClientAPI client, string message, bool modal) 93 public void SendAlertToUser(IClientAPI client, string message,
94 bool modal)
75 { 95 {
76 client.SendAgentAlertMessage(message, modal); 96 client.SendAgentAlertMessage(message, modal);
77 } 97 }
78 98
79 public void SendAlertToUser(UUID agentID, string message) 99 public void SendAlertToUser(UUID agentID, string message)
80 { 100 {
81 SendAlertToUser(agentID, message, false); 101 SendAlertToUser(agentID, message, false);
82 } 102 }
83 103
84 public void SendAlertToUser(UUID agentID, string message, bool modal) 104 public void SendAlertToUser(UUID agentID, string message, bool modal)
85 { 105 {
86 ScenePresence sp = m_scene.GetScenePresence(agentID); 106 ScenePresence sp = m_scene.GetScenePresence(agentID);
87 107
88 if (sp != null) 108 if (sp != null)
89 sp.ControllingClient.SendAgentAlertMessage(message, modal); 109 sp.ControllingClient.SendAgentAlertMessage(message, modal);
90 } 110 }
91 111
92 public void SendAlertToUser(string firstName, string lastName, string message, bool modal) 112 public void SendAlertToUser(string firstName, string lastName,
113 string message, bool modal)
93 { 114 {
94 ScenePresence presence = m_scene.GetScenePresence(firstName, lastName); 115 ScenePresence presence = m_scene.GetScenePresence(firstName,
116 lastName);
95 if (presence != null) 117 if (presence != null)
96 presence.ControllingClient.SendAgentAlertMessage(message, modal); 118 {
119 presence.ControllingClient.SendAgentAlertMessage(message,
120 modal);
121 }
97 } 122 }
98 123
99 public void SendGeneralAlert(string message) 124 public void SendGeneralAlert(string message)
100 { 125 {
101 m_scene.ForEachRootClient(delegate(IClientAPI client) 126 m_scene.ForEachRootClient(delegate(IClientAPI client)
@@ -104,11 +129,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
104 }); 129 });
105 } 130 }
106 131
107 public void SendDialogToUser( 132 public void SendDialogToUser(UUID avatarID, string objectName,
108 UUID avatarID, string objectName, UUID objectID, UUID ownerID, 133 UUID objectID, UUID ownerID, string message, UUID textureID,
109 string message, UUID textureID, int ch, string[] buttonlabels) 134 int ch, string[] buttonlabels)
110 { 135 {
111 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerID); 136 UserAccount account = m_scene.UserAccountService.GetUserAccount(
137 m_scene.RegionInfo.ScopeID, ownerID);
112 string ownerFirstName, ownerLastName; 138 string ownerFirstName, ownerLastName;
113 if (account != null) 139 if (account != null)
114 { 140 {
@@ -123,29 +149,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
123 149
124 ScenePresence sp = m_scene.GetScenePresence(avatarID); 150 ScenePresence sp = m_scene.GetScenePresence(avatarID);
125 if (sp != null) 151 if (sp != null)
126 sp.ControllingClient.SendDialog( 152 {
127 objectName, objectID, ownerID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels); 153 sp.ControllingClient.SendDialog(objectName, objectID, ownerID,
154 ownerFirstName, ownerLastName, message, textureID, ch,
155 buttonlabels);
156 }
128 } 157 }
129 158
130 public void SendUrlToUser( 159 public void SendUrlToUser(UUID avatarID, string objectName,
131 UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url) 160 UUID objectID, UUID ownerID, bool groupOwned, string message,
161 string url)
132 { 162 {
133 ScenePresence sp = m_scene.GetScenePresence(avatarID); 163 ScenePresence sp = m_scene.GetScenePresence(avatarID);
134 164
135 if (sp != null) 165 if (sp != null)
136 sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); 166 {
167 sp.ControllingClient.SendLoadURL(objectName, objectID,
168 ownerID, groupOwned, message, url);
169 }
137 } 170 }
138 171
139 public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid) 172 public void SendTextBoxToUser(UUID avatarid, string message,
173 int chatChannel, string name, UUID objectid, UUID ownerid)
140 { 174 {
141 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); 175 UserAccount account = m_scene.UserAccountService.GetUserAccount(
176 m_scene.RegionInfo.ScopeID, ownerid);
142 string ownerFirstName, ownerLastName; 177 string ownerFirstName, ownerLastName;
143 UUID ownerID = UUID.Zero; 178 UUID ownerID = UUID.Zero;
144 if (account != null) 179 if (account != null)
145 { 180 {
146 ownerFirstName = account.FirstName; 181 ownerFirstName = account.FirstName;
147 ownerLastName = account.LastName; 182 ownerLastName = account.LastName;
148 ownerID = account.PrincipalID; 183 ownerID = account.PrincipalID;
149 } 184 }
150 else 185 else
151 { 186 {
@@ -154,29 +189,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
154 } 189 }
155 190
156 ScenePresence sp = m_scene.GetScenePresence(avatarid); 191 ScenePresence sp = m_scene.GetScenePresence(avatarid);
157 192
158 if (sp != null) 193 if (sp != null)
159 sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerID, ownerFirstName, ownerLastName, objectid); 194 {
195 sp.ControllingClient.SendTextBoxRequest(message, chatChannel,
196 name, ownerID, ownerFirstName, ownerLastName,
197 objectid);
198 }
160 } 199 }
161 200
162 public void SendNotificationToUsersInRegion( 201 public void SendNotificationToUsersInRegion(UUID fromAvatarID,
163 UUID fromAvatarID, string fromAvatarName, string message) 202 string fromAvatarName, string message)
164 { 203 {
165 m_scene.ForEachRootClient(delegate(IClientAPI client) 204 m_scene.ForEachRootClient(delegate(IClientAPI client)
166 { 205 {
167 client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); 206 client.SendBlueBoxMessage(fromAvatarID, fromAvatarName,
207 message);
168 }); 208 });
169 } 209 }
170 210
171 /// <summary> 211 /// <summary>
172 /// Handle an alert command from the console. 212 /// Handle an alert command from the console.
173 /// </summary> 213 /// </summary>
174 /// <param name="module"></param> 214 /// <param name="module"></param>
175 /// <param name="cmdparams"></param> 215 /// <param name="cmdparams"></param>
176 public void HandleAlertConsoleCommand(string module, string[] cmdparams) 216 public void HandleAlertConsoleCommand(string module,
217 string[] cmdparams)
177 { 218 {
178 if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) 219 if (m_scene.ConsoleScene() != null &&
220 m_scene.ConsoleScene() != m_scene)
221 {
179 return; 222 return;
223 }
180 224
181 string message = string.Empty; 225 string message = string.Empty;
182 226
@@ -184,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
184 { 228 {
185 message = CombineParams(cmdparams, 1); 229 message = CombineParams(cmdparams, 1);
186 m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}", 230 m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}",
187 m_scene.RegionInfo.RegionName, message); 231 m_scene.RegionInfo.RegionName, message);
188 SendGeneralAlert(message); 232 SendGeneralAlert(message);
189 } 233 }
190 else if (cmdparams.Length > 3) 234 else if (cmdparams.Length > 3)
@@ -192,9 +236,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
192 string firstName = cmdparams[1]; 236 string firstName = cmdparams[1];
193 string lastName = cmdparams[2]; 237 string lastName = cmdparams[2];
194 message = CombineParams(cmdparams, 3); 238 message = CombineParams(cmdparams, 3);
195 m_log.InfoFormat( 239 m_log.InfoFormat("[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}",
196 "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", 240 m_scene.RegionInfo.RegionName, firstName, lastName,
197 m_scene.RegionInfo.RegionName, firstName, lastName, message); 241 message);
198 SendAlertToUser(firstName, lastName, message, false); 242 SendAlertToUser(firstName, lastName, message, false);
199 } 243 }
200 else 244 else
@@ -212,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
212 { 256 {
213 result += commandParams[i] + " "; 257 result += commandParams[i] + " ";
214 } 258 }
215 259
216 return result; 260 return result;
217 } 261 }
218 } 262 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
index 7df2beb..de70dba 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
@@ -25,6 +25,7 @@
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;
30using Nini.Config; 31using Nini.Config;
@@ -35,26 +36,46 @@ using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
36using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
37 38
39using Mono.Addins;
40
38namespace OpenSim.Region.CoreModules.Avatar.Gestures 41namespace OpenSim.Region.CoreModules.Avatar.Gestures
39{ 42{
40 public class GesturesModule : IRegionModule 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
44 public class GesturesModule : INonSharedRegionModule
41 { 45 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 47
44 protected Scene m_scene; 48 protected Scene m_scene;
45 49
46 public void Initialise(Scene scene, IConfigSource source) 50 public void Initialise(IConfigSource source)
51 {
52 }
53
54 public void AddRegion(Scene scene)
47 { 55 {
48 m_scene = scene; 56 m_scene = scene;
49 57
50 m_scene.EventManager.OnNewClient += OnNewClient; 58 m_scene.EventManager.OnNewClient += OnNewClient;
51 } 59 }
60
61 public void RegionLoaded(Scene scene)
62 {
63 }
64
65 public void RemoveRegion(Scene scene)
66 {
67 m_scene.EventManager.OnNewClient -= OnNewClient;
68 m_scene = null;
69 }
52 70
53 public void PostInitialise() {}
54 public void Close() {} 71 public void Close() {}
55 public string Name { get { return "Gestures Module"; } } 72 public string Name { get { return "Gestures Module"; } }
56 public bool IsSharedModule { get { return false; } } 73
57 74 public Type ReplaceableInterface
75 {
76 get { return null; }
77 }
78
58 private void OnNewClient(IClientAPI client) 79 private void OnNewClient(IClientAPI client)
59 { 80 {
60 client.OnActivateGesture += ActivateGesture; 81 client.OnActivateGesture += ActivateGesture;
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index 82816d9..e7a9f53 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -25,6 +25,7 @@
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 Nini.Config; 30using Nini.Config;
30using OpenMetaverse; 31using OpenMetaverse;
@@ -50,9 +51,12 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
50using OSDArray = OpenMetaverse.StructuredData.OSDArray; 51using OSDArray = OpenMetaverse.StructuredData.OSDArray;
51using OSDMap = OpenMetaverse.StructuredData.OSDMap; 52using OSDMap = OpenMetaverse.StructuredData.OSDMap;
52 53
54using Mono.Addins;
55
53namespace OpenSim.Region.CoreModules.Avatar.Gods 56namespace OpenSim.Region.CoreModules.Avatar.Gods
54{ 57{
55 public class GodsModule : IRegionModule, IGodsModule 58 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
59 public class GodsModule : INonSharedRegionModule, IGodsModule
56 { 60 {
57 private static readonly ILog m_log = 61 private static readonly ILog m_log =
58 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 62 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -66,10 +70,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
66 protected Dictionary<UUID, string> m_capsDict = 70 protected Dictionary<UUID, string> m_capsDict =
67 new Dictionary<UUID, string>(); 71 new Dictionary<UUID, string>();
68 72
69 public void Initialise(Scene scene, IConfigSource source) 73 protected IDialogModule DialogModule
74 {
75 get
76 {
77 if (m_dialogModule == null)
78 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
79
80 return m_dialogModule;
81 }
82 }
83
84 public void Initialise(IConfigSource source)
85 {
86 }
87
88 public void AddRegion(Scene scene)
70 { 89 {
71 m_scene = scene; 90 m_scene = scene;
72 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
73 m_scene.RegisterModuleInterface<IGodsModule>(this); 91 m_scene.RegisterModuleInterface<IGodsModule>(this);
74 m_scene.EventManager.OnNewClient += SubscribeToClientEvents; 92 m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
75 m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; 93 m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
@@ -77,12 +95,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
77 scene.EventManager.OnIncomingInstantMessage += 95 scene.EventManager.OnIncomingInstantMessage +=
78 OnIncomingInstantMessage; 96 OnIncomingInstantMessage;
79 } 97 }
80 98
81 public void PostInitialise() {} 99 public void RemoveRegion(Scene scene)
100 {
101 m_scene.UnregisterModuleInterface<IGodsModule>(this);
102 m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
103 m_scene = null;
104 }
105
106 public void RegionLoaded(Scene scene)
107 {
108 }
109
82 public void Close() {} 110 public void Close() {}
83 public string Name { get { return "Gods Module"; } } 111 public string Name { get { return "Gods Module"; } }
84 public bool IsSharedModule { get { return false; } } 112
85 113 public Type ReplaceableInterface
114 {
115 get { return null; }
116 }
117
86 public void SubscribeToClientEvents(IClientAPI client) 118 public void SubscribeToClientEvents(IClientAPI client)
87 { 119 {
88 client.OnGodKickUser += KickUser; 120 client.OnGodKickUser += KickUser;
@@ -172,8 +204,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
172 } 204 }
173 else 205 else
174 { 206 {
175 if (m_dialogModule != null) 207 if (DialogModule != null)
176 m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); 208 DialogModule.SendAlertToUser(agentID, "Request for god powers denied");
177 } 209 }
178 } 210 }
179 } 211 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
index b258e13..27f94ea 100644
--- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
@@ -25,6 +25,7 @@
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;
@@ -34,9 +35,12 @@ using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
36 37
38using Mono.Addins;
39
37namespace OpenSim.Region.CoreModules.Avatar.Groups 40namespace OpenSim.Region.CoreModules.Avatar.Groups
38{ 41{
39 public class GroupsModule : IRegionModule 42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
43 public class GroupsModule : ISharedRegionModule
40 { 44 {
41 private static readonly ILog m_log = 45 private static readonly ILog m_log =
42 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -55,9 +59,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
55 private static GroupMembershipData osGroup = 59 private static GroupMembershipData osGroup =
56 new GroupMembershipData(); 60 new GroupMembershipData();
57 61
58 #region IRegionModule Members 62 private bool m_Enabled = false;
63
64 #region ISharedRegionModule Members
59 65
60 public void Initialise(Scene scene, IConfigSource config) 66 public void Initialise(IConfigSource config)
61 { 67 {
62 IConfig groupsConfig = config.Configs["Groups"]; 68 IConfig groupsConfig = config.Configs["Groups"];
63 69
@@ -67,7 +73,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
67 } 73 }
68 else 74 else
69 { 75 {
70 if (!groupsConfig.GetBoolean("Enabled", false)) 76 m_Enabled = groupsConfig.GetBoolean("Enabled", false);
77 if (!m_Enabled)
71 { 78 {
72 m_log.Info("[GROUPS]: Groups disabled in configuration"); 79 m_log.Info("[GROUPS]: Groups disabled in configuration");
73 return; 80 return;
@@ -77,6 +84,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
77 return; 84 return;
78 } 85 }
79 86
87 }
88
89 public void AddRegion(Scene scene)
90 {
91 if (!m_Enabled)
92 return;
93
80 lock (m_SceneList) 94 lock (m_SceneList)
81 { 95 {
82 if (!m_SceneList.Contains(scene)) 96 if (!m_SceneList.Contains(scene))
@@ -96,7 +110,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
96 110
97 scene.EventManager.OnNewClient += OnNewClient; 111 scene.EventManager.OnNewClient += OnNewClient;
98 scene.EventManager.OnClientClosed += OnClientClosed; 112 scene.EventManager.OnClientClosed += OnClientClosed;
99// scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 113 // scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
114 }
115
116 public void RemoveRegion(Scene scene)
117 {
118 if (!m_Enabled)
119 return;
120
121 lock (m_SceneList)
122 {
123 if (m_SceneList.Contains(scene))
124 m_SceneList.Remove(scene);
125 }
126
127 scene.EventManager.OnNewClient -= OnNewClient;
128 scene.EventManager.OnClientClosed -= OnClientClosed;
129 }
130
131 public void RegionLoaded(Scene scene)
132 {
100 } 133 }
101 134
102 public void PostInitialise() 135 public void PostInitialise()
@@ -105,6 +138,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
105 138
106 public void Close() 139 public void Close()
107 { 140 {
141 if (!m_Enabled)
142 return;
143
108// m_log.Debug("[GROUPS]: Shutting down group module."); 144// m_log.Debug("[GROUPS]: Shutting down group module.");
109 145
110 lock (m_ClientMap) 146 lock (m_ClientMap)
@@ -123,9 +159,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
123 get { return "GroupsModule"; } 159 get { return "GroupsModule"; }
124 } 160 }
125 161
126 public bool IsSharedModule 162 public Type ReplaceableInterface
127 { 163 {
128 get { return true; } 164 get { return null; }
129 } 165 }
130 166
131 #endregion 167 #endregion
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 765b960..50c51d3 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -39,20 +39,18 @@ using OpenSim.Framework.Console;
39using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
42using Mono.Addins;
42 43
43namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver 44namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
44{ 45{
45 /// <summary> 46 /// <summary>
46 /// This module loads and saves OpenSimulator inventory archives 47 /// This module loads and saves OpenSimulator inventory archives
47 /// </summary> 48 /// </summary>
48 public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule 49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
50 public class InventoryArchiverModule : ISharedRegionModule, IInventoryArchiverModule
49 { 51 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 53
52 public string Name { get { return "Inventory Archiver Module"; } }
53
54 public bool IsSharedModule { get { return true; } }
55
56 /// <value> 54 /// <value>
57 /// Enable or disable checking whether the iar user is actually logged in 55 /// Enable or disable checking whether the iar user is actually logged in
58 /// </value> 56 /// </value>
@@ -99,9 +97,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
99// public InventoryArchiverModule(bool disablePresenceChecks) 97// public InventoryArchiverModule(bool disablePresenceChecks)
100// { 98// {
101// DisablePresenceChecks = disablePresenceChecks; 99// DisablePresenceChecks = disablePresenceChecks;
102// } 100 // }
101
102 #region ISharedRegionModule
103 103
104 public void Initialise(Scene scene, IConfigSource source) 104 public void Initialise(IConfigSource source)
105 {
106 }
107
108 public void AddRegion(Scene scene)
105 { 109 {
106 if (m_scenes.Count == 0) 110 if (m_scenes.Count == 0)
107 { 111 {
@@ -144,10 +148,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
144 m_scenes[scene.RegionInfo.RegionID] = scene; 148 m_scenes[scene.RegionInfo.RegionID] = scene;
145 } 149 }
146 150
147 public void PostInitialise() {} 151 public void RemoveRegion(Scene scene)
152 {
153 }
148 154
149 public void Close() {} 155 public void Close() {}
150 156
157 public void RegionLoaded(Scene scene)
158 {
159 }
160
161 public void PostInitialise()
162 {
163 }
164
165 public Type ReplaceableInterface
166 {
167 get { return null; }
168 }
169
170 public string Name { get { return "Inventory Archiver Module"; } }
171
172 #endregion
173
151 /// <summary> 174 /// <summary>
152 /// Trigger the inventory archive saved event. 175 /// Trigger the inventory archive saved event.
153 /// </summary> 176 /// </summary>