Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Commit

Permalink
Bugfix EventDispatcher
Browse files Browse the repository at this point in the history
addresses issues mentioned in #20, #51 and #61
  • Loading branch information
smiley22 committed Jan 21, 2014
1 parent a038a53 commit 9f1ffc0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion AuthMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public enum AuthMethod {
/// <summary>
/// Login using the Secure Remote Password (SRP) authentication mechanism.
/// </summary>
/// <remarks>The SRP mechanism is only available when targetting .NET 4.0 or newer.</remarks>
/// <remarks>The SRP mechanism is only available when targeting .NET 4.0 or newer.</remarks>
Srp
}
}
33 changes: 19 additions & 14 deletions ImapClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2134,21 +2134,25 @@ void EventDispatcher() {
Match m = Regex.Match(response, @"\*\s+(\d+)\s+(\w+)");
if (!m.Success)
continue;
uint numberOfMessages = Convert.ToUInt32(m.Groups[1].Value),
uid = GetHighestUID();
switch (m.Groups[2].Value.ToUpper()) {
case "EXISTS":
if (lastUid != uid) {
newMessageEvent.Raise(this,
new IdleMessageEventArgs(numberOfMessages, uid, this));
}
break;
case "EXPUNGE":
messageDeleteEvent.Raise(
this, new IdleMessageEventArgs(numberOfMessages, uid, this));
break;
try {
uint numberOfMessages = Convert.ToUInt32(m.Groups[1].Value),
uid = GetHighestUID();
switch (m.Groups[2].Value.ToUpper()) {
case "EXISTS":
if (lastUid != uid) {
newMessageEvent.Raise(this,
new IdleMessageEventArgs(numberOfMessages, uid, this));
}
break;
case "EXPUNGE":
messageDeleteEvent.Raise(
this, new IdleMessageEventArgs(numberOfMessages, uid, this));
break;
}
lastUid = uid;
} catch {
// Fall through.
}
lastUid = uid;
}
}

Expand Down Expand Up @@ -2251,6 +2255,7 @@ protected virtual void Dispose(bool disposing) {
idleDispatch.Abort();
idleDispatch = null;
}
noopTimer.Stop();
stream.Close();
stream = null;
if (client != null)
Expand Down
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ receiving electronic mail from an Internet Message Access Protocol (IMAP) server
### Downloads

You can always get the latest package on [Nuget](http://nuget.org/packages/S22.Imap/) (includes
.NET 4.0 and 3.5 binaries) or download the binaries (targetting .NET 4.0) as a .zip archive from
.NET 4.0 and 3.5 binaries) or download the binaries (targeting .NET 4.0) as a .zip archive from
[here](http://smiley22.github.com/Downloads/S22.Imap.zip). The
[documentation](http://smiley22.github.com/S22.Imap/Documentation/) is also available for offline
viewing as HTML or CHM and can be downloaded from
Expand Down Expand Up @@ -47,7 +47,7 @@ further details on using the classes and methods exposed by the S22.Imap namespa
+ Inherently thread-safe
+ Well documented with lots of example code
+ Robust MIME parser, tested with 100.000+ mails
+ Supports various SASL authentication mechanisms
+ Supports various SASL authentication mechanisms (SCRAM-SHA-1, OAUTH2, NTLM among [others](https://github.com/smiley22/S22.Imap/blob/master/AuthMethod.cs))
+ Still supports .NET 3.5
+ Free to use in commercial and personal projects ([MIT license](https://github.com/smiley22/S22.Imap/blob/master/License.md))

Expand Down

0 comments on commit 9f1ffc0

Please sign in to comment.