add some debug

master
Christopher 2020-07-01 18:45:41 +02:00
parent 8295c88818
commit d98e706e26
1 changed files with 41 additions and 15 deletions

View File

@ -37,6 +37,8 @@ namespace OpenSim.Modules.EMail
private List<InternalMail> m_messages = new List<InternalMail>(); private List<InternalMail> m_messages = new List<InternalMail>();
private bool m_debug = false;
private String SMTP_SERVER_HOSTNAME = null; private String SMTP_SERVER_HOSTNAME = null;
private String SMTP_SERVER_LOGIN = null; private String SMTP_SERVER_LOGIN = null;
private String SMTP_SERVER_PASSWORD = null; private String SMTP_SERVER_PASSWORD = null;
@ -102,6 +104,8 @@ namespace OpenSim.Modules.EMail
if (source.Configs["Mail"] == null) if (source.Configs["Mail"] == null)
return; return;
m_debug = m_config.Configs["Mail"].GetBoolean("DEBUG", m_debug);
SMTP_SERVER_HOSTNAME = m_config.Configs["Mail"].GetString("SMTP_SERVER_HOSTNAME", String.Empty); SMTP_SERVER_HOSTNAME = m_config.Configs["Mail"].GetString("SMTP_SERVER_HOSTNAME", String.Empty);
SMTP_SERVER_PORT = m_config.Configs["Mail"].GetInt("SMTP_SERVER_PORT", 25); SMTP_SERVER_PORT = m_config.Configs["Mail"].GetInt("SMTP_SERVER_PORT", 25);
SMTP_SERVER_SSL = m_config.Configs["Mail"].GetBoolean("SMTP_SERVER_SSL", false); SMTP_SERVER_SSL = m_config.Configs["Mail"].GetBoolean("SMTP_SERVER_SSL", false);
@ -135,7 +139,8 @@ namespace OpenSim.Modules.EMail
{ {
try try
{ {
m_log.Info("[" + Name + "] checkForMails"); if(m_debug)
m_log.Info("[" + Name + "] checkForMails");
using (var client = new ImapClient()) using (var client = new ImapClient())
{ {
@ -177,8 +182,12 @@ namespace OpenSim.Modules.EMail
{ {
try try
{ {
m_log.Info("[" + Name + "] Message To: " + adress.Address); if (m_debug)
m_log.Info("[" + Name + "] Objekt ID: " + adress.Address.Split('@')[0]); {
m_log.Info("[" + Name + "] Message To: " + adress.Address);
m_log.Info("[" + Name + "] Objekt ID: " + adress.Address.Split('@')[0]);
}
String UUIDString = adress.Address.Split('@')[0].Trim(); String UUIDString = adress.Address.Split('@')[0].Trim();
@ -191,7 +200,9 @@ namespace OpenSim.Modules.EMail
{ {
m_messages.Add(new InternalMail(message, objID)); m_messages.Add(new InternalMail(message, objID));
IMAPInbox.SetFlags(i, MessageFlags.Deleted, true); IMAPInbox.SetFlags(i, MessageFlags.Deleted, true);
m_log.Info("[" + Name + "] Get Message for objekt " + sceneObject.Name + " (" + sceneObject.UUID + ")");
if (m_debug)
m_log.Info("[" + Name + "] Get Message for objekt " + sceneObject.Name + " (" + sceneObject.UUID + ")");
} }
} }
else else
@ -266,26 +277,41 @@ namespace OpenSim.Modules.EMail
if(messages[0] != null) if(messages[0] != null)
{ {
Email lslMessage = new Email(); if(messages[0].Mail != null)
{
Email lslMessage = new Email();
lslMessage.time = DateTime.Now.ToShortTimeString();
lslMessage.message = messages[0].Mail.TextBody.ToString();
lslMessage.sender = messages[0].Mail.Sender.GetAddress(true);
lslMessage.subject = messages[0].Mail.Subject;
lslMessage.numLeft = messages.Count - 1;
m_messages.Remove(messages[0]);
return lslMessage;
}
else
{
if (m_debug)
m_log.Error("[" + Name + "] Cant find mail data!");
return null;
}
lslMessage.time = messages[0].Mail.Date.ToUnixTimeSeconds().ToString();
lslMessage.message = messages[0].Mail.TextBody.ToString();
lslMessage.sender = messages[0].Mail.Sender.GetAddress(true);
lslMessage.subject = messages[0].Mail.Subject;
lslMessage.numLeft = messages.Count - 1;
m_messages.Remove(messages[0]);
return lslMessage;
} }
else else
{ {
m_log.Error("[" + Name + "] Cant find caller objekt!"); if (m_debug)
m_log.Error("[" + Name + "] Cant find caller objekt!");
return null; return null;
} }
} }
else else
{ {
m_log.Error("[" + Name + "] Cant find caller objekt!"); if (m_debug)
m_log.Error("[" + Name + "] Cant find caller objekt!");
return null; return null;
} }
} }