return Email

master
Christopher 2020-07-01 18:21:50 +02:00
parent 060761b987
commit 0da86a4ad4
1 changed files with 12 additions and 30 deletions

View File

@ -35,7 +35,7 @@ namespace OpenSim.Modules.EMail
private Timer m_timer = null; private Timer m_timer = null;
private List<MimeMessage> m_messages = new List<MimeMessage>(); private List<InternalMail> m_messages = new List<InternalMail>();
private String SMTP_SERVER_HOSTNAME = null; private String SMTP_SERVER_HOSTNAME = null;
private String SMTP_SERVER_LOGIN = null; private String SMTP_SERVER_LOGIN = null;
@ -257,38 +257,20 @@ namespace OpenSim.Modules.EMail
public Email GetNextEmail(UUID objectID, string sender, string subject) public Email GetNextEmail(UUID objectID, string sender, string subject)
{ {
SceneObjectPart sceneObject = m_scene.GetSceneObjectPart(objectID); SceneObjectPart sceneObject = m_scene.GetSceneObjectPart(objectID);
m_log.Info("[" + Name + "] GetNextEmail: " + sceneObject.Name + " (" + sceneObject.UUID + ")"); m_log.Info("[" + Name + "] GetNextEmail: " + sceneObject.Name + " (" + sceneObject.UUID + ")");
List<MimeMessage> messages = m_messages.FindAll(X => X.Subject.Contains(subject) && X.Sender.GetAddress(true).Contains(sender)); List<InternalMail> messages = m_messages.FindAll(X => X.ID == objectID);
if (messages.Count == 0)
return null;
MimeMessage lastMessage = null; Email lslMessage = new Email();
Email lslMessage = null; lslMessage.time = messages[0].Mail.Date.ToUnixTimeSeconds().ToString();
lslMessage.message = messages[0].Mail.Body.ToString();
lslMessage.sender = messages[0].Mail.Sender.GetAddress(true);
lslMessage.subject = messages[0].Mail.Subject;
lslMessage.numLeft = messages.Count - 1;
foreach (MimeMessage message in messages) m_messages.Remove(messages[0]);
{
if (lslMessage != null)
continue;
lastMessage = message;
foreach (MailboxAddress adress in message.To.Mailboxes)
{
if (lslMessage != null)
continue;
lslMessage = new Email();
lslMessage.time = lastMessage.Date.ToUnixTimeSeconds().ToString();
lslMessage.message = lastMessage.Body.ToString();
lslMessage.sender = lastMessage.Sender.GetAddress(true);
lslMessage.subject = lastMessage.Subject;
lslMessage.numLeft = messages.Count - 1;
}
}
if(lastMessage != null)
m_messages.Remove(lastMessage);
return lslMessage; return lslMessage;
} }