aenetmail icon indicating copy to clipboard operation
aenetmail copied to clipboard

IDLE command does not work properly (unstable)

Open Umplify opened this issue 12 years ago • 4 comments

I have instantiated ImapClient class successfully. I hooked up the two events of NewMessage and MessageDeleted to be notified when a message arrives or deleted. The code sample below implies it:

        _imapClient.NewMessage += (sender, e) =>
        {
            var msg = _imapClient.GetMessage(e.MessageCount - 1);
            Trace.TraceInformation(msg.Uid);
        };

        _imapClient.MessageDeleted += (sender, e) =>
            {
                var msg = _imapClient.GetMessage(e.MessageCount - 1);
                Trace.TraceInformation(msg.Uid);
            };

There is only one incident or two that the application is notified (even that's by chance). In rest of cases, you never receive any notifications.

Umplify avatar Apr 30 '13 02:04 Umplify

So, we found a fix for this, but I'd like to run it by someone - basically, the issue is that the "Read" command was timing out before it ever could read idle updates. But, it looked like this was by design, so I'm curious if I messed anything else up by adding an optional read timeout:

internal static string ReadLine(this Stream stream, ref int maxLength, Encoding encoding, char? termChar, int readTimeout = 10000) { if (stream.CanTimeout && readTimeout > 0) stream.ReadTimeout = readTimeout;

patwhite avatar Aug 17 '13 20:08 patwhite

Correction, did this (Utilities.cs:92):

internal static string ReadLine(this Stream stream, ref int maxLength, Encoding encoding, char? termChar, int readTimeout = 10000) { if (stream.CanTimeout) stream.ReadTimeout = readTimeout;

patwhite avatar Aug 17 '13 20:08 patwhite

@patwhite can you send me a pull request?

andyedinborough avatar Aug 21 '13 05:08 andyedinborough