private void SpotterGetMailFields(SpotterBase spotter, out string from, out string to, out string cc, out string bcc, out string subject, out string content) { from = spotter.GetContentPart("^(from|From|FROM|senderEmail)$", "^<?[^@]+@[\\w]+\\.[a-zA-Z]{2,4}>?$"); to = spotter.GetContentPart("^(to|To|TO|recipientEmail)$", "^<?[^@]+@[\\w]+\\.[a-zA-Z]{2,4}>?$"); cc = spotter.GetContentPart("^(cc|Cc|CC)$", "^<?[^@]+@[\\w]+\\.[a-zA-Z]{2,4}>?$"); bcc = spotter.GetContentPart("^(bcc|Bcc|BCC)$", "^<?[^@]+@[\\w]+\\.[a-zA-Z]{2,4}>?$"); subject = spotter.GetContentPart("^(subject|Subject|SUBJECT)$", ".+"); content = spotter.GetContentPart("^([Cc]ontent|(simple)?[Bb]ody)$", ".*"); }
private WebmailEventBase CreateEvent(WebmailAnalyzerBase.EventSuggest evt, WebmailAnalyzerBase.WebmailSuggest webmailApp, SpotterBase spotter) { string from; string to; string cc; string bcc; string subject; string body; switch (evt) { case WebmailAnalyzerBase.EventSuggest.MailDisplayMessage: if (webmailApp == WebmailAnalyzerBase.WebmailSuggest.Seznam) { var o = spotter.Accept(SpotterVisitorsManager.GetSpotterVisitor("Seznam/GetDisplayMessage")); var m = o as MailMsg; if (m != null) { return(new EventDisplayMessage(this.SnooperExport, m)); } } else if (webmailApp == WebmailAnalyzerBase.WebmailSuggest.YahooMailNeo) { var o = spotter.Accept(SpotterVisitorsManager.GetSpotterVisitor("Yahoo/GetDisplayMessage")); var m = o as MailMsg; if (m != null) { return(new EventDisplayMessage(this.SnooperExport, m)); } } this.SpotterGetMailFields(spotter, out from, out to, out cc, out bcc, out subject, out body); return(new EventDisplayMessage(this.SnooperExport, from, to, cc, bcc, subject, body)); case WebmailAnalyzerBase.EventSuggest.MailListFolder: if (webmailApp == WebmailAnalyzerBase.WebmailSuggest.YahooMailNeo) { var o = spotter.Accept(SpotterVisitorsManager.GetSpotterVisitor("Yahoo/GetListedMessages")); var l = o as List <MailMsg>; if (l != null) { return(new EventListFolder(this.SnooperExport, l)); } } else if (webmailApp == WebmailAnalyzerBase.WebmailSuggest.Seznam) { var o = spotter.Accept(SpotterVisitorsManager.GetSpotterVisitor("Seznam/GetListedMessages")); var l = o as List <MailMsg>; if (l != null) { return(new EventListFolder(this.SnooperExport, l)); } } else if (webmailApp == WebmailAnalyzerBase.WebmailSuggest.MicrosoftLive) { // TODO var content = spotter.GetStringContent(); var splitted = content.Split(','); var list = new List <MailMsg>(); for (int i = 0; i < splitted.Length; i++) { if (!splitted[i].Contains("new HM.Rollup")) { continue; } var mail = new MailMsg(); mail.From = splitted[i + 11]; mail.Subject = splitted[i + 27]; list.Add(mail); } return(new EventListFolder(this.SnooperExport, list)); } return(new EventListFolder(this.SnooperExport, spotter.GetStringContent())); default: if (webmailApp == WebmailAnalyzerBase.WebmailSuggest.Seznam) { var o = spotter.Accept(SpotterVisitorsManager.GetSpotterVisitor("Seznam/GetNewMessage")); var m = o as MailMsg; if (m != null) { return(new EventNewMessage(this.SnooperExport, m)); } } else if (webmailApp == WebmailAnalyzerBase.WebmailSuggest.MicrosoftLive) { var pars = spotter.GetContentPart("^d$", "*"); var value = pars.Substring(1, pars.Length - 2); var parray = value.Split(','); to = parray.Length > 0 ? parray[0] : ""; from = parray.Length > 1 ? parray[1] : ""; cc = parray.Length > 2 ? parray[2] : ""; bcc = parray.Length > 3 ? parray[3] : ""; subject = parray.Length > 5 ? parray[5] : ""; body = parray.Length > 6 ? parray[6] : ""; return(new EventNewMessage(this.SnooperExport, from, to, cc, bcc, subject, body)); } this.SpotterGetMailFields(spotter, out from, out to, out cc, out bcc, out subject, out body); return(new EventNewMessage(this.SnooperExport, from, to, cc, bcc, subject, body)); } }