[dev] maybe commit?

Anton Nekhoroshih anton@valuehost.ru
Tue, 6 Aug 2002 23:14:04 +0400


Hello, dev.

Small fix which allows to send messages in the necessary coding for
Russian people.
maybe commit?

===========================================================
--- imp/compose.php.orig    Tue Aug  6 21:25:01 2002
+++ imp/compose.php Tue Jul 30 02:54:48 2002
@@ -602,8 +611,19 @@
             }
         }
 
+        /* Convert koi8-r <-> windows-1251 */
+        if($prefs->getValue('compose_enc')=='windows-1251') {
+         if (stristr(NLS::getCharset(), 'koi8-r')) {
+             $message = convert_cyr_string($message, 'k', 'w');
+         }
+       }
+        if($prefs->getValue('compose_enc')=='koi8-r') {
+         if (stristr(NLS::getCharset(), 'windows-1251')) {
+             $message = convert_cyr_string($message, 'w', 'k');
+         }
+       }
         /* Set up the body part now. */
-        $textBody = new MIME_Part('text/plain');
+        $textBody = new MIME_Part('text/plain',null,$prefs->getValue('compose_enc'));
         $textBody->setContents($textBody->replaceEOL($message));
         if (isset($trailer)) {
             $textBody->appendContents($trailer);
@@ -612,7 +632,7 @@
         /* Determine whether or not to send a multipart/alternative
            message with an HTML part. */
         if (Horde::getFormData('messageHTML')) {
-            $htmlBody = new MIME_Part('text/html', Text::wrap(Horde::getFormData('messageHTML')), null,
'inline');
+            $htmlBody = new MIME_Part('text/html', Text::wrap(Horde::getFormData('messageHTML')),
$prefs->getValue('compose_enc'), 'inline');
             if (isset($trailer)) {
                 $htmlBody->appendContents($trailer);
             }
@@ -899,15 +919,15 @@
             $headers->addHeader('From', $from);
         }
         if (($to = Horde::getFormData('to'))) {
-            $to = MIME::encodeAddress(_formatAddresses($to), null, $imp['maildomain']);
+            $to = MIME::encodeAddress(_formatAddresses($to), $prefs->getValue('compose_enc'),
$imp['maildomain']);
             $headers->addHeader('To', $to);
         }
         if (($cc = Horde::getFormData('cc'))) {
-            $cc = MIME::encodeAddress(_formatAddresses($cc), null, $imp['maildomain']);
+            $cc = MIME::encodeAddress(_formatAddresses($cc), $prefs->getValue('compose_enc'),
$imp['maildomain']);
             $headers->addHeader('Cc', $cc);
         }
         if (($bcc = Horde::getFormData('bcc'))) {
-            $bcc = MIME::encodeAddress(_formatAddresses($bcc), null, $imp['maildomain']);
+            $bcc = MIME::encodeAddress(_formatAddresses($bcc), $prefs->getValue('compose_enc'),
$imp['maildomain']);
             $headers->addHeader('Bcc', $bcc);
         }
         if (($sub = Horde::getFormData('subject'))) {
===========================================================

-- 
Anton Nekhoroshih

Web Hosting,
Russia, St.Peterburg, Karavannaya, 1
Phone: +7 (812) 320-87-85; +7 (095) 737-09-73
Fax: +7 (812) 325-88-97; +7 (095) 737-09-73
Url: http://www.valuehost.ru