Skip to content

Commit a19fc91

Browse files
committed
Apply specific gmail imap fix that david found a long time ago
1 parent ee75b61 commit a19fc91

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

‎Class Library/ActiveUp.Net.Imap4/Imap4Client.cs‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,11 +1006,26 @@ public void StartIdle()
10061006
response = sr.ReadLine();
10071007
OnTcpRead(new TcpReadEventArgs(response));
10081008

1009-
if (response.ToUpper().IndexOf("RECENT") > 0)
1010-
OnNewMessageReceived(new NewMessageReceivedEventArgs(int.Parse(response.Split(' ')[1])));
10111009
#if DEBUG
10121010
Console.WriteLine(response);
10131011
#endif
1012+
1013+
if (response != null)
1014+
{
1015+
var parts = response.Split(' ');
1016+
// SPLIT something like "* 28 EXISTS" into its parts
1017+
if (parts.Length > 2)
1018+
{
1019+
int countInt;
1020+
if (!int.TryParse(parts[1], out countInt))
1021+
{
1022+
#if DEBUG
1023+
Console.WriteLine("Unparsable: {0}", response);
1024+
#endif
1025+
}
1026+
OnNewMessageReceived(new NewMessageReceivedEventArgs(parts[2], int.Parse(parts[1])));
1027+
}
1028+
}
10141029
}
10151030
else
10161031
{

0 commit comments

Comments
 (0)