<commit_before>﻿using System;
using SmtpPilot.Server.Conversation;
using SmtpPilot.Server.Internal;

namespace SmtpPilot.Server.States
{
    public class DataConversationState : IConversationState
    {
        private bool _headersAreOver;

        public SmtpCommand AllowedCommands
        {
            get
            {
                return SmtpCommand.NonCommand;
            }
        }

        public void EnterState(ISmtpStateContext context)
        {
            context.Reply(SmtpReply.BeginData);
            context.Conversation.AddElement(new SmtpData());
            _headersAreOver = false;
        }

        public void LeaveState(ISmtpStateContext context)
        {
            context.Reply(new SmtpReply(SmtpReplyCode.Code250, "Awesome"));
        }

        public IConversationState ProcessData(ISmtpStateContext context, string line)
        {
            if (line.Equals(Constants.CarriageReturnLineFeed))
                return this;

            string choppedLine = line.Replace(Environment.NewLine, String.Empty);

            if (!_headersAreOver)
            {
                if (IO.IOHelper.LooksLikeHeader(line))
                {
                    string[] header = choppedLine.Split(new char[] { ':' }, 2);
                    context.AddHeader(new SmtpHeader(header[0], header[1]));
                }
                else
                {
                    _headersAreOver = true;
                }
            }
            else if (line.Equals(Constants.EndOfDataElement))
            {
                context.CompleteMessage();
                return new AcceptMailConversationState();
            }
<commit_msg>Changing an OK reply to use the static helper.<commit_after>﻿using System;
using SmtpPilot.Server.Conversation;
using SmtpPilot.Server.Internal;

namespace SmtpPilot.Server.States
{
    public class DataConversationState : IConversationState
    {
        private bool _headersAreOver;

        public SmtpCommand AllowedCommands
        {
            get
            {
                return SmtpCommand.NonCommand;
            }
        }

        public void EnterState(ISmtpStateContext context)
        {
            context.Reply(SmtpReply.BeginData);
            context.Conversation.AddElement(new SmtpData());
            _headersAreOver = false;
        }

        public void LeaveState(ISmtpStateContext context)
        {
            context.Reply(SmtpReply.OK);
        }

        public IConversationState ProcessData(ISmtpStateContext context, string line)
        {
            if (line.Equals(Constants.CarriageReturnLineFeed))
                return this;

            string choppedLine = line.Replace(Environment.NewLine, String.Empty);

            if (!_headersAreOver)
            {
                if (IO.IOHelper.LooksLikeHeader(line))
                {
                    string[] header = choppedLine.Split(new char[] { ':' }, 2);
                    context.AddHeader(new SmtpHeader(header[0], header[1]));
                }
                else
                {
                    _headersAreOver = true;
                }
            }
            else if (line.Equals(Constants.EndOfDataElement))
            {
                context.CompleteMessage();
                return new AcceptMailConversationState();
            }

{'fraction_non_alphanumeric': 0.07821901323706378, 'fraction_numerical': 0.002707581227436823, 'mean_word_length': 1.59765625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5212198', 'n_tokens_mistral': 877, 'n_tokens_neox': 812, 'n_words': 152}