void OnFieldsChanged(object sender, HeaderListChangedEventArgs e) { var stream = new MemoryBlockStream(); var options = FormatOptions.Default; fields.WriteTo(options, stream); stream.Position = 0; ContentObject = new ContentObject(stream); }
void OnFieldsChanged (object sender, HeaderListChangedEventArgs e) { var options = FormatOptions.GetDefault (); var stream = new MemoryBlockStream (); fields.WriteTo (options, stream); stream.Write (options.NewLineBytes, 0, options.NewLineBytes.Length); stream.Position = 0; ContentObject = new ContentObject (stream); }
void OnFieldsChanged(object sender, HeaderListChangedEventArgs e) { var options = FormatOptions.GetDefault(); var stream = new MemoryBlockStream(); fields.WriteTo(options, stream); stream.Write(options.NewLineBytes, 0, options.NewLineBytes.Length); stream.Position = 0; ContentObject = new ContentObject(stream); }
void HeadersChanged (object o, HeaderListChangedEventArgs e) { InternetAddressList list; InternetAddress address; byte[] rawValue; int index = 0; switch (e.Action) { case HeaderListChangedAction.Added: if (addresses.TryGetValue (e.Header.Field, out list)) { AddAddresses (e.Header, list); break; } rawValue = e.Header.RawValue; switch (e.Header.Id) { case HeaderId.MimeVersion: MimeUtils.TryParse (rawValue, 0, rawValue.Length, out version); break; case HeaderId.References: references.Changed -= ReferencesChanged; foreach (var msgid in MimeUtils.EnumerateReferences (rawValue, 0, rawValue.Length)) references.Add (msgid); references.Changed += ReferencesChanged; break; case HeaderId.InReplyTo: inreplyto = MimeUtils.EnumerateReferences (rawValue, 0, rawValue.Length).FirstOrDefault (); break; case HeaderId.ResentMessageId: resentMessageId = MimeUtils.EnumerateReferences (rawValue, 0, rawValue.Length).FirstOrDefault (); break; case HeaderId.MessageId: messageId = MimeUtils.EnumerateReferences (rawValue, 0, rawValue.Length).FirstOrDefault (); break; case HeaderId.ResentSender: if (InternetAddress.TryParse (Headers.Options, rawValue, ref index, rawValue.Length, false, out address)) resentSender = address as MailboxAddress; break; case HeaderId.Sender: if (InternetAddress.TryParse (Headers.Options, rawValue, ref index, rawValue.Length, false, out address)) sender = address as MailboxAddress; break; case HeaderId.ResentDate: DateUtils.TryParse (rawValue, 0, rawValue.Length, out resentDate); break; case HeaderId.Importance: switch (e.Header.Value.ToLowerInvariant ().Trim ()) { case "high": importance = MessageImportance.High; break; case "low": importance = MessageImportance.Low; break; default: importance = MessageImportance.Normal; break; } break; case HeaderId.Priority: switch (e.Header.Value.ToLowerInvariant ().Trim ()) { case "non-urgent": priority = MessagePriority.NonUrgent; break; case "urgent": priority = MessagePriority.Urgent; break; default: priority = MessagePriority.Normal; break; } break; case HeaderId.Date: DateUtils.TryParse (rawValue, 0, rawValue.Length, out date); break; } break; case HeaderListChangedAction.Changed: case HeaderListChangedAction.Removed: if (addresses.TryGetValue (e.Header.Field, out list)) { ReloadAddressList (e.Header.Id, list); break; } ReloadHeader (e.Header.Id); break; case HeaderListChangedAction.Cleared: foreach (var kvp in addresses) { kvp.Value.Changed -= InternetAddressListChanged; kvp.Value.Clear (); kvp.Value.Changed += InternetAddressListChanged; } references.Changed -= ReferencesChanged; references.Clear (); references.Changed += ReferencesChanged; importance = MessageImportance.Normal; priority = MessagePriority.Normal; resentMessageId = null; resentSender = null; inreplyto = null; messageId = null; version = null; sender = null; break; default: throw new ArgumentOutOfRangeException (); } }
void HeadersChanged(object sender, HeaderListChangedEventArgs e) { OnHeadersChanged(e.Action, e.Header); }
void HeadersChanged (object sender, HeaderListChangedEventArgs e) { OnHeadersChanged (e.Action, e.Header); }
void OnGroupChanged(object sender, HeaderListChangedEventArgs e) { OnChanged(); }
void OnFieldsChanged (object sender, HeaderListChangedEventArgs e) { var stream = new MemoryBlockStream (); var options = FormatOptions.Default; fields.WriteTo (options, stream); stream.Position = 0; ContentObject = new ContentObject (stream); }
void HeadersChanged(object sender, HeaderListChangedEventArgs e) { InternetAddressList list; switch (e.Action) { case HeaderListChangedAction.Added: if (addresses.TryGetValue (e.Header.Field, out list)) { AddAddresses (e.Header, list); break; } switch (e.Header.Id) { case HeaderId.MimeVersion: MimeUtils.TryParseVersion (e.Header.RawValue, 0, e.Header.RawValue.Length, out version); break; case HeaderId.References: references.Changed -= ReferencesChanged; foreach (var msgid in MimeUtils.EnumerateReferences (e.Header.RawValue, 0, e.Header.RawValue.Length)) references.Add (msgid); references.Changed += ReferencesChanged; break; case HeaderId.InReplyTo: inreplyto = MimeUtils.EnumerateReferences (e.Header.RawValue, 0, e.Header.RawValue.Length).FirstOrDefault (); break; case HeaderId.MessageId: messageId = MimeUtils.EnumerateReferences (e.Header.RawValue, 0, e.Header.RawValue.Length).FirstOrDefault (); break; case HeaderId.Date: DateUtils.TryParseDateTime (e.Header.RawValue, 0, e.Header.RawValue.Length, out date); break; } break; case HeaderListChangedAction.Changed: case HeaderListChangedAction.Removed: if (addresses.TryGetValue (e.Header.Field, out list)) { ReloadAddressList (e.Header.Field, list); break; } ReloadHeader (e.Header.Id, e.Header.Field); break; case HeaderListChangedAction.Cleared: foreach (var kvp in addresses) { kvp.Value.Changed -= InternetAddressListChanged; kvp.Value.Clear (); kvp.Value.Changed += InternetAddressListChanged; } references.Changed -= ReferencesChanged; references.Clear (); references.Changed += ReferencesChanged; inreplyto = null; messageId = null; version = null; break; default: throw new ArgumentOutOfRangeException (); } }
void HeadersChanged(object sender, HeaderListChangedEventArgs e) { InternetAddressList list; switch (e.Action) { case HeaderListChangedAction.Added: if (addresses.TryGetValue(e.Header.Field, out list)) { AddAddresses(e.Header, list); break; } switch (e.Header.Id) { case HeaderId.MimeVersion: MimeUtils.TryParseVersion(e.Header.RawValue, 0, e.Header.RawValue.Length, out version); break; case HeaderId.References: references.Changed -= ReferencesChanged; foreach (var msgid in MimeUtils.EnumerateReferences(e.Header.RawValue, 0, e.Header.RawValue.Length)) { references.Add(msgid); } references.Changed += ReferencesChanged; break; case HeaderId.InReplyTo: inreplyto = MimeUtils.EnumerateReferences(e.Header.RawValue, 0, e.Header.RawValue.Length).FirstOrDefault(); break; case HeaderId.MessageId: messageId = MimeUtils.EnumerateReferences(e.Header.RawValue, 0, e.Header.RawValue.Length).FirstOrDefault(); break; case HeaderId.Date: DateUtils.TryParseDateTime(e.Header.RawValue, 0, e.Header.RawValue.Length, out date); break; } break; case HeaderListChangedAction.Changed: case HeaderListChangedAction.Removed: if (addresses.TryGetValue(e.Header.Field, out list)) { ReloadAddressList(e.Header.Field, list); break; } ReloadHeader(e.Header.Id, e.Header.Field); break; case HeaderListChangedAction.Cleared: foreach (var kvp in addresses) { kvp.Value.Changed -= InternetAddressListChanged; kvp.Value.Clear(); kvp.Value.Changed += InternetAddressListChanged; } references.Changed -= ReferencesChanged; references.Clear(); references.Changed += ReferencesChanged; inreplyto = null; messageId = null; version = null; break; default: throw new ArgumentOutOfRangeException(); } }