6.0.0-alpha12
6/12/25

[#7891] hook msglist_format
Summary hook msglist_format
Queue IMP
Queue Version HEAD
Type Bug
State Resolved
Priority 1. Low
Owners slusarz (at) horde (dot) org
Requester rsalmon (at) mbpgroup (dot) com
Created 01/26/2009 (5981 days ago)
Due
Updated 01/12/2010 (5630 days ago)
Assigned 01/28/2009 (5979 days ago)
Resolved 01/29/2009 (5978 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
01/29/2009 05:21:07 PM Michael Slusarz Comment #6
State ⇒ Resolved
Reply to this comment
Guess I must have grepped the wrong file.  Regardless, the fixes 
listed in this ticket aren't correct - I have fixed the issues in Git 
master.
01/28/2009 03:47:14 PM Jan Schneider State ⇒ Assigned
Assigned to Michael Slusarz
 
01/28/2009 08:38:42 AM rsalmon (at) mbpgroup (dot) com Comment #5 Reply to this comment
Also,

in configuration tab  'Dynamic View (dimp) Options'

$conf[dimp][hooks][msglist_format]  = Should we use a custom function 
to provide additional information/custom formatting of messages in the 
mailbox message list? If so, make sure you define 
_dimp_hook_msglist_format() in config/hooks.php.





Is it using _dimp_hook_msglist_format() or _imp_hook_msglist_format() ? Typo ?




01/28/2009 08:28:53 AM rsalmon (at) mbpgroup (dot) com Comment #4 Reply to this comment
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;

     }

}
01/27/2009 07:07:09 PM Michael Slusarz Comment #3
State ⇒ Not A Bug
Reply to this comment
You are either not using IMP git, or you have not updated your hooks.php file.
01/26/2009 11:30:33 AM rsalmon (at) mbpgroup (dot) com Comment #2 Reply to this comment
  --- hooks.php.org        2009-01-26 12:21:21.000000000 +0100

  +++ hooks.php        2009-01-26 12:25:22.000000000 +0100

  @@ -220,7 +220,8 @@

           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) {


01/26/2009 11:26:53 AM rsalmon (at) mbpgroup (dot) com Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ hook msglist_format
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
I'm getting the following warnings when enabling $conf[hooks][msglist_format]



Notice: Undefined index: status in 
/var/www/html/horde/imp/config/hooks.php on line 245

Warning: array_merge() [function.array-merge]: Argument #1 is not an 
array in /var/www/html/horde/imp/mailbox.php on line 26



patches:

--- hooks.php.org        2009-01-26 12:21:21.000000000 +0100

+++ hooks.php        2009-01-26 12:25:22.000000000 +0100

@@ -220,7 +220,8 @@

          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) {



--- mailbox.php.org        2009-01-26 12:22:58.000000000 +0100

+++ mailbox.php        2009-01-26 12:26:31.000000000 +0100

@@ -23,7 +23,8 @@

              $ptr = &$msgs[$uid];



              if (!empty($val['class'])) {

-                $ptr['bg'] = array_merge($ptr['bg'], $val['class']);

+                $tmp['bg'] = $ptr['bg'];

+                $ptr['bg'] = array_merge($tmp, $val['class']);

              }



              if (!empty($val['flagbits'])) {


Saved Queries