From ead084693499934c467ca6a9c396367ac661dd61 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 15 Apr 2016 06:28:05 -0400
Subject: [PATCH] Plugin API: Add html2text hook (backport from master)

---
 program/steps/utils/html2text.inc |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/program/steps/utils/html2text.inc b/program/steps/utils/html2text.inc
index a33c5f5..1115b3e 100644
--- a/program/steps/utils/html2text.inc
+++ b/program/steps/utils/html2text.inc
@@ -29,12 +29,11 @@
 // Replace emoticon images with its text representation
 $html = $RCMAIL->replace_emoticons($html);
 
-$do_links = (bool) rcube_utils::get_input_value('_do_links', rcube_utils::INPUT_GET);
-$width    = (int) rcube_utils::get_input_value('_width', rcube_utils::INPUT_GET);
+$params['links'] = (bool) rcube_utils::get_input_value('_do_links', rcube_utils::INPUT_GET);
+$params['width'] = (int) rcube_utils::get_input_value('_width', rcube_utils::INPUT_GET);
 
-// Convert to text
-$converter = new rcube_html2text($html, false, $do_links, $width);
+$text = $RCMAIL->html2text($html, $params);
 
-header('Content-Type: text/plain; charset=UTF-8');
-print rtrim($converter->get_text());
+header('Content-Type: text/plain; charset=' . RCUBE_CHARSET);
+print $text;
 exit;

--
Gitblit v1.9.1