示例#1
0
        // IMAP messages for a given label do not actually list that label in the label header.  Append it
        // so there's less confusion correlating across different mailboxes.
        private void FixUpLabels(MailMessage message)
        {
            // Convert the special inbox label to match the inbox mailbox name.
            string newLabelHeader = message.Headers[GConstants.LabelsHeader].RawValue.Replace(GConstants.InboxLabel, GConstants.Inbox);

            message.Headers[GConstants.LabelsHeader] = new HeaderValue(newLabelHeader);

            if (Client.SelectedMailbox.Equals(GConstants.AllMailMailbox, StringComparison.Ordinal) ||
                Client.SelectedMailbox.Equals(GConstants.StarredMailbox, StringComparison.Ordinal))
            {
                // These are special mailboxes that don't appear as labels.
                // TODO: Others?
            }
            else
            {
                message.AddLabel(Client.SelectedMailbox);
            }
        }
        // IMAP messages for a given label do not actually list that label in the label header.  Append it
        // so there's less confusion correlating across different mailboxes.
        private void FixUpLabels(MailMessage message)
        {
            // Convert the special inbox label to match the inbox mailbox name.
            string newLabelHeader = message.Headers[GConstants.LabelsHeader].RawValue.Replace(GConstants.InboxLabel, GConstants.Inbox);

            message.Headers[GConstants.LabelsHeader] = new HeaderValue(newLabelHeader);

            if (Client.SelectedMailbox.Equals(GConstants.AllMailMailbox, StringComparison.Ordinal)
                || Client.SelectedMailbox.Equals(GConstants.StarredMailbox, StringComparison.Ordinal))
            {
                // These are special mailboxes that don't appear as labels.
                // TODO: Others?
            }
            else
            {
                message.AddLabel(Client.SelectedMailbox);
            }
        }