From ec3c31e61e5e540f822891110df9bc978655bbaf Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 22 Jan 2010 18:09:33 -0600 Subject: Updates all IRegionModules to the new style region modules. Signed-off-by: Melanie --- .../CoreModules/Avatar/Friends/FriendsModule.cs | 54 ++++++++++++++++------ 1 file changed, 41 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Friends') 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; using System.Net; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -81,7 +82,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends - Terminate Friendship messages (single) */ - public class FriendsModule : IRegionModule, IFriendsModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class FriendsModule : ISharedRegionModule, IFriendsModule { private class Transaction { @@ -111,9 +113,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends private IGridService m_gridServices = null; - #region IRegionModule Members + #region ISharedRegionModule Members - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) + { + + } + + public void PostInitialise() + { + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void AddRegion(Scene scene) { lock (m_scenes) { @@ -128,9 +144,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle)) m_scenes[scene.RegionInfo.RegionHandle] = scene; } - + scene.RegisterModuleInterface(this); - + scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; @@ -138,29 +154,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends scene.EventManager.OnClientClosed += ClientClosed; } - public void PostInitialise() + public void RegionLoaded(Scene scene) { if (m_scenes.Count > 0) { - m_TransferModule = m_initialScene.RequestModuleInterface(); - m_gridServices = m_initialScene.GridService; + m_TransferModule = scene.RequestModuleInterface(); + m_gridServices = scene.GridService; } if (m_TransferModule == null) m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work"); } - public void Close() + public void RemoveRegion(Scene scene) { + MainServer.Instance.RemoveXmlRPCHandler("presence_update_bulk"); + MainServer.Instance.RemoveXmlRPCHandler("terminate_friend"); + + if (m_scenes.ContainsKey(scene.RegionInfo.RegionHandle)) + m_scenes.Remove(scene.RegionInfo.RegionHandle); + + scene.UnregisterModuleInterface(this); + + scene.EventManager.OnNewClient -= OnNewClient; + scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; + scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; + scene.EventManager.OnMakeChildAgent -= MakeChildAgent; + scene.EventManager.OnClientClosed -= ClientClosed; } - public string Name + public void Close() { - get { return "FriendsModule"; } } - public bool IsSharedModule + public string Name { - get { return true; } + get { return "FriendsModule"; } } #endregion -- cgit v1.1