patches for imp-4.1.3 (require horde-04b.diff) hiromi at tac.tsukuba.ac.jp --- imp/view.php.orig Tue Mar 21 10:01:01 2006 +++ imp/view.php Wed Oct 18 09:59:20 2006 @@ -27,6 +27,15 @@ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ +function cleanStr ($str){ + $sps = array( + ' ' => '_', + '?' => '_', + '\xE3\x80\x80' => '_', + ); + return strtr(mbereg_replace("[\000-\037]","",$str), $sps); +} + /* We can't register this session as 'readonly' if we are doing a * 'view_attach' since some MIME_Drivers may need to create temporary cache * files to correctly generate links. */ @@ -96,6 +105,9 @@ if (empty($zipfile)) { $zipfile = _("attachments.zip"); } else { + if($browser->isBrowser('msie')){ + $zipfile = mb_convert_encoding($headers->getValue('subject'),'SJIS-win','auto'); + } $zipfile .= '.zip'; } foreach ($contents->getDownloadAllList() as $val) { @@ -139,6 +151,10 @@ $name .= '.zip'; $type = 'application/zip'; } + $name = cleanStr($name); + if($browser->isBrowser('msie')){ + $name = mb_convert_encoding($name,'SJIS-win','auto'); + } $browser->downloadHeaders($name, $type, false, strlen($body)); echo $body; exit; @@ -161,17 +177,24 @@ $imp_headers = &new IMP_Headers($index); $name = 'saved_message'; - if (($subject = $imp_headers->getOb('subject', true))) { - $name = trim(preg_replace('/[^\w-+_\. ]/', '_', $subject), ' _'); + if (($subject = MIME::decode($imp_headers->getOb('subject')))) { + //$name = trim(preg_replace('/[^\w-+_\. ]/', '_', $subject), ' _'); + $name = $subject; } if (!($from = $imp_headers->getFromAddress())) { $from = '<>'; } - $date = strftime('%a %b %d %H:%M:%S %Y', $imp_headers->getOb('udate')); + //$date = strftime('%a %b %d %H:%M:%S %Y', $imp_headers->getOb('udate')); + $date = strftime('%Y/%m/%d %H:%M:%S', $imp_headers->getOb('udate')); $body = 'From ' . $from . ' ' . $date . "\n" . $contents->fullMessageText(); $body = str_replace("\r\n", "\n", $body); + if($browser->isBrowser('msie')){ + $name = mb_convert_encoding($name,'SJIS-win','auto'); + }else{ + $name = mb_convert_encoding($name,'UTF-8','auto'); + } $browser->downloadHeaders($name . '.eml', 'message/rfc822', false, strlen($body)); echo $body; exit; --- imp/compose.php.orig Thu Jul 20 13:18:56 2006 +++ imp/compose.php Wed Oct 11 12:01:27 2006 @@ -678,7 +678,7 @@ $header['to'] = MIME::addrArray2String($imp_headers->getOb('to')); $header['cc'] = MIME::addrArray2String($imp_headers->getOb('cc')); $header['bcc'] = MIME::addrArray2String($imp_headers->getOb('bcc')); - $header['subject'] = $imp_headers->getOb('subject', true); + $header['subject'] = MIME::decode($imp_headers->getOb('subject')); $title = _("Message Composition"); } @@ -760,7 +760,7 @@ $msg = Text_Filter::filter($msg, 'text2html', array('parselevel' => TEXT_HTML_MICRO_LINKURL, 'class' => null, 'callback' => null)); } - $header['subject'] = $imp_headers->getOb('subject', true); + $header['subject'] = MIME::decode($imp_headers->getOb('subject')); if (!empty($header['subject'])) { if (String::lower(String::substr($header['subject'], 0, 3)) != 're:') { $header['subject'] = 'Re: ' . $header['subject']; @@ -804,7 +804,7 @@ } $header['inreplyto'] = chop($message_id); - $header['subject'] = $imp_headers->getOb('subject', true); + $header['subject'] = MIME::decode($imp_headers->getOb('subject')); if (!empty($header['subject'])) { $title = _("Forward:") . ' ' . $header['subject']; /* If the subject line already has signals indicating this @@ -1005,20 +1005,20 @@ $browser_charset = NLS::getCharset(); - $msg_headers->addHeader('From', String::convertCharset($from, $browser_charset, $charset)); + $msg_headers->addHeader('From', $from); if (!empty($replyto) && ($replyto != $barefrom)) { - $msg_headers->addHeader('Reply-to', String::convertCharset($replyto, $browser_charset, $charset)); + $msg_headers->addHeader('Reply-to', $replyto); } if (!empty($f_to)) { - $msg_headers->addHeader('To', String::convertCharset($f_to, $browser_charset, $charset)); + $msg_headers->addHeader('To', $f_to); } elseif (empty($f_to) && empty($f_cc)) { - $msg_headers->addHeader('To', 'undisclosed-recipients:;'); + $msg_headers->addHeader('To', 'undisclosed-recipients:;'); } if (!empty($f_cc)) { - $msg_headers->addHeader('Cc', String::convertCharset($f_cc, $browser_charset, $charset)); + $msg_headers->addHeader('Cc', $f_cc); } - $msg_headers->addHeader('Subject', String::convertCharset(Util::getFormData('subject', ''), $browser_charset, $charset)); + $msg_headers->addHeader('Subject', Util::getFormData('subject', '')); /* Add necessary headers for replies. */ $reply_type = Util::getFormData('reply_type'); @@ -1106,7 +1106,9 @@ if ($oldPart !== false) { $replace_part = &new MIME_Part('text/plain'); $replace_part->setCharset($charset); - $replace_part->setContents('[' . _("Attachment stripped: Original attachment type") . ': "' . $oldPart->getType() . '", ' . _("name") . ': "' . $oldPart->getName(true, true) . '"]', '8bit'); + //$replace_part->setContents('[' . _("Attachment stripped: Original attachment type") . ': "' . $oldPart->getType() . '", ' . _("name") . ': "' . $oldPart->getName(true, true) . '"]', '8bit'); + $s = '[' . _("Attachment stripped: Original attachment type") . ': "' . $oldPart->getType() . '", ' . _("name") . ': "' . $oldPart->getName(true, true) . '"]'; + $replace_part->setContents(String::convertCharset($s,NLS::getCharset(),$charset)); $mime_message->alterPart($i + 1, $replace_part); } } @@ -1301,7 +1303,8 @@ $part = &new MIME_Part('message/rfc822'); $contents = &IMP_Contents::singleton($index . IMP_IDX_SEP . $mailbox); $digest_headers = &$contents->getHeaderOb(); - if (!($name = $digest_headers->getOb('subject', true))) { + $name = MIME::decode($digest_headers->getOb('subject')); + if (!$name) { $name = _("[No Subject]"); } $part->setName($name); --- imp/lib/Folder.php.orig Thu Aug 10 10:10:24 2006 +++ imp/lib/Folder.php Mon Nov 27 14:28:20 2006 @@ -157,9 +157,9 @@ $item = implode($maildelim[$mbox_name], array_slice($parts, 0, $i)); if (!isset($list[$item])) { $abbrev = $folded = str_repeat(' ', 4 * ($i - 1)) . String::convertCharset($parts[($i - 1)], 'UTF7-IMAP'); - if (strlen($abbrev) > 26) { - $abbrev = String::substr($abbrev, 0, 10) . '...' . String::substr($abbrev, -13, 13); - } + //if (strlen($abbrev) > 26) { + // $abbrev = String::substr($abbrev, 0, 10) . '...' . String::substr($abbrev, -13, 13); + //} $list[$item] = array('val' => ($i == $partcount) ? $mbox_name : '', 'label' => $folded, 'abbrev' => $abbrev); } } --- imp/lib/MIME/Viewer/html.php.orig Fri Mar 24 08:56:37 2006 +++ imp/lib/MIME/Viewer/html.php Fri Aug 18 09:08:55 2006 @@ -108,7 +108,14 @@ if (stristr($data, '
)(.*)/is', '$1' . $msg . '$2', $data); + if(strtolower($charset) == 'iso-2022-jp'){ + // $msg also include $n(n=0-9) stings + $d1 = preg_replace('/(.*