One more module converted: EmailModule.
parent
f560d581bb
commit
84be90e5f8
|
@ -37,10 +37,12 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
{
|
{
|
||||||
public class EmailModule : IRegionModule, IEmailModule
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EmailModule")]
|
||||||
|
public class EmailModule : ISharedRegionModule, IEmailModule
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Log
|
// Log
|
||||||
|
@ -72,31 +74,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
|
|
||||||
public void InsertEmail(UUID to, Email email)
|
#region ISharedRegionModule
|
||||||
{
|
|
||||||
// It's tempting to create the queue here. Don't; objects which have
|
|
||||||
// not yet called GetNextEmail should have no queue, and emails to them
|
|
||||||
// should be silently dropped.
|
|
||||||
|
|
||||||
lock (m_MailQueues)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
|
||||||
if (m_MailQueues.ContainsKey(to))
|
|
||||||
{
|
|
||||||
if (m_MailQueues[to].Count >= m_MaxQueueSize)
|
|
||||||
{
|
|
||||||
// fail silently
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
lock (m_MailQueues[to])
|
|
||||||
{
|
|
||||||
m_MailQueues[to].Add(email);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
|
||||||
{
|
{
|
||||||
m_Config = config;
|
m_Config = config;
|
||||||
IConfig SMTPConfig;
|
IConfig SMTPConfig;
|
||||||
|
@ -138,9 +118,14 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// It's a go!
|
}
|
||||||
if (m_Enabled)
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// It's a go!
|
||||||
lock (m_Scenes)
|
lock (m_Scenes)
|
||||||
{
|
{
|
||||||
// Claim the interface slot
|
// Claim the interface slot
|
||||||
|
@ -159,6 +144,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
|
|
||||||
m_log.Info("[EMAIL] Activated DefaultEmailModule");
|
m_log.Info("[EMAIL] Activated DefaultEmailModule");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
@ -174,9 +162,39 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
get { return "DefaultEmailModule"; }
|
get { return "DefaultEmailModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public void InsertEmail(UUID to, Email email)
|
||||||
|
{
|
||||||
|
// It's tempting to create the queue here. Don't; objects which have
|
||||||
|
// not yet called GetNextEmail should have no queue, and emails to them
|
||||||
|
// should be silently dropped.
|
||||||
|
|
||||||
|
lock (m_MailQueues)
|
||||||
|
{
|
||||||
|
if (m_MailQueues.ContainsKey(to))
|
||||||
|
{
|
||||||
|
if (m_MailQueues[to].Count >= m_MaxQueueSize)
|
||||||
|
{
|
||||||
|
// fail silently
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lock (m_MailQueues[to])
|
||||||
|
{
|
||||||
|
m_MailQueues[to].Add(email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsLocal(UUID objectID)
|
private bool IsLocal(UUID objectID)
|
||||||
|
|
Loading…
Reference in New Issue