// --------------------------- RunList -------------------------------- // run the List command on the server public MailDropMessages RunList( ) { MailDropMessages messages = new MailDropMessages( ); string[] listLines = null; SockEx.SendReceive("LIST" + PopConstants.CrLf); while (true) { if (ResponseIsPopTerminated(SockEx.ResponseBuilder) == true) { break; } SockEx.SleepThenReadMoreAvailableData(1000); } listLines = Stringer.Split(SockEx.ResponseMessage, NetworkConstants.CrLf); // parse the list line output into an arraylist of MailDropMessages. for (int Ix = 0; Ix < listLines.Length; ++Ix) { string line = listLines[Ix]; if ((line[0] == '+') || (line[0] == '.')) { continue; } messages.AddMessage(new MailDropMessage(line)); } return(messages); }
// ------------------------ FromString -------------------------- // create a MailDropMessages object from a comma delimeted string. public static MailDropMessages FromString(string InValue) { MailDropMessages msgs = new MailDropMessages( ); CsvString msgsLine = new CsvString( ); msgsLine.String = InValue; CsvString.Value vlu = msgsLine.BeginValue( ); while (true) { vlu.AdvanceNextValue( ); if (vlu.IsAtValue == false) { break; } CsvString line = (CsvString)vlu.ToObject( ); MailDropMessage msg = MailDropMessage.FromString(line.ToString( )); msgs.AddMessage(msg); } return(msgs); }