Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE command does not work properly (unstable) #135

Open
Umplify opened this issue Apr 30, 2013 · 4 comments
Open

IDLE command does not work properly (unstable) #135

Umplify opened this issue Apr 30, 2013 · 4 comments

Comments

@Umplify
Copy link

Umplify commented Apr 30, 2013

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.

@patwhite
Copy link

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
Copy link

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;

@andyedinborough
Copy link
Owner

@patwhite can you send me a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@andyedinborough @patwhite and others