Thank you, Vytek, for a patch that streamlines the delay in the email

module and changes SMTP authentication (applied with changes)
Fixes Mantis #3168
0.6.3-post-fixes
Melanie Thielker 2009-02-15 13:54:34 +00:00
parent 9b19c65450
commit 272a319a3e
1 changed files with 16 additions and 11 deletions

View File

@ -178,17 +178,15 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
} }
/// <summary> /// <summary>
/// /// Delay function using thread in seconds
/// </summary> /// </summary>
/// <param name="seconds"></param> /// <param name="seconds"></param>
private void DelayInSeconds(int seconds) private void DelayInSeconds(int delay)
{ {
TimeSpan DiffDelay = new TimeSpan(0, 0, seconds); delay = (int)((float)delay * 1000);
DateTime EndDelay = DateTime.Now.Add(DiffDelay); if (delay == 0)
while (DateTime.Now < EndDelay) return;
{ System.Threading.Thread.Sleep(delay);
;//Do nothing!!
}
} }
private bool IsLocal(UUID objectID) private bool IsLocal(UUID objectID)
@ -293,12 +291,19 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
"\nRegion: " + LastObjectRegionName + "\nLocal-Position: " + "\nRegion: " + LastObjectRegionName + "\nLocal-Position: " +
LastObjectPosition + "\n\n" + body; LastObjectPosition + "\n\n" + body;
//Config SMTP Server
//Set SMTP SERVER config //Set SMTP SERVER config
SmtpServer smtpServer=new SmtpServer(SMTP_SERVER_HOSTNAME,SMTP_SERVER_PORT); SmtpServer smtpServer=new SmtpServer(SMTP_SERVER_HOSTNAME,SMTP_SERVER_PORT);
// Add authentication only when requested
//
if (SMTP_SERVER_LOGIN != String.Empty && SMTP_SERVER_PASSWORD != String.Empty)
{
//Authentication //Authentication
smtpServer.SmtpAuthToken=new SmtpAuthToken(SMTP_SERVER_LOGIN, SMTP_SERVER_PASSWORD); smtpServer.SmtpAuthToken=new SmtpAuthToken(SMTP_SERVER_LOGIN, SMTP_SERVER_PASSWORD);
}
//Send Email Message //Send Email Message
emailMessage.Send(smtpServer); emailMessage.Send(smtpServer);
//Log //Log
m_log.Info("[EMAIL] EMail sent to: " + address + " from object: " + objectID.ToString()); m_log.Info("[EMAIL] EMail sent to: " + address + " from object: " + objectID.ToString());
} }