aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorBlueWall2012-05-13 17:40:03 -0400
committerBlueWall2012-05-13 17:40:03 -0400
commit171480f2359c067e35caf29b50762835497107ff (patch)
tree7a2202a27cceb798ded94927c087ccde7b6f0fe4 /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
parentModifications for SMTP in OpenSimulator. Email size limit was fixed (was out ... (diff)
downloadopensim-SC_OLD-171480f2359c067e35caf29b50762835497107ff.zip
opensim-SC_OLD-171480f2359c067e35caf29b50762835497107ff.tar.gz
opensim-SC_OLD-171480f2359c067e35caf29b50762835497107ff.tar.bz2
opensim-SC_OLD-171480f2359c067e35caf29b50762835497107ff.tar.xz
Merge branch 'master' of /home/opensim/src/OpenSim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs28
2 files changed, 26 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
index 9255791..e91e8b9 100644
--- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
@@ -64,6 +64,8 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
64 private TimeSpan m_QueueTimeout = new TimeSpan(2, 0, 0); // 2 hours without llGetNextEmail drops the queue 64 private TimeSpan m_QueueTimeout = new TimeSpan(2, 0, 0); // 2 hours without llGetNextEmail drops the queue
65 private string m_InterObjectHostname = "lsl.opensim.local"; 65 private string m_InterObjectHostname = "lsl.opensim.local";
66 66
67 private int m_MaxEmailSize = 4096; // largest email allowed by default, as per lsl docs.
68
67 // Scenes by Region Handle 69 // Scenes by Region Handle
68 private Dictionary<ulong, Scene> m_Scenes = 70 private Dictionary<ulong, Scene> m_Scenes =
69 new Dictionary<ulong, Scene>(); 71 new Dictionary<ulong, Scene>();
@@ -127,6 +129,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
127 SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); 129 SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT);
128 SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); 130 SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN);
129 SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); 131 SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD);
132 m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize);
130 } 133 }
131 catch (Exception e) 134 catch (Exception e)
132 { 135 {
@@ -176,18 +179,6 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
176 get { return true; } 179 get { return true; }
177 } 180 }
178 181
179 /// <summary>
180 /// Delay function using thread in seconds
181 /// </summary>
182 /// <param name="seconds"></param>
183 private void DelayInSeconds(int delay)
184 {
185 delay = (int)((float)delay * 1000);
186 if (delay == 0)
187 return;
188 System.Threading.Thread.Sleep(delay);
189 }
190
191 private bool IsLocal(UUID objectID) 182 private bool IsLocal(UUID objectID)
192 { 183 {
193 string unused; 184 string unused;
@@ -267,10 +258,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
267 m_log.Error("[EMAIL] REGEX Problem in EMail Address: "+address); 258 m_log.Error("[EMAIL] REGEX Problem in EMail Address: "+address);
268 return; 259 return;
269 } 260 }
270 //FIXME:Check if subject + body = 4096 Byte 261 if ((subject.Length + body.Length) > m_MaxEmailSize)
271 if ((subject.Length + body.Length) > 1024)
272 { 262 {
273 m_log.Error("[EMAIL] subject + body > 1024 Byte"); 263 m_log.Error("[EMAIL] subject + body larger than limit of " + m_MaxEmailSize + " bytes");
274 return; 264 return;
275 } 265 }
276 266
@@ -345,10 +335,6 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
345 // TODO FIX 335 // TODO FIX
346 } 336 }
347 } 337 }
348
349 //DONE: Message as Second Life style
350 //20 second delay - AntiSpam System - for now only 10 seconds
351 DelayInSeconds(10);
352 } 338 }
353 339
354 /// <summary> 340 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 5b5cab8..5bff2e9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -106,6 +106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
106 protected IUrlModule m_UrlModule = null; 106 protected IUrlModule m_UrlModule = null;
107 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = 107 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache =
108 new Dictionary<UUID, UserInfoCacheEntry>(); 108 new Dictionary<UUID, UserInfoCacheEntry>();
109 protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
109 110
110 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) 111 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item)
111 { 112 {
@@ -113,6 +114,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
113 m_host = host; 114 m_host = host;
114 m_item = item; 115 m_item = item;
115 116
117 LoadLimits(); // read script limits from config.
118
119 m_TransferModule =
120 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
121 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
122
123 AsyncCommands = new AsyncCommandManager(ScriptEngine);
124 }
125
126 /* load configuration items that affect script, object and run-time behavior. */
127 private void LoadLimits()
128 {
116 m_ScriptDelayFactor = 129 m_ScriptDelayFactor =
117 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); 130 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
118 m_ScriptDistanceFactor = 131 m_ScriptDistanceFactor =
@@ -125,12 +138,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
125 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); 138 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
126 if (m_notecardLineReadCharsMax > 65535) 139 if (m_notecardLineReadCharsMax > 65535)
127 m_notecardLineReadCharsMax = 65535; 140 m_notecardLineReadCharsMax = 65535;
128 141 // load limits for particular subsystems.
129 m_TransferModule = 142 IConfig SMTPConfig;
130 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>(); 143 if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) {
131 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); 144 // there's an smtp config, so load in the snooze time.
132 145 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
133 AsyncCommands = new AsyncCommandManager(ScriptEngine); 146 }
134 } 147 }
135 148
136 public override Object InitializeLifetimeService() 149 public override Object InitializeLifetimeService()
@@ -2877,6 +2890,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2877 2890
2878 public virtual void llSleep(double sec) 2891 public virtual void llSleep(double sec)
2879 { 2892 {
2893// m_log.Info("llSleep snoozing " + sec + "s.");
2880 m_host.AddScriptLPS(1); 2894 m_host.AddScriptLPS(1);
2881 Thread.Sleep((int)(sec * 1000)); 2895 Thread.Sleep((int)(sec * 1000));
2882 } 2896 }
@@ -3130,7 +3144,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3130 } 3144 }
3131 3145
3132 emailModule.SendEmail(m_host.UUID, address, subject, message); 3146 emailModule.SendEmail(m_host.UUID, address, subject, message);
3133 ScriptSleep(20000); 3147 llSleep(EMAIL_PAUSE_TIME);
3134 } 3148 }
3135 3149
3136 public void llGetNextEmail(string address, string subject) 3150 public void llGetNextEmail(string address, string subject)