From 9932872ad1d24032ceade452a39269bbcc5b798a Mon Sep 17 00:00:00 2001 From: Andy Edinborough Date: Sat, 4 Feb 2012 19:31:22 -0600 Subject: [PATCH] Fix for #26 and #1 --- ImapClient.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ImapClient.cs b/ImapClient.cs index a8d3684..cbcdb9c 100644 --- a/ImapClient.cs +++ b/ImapClient.cs @@ -2,10 +2,10 @@ using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; +using System.Text; using System.Text.RegularExpressions; using System.Threading; using AE.Net.Mail.Imap; -using System.Text; namespace AE.Net.Mail { @@ -366,7 +366,10 @@ public MailMessage[] GetMessages(string start, string end, bool uid, bool header if (m2.Groups[1] != null) mail.Size = Convert.ToInt32(m2.Groups[1].ToString()); mail.Load(body.ToString(), headersonly); x.Add(mail); - response = GetResponse(); // read last line terminated by ) + + response = response.Split('\n').LastOrDefault() ?? string.Empty; + while (!response.Contains(tag + "OK")) + response = GetResponse(); m = Regex.Match(response, reg); } @@ -459,7 +462,7 @@ internal override void OnLogin(string login, string password) { break; case AuthMethods.Login: - command = tag + "LOGIN " + login + " " + password; + command = tag + "LOGIN " + login.QuoteString() + " " + password.QuoteString(); result = SendCommandGetResponse(command); break;