One more module converted: EmailModule.

integration
Diva Canto 2012-11-11 14:00:58 -08:00
parent f560d581bb
commit 84be90e5f8
1 changed files with 64 additions and 46 deletions

View File

@ -37,10 +37,12 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using Mono.Addins;
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
@ -72,31 +74,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
private bool m_Enabled = false;
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.
#region ISharedRegionModule
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);
}
}
}
}
public void Initialise(Scene scene, IConfigSource config)
public void Initialise(IConfigSource config)
{
m_Config = config;
IConfig SMTPConfig;
@ -133,14 +113,19 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
}
catch (Exception e)
{
m_log.Error("[EMAIL] DefaultEmailModule not configured: "+ e.Message);
m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message);
m_Enabled = false;
return;
}
// It's a go!
if (m_Enabled)
}
public void AddRegion(Scene scene)
{
if (!m_Enabled)
return;
// It's a go!
lock (m_Scenes)
{
// Claim the interface slot
@ -159,6 +144,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
m_log.Info("[EMAIL] Activated DefaultEmailModule");
}
public void RemoveRegion(Scene scene)
{
}
public void PostInitialise()
@ -174,9 +162,39 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
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)