From 3d0d5dbd0f35c47b21e2e574703a08f07ce677dd Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 08 May 2016 08:27:56 -0400
Subject: [PATCH] Performance improvements in format_flowed() and unfold_flowed()

---
 bin/msgexport.sh |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/bin/msgexport.sh b/bin/msgexport.sh
index e6c1801..f76aefe 100755
--- a/bin/msgexport.sh
+++ b/bin/msgexport.sh
@@ -1,7 +1,7 @@
 #!/usr/bin/env php
 <?php
 
-define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
+define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
 ini_set('memory_limit', -1);
 
 require_once INSTALL_PATH.'program/include/clisetup.php';
@@ -58,7 +58,7 @@
 		$from = current(rcube_mime::decode_address_list($headers->from, 1, false));
 
 		fwrite($out, sprintf("From %s %s UID %d\n", $from['mailto'], $headers->date, $headers->uid));
-		fwrite($out, $IMAP->print_raw_body($headers->uid));
+		$IMAP->get_raw_body($headers->uid, $out);
 		fwrite($out, "\n\n\n");
 
 		progress_update($i+1, $count);
@@ -71,7 +71,8 @@
 
 
 // get arguments
-$args = get_opt(array('h' => 'host', 'u' => 'user', 'p' => 'pass', 'm' => 'mbox', 'f' => 'file')) + array('host' => 'localhost', 'mbox' => 'INBOX');
+$opts = array('h' => 'host', 'u' => 'user', 'p' => 'pass', 'm' => 'mbox', 'f' => 'file');
+$args = rcube_utils::get_opt($opts) + array('host' => 'localhost', 'mbox' => 'INBOX');
 
 if ($_SERVER['argv'][1] == 'help')
 {
@@ -93,7 +94,7 @@
 }
 
 // prompt for password
-$args['pass'] = prompt_silent("Password: ");
+$args['pass'] = rcube_utils::prompt_silent("Password: ");
 
 
 // parse $host URL

--
Gitblit v1.9.1