mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
several changes to llTargetedEmail
This commit is contained in:
@@ -129,6 +129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
protected IMaterialsModule m_materialsModule = null;
|
||||
protected IEnvironmentModule m_envModule = null;
|
||||
protected IEmailModule m_emailModule = null;
|
||||
|
||||
protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = new Dictionary<UUID, UserInfoCacheEntry>();
|
||||
protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
|
||||
@@ -147,7 +148,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
protected int m_sleepMsOnMakeFire = 100;
|
||||
protected int m_sleepMsOnRezAtRoot = 100;
|
||||
protected int m_sleepMsOnInstantMessage = 2000;
|
||||
protected int m_sleepMsOnEmail = 20000;
|
||||
protected int m_sleepMsOnEmail = 30000;
|
||||
protected int m_sleepMsOnCreateLink = 1000;
|
||||
protected int m_sleepMsOnGiveInventory = 3000;
|
||||
protected int m_sleepMsOnRequestAgentData = 100;
|
||||
@@ -314,6 +315,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>();
|
||||
m_materialsModule = m_ScriptEngine.World.RequestModuleInterface<IMaterialsModule>();
|
||||
|
||||
m_emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>();
|
||||
m_envModule = m_ScriptEngine.World.RequestModuleInterface< IEnvironmentModule>();
|
||||
|
||||
AsyncCommands = new AsyncCommandManager(m_ScriptEngine);
|
||||
@@ -3983,8 +3985,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public void llEmail(string address, string subject, string message)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>();
|
||||
if (emailModule == null)
|
||||
if (m_emailModule == null)
|
||||
{
|
||||
Error("llEmail", "Email module not configured");
|
||||
return;
|
||||
@@ -4014,22 +4015,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
address = account.Email;
|
||||
}
|
||||
|
||||
emailModule.SendEmail(m_host.UUID, address, subject, message);
|
||||
m_emailModule.SendEmail(m_host.UUID, address, subject, message);
|
||||
ScriptSleep(m_sleepMsOnEmail);
|
||||
}
|
||||
|
||||
public void llGetNextEmail(string address, string subject)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>();
|
||||
if (emailModule == null)
|
||||
if (m_emailModule == null)
|
||||
{
|
||||
Error("llGetNextEmail", "Email module not configured");
|
||||
return;
|
||||
}
|
||||
Email email;
|
||||
|
||||
email = emailModule.GetNextEmail(m_host.UUID, address, subject);
|
||||
email = m_emailModule.GetNextEmail(m_host.UUID, address, subject);
|
||||
|
||||
if (email == null)
|
||||
return;
|
||||
@@ -4046,42 +4046,64 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
}
|
||||
|
||||
public void llTargetedEmail(LSL_Integer target, string subject, string message)
|
||||
public void llTargetedEmail(LSL_Integer target, LSL_String subject, LSL_String message)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>();
|
||||
if (emailModule == null)
|
||||
|
||||
SceneObjectGroup parent = m_host.ParentGroup;
|
||||
if (parent == null || parent.IsDeleted)
|
||||
return;
|
||||
|
||||
if (m_emailModule == null)
|
||||
{
|
||||
Error("llTargetedEmail", "Email module not configured");
|
||||
return;
|
||||
}
|
||||
|
||||
string address;
|
||||
|
||||
if(target == ScriptBaseClass.TARGETED_EMAIL_OBJECT_OWNER)
|
||||
if (subject.Length + message.Length > 4096)
|
||||
{
|
||||
UserAccount account =
|
||||
World.UserAccountService.GetUserAccount(
|
||||
World.RegionInfo.ScopeID,
|
||||
m_host.OwnerID);
|
||||
|
||||
if (account == null)
|
||||
{
|
||||
Error("llEmail", "Can't find user account for '" + m_host.OwnerID.ToString() + "'");
|
||||
return;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(account.Email))
|
||||
{
|
||||
Error("llEmail", "User account has not registered an email address.");
|
||||
return;
|
||||
}
|
||||
|
||||
address = account.Email;
|
||||
Error("llTargetedEmail", "Message is too large");
|
||||
return;
|
||||
}
|
||||
else return;
|
||||
|
||||
emailModule.SendEmail(m_host.UUID, address, subject, message);
|
||||
string address;
|
||||
UserAccount account = null;
|
||||
|
||||
if (target == ScriptBaseClass.TARGETED_EMAIL_OBJECT_OWNER)
|
||||
{
|
||||
if(parent.OwnerID == parent.GroupID)
|
||||
return;
|
||||
account = World.UserAccountService.GetUserAccount(
|
||||
World.RegionInfo.ScopeID,
|
||||
parent.OwnerID);
|
||||
}
|
||||
else if (target == ScriptBaseClass.TARGETED_EMAIL_ROOT_CREATOR)
|
||||
{
|
||||
// non standard avoid creator spam
|
||||
if(((parent.RootPart.OwnerMask & (uint)PermissionMask.Modify) == 0) || m_item.CreatorID == parent.RootPart.CreatorID)
|
||||
{
|
||||
account = World.UserAccountService.GetUserAccount(
|
||||
World.RegionInfo.ScopeID,
|
||||
parent.RootPart.CreatorID);
|
||||
}
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if (account == null)
|
||||
{
|
||||
Error("llTargetedEmail", "Can't find user account for '" + m_host.OwnerID.ToString() + "'");
|
||||
return;
|
||||
}
|
||||
|
||||
address = account.Email;
|
||||
if (String.IsNullOrEmpty(address))
|
||||
{
|
||||
Error("llTargetedEmail", "User account has not registered an email address.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_emailModule.SendEmail(m_host.UUID, address, subject, message);
|
||||
ScriptSleep(m_sleepMsOnEmail);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user