Added RestrictEmail to make llEmail only send to avatars email address if true.

bullet-2.82
Kevin Cozens 2014-08-08 16:44:22 -04:00
parent 4c781db572
commit 626536b8cc
2 changed files with 39 additions and 0 deletions

View File

@ -120,6 +120,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected IUrlModule m_UrlModule = null;
protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = new Dictionary<UUID, UserInfoCacheEntry>();
protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
protected string m_internalObjectHost = "lsl.opensim.local";
protected bool m_restrictEmail = false;
protected ISoundModule m_SoundModule = null;
//An array of HTTP/1.1 headers that are not allowed to be used
@ -193,11 +195,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (seConfigSource != null)
{
IConfig lslConfig = seConfigSource.Configs["LL-Functions"];
if (lslConfig != null)
{
m_restrictEmail = lslConfig.GetBoolean("RestrictEmail", m_restrictEmail);
}
IConfig smtpConfig = seConfigSource.Configs["SMTP"];
if (smtpConfig != null)
{
// there's an smtp config, so load in the snooze time.
EMAIL_PAUSE_TIME = smtpConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
m_internalObjectHost = smtpConfig.GetString("internal_object_host", m_internalObjectHost);
}
}
}
@ -3387,6 +3397,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
//Restrict email destination to the avatars registered email address?
//The restriction only applies if the destination address is not local.
if (m_restrictEmail == true && address.Contains(m_internalObjectHost) == false)
{
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;
}
emailModule.SendEmail(m_host.UUID, address, subject, message);
ScriptSleep(EMAIL_PAUSE_TIME * 1000);
}

View File

@ -1318,6 +1318,11 @@
; If false then gods cannot execute these functions either.
AllowGodFunctions = false
; Restrict the email address used by llEmail to the address associated with the avatars user account?
; If true then llEmail will only send email to the address in the user account of the avatar who owns the object containing the script.
; If false then email may be sent to any valid email address.
RestrictEmail = false
; Maximum number of llListen events we allow over the entire region.
; Set this to 0 to have no limit imposed
max_listens_per_region = 1000