]> git.donarmstrong.com Git - roundcube.git/blobdiff - program/steps/mail/viewsource.inc
Imported Upstream version 0.1.1
[roundcube.git] / program / steps / mail / viewsource.inc
index 5f10a569352b49a46944f9865f058ca1b18d8115..9ad8c142bbe194571c5fa5f70077b2252e6aba57 100644 (file)
@@ -5,7 +5,7 @@
  | program/steps/mail/viewsource.inc                                     |
  |                                                                       |
  | This file is part of the RoundCube Webmail client                     |
- | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
+ | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland                 |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | PURPOSE:                                                              |
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
 
- $Id: viewsource.inc 850 2007-10-03 00:13:32Z ihug $
+ $Id: viewsource.inc 1255 2008-04-05 12:49:21Z thomasb $
 
 */
 
 
 // similar code as in program/steps/mail/get.inc
 if ($uid = get_input_value('_uid', RCUBE_INPUT_GET))
-  {
-  header('Content-Type: text/plain');
-  //@ob_end_clean();
+{
+  $headers = $IMAP->get_headers($uid);
+  $charset = $headers->charset ? $headers->charset : $IMAP->default_charset;
+  header("Content-Type: text/plain; charset={$charset}");
   $IMAP->print_raw_body($uid);
-  }
+}
 else
-  {
-  raise_error(array('code' => 500,
-                    'type' => 'php',
-                    'message' => 'Message UID '.$uid.' not found'),
-              TRUE,
-              TRUE);
-  }
+{
+  raise_error(array(
+      'code' => 500,
+      'type' => 'php',
+      'message' => 'Message UID '.$uid.' not found'),
+    true,
+    true);
+}
 
 exit;
 ?>