[Tickets #7891] Re: hook msglist_format

bugs at horde.org bugs at horde.org
Wed Jan 28 08:28:53 UTC 2009


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/7891
------------------------------------------------------------------------------
  Ticket             | 7891
  Updated By         | rsalmon at mbpgroup.com
  Summary            | hook msglist_format
  Queue              | IMP
  Version            | Git master
  Type               | Bug
  State              | Not A Bug
  Priority           | 1. Low
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


rsalmon at mbpgroup.com (2009-01-28 03:28) wrote:

> You are either not using IMP git, or you have not updated your
> hooks.php file.

I do use imp from horde-hatchery
more horde/imp/docs/CHANGES
--------
v5.0-git
--------

[mms] Add ability to download attachments in MIMP (Request #2925).
[mms] Revamp JS event handling model.
[mms] ESC in DIMP search box now clears the search (Request #7196).
[mms] Enhancements to status icon view (Request #7519) (DIMP).
...


Here is the msglist_format hook (this is the only hook activated):

if (!function_exists('_imp_hook_msglist_format')) {
     function _imp_hook_msglist_format($mbox, $uids, $mode)
     {
         try {
             $imap_res = $GLOBALS['imp_imap']->ob->fetch($mbox, array(
                 Horde_Imap_Client::FETCH_HEADERS =>  
array(array('headers' => array('x-priority'), 'label' => 'hdr_search',  
'parse' => true, 'peek' => true)),
                 Horde_Imap_Client::FETCH_STRUCTURE => array('parse' => true)
             ), array('ids' => array_values($uids)));
         } catch (Horde_Imap_Client_Exception $e) {
             return array();
         }

         $alt_list = IMP_UI_Mailbox::getAttachmentAltList();
         $imp_ui = new IMP_UI_Mailbox($mbox);
         $imp_msg_ui = new IMP_UI_Message();
         $ret = array();

         foreach ($uids as $uid) {
             $tmp = array();
             $res_ptr = &$imap_res[$uid];
             $tmp['status'] = '';

             // Add attachment information
             if (($attachment =  
$imp_ui->getAttachmentType($res_ptr['structure']->getType()))) {
                 switch ($mode) {
                 case 'imp':
                     $alt_text = (isset($alt_list[$attachment]))
                         ? $alt_list[$attachment]
                         : $alt_list['attachment'];
                     $tmp['status'] = Horde::img($attachment . '.png',  
$alt_text, array('title' => $alt_text));
                     break;

                 case 'dimp':
                     $tmp['atc'] = $attachment;
                     break;
                 }
             }

             // Add X-Priority information
             switch  
($imp_msg_ui->getXpriority($res_ptr['headers']['hdr_search']->getValue('x-priority')))  
{
             case 'high':
                 if ($mode == 'imp') {
                     $tmp['flagbits'] = IMP::FLAG_FLAGGED;
                     $tmp['status'] .=  
Horde::img('mail_priority_high.png', _("High Priority"), array('title'  
=> _("High Priority")));
                 }
                 $tmp['class'][] = 'important';
                 break;

             case 'low':
                 if ($mode == 'imp') {
                     $tmp['status'] .=  
Horde::img('mail_priority_low.png', _("Low Priority"), array('title'  
=> _("Low Priority")));
                 }
                 $tmp['class'][] = 'unimportant';
                 break;
             }

             if (!empty($tmp)) {
                 $ret[$uid] = $tmp;
             }
         }

         return $ret;
     }
}






More information about the bugs mailing list