public Mailbox Examine(string mailbox) { IdlePause(); Mailbox x = null; string tag = GetTag(); string command = tag + "EXAMINE " + mailbox.QuoteString(); string response = SendCommandGetResponse(command); if (response.StartsWith("*")) { x = new Mailbox(mailbox); while (response.StartsWith("*")) { Match m; m = Regex.Match(response, @"(\d+) EXISTS"); if (m.Groups.Count > 1) { x.NumMsg = Convert.ToInt32(m.Groups[1].ToString()); } m = Regex.Match(response, @"(\d+) RECENT"); if (m.Groups.Count > 1) { x.NumNewMsg = Convert.ToInt32(m.Groups[1].ToString()); } m = Regex.Match(response, @"UNSEEN (\d+)"); if (m.Groups.Count > 1) { x.NumUnSeen = Convert.ToInt32(m.Groups[1].ToString()); } m = Regex.Match(response, @" FLAGS \((.*?)\)"); if (m.Groups.Count > 1) { x.SetFlags(m.Groups[1].ToString()); } response = GetResponse(); } _SelectedMailbox = mailbox; } IdleResume(); return(x); }
public Mailbox[] ListSuscribesMailboxes(string reference, string pattern) { IdlePause(); var x = new List <Mailbox>(); string command = GetTag() + "LSUB " + reference.QuoteString() + " " + pattern.QuoteString(); string reg = "\\* LSUB \\(([^\\)]*)\\) \\\"([^\\\"]+)\\\" \\\"([^\\\"]+)\\\""; string response = SendCommandGetResponse(command); Match m = Regex.Match(response, reg); while (m.Groups.Count > 1) { Mailbox mailbox = new Mailbox(m.Groups[3].ToString()); x.Add(mailbox); response = GetResponse(); m = Regex.Match(response, reg); } IdleResume(); return(x.ToArray()); }