Remove unused code and fix NNTPCore::getLine
message.func.inc.php | 17 ++++++++++++++++-
message.inc.php | 2 +-
mimepart.inc.php | 5 ++++-
nntpcore.inc.php | 18 +++---------------
4 files changed, 24 insertions(+), 18 deletions(-)
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@245
9869982d-c50d-0410-be91-
f2a2ec7c7c7b
if ($quote_level > 0) {
$length = Banana::$msgshow_wrap - $quote_level - 1;
return banana_quote(wordwrap($text, $length), $quote_level);
-
}
return wordwrap($text, Banana::$msgshow_wrap);
}
return preg_replace('/&&&urls&&&/e', 'array_shift($urls[0])', $text);
}
+/** Build a flowed text from plain text
+ */
+function banana_flow($text)
+{
+ $lines = explode("\n", $text);
+ $text = '';
+ while (!is_null($line = array_shift($lines))) {
+ if ($line != '-- ') {
+ $text .= rtrim(str_replace("\n", " \n", banana_wordwrap($line))) . "\n";
+ } else {
+ $text .= $line . "\n";
+ }
+ }
+ return $text;
+}
+
// {{{ URL Catcher tools
function banana__cutlink($link)
{
$msg = new BananaMessage();
$msg->msg_headers = $headers;
- $msg->makeTextPart($body, 'text/plain', '8bits', 'UTF-8', 'fixed');
+ $msg->makeTextPart($body, 'text/plain', '8bits', 'UTF-8', 'flowed');
if (!is_null($file)) {
$msg->addAttachment($file);
}
$headers['Content-Type'] = $this->content_type . ";"
. ($this->filename ? " name=\"{$this->filename}\";" : '')
. ($this->charset ? " charset=\"{$this->charset}\";" : '')
- . ($this->boundary ? " boundary=\"{$this->boundary}\";" : "");
+ . ($this->boundary ? " boundary=\"{$this->boundary}\";" : "")
+ . ($this->format ? " format={$this->format}" : "");
if ($this->encoding) {
$headers['Content-Transfer-Encoding'] = $this->encoding;
}
$content .= "\n--{$this->boundary}\n" . $part->get(true);
}
$content .= "\n--{$this->boundary}--";
+ } elseif ($this->isType('text', 'plain')) {
+ $content .= banana_flow($this->body);
} else {
$content .= banana_wordwrap($this->body);
}
*/
private function getLine()
{
- return rtrim(@fgets($this->ns, 1200));
+ return rtrim(@fgets($this->ns, 1200), "\r\n");
}
/** fetch data (and on delimitor)
* @param STRING $delim string indicating and of transmission
*/
- private function fetchResult($callback = null)
+ private function fetchResult()
{
$array = Array();
while (($result = $this->getLine()) != '.') {
- if (!is_null($callback)) {
- list($key, $result) = call_user_func($callback, $result);
- if (is_null($result)) {
- continue;
- }
- if (is_null($key)) {
- $array[] = $result;
- } else {
- $array[$key] = $result;
- }
- } else {
- $array[] = $result;
- }
+ $array[] = $result;
}
if ($this->debug && $this->bt) {
$this->bt[count($this->bt) - 1]['response'] = count($array);