aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Scripting/EMailModules
diff options
context:
space:
mode:
authorJeff Ames2008-08-18 00:39:10 +0000
committerJeff Ames2008-08-18 00:39:10 +0000
commit6ef9d4da901a346c232458317cca6268da888e2e (patch)
treedd1d935b10f34f261839da9f9879c02322e8ede7 /OpenSim/Region/Environment/Modules/Scripting/EMailModules
parentUpdate svn properties, minor formatting cleanup. (diff)
downloadopensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.zip
opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.tar.gz
opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.tar.bz2
opensim-SC-6ef9d4da901a346c232458317cca6268da888e2e.tar.xz
Formatting cleanup.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Scripting/EMailModules')
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs52
1 files changed, 26 insertions, 26 deletions
diff --git a/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs
index 1162c25..bcf3e76 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs
@@ -68,14 +68,14 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules
68 { 68 {
69 m_Config = config; 69 m_Config = config;
70 IConfig SMTPConfig; 70 IConfig SMTPConfig;
71 71
72 //FIXME: RegionName is correct?? 72 //FIXME: RegionName is correct??
73 //m_RegionName = scene.RegionInfo.RegionName; 73 //m_RegionName = scene.RegionInfo.RegionName;
74 74
75 IConfig startupConfig = m_Config.Configs["Startup"]; 75 IConfig startupConfig = m_Config.Configs["Startup"];
76 76
77 m_Enabled = (startupConfig.GetString("emailmodule", "DefaultEmailModule") == "DefaultEmailModule"); 77 m_Enabled = (startupConfig.GetString("emailmodule", "DefaultEmailModule") == "DefaultEmailModule");
78 78
79 //Load SMTP SERVER config 79 //Load SMTP SERVER config
80 try 80 try
81 { 81 {
@@ -85,16 +85,16 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules
85 m_Enabled = false; 85 m_Enabled = false;
86 return; 86 return;
87 } 87 }
88 88
89 if (!SMTPConfig.GetBoolean("enabled", false)) 89 if (!SMTPConfig.GetBoolean("enabled", false))
90 { 90 {
91 m_log.InfoFormat("[SMTP] module disabled in configuration"); 91 m_log.InfoFormat("[SMTP] module disabled in configuration");
92 m_Enabled = false; 92 m_Enabled = false;
93 return; 93 return;
94 } 94 }
95 95
96 m_HostName = SMTPConfig.GetString("host_domain_header_from", m_HostName); 96 m_HostName = SMTPConfig.GetString("host_domain_header_from", m_HostName);
97 SMTP_SERVER_HOSTNAME = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME",SMTP_SERVER_HOSTNAME); 97 SMTP_SERVER_HOSTNAME = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME",SMTP_SERVER_HOSTNAME);
98 SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); 98 SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT);
99 SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); 99 SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN);
100 SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); 100 SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD);
@@ -124,7 +124,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules
124 m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); 124 m_Scenes.Add(scene.RegionInfo.RegionHandle, scene);
125 } 125 }
126 } 126 }
127 127
128 m_log.Info("[EMAIL] Activated DefaultEmailModule"); 128 m_log.Info("[EMAIL] Activated DefaultEmailModule");
129 } 129 }
130 } 130 }
@@ -146,9 +146,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules
146 { 146 {
147 get { return true; } 147 get { return true; }
148 } 148 }
149 149
150 /// <summary> 150 /// <summary>
151 /// 151 ///
152 /// </summary> 152 /// </summary>
153 /// <param name="seconds"></param> 153 /// <param name="seconds"></param>
154 private void DelayInSeconds(int seconds) 154 private void DelayInSeconds(int seconds)
@@ -156,11 +156,11 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules
156 TimeSpan DiffDelay = new TimeSpan(0, 0, seconds); 156 TimeSpan DiffDelay = new TimeSpan(0, 0, seconds);
157 DateTime EndDelay = DateTime.Now.Add(DiffDelay); 157 DateTime EndDelay = DateTime.Now.Add(DiffDelay);
158 while (DateTime.Now < EndDelay) 158 while (DateTime.Now < EndDelay)
159 { 159 {
160 ;//Do nothing!! 160 ;//Do nothing!!
161 } 161 }
162 } 162 }
163 163
164 private SceneObjectPart findPrim(LLUUID objectID, out string ObjectRegionName) 164 private SceneObjectPart findPrim(LLUUID objectID, out string ObjectRegionName)
165 { 165 {
166 lock (m_Scenes) 166 lock (m_Scenes)
@@ -187,7 +187,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules
187 { 187 {
188 ObjectAbsolutePosition = part.AbsolutePosition.ToString(); 188 ObjectAbsolutePosition = part.AbsolutePosition.ToString();
189 ObjectName = part.Name; 189 ObjectName = part.Name;
190 ObjectRegionName = m_ObjectRegionName; 190 ObjectRegionName = m_ObjectRegionName;
191 return; 191 return;
192 } 192 }
193 ObjectAbsolutePosition = part.AbsolutePosition.ToString(); 193 ObjectAbsolutePosition = part.AbsolutePosition.ToString();
@@ -195,7 +195,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules
195 ObjectRegionName = m_ObjectRegionName; 195 ObjectRegionName = m_ObjectRegionName;
196 return; 196 return;
197 } 197 }
198 198
199 /// <summary> 199 /// <summary>
200 /// SendMail function utilized by llEMail 200 /// SendMail function utilized by llEMail
201 /// </summary> 201 /// </summary>
@@ -206,14 +206,14 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules
206 public void SendEmail(LLUUID objectID, string address, string subject, string body) 206 public void SendEmail(LLUUID objectID, string address, string subject, string body)
207 { 207 {
208 //Check if address is empty 208 //Check if address is empty
209 if (address == string.Empty) 209 if (address == string.Empty)
210 return; 210 return;
211 211
212 //FIXED:Check the email is correct form in REGEX 212 //FIXED:Check the email is correct form in REGEX
213 string EMailpatternStrict = @"^(([^<>()[\]\\.,;:\s@\""]+" 213 string EMailpatternStrict = @"^(([^<>()[\]\\.,;:\s@\""]+"
214 + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@" 214 + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@"
215 + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" 215 + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
216 + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+" 216 + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+"
217 + @"[a-zA-Z]{2,}))$"; 217 + @"[a-zA-Z]{2,}))$";
218 Regex EMailreStrict = new Regex(EMailpatternStrict); 218 Regex EMailreStrict = new Regex(EMailpatternStrict);
219 bool isEMailStrictMatch = EMailreStrict.IsMatch(address); 219 bool isEMailStrictMatch = EMailreStrict.IsMatch(address);
@@ -226,9 +226,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules
226 if ((subject.Length + body.Length) > 1024) 226 if ((subject.Length + body.Length) > 1024)
227 { 227 {
228 m_log.Error("[EMAIL] subject + body > 1024 Byte"); 228 m_log.Error("[EMAIL] subject + body > 1024 Byte");
229 return; 229 return;
230 } 230 }
231 231
232 try 232 try
233 { 233 {
234 string LastObjectName = string.Empty; 234 string LastObjectName = string.Empty;
@@ -242,21 +242,21 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules
242 //From 242 //From
243 emailMessage.FromAddress = new EmailAddress(objectID.UUID.ToString()+"@"+m_HostName); 243 emailMessage.FromAddress = new EmailAddress(objectID.UUID.ToString()+"@"+m_HostName);
244 //To - Only One 244 //To - Only One
245 emailMessage.AddToAddress(new EmailAddress(address)); 245 emailMessage.AddToAddress(new EmailAddress(address));
246 //Subject 246 //Subject
247 emailMessage.Subject = subject; 247 emailMessage.Subject = subject;
248 //TEXT Body 248 //TEXT Body
249 resolveNamePositionRegionName(objectID, out LastObjectName, out LastObjectPosition, out LastObjectRegionName); 249 resolveNamePositionRegionName(objectID, out LastObjectName, out LastObjectPosition, out LastObjectRegionName);
250 emailMessage.TextPart = new TextAttachment("Object-Name: " + LastObjectName + 250 emailMessage.TextPart = new TextAttachment("Object-Name: " + LastObjectName +
251 "\r\nRegion: " + LastObjectRegionName + "\r\nLocal-Position: " + 251 "\r\nRegion: " + LastObjectRegionName + "\r\nLocal-Position: " +
252 LastObjectPosition+"\r\n\r\n\r\n" + body); 252 LastObjectPosition+"\r\n\r\n\r\n" + body);
253 //HTML Body 253 //HTML Body
254 emailMessage.HtmlPart = new HtmlAttachment("<html><body><p>" + 254 emailMessage.HtmlPart = new HtmlAttachment("<html><body><p>" +
255 "<BR>Object-Name: " + LastObjectName + 255 "<BR>Object-Name: " + LastObjectName +
256 "<BR>Region: " + LastObjectRegionName + 256 "<BR>Region: " + LastObjectRegionName +
257 "<BR>Local-Position: " + LastObjectPosition + "<BR><BR><BR>" 257 "<BR>Local-Position: " + LastObjectPosition + "<BR><BR><BR>"
258 +body+"\r\n</p></body><html>"); 258 +body+"\r\n</p></body><html>");
259 259
260 //Set SMTP SERVER config 260 //Set SMTP SERVER config
261 SmtpServer smtpServer=new SmtpServer(SMTP_SERVER_HOSTNAME,SMTP_SERVER_PORT); 261 SmtpServer smtpServer=new SmtpServer(SMTP_SERVER_HOSTNAME,SMTP_SERVER_PORT);
262 //Authentication 262 //Authentication
@@ -272,9 +272,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules
272 return; 272 return;
273 } 273 }
274 } 274 }
275 275
276 /// <summary> 276 /// <summary>
277 /// 277 ///
278 /// </summary> 278 /// </summary>
279 /// <param name="objectID"></param> 279 /// <param name="objectID"></param>
280 /// <param name="sender"></param> 280 /// <param name="sender"></param>