aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs4
-rw-r--r--OpenSim/Client/MXP/MXPModule.cs36
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs30
-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
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs103
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs83
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs31
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs100
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs60
-rw-r--r--OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs32
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs36
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs37
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs41
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs37
-rw-r--r--OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs51
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs16
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs58
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs212
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs96
-rw-r--r--OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs27
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/WindModule.cs45
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs35
-rw-r--r--OpenSim/Region/DataSnapshot/DataSnapshotManager.cs55
-rw-r--r--OpenSim/Region/Framework/Interfaces/ICloudModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEmailModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISunModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWindModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs32
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs72
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs47
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs64
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs28
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs30
-rw-r--r--OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs28
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs28
-rw-r--r--OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs41
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs33
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs9
76 files changed, 1837 insertions, 892 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 6fd3d30..64863c5 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -99,7 +99,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
99 regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source); 99 regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source);
100 RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); 100 RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
101 101
102 m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules..."); 102 /*m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules...");
103 m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule..."); 103 m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule...");
104 m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); 104 m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
105 m_log.Info("[LOADREGIONSPLUGIN]: InstantMessageModule..."); 105 m_log.Info("[LOADREGIONSPLUGIN]: InstantMessageModule...");
@@ -111,7 +111,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
111 m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule..."); 111 m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
112 m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); 112 m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
113 m_log.Info("[LOADREGIONSPLUGIN]: Done."); 113 m_log.Info("[LOADREGIONSPLUGIN]: Done.");
114 114 */
115 if (!CheckRegionsForSanity(regionsToLoad)) 115 if (!CheckRegionsForSanity(regionsToLoad))
116 { 116 {
117 m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); 117 m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations");
diff --git a/OpenSim/Client/MXP/MXPModule.cs b/OpenSim/Client/MXP/MXPModule.cs
index 0b442cc..47417ab 100644
--- a/OpenSim/Client/MXP/MXPModule.cs
+++ b/OpenSim/Client/MXP/MXPModule.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31using System.Text; 31using System.Text;
32using System.Timers; 32using System.Timers;
33using log4net; 33using log4net;
34using Mono.Addins;
34using MXP; 35using MXP;
35using Nini.Config; 36using Nini.Config;
36using OpenMetaverse; 37using OpenMetaverse;
@@ -44,7 +45,8 @@ namespace OpenSim.Client.MXP
44 /** 45 /**
45 * MXP Client Module which adds MXP support to client / region communication. 46 * MXP Client Module which adds MXP support to client / region communication.
46 */ 47 */
47 public class MXPModule : IRegionModule 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
49 public class MXPModule : ISharedRegionModule
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
@@ -57,15 +59,23 @@ namespace OpenSim.Client.MXP
57 private readonly Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); 59 private readonly Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
58 private bool m_shutdown; 60 private bool m_shutdown;
59 61
60 public void Initialise(Scene scene, IConfigSource source) 62 public void Initialise(IConfigSource source)
63 {
64 m_config = source;
65 }
66
67 public Type ReplaceableInterface
68 {
69 get { return null; }
70 }
71
72 public void AddRegion(Scene scene)
61 { 73 {
62 if (!m_scenes.ContainsKey(scene.RegionInfo.RegionID)) 74 if (!m_scenes.ContainsKey(scene.RegionInfo.RegionID))
63 m_scenes.Add(scene.RegionInfo.RegionID, scene); 75 m_scenes.Add(scene.RegionInfo.RegionID, scene);
64
65 m_config = source;
66 } 76 }
67 77
68 public void PostInitialise() 78 public void RegionLoaded(Scene scene)
69 { 79 {
70 if (m_config.Configs["MXP"] != null) 80 if (m_config.Configs["MXP"] != null)
71 { 81 {
@@ -76,7 +86,7 @@ namespace OpenSim.Client.MXP
76 86
77 m_port = con.GetInt("Port", m_port); 87 m_port = con.GetInt("Port", m_port);
78 88
79 m_server = new MXPPacketServer(m_port, m_scenes,m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate",true)); 89 m_server = new MXPPacketServer(m_port, m_scenes, m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate", true));
80 90
81 m_ticker = new Timer(100); 91 m_ticker = new Timer(100);
82 m_ticker.AutoReset = false; 92 m_ticker.AutoReset = false;
@@ -89,6 +99,14 @@ namespace OpenSim.Client.MXP
89 } 99 }
90 } 100 }
91 101
102 public void RemoveRegion(Scene scene)
103 {
104 }
105
106 public void PostInitialise()
107 {
108 }
109
92 void ticker_Elapsed(object sender, ElapsedEventArgs e) 110 void ticker_Elapsed(object sender, ElapsedEventArgs e)
93 { 111 {
94 try 112 try
@@ -121,11 +139,5 @@ namespace OpenSim.Client.MXP
121 { 139 {
122 get { return "MXP ClientStack Module"; } 140 get { return "MXP ClientStack Module"; }
123 } 141 }
124
125 public bool IsSharedModule
126 {
127 get { return true; }
128 }
129
130 } 142 }
131} 143}
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
index 1077f4a..7012037 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.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 OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
@@ -35,7 +36,8 @@ using OpenSim.Region.Framework.Scenes;
35 36
36namespace OpenSim.Region.CoreModules.Agent.AssetTransaction 37namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
37{ 38{
38 public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions 39 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
40 public class AssetTransactionModule : ISharedRegionModule, IAgentAssetTransactions
39 { 41 {
40 private readonly Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>(); 42 private readonly Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>();
41 private bool m_dumpAssetsToFile = false; 43 private bool m_dumpAssetsToFile = false;
@@ -59,9 +61,14 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
59 //m_log.Debug("creating AgentAssetTransactionModule"); 61 //m_log.Debug("creating AgentAssetTransactionModule");
60 } 62 }
61 63
62 #region IRegionModule Members 64 #region ISharedRegionModule Members
63 65
64 public void Initialise(Scene scene, IConfigSource config) 66 public void Initialise(IConfigSource config)
67 {
68
69 }
70
71 public void AddRegion(Scene scene)
65 { 72 {
66 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) 73 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
67 { 74 {
@@ -79,6 +86,23 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
79 m_scene = scene; 86 m_scene = scene;
80 } 87 }
81 88
89 public Type ReplaceableInterface
90 {
91 get { return null; }
92 }
93
94 public void RegionLoaded(Scene scene)
95 {
96 }
97
98 public void RemoveRegion(Scene scene)
99 {
100 if (RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
101 RegisteredScenes.Remove(scene.RegionInfo.RegionID);
102 scene.UnregisterModuleInterface<IAgentAssetTransactions>(this);
103 scene.EventManager.OnNewClient -= NewClient;
104 }
105
82 public void PostInitialise() 106 public void PostInitialise()
83 { 107 {
84 } 108 }
@@ -92,11 +116,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
92 get { return "AgentTransactionModule"; } 116 get { return "AgentTransactionModule"; }
93 } 117 }
94 118
95 public bool IsSharedModule
96 {
97 get { return true; }
98 }
99
100 #endregion 119 #endregion
101 120
102 public void NewClient(IClientAPI client) 121 public void NewClient(IClientAPI client)
diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
index 2a1355b..886173f 100644
--- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
69 69
70 public void RemoveRegion(Scene scene) 70 public void RemoveRegion(Scene scene)
71 { 71 {
72 m_scene.UnregisterModuleInterface<ICapabilitiesModule>(this); 72 scene.UnregisterModuleInterface<ICapabilitiesModule>(this);
73 } 73 }
74 74
75 public void PostInitialise() {} 75 public void PostInitialise() {}
diff --git a/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs b/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs
index bfe2a71..f7f2eff 100644
--- a/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Text; 31using System.Text;
32using Mono.Addins;
32using Nini.Config; 33using Nini.Config;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
@@ -36,21 +37,27 @@ using OpenSim.Region.Framework.Scenes;
36 37
37namespace OpenSim.Region.CoreModules.Agent.IPBan 38namespace OpenSim.Region.CoreModules.Agent.IPBan
38{ 39{
39 public class IPBanModule : IRegionModule 40 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
41 public class IPBanModule : ISharedRegionModule
40 { 42 {
41 #region Implementation of IRegionModule 43 #region Implementation of ISharedRegionModule
42 44
43 private List<string> m_bans = new List<string>(); 45 private List<string> m_bans = new List<string>();
46 private Dictionary<Scene, SceneBanner> SceneBanners = new Dictionary<Scene, SceneBanner>();
44 47
45 public void Initialise(Scene scene, IConfigSource source) 48 public void Initialise(IConfigSource source)
46 { 49 {
47 new SceneBanner(scene, m_bans); 50 }
51
52 public void AddRegion(Scene scene)
53 {
54 SceneBanners.Add(scene, new SceneBanner(scene, m_bans));
48 55
49 lock (m_bans) 56 lock (m_bans)
50 { 57 {
51 foreach (EstateBan ban in scene.RegionInfo.EstateSettings.EstateBans) 58 foreach (EstateBan ban in scene.RegionInfo.EstateSettings.EstateBans)
52 { 59 {
53 if (!String.IsNullOrEmpty(ban.BannedHostIPMask)) 60 if (!String.IsNullOrEmpty(ban.BannedHostIPMask))
54 m_bans.Add(ban.BannedHostIPMask); 61 m_bans.Add(ban.BannedHostIPMask);
55 if (!String.IsNullOrEmpty(ban.BannedHostNameMask)) 62 if (!String.IsNullOrEmpty(ban.BannedHostNameMask))
56 m_bans.Add(ban.BannedHostNameMask); 63 m_bans.Add(ban.BannedHostNameMask);
@@ -58,7 +65,12 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
58 } 65 }
59 } 66 }
60 67
61 public void PostInitialise() 68 public Type ReplaceableInterface
69 {
70 get { return null; }
71 }
72
73 public void RegionLoaded(Scene scene)
62 { 74 {
63 if (File.Exists("bans.txt")) 75 if (File.Exists("bans.txt"))
64 { 76 {
@@ -70,19 +82,23 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
70 } 82 }
71 } 83 }
72 84
73 public void Close() 85 public void RemoveRegion(Scene scene)
74 { 86 {
75 87 if(SceneBanners.ContainsKey(scene))
88 SceneBanners.Remove(scene);
76 } 89 }
77 90
78 public string Name 91 public void PostInitialise()
92 {
93 }
94
95 public void Close()
79 { 96 {
80 get { return "IPBanModule"; }
81 } 97 }
82 98
83 public bool IsSharedModule 99 public string Name
84 { 100 {
85 get { return true; } 101 get { return "IPBanModule"; }
86 } 102 }
87 103
88 #endregion 104 #endregion
diff --git a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs
index 71ff28c..c4d84cb 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Threading; 31using System.Threading;
32using log4net; 32using log4net;
33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenSim.Framework; 36using OpenSim.Framework;
@@ -41,7 +42,8 @@ using OpenSim.Services.Interfaces;
41 42
42namespace OpenSim.Region.CoreModules.Agent.TextureDownload 43namespace OpenSim.Region.CoreModules.Agent.TextureDownload
43{ 44{
44 public class TextureDownloadModule : IRegionModule 45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
46 public class TextureDownloadModule : INonSharedRegionModule
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);
@@ -65,11 +67,14 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload
65 { 67 {
66 } 68 }
67 69
68 #region IRegionModule Members 70 #region INonSharedRegionModule Members
69 71
70 public void Initialise(Scene scene, IConfigSource config) 72 public void Initialise(IConfigSource config)
73 {
74 }
75
76 public void AddRegion(Scene scene)
71 { 77 {
72
73 if (m_scene == null) 78 if (m_scene == null)
74 { 79 {
75 //m_log.Debug("Creating Texture download module"); 80 //m_log.Debug("Creating Texture download module");
@@ -90,22 +95,30 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload
90 } 95 }
91 } 96 }
92 97
93 public void PostInitialise() 98 public Type ReplaceableInterface
94 { 99 {
100 get { return null; }
95 } 101 }
96 102
97 public void Close() 103 public void RegionLoaded(Scene scene)
98 { 104 {
99 } 105 }
100 106
101 public string Name 107 public void RemoveRegion(Scene scene)
102 { 108 {
103 get { return "TextureDownloadModule"; } 109 if(m_scenes.Contains(scene))
110 m_scenes.Remove(scene);
111 scene.EventManager.OnNewClient -= NewClient;
112 scene.EventManager.OnRemovePresence -= EventManager_OnRemovePresence;
104 } 113 }
105 114
106 public bool IsSharedModule 115 public void Close()
116 {
117 }
118
119 public string Name
107 { 120 {
108 get { return false; } 121 get { return "TextureDownloadModule"; }
109 } 122 }
110 123
111 #endregion 124 #endregion
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 7ac8bed..ff87493 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -32,6 +32,7 @@ using System.Reflection;
32using System.Text; 32using System.Text;
33using System.Threading; 33using System.Threading;
34using log4net; 34using log4net;
35using Mono.Addins;
35using Nini.Config; 36using Nini.Config;
36using OpenMetaverse; 37using OpenMetaverse;
37using OpenMetaverse.Imaging; 38using OpenMetaverse.Imaging;
@@ -45,7 +46,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
45{ 46{
46 public delegate void J2KDecodeDelegate(UUID assetID); 47 public delegate void J2KDecodeDelegate(UUID assetID);
47 48
48 public class J2KDecoderModule : IRegionModule, IJ2KDecoder 49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
50 public class J2KDecoderModule : ISharedRegionModule, IJ2KDecoder
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
@@ -58,16 +60,19 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
58 /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary> 60 /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary>
59 private Scene m_scene; 61 private Scene m_scene;
60 62
61 #region IRegionModule 63 #region ISharedRegionModule
62 64
63 public string Name { get { return "J2KDecoderModule"; } } 65 public string Name { get { return "J2KDecoderModule"; } }
64 public bool IsSharedModule { get { return true; } } 66
65
66 public J2KDecoderModule() 67 public J2KDecoderModule()
67 { 68 {
68 } 69 }
69 70
70 public void Initialise(Scene scene, IConfigSource source) 71 public void Initialise(IConfigSource source)
72 {
73 }
74
75 public void AddRegion(Scene scene)
71 { 76 {
72 if (m_scene == null) 77 if (m_scene == null)
73 m_scene = scene; 78 m_scene = scene;
@@ -75,16 +80,30 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
75 scene.RegisterModuleInterface<IJ2KDecoder>(this); 80 scene.RegisterModuleInterface<IJ2KDecoder>(this);
76 } 81 }
77 82
78 public void PostInitialise() 83 public Type ReplaceableInterface
84 {
85 get { return null; }
86 }
87
88 public void RegionLoaded(Scene scene)
79 { 89 {
80 m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); 90 m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
81 } 91 }
82 92
93 public void RemoveRegion(Scene scene)
94 {
95 scene.UnregisterModuleInterface<IJ2KDecoder>(this);
96 }
97
98 public void PostInitialise()
99 {
100 }
101
83 public void Close() 102 public void Close()
84 { 103 {
85 } 104 }
86 105
87 #endregion IRegionModule 106 #endregion
88 107
89 #region IJ2KDecoder 108 #region IJ2KDecoder
90 109
diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
index ef7dce8..d062361 100644
--- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.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 OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
@@ -35,7 +36,8 @@ using OpenSim.Region.Framework.Scenes;
35 36
36namespace OpenSim.Region.CoreModules.Agent.Xfer 37namespace OpenSim.Region.CoreModules.Agent.Xfer
37{ 38{
38 public class XferModule : IRegionModule, IXfer 39 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
40 public class XferModule : INonSharedRegionModule, IXfer
39 { 41 {
40 private Scene m_scene; 42 private Scene m_scene;
41 private Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>(); 43 private Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>();
@@ -52,9 +54,13 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
52 public DateTime timeStamp; 54 public DateTime timeStamp;
53 } 55 }
54 56
55 #region IRegionModule Members 57 #region INonSharedRegionModule Members
56 58
57 public void Initialise(Scene scene, IConfigSource config) 59 public void Initialise(IConfigSource config)
60 {
61 }
62
63 public void AddRegion(Scene scene)
58 { 64 {
59 m_scene = scene; 65 m_scene = scene;
60 m_scene.EventManager.OnNewClient += NewClient; 66 m_scene.EventManager.OnNewClient += NewClient;
@@ -62,22 +68,28 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
62 m_scene.RegisterModuleInterface<IXfer>(this); 68 m_scene.RegisterModuleInterface<IXfer>(this);
63 } 69 }
64 70
65 public void PostInitialise() 71 public Type ReplaceableInterface
66 { 72 {
73 get { return null; }
67 } 74 }
68 75
69 public void Close() 76 public void RegionLoaded(Scene scene)
70 { 77 {
71 } 78 }
72 79
73 public string Name 80 public void RemoveRegion(Scene scene)
74 { 81 {
75 get { return "XferModule"; } 82 scene.EventManager.OnNewClient -= NewClient;
83 scene.UnregisterModuleInterface<IXfer>(this);
76 } 84 }
77 85
78 public bool IsSharedModule 86 public void Close()
87 {
88 }
89
90 public string Name
79 { 91 {
80 get { return false; } 92 get { return "XferModule"; }
81 } 93 }
82 94
83 #endregion 95 #endregion
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
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 0c6cb1b..1ee6f0d 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -32,6 +32,7 @@ using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Threading;
34using log4net; 34using log4net;
35using Mono.Addins;
35using Nini.Config; 36using Nini.Config;
36using OpenMetaverse; 37using OpenMetaverse;
37using OpenMetaverse.Packets; 38using OpenMetaverse.Packets;
@@ -52,11 +53,13 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
52 public OSDMap body; 53 public OSDMap body;
53 } 54 }
54 55
55 public class EventQueueGetModule : IEventQueue, IRegionModule 56 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
57 public class EventQueueGetModule : IEventQueue, INonSharedRegionModule
56 { 58 {
57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58 protected Scene m_scene = null; 60 protected Scene m_scene = null;
59 private IConfigSource m_gConfig; 61 private IConfigSource m_gConfig;
62 private IConfig m_startupConfig;
60 bool enabledYN = false; 63 bool enabledYN = false;
61 64
62 private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>(); 65 private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>();
@@ -65,23 +68,31 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
65 private Dictionary<UUID, UUID> m_QueueUUIDAvatarMapping = new Dictionary<UUID, UUID>(); 68 private Dictionary<UUID, UUID> m_QueueUUIDAvatarMapping = new Dictionary<UUID, UUID>();
66 private Dictionary<UUID, UUID> m_AvatarQueueUUIDMapping = new Dictionary<UUID, UUID>(); 69 private Dictionary<UUID, UUID> m_AvatarQueueUUIDMapping = new Dictionary<UUID, UUID>();
67 70
68 #region IRegionModule methods 71 #region INonSharedRegionModule methods
69 public virtual void Initialise(Scene scene, IConfigSource config) 72 public virtual void Initialise(IConfigSource config)
70 { 73 {
71 m_gConfig = config; 74 m_gConfig = config;
72 75
73 IConfig startupConfig = m_gConfig.Configs["Startup"]; 76 m_startupConfig = m_gConfig.Configs["Startup"];
77 }
74 78
75 ReadConfigAndPopulate(scene, startupConfig, "Startup"); 79 public Type ReplaceableInterface
80 {
81 get { return null; }
82 }
83
84 public void AddRegion(Scene scene)
85 {
86 ReadConfigAndPopulate(scene, m_startupConfig, "Startup");
76 87
77 if (enabledYN) 88 if (enabledYN)
78 { 89 {
79 m_scene = scene; 90 m_scene = scene;
80 scene.RegisterModuleInterface<IEventQueue>(this); 91 scene.RegisterModuleInterface<IEventQueue>(this);
81 92
82 // Register fallback handler 93 // Register fallback handler
83 // Why does EQG Fail on region crossings! 94 // Why does EQG Fail on region crossings!
84 95
85 //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack); 96 //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack);
86 97
87 scene.EventManager.OnNewClient += OnNewClient; 98 scene.EventManager.OnNewClient += OnNewClient;
@@ -99,18 +110,21 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
99 { 110 {
100 m_gConfig = null; 111 m_gConfig = null;
101 } 112 }
102
103 } 113 }
104 114
105 private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p) 115 public void RegionLoaded(Scene scene)
106 { 116 {
107 enabledYN = startupConfig.GetBoolean("EventQueue", true);
108 } 117 }
109 118
110 public void PostInitialise() 119 public void RemoveRegion(Scene scene)
111 { 120 {
112 } 121 }
113 122
123 private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p)
124 {
125 enabledYN = startupConfig.GetBoolean("EventQueue", true);
126 }
127
114 public virtual void Close() 128 public virtual void Close()
115 { 129 {
116 } 130 }
@@ -120,10 +134,6 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
120 get { return "EventQueueGetModule"; } 134 get { return "EventQueueGetModule"; }
121 } 135 }
122 136
123 public bool IsSharedModule
124 {
125 get { return false; }
126 }
127 #endregion 137 #endregion
128 138
129 /// <summary> 139 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
index f15f8f6..0135d33 100644
--- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
@@ -25,10 +25,12 @@
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; 29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using log4net;
33using Mono.Addins;
32using Nini.Config; 34using Nini.Config;
33using OpenMetaverse; 35using OpenMetaverse;
34using OpenSim.Framework; 36using OpenSim.Framework;
@@ -39,7 +41,8 @@ using OpenSim.Region.Framework.Scenes;
39 41
40namespace OpenSim.Region.CoreModules.Framework.Monitoring 42namespace OpenSim.Region.CoreModules.Framework.Monitoring
41{ 43{
42 public class MonitorModule : IRegionModule 44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
45 public class MonitorModule : INonSharedRegionModule
43 { 46 {
44 private Scene m_scene; 47 private Scene m_scene;
45 private readonly List<IMonitor> m_monitors = new List<IMonitor>(); 48 private readonly List<IMonitor> m_monitors = new List<IMonitor>();
@@ -62,9 +65,19 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
62 } 65 }
63 } 66 }
64 67
65 #region Implementation of IRegionModule 68 #region Implementation of INonSharedRegionModule
66 69
67 public void Initialise(Scene scene, IConfigSource source) 70 public void Initialise(IConfigSource source)
71 {
72
73 }
74
75 public Type ReplaceableInterface
76 {
77 get { return null; }
78 }
79
80 public void AddRegion(Scene scene)
68 { 81 {
69 m_scene = scene; 82 m_scene = scene;
70 83
@@ -77,6 +90,51 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
77 MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage); 90 MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage);
78 } 91 }
79 92
93 public void RegionLoaded(Scene scene)
94 {
95 m_monitors.Add(new AgentCountMonitor(m_scene));
96 m_monitors.Add(new ChildAgentCountMonitor(m_scene));
97 m_monitors.Add(new GCMemoryMonitor());
98 m_monitors.Add(new ObjectCountMonitor(m_scene));
99 m_monitors.Add(new PhysicsFrameMonitor(m_scene));
100 m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene));
101 m_monitors.Add(new PWSMemoryMonitor());
102 m_monitors.Add(new ThreadCountMonitor());
103 m_monitors.Add(new TotalFrameMonitor(m_scene));
104 m_monitors.Add(new EventFrameMonitor(m_scene));
105 m_monitors.Add(new LandFrameMonitor(m_scene));
106 m_monitors.Add(new LastFrameTimeMonitor(m_scene));
107
108 m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor));
109
110 foreach (IAlert alert in m_alerts)
111 {
112 alert.OnTriggerAlert += OnTriggerAlert;
113 }
114 }
115
116 public void RemoveRegion(Scene scene)
117 {
118 MainServer.Instance.RemoveHTTPHandler("", "/monitorstats/" + m_scene.RegionInfo.RegionID + "/");
119 m_monitors.Clear();
120
121 foreach (IAlert alert in m_alerts)
122 {
123 alert.OnTriggerAlert -= OnTriggerAlert;
124 }
125 m_alerts.Clear();
126 }
127
128 public void Close()
129 {
130
131 }
132
133 public string Name
134 {
135 get { return "Region Health Monitoring Module"; }
136 }
137
80 public Hashtable StatsPage(Hashtable request) 138 public Hashtable StatsPage(Hashtable request)
81 { 139 {
82 // If request was for a specific monitor 140 // If request was for a specific monitor
@@ -132,49 +190,10 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
132 return ereply; 190 return ereply;
133 } 191 }
134 192
135 public void PostInitialise()
136 {
137 m_monitors.Add(new AgentCountMonitor(m_scene));
138 m_monitors.Add(new ChildAgentCountMonitor(m_scene));
139 m_monitors.Add(new GCMemoryMonitor());
140 m_monitors.Add(new ObjectCountMonitor(m_scene));
141 m_monitors.Add(new PhysicsFrameMonitor(m_scene));
142 m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene));
143 m_monitors.Add(new PWSMemoryMonitor());
144 m_monitors.Add(new ThreadCountMonitor());
145 m_monitors.Add(new TotalFrameMonitor(m_scene));
146 m_monitors.Add(new EventFrameMonitor(m_scene));
147 m_monitors.Add(new LandFrameMonitor(m_scene));
148 m_monitors.Add(new LastFrameTimeMonitor(m_scene));
149
150 m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor));
151
152 foreach (IAlert alert in m_alerts)
153 {
154 alert.OnTriggerAlert += OnTriggerAlert;
155 }
156 }
157
158 void OnTriggerAlert(System.Type reporter, string reason, bool fatal) 193 void OnTriggerAlert(System.Type reporter, string reason, bool fatal)
159 { 194 {
160 m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")"); 195 m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")");
161 } 196 }
162
163 public void Close()
164 {
165
166 }
167
168 public string Name
169 {
170 get { return "Region Health Monitoring Module"; }
171 }
172
173 public bool IsSharedModule
174 {
175 get { return false; }
176 }
177
178 #endregion 197 #endregion
179 } 198 }
180} 199}
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
index 0b54746..f9c594b 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -32,6 +32,7 @@ using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Text.RegularExpressions; 33using System.Text.RegularExpressions;
34using log4net; 34using log4net;
35using Mono.Addins;
35using Nini.Config; 36using Nini.Config;
36using OpenMetaverse; 37using OpenMetaverse;
37using Nwc.XmlRpc; 38using Nwc.XmlRpc;
@@ -46,7 +47,8 @@ using OpenSim.Region.Framework.Interfaces;
46 47
47namespace OpenSim.Region.CoreModules.Hypergrid 48namespace OpenSim.Region.CoreModules.Hypergrid
48{ 49{
49 public class HGStandaloneLoginModule : IRegionModule, ILoginServiceToRegionsConnector 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
51 public class HGStandaloneLoginModule : ISharedRegionModule, ILoginServiceToRegionsConnector
50 { 52 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 54
@@ -56,47 +58,58 @@ namespace OpenSim.Region.CoreModules.Hypergrid
56 protected bool m_enabled = false; // Module is only enabled if running in standalone mode 58 protected bool m_enabled = false; // Module is only enabled if running in standalone mode
57 59
58 protected HGLoginAuthService m_loginService; 60 protected HGLoginAuthService m_loginService;
61 private bool authenticate = true;
62 private string welcomeMessage = "Welcome to OpenSim";
63 private IConfig startupConfig;
64 private IConfig standaloneConfig;
65
66 #region ISharedRegionModule Members
67
68 public void Initialise(IConfigSource source)
69 {
70 startupConfig = source.Configs["Startup"];
71 standaloneConfig = source.Configs["StandAlone"];
72 if (standaloneConfig != null)
73 {
74 authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true);
75 welcomeMessage = standaloneConfig.GetString("welcome_message");
76 }
77 m_enabled = !startupConfig.GetBoolean("gridmode", false);
78 }
79
80 public Type ReplaceableInterface
81 {
82 get { return null; }
83 }
59 84
60 #region IRegionModule Members 85 public void AddRegion(Scene scene)
86 {
87 }
61 88
62 public void Initialise(Scene scene, IConfigSource source) 89 public void RegionLoaded(Scene scene)
63 { 90 {
64 if (m_firstScene == null) 91 if (m_firstScene == null)
65 { 92 {
66 m_firstScene = scene; 93 m_firstScene = scene;
67 94
68 IConfig startupConfig = source.Configs["Startup"];
69 if (startupConfig != null)
70 {
71 m_enabled = !startupConfig.GetBoolean("gridmode", false);
72 }
73
74 if (m_enabled) 95 if (m_enabled)
75 { 96 {
76 m_log.Debug("[HGLogin]: HGlogin module enabled"); 97 m_log.Debug("[HGLogin]: HGlogin module enabled");
77 bool authenticate = true;
78 string welcomeMessage = "Welcome to OpenSim";
79 IConfig standaloneConfig = source.Configs["StandAlone"];
80 if (standaloneConfig != null)
81 {
82 authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true);
83 welcomeMessage = standaloneConfig.GetString("welcome_message");
84 }
85 98
86 //TODO: fix casting. 99 //TODO: fix casting.
87 LibraryRootFolder rootFolder = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder; 100 LibraryRootFolder rootFolder = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder;
88 101
89 IHttpServer httpServer = MainServer.Instance; 102 IHttpServer httpServer = MainServer.Instance;
90 103
91 //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference 104 //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference
92 m_loginService 105 m_loginService
93 = new HGLoginAuthService( 106 = new HGLoginAuthService(
94 (UserManagerBase)m_firstScene.CommsManager.UserAdminService, 107 (UserManagerBase)m_firstScene.CommsManager.UserAdminService,
95 welcomeMessage, 108 welcomeMessage,
96 m_firstScene.CommsManager.InterServiceInventoryService, 109 m_firstScene.CommsManager.InterServiceInventoryService,
97 m_firstScene.CommsManager.NetworkServersInfo, 110 m_firstScene.CommsManager.NetworkServersInfo,
98 authenticate, 111 authenticate,
99 rootFolder, 112 rootFolder,
100 this); 113 this);
101 114
102 httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); 115 httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod);
@@ -113,6 +126,19 @@ namespace OpenSim.Region.CoreModules.Hypergrid
113 } 126 }
114 } 127 }
115 128
129 public void RemoveRegion(Scene scene)
130 {
131 if (scene == m_firstScene)
132 {
133 IHttpServer httpServer = MainServer.Instance;
134 httpServer.RemoveXmlRPCHandler("hg_login");
135 httpServer.RemoveXmlRPCHandler("check_auth_session");
136 httpServer.RemoveXmlRPCHandler("get_avatar_appearance");
137 httpServer.RemoveXmlRPCHandler("update_avatar_appearance");
138 }
139 m_scenes.Remove(scene);
140 }
141
116 public void PostInitialise() 142 public void PostInitialise()
117 { 143 {
118 144
@@ -128,11 +154,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid
128 get { return "HGStandaloneLoginModule"; } 154 get { return "HGStandaloneLoginModule"; }
129 } 155 }
130 156
131 public bool IsSharedModule
132 {
133 get { return true; }
134 }
135
136 #endregion 157 #endregion
137 158
138 protected void AddScene(Scene scene) 159 protected void AddScene(Scene scene)
diff --git a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs
index 0f2ba32..4534024 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs
@@ -32,6 +32,7 @@ using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Text; 33using System.Text;
34using log4net; 34using log4net;
35using Mono.Addins;
35using Nini.Config; 36using Nini.Config;
36using Nwc.XmlRpc; 37using Nwc.XmlRpc;
37using OpenMetaverse; 38using OpenMetaverse;
@@ -42,7 +43,8 @@ using OpenSim.Region.Framework.Scenes;
42 43
43namespace OpenSim.Region.CoreModules.InterGrid 44namespace OpenSim.Region.CoreModules.InterGrid
44{ 45{
45 public class OGSRadmin : IRegionModule 46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
47 public class OGSRadmin : ISharedRegionModule
46 { 48 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 private readonly List<Scene> m_scenes = new List<Scene>(); 50 private readonly List<Scene> m_scenes = new List<Scene>();
@@ -56,7 +58,6 @@ namespace OpenSim.Region.CoreModules.InterGrid
56 get { return "OGS Supporting RAdmin"; } 58 get { return "OGS Supporting RAdmin"; }
57 } 59 }
58 60
59
60 public void Initialise(IConfigSource source) 61 public void Initialise(IConfigSource source)
61 { 62 {
62 m_settings = source; 63 m_settings = source;
@@ -67,6 +68,11 @@ namespace OpenSim.Region.CoreModules.InterGrid
67 68
68 } 69 }
69 70
71 public Type ReplaceableInterface
72 {
73 get { return null; }
74 }
75
70 public void AddRegion(Scene scene) 76 public void AddRegion(Scene scene)
71 { 77 {
72 lock (m_scenes) 78 lock (m_scenes)
@@ -77,15 +83,11 @@ namespace OpenSim.Region.CoreModules.InterGrid
77 { 83 {
78 lock (m_scenes) 84 lock (m_scenes)
79 m_scenes.Remove(scene); 85 m_scenes.Remove(scene);
86 MainServer.Instance.RemoveXmlRPCHandler("grid_message");
80 } 87 }
81 88
82 public void RegionLoaded(Scene scene) 89 public void RegionLoaded(Scene scene)
83 { 90 {
84
85 }
86
87 public void PostInitialise()
88 {
89 if (m_settings.Configs["Startup"].GetBoolean("gridmode", false)) 91 if (m_settings.Configs["Startup"].GetBoolean("gridmode", false))
90 { 92 {
91 m_com = m_scenes[0].CommsManager; 93 m_com = m_scenes[0].CommsManager;
@@ -93,21 +95,8 @@ namespace OpenSim.Region.CoreModules.InterGrid
93 } 95 }
94 } 96 }
95 97
96 #endregion 98 public void PostInitialise()
97
98 #region IRegionModule
99
100 public void Initialise(Scene scene, IConfigSource source)
101 {
102 m_settings = source;
103
104 lock (m_scenes)
105 m_scenes.Add(scene);
106 }
107
108 public bool IsSharedModule
109 { 99 {
110 get { return true; }
111 } 100 }
112 101
113 #endregion 102 #endregion
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index 10a3232..8bb0fa9 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -35,6 +35,7 @@ using System.Security.Cryptography.X509Certificates;
35using System.Threading; 35using System.Threading;
36using System.Web; 36using System.Web;
37using log4net; 37using log4net;
38using Mono.Addins;
38using Nini.Config; 39using Nini.Config;
39using OpenMetaverse; 40using OpenMetaverse;
40using OpenMetaverse.StructuredData; 41using OpenMetaverse.StructuredData;
@@ -75,8 +76,9 @@ namespace OpenSim.Region.CoreModules.InterGrid
75 public bool visible_to_parent; 76 public bool visible_to_parent;
76 public string teleported_into_region; 77 public string teleported_into_region;
77 } 78 }
78 79
79 public class OpenGridProtocolModule : IRegionModule 80 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
81 public class OpenGridProtocolModule : ISharedRegionModule
80 { 82 {
81 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 83 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
82 private List<Scene> m_scene = new List<Scene>(); 84 private List<Scene> m_scene = new List<Scene>();
@@ -92,21 +94,22 @@ namespace OpenSim.Region.CoreModules.InterGrid
92 private bool httpSSL = false; 94 private bool httpSSL = false;
93 private uint httpsslport = 0; 95 private uint httpsslport = 0;
94 private bool GridMode = false; 96 private bool GridMode = false;
97 private bool m_enabled = false;
98 private IConfig cfg = null;
99 private IConfig httpcfg = null;
100 private IConfig startupcfg = null;
101
102 #region ISharedRegionModule Members
95 103
96 #region IRegionModule Members 104 public void Initialise(IConfigSource config)
97
98 public void Initialise(Scene scene, IConfigSource config)
99 { 105 {
100 bool enabled = false;
101 IConfig cfg = null;
102 IConfig httpcfg = null;
103 IConfig startupcfg = null;
104 try 106 try
105 { 107 {
106 cfg = config.Configs["OpenGridProtocol"]; 108 cfg = config.Configs["OpenGridProtocol"];
107 } catch (NullReferenceException) 109 }
110 catch (NullReferenceException)
108 { 111 {
109 enabled = false; 112 m_enabled = false;
110 } 113 }
111 114
112 try 115 try
@@ -128,15 +131,15 @@ namespace OpenSim.Region.CoreModules.InterGrid
128 131
129 if (startupcfg != null) 132 if (startupcfg != null)
130 { 133 {
131 GridMode = enabled = startupcfg.GetBoolean("gridmode", false); 134 GridMode = m_enabled = startupcfg.GetBoolean("gridmode", false);
132 } 135 }
133 136
134 if (cfg != null) 137 if (cfg != null)
135 { 138 {
136 enabled = cfg.GetBoolean("ogp_enabled", false); 139 m_enabled = cfg.GetBoolean("ogp_enabled", false);
137 LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL"); 140 LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL");
138 FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", ""); 141 FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", "");
139 if (enabled) 142 if (m_enabled)
140 { 143 {
141 m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/"); 144 m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/");
142 lock (m_scene) 145 lock (m_scene)
@@ -165,35 +168,61 @@ namespace OpenSim.Region.CoreModules.InterGrid
165 } 168 }
166 169
167 } 170 }
168 // can't pick the region 'agent' because it would conflict with our agent domain handler
169 // a zero length region name would conflict with are base region seed cap
170 if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0)
171 {
172 MainServer.Instance.AddLLSDHandler(
173 "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()),
174 ProcessRegionDomainSeed);
175 }
176
177 if (!m_scene.Contains(scene))
178 m_scene.Add(scene);
179 } 171 }
180 } 172 }
181 } 173 }
182 lock (m_scene) 174 }
175
176 public Type ReplaceableInterface
177 {
178 get { return null; }
179 }
180
181 public void AddRegion(Scene scene)
182 {
183 if (m_enabled)
183 { 184 {
184 if (m_scene.Count == 1) 185 lock (m_scene)
185 { 186 {
186 if (httpcfg != null) 187 if (m_scene.Count == 1)
187 { 188 {
188 httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); 189 if (httpcfg != null)
189 httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); 190 {
190 if (httpsCN.Length == 0) 191 httpSSL = httpcfg.GetBoolean("http_listener_ssl", false);
191 httpsCN = scene.RegionInfo.ExternalHostName; 192 httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName);
192 httpsslport = (uint)httpcfg.GetInt("http_listener_sslport",((int)scene.RegionInfo.HttpPort + 1)); 193 if (httpsCN.Length == 0)
194 httpsCN = scene.RegionInfo.ExternalHostName;
195 httpsslport = (uint)httpcfg.GetInt("http_listener_sslport", ((int)scene.RegionInfo.HttpPort + 1));
196 }
193 } 197 }
194 } 198 }
199 // can't pick the region 'agent' because it would conflict with our agent domain handler
200 // a zero length region name would conflict with are base region seed cap
201 if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0)
202 {
203 MainServer.Instance.AddLLSDHandler(
204 "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()),
205 ProcessRegionDomainSeed);
206 }
207
208 if (!m_scene.Contains(scene))
209 m_scene.Add(scene);
195 } 210 }
196 } 211 }
212
213 public void RegionLoaded(Scene scene)
214 {
215 }
216
217 public void RemoveRegion(Scene scene)
218 {
219 MainServer.Instance.RemoveLLSDHandler(
220 "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()),
221 ProcessRegionDomainSeed);
222
223 if (m_scene.Contains(scene))
224 m_scene.Remove(scene);
225 }
197 226
198 public void PostInitialise() 227 public void PostInitialise()
199 { 228 {
@@ -209,11 +238,6 @@ namespace OpenSim.Region.CoreModules.InterGrid
209 get { return "OpenGridProtocolModule"; } 238 get { return "OpenGridProtocolModule"; }
210 } 239 }
211 240
212 public bool IsSharedModule
213 {
214 get { return true; }
215 }
216
217 #endregion 241 #endregion
218 242
219 public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint) 243 public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint)
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
index 679c871..40b7159 100644
--- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Drawing; 30using System.Drawing;
31using System.Drawing.Imaging; 31using System.Drawing.Imaging;
32using Mono.Addins;
32using Nini.Config; 33using Nini.Config;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenMetaverse.Imaging; 35using OpenMetaverse.Imaging;
@@ -40,7 +41,8 @@ using System.Reflection;
40 41
41namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture 42namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
42{ 43{
43 public class DynamicTextureModule : IRegionModule, IDynamicTextureManager 44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
45 public class DynamicTextureModule : ISharedRegionModule, IDynamicTextureManager
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
@@ -210,9 +212,14 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
210 212
211 #endregion 213 #endregion
212 214
213 #region IRegionModule Members 215 #region ISharedRegionModule Members
214 216
215 public void Initialise(Scene scene, IConfigSource config) 217 public void Initialise(IConfigSource config)
218 {
219
220 }
221
222 public void AddRegion(Scene scene)
216 { 223 {
217 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) 224 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
218 { 225 {
@@ -221,6 +228,24 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
221 } 228 }
222 } 229 }
223 230
231 public Type ReplaceableInterface
232 {
233 get { return null; }
234 }
235
236 public void RegionLoaded(Scene scene)
237 {
238 }
239
240 public void RemoveRegion(Scene scene)
241 {
242 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
243 {
244 RegisteredScenes.Remove(scene.RegionInfo.RegionID);
245 scene.UnregisterModuleInterface<IDynamicTextureManager>(this);
246 }
247 }
248
224 public void PostInitialise() 249 public void PostInitialise()
225 { 250 {
226 } 251 }
@@ -234,11 +259,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
234 get { return "DynamicTextureModule"; } 259 get { return "DynamicTextureModule"; }
235 } 260 }
236 261
237 public bool IsSharedModule
238 {
239 get { return true; }
240 }
241
242 #endregion 262 #endregion
243 263
244 #region Nested type: DynamicTextureUpdater 264 #region Nested type: DynamicTextureUpdater
@@ -358,18 +378,18 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
358 // tmptex.DefaultTexture.Fullbright = true; 378 // tmptex.DefaultTexture.Fullbright = true;
359 379
360 part.UpdateTexture(tmptex); 380 part.UpdateTexture(tmptex);
361 } 381 }
362 382
363 if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0)) 383 if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0))
364 { 384 {
365 if (oldAsset == null) oldAsset = scene.AssetService.Get(oldID.ToString()); 385 if (oldAsset == null) oldAsset = scene.AssetService.Get(oldID.ToString());
366 if (oldAsset != null) 386 if (oldAsset != null)
367 { 387 {
368 if (oldAsset.Temporary == true) 388 if (oldAsset.Temporary == true)
369 { 389 {
370 scene.AssetService.Delete(oldID.ToString()); 390 scene.AssetService.Delete(oldID.ToString());
371 } 391 }
372 } 392 }
373 } 393 }
374 } 394 }
375 395
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
index 83f004d..d6ed468 100644
--- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
@@ -32,6 +32,7 @@ using System.Text.RegularExpressions;
32using DotNetOpenMail; 32using DotNetOpenMail;
33using DotNetOpenMail.SmtpAuth; 33using DotNetOpenMail.SmtpAuth;
34using log4net; 34using log4net;
35using Mono.Addins;
35using Nini.Config; 36using Nini.Config;
36using OpenMetaverse; 37using OpenMetaverse;
37using OpenSim.Framework; 38using OpenSim.Framework;
@@ -40,6 +41,7 @@ using OpenSim.Region.Framework.Scenes;
40 41
41namespace OpenSim.Region.CoreModules.Scripting.EmailModules 42namespace OpenSim.Region.CoreModules.Scripting.EmailModules
42{ 43{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
43 public class EmailModule : IEmailModule 45 public class EmailModule : IEmailModule
44 { 46 {
45 // 47 //
@@ -94,7 +96,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
94 } 96 }
95 } 97 }
96 98
97 public void Initialise(Scene scene, IConfigSource config) 99 public void Initialise(IConfigSource config)
98 { 100 {
99 m_Config = config; 101 m_Config = config;
100 IConfig SMTPConfig; 102 IConfig SMTPConfig;
@@ -136,7 +138,16 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
136 m_Enabled = false; 138 m_Enabled = false;
137 return; 139 return;
138 } 140 }
141 m_log.Info("[EMAIL] Activated DefaultEmailModule");
142 }
143
144 public Type ReplaceableInterface
145 {
146 get { return null; }
147 }
139 148
149 public void AddRegion(Scene scene)
150 {
140 // It's a go! 151 // It's a go!
141 if (m_Enabled) 152 if (m_Enabled)
142 { 153 {
@@ -155,8 +166,20 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
155 m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); 166 m_Scenes.Add(scene.RegionInfo.RegionHandle, scene);
156 } 167 }
157 } 168 }
169 }
170 }
158 171
159 m_log.Info("[EMAIL] Activated DefaultEmailModule"); 172 public void RegionLoaded(Scene scene)
173 {
174 }
175
176 public void RemoveRegion(Scene scene)
177 {
178 scene.UnregisterModuleInterface<IEmailModule>(this);
179
180 if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle))
181 {
182 m_Scenes.Remove(scene.RegionInfo.RegionHandle);
160 } 183 }
161 } 184 }
162 185
@@ -173,11 +196,6 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
173 get { return "DefaultEmailModule"; } 196 get { return "DefaultEmailModule"; }
174 } 197 }
175 198
176 public bool IsSharedModule
177 {
178 get { return true; }
179 }
180
181 /// <summary> 199 /// <summary>
182 /// Delay function using thread in seconds 200 /// Delay function using thread in seconds
183 /// </summary> 201 /// </summary>
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index d78931a..e331b8d 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -31,6 +31,7 @@ using System.IO;
31using System.Net; 31using System.Net;
32using System.Text; 32using System.Text;
33using System.Threading; 33using System.Threading;
34using Mono.Addins;
34using Nini.Config; 35using Nini.Config;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenSim.Framework; 37using OpenSim.Framework;
@@ -84,7 +85,8 @@ using OpenSim.Region.Framework.Scenes;
84 85
85namespace OpenSim.Region.CoreModules.Scripting.HttpRequest 86namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
86{ 87{
87 public class HttpRequestModule : IRegionModule, IHttpRequestModule 88 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
89 public class HttpRequestModule : ISharedRegionModule, IHttpRequestModule
88 { 90 {
89 private object HttpListLock = new object(); 91 private object HttpListLock = new object();
90 private int httpTimeout = 30000; 92 private int httpTimeout = 30000;
@@ -229,18 +231,35 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
229 231
230 #endregion 232 #endregion
231 233
232 #region IRegionModule Members 234 #region ISharedRegionModule Members
233 235
234 public void Initialise(Scene scene, IConfigSource config) 236 public void Initialise(IConfigSource config)
237 {
238 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
239 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
240
241 m_pendingRequests = new Dictionary<UUID, HttpRequestClass>();
242 }
243
244 public void AddRegion(Scene scene)
235 { 245 {
236 m_scene = scene; 246 m_scene = scene;
237 247
238 m_scene.RegisterModuleInterface<IHttpRequestModule>(this); 248 m_scene.RegisterModuleInterface<IHttpRequestModule>(this);
249 }
250
251 public Type ReplaceableInterface
252 {
253 get { return null; }
254 }
239 255
240 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); 256 public void RegionLoaded(Scene scene)
241 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); 257 {
258 }
242 259
243 m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); 260 public void RemoveRegion(Scene scene)
261 {
262 scene.UnregisterModuleInterface<IHttpRequestModule>(this);
244 } 263 }
245 264
246 public void PostInitialise() 265 public void PostInitialise()
@@ -256,11 +275,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
256 get { return m_name; } 275 get { return m_name; }
257 } 276 }
258 277
259 public bool IsSharedModule
260 {
261 get { return true; }
262 }
263
264 #endregion 278 #endregion
265 } 279 }
266 280
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index 9b565ed..6ce55a9 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -126,6 +126,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
126 126
127 public void RemoveRegion(Scene scene) 127 public void RemoveRegion(Scene scene)
128 { 128 {
129 scene.UnregisterModuleInterface<IUrlModule>(this);
130 scene.EventManager.OnScriptReset -= OnScriptReset;
129 } 131 }
130 132
131 public void Close() 133 public void Close()
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
index c23cea5..35ce2cb 100644
--- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
@@ -29,6 +29,7 @@ using System;
29using System.Drawing; 29using System.Drawing;
30using System.IO; 30using System.IO;
31using System.Net; 31using System.Net;
32using Mono.Addins;
32using Nini.Config; 33using Nini.Config;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenMetaverse.Imaging; 35using OpenMetaverse.Imaging;
@@ -39,7 +40,8 @@ using System.Reflection;
39 40
40namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL 41namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
41{ 42{
42 public class LoadImageURLModule : IRegionModule, IDynamicTextureRender 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
44 public class LoadImageURLModule : ISharedRegionModule, IDynamicTextureRender
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
@@ -97,20 +99,28 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
97 99
98 #endregion 100 #endregion
99 101
100 #region IRegionModule Members 102 #region ISharedRegionModule Members
101 103
102 public void Initialise(Scene scene, IConfigSource config) 104 public void Initialise(IConfigSource config)
105 {
106 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
107 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
108 }
109
110 public void AddRegion(Scene scene)
103 { 111 {
104 if (m_scene == null) 112 if (m_scene == null)
105 { 113 {
106 m_scene = scene; 114 m_scene = scene;
107 } 115 }
108
109 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
110 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
111 } 116 }
112 117
113 public void PostInitialise() 118 public Type ReplaceableInterface
119 {
120 get { return null; }
121 }
122
123 public void RegionLoaded(Scene scene)
114 { 124 {
115 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); 125 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
116 if (m_textureManager != null) 126 if (m_textureManager != null)
@@ -119,18 +129,21 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
119 } 129 }
120 } 130 }
121 131
122 public void Close() 132 public void RemoveRegion(Scene scene)
123 { 133 {
124 } 134 }
125 135
126 public string Name 136 public void PostInitialise()
127 { 137 {
128 get { return m_name; }
129 } 138 }
130 139
131 public bool IsSharedModule 140 public void Close()
132 { 141 {
133 get { return true; } 142 }
143
144 public string Name
145 {
146 get { return m_name; }
134 } 147 }
135 148
136 #endregion 149 #endregion
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index d57a8e5..71b01a1 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -31,6 +31,7 @@ using System.Drawing.Imaging;
31using System.Globalization; 31using System.Globalization;
32using System.IO; 32using System.IO;
33using System.Net; 33using System.Net;
34using Mono.Addins;
34using Nini.Config; 35using Nini.Config;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenMetaverse.Imaging; 37using OpenMetaverse.Imaging;
@@ -43,7 +44,8 @@ using System.Reflection;
43 44
44namespace OpenSim.Region.CoreModules.Scripting.VectorRender 45namespace OpenSim.Region.CoreModules.Scripting.VectorRender
45{ 46{
46 public class VectorRenderModule : IRegionModule, IDynamicTextureRender 47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
48 public class VectorRenderModule : ISharedRegionModule, IDynamicTextureRender
47 { 49 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 51
@@ -110,15 +112,10 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
110 112
111 #endregion 113 #endregion
112 114
113 #region IRegionModule Members 115 #region ISharedRegionModule Members
114 116
115 public void Initialise(Scene scene, IConfigSource config) 117 public void Initialise(IConfigSource config)
116 { 118 {
117 if (m_scene == null)
118 {
119 m_scene = scene;
120 }
121
122 if (m_graph == null) 119 if (m_graph == null)
123 { 120 {
124 Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); 121 Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
@@ -133,7 +130,20 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
133 m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName); 130 m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName);
134 } 131 }
135 132
136 public void PostInitialise() 133 public void AddRegion(Scene scene)
134 {
135 if (m_scene == null)
136 {
137 m_scene = scene;
138 }
139 }
140
141 public Type ReplaceableInterface
142 {
143 get { return null; }
144 }
145
146 public void RegionLoaded(Scene scene)
137 { 147 {
138 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); 148 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
139 if (m_textureManager != null) 149 if (m_textureManager != null)
@@ -142,18 +152,21 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
142 } 152 }
143 } 153 }
144 154
145 public void Close() 155 public void RemoveRegion(Scene scene)
146 { 156 {
147 } 157 }
148 158
149 public string Name 159 public void PostInitialise()
150 { 160 {
151 get { return m_name; }
152 } 161 }
153 162
154 public bool IsSharedModule 163 public void Close()
164 {
165 }
166
167 public string Name
155 { 168 {
156 get { return true; } 169 get { return m_name; }
157 } 170 }
158 171
159 #endregion 172 #endregion
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index 60df2e7..acd8dbf 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using Mono.Addins;
31using Nini.Config; 32using Nini.Config;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -85,7 +86,8 @@ using OpenSim.Region.Framework.Scenes;
85 86
86namespace OpenSim.Region.CoreModules.Scripting.WorldComm 87namespace OpenSim.Region.CoreModules.Scripting.WorldComm
87{ 88{
88 public class WorldCommModule : IRegionModule, IWorldComm 89 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
90 public class WorldCommModule : INonSharedRegionModule, IWorldComm
89 { 91 {
90 // private static readonly ILog m_log = 92 // private static readonly ILog m_log =
91 // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 93 // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -98,9 +100,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
98 private int m_saydistance = 30; 100 private int m_saydistance = 30;
99 private int m_shoutdistance = 100; 101 private int m_shoutdistance = 100;
100 102
101 #region IRegionModule Members 103 #region ISharedRegionModule Members
102 104
103 public void Initialise(Scene scene, IConfigSource config) 105 public void Initialise(IConfigSource config)
104 { 106 {
105 // wrap this in a try block so that defaults will work if 107 // wrap this in a try block so that defaults will work if
106 // the config file doesn't specify otherwise. 108 // the config file doesn't specify otherwise.
@@ -120,31 +122,42 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
120 if (maxlisteners < 1) maxlisteners = int.MaxValue; 122 if (maxlisteners < 1) maxlisteners = int.MaxValue;
121 if (maxhandles < 1) maxhandles = int.MaxValue; 123 if (maxhandles < 1) maxhandles = int.MaxValue;
122 124
125 m_listenerManager = new ListenerManager(maxlisteners, maxhandles);
126 m_pendingQ = new Queue();
127 m_pending = Queue.Synchronized(m_pendingQ);
128 }
129
130 public void AddRegion(Scene scene)
131 {
123 m_scene = scene; 132 m_scene = scene;
124 m_scene.RegisterModuleInterface<IWorldComm>(this); 133 m_scene.RegisterModuleInterface<IWorldComm>(this);
125 m_listenerManager = new ListenerManager(maxlisteners, maxhandles);
126 m_scene.EventManager.OnChatFromClient += DeliverClientMessage; 134 m_scene.EventManager.OnChatFromClient += DeliverClientMessage;
127 m_scene.EventManager.OnChatBroadcast += DeliverClientMessage; 135 m_scene.EventManager.OnChatBroadcast += DeliverClientMessage;
128 m_pendingQ = new Queue();
129 m_pending = Queue.Synchronized(m_pendingQ);
130 } 136 }
131 137
132 public void PostInitialise() 138 public Type ReplaceableInterface
133 { 139 {
140 get { return null; }
134 } 141 }
135 142
136 public void Close() 143 public void RegionLoaded(Scene scene)
137 { 144 {
138 } 145 }
139 146
140 public string Name 147 public void RemoveRegion(Scene scene)
141 { 148 {
142 get { return "WorldCommModule"; } 149 scene.UnregisterModuleInterface<IWorldComm>(this);
150 scene.EventManager.OnChatFromClient -= DeliverClientMessage;
151 scene.EventManager.OnChatBroadcast -= DeliverClientMessage;
143 } 152 }
144 153
145 public bool IsSharedModule 154 public void Close()
146 { 155 {
147 get { return false; } 156 }
157
158 public string Name
159 {
160 get { return "WorldCommModule"; }
148 } 161 }
149 162
150 #endregion 163 #endregion
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
index 27b64bf..a9147fb6 100644
--- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -32,6 +32,7 @@ using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Threading;
34using log4net; 34using log4net;
35using Mono.Addins;
35using Nini.Config; 36using Nini.Config;
36using Nwc.XmlRpc; 37using Nwc.XmlRpc;
37using OpenMetaverse; 38using OpenMetaverse;
@@ -76,7 +77,8 @@ using OpenSim.Region.Framework.Scenes;
76 77
77namespace OpenSim.Region.CoreModules.Scripting.XMLRPC 78namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
78{ 79{
79 public class XMLRPCModule : IRegionModule, IXMLRPC 80 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
81 public class XMLRPCModule : ISharedRegionModule, IXMLRPC
80 { 82 {
81 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 83 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
82 84
@@ -94,9 +96,9 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
94 private int RemoteReplyScriptWait = 300; 96 private int RemoteReplyScriptWait = 300;
95 private object XMLRPCListLock = new object(); 97 private object XMLRPCListLock = new object();
96 98
97 #region IRegionModule Members 99 #region ISharedRegionModule Members
98 100
99 public void Initialise(Scene scene, IConfigSource config) 101 public void Initialise(IConfigSource config)
100 { 102 {
101 // We need to create these early because the scripts might be calling 103 // We need to create these early because the scripts might be calling
102 // But since this gets called for every region, we need to make sure they 104 // But since this gets called for every region, we need to make sure they
@@ -116,7 +118,14 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
116 { 118 {
117 } 119 }
118 } 120 }
121 }
122
123 public void PostInitialise()
124 {
125 }
119 126
127 public void AddRegion(Scene scene)
128 {
120 if (!m_scenes.Contains(scene)) 129 if (!m_scenes.Contains(scene))
121 { 130 {
122 m_scenes.Add(scene); 131 m_scenes.Add(scene);
@@ -125,7 +134,12 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
125 } 134 }
126 } 135 }
127 136
128 public void PostInitialise() 137 public Type ReplaceableInterface
138 {
139 get { return null; }
140 }
141 private Dictionary<Scene, BaseHttpServer> m_HttpServers = new Dictionary<Scene, BaseHttpServer>();
142 public void RegionLoaded(Scene scene)
129 { 143 {
130 if (IsEnabled()) 144 if (IsEnabled())
131 { 145 {
@@ -133,24 +147,41 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
133 // Attach xmlrpc handlers 147 // Attach xmlrpc handlers
134 m_log.Info("[REMOTE_DATA]: " + 148 m_log.Info("[REMOTE_DATA]: " +
135 "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); 149 "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
136 BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort); 150 BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort);
137 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); 151 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
138 httpServer.Start(); 152 httpServer.Start();
153 m_HttpServers.Add(scene, httpServer);
139 } 154 }
140 } 155 }
141 156
142 public void Close() 157 public void RemoveRegion(Scene scene)
143 { 158 {
159 if (m_scenes.Contains(scene))
160 m_scenes.Remove(scene);
161 scene.UnregisterModuleInterface<IXMLRPC>(this);
162 if (IsEnabled())
163 {
164 // Start http server
165 // Attach xmlrpc handlers
166 if (m_HttpServers.ContainsKey(scene))
167 {
168 BaseHttpServer httpServer;
169 m_HttpServers.TryGetValue(scene, out httpServer);
170 m_log.Info("[REMOTE_DATA]: " +
171 "Stopping XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
172 httpServer.RemoveXmlRPCHandler("llRemoteData");
173 httpServer.Stop();
174 }
175 }
144 } 176 }
145 177
146 public string Name 178 public void Close()
147 { 179 {
148 get { return m_name; }
149 } 180 }
150 181
151 public bool IsSharedModule 182 public string Name
152 { 183 {
153 get { return true; } 184 get { return m_name; }
154 } 185 }
155 186
156 public int Port 187 public int Port
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs
index 879cc70..d3e2db7 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset
47 private IConfigSource m_Config; 47 private IConfigSource m_Config;
48 bool m_Registered = false; 48 bool m_Registered = false;
49 49
50 #region IRegionModule interface 50 #region ISharedRegionModule interface
51 51
52 public void Initialise(IConfigSource config) 52 public void Initialise(IConfigSource config)
53 { 53 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
index b12d778..a895a3f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
51 bool m_Registered = false; 51 bool m_Registered = false;
52 HypergridServiceInConnector m_HypergridHandler; 52 HypergridServiceInConnector m_HypergridHandler;
53 53
54 #region IRegionModule interface 54 #region ISharedRegionModule interface
55 55
56 public void Initialise(IConfigSource config) 56 public void Initialise(IConfigSource config)
57 { 57 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
index 54c6d89..4c74725 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory
47 private IConfigSource m_Config; 47 private IConfigSource m_Config;
48 bool m_Registered = false; 48 bool m_Registered = false;
49 49
50 #region IRegionModule interface 50 #region ISharedRegionModule interface
51 51
52 public void Initialise(IConfigSource config) 52 public void Initialise(IConfigSource config)
53 { 53 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
index bce160a..dcc6dec 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
50 private IConfigSource m_Config; 50 private IConfigSource m_Config;
51 private List<Scene> m_Scenes = new List<Scene>(); 51 private List<Scene> m_Scenes = new List<Scene>();
52 52
53 #region IRegionModule interface 53 #region ISharedRegionModule interface
54 54
55 public void Initialise(IConfigSource config) 55 public void Initialise(IConfigSource config)
56 { 56 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
index 8a90370..a5c5ef6 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour
50 private IConfigSource m_Config; 50 private IConfigSource m_Config;
51 private List<Scene> m_Scenes = new List<Scene>(); 51 private List<Scene> m_Scenes = new List<Scene>();
52 52
53 #region IRegionModule interface 53 #region ISharedRegionModule interface
54 54
55 public void Initialise(IConfigSource config) 55 public void Initialise(IConfigSource config)
56 { 56 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
index f28a318..c2cea16 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation
49 private IConfigSource m_Config; 49 private IConfigSource m_Config;
50 bool m_Registered = false; 50 bool m_Registered = false;
51 51
52 #region IRegionModule interface 52 #region ISharedRegionModule interface
53 53
54 public void Initialise(IConfigSource config) 54 public void Initialise(IConfigSource config)
55 { 55 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
index d68c683..71d7993 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
48 48
49 #endregion /* Events */ 49 #endregion /* Events */
50 50
51 #region IRegionModule 51 #region ISharedRegionModule
52 52
53 public void Initialise(IConfigSource config) 53 public void Initialise(IConfigSource config)
54 { 54 {
@@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
136 } 136 }
137 } 137 }
138 138
139 #endregion /* IRegionModule */ 139 #endregion
140 140
141 #region IInterregionComms 141 #region IInterregionComms
142 142
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
index 44458d1..24d35e1 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
66 protected bool m_safemode; 66 protected bool m_safemode;
67 protected IPAddress m_thisIP; 67 protected IPAddress m_thisIP;
68 68
69 #region IRegionModule 69 #region ISharedRegionModule
70 70
71 public virtual void Initialise(IConfigSource config) 71 public virtual void Initialise(IConfigSource config)
72 { 72 {
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
149 MainServer.Instance.AddHTTPHandler("/object/", ObjectHandler); 149 MainServer.Instance.AddHTTPHandler("/object/", ObjectHandler);
150 } 150 }
151 151
152 #endregion /* IRegionModule */ 152 #endregion
153 153
154 #region IInterregionComms 154 #region IInterregionComms
155 155
@@ -436,12 +436,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
436 } 436 }
437 437
438 OSDMap resp = new OSDMap(2); 438 OSDMap resp = new OSDMap(2);
439 string reason = String.Empty; 439 string reason = String.Empty;
440 uint teleportFlags = 0; 440 uint teleportFlags = 0;
441 if (args.ContainsKey("teleport_flags")) 441 if (args.ContainsKey("teleport_flags"))
442 { 442 {
443 teleportFlags = args["teleport_flags"].AsUInteger(); 443 teleportFlags = args["teleport_flags"].AsUInteger();
444 } 444 }
445 445
446 // This is the meaning of POST agent 446 // This is the meaning of POST agent
447 m_regionClient.AdjustUserInformation(aCircuit); 447 m_regionClient.AdjustUserInformation(aCircuit);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index fc8d4e1..c738b65 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -81,6 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
81 81
82 public void RemoveRegion(Scene scene) 82 public void RemoveRegion(Scene scene)
83 { 83 {
84 scene.UnregisterModuleInterface<IRegionArchiverModule>(this);
84 } 85 }
85 86
86 public void Close() 87 public void Close()
diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
index 5fa3dc2..a2cfce6 100644
--- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
+++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.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 OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
@@ -35,6 +36,7 @@ using OpenSim.Region.Framework.Scenes;
35 36
36namespace OpenSim.Region.CoreModules 37namespace OpenSim.Region.CoreModules
37{ 38{
39 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
38 public class CloudModule : ICloudModule 40 public class CloudModule : ICloudModule
39 { 41 {
40// private static readonly log4net.ILog m_log 42// private static readonly log4net.ILog m_log
@@ -48,7 +50,7 @@ namespace OpenSim.Region.CoreModules
48 private float m_cloudDensity = 1.0F; 50 private float m_cloudDensity = 1.0F;
49 private float[] cloudCover = new float[16 * 16]; 51 private float[] cloudCover = new float[16 * 16];
50 52
51 public void Initialise(Scene scene, IConfigSource config) 53 public void Initialise(IConfigSource config)
52 { 54 {
53 IConfig cloudConfig = config.Configs["Cloud"]; 55 IConfig cloudConfig = config.Configs["Cloud"];
54 56
@@ -58,10 +60,17 @@ namespace OpenSim.Region.CoreModules
58 m_cloudDensity = cloudConfig.GetFloat("density", 0.5F); 60 m_cloudDensity = cloudConfig.GetFloat("density", 0.5F);
59 m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000); 61 m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000);
60 } 62 }
63 }
64
65 public Type ReplaceableInterface
66 {
67 get { return null; }
68 }
61 69
70 public void AddRegion(Scene scene)
71 {
62 if (m_enabled) 72 if (m_enabled)
63 { 73 {
64
65 m_scene = scene; 74 m_scene = scene;
66 75
67 scene.EventManager.OnNewClient += CloudsToClient; 76 scene.EventManager.OnNewClient += CloudsToClient;
@@ -71,9 +80,18 @@ namespace OpenSim.Region.CoreModules
71 GenerateCloudCover(); 80 GenerateCloudCover();
72 81
73 m_ready = true; 82 m_ready = true;
74
75 } 83 }
84 }
76 85
86 public void RegionLoaded(Scene scene)
87 {
88 }
89
90 public void RemoveRegion(Scene scene)
91 {
92 scene.EventManager.OnNewClient -= CloudsToClient;
93 scene.UnregisterModuleInterface<ICloudModule>(this);
94 scene.EventManager.OnFrame -= CloudUpdate;
77 } 95 }
78 96
79 public void PostInitialise() 97 public void PostInitialise()
@@ -96,12 +114,6 @@ namespace OpenSim.Region.CoreModules
96 get { return "CloudModule"; } 114 get { return "CloudModule"; }
97 } 115 }
98 116
99 public bool IsSharedModule
100 {
101 get { return false; }
102 }
103
104
105 public float CloudCover(int x, int y, int z) 117 public float CloudCover(int x, int y, int z)
106 { 118 {
107 float cover = 0f; 119 float cover = 0f;
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 695cced..39836ae 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -30,6 +30,7 @@ using System.IO;
30using System.Reflection; 30using System.Reflection;
31using System.Security; 31using System.Security;
32using log4net; 32using log4net;
33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenSim.Framework; 36using OpenSim.Framework;
@@ -38,6 +39,7 @@ using OpenSim.Region.Framework.Scenes;
38 39
39namespace OpenSim.Region.CoreModules.World.Estate 40namespace OpenSim.Region.CoreModules.World.Estate
40{ 41{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
41 public class EstateManagementModule : IEstateModule 43 public class EstateManagementModule : IEstateModule
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);
@@ -898,7 +900,16 @@ namespace OpenSim.Region.CoreModules.World.Estate
898 900
899 #region IRegionModule Members 901 #region IRegionModule Members
900 902
901 public void Initialise(Scene scene, IConfigSource source) 903 public void Initialise(IConfigSource source)
904 {
905 }
906
907 public Type ReplaceableInterface
908 {
909 get { return null; }
910 }
911
912 public void AddRegion(Scene scene)
902 { 913 {
903 m_scene = scene; 914 m_scene = scene;
904 m_scene.RegisterModuleInterface<IEstateModule>(this); 915 m_scene.RegisterModuleInterface<IEstateModule>(this);
@@ -920,6 +931,29 @@ namespace OpenSim.Region.CoreModules.World.Estate
920 consoleSetTerrainHeights); 931 consoleSetTerrainHeights);
921 } 932 }
922 933
934 public void RegionLoaded(Scene scene)
935 {
936 // Sets up the sun module based on the saved Estate and Region Settings
937 // DO NOT REMOVE or the sun will stop working
938 TriggerEstateToolsSunUpdate();
939 }
940
941 public void RemoveRegion(Scene scene)
942 {
943 scene.UnregisterModuleInterface<IEstateModule>(this);
944 scene.EventManager.OnNewClient -= EventManager_OnNewClient;
945 scene.EventManager.OnRequestChangeWaterHeight -= changeWaterHeight;
946 }
947
948 public void Close()
949 {
950 }
951
952 public string Name
953 {
954 get { return "EstateManagementModule"; }
955 }
956
923 #region Console Commands 957 #region Console Commands
924 958
925 public void consoleSetTerrainTexture(string module, string[] args) 959 public void consoleSetTerrainTexture(string module, string[] args)
@@ -1006,28 +1040,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
1006 } 1040 }
1007 1041
1008 #endregion 1042 #endregion
1009
1010 public void PostInitialise()
1011 {
1012 // Sets up the sun module based no the saved Estate and Region Settings
1013 // DO NOT REMOVE or the sun will stop working
1014 TriggerEstateToolsSunUpdate();
1015 }
1016
1017 public void Close()
1018 {
1019 }
1020
1021 public string Name
1022 {
1023 get { return "EstateManagementModule"; }
1024 }
1025
1026 public bool IsSharedModule
1027 {
1028 get { return false; }
1029 }
1030
1031 #endregion 1043 #endregion
1032 1044
1033 #region Other Functions 1045 #region Other Functions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index f66f01f..68e8485 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.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;
@@ -89,7 +90,8 @@ enum GroupPowers : long
89 90
90namespace OpenSim.Region.CoreModules.World.Permissions 91namespace OpenSim.Region.CoreModules.World.Permissions
91{ 92{
92 public class PermissionsModule : IRegionModule 93 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
94 public class PermissionsModule : INonSharedRegionModule
93 { 95 {
94 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 96 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
95 97
@@ -148,12 +150,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
148 150
149 #endregion 151 #endregion
150 152
151 #region IRegionModule Members 153 #region INonSharedRegionModule Members
152 154
153 public void Initialise(Scene scene, IConfigSource config) 155 public void Initialise(IConfigSource config)
154 { 156 {
155 m_scene = scene;
156
157 IConfig myConfig = config.Configs["Startup"]; 157 IConfig myConfig = config.Configs["Startup"];
158 158
159 string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); 159 string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule");
@@ -177,7 +177,57 @@ namespace OpenSim.Region.CoreModules.World.Permissions
177 if (m_bypassPermissions) 177 if (m_bypassPermissions)
178 m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks"); 178 m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks");
179 else 179 else
180 m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); 180 m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks");
181
182 string grant = myConfig.GetString("GrantLSL","");
183 if (grant.Length > 0) {
184 foreach (string uuidl in grant.Split(',')) {
185 string uuid = uuidl.Trim(" \t".ToCharArray());
186 GrantLSL.Add(uuid, true);
187 }
188 }
189
190 grant = myConfig.GetString("GrantCS","");
191 if (grant.Length > 0) {
192 foreach (string uuidl in grant.Split(',')) {
193 string uuid = uuidl.Trim(" \t".ToCharArray());
194 GrantCS.Add(uuid, true);
195 }
196 }
197
198 grant = myConfig.GetString("GrantVB","");
199 if (grant.Length > 0) {
200 foreach (string uuidl in grant.Split(',')) {
201 string uuid = uuidl.Trim(" \t".ToCharArray());
202 GrantVB.Add(uuid, true);
203 }
204 }
205
206 grant = myConfig.GetString("GrantJS", "");
207 if (grant.Length > 0)
208 {
209 foreach (string uuidl in grant.Split(','))
210 {
211 string uuid = uuidl.Trim(" \t".ToCharArray());
212 GrantJS.Add(uuid, true);
213 }
214 }
215
216 grant = myConfig.GetString("GrantYP", "");
217 if (grant.Length > 0)
218 {
219 foreach (string uuidl in grant.Split(','))
220 {
221 string uuid = uuidl.Trim(" \t".ToCharArray());
222 GrantYP.Add(uuid, true);
223 }
224 }
225
226 }
227
228 public void AddRegion(Scene scene)
229 {
230 m_scene = scene;
181 231
182 //Register functions with Scene External Checks! 232 //Register functions with Scene External Checks!
183 m_scene.Permissions.OnBypassPermissions += BypassPermissions; 233 m_scene.Permissions.OnBypassPermissions += BypassPermissions;
@@ -210,23 +260,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
210 m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED 260 m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED
211 m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED 261 m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED
212 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED 262 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED
213 263
214 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED 264 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED
215 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED 265 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED
216 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED 266 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED
217 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED 267 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED
218 268
219 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE 269 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE
220 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED 270 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
221 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED 271 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED
222 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED 272 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED
223 m_scene.Permissions.OnResetScript += CanResetScript; 273 m_scene.Permissions.OnResetScript += CanResetScript;
224 274
225 m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED 275 m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED
226 m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED 276 m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED
227 m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED 277 m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED
228 m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED 278 m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED
229 279
230 m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED 280 m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED
231 m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED 281 m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED
232 282
@@ -244,52 +294,87 @@ namespace OpenSim.Region.CoreModules.World.Permissions
244 "debug permissions <true / false>", 294 "debug permissions <true / false>",
245 "Enable permissions debugging", 295 "Enable permissions debugging",
246 HandleDebugPermissions); 296 HandleDebugPermissions);
247 297 }
248
249 string grant = myConfig.GetString("GrantLSL","");
250 if (grant.Length > 0) {
251 foreach (string uuidl in grant.Split(',')) {
252 string uuid = uuidl.Trim(" \t".ToCharArray());
253 GrantLSL.Add(uuid, true);
254 }
255 }
256 298
257 grant = myConfig.GetString("GrantCS",""); 299 public Type ReplaceableInterface
258 if (grant.Length > 0) { 300 {
259 foreach (string uuidl in grant.Split(',')) { 301 get { return null; }
260 string uuid = uuidl.Trim(" \t".ToCharArray()); 302 }
261 GrantCS.Add(uuid, true);
262 }
263 }
264 303
265 grant = myConfig.GetString("GrantVB",""); 304 public void RegionLoaded(Scene scene)
266 if (grant.Length > 0) { 305 {
267 foreach (string uuidl in grant.Split(',')) { 306 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
268 string uuid = uuidl.Trim(" \t".ToCharArray());
269 GrantVB.Add(uuid, true);
270 }
271 }
272 307
273 grant = myConfig.GetString("GrantJS", ""); 308 if (m_friendsModule == null)
274 if (grant.Length > 0) 309 m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work");
275 { 310 else
276 foreach (string uuidl in grant.Split(',')) 311 m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled");
277 { 312 }
278 string uuid = uuidl.Trim(" \t".ToCharArray());
279 GrantJS.Add(uuid, true);
280 }
281 }
282 313
283 grant = myConfig.GetString("GrantYP", ""); 314 public void RemoveRegion(Scene scene)
284 if (grant.Length > 0) 315 {
285 { 316 scene.Permissions.OnBypassPermissions -= BypassPermissions;
286 foreach (string uuidl in grant.Split(',')) 317 scene.Permissions.OnSetBypassPermissions -= SetBypassPermissions;
287 { 318 scene.Permissions.OnPropagatePermissions -= PropagatePermissions;
288 string uuid = uuidl.Trim(" \t".ToCharArray()); 319 scene.Permissions.OnGenerateClientFlags -= GenerateClientFlags;
289 GrantYP.Add(uuid, true); 320 scene.Permissions.OnAbandonParcel -= CanAbandonParcel;
290 } 321 scene.Permissions.OnReclaimParcel -= CanReclaimParcel;
291 } 322 scene.Permissions.OnDeedParcel -= CanDeedParcel;
323 scene.Permissions.OnDeedObject -= CanDeedObject;
324 scene.Permissions.OnIsGod -= IsGod;
325 scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
326 scene.Permissions.OnDeleteObject -= CanDeleteObject; //MAYBE FULLY IMPLEMENTED
327 scene.Permissions.OnEditObject -= CanEditObject; //MAYBE FULLY IMPLEMENTED
328 scene.Permissions.OnEditParcel -= CanEditParcel; //MAYBE FULLY IMPLEMENTED
329 scene.Permissions.OnInstantMessage -= CanInstantMessage;
330 scene.Permissions.OnInventoryTransfer -= CanInventoryTransfer; //NOT YET IMPLEMENTED
331 scene.Permissions.OnIssueEstateCommand -= CanIssueEstateCommand; //FULLY IMPLEMENTED
332 scene.Permissions.OnMoveObject -= CanMoveObject; //MAYBE FULLY IMPLEMENTED
333 scene.Permissions.OnObjectEntry -= CanObjectEntry;
334 scene.Permissions.OnReturnObject -= CanReturnObject; //NOT YET IMPLEMENTED
335 scene.Permissions.OnRezObject -= CanRezObject; //MAYBE FULLY IMPLEMENTED
336 scene.Permissions.OnRunConsoleCommand -= CanRunConsoleCommand;
337 scene.Permissions.OnRunScript -= CanRunScript; //NOT YET IMPLEMENTED
338 scene.Permissions.OnCompileScript -= CanCompileScript;
339 scene.Permissions.OnSellParcel -= CanSellParcel;
340 scene.Permissions.OnTakeObject -= CanTakeObject;
341 scene.Permissions.OnTakeCopyObject -= CanTakeCopyObject;
342 scene.Permissions.OnTerraformLand -= CanTerraformLand;
343 scene.Permissions.OnLinkObject -= CanLinkObject; //NOT YET IMPLEMENTED
344 scene.Permissions.OnDelinkObject -= CanDelinkObject; //NOT YET IMPLEMENTED
345 scene.Permissions.OnBuyLand -= CanBuyLand; //NOT YET IMPLEMENTED
346
347 scene.Permissions.OnViewNotecard -= CanViewNotecard; //NOT YET IMPLEMENTED
348 scene.Permissions.OnViewScript -= CanViewScript; //NOT YET IMPLEMENTED
349 scene.Permissions.OnEditNotecard -= CanEditNotecard; //NOT YET IMPLEMENTED
350 scene.Permissions.OnEditScript -= CanEditScript; //NOT YET IMPLEMENTED
351
352 scene.Permissions.OnCreateObjectInventory -= CanCreateObjectInventory; //NOT IMPLEMENTED HERE
353 scene.Permissions.OnEditObjectInventory -= CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
354 scene.Permissions.OnCopyObjectInventory -= CanCopyObjectInventory; //NOT YET IMPLEMENTED
355 scene.Permissions.OnDeleteObjectInventory -= CanDeleteObjectInventory; //NOT YET IMPLEMENTED
356 scene.Permissions.OnResetScript -= CanResetScript;
357
358 scene.Permissions.OnCreateUserInventory -= CanCreateUserInventory; //NOT YET IMPLEMENTED
359 scene.Permissions.OnCopyUserInventory -= CanCopyUserInventory; //NOT YET IMPLEMENTED
360 scene.Permissions.OnEditUserInventory -= CanEditUserInventory; //NOT YET IMPLEMENTED
361 scene.Permissions.OnDeleteUserInventory -= CanDeleteUserInventory; //NOT YET IMPLEMENTED
362
363 scene.Permissions.OnTeleport -= CanTeleport; //NOT YET IMPLEMENTED
364 scene.Permissions.OnUseObjectReturn -= CanUseObjectReturn; //NOT YET IMPLEMENTED
365 }
366
367 public void PostInitialise()
368 {
369 }
370
371 public void Close()
372 {
373 }
292 374
375 public string Name
376 {
377 get { return "PermissionsModule"; }
293 } 378 }
294 379
295 public void HandleBypassPermissions(string module, string[] args) 380 public void HandleBypassPermissions(string module, string[] args)
@@ -362,31 +447,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
362 m_log.InfoFormat("[PERMISSIONS] Set permissions debugging to {0} in {1}", m_debugPermissions, m_scene.RegionInfo.RegionName); 447 m_log.InfoFormat("[PERMISSIONS] Set permissions debugging to {0} in {1}", m_debugPermissions, m_scene.RegionInfo.RegionName);
363 } 448 }
364 } 449 }
365
366 public void PostInitialise()
367 {
368 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
369
370 if (m_friendsModule == null)
371 m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work");
372 else
373 m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled");
374 }
375
376 public void Close()
377 {
378 }
379
380 public string Name
381 {
382 get { return "PermissionsModule"; }
383 }
384
385 public bool IsSharedModule
386 {
387 get { return false; }
388 }
389
390 #endregion 450 #endregion
391 451
392 #region Helper Functions 452 #region Helper Functions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index 37f1f2e..ed7bfe1 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using Mono.Addins;
29using Nini.Config; 30using Nini.Config;
30using OpenMetaverse; 31using OpenMetaverse;
31using OpenSim.Framework; 32using OpenSim.Framework;
@@ -34,26 +35,44 @@ using OpenSim.Region.Framework.Scenes;
34 35
35namespace OpenSim.Region.CoreModules.World.Sound 36namespace OpenSim.Region.CoreModules.World.Sound
36{ 37{
37 public class SoundModule : IRegionModule, ISoundModule 38 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
39 public class SoundModule : INonSharedRegionModule, ISoundModule
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
41 protected Scene m_scene; 43 protected Scene m_scene;
42 44
43 public void Initialise(Scene scene, IConfigSource source) 45 public void Initialise(IConfigSource source)
46 {
47 }
48
49 public void AddRegion(Scene scene)
44 { 50 {
45 m_scene = scene; 51 m_scene = scene;
46 52
47 m_scene.EventManager.OnNewClient += OnNewClient; 53 m_scene.EventManager.OnNewClient += OnNewClient;
48 54
49 m_scene.RegisterModuleInterface<ISoundModule>(this); 55 m_scene.RegisterModuleInterface<ISoundModule>(this);
50 } 56 }
57
58 public Type ReplaceableInterface
59 {
60 get { return null; }
61 }
62
63 public void RegionLoaded(Scene scene)
64 {
65 }
66
67 public void RemoveRegion(Scene scene)
68 {
69 scene.EventManager.OnNewClient -= OnNewClient;
70 scene.UnregisterModuleInterface<ISoundModule>(this);
71 }
51 72
52 public void PostInitialise() {}
53 public void Close() {} 73 public void Close() {}
54 public string Name { get { return "Sound Module"; } } 74 public string Name { get { return "Sound Module"; } }
55 public bool IsSharedModule { get { return false; } } 75
56
57 private void OnNewClient(IClientAPI client) 76 private void OnNewClient(IClientAPI client)
58 { 77 {
59 client.OnSoundTrigger += TriggerSound; 78 client.OnSoundTrigger += TriggerSound;
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index 0712a7f..948c47c 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.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,6 +38,7 @@ using OpenSim.Region.Framework.Scenes;
37 38
38namespace OpenSim.Region.CoreModules 39namespace OpenSim.Region.CoreModules
39{ 40{
41 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
40 public class SunModule : ISunModule 42 public class SunModule : ISunModule
41 { 43 {
42 /// <summary> 44 /// <summary>
@@ -278,27 +280,12 @@ namespace OpenSim.Region.CoreModules
278 return GetCurrentSunHour() + 6.0f; 280 return GetCurrentSunHour() + 6.0f;
279 } 281 }
280 282
281 #region IRegion Methods 283 #region INonSharedRegionModule Methods
282 284
283 // Called immediately after the module is loaded for a given region 285 // Called immediately after the module is loaded for a given region
284 // i.e. Immediately after instance creation. 286 // i.e. Immediately after instance creation.
285 public void Initialise(Scene scene, IConfigSource config) 287 public void Initialise(IConfigSource config)
286 { 288 {
287 m_scene = scene;
288 m_frame = 0;
289
290 // This one puts an entry in the main help screen
291 m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
292
293 // This one enables the ability to type just "sun" without any parameters
294 m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand);
295 foreach (KeyValuePair<string, string> kvp in GetParamList())
296 {
297 m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand);
298 }
299
300
301
302 TimeZone local = TimeZone.CurrentTimeZone; 289 TimeZone local = TimeZone.CurrentTimeZone;
303 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; 290 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
304 m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); 291 m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset);
@@ -346,7 +333,43 @@ namespace OpenSim.Region.CoreModules
346 // m_latitude = d_latitude; 333 // m_latitude = d_latitude;
347 // m_longitude = d_longitude; 334 // m_longitude = d_longitude;
348 } 335 }
336 }
337
338 public void Close()
339 {
340 ready = false;
341
342 // Remove our hooks
343 m_scene.EventManager.OnFrame -= SunUpdate;
344 m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
345 m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate;
346 m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
347 }
348
349 public string Name
350 {
351 get { return "SunModule"; }
352 }
353
354 public Type ReplaceableInterface
355 {
356 get { return null; }
357 }
358
359 public void AddRegion(Scene scene)
360 {
361 m_scene = scene;
362 m_frame = 0;
363
364 // This one puts an entry in the main help screen
365 m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
349 366
367 // This one enables the ability to type just "sun" without any parameters
368 m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand);
369 foreach (KeyValuePair<string, string> kvp in GetParamList())
370 {
371 m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand);
372 }
350 switch (m_RegionMode) 373 switch (m_RegionMode)
351 { 374 {
352 case "T1": 375 case "T1":
@@ -354,8 +377,8 @@ namespace OpenSim.Region.CoreModules
354 case "SL": 377 case "SL":
355 // Time taken to complete a cycle (day and season) 378 // Time taken to complete a cycle (day and season)
356 379
357 SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); 380 SecondsPerSunCycle = (uint)(m_DayLengthHours * 60 * 60);
358 SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); 381 SecondsPerYear = (uint)(SecondsPerSunCycle * m_YearLengthDays);
359 382
360 // Ration of real-to-virtual time 383 // Ration of real-to-virtual time
361 384
@@ -364,17 +387,17 @@ namespace OpenSim.Region.CoreModules
364 // Speed of rotation needed to complete a cycle in the 387 // Speed of rotation needed to complete a cycle in the
365 // designated period (day and season) 388 // designated period (day and season)
366 389
367 SunSpeed = m_SunCycle/SecondsPerSunCycle; 390 SunSpeed = m_SunCycle / SecondsPerSunCycle;
368 SeasonSpeed = m_SeasonalCycle/SecondsPerYear; 391 SeasonSpeed = m_SeasonalCycle / SecondsPerYear;
369 392
370 // Horizon translation 393 // Horizon translation
371 394
372 HorizonShift = m_HorizonShift; // Z axis translation 395 HorizonShift = m_HorizonShift; // Z axis translation
373 // HoursToRadians = (SunCycle/24)*VWTimeRatio; 396 // HoursToRadians = (SunCycle/24)*VWTimeRatio;
374 397
375 // Insert our event handling hooks 398 // Insert our event handling hooks
376 399
377 scene.EventManager.OnFrame += SunUpdate; 400 scene.EventManager.OnFrame += SunUpdate;
378 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 401 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
379 scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; 402 scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate;
380 scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; 403 scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour;
@@ -391,34 +414,21 @@ namespace OpenSim.Region.CoreModules
391 } 414 }
392 415
393 scene.RegisterModuleInterface<ISunModule>(this); 416 scene.RegisterModuleInterface<ISunModule>(this);
394
395 } 417 }
396 418
397 419 public void RegionLoaded(Scene scene)
398 public void PostInitialise()
399 { 420 {
400 } 421 }
401 422
402 public void Close() 423 public void RemoveRegion(Scene scene)
403 {
404 ready = false;
405
406 // Remove our hooks
407 m_scene.EventManager.OnFrame -= SunUpdate;
408 m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
409 m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate;
410 m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
411 }
412
413 public string Name
414 { 424 {
415 get { return "SunModule"; } 425 scene.RegisterModuleInterface<ISunModule>(this);
426 scene.EventManager.OnFrame -= SunUpdate;
427 scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
428 scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate;
429 scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
416 } 430 }
417 431
418 public bool IsSharedModule
419 {
420 get { return false; }
421 }
422 #endregion 432 #endregion
423 433
424 #region EventManager Events 434 #region EventManager Events
diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
index c2ad7b8..0b487ed 100644
--- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
+++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.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;
@@ -36,7 +37,8 @@ using OpenSim.Region.Framework.Scenes;
36 37
37namespace OpenSim.Region.CoreModules.Avatar.Vegetation 38namespace OpenSim.Region.CoreModules.Avatar.Vegetation
38{ 39{
39 public class VegetationModule : IRegionModule, IVegetationModule 40 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
41 public class VegetationModule : INonSharedRegionModule, IVegetationModule
40 { 42 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 44
@@ -45,17 +47,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
45 protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree }; 47 protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree };
46 public PCode[] CreationCapabilities { get { return creationCapabilities; } } 48 public PCode[] CreationCapabilities { get { return creationCapabilities; } }
47 49
48 public void Initialise(Scene scene, IConfigSource source) 50 public void Initialise(IConfigSource source)
51 {
52 }
53
54 public void AddRegion(Scene scene)
49 { 55 {
50 m_scene = scene; 56 m_scene = scene;
51 m_scene.RegisterModuleInterface<IVegetationModule>(this); 57 m_scene.RegisterModuleInterface<IVegetationModule>(this);
52 } 58 }
59
60 public Type ReplaceableInterface
61 {
62 get { return null; }
63 }
64
65 public void RegionLoaded(Scene scene)
66 {
67 }
68
69 public void RemoveRegion(Scene scene)
70 {
71 scene.UnregisterModuleInterface<IVegetationModule>(this);
72 }
53 73
54 public void PostInitialise() {} 74 public void PostInitialise() {}
55 public void Close() {} 75 public void Close() {}
56 public string Name { get { return "Vegetation Module"; } } 76 public string Name { get { return "Vegetation Module"; } }
57 public bool IsSharedModule { get { return false; } } 77
58
59 public SceneObjectGroup AddTree( 78 public SceneObjectGroup AddTree(
60 UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree) 79 UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree)
61 { 80 {
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index 3283c1f..cd3706d 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -55,17 +55,19 @@ namespace OpenSim.Region.CoreModules
55 55
56 private IWindModelPlugin m_activeWindPlugin = null; 56 private IWindModelPlugin m_activeWindPlugin = null;
57 private const string m_dWindPluginName = "SimpleRandomWind"; 57 private const string m_dWindPluginName = "SimpleRandomWind";
58 private string m_desiredWindPlugin = "SimpleRandomWind";
58 private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>(); 59 private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>();
59 60
60 // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m 61 // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m
61 private Vector2[] windSpeeds = new Vector2[16 * 16]; 62 private Vector2[] windSpeeds = new Vector2[16 * 16];
63 private IConfig windConfig;
62 64
63 #region IRegion Methods 65 #region IRegion Methods
64 66
65 public void Initialise(Scene scene, IConfigSource config) 67 public void Initialise(IConfigSource config)
66 { 68 {
67 IConfig windConfig = config.Configs["Wind"]; 69 windConfig = config.Configs["Wind"];
68 string desiredWindPlugin = m_dWindPluginName; 70 m_desiredWindPlugin = m_dWindPluginName;
69 71
70 if (windConfig != null) 72 if (windConfig != null)
71 { 73 {
@@ -76,10 +78,18 @@ namespace OpenSim.Region.CoreModules
76 // Determine which wind model plugin is desired 78 // Determine which wind model plugin is desired
77 if (windConfig.Contains("wind_plugin")) 79 if (windConfig.Contains("wind_plugin"))
78 { 80 {
79 desiredWindPlugin = windConfig.GetString("wind_plugin"); 81 m_desiredWindPlugin = windConfig.GetString("wind_plugin");
80 } 82 }
81 } 83 }
84 }
85
86 public Type ReplaceableInterface
87 {
88 get { return null; }
89 }
82 90
91 public void AddRegion(Scene scene)
92 {
83 if (m_enabled) 93 if (m_enabled)
84 { 94 {
85 m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); 95 m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate);
@@ -95,30 +105,30 @@ namespace OpenSim.Region.CoreModules
95 } 105 }
96 106
97 // Check for desired plugin 107 // Check for desired plugin
98 if (m_availableWindPlugins.ContainsKey(desiredWindPlugin)) 108 if (m_availableWindPlugins.ContainsKey(m_desiredWindPlugin))
99 { 109 {
100 m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin]; 110 m_activeWindPlugin = m_availableWindPlugins[m_desiredWindPlugin];
101 111
102 m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); 112 m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_desiredWindPlugin);
103 113
104 if (windConfig != null) 114 if (windConfig != null)
105 { 115 {
106 m_activeWindPlugin.Initialise(); 116 m_activeWindPlugin.Initialise();
107 m_activeWindPlugin.WindConfig(m_scene, windConfig); 117 m_activeWindPlugin.WindConfig(m_scene, windConfig);
108 } 118 }
109 } 119 }
110 120
111 121
112 // if the plug-in wasn't found, default to no wind. 122 // if the plug-in wasn't found, default to no wind.
113 if (m_activeWindPlugin == null) 123 if (m_activeWindPlugin == null)
114 { 124 {
115 m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); 125 m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_desiredWindPlugin);
116 m_log.ErrorFormat("[WIND] Defaulting to no wind."); 126 m_log.ErrorFormat("[WIND] Defaulting to no wind.");
117 } 127 }
118 128
119 // This one puts an entry in the main help screen 129 // This one puts an entry in the main help screen
120 m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); 130 m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
121 131
122 // This one enables the ability to type just the base command without any parameters 132 // This one enables the ability to type just the base command without any parameters
123 m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand); 133 m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand);
124 134
@@ -127,7 +137,7 @@ namespace OpenSim.Region.CoreModules
127 { 137 {
128 m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); 138 m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand);
129 m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand); 139 m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand);
130 140
131 foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) 141 foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams())
132 { 142 {
133 m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand); 143 m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand);
@@ -149,11 +159,17 @@ namespace OpenSim.Region.CoreModules
149 m_ready = true; 159 m_ready = true;
150 160
151 } 161 }
162 }
152 163
164 public void RegionLoaded(Scene scene)
165 {
153 } 166 }
154 167
155 public void PostInitialise() 168 public void RemoveRegion(Scene scene)
156 { 169 {
170 scene.EventManager.OnFrame -= WindUpdate;
171 scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion;
172 scene.UnregisterModuleInterface<IWindModule>(this);
157 } 173 }
158 174
159 public void Close() 175 public void Close()
@@ -182,11 +198,6 @@ namespace OpenSim.Region.CoreModules
182 get { return "WindModule"; } 198 get { return "WindModule"; }
183 } 199 }
184 200
185 public bool IsSharedModule
186 {
187 get { return false; }
188 }
189
190 201
191 #endregion 202 #endregion
192 203
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index 285d36a..6bda1e9 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Drawing; 30using System.Drawing;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenMetaverse.Imaging; 36using OpenMetaverse.Imaging;
@@ -59,7 +60,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
59 public face[] trns; 60 public face[] trns;
60 } 61 }
61 62
62 public class MapImageModule : IMapImageGenerator, IRegionModule 63 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
64 public class MapImageModule : IMapImageGenerator, INonSharedRegionModule
63 { 65 {
64 private static readonly ILog m_log = 66 private static readonly ILog m_log =
65 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 67 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -128,37 +130,45 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
128 130
129 #endregion 131 #endregion
130 132
131 #region IRegionModule Members 133 #region INonSharedRegionModule Members
132 134
133 public void Initialise(Scene scene, IConfigSource source) 135 public void Initialise(IConfigSource source)
134 { 136 {
135 m_scene = scene;
136 m_config = source; 137 m_config = source;
137 138
138 IConfig startupConfig = m_config.Configs["Startup"]; 139 IConfig startupConfig = m_config.Configs["Startup"];
139 if (startupConfig.GetString("MapImageModule", "MapImageModule") != 140 if (startupConfig.GetString("MapImageModule", "MapImageModule") !=
140 "MapImageModule") 141 "MapImageModule")
141 return; 142 return;
143 }
142 144
145 public void AddRegion(Scene scene)
146 {
147 m_scene = scene;
143 m_scene.RegisterModuleInterface<IMapImageGenerator>(this); 148 m_scene.RegisterModuleInterface<IMapImageGenerator>(this);
144 } 149 }
145 150
146 public void PostInitialise() 151 public Type ReplaceableInterface
147 { 152 {
153 get { return null; }
148 } 154 }
149 155
150 public void Close() 156 public void RegionLoaded(Scene scene)
151 { 157 {
152 } 158 }
153 159
154 public string Name 160 public void RemoveRegion(Scene scene)
155 { 161 {
156 get { return "MapImageModule"; } 162 scene.UnregisterModuleInterface<IMapImageGenerator>(this);
157 } 163 }
158 164
159 public bool IsSharedModule 165 public void Close()
166 {
167 }
168
169 public string Name
160 { 170 {
161 get { return false; } 171 get { return "MapImageModule"; }
162 } 172 }
163 173
164 #endregion 174 #endregion
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index be46fa5..dd33673 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.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;
@@ -38,7 +41,8 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
38 41
39namespace OpenSim.Region.CoreModules.World.WorldMap 42namespace OpenSim.Region.CoreModules.World.WorldMap
40{ 43{
41 public class MapSearchModule : IRegionModule 44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
45 public class MapSearchModule : ISharedRegionModule
42 { 46 {
43 private static readonly ILog m_log = 47 private static readonly ILog m_log =
44 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -46,8 +50,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
46 Scene m_scene = null; // only need one for communication with GridService 50 Scene m_scene = null; // only need one for communication with GridService
47 List<Scene> m_scenes = new List<Scene>(); 51 List<Scene> m_scenes = new List<Scene>();
48 52
49 #region IRegionModule Members 53 #region ISharedRegionModule Members
50 public void Initialise(Scene scene, IConfigSource source) 54 public void Initialise(IConfigSource source)
55 {
56 }
57
58 public void AddRegion(Scene scene)
51 { 59 {
52 if (m_scene == null) 60 if (m_scene == null)
53 { 61 {
@@ -58,6 +66,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
58 scene.EventManager.OnNewClient += OnNewClient; 66 scene.EventManager.OnNewClient += OnNewClient;
59 } 67 }
60 68
69 public Type ReplaceableInterface
70 {
71 get { return null; }
72 }
73
74 public void RegionLoaded(Scene scene)
75 {
76 }
77
78 public void RemoveRegion(Scene scene)
79 {
80 if(m_scenes.Contains(scene))
81 m_scenes.Remove(scene);
82 scene.EventManager.OnNewClient -= OnNewClient;
83 }
84
61 public void PostInitialise() 85 public void PostInitialise()
62 { 86 {
63 } 87 }
@@ -73,11 +97,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
73 get { return "MapSearchModule"; } 97 get { return "MapSearchModule"; }
74 } 98 }
75 99
76 public bool IsSharedModule
77 {
78 get { return true; }
79 }
80
81 #endregion 100 #endregion
82 101
83 private void OnNewClient(IClientAPI client) 102 private void OnNewClient(IClientAPI client)
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
index 4df9094..b0cefc3 100644
--- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
+++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
@@ -33,6 +33,7 @@ using System.Net;
33using System.Reflection; 33using System.Reflection;
34using System.Xml; 34using System.Xml;
35using log4net; 35using log4net;
36using Mono.Addins;
36using Nini.Config; 37using Nini.Config;
37using OpenMetaverse; 38using OpenMetaverse;
38using OpenSim.Framework; 39using OpenSim.Framework;
@@ -43,7 +44,8 @@ using OpenSim.Region.Framework.Scenes;
43 44
44namespace OpenSim.Region.DataSnapshot 45namespace OpenSim.Region.DataSnapshot
45{ 46{
46 public class DataSnapshotManager : IRegionModule, IDataSnapshot 47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
48 public class DataSnapshotManager : ISharedRegionModule, IDataSnapshot
47 { 49 {
48 #region Class members 50 #region Class members
49 //Information from config 51 //Information from config
@@ -89,7 +91,7 @@ namespace OpenSim.Region.DataSnapshot
89 91
90 #region IRegionModule 92 #region IRegionModule
91 93
92 public void Initialise(Scene scene, IConfigSource config) 94 public void Initialise(IConfigSource config)
93 { 95 {
94 if (!m_configLoaded) 96 if (!m_configLoaded)
95 { 97 {
@@ -140,24 +142,29 @@ namespace OpenSim.Region.DataSnapshot
140 return; 142 return;
141 } 143 }
142 } 144 }
145 }
146 }
143 147
144 if (m_enabled) 148 public Type ReplaceableInterface
145 { 149 {
146 //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer 150 get { return null; }
147 new DataRequestHandler(scene, this); 151 }
148 152
149 m_hostname = scene.RegionInfo.ExternalHostName; 153 public void AddRegion(Scene scene)
150 m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname); 154 {
155 if (m_enabled)
156 {
157 //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer
158 new DataRequestHandler(scene, this);
151 159
152 MakeEverythingStale(); 160 m_hostname = scene.RegionInfo.ExternalHostName;
161 m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname);
153 162
154 if (m_dataServices != "" && m_dataServices != "noservices") 163 MakeEverythingStale();
155 NotifyDataServices(m_dataServices, "online"); 164
156 } 165 if (m_dataServices != "" && m_dataServices != "noservices")
157 } 166 NotifyDataServices(m_dataServices, "online");
158 167
159 if (m_enabled)
160 {
161 m_log.Info("[DATASNAPSHOT]: Scene added to module."); 168 m_log.Info("[DATASNAPSHOT]: Scene added to module.");
162 169
163 m_snapStore.AddScene(scene); 170 m_snapStore.AddScene(scene);
@@ -191,20 +198,25 @@ namespace OpenSim.Region.DataSnapshot
191 } 198 }
192 else 199 else
193 { 200 {
194 m_log.Warn("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else)."); 201 m_log.Info("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else).");
195 } 202 }
196 } 203 }
197 204
198 public void Close() 205 public void RegionLoaded(Scene scene)
199 { 206 {
200 if (m_enabled && m_dataServices != "" && m_dataServices != "noservices")
201 NotifyDataServices(m_dataServices, "offline");
202 } 207 }
203 208
209 public void RemoveRegion(Scene scene)
210 {
211 if (m_scenes.Contains(scene))
212 m_scenes.Remove(scene);
213 m_snapStore.RemoveScene(scene);
214 }
204 215
205 public bool IsSharedModule 216 public void Close()
206 { 217 {
207 get { return true; } 218 if (m_enabled && m_dataServices != "" && m_dataServices != "noservices")
219 NotifyDataServices(m_dataServices, "offline");
208 } 220 }
209 221
210 public string Name 222 public string Name
@@ -214,7 +226,6 @@ namespace OpenSim.Region.DataSnapshot
214 226
215 public void PostInitialise() 227 public void PostInitialise()
216 { 228 {
217
218 } 229 }
219 230
220 #endregion 231 #endregion
diff --git a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs
index f8a5bad..879114b 100644
--- a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs
@@ -28,7 +28,7 @@
28 28
29namespace OpenSim.Region.Framework.Interfaces 29namespace OpenSim.Region.Framework.Interfaces
30{ 30{
31 public interface ICloudModule : IRegionModule 31 public interface ICloudModule : INonSharedRegionModule
32 { 32 {
33 /// <summary> 33 /// <summary>
34 /// Retrieves the cloud density at the given region coordinates 34 /// Retrieves the cloud density at the given region coordinates
diff --git a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs
index 3a2c423..bdad0b4 100644
--- a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces
38 public int numLeft; 38 public int numLeft;
39 } 39 }
40 40
41 public interface IEmailModule : IRegionModule 41 public interface IEmailModule : ISharedRegionModule
42 { 42 {
43 void SendEmail(UUID objectID, string address, string subject, string body); 43 void SendEmail(UUID objectID, string address, string subject, string body);
44 Email GetNextEmail(UUID objectID, string sender, string subject); 44 Email GetNextEmail(UUID objectID, string sender, string subject);
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
index 890fa31..347818c 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
@@ -29,7 +29,7 @@ using OpenMetaverse;
29 29
30namespace OpenSim.Region.Framework.Interfaces 30namespace OpenSim.Region.Framework.Interfaces
31{ 31{
32 public interface IEstateModule : IRegionModule 32 public interface IEstateModule : INonSharedRegionModule
33 { 33 {
34 uint GetRegionFlags(); 34 uint GetRegionFlags();
35 bool IsManager(UUID avatarID); 35 bool IsManager(UUID avatarID);
diff --git a/OpenSim/Region/Framework/Interfaces/ISunModule.cs b/OpenSim/Region/Framework/Interfaces/ISunModule.cs
index 819ae11..8231716 100644
--- a/OpenSim/Region/Framework/Interfaces/ISunModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISunModule.cs
@@ -29,7 +29,7 @@ using OpenMetaverse;
29 29
30namespace OpenSim.Region.Framework.Interfaces 30namespace OpenSim.Region.Framework.Interfaces
31{ 31{
32 public interface ISunModule : IRegionModule 32 public interface ISunModule : INonSharedRegionModule
33 { 33 {
34 double GetSunParameter(string param); 34 double GetSunParameter(string param);
35 35
diff --git a/OpenSim/Region/Framework/Interfaces/IWindModule.cs b/OpenSim/Region/Framework/Interfaces/IWindModule.cs
index 10ecc32..4a26a71 100644
--- a/OpenSim/Region/Framework/Interfaces/IWindModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWindModule.cs
@@ -29,7 +29,7 @@ using OpenMetaverse;
29 29
30namespace OpenSim.Region.Framework.Interfaces 30namespace OpenSim.Region.Framework.Interfaces
31{ 31{
32 public interface IWindModule : IRegionModule 32 public interface IWindModule : INonSharedRegionModule
33 { 33 {
34 34
35 /// <summary> 35 /// <summary>
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs
index cfe1278..ec040db 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.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.Net; 29using System.Net;
29using System.Reflection; 30using System.Reflection;
30using log4net; 31using log4net;
32using Mono.Addins;
31using Nini.Config; 33using Nini.Config;
32using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
@@ -35,24 +37,23 @@ using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server;
35 37
36namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView 38namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
37{ 39{
38 public class IRCStackModule : IRegionModule 40 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
41 public class IRCStackModule : INonSharedRegionModule
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
42 private IRCServer m_server; 45 private IRCServer m_server;
43// private Scene m_scene; 46// private Scene m_scene;
47 private int portNo;
44 48
45 #region Implementation of IRegionModule 49 #region Implementation of ISharedRegionModule
46 50
47 public void Initialise(Scene scene, IConfigSource source) 51 public void Initialise(IConfigSource source)
48 { 52 {
49 if (null != source.Configs["IRCd"] && 53 if (null != source.Configs["IRCd"] &&
50 source.Configs["IRCd"].GetBoolean("Enabled",false)) 54 source.Configs["IRCd"].GetBoolean("Enabled",false))
51 { 55 {
52 int portNo = source.Configs["IRCd"].GetInt("Port",6666); 56 portNo = source.Configs["IRCd"].GetInt("Port",6666);
53// m_scene = scene;
54 m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene);
55 m_server.OnNewIRCClient += m_server_OnNewIRCClient;
56 } 57 }
57 } 58 }
58 59
@@ -68,9 +69,20 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
68 m_log.Info("[IRCd] Added user to Scene"); 69 m_log.Info("[IRCd] Added user to Scene");
69 } 70 }
70 71
71 public void PostInitialise() 72 public void AddRegion(Scene scene)
73 {
74 if (portNo != null)
75 {
76 m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene);
77 m_server.OnNewIRCClient += m_server_OnNewIRCClient;
78 }
79 }
80 public void RegionLoaded(Scene scene)
72 { 81 {
82 }
73 83
84 public void RemoveRegion(Scene scene)
85 {
74 } 86 }
75 87
76 public void Close() 88 public void Close()
@@ -83,9 +95,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
83 get { return "IRCClientStackModule"; } 95 get { return "IRCClientStackModule"; }
84 } 96 }
85 97
86 public bool IsSharedModule 98 public Type ReplaceableInterface
87 { 99 {
88 get { return false; } 100 get { return null; }
89 } 101 }
90 102
91 #endregion 103 #endregion
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index b04b076..23ae307 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -38,6 +38,7 @@ using System.Collections.Generic;
38using System.Reflection; 38using System.Reflection;
39using OpenMetaverse; 39using OpenMetaverse;
40using log4net; 40using log4net;
41using Mono.Addins;
41using Nini.Config; 42using Nini.Config;
42using Nwc.XmlRpc; 43using Nwc.XmlRpc;
43using OpenSim.Framework; 44using OpenSim.Framework;
@@ -53,7 +54,8 @@ using System.Text.RegularExpressions;
53 54
54namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice 55namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
55{ 56{
56 public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule 57 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
58 public class FreeSwitchVoiceModule : ISharedRegionModule, IVoiceModule
57 { 59 {
58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 60 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59 61
@@ -108,9 +110,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
108 110
109 private IConfig m_config; 111 private IConfig m_config;
110 112
111 public void Initialise(Scene scene, IConfigSource config) 113 public void Initialise(IConfigSource config)
112 { 114 {
113 m_scene = scene;
114 m_config = config.Configs["FreeSwitchVoice"]; 115 m_config = config.Configs["FreeSwitchVoice"];
115 116
116 if (null == m_config) 117 if (null == m_config)
@@ -224,17 +225,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
224 return; 225 return;
225 } 226 }
226 } 227 }
228 }
227 229
228 if (m_pluginEnabled) 230 public void AddRegion(Scene scene)
231 {
232 m_scene = scene;
233 if (m_pluginEnabled)
229 { 234 {
230 // we need to capture scene in an anonymous method 235 // we need to capture scene in an anonymous method
231 // here as we need it later in the callbacks 236 // here as we need it later in the callbacks
232 scene.EventManager.OnRegisterCaps += delegate(UUID agentID, Caps caps) 237 scene.EventManager.OnRegisterCaps += delegate(UUID agentID, Caps caps)
233 { 238 {
234 OnRegisterCaps(scene, agentID, caps); 239 OnRegisterCaps(scene, agentID, caps);
235 }; 240 };
236 241
237 242
238 243
239 try 244 try
240 { 245 {
@@ -254,33 +259,60 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
254 m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions."); 259 m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions.");
255 } 260 }
256 } 261 }
257 262
258 } 263 }
259 }
260
261 public void PostInitialise()
262 {
263 if (m_pluginEnabled) 264 if (m_pluginEnabled)
264 { 265 {
265 m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); 266 m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
266 267
267 // register the voice interface for this module, so the script engine can call us 268 // register the voice interface for this module, so the script engine can call us
268 m_scene.RegisterModuleInterface<IVoiceModule>(this); 269 m_scene.RegisterModuleInterface<IVoiceModule>(this);
269 } 270 }
270 } 271 }
271 272
272 public void Close() 273 public void RegionLoaded(Scene scene)
273 { 274 {
274 } 275 }
275 276
276 public string Name 277 public void RemoveRegion(Scene scene)
278 {
279 if (UseProxy)
280 {
281 MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/", m_freeSwitchAPIPrefix));
282 }
283 else
284 {
285 MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix));
286
287 MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix));
288
289 MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix));
290
291 MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix));
292 }
293 scene.EventManager.OnRegisterCaps -= delegate(UUID agentID, Caps caps)
294 {
295 OnRegisterCaps(scene, agentID, caps);
296 };
297 scene.UnregisterModuleInterface<IVoiceModule>(this);
298 }
299
300 public Type ReplaceableInterface
301 {
302 get { return null; }
303 }
304
305 public void PostInitialise()
277 { 306 {
278 get { return "FreeSwitchVoiceModule"; }
279 } 307 }
280 308
281 public bool IsSharedModule 309 public void Close()
282 { 310 {
283 get { return true; } 311 }
312
313 public string Name
314 {
315 get { return "FreeSwitchVoiceModule"; }
284 } 316 }
285 317
286 // <summary> 318 // <summary>
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs
index 3d1c346..6769d59 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -38,6 +38,7 @@ using System.Threading;
38 38
39using OpenMetaverse; 39using OpenMetaverse;
40 40
41using Mono.Addins;
41using Nini.Config; 42using Nini.Config;
42 43
43using OpenSim; 44using OpenSim;
@@ -50,7 +51,8 @@ using log4net;
50 51
51namespace OpenSim.Region.OptionalModules.ContentManagement 52namespace OpenSim.Region.OptionalModules.ContentManagement
52{ 53{
53 public class ContentManagementModule : IRegionModule 54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
55 public class ContentManagementModule : ISharedRegionModule
54 { 56 {
55 #region Static Fields 57 #region Static Fields
56 58
@@ -60,22 +62,20 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
60 62
61 #region Fields 63 #region Fields
62 64
63 bool initialised = false; 65 private bool initialised = false;
64 CMController m_control = null; 66 private CMController m_control = null;
65 bool m_enabled = false; 67 private bool m_enabled = false;
66 CMModel m_model = null; 68 private CMModel m_model = null;
67 bool m_posted = false; 69 private bool m_posted = false;
68 CMView m_view = null; 70 private CMView m_view = null;
71 private string databaseDir = "./";
72 private string database = "FileSystemDatabase";
73 private int channel = 345;
69 74
70 #endregion Fields 75 #endregion Fields
71 76
72 #region Public Properties 77 #region Public Properties
73 78
74 public bool IsSharedModule
75 {
76 get { return true; }
77 }
78
79 public string Name 79 public string Name
80 { 80 {
81 get { return "ContentManagementModule"; } 81 get { return "ContentManagementModule"; }
@@ -89,11 +89,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
89 { 89 {
90 } 90 }
91 91
92 public void Initialise(Scene scene, IConfigSource source) 92 public void Initialise(IConfigSource source)
93 { 93 {
94 string databaseDir = "./";
95 string database = "FileSystemDatabase";
96 int channel = 345;
97 try 94 try
98 { 95 {
99 if (source.Configs["CMS"] == null) 96 if (source.Configs["CMS"] == null)
@@ -115,13 +112,15 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
115 m_log.ErrorFormat("[Content Management]: Exception thrown while reading parameters from configuration file. Message: " + e); 112 m_log.ErrorFormat("[Content Management]: Exception thrown while reading parameters from configuration file. Message: " + e);
116 m_enabled = false; 113 m_enabled = false;
117 } 114 }
115 }
118 116
117 public void AddRegion(Scene scene)
118 {
119 if (!m_enabled) 119 if (!m_enabled)
120 { 120 {
121 m_log.Info("[Content Management]: Content Management System is not Enabled."); 121 m_log.Info("[Content Management]: Content Management System is not Enabled.");
122 return; 122 return;
123 } 123 }
124
125 lock (this) 124 lock (this)
126 { 125 {
127 if (!initialised) //only init once 126 if (!initialised) //only init once
@@ -142,6 +141,18 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
142 } 141 }
143 } 142 }
144 } 143 }
144 public void RegionLoaded(Scene scene)
145 {
146 }
147
148 public void RemoveRegion(Scene scene)
149 {
150 }
151
152 public Type ReplaceableInterface
153 {
154 get { return null; }
155 }
145 156
146 public void PostInitialise() 157 public void PostInitialise()
147 { 158 {
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index 4521f8e..f24bcdc 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -38,6 +38,7 @@ using System.Security.Policy;
38using System.Text; 38using System.Text;
39using log4net; 39using log4net;
40using Microsoft.CSharp; 40using Microsoft.CSharp;
41using Mono.Addins;
41using Nini.Config; 42using Nini.Config;
42using OpenMetaverse; 43using OpenMetaverse;
43using OpenSim.Framework; 44using OpenSim.Framework;
@@ -46,7 +47,8 @@ using OpenSim.Region.Framework.Scenes;
46 47
47namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 48namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
48{ 49{
49 public class MRMModule : IRegionModule, IMRMModule 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
51 public class MRMModule : INonSharedRegionModule, IMRMModule
50 { 52 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 private Scene m_scene; 54 private Scene m_scene;
@@ -62,12 +64,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
62 64
63 private IConfig m_config; 65 private IConfig m_config;
64 66
67 private bool m_hidden = true;
68
65 public void RegisterExtension<T>(T instance) 69 public void RegisterExtension<T>(T instance)
66 { 70 {
67 m_extensions[typeof (T)] = instance; 71 m_extensions[typeof (T)] = instance;
68 } 72 }
69 73
70 public void Initialise(Scene scene, IConfigSource source) 74 public void Initialise(IConfigSource source)
71 { 75 {
72 if (source.Configs["MRM"] != null) 76 if (source.Configs["MRM"] != null)
73 { 77 {
@@ -76,19 +80,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
76 if (source.Configs["MRM"].GetBoolean("Enabled", false)) 80 if (source.Configs["MRM"].GetBoolean("Enabled", false))
77 { 81 {
78 m_log.Info("[MRM] Enabling MRM Module"); 82 m_log.Info("[MRM] Enabling MRM Module");
79 m_scene = scene; 83
80
81 // when hidden, we don't listen for client initiated script events 84 // when hidden, we don't listen for client initiated script events
82 // only making the MRM engine available for region modules 85 // only making the MRM engine available for region modules
83 if (!source.Configs["MRM"].GetBoolean("Hidden", false)) 86 m_hidden = source.Configs["MRM"].GetBoolean("Hidden", false);
84 {
85 scene.EventManager.OnRezScript += EventManager_OnRezScript;
86 scene.EventManager.OnStopScript += EventManager_OnStopScript;
87 }
88
89 scene.EventManager.OnFrame += EventManager_OnFrame;
90
91 scene.RegisterModuleInterface<IMRMModule>(this);
92 } 87 }
93 else 88 else
94 { 89 {
@@ -101,6 +96,39 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
101 } 96 }
102 } 97 }
103 98
99 public Type ReplaceableInterface
100 {
101 get { return null; }
102 }
103
104 public void AddRegion(Scene scene)
105 {
106 m_scene = scene;
107 if (!m_hidden)
108 {
109 scene.EventManager.OnRezScript += EventManager_OnRezScript;
110 scene.EventManager.OnStopScript += EventManager_OnStopScript;
111 }
112 scene.EventManager.OnFrame += EventManager_OnFrame;
113
114 scene.RegisterModuleInterface<IMRMModule>(this);
115 }
116 public void RegionLoaded(Scene scene)
117 {
118 }
119
120 public void RemoveRegion(Scene scene)
121 {
122 if (!m_hidden)
123 {
124 scene.EventManager.OnRezScript -= EventManager_OnRezScript;
125 scene.EventManager.OnStopScript -= EventManager_OnStopScript;
126 }
127 scene.EventManager.OnFrame -= EventManager_OnFrame;
128
129 scene.UnregisterModuleInterface<IMRMModule>(this);
130 }
131
104 void EventManager_OnStopScript(uint localID, UUID itemID) 132 void EventManager_OnStopScript(uint localID, UUID itemID)
105 { 133 {
106 if (m_scripts.ContainsKey(itemID)) 134 if (m_scripts.ContainsKey(itemID))
@@ -302,11 +330,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
302 mmb.InitMiniModule(world, host, itemID); 330 mmb.InitMiniModule(world, host, itemID);
303 } 331 }
304 332
305 public void PostInitialise()
306 {
307
308 }
309
310 public void Close() 333 public void Close()
311 { 334 {
312 foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts) 335 foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts)
@@ -320,11 +343,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
320 get { return "MiniRegionModule"; } 343 get { return "MiniRegionModule"; }
321 } 344 }
322 345
323 public bool IsSharedModule
324 {
325 get { return false; }
326 }
327
328 /// <summary> 346 /// <summary>
329 /// Stolen from ScriptEngine Common 347 /// Stolen from ScriptEngine Common
330 /// </summary> 348 /// </summary>
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index c653e98..999756a 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -100,10 +100,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
100 if (!m_enabled) 100 if (!m_enabled)
101 return; 101 return;
102 102
103 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; 103 scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
104 m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; 104 scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded;
105 105
106 m_scene = null; 106 scene = null;
107 } 107 }
108 108
109 public void Close() 109 public void Close()
diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
index 44c9ada..df01938 100644
--- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
@@ -58,6 +58,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
58 58
59 public void RemoveRegion(Scene scene) 59 public void RemoveRegion(Scene scene)
60 { 60 {
61 scene.UnregisterModuleInterface<IScriptModuleComms>(this);
61 } 62 }
62 63
63 public void RegionLoaded(Scene scene) 64 public void RegionLoaded(Scene scene)
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
index d18ac0a..f2a0e53 100644
--- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31 31
32using log4net; 32using log4net;
33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
34using OpenMetaverse; 35using OpenMetaverse;
35 36
@@ -49,7 +50,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
49 public string uri; 50 public string uri;
50 } 51 }
51 52
52 public class XmlRpcGridRouter : IRegionModule, IXmlRpcRouter 53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
54 public class XmlRpcGridRouter : INonSharedRegionModule, IXmlRpcRouter
53 { 55 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 57
@@ -59,7 +61,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
59 private bool m_Enabled = false; 61 private bool m_Enabled = false;
60 private string m_ServerURI = String.Empty; 62 private string m_ServerURI = String.Empty;
61 63
62 public void Initialise(Scene scene, IConfigSource config) 64 public void Initialise(IConfigSource config)
63 { 65 {
64 IConfig startupConfig = config.Configs["Startup"]; 66 IConfig startupConfig = config.Configs["Startup"];
65 if (startupConfig == null) 67 if (startupConfig == null)
@@ -75,27 +77,35 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
75 return; 77 return;
76 } 78 }
77 79
78 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
79 m_Enabled = true; 80 m_Enabled = true;
80 } 81 }
81 } 82 }
82 83
83 public void PostInitialise() 84 public void AddRegion(Scene scene)
85 {
86 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
87 }
88 public void RegionLoaded(Scene scene)
84 { 89 {
85 } 90 }
86 91
87 public void Close() 92 public void RemoveRegion(Scene scene)
88 { 93 {
94 scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
89 } 95 }
90 96
91 public string Name 97 public Type ReplaceableInterface
92 { 98 {
93 get { return "XmlRpcGridRouterModule"; } 99 get { return null; }
94 } 100 }
95 101
96 public bool IsSharedModule 102 public void Close()
97 { 103 {
98 get { return false; } 104 }
105
106 public string Name
107 {
108 get { return "XmlRpcGridRouterModule"; }
99 } 109 }
100 110
101 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) 111 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
index 32659c8..4d39345 100644
--- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
@@ -29,6 +29,7 @@ using System;
29using System.Reflection; 29using System.Reflection;
30 30
31using log4net; 31using log4net;
32using Mono.Addins;
32using Nini.Config; 33using Nini.Config;
33using OpenMetaverse; 34using OpenMetaverse;
34 35
@@ -39,11 +40,12 @@ using OpenSim.Region.Framework.Scenes;
39 40
40namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule 41namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
41{ 42{
42 public class XmlRpcRouter : IRegionModule, IXmlRpcRouter 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
44 public class XmlRpcRouter : INonSharedRegionModule, IXmlRpcRouter
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 private bool m_enabled = false;
46 public void Initialise(Scene scene, IConfigSource config) 48 public void Initialise(IConfigSource config)
47 { 49 {
48 IConfig startupConfig = config.Configs["Startup"]; 50 IConfig startupConfig = config.Configs["Startup"];
49 if (startupConfig == null) 51 if (startupConfig == null)
@@ -52,26 +54,34 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
52 if (startupConfig.GetString("XmlRpcRouterModule", 54 if (startupConfig.GetString("XmlRpcRouterModule",
53 "XmlRpcRouterModule") == "XmlRpcRouterModule") 55 "XmlRpcRouterModule") == "XmlRpcRouterModule")
54 { 56 {
55 scene.RegisterModuleInterface<IXmlRpcRouter>(this); 57 m_enabled = true;
56 } 58 }
57 } 59 }
60 public void AddRegion(Scene scene)
61 {
62 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
63 }
64 public void RegionLoaded(Scene scene)
65 {
66 }
58 67
59 public void PostInitialise() 68 public void RemoveRegion(Scene scene)
60 { 69 {
70 scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
61 } 71 }
62 72
63 public void Close() 73 public Type ReplaceableInterface
64 { 74 {
75 get { return null; }
65 } 76 }
66 77
67 public string Name 78 public void Close()
68 { 79 {
69 get { return "XmlRpcRouterModule"; }
70 } 80 }
71 81
72 public bool IsSharedModule 82 public string Name
73 { 83 {
74 get { return false; } 84 get { return "XmlRpcRouterModule"; }
75 } 85 }
76 86
77 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) 87 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
diff --git a/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs
index 97fa63c..801f1f8 100644
--- a/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Freeswitch
47 private IConfigSource m_Config; 47 private IConfigSource m_Config;
48 bool m_Registered = false; 48 bool m_Registered = false;
49 49
50 #region IRegionModule interface 50 #region ISharedRegionModule interface
51 51
52 public void Initialise(IConfigSource config) 52 public void Initialise(IConfigSource config)
53 { 53 {
diff --git a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs
index 3490a8b..fa5878d 100644
--- a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs
+++ b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs
@@ -31,6 +31,7 @@ using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Timers; 32using System.Timers;
33using log4net; 33using log4net;
34using Mono.Addins;
34using Nini.Config; 35using Nini.Config;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.CoreModules.World.Serialiser; 37using OpenSim.Region.CoreModules.World.Serialiser;
@@ -42,7 +43,8 @@ using Slash = System.IO.Path;
42 43
43namespace OpenSim.Region.Modules.SvnSerialiser 44namespace OpenSim.Region.Modules.SvnSerialiser
44{ 45{
45 public class SvnBackupModule : IRegionModule 46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
47 public class SvnBackupModule : ISharedRegionModule
46 { 48 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 50
@@ -200,9 +202,9 @@ namespace OpenSim.Region.Modules.SvnSerialiser
200 202
201 #endregion 203 #endregion
202 204
203 #region IRegionModule Members 205 #region ISharedRegionModule Members
204 206
205 public void Initialise(Scene scene, IConfigSource source) 207 public void Initialise(IConfigSource source)
206 { 208 {
207 m_scenes = new List<Scene>(); 209 m_scenes = new List<Scene>();
208 m_timer = new Timer(); 210 m_timer = new Timer();
@@ -225,7 +227,10 @@ namespace OpenSim.Region.Modules.SvnSerialiser
225 catch (Exception) 227 catch (Exception)
226 { 228 {
227 } 229 }
230 }
228 231
232 public void AddRegion(Scene scene)
233 {
229 lock (m_scenes) 234 lock (m_scenes)
230 { 235 {
231 m_scenes.Add(scene); 236 m_scenes.Add(scene);
@@ -236,6 +241,18 @@ namespace OpenSim.Region.Modules.SvnSerialiser
236 scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; 241 scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
237 } 242 }
238 } 243 }
244 public void RegionLoaded(Scene scene)
245 {
246 }
247
248 public void RemoveRegion(Scene scene)
249 {
250 }
251
252 public Type ReplaceableInterface
253 {
254 get { return null; }
255 }
239 256
240 public void PostInitialise() 257 public void PostInitialise()
241 { 258 {
@@ -277,11 +294,6 @@ namespace OpenSim.Region.Modules.SvnSerialiser
277 get { return "SvnBackupModule"; } 294 get { return "SvnBackupModule"; }
278 } 295 }
279 296
280 public bool IsSharedModule
281 {
282 get { return true; }
283 }
284
285 #endregion 297 #endregion
286 298
287 private void EventManager_OnPluginConsole(string[] args) 299 private void EventManager_OnPluginConsole(string[] args)
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index ac39a53..521d01a 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.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.Threading; 30using System.Threading;
30using OpenMetaverse; 31using OpenMetaverse;
32using Mono.Addins;
31using Nini.Config; 33using Nini.Config;
32using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
@@ -37,7 +39,8 @@ using Timer=System.Timers.Timer;
37 39
38namespace OpenSim.Region.OptionalModules.World.NPC 40namespace OpenSim.Region.OptionalModules.World.NPC
39{ 41{
40 public class NPCModule : IRegionModule, INPCModule 42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
43 public class NPCModule : ISharedRegionModule, INPCModule
41 { 44 {
42 // private const bool m_enabled = false; 45 // private const bool m_enabled = false;
43 46
@@ -134,15 +137,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
134 } 137 }
135 138
136 139
137 public void Initialise(Scene scene, IConfigSource source) 140 public void Initialise(IConfigSource source)
138 { 141 {
139 m_createMutex = new Mutex(false); 142 m_createMutex = new Mutex(false);
140 143
141 m_timer = new Timer(500); 144 m_timer = new Timer(500);
142 m_timer.Elapsed += m_timer_Elapsed; 145 m_timer.Elapsed += m_timer_Elapsed;
143 m_timer.Start(); 146 m_timer.Start();
144
145 scene.RegisterModuleInterface<INPCModule>(this);
146 } 147 }
147 148
148 void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) 149 void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
@@ -173,6 +174,19 @@ namespace OpenSim.Region.OptionalModules.World.NPC
173 } 174 }
174 } 175 }
175 176
177 public void AddRegion(Scene scene)
178 {
179 scene.RegisterModuleInterface<INPCModule>(this);
180 }
181 public void RegionLoaded(Scene scene)
182 {
183 }
184
185 public void RemoveRegion(Scene scene)
186 {
187 scene.UnregisterModuleInterface<INPCModule>(this);
188 }
189
176 public void PostInitialise() 190 public void PostInitialise()
177 { 191 {
178 } 192 }
@@ -186,9 +200,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
186 get { return "NPCModule"; } 200 get { return "NPCModule"; }
187 } 201 }
188 202
189 public bool IsSharedModule 203 public Type ReplaceableInterface
190 { 204 {
191 get { return true; } 205 get { return null; }
192 } 206 }
193 } 207 }
194} 208}
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index e3fbb6e..b59d07a 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31using System.Timers; 31using System.Timers;
32using OpenMetaverse; 32using OpenMetaverse;
33using log4net; 33using log4net;
34using Mono.Addins;
34using Nini.Config; 35using Nini.Config;
35using OpenSim.Framework; 36using OpenSim.Framework;
36using OpenSim.Region.CoreModules.Framework.InterfaceCommander; 37using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
@@ -46,7 +47,8 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
46 /// <summary> 47 /// <summary>
47 /// Version 2.02 - Still hacky 48 /// Version 2.02 - Still hacky
48 /// </summary> 49 /// </summary>
49 public class TreePopulatorModule : IRegionModule, ICommandableModule, IVegetationModule 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
51 public class TreePopulatorModule : INonSharedRegionModule, ICommandableModule, IVegetationModule
50 { 52 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 private readonly Commander m_commander = new Commander("tree"); 54 private readonly Commander m_commander = new Commander("tree");
@@ -168,15 +170,10 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
168 170
169 #endregion 171 #endregion
170 172
171 #region IRegionModule Members 173 #region ISharedRegionModule Members
172 174
173 public void Initialise(Scene scene, IConfigSource config) 175 public void Initialise(IConfigSource config)
174 { 176 {
175
176 m_scene = scene;
177 m_scene.RegisterModuleInterface<IRegionModule>(this);
178 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
179
180 // ini file settings 177 // ini file settings
181 try 178 try
182 { 179 {
@@ -196,12 +193,18 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
196 m_log.Debug("[TREES]: ini failure for update_rate - using default"); 193 m_log.Debug("[TREES]: ini failure for update_rate - using default");
197 } 194 }
198 195
199 InstallCommands();
200
201 m_log.Debug("[TREES]: Initialised tree module"); 196 m_log.Debug("[TREES]: Initialised tree module");
202 } 197 }
203 198
204 public void PostInitialise() 199 public void AddRegion(Scene scene)
200 {
201 m_scene = scene;
202 m_scene.RegisterModuleInterface<INonSharedRegionModule>(this);
203 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
204 InstallCommands();
205 }
206
207 public void RegionLoaded(Scene scene)
205 { 208 {
206 ReloadCopse(); 209 ReloadCopse();
207 if (m_copse.Count > 0) 210 if (m_copse.Count > 0)
@@ -211,18 +214,24 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
211 activeizeTreeze(true); 214 activeizeTreeze(true);
212 } 215 }
213 216
214 public void Close() 217 public void RemoveRegion(Scene scene)
215 { 218 {
219 scene.UnregisterModuleInterface<INonSharedRegionModule>(this);
220 scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
216 } 221 }
217 222
218 public string Name 223 public Type ReplaceableInterface
224 {
225 get { return null; }
226 }
227
228 public void Close()
219 { 229 {
220 get { return "TreePopulatorModule"; }
221 } 230 }
222 231
223 public bool IsSharedModule 232 public string Name
224 { 233 {
225 get { return false; } 234 get { return "TreePopulatorModule"; }
226 } 235 }
227 236
228 #endregion 237 #endregion
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index a03cc4c..9b53d06 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -34,6 +34,7 @@ using System.Reflection;
34using System.Text; 34using System.Text;
35using System.Threading; 35using System.Threading;
36using log4net; 36using log4net;
37using Mono.Addins;
37using Nini.Config; 38using Nini.Config;
38using OpenMetaverse; 39using OpenMetaverse;
39using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
@@ -52,7 +53,8 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap;
52 53
53namespace OpenSim.Region.UserStatistics 54namespace OpenSim.Region.UserStatistics
54{ 55{
55 public class WebStatsModule : IRegionModule 56 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
57 public class WebStatsModule : ISharedRegionModule
56 { 58 {
57 private static readonly ILog m_log = 59 private static readonly ILog m_log =
58 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 60 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -70,7 +72,7 @@ namespace OpenSim.Region.UserStatistics
70 private string m_loglines = String.Empty; 72 private string m_loglines = String.Empty;
71 private volatile int lastHit = 12000; 73 private volatile int lastHit = 12000;
72 74
73 public virtual void Initialise(Scene scene, IConfigSource config) 75 public virtual void Initialise(IConfigSource config)
74 { 76 {
75 IConfig cnfg; 77 IConfig cnfg;
76 try 78 try
@@ -82,11 +84,17 @@ namespace OpenSim.Region.UserStatistics
82 { 84 {
83 enabled = false; 85 enabled = false;
84 } 86 }
85 87 }
88
89 public Type ReplaceableInterface
90 {
91 get { return null; }
92 }
93
94 public void AddRegion(Scene scene)
95 {
86 if (!enabled) 96 if (!enabled)
87 {
88 return; 97 return;
89 }
90 98
91 lock (m_scene) 99 lock (m_scene)
92 { 100 {
@@ -130,7 +138,7 @@ namespace OpenSim.Region.UserStatistics
130 MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest); 138 MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest);
131 MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest); 139 MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest);
132 } 140 }
133 141
134 m_scene.Add(scene); 142 m_scene.Add(scene);
135 if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID)) 143 if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID))
136 m_simstatsCounters.Remove(scene.RegionInfo.RegionID); 144 m_simstatsCounters.Remove(scene.RegionInfo.RegionID);
@@ -140,6 +148,14 @@ namespace OpenSim.Region.UserStatistics
140 } 148 }
141 } 149 }
142 150
151 public void RegionLoaded(Scene scene)
152 {
153 }
154
155 public void RemoveRegion(Scene scene)
156 {
157 }
158
143 public void ReceiveClassicSimStatsPacket(SimStats stats) 159 public void ReceiveClassicSimStatsPacket(SimStats stats)
144 { 160 {
145 if (!enabled) 161 if (!enabled)
@@ -308,11 +324,6 @@ namespace OpenSim.Region.UserStatistics
308 get { return "ViewerStatsModule"; } 324 get { return "ViewerStatsModule"; }
309 } 325 }
310 326
311 public bool IsSharedModule
312 {
313 get { return true; }
314 }
315
316 public void OnRegisterCaps(UUID agentID, Caps caps) 327 public void OnRegisterCaps(UUID agentID, Caps caps)
317 { 328 {
318 m_log.DebugFormat("[VC]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); 329 m_log.DebugFormat("[VC]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index b13e8dd..20f2bca 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -161,10 +161,11 @@ namespace OpenSim.Tests.Common.Setup
161 capsModule.Initialise(new IniConfigSource()); 161 capsModule.Initialise(new IniConfigSource());
162 testScene.AddRegionModule(capsModule.Name, capsModule); 162 testScene.AddRegionModule(capsModule.Name, capsModule);
163 capsModule.AddRegion(testScene); 163 capsModule.AddRegion(testScene);
164 164
165 IRegionModule godsModule = new GodsModule(); 165 INonSharedRegionModule godsModule = new GodsModule();
166 godsModule.Initialise(testScene, new IniConfigSource()); 166 godsModule.Initialise(new IniConfigSource());
167 testScene.AddModule(godsModule.Name, godsModule); 167 testScene.AddRegionModule(godsModule.Name, godsModule);
168 godsModule.AddRegion(testScene);
168 realServices = realServices.ToLower(); 169 realServices = realServices.ToLower();
169 // IConfigSource config = new IniConfigSource(); 170 // IConfigSource config = new IniConfigSource();
170 171