From 232aa1924c8c0f10d87b210b46c9f061af5c844c Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 17 Oct 2010 13:29:57 +0000 Subject: added files --- .../Swift/Mime/ContentEncoder/QpContentEncoder.php | 117 +++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 h-source/External/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php (limited to 'h-source/External/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php') diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php b/h-source/External/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php new file mode 100644 index 0000000..3beeb63 --- /dev/null +++ b/h-source/External/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php @@ -0,0 +1,117 @@ + 76 || $maxLineLength <= 0) + { + $maxLineLength = 76; + } + + $thisLineLength = $maxLineLength - $firstLineOffset; + + $this->_charStream->flushContents(); + $this->_charStream->importByteStream($os); + + $currentLine = ''; + $prepend = ''; + $size=$lineLen=0; + + while (false !== $bytes = $this->_nextSequence()) + { + //If we're filtering the input + if (isset($this->_filter)) + { + //If we can't filter because we need more bytes + while ($this->_filter->shouldBuffer($bytes)) + { + //Then collect bytes into the buffer + if (false === $moreBytes = $this->_nextSequence(1)) + { + break; + } + + foreach ($moreBytes as $b) + { + $bytes[] = $b; + } + } + //And filter them + $bytes = $this->_filter->filter($bytes); + } + + $enc = $this->_encodeByteSequence($bytes, $size); + if ($currentLine && $lineLen+$size >= $thisLineLength) + { + $is->write($prepend . $this->_standardize($currentLine)); + $currentLine = ''; + $prepend = "=\r\n"; + $thisLineLength = $maxLineLength; + $lineLen=0; + } + $lineLen+=$size; + $currentLine .= $enc; + } + if (strlen($currentLine)) + { + $is->write($prepend . $this->_standardize($currentLine)); + } + } + + /** + * Get the name of this encoding scheme. + * Returns the string 'quoted-printable'. + * @return string + */ + public function getName() + { + return 'quoted-printable'; + } + +} -- cgit v1.2.3