[imp] Mailbox Size Hack

Karl J. Smalley Karl.Smalley at mail.jci.tju.edu
Fri Aug 12 08:48:12 PDT 2005


I have a "Mailbox size" hack that I have installed in Imp: H3 (4.0.3) under
Horde: 3.0.5 .  It just adds the size of the mailbox on to the "Message n to n
of n" message at the top of the mailbox listing.

I know that the Horde group is always aksing people to submit such things. What
is the proper way to submit this and is it worth submitting. Here is the code
anyway, for those that want it:

in imp/mailbox.php 

change:

    $msg_count = sprintf(_("%d to %d of %d Messages"), $pageOb->begin,
$pageOb->end, $pageOb->msgcount);

to 
    $msg_count = sprintf(_("%d to %d of %d Messages  %s"), $pageOb->begin,
$pageOb->end, $pageOb->msgcount,$pageOb->mbxsize);



in imp/lib/Mailbox.php

In function buildMailboxPage

add the lines 
       // Mailbox size hack by KJS (8-11-05)
       //
       $info = imap_mailboxmsginfo($imp['stream']);
       $nsize = $info->Size;
       $size = sprintf("%d bytes",$nsize);
       if ($nsize > 1024)
       {
               $nsize = $nsize/1024;
               $size = sprintf("%.1f KB", $nsize);
               if ($nsize > 1024)
               {
                       $nsize = $nsize/1024;
                       $size = sprintf("%.1f MB", $nsize);
               }
       }
       $mbxsize = " (" . $size . ")";
       // End mailbox size calculations -- added it to class that gets returned
below  - KJS 8-11-05

after the line

 $msgcount = $this->getMessageCount();




Also in lib/Mailbox.php same function 

add 

       /* mbxsize added to objext by KJS 8-11-05 */
       $ob->mbxsize = $mbxsize;
after

       $ob = new stdClass;
       $ob->anymsg    = $anymsg;
       $ob->begin     = $begin;
       $ob->end       = $end;
       $ob->index     = $beginIndex;
       $ob->msgcount  = $msgcount;
       $ob->page      = $page;
       $ob->pagecount = $pageCount;


I'd be more than willing to submit this in the proper format if someone can send
me the directions.


-- 
----------------------------------------------------------------------
Karl J. Smalley
Systems Analyst                         Snail Mail:
                                         Kimmel Cancer Center
Phone:  (215) 503-4602                   Thomas Jefferson University
FAX:    (215) 955-9093                   812 BLSB, 233 S. 10th St.
E-Mail: Karl.Smalley at mail.jci.tju.edu    Philadelphia, PA 19107
WWW:    http://www.jci.tju.edu/~karl

"Mate in 3" - The sweetest words I have ever heard myself utter.
*******  This is  a Chess Phrase and nothing more **********
-----------------------------------------------------------------------


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


More information about the imp mailing list