diff options
author | Kevin Cozens | 2014-08-08 16:44:22 -0400 |
---|---|---|
committer | Kevin Cozens | 2014-08-14 02:40:06 -0400 |
commit | 626536b8cc525deacf66ad98a09ebc7f94ffee31 (patch) | |
tree | eab3cac766930c70e11eed84cc0d58d45df06f00 /OpenSim/Region/ScriptEngine | |
parent | Make RootTerseUpdatePeriod and ChildTerseUpdatePeriod configurable in [Intere... (diff) | |
download | opensim-SC_OLD-626536b8cc525deacf66ad98a09ebc7f94ffee31.zip opensim-SC_OLD-626536b8cc525deacf66ad98a09ebc7f94ffee31.tar.gz opensim-SC_OLD-626536b8cc525deacf66ad98a09ebc7f94ffee31.tar.bz2 opensim-SC_OLD-626536b8cc525deacf66ad98a09ebc7f94ffee31.tar.xz |
Added RestrictEmail to make llEmail only send to avatars email address if true.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 991107e..0e6e8bb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -120,6 +120,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
120 | protected IUrlModule m_UrlModule = null; | 120 | protected IUrlModule m_UrlModule = null; |
121 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = new Dictionary<UUID, UserInfoCacheEntry>(); | 121 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = new Dictionary<UUID, UserInfoCacheEntry>(); |
122 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. | 122 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. |
123 | protected string m_internalObjectHost = "lsl.opensim.local"; | ||
124 | protected bool m_restrictEmail = false; | ||
123 | protected ISoundModule m_SoundModule = null; | 125 | protected ISoundModule m_SoundModule = null; |
124 | 126 | ||
125 | //An array of HTTP/1.1 headers that are not allowed to be used | 127 | //An array of HTTP/1.1 headers that are not allowed to be used |
@@ -193,11 +195,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
193 | 195 | ||
194 | if (seConfigSource != null) | 196 | if (seConfigSource != null) |
195 | { | 197 | { |
198 | IConfig lslConfig = seConfigSource.Configs["LL-Functions"]; | ||
199 | if (lslConfig != null) | ||
200 | { | ||
201 | m_restrictEmail = lslConfig.GetBoolean("RestrictEmail", m_restrictEmail); | ||
202 | } | ||
203 | |||
196 | IConfig smtpConfig = seConfigSource.Configs["SMTP"]; | 204 | IConfig smtpConfig = seConfigSource.Configs["SMTP"]; |
197 | if (smtpConfig != null) | 205 | if (smtpConfig != null) |
198 | { | 206 | { |
199 | // there's an smtp config, so load in the snooze time. | 207 | // there's an smtp config, so load in the snooze time. |
200 | EMAIL_PAUSE_TIME = smtpConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); | 208 | EMAIL_PAUSE_TIME = smtpConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); |
209 | |||
210 | m_internalObjectHost = smtpConfig.GetString("internal_object_host", m_internalObjectHost); | ||
201 | } | 211 | } |
202 | } | 212 | } |
203 | } | 213 | } |
@@ -3387,6 +3397,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3387 | return; | 3397 | return; |
3388 | } | 3398 | } |
3389 | 3399 | ||
3400 | //Restrict email destination to the avatars registered email address? | ||
3401 | //The restriction only applies if the destination address is not local. | ||
3402 | if (m_restrictEmail == true && address.Contains(m_internalObjectHost) == false) | ||
3403 | { | ||
3404 | UserAccount account = | ||
3405 | World.UserAccountService.GetUserAccount( | ||
3406 | World.RegionInfo.ScopeID, | ||
3407 | m_host.OwnerID); | ||
3408 | |||
3409 | if (account == null) | ||
3410 | { | ||
3411 | Error("llEmail", "Can't find user account for '" + m_host.OwnerID.ToString() + "'"); | ||
3412 | return; | ||
3413 | } | ||
3414 | |||
3415 | if (String.IsNullOrEmpty(account.Email)) | ||
3416 | { | ||
3417 | Error("llEmail", "User account has not registered an email address."); | ||
3418 | return; | ||
3419 | } | ||
3420 | |||
3421 | address = account.Email; | ||
3422 | } | ||
3423 | |||
3390 | emailModule.SendEmail(m_host.UUID, address, subject, message); | 3424 | emailModule.SendEmail(m_host.UUID, address, subject, message); |
3391 | ScriptSleep(EMAIL_PAUSE_TIME * 1000); | 3425 | ScriptSleep(EMAIL_PAUSE_TIME * 1000); |
3392 | } | 3426 | } |