Add Face header support to IMP
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 3 Dec 2009 20:40:09 +0000 (13:40 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 3 Dec 2009 21:53:39 +0000 (14:53 -0700)
imp/docs/CHANGES
imp/docs/RFCS
imp/message.php
imp/view.php

index 82b87f1..f4957a4 100644 (file)
@@ -2,6 +2,7 @@
 v5.0-git
 --------
 
+[mms] Add Face: header support to IMP.
 [mms] Add splitbar to resize sidebar in DIMP.
 [mms] Use LIST-EXTENDED IMAP extension (RFC 5258) to get subscribed
       mailbox information, if available.
index d83e608..69328f7 100644 (file)
@@ -134,3 +134,10 @@ RFC 3156
 
 RFC 3464
     - An Extensible Message Format for Delivery Status Notifications
+
+
+Non-RFC Features
+================
+
+Face Header (view support)
+    - http://quimby.gnus.org/circus/face/
index 49f8a69..a1bd913 100644 (file)
@@ -258,6 +258,14 @@ if (!empty($from_img)) {
     $display_headers['from'] .= '&nbsp;' . $from_img;
 }
 
+/* Look for Face: information. */
+if ($mime_headers->getValue('face')) {
+    $view_url = IMP::generateIMPUrl('view.php', $imp_mbox['mailbox'], $uid, $mailbox_name);
+    // TODO: Use Data URL
+    $view_url->add('actionID', 'view_face');
+    $display_headers['from'] .= '&nbsp;<img src="' . $view_url . '">';
+}
+
 /* Build To/Cc/Bcc links. */
 foreach (array('to', 'cc', 'bcc') as $val) {
     $msgAddresses[] = $mime_headers->getValue($val);
@@ -363,9 +371,6 @@ if ($next_msg) {
 /* Generate the mailbox link. */
 $mailbox_url = Horde_Util::addParameter(IMP::generateIMPUrl('mailbox.php', $imp_mbox['mailbox']), 'start', $msgindex);
 
-/* Generate the view link. */
-$view_link = IMP::generateIMPUrl('view.php', $imp_mbox['mailbox'], $uid, $mailbox_name);
-
 /* Everything below here is related to preparing the output. */
 
 /* Set the status information of the message. */
index 676b31b..039de9c 100644 (file)
@@ -10,6 +10,7 @@
  *   'download_render'
  *   'save_message'
  *   'view_attach'
+ *   'view_face'
  *   'view_source'
  * 'ctype' - (string) The content-type to use instead of the content-type
  *           found in the original Horde_Mime_Part object.
@@ -194,4 +195,13 @@ case 'save_message':
     rewind($msg);
     fpassthru($msg);
     break;
+
+case 'view_face':
+    $mime_headers = $contents->getHeaderOb();
+    if ($face = $mime_headers->getValue('face')) {
+        $face = base64_decode($face);
+        $browser->downloadHeaders(null, 'image/png', true, strlen($face));
+        echo $face;
+    }
+    break;
 }