AW: [exim] Quota understanding problem

Pàgina inicial
Delete this message
Reply to this message
Autor: Silmar A. Marca
Data:  
A: exim-users
Assumpte: AW: [exim] Quota understanding problem
I use exim for delivery message and impose a filecount/size quotas.
The courier-imap is used only for show this quota (it using a maildirsize file
to show this).
If use a IMP webmail, courier-imap and exim, the webmail show quota sucessfully.

Imp file ./horde/imp/config/conf.php (imp v3.2, horde 2.2)

---------------------------------------------------
$conf['hooks']['quota'] = 'imp_show_quota';

 if (!function_exists('imp_show_quota')) {
    function imp_show_quota ($imp) {
         $quota_html = '';
         $imap_admin = $imp['user'];
         $imap_passwd = Secret::read(Secret::getKey('imp'), $imp['pass']);


         $stream = @imap_open(IMP::serverString(), $imap_admin, $imap_passwd,
OP_HALFOPEN);
         $quota = @imap_get_quota($stream, 'ROOT');
         imap_close($stream);
         if (is_array($quota) && isset($quota['STORAGE']) &&
isset($quota['MESSAGE'])) {
             $storage = $quota['STORAGE'];
             $storage_usage   = $storage['usage'] / 1024.0;
             $storage_limit   = $storage['limit'] / 1024.0;
             $storage_percent = $storage_usage * 100 / $storage_limit;
             $message = $quota['MESSAGE'];
             $message_usage   = $message['usage'];
             $message_limit   = $message['limit'];
             $message_percent = $message_usage * 100 / $message_limit;
             if (($storage_percent >= 90) || ($message_percent >= 90)) {
                 $class = 'quotaalert';
             } elseif (($storage_percent >= 75) || ($message_percent >= 75)) {
                 $class = 'quotawarn';
             } else {
                 $class = 'control';
             }
             $quota_html = '<table width="100%" border="0" cellpadding="0"
cellspacing="0"><tr><td class="item">'
                           . '<table border="0" cellspacing="2" cellpadding="2"
width="100%"><tr><td align="center" class="'. $class . '">'
                           . sprintf('<b>' . _('Size') . '</b>: ' ) . 
sprintf("%.2fMB / %.2fMB  (%.2f%%)", $storage_usage, $storage_limit,
$storage_percent)
                           . ' - <b>Msgs</b>: ' .  sprintf("%.0f / %.0f 
(%.2f%%)", $message_usage, $message_limit, $message_percent)
                           . '</td></tr></table></td></tr></table>';
         }
         return $quota_html;
     }
 }
---------------------------------------------------



Cordialmente, Silmar A. Marca
GrupoGSN - Desenvolvimento, Implantação e Verificação de Servidores
Profissionais baseados em Linux/Novell
http://www.grupogsn.com.br/~marca/
------------------------------------------------------------
Se algo não lhe faz mal (fisico, moral ou psicologicamente),
experimente! O máximo e você perder tempo! E tempo, e
o que você tem a vida toda pra perder.....
Mais vale um instante de prazer que uma eternidade fútil!
------------------------------------------------------------