/** * returns true if a contact is myself */ internal static bool ParseFrom(IResource article, string fromValue, out IContact contact) { if (MIMEParser.ContainsMIMEStrings(fromValue)) { fromValue = ParseTools.ParseMIMEHeader(fromValue); } fromValue = fromValue.Replace("<", null).Replace(">", null).Replace("\\", null).Replace("//", null); string[] parts = fromValue.Split(' '); string eMail = string.Empty; foreach (string part in parts) { if (part.IndexOf('@') >= 0) { eMail = part; break; } } string displayName = fromValue; if (eMail.Length > 0) { displayName = displayName.Replace(eMail, null).Trim(); } if (eMail.Length > 0 || displayName.Length > 0) { IContactManager cm = Core.ContactManager; IResource oldFrom = article.GetLinkProp(cm.Props.LinkFrom); contact = cm.FindOrCreateContact(eMail, displayName); cm.LinkContactToResource(cm.Props.LinkFrom, contact.Resource, article, eMail, displayName); if (oldFrom != null && contact.Resource != oldFrom) { cm.DeleteUnusedContacts(oldFrom.ToResourceList()); } return(contact.IsMyself); } contact = null; return(false); }