From 141205532b0ea4a9f757dbb5317eda0517e40c49 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 14 Jun 2016 00:03:40 +0200 Subject: Make chat and instant message modules fully subclassable --- .../Region/CoreModules/Avatar/Chat/ChatModule.cs | 34 +++++++++---------- .../Avatar/InstantMessage/InstantMessageModule.cs | 38 +++++++++++----------- 2 files changed, 36 insertions(+), 36 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index ee0a4f8..fe0a243 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -45,18 +45,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private const int DEBUG_CHANNEL = 2147483647; + protected const int DEBUG_CHANNEL = 2147483647; - private bool m_enabled = true; - private int m_saydistance = 20; - private int m_shoutdistance = 100; - private int m_whisperdistance = 10; - private List m_scenes = new List(); - private List FreezeCache = new List(); - private string m_adminPrefix = ""; - internal object m_syncy = new object(); + protected bool m_enabled = true; + protected int m_saydistance = 20; + protected int m_shoutdistance = 100; + protected int m_whisperdistance = 10; + protected List m_scenes = new List(); + protected List FreezeCache = new List(); + protected string m_adminPrefix = ""; + protected object m_syncy = new object(); - internal IConfig m_config; + protected IConfig m_config; #region ISharedRegionModule Members public virtual void Initialise(IConfigSource config) @@ -134,7 +134,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat { } - public Type ReplaceableInterface + public virtual Type ReplaceableInterface { get { return null; } } @@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat client.OnChatFromClient += OnChatFromClient; } - protected OSChatMessage FixPositionOfChatMessage(OSChatMessage c) + protected virtual OSChatMessage FixPositionOfChatMessage(OSChatMessage c) { ScenePresence avatar; Scene scene = (Scene)c.Scene; @@ -324,7 +324,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully); } - static private Vector3 CenterOfRegion = new Vector3(128, 128, 30); + static protected Vector3 CenterOfRegion = new Vector3(128, 128, 30); public virtual void OnChatBroadcast(Object sender, OSChatMessage c) { @@ -437,7 +437,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat } Dictionary Timers = new Dictionary(); - public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) + public virtual void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) { System.Threading.Timer Timer; if (flags == 0) @@ -456,7 +456,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat } } - private void OnEndParcelFrozen(object avatar) + protected virtual void OnEndParcelFrozen(object avatar) { UUID target = (UUID)avatar; FreezeCache.Remove(target.ToString()); @@ -467,9 +467,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat } #region SimulatorFeaturesRequest - static OSDInteger m_SayRange, m_WhisperRange, m_ShoutRange; + protected static OSDInteger m_SayRange, m_WhisperRange, m_ShoutRange; - private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) + protected virtual void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) { OSD extras = new OSDMap(); if (features.ContainsKey("OpenSimExtras")) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index 55e30a0..fb868be 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs @@ -45,22 +45,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private Timer m_logTimer = new Timer(10000); - private List m_logData = new List(); - private string m_restUrl; + protected Timer m_logTimer = new Timer(10000); + protected List m_logData = new List(); + protected string m_restUrl; /// /// Is this module enabled? /// - private bool m_enabled = false; + protected bool m_enabled = false; - private readonly List m_scenes = new List(); + protected readonly List m_scenes = new List(); #region Region Module interface - private IMessageTransferModule m_TransferModule = null; + protected IMessageTransferModule m_TransferModule = null; - public void Initialise(IConfigSource config) + public virtual void Initialise(IConfigSource config) { if (config.Configs["Messaging"] != null) { @@ -76,7 +76,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage m_logTimer.Elapsed += LogTimerElapsed; } - public void AddRegion(Scene scene) + public virtual void AddRegion(Scene scene) { if (!m_enabled) return; @@ -92,7 +92,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } - public void RegionLoaded(Scene scene) + public virtual void RegionLoaded(Scene scene) { if (!m_enabled) return; @@ -114,7 +114,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } - public void RemoveRegion(Scene scene) + public virtual void RemoveRegion(Scene scene) { if (!m_enabled) return; @@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } - void OnClientConnect(IClientCore client) + protected virtual void OnClientConnect(IClientCore client) { IClientIM clientIM; if (client.TryGet(out clientIM)) @@ -134,27 +134,27 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } - public void PostInitialise() + public virtual void PostInitialise() { } - public void Close() + public virtual void Close() { } - public string Name + public virtual string Name { get { return "InstantMessageModule"; } } - public Type ReplaceableInterface + public virtual Type ReplaceableInterface { get { return null; } } #endregion - public void OnInstantMessage(IClientAPI client, GridInstantMessage im) + public virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im) { byte dialog = im.dialog; @@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage /// /// /// - private void OnGridInstantMessage(GridInstantMessage msg) + protected virtual void OnGridInstantMessage(GridInstantMessage msg) { // Just call the Text IM handler above // This event won't be raised unless we have that agent, @@ -240,7 +240,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage OnInstantMessage(null, msg); } - private void LogInstantMesssage(GridInstantMessage im) + protected virtual void LogInstantMesssage(GridInstantMessage im) { if (m_logData.Count < 20) { @@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } - private void LogTimerElapsed(object source, ElapsedEventArgs e) + protected virtual void LogTimerElapsed(object source, ElapsedEventArgs e) { lock (m_logData) { -- cgit v1.1