Skip to content

Instantly share code, notes, and snippets.

@jstedfast
jstedfast / gist:a0a971cf191699fbd0d2
Created June 12, 2015 19:34
HtmlEntityDecoder.g.cs
// WARNING: This file is auto-generated. DO NOT EDIT!
namespace HtmlKit {
public partial class HtmlEntityDecoder {
bool PushNamedEntity (char c)
{
switch (c) {
case '1':
switch (state) {
case 436: state = 437; break; // &blk -> &blk1
using (var client = new ImapClient ()) {
var inbox = client.Inbox;
client.Connect(_currEmailAccountInfoAcct.Servername, 993, true, _emailCancellationTokenSource.Token);
inbox.Open(FolderAccess.ReadOnly); // this throws NullReferenceException
client.AuthenticationMechanisms.Remove("XOAUTH2");
client.Authenticate(_currEmailAccountInfoAcct.UserName, _currEmailAccountInfoAcct.Password);
@jstedfast
jstedfast / charsets.cs
Created February 27, 2015 13:55
Lists available charset encodings for .NET
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Charsets
{
class Program
{
It's been about a year in the making for MimeKit and nearly 8 months for MailKit,
but they've finally both reached 1.0 status.
I started really working on MimeKit about a year ago wanting to give the .NET
community a top-notch MIME parser that could handle anything the real world could
throw at it on any platform that can run .NET (including mobile platforms) and do
it with remarkable speed and grace. I wanted to make it such that re-serializing
the message would be a byte-for-byte copy of the original so that no data would
ever be lost. This was also very important for my last goal, which was to support
S/MIME and PGP.
@jstedfast
jstedfast / atomic.patch
Created August 29, 2014 22:40
Atomically read the first token of a line when in the IDLE state
diff --git a/MailKit/Net/Imap/ImapCommand.cs b/MailKit/Net/Imap/ImapCommand.cs
index 3d9f2b6..f6d9160 100644
--- a/MailKit/Net/Imap/ImapCommand.cs
+++ b/MailKit/Net/Imap/ImapCommand.cs
@@ -500,7 +500,7 @@ namespace MailKit.Net.Imap {
try {
Engine.Stream.ReadTimeout = -1;
- token = Engine.ReadToken (idle.LinkedToken);
+ token = Engine.AtomicReadToken (idle.LinkedToken);
Delivered-To: [email protected]
Received: by 10.224.135.8 with SMTP id l8csp316922qat;
Thu, 19 Jun 2014 03:12:05 -0700 (PDT)
X-Received: by 10.180.37.230 with SMTP id b6mr5037071wik.47.1403172724974;
Thu, 19 Jun 2014 03:12:04 -0700 (PDT)
Return-Path: <[email protected]>
Received: from DUB004-OMC2S17.hotmail.com (dub004-omc2s17.hotmail.com. [157.55.1.156])
by mx.google.com with ESMTPS id ck8si6631066wjc.8.2014.06.19.03.12.04
for <[email protected]>
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
using System;
using System.IO;
using System.Net;
using System.Linq;
using System.Text;
using System.Threading;
using System.Security.Cryptography;
using MailKit.Net.Imap;
using MailKit.Net.Pop3;
diff --git a/MailKit/Net/Imap/ImapFolder.cs b/MailKit/Net/Imap/ImapFolder.cs
index 3de9c2f..9667d2f 100644
--- a/MailKit/Net/Imap/ImapFolder.cs
+++ b/MailKit/Net/Imap/ImapFolder.cs
@@ -2009,7 +2009,8 @@ namespace MailKit.Net.Imap {
if (token.Type != ImapTokenType.OpenParen)
throw ImapEngine.UnexpectedToken (token, false);
- token = engine.ReadToken (ic.CancellationToken);
+ // Note: GMail's IMAP implementation is broken and does not quote strings with square brackets like it should
@jstedfast
jstedfast / limilabs.txt
Created April 24, 2014 17:49
Email exchange with LimiLabs
On Thu, Apr 24, 2014 at 1:09 PM, Pawel Lesnikowski <[email protected]
> wrote:
> In many places you claim that Mail.dll does not include proper parsing,
>
Where do I make this claim? It says only that MimeKit is faster, which is
true.
@jstedfast
jstedfast / startrek.msg
Created January 14, 2014 14:22
Star Trek email message used in performance testing MimeKit against other .NET MIME parser implementations.
Return-Path: <nsb>
Received: by greenbush.bellcore.com (4.1/4.7)
id <AA12840> for nsb; Thu, 19 Sep 91 12:41:43 EDT
Date: Thu, 19 Sep 91 12:41:43 EDT
From: nsb (Nathaniel Borenstein)
Message-Id: <[email protected]>
To: abel, bianchi, braun, cameron, carmen, jfp, jxr, kraut, lamb, lowery, lynn,
mlittman, nancyg, sau, shoshi, slr, stornett@flash, tkl
Cc: nsb, trina@flash
Subject: Star Trek Party!