C# Class MailKit.Net.Imap.ImapUtils

IMAP utility functions.
Show file Open project: jstedfast/MailKit Class Usage Examples

Public Methods

Method Description
CanonicalizeMailboxName ( string mailboxName, char directorySeparator ) : string

Canonicalize the name of the mailbox.

Canonicalizes the name of the mailbox by replacing various capitalizations of "INBOX" with the literal "INBOX" string.

FormatFlagsList ( MessageFlags flags, int numUserFlags ) : string

Formats a flags list suitable for use with the APPEND command.

FormatIndexSet ( IList indexes ) : string

Formats the array of indexes as a string suitable for use with IMAP commands.

FormatInternalDate ( DateTimeOffset date ) : string

Formats a date in a format suitable for use with the APPEND command.

FormatUidSet ( IList uids ) : string

Formats the array of UIDs as a string suitable for use with IMAP commands.

IsInbox ( string mailboxName ) : bool

Determines whether the specified mailbox is the Inbox.

ParseBody ( MailKit.Net.Imap.ImapEngine engine, string format, string path, CancellationToken cancellationToken ) : BodyPart
ParseEnvelope ( MailKit.Net.Imap.ImapEngine engine, CancellationToken cancellationToken ) : Envelope

Parses the ENVELOPE parenthesized list.

ParseFlagsList ( ImapEngine engine, string name, HashSet userFlags, CancellationToken cancellationToken ) : MessageFlags

Parses the flags list.

ParseFolderList ( ImapEngine engine, ImapCommand ic, int index ) : void

Parses an untagged LIST or LSUB response.

ParseImplementation ( ImapEngine engine, ImapCommand ic, int index ) : void

Parses an untagged ID response.

ParseInternalDate ( string text ) : DateTimeOffset

Parses the internal date string.

ParseLabelsList ( ImapEngine engine, CancellationToken cancellationToken ) : ReadOnlyCollection

Parses the X-GM-LABELS list.

ParseMetadata ( ImapEngine engine, ImapCommand ic, int index ) : void

Parses an untagged METADATA response.

ParseThreads ( ImapEngine engine, uint uidValidity, CancellationToken cancellationToken ) : IList

Parses the threads.

Private Methods

Method Description
InvalidInternalDateFormat ( string text ) : Exception
NeedsQuoting ( string value ) : bool
ParseContentDisposition ( MailKit.Net.Imap.ImapEngine engine, string format, CancellationToken cancellationToken ) : MimeKit.ContentDisposition
ParseContentLanguage ( MailKit.Net.Imap.ImapEngine engine, string format, CancellationToken cancellationToken ) : string[]
ParseContentLocation ( MailKit.Net.Imap.ImapEngine engine, string format, CancellationToken cancellationToken ) : Uri
ParseContentType ( MailKit.Net.Imap.ImapEngine engine, string format, CancellationToken cancellationToken, MimeKit.ContentType &contentType, string &value ) : bool
ParseEnvelopeAddress ( ImapEngine engine, string format, CancellationToken cancellationToken ) : EnvelopeAddress
ParseEnvelopeAddressList ( InternetAddressList list, ImapEngine engine, string format, CancellationToken cancellationToken ) : void
ParseEnvelopeDate ( ImapEngine engine, string format, CancellationToken cancellationToken ) : DateTimeOffset?
ParseMultipart ( ImapEngine engine, string format, string path, string subtype, CancellationToken cancellationToken ) : BodyPart
ParseParameterList ( StringBuilder builder, ImapEngine engine, string format, CancellationToken cancellationToken ) : void
ParseThread ( ImapEngine engine, uint uidValidity, CancellationToken cancellationToken ) : MessageThread
ReadNStringToken ( ImapEngine engine, string format, bool rfc2047, CancellationToken cancellationToken ) : string
ReadNumber ( ImapEngine engine, string format, CancellationToken cancellationToken ) : uint
ReadStringToken ( ImapEngine engine, string format, CancellationToken cancellationToken ) : string
SkipBodyExtensions ( ImapEngine engine, string format, CancellationToken cancellationToken ) : void
TryGetInt32 ( string text, int &index, char delim, int &value ) : bool
TryGetInt32 ( string text, int &index, int &value ) : bool
TryGetMonth ( string text, int &index, char delim, int &month ) : bool
TryGetTimeZone ( string text, int &index, TimeSpan &timezone ) : bool

Method Details

CanonicalizeMailboxName() public static method

Canonicalize the name of the mailbox.
Canonicalizes the name of the mailbox by replacing various capitalizations of "INBOX" with the literal "INBOX" string.
public static CanonicalizeMailboxName ( string mailboxName, char directorySeparator ) : string
mailboxName string The encoded mailbox name.
directorySeparator char The directory separator.
return string

FormatFlagsList() public static method

Formats a flags list suitable for use with the APPEND command.
public static FormatFlagsList ( MessageFlags flags, int numUserFlags ) : string
flags MessageFlags The message flags.
numUserFlags int The number of user-defined flags.
return string

FormatIndexSet() public static method

Formats the array of indexes as a string suitable for use with IMAP commands.
/// is null. /// /// One or more of the indexes has a negative value. ///
public static FormatIndexSet ( IList indexes ) : string
indexes IList The indexes.
return string

FormatInternalDate() public static method

Formats a date in a format suitable for use with the APPEND command.
public static FormatInternalDate ( DateTimeOffset date ) : string
date DateTimeOffset The date.
return string

FormatUidSet() public static method

Formats the array of UIDs as a string suitable for use with IMAP commands.
/// is null. /// /// One or more of the UIDs is invalid. ///
public static FormatUidSet ( IList uids ) : string
uids IList The UIDs.
return string

IsInbox() public static method

Determines whether the specified mailbox is the Inbox.
public static IsInbox ( string mailboxName ) : bool
mailboxName string The mailbox name.
return bool

ParseBody() public static method

public static ParseBody ( MailKit.Net.Imap.ImapEngine engine, string format, string path, CancellationToken cancellationToken ) : BodyPart
engine MailKit.Net.Imap.ImapEngine
format string
path string
cancellationToken System.Threading.CancellationToken
return BodyPart

ParseEnvelope() public static method

Parses the ENVELOPE parenthesized list.
public static ParseEnvelope ( MailKit.Net.Imap.ImapEngine engine, CancellationToken cancellationToken ) : Envelope
engine MailKit.Net.Imap.ImapEngine The IMAP engine.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Envelope

ParseFlagsList() public static method

Parses the flags list.
public static ParseFlagsList ( ImapEngine engine, string name, HashSet userFlags, CancellationToken cancellationToken ) : MessageFlags
engine ImapEngine The IMAP engine.
name string The name of the flags being parsed.
userFlags HashSet A hash set of user-defined message flags that will be populated if non-null.
cancellationToken CancellationToken The cancellation token.
return MessageFlags

ParseFolderList() public static method

Parses an untagged LIST or LSUB response.
public static ParseFolderList ( ImapEngine engine, ImapCommand ic, int index ) : void
engine ImapEngine The IMAP engine.
ic ImapCommand The IMAP command.
index int The index.
return void

ParseImplementation() public static method

Parses an untagged ID response.
public static ParseImplementation ( ImapEngine engine, ImapCommand ic, int index ) : void
engine ImapEngine The IMAP engine.
ic ImapCommand The IMAP command.
index int The index.
return void

ParseInternalDate() public static method

Parses the internal date string.
public static ParseInternalDate ( string text ) : DateTimeOffset
text string The text to parse.
return DateTimeOffset

ParseLabelsList() public static method

Parses the X-GM-LABELS list.
public static ParseLabelsList ( ImapEngine engine, CancellationToken cancellationToken ) : ReadOnlyCollection
engine ImapEngine The IMAP engine.
cancellationToken CancellationToken The cancellation token.
return ReadOnlyCollection

ParseMetadata() public static method

Parses an untagged METADATA response.
public static ParseMetadata ( ImapEngine engine, ImapCommand ic, int index ) : void
engine ImapEngine The IMAP engine.
ic ImapCommand The IMAP command.
index int The index.
return void

ParseThreads() public static method

Parses the threads.
public static ParseThreads ( ImapEngine engine, uint uidValidity, CancellationToken cancellationToken ) : IList
engine ImapEngine The IMAP engine.
uidValidity uint The UIDVALIDITY of the folder.
cancellationToken CancellationToken The cancellation token.
return IList