[Svn] r3898 - trunk/roundcubemail/program/steps/mail

trac at roundcube.net trac at roundcube.net
Mon Aug 16 12:07:28 CEST 2010


Author: alec
Date: 2010-08-16 05:07:28 -0500 (Mon, 16 Aug 2010)
New Revision: 3898

Modified:
   trunk/roundcubemail/program/steps/mail/func.inc
Log:
- Added 'message_body_prefix' hook. Now it's possible to add some HTML code
  before every displayed part of the message.


Modified: trunk/roundcubemail/program/steps/mail/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/func.inc	2010-08-13 19:21:21 UTC (rev 3897)
+++ trunk/roundcubemail/program/steps/mail/func.inc	2010-08-16 10:07:28 UTC (rev 3898)
@@ -944,7 +944,7 @@
  */
 function rcmail_message_body($attrib)
   {
-  global $CONFIG, $OUTPUT, $MESSAGE, $IMAP, $REMOTE_OBJECTS;
+  global $CONFIG, $OUTPUT, $MESSAGE, $IMAP, $RCMAIL, $REMOTE_OBJECTS;
 
   if (!is_array($MESSAGE->parts) && empty($MESSAGE->body))
     return '';
@@ -980,6 +980,9 @@
           rcmail_message_error($MESSAGE->uid);
         }
 
+        $plugin = $RCMAIL->plugins->exec_hook('message_body_prefix', array(
+          'part' => $part, 'prefix' => ''));
+
         // re-format format=flowed content
         if ($part->ctype_secondary == "plain" && $part->ctype_parameters['format'] == "flowed")
           $part->body = rcube_message::unfold_flowed($part->body);
@@ -998,16 +1001,20 @@
           if (!empty($style))
             $div_attr['style'] = implode('; ', $style);
 
-          $out .= html::div($div_attr, $body);
+          $out .= html::div($div_attr, $plugin['prefix'] . $body);
         }
         else
-          $out .= html::div('message-part', $body);
+          $out .= html::div('message-part', $plugin['prefix'] . $body);
         }
       }
     }
-  else
-    $out .= html::div('message-part', html::tag('pre', array(),
+  else {
+    $plugin = $RCMAIL->plugins->exec_hook('message_body_prefix', array(
+      'part' => $MESSAGE, 'prefix' => ''));
+
+    $out .= html::div('message-part', $plugin['prefix'] . html::tag('pre', array(),
       rcmail_plain_body(Q($MESSAGE->body, 'strict', false))));
+    }
 
   $ctype_primary = strtolower($MESSAGE->structure->ctype_primary);
   $ctype_secondary = strtolower($MESSAGE->structure->ctype_secondary);

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list