diff options
author | thomascube <thomas@roundcube.net> | 2012-01-16 15:14:41 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2012-01-16 15:14:41 +0000 |
commit | c321a955a7b0f6d6b13ffaebf040a6c7091037ae (patch) | |
tree | 60c257d29a726d9bdda7fb75a198342aaef315fa /bin | |
parent | 8764b6ecf0c8d1b0646915a8139cdf6bbac2ca14 (diff) |
Merged devel-framework branch (r5746:5779) back into trunk
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/msgexport.sh | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/bin/msgexport.sh b/bin/msgexport.sh index 5f9061971..c876f5f10 100755 --- a/bin/msgexport.sh +++ b/bin/msgexport.sh @@ -31,10 +31,14 @@ function export_mailbox($mbox, $filename) { global $IMAP; - $IMAP->set_mailbox($mbox); + $IMAP->set_folder($mbox); + + $index = $IMAP->index($mbox, null, 'ASC'); + $count = $index->countMessages(); + $index = $index->get(); vputs("Getting message list of {$mbox}..."); - vputs($IMAP->messagecount()." messages\n"); + vputs("$count messages\n"); if ($filename) { @@ -48,17 +52,16 @@ function export_mailbox($mbox, $filename) else $out = STDOUT; - for ($count = $IMAP->messagecount(), $i=1; $i <= $count; $i++) + for ($i = 0; $i < $count; $i++) { - $headers = $IMAP->get_headers($i, null, false); + $headers = $IMAP->get_message_headers($index[$i]); $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->conn->fetchPartHeader($mbox, $i)); - fwrite($out, $IMAP->conn->handlePartBody($mbox, $i)); + fwrite($out, $IMAP->print_raw_body($headers->uid)); fwrite($out, "\n\n\n"); - progress_update($i, $count); + progress_update($i+1, $count); } vputs("\ncomplete.\n"); @@ -116,7 +119,7 @@ if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl)) vputs("IMAP login successful.\n"); $filename = null; - $mailboxes = $args['mbox'] == '*' ? $IMAP->list_mailboxes(null) : array($args['mbox']); + $mailboxes = $args['mbox'] == '*' ? $IMAP->list_folders(null) : array($args['mbox']); foreach ($mailboxes as $mbox) { |