From 384948886c4a1bedb17318af63c944c33ae0b3b6 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 13 Jul 2012 14:16:52 -0400
Subject: [PATCH] Prepare to show contact photo of email sender in mail views

---
 program/steps/mail/show.inc |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 5fa72d7..70c0833 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -266,11 +266,25 @@
   return false;
 }
 
+function rcmail_message_contactphoto($attrib)
+{
+  global $RCMAIL, $MESSAGE;
+
+  $placeholder = $attrib['placeholder'] ? $RCMAIL->config->get('skin_path') . $attrib['placeholder'] : null;
+  if ($MESSAGE->sender)
+    $photo_img = $RCMAIL->url(array('_task' => 'addressbook', '_action' => 'photo', '_email' => $MESSAGE->sender['mailto'], '_alt' => $placeholder));
+  else
+    $photo_img = $placeholder ? $placeholder : 'program/blank.gif';
+
+  return html::img(array('src' => $photo_img) + $attrib);
+}
+
 
 $OUTPUT->add_handlers(array(
   'messageattachments' => 'rcmail_message_attachments',
   'mailboxname' => 'rcmail_mailbox_name_display',
   'messageobjects' => 'rcmail_message_objects',
+  'contactphoto' => 'rcmail_message_contactphoto',
 ));
 
 

--
Gitblit v1.9.1