Make chat and instant message modules fully subclassable

LSLKeyTest
Melanie Thielker 2016-06-14 00:03:40 +02:00
parent 3ef5e1a24b
commit 141205532b
2 changed files with 36 additions and 36 deletions

View File

@ -45,18 +45,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const int DEBUG_CHANNEL = 2147483647; protected const int DEBUG_CHANNEL = 2147483647;
private bool m_enabled = true; protected bool m_enabled = true;
private int m_saydistance = 20; protected int m_saydistance = 20;
private int m_shoutdistance = 100; protected int m_shoutdistance = 100;
private int m_whisperdistance = 10; protected int m_whisperdistance = 10;
private List<Scene> m_scenes = new List<Scene>(); protected List<Scene> m_scenes = new List<Scene>();
private List<string> FreezeCache = new List<string>(); protected List<string> FreezeCache = new List<string>();
private string m_adminPrefix = ""; protected string m_adminPrefix = "";
internal object m_syncy = new object(); protected object m_syncy = new object();
internal IConfig m_config; protected IConfig m_config;
#region ISharedRegionModule Members #region ISharedRegionModule Members
public virtual void Initialise(IConfigSource config) 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; } get { return null; }
} }
@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
client.OnChatFromClient += OnChatFromClient; client.OnChatFromClient += OnChatFromClient;
} }
protected OSChatMessage FixPositionOfChatMessage(OSChatMessage c) protected virtual OSChatMessage FixPositionOfChatMessage(OSChatMessage c)
{ {
ScenePresence avatar; ScenePresence avatar;
Scene scene = (Scene)c.Scene; 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); 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) public virtual void OnChatBroadcast(Object sender, OSChatMessage c)
{ {
@ -437,7 +437,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
} }
Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
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; System.Threading.Timer Timer;
if (flags == 0) 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; UUID target = (UUID)avatar;
FreezeCache.Remove(target.ToString()); FreezeCache.Remove(target.ToString());
@ -467,9 +467,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
} }
#region SimulatorFeaturesRequest #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(); OSD extras = new OSDMap();
if (features.ContainsKey("OpenSimExtras")) if (features.ContainsKey("OpenSimExtras"))

View File

@ -45,22 +45,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private static readonly ILog m_log = LogManager.GetLogger( private static readonly ILog m_log = LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private Timer m_logTimer = new Timer(10000); protected Timer m_logTimer = new Timer(10000);
private List<GridInstantMessage> m_logData = new List<GridInstantMessage>(); protected List<GridInstantMessage> m_logData = new List<GridInstantMessage>();
private string m_restUrl; protected string m_restUrl;
/// <value> /// <value>
/// Is this module enabled? /// Is this module enabled?
/// </value> /// </value>
private bool m_enabled = false; protected bool m_enabled = false;
private readonly List<Scene> m_scenes = new List<Scene>(); protected readonly List<Scene> m_scenes = new List<Scene>();
#region Region Module interface #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) if (config.Configs["Messaging"] != null)
{ {
@ -76,7 +76,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
m_logTimer.Elapsed += LogTimerElapsed; m_logTimer.Elapsed += LogTimerElapsed;
} }
public void AddRegion(Scene scene) public virtual void AddRegion(Scene scene)
{ {
if (!m_enabled) if (!m_enabled)
return; 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) if (!m_enabled)
return; 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) if (!m_enabled)
return; return;
@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
} }
} }
void OnClientConnect(IClientCore client) protected virtual void OnClientConnect(IClientCore client)
{ {
IClientIM clientIM; IClientIM clientIM;
if (client.TryGet(out 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"; } get { return "InstantMessageModule"; }
} }
public Type ReplaceableInterface public virtual Type ReplaceableInterface
{ {
get { return null; } get { return null; }
} }
#endregion #endregion
public void OnInstantMessage(IClientAPI client, GridInstantMessage im) public virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{ {
byte dialog = im.dialog; byte dialog = im.dialog;
@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
/// ///
/// </summary> /// </summary>
/// <param name="msg"></param> /// <param name="msg"></param>
private void OnGridInstantMessage(GridInstantMessage msg) protected virtual void OnGridInstantMessage(GridInstantMessage msg)
{ {
// Just call the Text IM handler above // Just call the Text IM handler above
// This event won't be raised unless we have that agent, // This event won't be raised unless we have that agent,
@ -240,7 +240,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
OnInstantMessage(null, msg); OnInstantMessage(null, msg);
} }
private void LogInstantMesssage(GridInstantMessage im) protected virtual void LogInstantMesssage(GridInstantMessage im)
{ {
if (m_logData.Count < 20) 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) lock (m_logData)
{ {