예제 #1
0
 public void DecodeMessageLines( )
 {
     if (AcCommon.StringValue(Properties.ContentTransferEncoding)
         == "quoted-printable")
     {
         mRawMessageLines = mMessageLines;
         mMessageLines    = QuotedPrintable.DecodeLines(mRawMessageLines);
     }
 }
예제 #2
0
        public MimeMessagePart AddNewPart(
            string InStream, MimeMessagePart.PartInProgress InPip)
        {
            MimeMessagePart part = null;

            if (InPip.PartCode == MimePartCode.Top)
            {
                part = new MimeTopPart( );
            }
            else
            {
                part = new MimeMessagePart( );
            }

            part.PartCode = InPip.PartCode;
            base.Add(part);

            // store the property lines of the part.
            if (InPip.PropBx != -1)
            {
                part.LoadPropertyLines(InStream, InPip.PropBx, InPip.PropLineCx);
            }

            // store the message lines of the part.
            if (InPip.MessageBx != -1)
            {
                part.LoadMessageLines(InStream, InPip.MessageBx, InPip.MessageLineCx);
            }

            // the message lines are quoted-printable encoded. decode here.
            if (AcCommon.StringValue(part.Properties.ContentTransferEncoding)
                == "quoted-printable")
            {
                part.DecodeMessageLines( );
            }

            return(part);
        }
예제 #3
0
        // ------------------------------- LoadLines -------------------------------
        /// <summary>
        /// load the lines of the part from an array of all the lines of the message.
        /// </summary>
        /// <param name="InLines"></param>
        /// <param name="InLineBx"></param>
        /// <param name="InLineCx"></param>
        /// <returns>reference to this object</returns>
        public MimeMessagePart LoadLines(string[] InLines, int InLineBx, int InLineCx)
        {
            int    lineBx = InLineBx;
            int    lineCx = InLineCx;
            string line   = null;

            // first thing.  if this is the top part, check for and trim off the initial
            // "+OK" response line from the server. ( server sends this line, followed immed
            // by the message data.  this is the first opportunity to strip it out. )
            if ((PartCode == MimePartCode.Top) &&
                (lineCx > 0) &&
                (InLines[0].Length >= 3) &&
                (InLines[0].Substring(0, 3) == "+OK"))
            {
                ++lineBx;
                --lineCx;
            }

            // calc the number of property lines, then calc the number of message lines.
            int propLineCx = CountPropertyLines(InLines, lineBx, lineCx);
            int msgLineCx  = lineCx - propLineCx;
            int msgLineBx  = lineBx + propLineCx;

            // store the part property lines.
            mPropertyLines = new string[propLineCx];
            for (int Ix = 0; Ix < propLineCx; ++Ix)
            {
                mPropertyLines[Ix] = InLines[Ix + lineBx];
            }

            // load the property dictionary from the property lines.
            LoadPropertyDictionary( );

            // reduce the message line bounds by one in case the first line is blank.
            if (msgLineCx > 0)
            {
                line = InLines[msgLineBx];
                if (line == "")
                {
                    msgLineCx -= 1;
                    msgLineBx += 1;
                }
            }

            // store the message lines of the part.
            mMessageLines = new string[msgLineCx];
            for (int Ix = 0; Ix < msgLineCx; ++Ix)
            {
                mMessageLines[Ix] = InLines[Ix + msgLineBx];
            }

            // the message lines are either quoted-printable or base64 encoded.
            // Decode the message lines.
            if (AcCommon.StringValue(Properties.ContentTransferEncoding)
                == "quoted-printable")
            {
                mRawMessageLines = mMessageLines;
                mMessageLines    = QuotedPrintable.DecodeLines(mRawMessageLines);
            }

            return(this);
        }